repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
18
192
func_name
stringlengths
5
108
whole_func_string
stringlengths
75
3.91k
language
stringclasses
1 value
func_code_string
stringlengths
75
3.91k
func_code_tokens
listlengths
21
629
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
111
306
UrielCh/ovh-java-sdk
ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java
ApiOvhEmaildomain.domain_account_accountName_filter_name_rule_POST
public OvhTaskFilter domain_account_accountName_filter_name_rule_POST(String domain, String accountName, String name, String header, OvhDomainFilterOperandEnum operand, String value) throws IOException { String qPath = "/email/domain/{domain}/account/{accountName}/filter/{name}/rule"; StringBuilder sb = path(qPath, domain, accountName, name); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "header", header); addBody(o, "operand", operand); addBody(o, "value", value); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTaskFilter.class); }
java
public OvhTaskFilter domain_account_accountName_filter_name_rule_POST(String domain, String accountName, String name, String header, OvhDomainFilterOperandEnum operand, String value) throws IOException { String qPath = "/email/domain/{domain}/account/{accountName}/filter/{name}/rule"; StringBuilder sb = path(qPath, domain, accountName, name); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "header", header); addBody(o, "operand", operand); addBody(o, "value", value); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTaskFilter.class); }
[ "public", "OvhTaskFilter", "domain_account_accountName_filter_name_rule_POST", "(", "String", "domain", ",", "String", "accountName", ",", "String", "name", ",", "String", "header", ",", "OvhDomainFilterOperandEnum", "operand", ",", "String", "value", ")", "throws", "IO...
Create new rule for filter REST: POST /email/domain/{domain}/account/{accountName}/filter/{name}/rule @param value [required] Rule parameter of filter @param operand [required] Rule of filter @param header [required] Header to be filtered @param domain [required] Name of your domain name @param accountName [required] Name of account @param name [required] Filter name
[ "Create", "new", "rule", "for", "filter" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emaildomain/src/main/java/net/minidev/ovh/api/ApiOvhEmaildomain.java#L703-L712
haraldk/TwelveMonkeys
common/common-image/src/main/java/com/twelvemonkeys/image/IndexImage.java
IndexImage.getIndexedImage
public static BufferedImage getIndexedImage(BufferedImage pImage, int pNumberOfColors, int pHints) { return getIndexedImage(pImage, pNumberOfColors, null, pHints); }
java
public static BufferedImage getIndexedImage(BufferedImage pImage, int pNumberOfColors, int pHints) { return getIndexedImage(pImage, pNumberOfColors, null, pHints); }
[ "public", "static", "BufferedImage", "getIndexedImage", "(", "BufferedImage", "pImage", ",", "int", "pNumberOfColors", ",", "int", "pHints", ")", "{", "return", "getIndexedImage", "(", "pImage", ",", "pNumberOfColors", ",", "null", ",", "pHints", ")", ";", "}" ]
Converts the input image (must be {@code TYPE_INT_RGB} or {@code TYPE_INT_ARGB}) to an indexed image. Generating an adaptive palette with the given number of colors. Dithering, transparency and color selection is controlled with the {@code pHints}parameter. <p/> The image returned is a new image, the input image is not modified. @param pImage the BufferedImage to index @param pNumberOfColors the number of colors for the image @param pHints hints that control output quality and speed. @return the indexed BufferedImage. The image will be of type {@code BufferedImage.TYPE_BYTE_INDEXED} or {@code BufferedImage.TYPE_BYTE_BINARY}, and use an {@code IndexColorModel}. @see #DITHER_DIFFUSION @see #DITHER_NONE @see #COLOR_SELECTION_FAST @see #COLOR_SELECTION_QUALITY @see #TRANSPARENCY_OPAQUE @see #TRANSPARENCY_BITMASK @see BufferedImage#TYPE_BYTE_INDEXED @see BufferedImage#TYPE_BYTE_BINARY @see IndexColorModel
[ "Converts", "the", "input", "image", "(", "must", "be", "{", "@code", "TYPE_INT_RGB", "}", "or", "{", "@code", "TYPE_INT_ARGB", "}", ")", "to", "an", "indexed", "image", ".", "Generating", "an", "adaptive", "palette", "with", "the", "given", "number", "of"...
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/common/common-image/src/main/java/com/twelvemonkeys/image/IndexImage.java#L1092-L1094
igniterealtime/Smack
smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java
JingleSession.createJingleError
public IQ createJingleError(IQ iq, JingleError jingleError) { IQ errorPacket = null; if (jingleError != null) { // TODO This is wrong according to XEP-166 § 10, but this jingle implementation is deprecated anyways StanzaError.Builder builder = StanzaError.getBuilder(StanzaError.Condition.undefined_condition); builder.addExtension(jingleError); errorPacket = IQ.createErrorResponse(iq, builder); // errorPacket.addExtension(jingleError); // NO! Let the normal state machinery do all of the sending. // getConnection().sendStanza(perror); LOGGER.severe("Error sent: " + errorPacket.toXML()); } return errorPacket; }
java
public IQ createJingleError(IQ iq, JingleError jingleError) { IQ errorPacket = null; if (jingleError != null) { // TODO This is wrong according to XEP-166 § 10, but this jingle implementation is deprecated anyways StanzaError.Builder builder = StanzaError.getBuilder(StanzaError.Condition.undefined_condition); builder.addExtension(jingleError); errorPacket = IQ.createErrorResponse(iq, builder); // errorPacket.addExtension(jingleError); // NO! Let the normal state machinery do all of the sending. // getConnection().sendStanza(perror); LOGGER.severe("Error sent: " + errorPacket.toXML()); } return errorPacket; }
[ "public", "IQ", "createJingleError", "(", "IQ", "iq", ",", "JingleError", "jingleError", ")", "{", "IQ", "errorPacket", "=", "null", ";", "if", "(", "jingleError", "!=", "null", ")", "{", "// TODO This is wrong according to XEP-166 § 10, but this jingle implementation i...
Complete and send an error. Complete all the null fields in an IQ error response, using the session information we have or some info from the incoming packet. @param iq The Jingle stanza we are responding to @param jingleError the IQ stanza we want to complete and send
[ "Complete", "and", "send", "an", "error", ".", "Complete", "all", "the", "null", "fields", "in", "an", "IQ", "error", "response", "using", "the", "session", "information", "we", "have", "or", "some", "info", "from", "the", "incoming", "packet", "." ]
train
https://github.com/igniterealtime/Smack/blob/870756997faec1e1bfabfac0cd6c2395b04da873/smack-jingle-old/src/main/java/org/jivesoftware/smackx/jingleold/JingleSession.java#L1052-L1068
exoplatform/jcr
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
CacheableWorkspaceDataManager.getCachedItemData
protected ItemData getCachedItemData(NodeData parentData, QPathEntry name, ItemType itemType) throws RepositoryException { return cache.isEnabled() ? cache.get(parentData.getIdentifier(), name, itemType) : null; }
java
protected ItemData getCachedItemData(NodeData parentData, QPathEntry name, ItemType itemType) throws RepositoryException { return cache.isEnabled() ? cache.get(parentData.getIdentifier(), name, itemType) : null; }
[ "protected", "ItemData", "getCachedItemData", "(", "NodeData", "parentData", ",", "QPathEntry", "name", ",", "ItemType", "itemType", ")", "throws", "RepositoryException", "{", "return", "cache", ".", "isEnabled", "(", ")", "?", "cache", ".", "get", "(", "parentD...
Get cached ItemData. @param parentData parent @param name Item name @param itemType item type @return ItemData @throws RepositoryException error
[ "Get", "cached", "ItemData", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java#L1284-L1288
Deep-Symmetry/beat-link
src/main/java/org/deepsymmetry/beatlink/BeatFinder.java
BeatFinder.isPacketLongEnough
private boolean isPacketLongEnough(DatagramPacket packet, int expectedLength, String name) { final int length = packet.getLength(); if (length < expectedLength) { logger.warn("Ignoring too-short " + name + " packet; expecting " + expectedLength + " bytes and got " + length + "."); return false; } if (length > expectedLength) { logger.warn("Processing too-long " + name + " packet; expecting " + expectedLength + " bytes and got " + length + "."); } return true; }
java
private boolean isPacketLongEnough(DatagramPacket packet, int expectedLength, String name) { final int length = packet.getLength(); if (length < expectedLength) { logger.warn("Ignoring too-short " + name + " packet; expecting " + expectedLength + " bytes and got " + length + "."); return false; } if (length > expectedLength) { logger.warn("Processing too-long " + name + " packet; expecting " + expectedLength + " bytes and got " + length + "."); } return true; }
[ "private", "boolean", "isPacketLongEnough", "(", "DatagramPacket", "packet", ",", "int", "expectedLength", ",", "String", "name", ")", "{", "final", "int", "length", "=", "packet", ".", "getLength", "(", ")", ";", "if", "(", "length", "<", "expectedLength", ...
Helper method to check that we got the right size packet. @param packet a packet that has been received @param expectedLength the number of bytes we expect it to contain @param name the description of the packet in case we need to report issues with the length @return {@code true} if enough bytes were received to process the packet
[ "Helper", "method", "to", "check", "that", "we", "got", "the", "right", "size", "packet", "." ]
train
https://github.com/Deep-Symmetry/beat-link/blob/f958a2a70e8a87a31a75326d7b4db77c2f0b4212/src/main/java/org/deepsymmetry/beatlink/BeatFinder.java#L72-L86
jbundle/jbundle
base/screen/control/servlet/src/main/java/org/jbundle/base/screen/control/servlet/html/HTMLServlet.java
HTMLServlet.addBrowserProperties
public void addBrowserProperties(HttpServletRequest req, PropertyOwner servletTask) { String strBrowser = this.getBrowser(req); String strOS = this.getOS(req); servletTask.setProperty(DBParams.BROWSER, strBrowser); servletTask.setProperty(DBParams.OS, strOS); }
java
public void addBrowserProperties(HttpServletRequest req, PropertyOwner servletTask) { String strBrowser = this.getBrowser(req); String strOS = this.getOS(req); servletTask.setProperty(DBParams.BROWSER, strBrowser); servletTask.setProperty(DBParams.OS, strOS); }
[ "public", "void", "addBrowserProperties", "(", "HttpServletRequest", "req", ",", "PropertyOwner", "servletTask", ")", "{", "String", "strBrowser", "=", "this", ".", "getBrowser", "(", "req", ")", ";", "String", "strOS", "=", "this", ".", "getOS", "(", "req", ...
Add the browser properties to this servlet task. @param req @param servletTask
[ "Add", "the", "browser", "properties", "to", "this", "servlet", "task", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/screen/control/servlet/src/main/java/org/jbundle/base/screen/control/servlet/html/HTMLServlet.java#L154-L160
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/BidiOrder.java
BidiOrder.setLevels
private void setLevels(int start, int limit, byte newLevel) { for (int i = start; i < limit; ++i) { resultLevels[i] = newLevel; } }
java
private void setLevels(int start, int limit, byte newLevel) { for (int i = start; i < limit; ++i) { resultLevels[i] = newLevel; } }
[ "private", "void", "setLevels", "(", "int", "start", ",", "int", "limit", ",", "byte", "newLevel", ")", "{", "for", "(", "int", "i", "=", "start", ";", "i", "<", "limit", ";", "++", "i", ")", "{", "resultLevels", "[", "i", "]", "=", "newLevel", "...
Set resultLevels from start up to (but not including) limit to newLevel.
[ "Set", "resultLevels", "from", "start", "up", "to", "(", "but", "not", "including", ")", "limit", "to", "newLevel", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/BidiOrder.java#L1068-L1072
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/SQLInLoop.java
SQLInLoop.sawOpcode
@Override public void sawOpcode(int seen) { if (seen == Const.INVOKEINTERFACE) { String clsName = getClassConstantOperand(); String methodName = getNameConstantOperand(); if (queryClasses.contains(clsName) && queryMethods.contains(methodName)) { queryLocations.add(Integer.valueOf(getPC())); } } else if (OpcodeUtils.isBranch(seen)) { int branchTarget = getBranchTarget(); int pc = getPC(); if (branchTarget < pc) { loops.add(new LoopLocation(branchTarget, pc)); } } }
java
@Override public void sawOpcode(int seen) { if (seen == Const.INVOKEINTERFACE) { String clsName = getClassConstantOperand(); String methodName = getNameConstantOperand(); if (queryClasses.contains(clsName) && queryMethods.contains(methodName)) { queryLocations.add(Integer.valueOf(getPC())); } } else if (OpcodeUtils.isBranch(seen)) { int branchTarget = getBranchTarget(); int pc = getPC(); if (branchTarget < pc) { loops.add(new LoopLocation(branchTarget, pc)); } } }
[ "@", "Override", "public", "void", "sawOpcode", "(", "int", "seen", ")", "{", "if", "(", "seen", "==", "Const", ".", "INVOKEINTERFACE", ")", "{", "String", "clsName", "=", "getClassConstantOperand", "(", ")", ";", "String", "methodName", "=", "getNameConstan...
implements the visitor to collect positions of queries and loops @param seen the opcode of the currently parsed instruction
[ "implements", "the", "visitor", "to", "collect", "positions", "of", "queries", "and", "loops" ]
train
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/SQLInLoop.java#L107-L123
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/util/MainApplication.java
MainApplication.retrieveUserProperties
public PropertyOwner retrieveUserProperties(String strRegistrationKey) { if ((strRegistrationKey == null) || (strRegistrationKey.length() == 0)) return this; // Use default user properties UserProperties regKey = (UserProperties)m_htRegistration.get(strRegistrationKey); if (regKey == null) regKey = new UserProperties(this, strRegistrationKey); regKey.bumpUseCount(+1); return regKey; }
java
public PropertyOwner retrieveUserProperties(String strRegistrationKey) { if ((strRegistrationKey == null) || (strRegistrationKey.length() == 0)) return this; // Use default user properties UserProperties regKey = (UserProperties)m_htRegistration.get(strRegistrationKey); if (regKey == null) regKey = new UserProperties(this, strRegistrationKey); regKey.bumpUseCount(+1); return regKey; }
[ "public", "PropertyOwner", "retrieveUserProperties", "(", "String", "strRegistrationKey", ")", "{", "if", "(", "(", "strRegistrationKey", "==", "null", ")", "||", "(", "strRegistrationKey", ".", "length", "(", ")", "==", "0", ")", ")", "return", "this", ";", ...
Retrieve/Create a user properties record with this lookup key. User properties are accessed in two ways. <br/>First, if you pass a null, you get the default top-level user properties (such as background color, fonts, etc.). <br/>Second, if you pass a registration key, you get a property database for that specific key (such as screen field default values, specific screen sizes, etc). @param strPropertyCode The key I'm looking up (null for the default user's properties). @return The UserProperties for this registration key.
[ "Retrieve", "/", "Create", "a", "user", "properties", "record", "with", "this", "lookup", "key", ".", "User", "properties", "are", "accessed", "in", "two", "ways", ".", "<br", "/", ">", "First", "if", "you", "pass", "a", "null", "you", "get", "the", "d...
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/util/MainApplication.java#L580-L589
zaproxy/zaproxy
src/org/zaproxy/zap/extension/script/ScriptVars.java
ScriptVars.setGlobalVar
public static void setGlobalVar(String key, String value) { validateKey(key); if (value == null) { globalVars.remove(key); } else { validateValueLength(value); if (globalVars.size() > MAX_GLOBAL_VARS) { throw new IllegalArgumentException("Maximum number of global variables reached: " + MAX_GLOBAL_VARS); } globalVars.put(key, value); } }
java
public static void setGlobalVar(String key, String value) { validateKey(key); if (value == null) { globalVars.remove(key); } else { validateValueLength(value); if (globalVars.size() > MAX_GLOBAL_VARS) { throw new IllegalArgumentException("Maximum number of global variables reached: " + MAX_GLOBAL_VARS); } globalVars.put(key, value); } }
[ "public", "static", "void", "setGlobalVar", "(", "String", "key", ",", "String", "value", ")", "{", "validateKey", "(", "key", ")", ";", "if", "(", "value", "==", "null", ")", "{", "globalVars", ".", "remove", "(", "key", ")", ";", "}", "else", "{", ...
Sets or removes a global variable. <p> The variable is removed when the {@code value} is {@code null}. @param key the key of the variable. @param value the value of the variable. @throws IllegalArgumentException if one of the following conditions is met: <ul> <li>The {@code key} is {@code null} or its length is higher than the maximum allowed ({@value #MAX_KEY_SIZE});</li> <li>The {@code value}'s length is higher than the maximum allowed ({@value #MAX_VALUE_SIZE});</li> <li>The number of global variables is higher than the maximum allowed ({@value #MAX_GLOBAL_VARS});</li> </ul>
[ "Sets", "or", "removes", "a", "global", "variable", ".", "<p", ">", "The", "variable", "is", "removed", "when", "the", "{", "@code", "value", "}", "is", "{", "@code", "null", "}", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/script/ScriptVars.java#L79-L91
undertow-io/undertow
core/src/main/java/io/undertow/server/handlers/resource/PathResourceManager.java
PathResourceManager.getSymlinkBase
private SymlinkResult getSymlinkBase(final String base, final Path file) throws IOException { int nameCount = file.getNameCount(); Path root = fileSystem.getPath(base); int rootCount = root.getNameCount(); Path f = file; for (int i = nameCount - 1; i>=0; i--) { if (Files.isSymbolicLink(f)) { return new SymlinkResult(i+1 > rootCount, f); } f = f.getParent(); } return null; }
java
private SymlinkResult getSymlinkBase(final String base, final Path file) throws IOException { int nameCount = file.getNameCount(); Path root = fileSystem.getPath(base); int rootCount = root.getNameCount(); Path f = file; for (int i = nameCount - 1; i>=0; i--) { if (Files.isSymbolicLink(f)) { return new SymlinkResult(i+1 > rootCount, f); } f = f.getParent(); } return null; }
[ "private", "SymlinkResult", "getSymlinkBase", "(", "final", "String", "base", ",", "final", "Path", "file", ")", "throws", "IOException", "{", "int", "nameCount", "=", "file", ".", "getNameCount", "(", ")", ";", "Path", "root", "=", "fileSystem", ".", "getPa...
Returns true is some element of path inside base path is a symlink.
[ "Returns", "true", "is", "some", "element", "of", "path", "inside", "base", "path", "is", "a", "symlink", "." ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/server/handlers/resource/PathResourceManager.java#L300-L313
apache/groovy
src/main/java/org/codehaus/groovy/runtime/ProcessGroovyMethods.java
ProcessGroovyMethods.consumeProcessOutput
public static void consumeProcessOutput(Process self, OutputStream output, OutputStream error) { consumeProcessOutputStream(self, output); consumeProcessErrorStream(self, error); }
java
public static void consumeProcessOutput(Process self, OutputStream output, OutputStream error) { consumeProcessOutputStream(self, output); consumeProcessErrorStream(self, error); }
[ "public", "static", "void", "consumeProcessOutput", "(", "Process", "self", ",", "OutputStream", "output", ",", "OutputStream", "error", ")", "{", "consumeProcessOutputStream", "(", "self", ",", "output", ")", ";", "consumeProcessErrorStream", "(", "self", ",", "e...
Gets the output and error streams from a process and reads them to keep the process from blocking due to a full output buffer. The processed stream data is appended to the supplied OutputStream. For this, two Threads are started, so this method will return immediately. The threads will not be join()ed, even if waitFor() is called. To wait for the output to be fully consumed call waitForProcessOutput(). @param self a Process @param output an OutputStream to capture the process stdout @param error an OutputStream to capture the process stderr @since 1.5.2
[ "Gets", "the", "output", "and", "error", "streams", "from", "a", "process", "and", "reads", "them", "to", "keep", "the", "process", "from", "blocking", "due", "to", "a", "full", "output", "buffer", ".", "The", "processed", "stream", "data", "is", "appended...
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ProcessGroovyMethods.java#L205-L208
xwiki/xwiki-rendering
xwiki-rendering-wikimodel/src/main/java/org/xwiki/rendering/wikimodel/WikiPageUtil.java
WikiPageUtil.isValidXmlNameStartChar
public static boolean isValidXmlNameStartChar(char ch, boolean colonEnabled) { if (ch == ':') { return colonEnabled; } return (ch >= 'A' && ch <= 'Z') || ch == '_' || (ch >= 'a' && ch <= 'z') || (ch >= 0xC0 && ch <= 0xD6) || (ch >= 0xD8 && ch <= 0xF6) || (ch >= 0xF8 && ch <= 0x2FF) || (ch >= 0x370 && ch <= 0x37D) || (ch >= 0x37F && ch <= 0x1FFF) || (ch >= 0x200C && ch <= 0x200D) || (ch >= 0x2070 && ch <= 0x218F) || (ch >= 0x2C00 && ch <= 0x2FEF) || (ch >= 0x3001 && ch <= 0xD7FF) || (ch >= 0xF900 && ch <= 0xFDCF) || (ch >= 0xFDF0 && ch <= 0xFFFD) || (ch >= 0x10000 && ch <= 0xEFFFF); }
java
public static boolean isValidXmlNameStartChar(char ch, boolean colonEnabled) { if (ch == ':') { return colonEnabled; } return (ch >= 'A' && ch <= 'Z') || ch == '_' || (ch >= 'a' && ch <= 'z') || (ch >= 0xC0 && ch <= 0xD6) || (ch >= 0xD8 && ch <= 0xF6) || (ch >= 0xF8 && ch <= 0x2FF) || (ch >= 0x370 && ch <= 0x37D) || (ch >= 0x37F && ch <= 0x1FFF) || (ch >= 0x200C && ch <= 0x200D) || (ch >= 0x2070 && ch <= 0x218F) || (ch >= 0x2C00 && ch <= 0x2FEF) || (ch >= 0x3001 && ch <= 0xD7FF) || (ch >= 0xF900 && ch <= 0xFDCF) || (ch >= 0xFDF0 && ch <= 0xFFFD) || (ch >= 0x10000 && ch <= 0xEFFFF); }
[ "public", "static", "boolean", "isValidXmlNameStartChar", "(", "char", "ch", ",", "boolean", "colonEnabled", ")", "{", "if", "(", "ch", "==", "'", "'", ")", "{", "return", "colonEnabled", ";", "}", "return", "(", "ch", ">=", "'", "'", "&&", "ch", "<=",...
Returns <code>true</code> if the given value is a valid first character of an XML name. <p> See http://www.w3.org/TR/xml/#NT-NameStartChar. </p> @param ch the character to check @param colonEnabled if this flag is <code>true</code> then this method accepts the ':' symbol. @return <code>true</code> if the given value is a valid first character for an XML name
[ "Returns", "<code", ">", "true<", "/", "code", ">", "if", "the", "given", "value", "is", "a", "valid", "first", "character", "of", "an", "XML", "name", ".", "<p", ">", "See", "http", ":", "//", "www", ".", "w3", ".", "org", "/", "TR", "/", "xml",...
train
https://github.com/xwiki/xwiki-rendering/blob/a21cdfcb64ef5b76872e3eedf78c530f26d7beb0/xwiki-rendering-wikimodel/src/main/java/org/xwiki/rendering/wikimodel/WikiPageUtil.java#L291-L311
Jacksgong/JKeyboardPanelSwitch
library/src/main/java/cn/dreamtobe/kpswitch/util/KPSwitchConflictUtil.java
KPSwitchConflictUtil.switchPanelAndKeyboard
public static boolean switchPanelAndKeyboard(final View panelLayout, final View focusView) { boolean switchToPanel = panelLayout.getVisibility() != View.VISIBLE; if (!switchToPanel) { showKeyboard(panelLayout, focusView); } else { showPanel(panelLayout); } return switchToPanel; }
java
public static boolean switchPanelAndKeyboard(final View panelLayout, final View focusView) { boolean switchToPanel = panelLayout.getVisibility() != View.VISIBLE; if (!switchToPanel) { showKeyboard(panelLayout, focusView); } else { showPanel(panelLayout); } return switchToPanel; }
[ "public", "static", "boolean", "switchPanelAndKeyboard", "(", "final", "View", "panelLayout", ",", "final", "View", "focusView", ")", "{", "boolean", "switchToPanel", "=", "panelLayout", ".", "getVisibility", "(", ")", "!=", "View", ".", "VISIBLE", ";", "if", ...
If the keyboard is showing, then going to show the {@code panelLayout}, and hide the keyboard with non-layout-conflict. <p/> If the panel is showing, then going to show the keyboard, and hide the {@code panelLayout} with non-layout-conflict. <p/> If the panel and the keyboard are both hiding. then going to show the {@code panelLayout} with non-layout-conflict. @param panelLayout the layout of panel. @param focusView the view will be focused or lose the focus. @return If true, switch to showing {@code panelLayout}; If false, switch to showing Keyboard.
[ "If", "the", "keyboard", "is", "showing", "then", "going", "to", "show", "the", "{", "@code", "panelLayout", "}", "and", "hide", "the", "keyboard", "with", "non", "-", "layout", "-", "conflict", ".", "<p", "/", ">", "If", "the", "panel", "is", "showing...
train
https://github.com/Jacksgong/JKeyboardPanelSwitch/blob/092128023e824c85da63540780c79088b37a0c74/library/src/main/java/cn/dreamtobe/kpswitch/util/KPSwitchConflictUtil.java#L227-L236
google/flogger
api/src/main/java/com/google/common/flogger/backend/Platform.java
Platform.shouldForceLogging
public static boolean shouldForceLogging(String loggerName, Level level, boolean isEnabled) { return LazyHolder.INSTANCE.shouldForceLoggingImpl(loggerName, level, isEnabled); }
java
public static boolean shouldForceLogging(String loggerName, Level level, boolean isEnabled) { return LazyHolder.INSTANCE.shouldForceLoggingImpl(loggerName, level, isEnabled); }
[ "public", "static", "boolean", "shouldForceLogging", "(", "String", "loggerName", ",", "Level", "level", ",", "boolean", "isEnabled", ")", "{", "return", "LazyHolder", ".", "INSTANCE", ".", "shouldForceLoggingImpl", "(", "loggerName", ",", "level", ",", "isEnabled...
Returns whether the given logger should have logging forced at the specified level. When logging is forced for a log statement it will be emitted regardless or the normal log level configuration of the logger and ignoring any rate limiting or other filtering. <p> This method is intended to be invoked unconditionally from a fluent logger's {@code at(Level)} method to permit overriding of default logging behavior. @param loggerName the fully qualified logger name (e.g. "com.example.SomeClass") @param level the level of the log statement being invoked @param isEnabled whether the logger is enabled at the given level (i.e. the result of calling {@code isLoggable()} on the backend instance)
[ "Returns", "whether", "the", "given", "logger", "should", "have", "logging", "forced", "at", "the", "specified", "level", ".", "When", "logging", "is", "forced", "for", "a", "log", "statement", "it", "will", "be", "emitted", "regardless", "or", "the", "norma...
train
https://github.com/google/flogger/blob/a164967a93a9f4ce92f34319fc0cc7c91a57321c/api/src/main/java/com/google/common/flogger/backend/Platform.java#L175-L177
stephanenicolas/toothpick
toothpick-runtime/src/main/java/toothpick/ScopeImpl.java
ScopeImpl.installUnBoundProvider
private <T> InternalProviderImpl<? extends T> installUnBoundProvider(Class<T> clazz, String bindingName, InternalProviderImpl<? extends T> internalProvider) { return installInternalProvider(clazz, bindingName, internalProvider, false, false); }
java
private <T> InternalProviderImpl<? extends T> installUnBoundProvider(Class<T> clazz, String bindingName, InternalProviderImpl<? extends T> internalProvider) { return installInternalProvider(clazz, bindingName, internalProvider, false, false); }
[ "private", "<", "T", ">", "InternalProviderImpl", "<", "?", "extends", "T", ">", "installUnBoundProvider", "(", "Class", "<", "T", ">", "clazz", ",", "String", "bindingName", ",", "InternalProviderImpl", "<", "?", "extends", "T", ">", "internalProvider", ")", ...
Install the provider of the class {@code clazz} and name {@code bindingName} in the pool of unbound providers. @param clazz the class for which to install the provider. @param bindingName the name, possibly {@code null}, for which to install the scoped provider. @param internalProvider the internal provider to install. @param <T> the type of {@code clazz}.
[ "Install", "the", "provider", "of", "the", "class", "{", "@code", "clazz", "}", "and", "name", "{", "@code", "bindingName", "}", "in", "the", "pool", "of", "unbound", "providers", "." ]
train
https://github.com/stephanenicolas/toothpick/blob/54476ca9a5fa48809c15a46e43e38db9ed7e1a75/toothpick-runtime/src/main/java/toothpick/ScopeImpl.java#L459-L462
jronrun/benayn
benayn-ustyle/src/main/java/com/benayn/ustyle/string/Finder.java
Finder.find
public MultiPos<String, String, String> find() { return new MultiPos<String, String, String>(null, null) { @Override protected String result() { return findingReplacing(EMPTY, 'L', pos, position); } }; }
java
public MultiPos<String, String, String> find() { return new MultiPos<String, String, String>(null, null) { @Override protected String result() { return findingReplacing(EMPTY, 'L', pos, position); } }; }
[ "public", "MultiPos", "<", "String", ",", "String", ",", "String", ">", "find", "(", ")", "{", "return", "new", "MultiPos", "<", "String", ",", "String", ",", "String", ">", "(", "null", ",", "null", ")", "{", "@", "Override", "protected", "String", ...
Returns a NegateMultiPos instance with all lookup results @return
[ "Returns", "a", "NegateMultiPos", "instance", "with", "all", "lookup", "results" ]
train
https://github.com/jronrun/benayn/blob/7585152e10e4cac07b4274c65f1c72ad7061ae69/benayn-ustyle/src/main/java/com/benayn/ustyle/string/Finder.java#L90-L97
crawljax/crawljax
core/src/main/java/com/crawljax/util/DomUtils.java
DomUtils.getTextContent
public static String getTextContent(Document document, boolean individualTokens) { String textContent = null; if (individualTokens) { List<String> tokens = getTextTokens(document); textContent = StringUtils.join(tokens, ","); } else { textContent = document.getDocumentElement().getTextContent().trim().replaceAll("\\s+", ","); } return textContent; }
java
public static String getTextContent(Document document, boolean individualTokens) { String textContent = null; if (individualTokens) { List<String> tokens = getTextTokens(document); textContent = StringUtils.join(tokens, ","); } else { textContent = document.getDocumentElement().getTextContent().trim().replaceAll("\\s+", ","); } return textContent; }
[ "public", "static", "String", "getTextContent", "(", "Document", "document", ",", "boolean", "individualTokens", ")", "{", "String", "textContent", "=", "null", ";", "if", "(", "individualTokens", ")", "{", "List", "<", "String", ">", "tokens", "=", "getTextTo...
To get all the textual content in the dom @param document @param individualTokens : default True : when set to true, each text node from dom is used to build the text content : when set to false, the text content of whole is obtained at once. @return
[ "To", "get", "all", "the", "textual", "content", "in", "the", "dom" ]
train
https://github.com/crawljax/crawljax/blob/d339f4f622ca902ccd35322065821e52a62ec543/core/src/main/java/com/crawljax/util/DomUtils.java#L511-L521
wildfly/wildfly-core
controller/src/main/java/org/jboss/as/controller/AttributeDefinition.java
AttributeDefinition.marshallAsElement
public void marshallAsElement(final ModelNode resourceModel, final boolean marshallDefault, final XMLStreamWriter writer) throws XMLStreamException { if (getMarshaller().isMarshallableAsElement()) { getMarshaller().marshallAsElement(this, resourceModel, marshallDefault, writer); } else { throw ControllerLogger.ROOT_LOGGER.couldNotMarshalAttributeAsElement(getName()); } }
java
public void marshallAsElement(final ModelNode resourceModel, final boolean marshallDefault, final XMLStreamWriter writer) throws XMLStreamException { if (getMarshaller().isMarshallableAsElement()) { getMarshaller().marshallAsElement(this, resourceModel, marshallDefault, writer); } else { throw ControllerLogger.ROOT_LOGGER.couldNotMarshalAttributeAsElement(getName()); } }
[ "public", "void", "marshallAsElement", "(", "final", "ModelNode", "resourceModel", ",", "final", "boolean", "marshallDefault", ",", "final", "XMLStreamWriter", "writer", ")", "throws", "XMLStreamException", "{", "if", "(", "getMarshaller", "(", ")", ".", "isMarshall...
Marshalls the value from the given {@code resourceModel} as an xml element, if it {@link #isMarshallable(org.jboss.dmr.ModelNode, boolean) is marshallable}. @param resourceModel the model, a non-null node of {@link org.jboss.dmr.ModelType#OBJECT}. @param marshallDefault {@code true} if the value should be marshalled even if it matches the default value @param writer stream writer to use for writing the attribute @throws javax.xml.stream.XMLStreamException if thrown by {@code writer}
[ "Marshalls", "the", "value", "from", "the", "given", "{", "@code", "resourceModel", "}", "as", "an", "xml", "element", "if", "it", "{", "@link", "#isMarshallable", "(", "org", ".", "jboss", ".", "dmr", ".", "ModelNode", "boolean", ")", "is", "marshallable"...
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/controller/src/main/java/org/jboss/as/controller/AttributeDefinition.java#L756-L762
undertow-io/undertow
core/src/main/java/io/undertow/protocols/http2/Http2StreamSourceChannel.java
Http2StreamSourceChannel.updateContentSize
void updateContentSize(long frameLength, boolean last) { if(contentLengthRemaining != -1) { contentLengthRemaining -= frameLength; if(contentLengthRemaining < 0) { UndertowLogger.REQUEST_IO_LOGGER.debugf("Closing stream %s on %s as data length exceeds content size", streamId, getFramedChannel()); getFramedChannel().sendRstStream(streamId, Http2Channel.ERROR_PROTOCOL_ERROR); } else if(last && contentLengthRemaining != 0) { UndertowLogger.REQUEST_IO_LOGGER.debugf("Closing stream %s on %s as data length was less than content size", streamId, getFramedChannel()); getFramedChannel().sendRstStream(streamId, Http2Channel.ERROR_PROTOCOL_ERROR); } } }
java
void updateContentSize(long frameLength, boolean last) { if(contentLengthRemaining != -1) { contentLengthRemaining -= frameLength; if(contentLengthRemaining < 0) { UndertowLogger.REQUEST_IO_LOGGER.debugf("Closing stream %s on %s as data length exceeds content size", streamId, getFramedChannel()); getFramedChannel().sendRstStream(streamId, Http2Channel.ERROR_PROTOCOL_ERROR); } else if(last && contentLengthRemaining != 0) { UndertowLogger.REQUEST_IO_LOGGER.debugf("Closing stream %s on %s as data length was less than content size", streamId, getFramedChannel()); getFramedChannel().sendRstStream(streamId, Http2Channel.ERROR_PROTOCOL_ERROR); } } }
[ "void", "updateContentSize", "(", "long", "frameLength", ",", "boolean", "last", ")", "{", "if", "(", "contentLengthRemaining", "!=", "-", "1", ")", "{", "contentLengthRemaining", "-=", "frameLength", ";", "if", "(", "contentLengthRemaining", "<", "0", ")", "{...
Checks that the actual content size matches the expected. We check this proactivly, rather than as the data is read @param frameLength The amount of data in the frame @param last If this is the last frame
[ "Checks", "that", "the", "actual", "content", "size", "matches", "the", "expected", ".", "We", "check", "this", "proactivly", "rather", "than", "as", "the", "data", "is", "read" ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/protocols/http2/Http2StreamSourceChannel.java#L277-L288
algolia/algoliasearch-client-java
src/main/java/com/algolia/search/saas/APIClient.java
APIClient.getLogs
public JSONObject getLogs(int offset, int length, LogType logType) throws AlgoliaException { return this.getLogs(offset, length, logType, RequestOptions.empty); }
java
public JSONObject getLogs(int offset, int length, LogType logType) throws AlgoliaException { return this.getLogs(offset, length, logType, RequestOptions.empty); }
[ "public", "JSONObject", "getLogs", "(", "int", "offset", ",", "int", "length", ",", "LogType", "logType", ")", "throws", "AlgoliaException", "{", "return", "this", ".", "getLogs", "(", "offset", ",", "length", ",", "logType", ",", "RequestOptions", ".", "emp...
Return last logs entries. @param offset Specify the first entry to retrieve (0-based, 0 is the most recent log entry). @param length Specify the maximum number of entries to retrieve starting at offset. Maximum allowed value: 1000. @param logType Specify the type of log to retrieve
[ "Return", "last", "logs", "entries", "." ]
train
https://github.com/algolia/algoliasearch-client-java/blob/a05da2f66c099fe6f77295c7b6a8a12c24e95f9b/src/main/java/com/algolia/search/saas/APIClient.java#L472-L474
puniverse/capsule
capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java
Jar.getListAttribute
public List<String> getListAttribute(String section, String name) { return split(getAttribute(section, name)); }
java
public List<String> getListAttribute(String section, String name) { return split(getAttribute(section, name)); }
[ "public", "List", "<", "String", ">", "getListAttribute", "(", "String", "section", ",", "String", "name", ")", "{", "return", "split", "(", "getAttribute", "(", "section", ",", "name", ")", ")", ";", "}" ]
Returns an attribute's list value from a non-main section of this JAR's manifest. The attributes string value will be split on whitespace into the returned list. The returned list may be safely modified. @param section the manifest's section @param name the attribute's name
[ "Returns", "an", "attribute", "s", "list", "value", "from", "a", "non", "-", "main", "section", "of", "this", "JAR", "s", "manifest", ".", "The", "attributes", "string", "value", "will", "be", "split", "on", "whitespace", "into", "the", "returned", "list",...
train
https://github.com/puniverse/capsule/blob/291a54e501a32aaf0284707b8c1fbff6a566822b/capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java#L258-L260
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/LocalDateTime.java
LocalDateTime.plusDays
public LocalDateTime plusDays(long days) { LocalDate newDate = date.plusDays(days); return with(newDate, time); }
java
public LocalDateTime plusDays(long days) { LocalDate newDate = date.plusDays(days); return with(newDate, time); }
[ "public", "LocalDateTime", "plusDays", "(", "long", "days", ")", "{", "LocalDate", "newDate", "=", "date", ".", "plusDays", "(", "days", ")", ";", "return", "with", "(", "newDate", ",", "time", ")", ";", "}" ]
Returns a copy of this {@code LocalDateTime} with the specified number of days added. <p> This method adds the specified amount to the days field incrementing the month and year fields as necessary to ensure the result remains valid. The result is only invalid if the maximum/minimum year is exceeded. <p> For example, 2008-12-31 plus one day would result in 2009-01-01. <p> This instance is immutable and unaffected by this method call. @param days the days to add, may be negative @return a {@code LocalDateTime} based on this date-time with the days added, not null @throws DateTimeException if the result exceeds the supported date range
[ "Returns", "a", "copy", "of", "this", "{", "@code", "LocalDateTime", "}", "with", "the", "specified", "number", "of", "days", "added", ".", "<p", ">", "This", "method", "adds", "the", "specified", "amount", "to", "the", "days", "field", "incrementing", "th...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/LocalDateTime.java#L1279-L1282
cdk/cdk
base/standard/src/main/java/org/openscience/cdk/tools/manipulator/ChemModelManipulator.java
ChemModelManipulator.getRelevantAtomContainer
public static IAtomContainer getRelevantAtomContainer(IChemModel chemModel, IAtom atom) { IAtomContainer result = null; if (chemModel.getMoleculeSet() != null) { IAtomContainerSet moleculeSet = chemModel.getMoleculeSet(); result = MoleculeSetManipulator.getRelevantAtomContainer(moleculeSet, atom); if (result != null) { return result; } } if (chemModel.getReactionSet() != null) { IReactionSet reactionSet = chemModel.getReactionSet(); return ReactionSetManipulator.getRelevantAtomContainer(reactionSet, atom); } if (chemModel.getCrystal() != null && chemModel.getCrystal().contains(atom)) { return chemModel.getCrystal(); } if (chemModel.getRingSet() != null) { return AtomContainerSetManipulator.getRelevantAtomContainer(chemModel.getRingSet(), atom); } throw new IllegalArgumentException("The provided atom is not part of this IChemModel."); }
java
public static IAtomContainer getRelevantAtomContainer(IChemModel chemModel, IAtom atom) { IAtomContainer result = null; if (chemModel.getMoleculeSet() != null) { IAtomContainerSet moleculeSet = chemModel.getMoleculeSet(); result = MoleculeSetManipulator.getRelevantAtomContainer(moleculeSet, atom); if (result != null) { return result; } } if (chemModel.getReactionSet() != null) { IReactionSet reactionSet = chemModel.getReactionSet(); return ReactionSetManipulator.getRelevantAtomContainer(reactionSet, atom); } if (chemModel.getCrystal() != null && chemModel.getCrystal().contains(atom)) { return chemModel.getCrystal(); } if (chemModel.getRingSet() != null) { return AtomContainerSetManipulator.getRelevantAtomContainer(chemModel.getRingSet(), atom); } throw new IllegalArgumentException("The provided atom is not part of this IChemModel."); }
[ "public", "static", "IAtomContainer", "getRelevantAtomContainer", "(", "IChemModel", "chemModel", ",", "IAtom", "atom", ")", "{", "IAtomContainer", "result", "=", "null", ";", "if", "(", "chemModel", ".", "getMoleculeSet", "(", ")", "!=", "null", ")", "{", "IA...
This badly named methods tries to determine which AtomContainer in the ChemModel is best suited to contain added Atom's and Bond's.
[ "This", "badly", "named", "methods", "tries", "to", "determine", "which", "AtomContainer", "in", "the", "ChemModel", "is", "best", "suited", "to", "contain", "added", "Atom", "s", "and", "Bond", "s", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/tools/manipulator/ChemModelManipulator.java#L200-L220
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Image.java
Image.drawEmbedded
public void drawEmbedded(float x, float y, float x2, float y2, float srcx, float srcy, float srcx2, float srcy2, Color filter) { if (filter != null) { filter.bind(); } float mywidth = x2 - x; float myheight = y2 - y; float texwidth = srcx2 - srcx; float texheight = srcy2 - srcy; float newTextureOffsetX = (((srcx) / (width)) * textureWidth) + textureOffsetX; float newTextureOffsetY = (((srcy) / (height)) * textureHeight) + textureOffsetY; float newTextureWidth = ((texwidth) / (width)) * textureWidth; float newTextureHeight = ((texheight) / (height)) * textureHeight; GL.glTexCoord2f(newTextureOffsetX, newTextureOffsetY); GL.glVertex3f(x,y, 0.0f); GL.glTexCoord2f(newTextureOffsetX, newTextureOffsetY + newTextureHeight); GL.glVertex3f(x,(y + myheight), 0.0f); GL.glTexCoord2f(newTextureOffsetX + newTextureWidth, newTextureOffsetY + newTextureHeight); GL.glVertex3f((x + mywidth),(y + myheight), 0.0f); GL.glTexCoord2f(newTextureOffsetX + newTextureWidth, newTextureOffsetY); GL.glVertex3f((x + mywidth),y, 0.0f); }
java
public void drawEmbedded(float x, float y, float x2, float y2, float srcx, float srcy, float srcx2, float srcy2, Color filter) { if (filter != null) { filter.bind(); } float mywidth = x2 - x; float myheight = y2 - y; float texwidth = srcx2 - srcx; float texheight = srcy2 - srcy; float newTextureOffsetX = (((srcx) / (width)) * textureWidth) + textureOffsetX; float newTextureOffsetY = (((srcy) / (height)) * textureHeight) + textureOffsetY; float newTextureWidth = ((texwidth) / (width)) * textureWidth; float newTextureHeight = ((texheight) / (height)) * textureHeight; GL.glTexCoord2f(newTextureOffsetX, newTextureOffsetY); GL.glVertex3f(x,y, 0.0f); GL.glTexCoord2f(newTextureOffsetX, newTextureOffsetY + newTextureHeight); GL.glVertex3f(x,(y + myheight), 0.0f); GL.glTexCoord2f(newTextureOffsetX + newTextureWidth, newTextureOffsetY + newTextureHeight); GL.glVertex3f((x + mywidth),(y + myheight), 0.0f); GL.glTexCoord2f(newTextureOffsetX + newTextureWidth, newTextureOffsetY); GL.glVertex3f((x + mywidth),y, 0.0f); }
[ "public", "void", "drawEmbedded", "(", "float", "x", ",", "float", "y", ",", "float", "x2", ",", "float", "y2", ",", "float", "srcx", ",", "float", "srcy", ",", "float", "srcx2", ",", "float", "srcy2", ",", "Color", "filter", ")", "{", "if", "(", "...
Draw a section of this image at a particular location and scale on the screen, while this is image is "in use", i.e. between calls to startUse and endUse. @param x The x position to draw the image @param y The y position to draw the image @param x2 The x position of the bottom right corner of the drawn image @param y2 The y position of the bottom right corner of the drawn image @param srcx The x position of the rectangle to draw from this image (i.e. relative to this image) @param srcy The y position of the rectangle to draw from this image (i.e. relative to this image) @param srcx2 The x position of the bottom right cornder of rectangle to draw from this image (i.e. relative to this image) @param srcy2 The t position of the bottom right cornder of rectangle to draw from this image (i.e. relative to this image) @param filter The colour filter to apply when drawing
[ "Draw", "a", "section", "of", "this", "image", "at", "a", "particular", "location", "and", "scale", "on", "the", "screen", "while", "this", "is", "image", "is", "in", "use", "i", ".", "e", ".", "between", "calls", "to", "startUse", "and", "endUse", "."...
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Image.java#L1094-L1124
MKLab-ITI/multimedia-indexing
src/main/java/gr/iti/mklab/visual/utilities/ImageIOGreyScale.java
ImageIOGreyScale.getImageWritersByMIMEType
public static Iterator<ImageWriter> getImageWritersByMIMEType(String MIMEType) { if (MIMEType == null) { throw new IllegalArgumentException("MIMEType == null!"); } Iterator iter; // Ensure category is present try { iter = theRegistry.getServiceProviders(ImageWriterSpi.class, new ContainsFilter(writerMIMETypesMethod, MIMEType), true); } catch (IllegalArgumentException e) { return new HashSet().iterator(); } return new ImageWriterIterator(iter); }
java
public static Iterator<ImageWriter> getImageWritersByMIMEType(String MIMEType) { if (MIMEType == null) { throw new IllegalArgumentException("MIMEType == null!"); } Iterator iter; // Ensure category is present try { iter = theRegistry.getServiceProviders(ImageWriterSpi.class, new ContainsFilter(writerMIMETypesMethod, MIMEType), true); } catch (IllegalArgumentException e) { return new HashSet().iterator(); } return new ImageWriterIterator(iter); }
[ "public", "static", "Iterator", "<", "ImageWriter", ">", "getImageWritersByMIMEType", "(", "String", "MIMEType", ")", "{", "if", "(", "MIMEType", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"MIMEType == null!\"", ")", ";", "}", "It...
Returns an <code>Iterator</code> containing all currently registered <code>ImageWriter</code>s that claim to be able to encode files with the given MIME type. @param MIMEType a <code>String</code> containing a file suffix (<i>e.g.</i>, "image/jpeg" or "image/x-bmp"). @return an <code>Iterator</code> containing <code>ImageWriter</code>s. @exception IllegalArgumentException if <code>MIMEType</code> is <code>null</code>. @see javax.imageio.spi.ImageWriterSpi#getMIMETypes
[ "Returns", "an", "<code", ">", "Iterator<", "/", "code", ">", "containing", "all", "currently", "registered", "<code", ">", "ImageWriter<", "/", "code", ">", "s", "that", "claim", "to", "be", "able", "to", "encode", "files", "with", "the", "given", "MIME",...
train
https://github.com/MKLab-ITI/multimedia-indexing/blob/f82e8e517da706651f4b7a719805401f3102e135/src/main/java/gr/iti/mklab/visual/utilities/ImageIOGreyScale.java#L837-L849
UrielCh/ovh-java-sdk
ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java
ApiOvhTelephony.billingAccount_ovhPabx_serviceName_hunting_agent_agentId_GET
public OvhOvhPabxHuntingAgent billingAccount_ovhPabx_serviceName_hunting_agent_agentId_GET(String billingAccount, String serviceName, Long agentId) throws IOException { String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/hunting/agent/{agentId}"; StringBuilder sb = path(qPath, billingAccount, serviceName, agentId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOvhPabxHuntingAgent.class); }
java
public OvhOvhPabxHuntingAgent billingAccount_ovhPabx_serviceName_hunting_agent_agentId_GET(String billingAccount, String serviceName, Long agentId) throws IOException { String qPath = "/telephony/{billingAccount}/ovhPabx/{serviceName}/hunting/agent/{agentId}"; StringBuilder sb = path(qPath, billingAccount, serviceName, agentId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhOvhPabxHuntingAgent.class); }
[ "public", "OvhOvhPabxHuntingAgent", "billingAccount_ovhPabx_serviceName_hunting_agent_agentId_GET", "(", "String", "billingAccount", ",", "String", "serviceName", ",", "Long", "agentId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/telephony/{billingAccount}/o...
Get this object properties REST: GET /telephony/{billingAccount}/ovhPabx/{serviceName}/hunting/agent/{agentId} @param billingAccount [required] The name of your billingAccount @param serviceName [required] @param agentId [required]
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-telephony/src/main/java/net/minidev/ovh/api/ApiOvhTelephony.java#L6395-L6400
javalite/activeweb
activeweb/src/main/java/org/javalite/activeweb/Router.java
Router.getControllerPath
protected ControllerPath getControllerPath(String uri) { boolean rootPath = uri.equals("/"); boolean useRootController = rootPath && rootControllerName != null; if (useRootController) { return new ControllerPath(rootControllerName); } else if (rootControllerName == null && rootPath) { LOGGER.warn("URI is: '/', but root controller not set"); return new ControllerPath(); } else { String controllerPackage; if ((controllerPackage = findPackageSuffix(uri)) != null) { String controllerName = findControllerNamePart(controllerPackage, uri); return new ControllerPath(controllerName, controllerPackage); } else { return new ControllerPath(uri.split("/")[1]);//no package suffix } } }
java
protected ControllerPath getControllerPath(String uri) { boolean rootPath = uri.equals("/"); boolean useRootController = rootPath && rootControllerName != null; if (useRootController) { return new ControllerPath(rootControllerName); } else if (rootControllerName == null && rootPath) { LOGGER.warn("URI is: '/', but root controller not set"); return new ControllerPath(); } else { String controllerPackage; if ((controllerPackage = findPackageSuffix(uri)) != null) { String controllerName = findControllerNamePart(controllerPackage, uri); return new ControllerPath(controllerName, controllerPackage); } else { return new ControllerPath(uri.split("/")[1]);//no package suffix } } }
[ "protected", "ControllerPath", "getControllerPath", "(", "String", "uri", ")", "{", "boolean", "rootPath", "=", "uri", ".", "equals", "(", "\"/\"", ")", ";", "boolean", "useRootController", "=", "rootPath", "&&", "rootControllerName", "!=", "null", ";", "if", ...
Finds a controller path from URI. Controller path includes a package prefix taken from URI, similar to: <p/> <code>http://host/context/admin/printers/show/1</code>, where "admin" is a "package_suffix", "printers" is a "controller_name". <p/> for example above, the method will Map with two keys: "package_suffix" and "controller_name" @param uri this is a URI - the information after context : "controller/action/whatever". @return map with two keys: "controller_name" and "package_suffix", both of which can be null.
[ "Finds", "a", "controller", "path", "from", "URI", ".", "Controller", "path", "includes", "a", "package", "prefix", "taken", "from", "URI", "similar", "to", ":", "<p", "/", ">", "<code", ">", "http", ":", "//", "host", "/", "context", "/", "admin", "/"...
train
https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/Router.java#L327-L346
marklogic/java-client-api
marklogic-client-api/src/main/java/com/marklogic/client/example/cookbook/datamovement/BulkLoadFromJdbcRaw.java
BulkLoadFromJdbcRaw.populateTitle
public void populateTitle(ResultSet row, ObjectNode t) throws SQLException { t.put("employeeId", row.getInt("emp_no")); t.put("title", row.getString("title")); Calendar fromDate = Calendar.getInstance(); fromDate.setTime(row.getDate("from_date")); t.put("fromDate", dateFormat.format(fromDate.getTime())); Calendar toDate = Calendar.getInstance(); toDate.setTime(row.getDate("to_date")); t.put("toDate", dateFormat.format(toDate.getTime())); }
java
public void populateTitle(ResultSet row, ObjectNode t) throws SQLException { t.put("employeeId", row.getInt("emp_no")); t.put("title", row.getString("title")); Calendar fromDate = Calendar.getInstance(); fromDate.setTime(row.getDate("from_date")); t.put("fromDate", dateFormat.format(fromDate.getTime())); Calendar toDate = Calendar.getInstance(); toDate.setTime(row.getDate("to_date")); t.put("toDate", dateFormat.format(toDate.getTime())); }
[ "public", "void", "populateTitle", "(", "ResultSet", "row", ",", "ObjectNode", "t", ")", "throws", "SQLException", "{", "t", ".", "put", "(", "\"employeeId\"", ",", "row", ".", "getInt", "(", "\"emp_no\"", ")", ")", ";", "t", ".", "put", "(", "\"title\""...
take data from a JDBC ResultSet (row) and populate an ObjectNode (JSON) object
[ "take", "data", "from", "a", "JDBC", "ResultSet", "(", "row", ")", "and", "populate", "an", "ObjectNode", "(", "JSON", ")", "object" ]
train
https://github.com/marklogic/java-client-api/blob/acf60229a928abd4a8cc4b21b641d56957467da7/marklogic-client-api/src/main/java/com/marklogic/client/example/cookbook/datamovement/BulkLoadFromJdbcRaw.java#L125-L134
apache/groovy
src/main/java/org/codehaus/groovy/control/ClassNodeResolver.java
ClassNodeResolver.tryAsScript
private static LookupResult tryAsScript(String name, CompilationUnit compilationUnit, ClassNode oldClass) { LookupResult lr = null; if (oldClass!=null) { lr = new LookupResult(null, oldClass); } if (name.startsWith("java.")) return lr; //TODO: don't ignore inner static classes completely if (name.indexOf('$') != -1) return lr; // try to find a script from classpath*/ GroovyClassLoader gcl = compilationUnit.getClassLoader(); URL url = null; try { url = gcl.getResourceLoader().loadGroovySource(name); } catch (MalformedURLException e) { // fall through and let the URL be null } if (url != null && ( oldClass==null || isSourceNewer(url, oldClass))) { SourceUnit su = compilationUnit.addSource(url); return new LookupResult(su,null); } return lr; }
java
private static LookupResult tryAsScript(String name, CompilationUnit compilationUnit, ClassNode oldClass) { LookupResult lr = null; if (oldClass!=null) { lr = new LookupResult(null, oldClass); } if (name.startsWith("java.")) return lr; //TODO: don't ignore inner static classes completely if (name.indexOf('$') != -1) return lr; // try to find a script from classpath*/ GroovyClassLoader gcl = compilationUnit.getClassLoader(); URL url = null; try { url = gcl.getResourceLoader().loadGroovySource(name); } catch (MalformedURLException e) { // fall through and let the URL be null } if (url != null && ( oldClass==null || isSourceNewer(url, oldClass))) { SourceUnit su = compilationUnit.addSource(url); return new LookupResult(su,null); } return lr; }
[ "private", "static", "LookupResult", "tryAsScript", "(", "String", "name", ",", "CompilationUnit", "compilationUnit", ",", "ClassNode", "oldClass", ")", "{", "LookupResult", "lr", "=", "null", ";", "if", "(", "oldClass", "!=", "null", ")", "{", "lr", "=", "n...
try to find a script using the compilation unit class loader.
[ "try", "to", "find", "a", "script", "using", "the", "compilation", "unit", "class", "loader", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/control/ClassNodeResolver.java#L279-L302
vipshop/vjtools
vjkit/src/main/java/com/vip/vjtools/vjkit/base/ValueValidator.java
ValueValidator.checkAndGet
public static <T> T checkAndGet(T value, T defaultValue, Validator<T> v) { if (v.validate(value)) { return value; } return defaultValue; }
java
public static <T> T checkAndGet(T value, T defaultValue, Validator<T> v) { if (v.validate(value)) { return value; } return defaultValue; }
[ "public", "static", "<", "T", ">", "T", "checkAndGet", "(", "T", "value", ",", "T", "defaultValue", ",", "Validator", "<", "T", ">", "v", ")", "{", "if", "(", "v", ".", "validate", "(", "value", ")", ")", "{", "return", "value", ";", "}", "return...
对目标值进行校验,并根据校验结果取值 使用示例(校验目标值是否大于0, 如果小于 0 则取值为 1) ValueValidator.checkAndGet(idleTime, 1, Validator.INTEGER_GT_ZERO_VALIDATOR) @param value 校验值 @param defaultValue 校验失败默认值 @param v 校验器 @return 经Validator校验后的返回值,校验成功返回 value, 校验失败返回 defaultValue
[ "对目标值进行校验,并根据校验结果取值" ]
train
https://github.com/vipshop/vjtools/blob/60c743da35913d72f37f2d79afa90ad2bf73cb89/vjkit/src/main/java/com/vip/vjtools/vjkit/base/ValueValidator.java#L30-L36
RestComm/sipunit
src/main/java/org/cafesip/sipunit/PresenceSubscriber.java
PresenceSubscriber.refreshBuddy
public boolean refreshBuddy(Request req, long timeout) { if (parent.getBuddyList().get(targetUri) == null) { setReturnCode(SipSession.INVALID_ARGUMENT); setErrorMessage("Buddy refresh for URI " + targetUri + " failed, uri was not found in the buddy list. Use fetchPresenceInfo() for users not in the buddy list"); return false; } return refreshSubscription(req, timeout, parent.getProxyHost() != null); }
java
public boolean refreshBuddy(Request req, long timeout) { if (parent.getBuddyList().get(targetUri) == null) { setReturnCode(SipSession.INVALID_ARGUMENT); setErrorMessage("Buddy refresh for URI " + targetUri + " failed, uri was not found in the buddy list. Use fetchPresenceInfo() for users not in the buddy list"); return false; } return refreshSubscription(req, timeout, parent.getProxyHost() != null); }
[ "public", "boolean", "refreshBuddy", "(", "Request", "req", ",", "long", "timeout", ")", "{", "if", "(", "parent", ".", "getBuddyList", "(", ")", ".", "get", "(", "targetUri", ")", "==", "null", ")", "{", "setReturnCode", "(", "SipSession", ".", "INVALID...
This method is the same as refreshBuddy(duration, eventId, timeout) except that instead of creating the SUBSCRIBE request from parameters passed in, the given request message parameter is used for sending out the SUBSCRIBE message. <p> The Request parameter passed into this method should come from calling createSubscribeMessage() - see that javadoc. The subscription duration is reset to the passed in Request's expiry value. If it is 0, this is an unsubscribe. Note, the buddy stays in the buddy list even though the subscription won't be active. The event "id" in the given request will be used subsequently (for error checking SUBSCRIBE responses and NOTIFYs from the server as well as for sending subsequent SUBSCRIBEs).
[ "This", "method", "is", "the", "same", "as", "refreshBuddy", "(", "duration", "eventId", "timeout", ")", "except", "that", "instead", "of", "creating", "the", "SUBSCRIBE", "request", "from", "parameters", "passed", "in", "the", "given", "request", "message", "...
train
https://github.com/RestComm/sipunit/blob/18a6be2e29be3fbdc14226e8c41b25e2d57378b1/src/main/java/org/cafesip/sipunit/PresenceSubscriber.java#L387-L397
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/AbstractMultiDataSetNormalizer.java
AbstractMultiDataSetNormalizer.revertLabels
public void revertLabels(@NonNull INDArray labels, INDArray mask, int output) { if (isFitLabel()) { strategy.revert(labels, mask, getLabelStats(output)); } }
java
public void revertLabels(@NonNull INDArray labels, INDArray mask, int output) { if (isFitLabel()) { strategy.revert(labels, mask, getLabelStats(output)); } }
[ "public", "void", "revertLabels", "(", "@", "NonNull", "INDArray", "labels", ",", "INDArray", "mask", ",", "int", "output", ")", "{", "if", "(", "isFitLabel", "(", ")", ")", "{", "strategy", ".", "revert", "(", "labels", ",", "mask", ",", "getLabelStats"...
Undo (revert) the normalization applied by this normalizer to a specific labels array. If labels normalization is disabled (i.e., {@link #isFitLabel()} == false) then this is a no-op. Can also be used to undo normalization for network output arrays, in the case of regression. @param labels Labels arrays to revert the normalization on @param output the index of the array to revert
[ "Undo", "(", "revert", ")", "the", "normalization", "applied", "by", "this", "normalizer", "to", "a", "specific", "labels", "array", ".", "If", "labels", "normalization", "is", "disabled", "(", "i", ".", "e", ".", "{", "@link", "#isFitLabel", "()", "}", ...
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/dataset/api/preprocessor/AbstractMultiDataSetNormalizer.java#L272-L276
Azure/azure-sdk-for-java
storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/BlobContainersInner.java
BlobContainersInner.extendImmutabilityPolicy
public ImmutabilityPolicyInner extendImmutabilityPolicy(String resourceGroupName, String accountName, String containerName, String ifMatch, int immutabilityPeriodSinceCreationInDays) { return extendImmutabilityPolicyWithServiceResponseAsync(resourceGroupName, accountName, containerName, ifMatch, immutabilityPeriodSinceCreationInDays).toBlocking().single().body(); }
java
public ImmutabilityPolicyInner extendImmutabilityPolicy(String resourceGroupName, String accountName, String containerName, String ifMatch, int immutabilityPeriodSinceCreationInDays) { return extendImmutabilityPolicyWithServiceResponseAsync(resourceGroupName, accountName, containerName, ifMatch, immutabilityPeriodSinceCreationInDays).toBlocking().single().body(); }
[ "public", "ImmutabilityPolicyInner", "extendImmutabilityPolicy", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "containerName", ",", "String", "ifMatch", ",", "int", "immutabilityPeriodSinceCreationInDays", ")", "{", "return", "extendImmut...
Extends the immutabilityPeriodSinceCreationInDays of a locked immutabilityPolicy. The only action allowed on a Locked policy will be this action. ETag in If-Match is required for this operation. @param resourceGroupName The name of the resource group within the user's subscription. The name is case insensitive. @param accountName The name of the storage account within the specified resource group. Storage account names must be between 3 and 24 characters in length and use numbers and lower-case letters only. @param containerName The name of the blob container within the specified storage account. Blob container names must be between 3 and 63 characters in length and use numbers, lower-case letters and dash (-) only. Every dash (-) character must be immediately preceded and followed by a letter or number. @param ifMatch The entity state (ETag) version of the immutability policy to update. A value of "*" can be used to apply the operation only if the immutability policy already exists. If omitted, this operation will always be applied. @param immutabilityPeriodSinceCreationInDays The immutability period for the blobs in the container since the policy creation, in days. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ImmutabilityPolicyInner object if successful.
[ "Extends", "the", "immutabilityPeriodSinceCreationInDays", "of", "a", "locked", "immutabilityPolicy", ".", "The", "only", "action", "allowed", "on", "a", "Locked", "policy", "will", "be", "this", "action", ".", "ETag", "in", "If", "-", "Match", "is", "required",...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/storage/resource-manager/v2018_03_01_preview/src/main/java/com/microsoft/azure/management/storage/v2018_03_01_preview/implementation/BlobContainersInner.java#L1587-L1589
JodaOrg/joda-time
src/main/java/org/joda/time/Months.java
Months.monthsBetween
public static Months monthsBetween(ReadableInstant start, ReadableInstant end) { int amount = BaseSingleFieldPeriod.between(start, end, DurationFieldType.months()); return Months.months(amount); }
java
public static Months monthsBetween(ReadableInstant start, ReadableInstant end) { int amount = BaseSingleFieldPeriod.between(start, end, DurationFieldType.months()); return Months.months(amount); }
[ "public", "static", "Months", "monthsBetween", "(", "ReadableInstant", "start", ",", "ReadableInstant", "end", ")", "{", "int", "amount", "=", "BaseSingleFieldPeriod", ".", "between", "(", "start", ",", "end", ",", "DurationFieldType", ".", "months", "(", ")", ...
Creates a <code>Months</code> representing the number of whole months between the two specified datetimes. This method correctly handles any daylight savings time changes that may occur during the interval. <p> This method calculates by adding months to the start date until the result is past the end date. As such, a period from the end of a "long" month to the end of a "short" month is counted as a whole month. @param start the start instant, must not be null @param end the end instant, must not be null @return the period in months @throws IllegalArgumentException if the instants are null or invalid
[ "Creates", "a", "<code", ">", "Months<", "/", "code", ">", "representing", "the", "number", "of", "whole", "months", "between", "the", "two", "specified", "datetimes", ".", "This", "method", "correctly", "handles", "any", "daylight", "savings", "time", "change...
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/Months.java#L141-L144
UrielCh/ovh-java-sdk
ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java
ApiOvhIp.loadBalancing_serviceName_portsRedirection_srcPort_DELETE
public OvhLoadBalancingTask loadBalancing_serviceName_portsRedirection_srcPort_DELETE(String serviceName, net.minidev.ovh.api.ip.OvhLoadBalancingAdditionalPortEnum srcPort) throws IOException { String qPath = "/ip/loadBalancing/{serviceName}/portsRedirection/{srcPort}"; StringBuilder sb = path(qPath, serviceName, srcPort); String resp = exec(qPath, "DELETE", sb.toString(), null); return convertTo(resp, OvhLoadBalancingTask.class); }
java
public OvhLoadBalancingTask loadBalancing_serviceName_portsRedirection_srcPort_DELETE(String serviceName, net.minidev.ovh.api.ip.OvhLoadBalancingAdditionalPortEnum srcPort) throws IOException { String qPath = "/ip/loadBalancing/{serviceName}/portsRedirection/{srcPort}"; StringBuilder sb = path(qPath, serviceName, srcPort); String resp = exec(qPath, "DELETE", sb.toString(), null); return convertTo(resp, OvhLoadBalancingTask.class); }
[ "public", "OvhLoadBalancingTask", "loadBalancing_serviceName_portsRedirection_srcPort_DELETE", "(", "String", "serviceName", ",", "net", ".", "minidev", ".", "ovh", ".", "api", ".", "ip", ".", "OvhLoadBalancingAdditionalPortEnum", "srcPort", ")", "throws", "IOException", ...
Delete a port redirection REST: DELETE /ip/loadBalancing/{serviceName}/portsRedirection/{srcPort} @param serviceName [required] The internal name of your IP load balancing @param srcPort [required] The port you want to redirect from
[ "Delete", "a", "port", "redirection" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ip/src/main/java/net/minidev/ovh/api/ApiOvhIp.java#L1513-L1518
agmip/acmo
src/main/java/org/agmip/acmo/util/AcmoUtil.java
AcmoUtil.createCsvFile
public static File createCsvFile(String outputCsvPath, String mode) { return createCsvFile(outputCsvPath, mode, null); }
java
public static File createCsvFile(String outputCsvPath, String mode) { return createCsvFile(outputCsvPath, mode, null); }
[ "public", "static", "File", "createCsvFile", "(", "String", "outputCsvPath", ",", "String", "mode", ")", "{", "return", "createCsvFile", "(", "outputCsvPath", ",", "mode", ",", "null", ")", ";", "}" ]
Generate an ACMO CSV file object with a non-repeated file name in the given directory. The naming rule is as follow, ACMO-[Region]-[stratum]-[climate_id]-[RAP_id]-[Management_id]-[model].csv @param outputCsvPath The output path for CSV file @param mode The name of model which provide the model output data @return The {@code File} for CSV file
[ "Generate", "an", "ACMO", "CSV", "file", "object", "with", "a", "non", "-", "repeated", "file", "name", "in", "the", "given", "directory", ".", "The", "naming", "rule", "is", "as", "follow", "ACMO", "-", "[", "Region", "]", "-", "[", "stratum", "]", ...
train
https://github.com/agmip/acmo/blob/cf609b272ed7344abd2e2bef3d0060d2afa81cb0/src/main/java/org/agmip/acmo/util/AcmoUtil.java#L503-L505
tuenti/SmsRadar
library/src/main/java/com/tuenti/smsradar/SmsRadar.java
SmsRadar.stopSmsRadarService
public static void stopSmsRadarService(Context context) { SmsRadar.smsListener = null; Intent intent = new Intent(context, SmsRadarService.class); context.stopService(intent); }
java
public static void stopSmsRadarService(Context context) { SmsRadar.smsListener = null; Intent intent = new Intent(context, SmsRadarService.class); context.stopService(intent); }
[ "public", "static", "void", "stopSmsRadarService", "(", "Context", "context", ")", "{", "SmsRadar", ".", "smsListener", "=", "null", ";", "Intent", "intent", "=", "new", "Intent", "(", "context", ",", "SmsRadarService", ".", "class", ")", ";", "context", "."...
Stops the service and remove the SmsListener added when the SmsRadar was initialized @param context used to stop the service
[ "Stops", "the", "service", "and", "remove", "the", "SmsListener", "added", "when", "the", "SmsRadar", "was", "initialized" ]
train
https://github.com/tuenti/SmsRadar/blob/598553c69c474634a1d4041a39f015f0b4c33a6d/library/src/main/java/com/tuenti/smsradar/SmsRadar.java#L50-L54
kkopacz/agiso-core
bundles/agiso-core-lang/src/main/java/org/agiso/core/lang/util/ThreadUtils.java
ThreadUtils.putAttribute
public static Object putAttribute(String key, Object attribute) { return putAttribute(key, attribute, false); }
java
public static Object putAttribute(String key, Object attribute) { return putAttribute(key, attribute, false); }
[ "public", "static", "Object", "putAttribute", "(", "String", "key", ",", "Object", "attribute", ")", "{", "return", "putAttribute", "(", "key", ",", "attribute", ",", "false", ")", ";", "}" ]
Umieszcza wartość atrybutu pod określonym kluczem w lokalnym zasięgu wątku. @param key Klucz, pod którym atrybut zostanie umieszczony @param attribute Wartość atrybutu do umieszczenia w lokalnym zasięgu wątku @return poprzednia wartość atrybutu powiązanego z klluczem, lub <code>null </code> jeśli atrybut nie został ustawiony (albo posiadał wartość <code> null</code>).
[ "Umieszcza", "wartość", "atrybutu", "pod", "określonym", "kluczem", "w", "lokalnym", "zasięgu", "wątku", "." ]
train
https://github.com/kkopacz/agiso-core/blob/b994ec0146be1fe3f10829d69cd719bdbdebe1c5/bundles/agiso-core-lang/src/main/java/org/agiso/core/lang/util/ThreadUtils.java#L107-L109
elki-project/elki
elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/data/Clustering.java
Clustering.addChildCluster
public void addChildCluster(Cluster<M> parent, Cluster<M> child) { hierarchy.add(parent, child); }
java
public void addChildCluster(Cluster<M> parent, Cluster<M> child) { hierarchy.add(parent, child); }
[ "public", "void", "addChildCluster", "(", "Cluster", "<", "M", ">", "parent", ",", "Cluster", "<", "M", ">", "child", ")", "{", "hierarchy", ".", "add", "(", "parent", ",", "child", ")", ";", "}" ]
Add a cluster to the clustering. @param parent Parent cluster @param child Child cluster.
[ "Add", "a", "cluster", "to", "the", "clustering", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-clustering/src/main/java/de/lmu/ifi/dbs/elki/data/Clustering.java#L116-L118
Mozu/mozu-java
mozu-javaasync-core/src/main/java/com/mozu/api/urls/platform/ReferenceDataUrl.java
ReferenceDataUrl.getUnitsOfMeasureUrl
public static MozuUrl getUnitsOfMeasureUrl(String filter, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/platform/reference/unitsofmeasure?filter={filter}&responseFields={responseFields}"); formatter.formatUrl("filter", filter); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.HOME_POD) ; }
java
public static MozuUrl getUnitsOfMeasureUrl(String filter, String responseFields) { UrlFormatter formatter = new UrlFormatter("/api/platform/reference/unitsofmeasure?filter={filter}&responseFields={responseFields}"); formatter.formatUrl("filter", filter); formatter.formatUrl("responseFields", responseFields); return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.HOME_POD) ; }
[ "public", "static", "MozuUrl", "getUnitsOfMeasureUrl", "(", "String", "filter", ",", "String", "responseFields", ")", "{", "UrlFormatter", "formatter", "=", "new", "UrlFormatter", "(", "\"/api/platform/reference/unitsofmeasure?filter={filter}&responseFields={responseFields}\"", ...
Get Resource Url for GetUnitsOfMeasure @param filter A set of filter expressions representing the search parameters for a query. This parameter is optional. Refer to [Sorting and Filtering](../../../../Developer/api-guides/sorting-filtering.htm) for a list of supported filters. @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", "GetUnitsOfMeasure" ]
train
https://github.com/Mozu/mozu-java/blob/5beadde73601a859f845e3e2fc1077b39c8bea83/mozu-javaasync-core/src/main/java/com/mozu/api/urls/platform/ReferenceDataUrl.java#L174-L180
Azure/azure-sdk-for-java
common/azure-common/src/main/java/com/azure/common/implementation/RestProxy.java
RestProxy.createHttpRequest
@SuppressWarnings("unchecked") private HttpRequest createHttpRequest(SwaggerMethodParser methodParser, Object[] args) throws IOException { UrlBuilder urlBuilder; // Sometimes people pass in a full URL for the value of their PathParam annotated argument. // This definitely happens in paging scenarios. In that case, just use the full URL and // ignore the Host annotation. final String path = methodParser.path(args); final UrlBuilder pathUrlBuilder = UrlBuilder.parse(path); if (pathUrlBuilder.scheme() != null) { urlBuilder = pathUrlBuilder; } else { urlBuilder = new UrlBuilder(); // We add path to the UrlBuilder first because this is what is // provided to the HTTP Method annotation. Any path substitutions // from other substitution annotations will overwrite this. urlBuilder.withPath(path); final String scheme = methodParser.scheme(args); urlBuilder.withScheme(scheme); final String host = methodParser.host(args); urlBuilder.withHost(host); } for (final EncodedParameter queryParameter : methodParser.encodedQueryParameters(args)) { urlBuilder.setQueryParameter(queryParameter.name(), queryParameter.encodedValue()); } final URL url = urlBuilder.toURL(); final HttpRequest request = configRequest(new HttpRequest(methodParser.httpMethod(), url), methodParser, args); // Headers from Swagger method arguments always take precedence over inferred headers from body types for (final HttpHeader header : methodParser.headers(args)) { request.withHeader(header.name(), header.value()); } return request; }
java
@SuppressWarnings("unchecked") private HttpRequest createHttpRequest(SwaggerMethodParser methodParser, Object[] args) throws IOException { UrlBuilder urlBuilder; // Sometimes people pass in a full URL for the value of their PathParam annotated argument. // This definitely happens in paging scenarios. In that case, just use the full URL and // ignore the Host annotation. final String path = methodParser.path(args); final UrlBuilder pathUrlBuilder = UrlBuilder.parse(path); if (pathUrlBuilder.scheme() != null) { urlBuilder = pathUrlBuilder; } else { urlBuilder = new UrlBuilder(); // We add path to the UrlBuilder first because this is what is // provided to the HTTP Method annotation. Any path substitutions // from other substitution annotations will overwrite this. urlBuilder.withPath(path); final String scheme = methodParser.scheme(args); urlBuilder.withScheme(scheme); final String host = methodParser.host(args); urlBuilder.withHost(host); } for (final EncodedParameter queryParameter : methodParser.encodedQueryParameters(args)) { urlBuilder.setQueryParameter(queryParameter.name(), queryParameter.encodedValue()); } final URL url = urlBuilder.toURL(); final HttpRequest request = configRequest(new HttpRequest(methodParser.httpMethod(), url), methodParser, args); // Headers from Swagger method arguments always take precedence over inferred headers from body types for (final HttpHeader header : methodParser.headers(args)) { request.withHeader(header.name(), header.value()); } return request; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "HttpRequest", "createHttpRequest", "(", "SwaggerMethodParser", "methodParser", ",", "Object", "[", "]", "args", ")", "throws", "IOException", "{", "UrlBuilder", "urlBuilder", ";", "// Sometimes people pass ...
Create a HttpRequest for the provided Swagger method using the provided arguments. @param methodParser the Swagger method parser to use @param args the arguments to use to populate the method's annotation values @return a HttpRequest @throws IOException thrown if the body contents cannot be serialized
[ "Create", "a", "HttpRequest", "for", "the", "provided", "Swagger", "method", "using", "the", "provided", "arguments", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/common/azure-common/src/main/java/com/azure/common/implementation/RestProxy.java#L161-L200
lessthanoptimal/BoofCV
main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeAlignmentPatternLocator.java
QrCodeAlignmentPatternLocator.centerOnSquare
boolean centerOnSquare(QrCode.Alignment pattern, float guessY, float guessX) { float step = 1; float bestMag = Float.MAX_VALUE; float bestX = guessX; float bestY = guessY; for (int i = 0; i < 10; i++) { for (int row = 0; row < 3; row++) { float gridy = guessY - 1f + row; for (int col = 0; col < 3; col++) { float gridx = guessX - 1f + col; samples[row*3+col] = reader.read(gridy,gridx); } } float dx = (samples[2]+samples[5]+samples[8])-(samples[0]+samples[3]+samples[6]); float dy = (samples[6]+samples[7]+samples[8])-(samples[0]+samples[1]+samples[2]); float r = (float)Math.sqrt(dx*dx + dy*dy); if( bestMag > r ) { // System.out.println("good step at "+i); bestMag = r; bestX = guessX; bestY = guessY; } else { // System.out.println("bad step at "+i); step *= 0.75f; } if( r > 0 ) { guessX = bestX + step * dx / r; guessY = bestY + step * dy / r; } else { break; } } pattern.moduleFound.x = bestX; pattern.moduleFound.y = bestY; reader.gridToImage((float)pattern.moduleFound.y,(float)pattern.moduleFound.x,pattern.pixel); return true; }
java
boolean centerOnSquare(QrCode.Alignment pattern, float guessY, float guessX) { float step = 1; float bestMag = Float.MAX_VALUE; float bestX = guessX; float bestY = guessY; for (int i = 0; i < 10; i++) { for (int row = 0; row < 3; row++) { float gridy = guessY - 1f + row; for (int col = 0; col < 3; col++) { float gridx = guessX - 1f + col; samples[row*3+col] = reader.read(gridy,gridx); } } float dx = (samples[2]+samples[5]+samples[8])-(samples[0]+samples[3]+samples[6]); float dy = (samples[6]+samples[7]+samples[8])-(samples[0]+samples[1]+samples[2]); float r = (float)Math.sqrt(dx*dx + dy*dy); if( bestMag > r ) { // System.out.println("good step at "+i); bestMag = r; bestX = guessX; bestY = guessY; } else { // System.out.println("bad step at "+i); step *= 0.75f; } if( r > 0 ) { guessX = bestX + step * dx / r; guessY = bestY + step * dy / r; } else { break; } } pattern.moduleFound.x = bestX; pattern.moduleFound.y = bestY; reader.gridToImage((float)pattern.moduleFound.y,(float)pattern.moduleFound.x,pattern.pixel); return true; }
[ "boolean", "centerOnSquare", "(", "QrCode", ".", "Alignment", "pattern", ",", "float", "guessY", ",", "float", "guessX", ")", "{", "float", "step", "=", "1", ";", "float", "bestMag", "=", "Float", ".", "MAX_VALUE", ";", "float", "bestX", "=", "guessX", "...
If the initial guess is within the inner white circle or black dot this will ensure that it is centered on the black dot
[ "If", "the", "initial", "guess", "is", "within", "the", "inner", "white", "circle", "or", "black", "dot", "this", "will", "ensure", "that", "it", "is", "centered", "on", "the", "black", "dot" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-recognition/src/main/java/boofcv/alg/fiducial/qrcode/QrCodeAlignmentPatternLocator.java#L153-L198
line/armeria
core/src/main/java/com/linecorp/armeria/common/metric/PrometheusMeterRegistries.java
PrometheusMeterRegistries.newRegistry
public static PrometheusMeterRegistry newRegistry(CollectorRegistry registry, Clock clock) { final PrometheusMeterRegistry meterRegistry = new PrometheusMeterRegistry( PrometheusConfig.DEFAULT, requireNonNull(registry, "registry"), requireNonNull(clock, "clock")); meterRegistry.config().namingConvention(MoreNamingConventions.prometheus()); meterRegistry.config().pauseDetector(new NoPauseDetector()); return meterRegistry; }
java
public static PrometheusMeterRegistry newRegistry(CollectorRegistry registry, Clock clock) { final PrometheusMeterRegistry meterRegistry = new PrometheusMeterRegistry( PrometheusConfig.DEFAULT, requireNonNull(registry, "registry"), requireNonNull(clock, "clock")); meterRegistry.config().namingConvention(MoreNamingConventions.prometheus()); meterRegistry.config().pauseDetector(new NoPauseDetector()); return meterRegistry; }
[ "public", "static", "PrometheusMeterRegistry", "newRegistry", "(", "CollectorRegistry", "registry", ",", "Clock", "clock", ")", "{", "final", "PrometheusMeterRegistry", "meterRegistry", "=", "new", "PrometheusMeterRegistry", "(", "PrometheusConfig", ".", "DEFAULT", ",", ...
Returns a newly-created {@link PrometheusMeterRegistry} instance with the specified {@link CollectorRegistry} and {@link Clock}.
[ "Returns", "a", "newly", "-", "created", "{" ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/core/src/main/java/com/linecorp/armeria/common/metric/PrometheusMeterRegistries.java#L59-L65
h2oai/h2o-2
src/main/java/water/Model.java
Model.getDomainMapping
public static int[][] getDomainMapping(String[] modelDom, String[] colDom, boolean exact) { return getDomainMapping(null, modelDom, colDom, exact); }
java
public static int[][] getDomainMapping(String[] modelDom, String[] colDom, boolean exact) { return getDomainMapping(null, modelDom, colDom, exact); }
[ "public", "static", "int", "[", "]", "[", "]", "getDomainMapping", "(", "String", "[", "]", "modelDom", ",", "String", "[", "]", "colDom", ",", "boolean", "exact", ")", "{", "return", "getDomainMapping", "(", "null", ",", "modelDom", ",", "colDom", ",", ...
Returns a mapping between values of model domains (<code>modelDom</code>) and given column domain. @see #getDomainMapping(String, String[], String[], boolean)
[ "Returns", "a", "mapping", "between", "values", "of", "model", "domains", "(", "<code", ">", "modelDom<", "/", "code", ">", ")", "and", "given", "column", "domain", "." ]
train
https://github.com/h2oai/h2o-2/blob/be350f3f2c2fb6f135cc07c41f83fd0e4f521ac1/src/main/java/water/Model.java#L424-L426
NordicSemiconductor/Android-DFU-Library
dfu/src/main/java/no/nordicsemi/android/dfu/ButtonlessDfuImpl.java
ButtonlessDfuImpl.getStatusCode
@SuppressWarnings("SameParameterValue") private int getStatusCode(final byte[] response, final int request) throws UnknownResponseException { if (response == null || response.length < 3 || response[0] != OP_CODE_RESPONSE_CODE_KEY || response[1] != request || (response[2] != DFU_STATUS_SUCCESS && response[2] != SecureDfuError.BUTTONLESS_ERROR_OP_CODE_NOT_SUPPORTED && response[2] != SecureDfuError.BUTTONLESS_ERROR_OPERATION_FAILED)) throw new UnknownResponseException("Invalid response received", response, OP_CODE_RESPONSE_CODE_KEY, request); return response[2]; }
java
@SuppressWarnings("SameParameterValue") private int getStatusCode(final byte[] response, final int request) throws UnknownResponseException { if (response == null || response.length < 3 || response[0] != OP_CODE_RESPONSE_CODE_KEY || response[1] != request || (response[2] != DFU_STATUS_SUCCESS && response[2] != SecureDfuError.BUTTONLESS_ERROR_OP_CODE_NOT_SUPPORTED && response[2] != SecureDfuError.BUTTONLESS_ERROR_OPERATION_FAILED)) throw new UnknownResponseException("Invalid response received", response, OP_CODE_RESPONSE_CODE_KEY, request); return response[2]; }
[ "@", "SuppressWarnings", "(", "\"SameParameterValue\"", ")", "private", "int", "getStatusCode", "(", "final", "byte", "[", "]", "response", ",", "final", "int", "request", ")", "throws", "UnknownResponseException", "{", "if", "(", "response", "==", "null", "||",...
Checks whether the response received is valid and returns the status code. @param response the response received from the DFU device. @param request the expected Op Code. @return The status code. @throws UnknownResponseException if response was not valid.
[ "Checks", "whether", "the", "response", "received", "is", "valid", "and", "returns", "the", "status", "code", "." ]
train
https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/ButtonlessDfuImpl.java#L178-L185
Azure/azure-sdk-for-java
sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerAutomaticTuningsInner.java
ServerAutomaticTuningsInner.updateAsync
public Observable<ServerAutomaticTuningInner> updateAsync(String resourceGroupName, String serverName, ServerAutomaticTuningInner parameters) { return updateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1<ServiceResponse<ServerAutomaticTuningInner>, ServerAutomaticTuningInner>() { @Override public ServerAutomaticTuningInner call(ServiceResponse<ServerAutomaticTuningInner> response) { return response.body(); } }); }
java
public Observable<ServerAutomaticTuningInner> updateAsync(String resourceGroupName, String serverName, ServerAutomaticTuningInner parameters) { return updateWithServiceResponseAsync(resourceGroupName, serverName, parameters).map(new Func1<ServiceResponse<ServerAutomaticTuningInner>, ServerAutomaticTuningInner>() { @Override public ServerAutomaticTuningInner call(ServiceResponse<ServerAutomaticTuningInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ServerAutomaticTuningInner", ">", "updateAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "ServerAutomaticTuningInner", "parameters", ")", "{", "return", "updateWithServiceResponseAsync", "(", "resourceGroupName", "...
Update automatic tuning options on server. @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 parameters The requested automatic tuning resource state. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the ServerAutomaticTuningInner object
[ "Update", "automatic", "tuning", "options", "on", "server", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2017_03_01_preview/src/main/java/com/microsoft/azure/management/sql/v2017_03_01_preview/implementation/ServerAutomaticTuningsInner.java#L191-L198
OpenBEL/openbel-framework
org.openbel.framework.common/src/main/java/org/openbel/framework/common/external/ExternalType.java
ExternalType.writeInteger
public static void writeInteger(final ObjectOutput out, final Integer i) throws IOException { if (i == null) { out.writeByte(0); return; } out.writeByte(1); out.writeInt(i); }
java
public static void writeInteger(final ObjectOutput out, final Integer i) throws IOException { if (i == null) { out.writeByte(0); return; } out.writeByte(1); out.writeInt(i); }
[ "public", "static", "void", "writeInteger", "(", "final", "ObjectOutput", "out", ",", "final", "Integer", "i", ")", "throws", "IOException", "{", "if", "(", "i", "==", "null", ")", "{", "out", ".", "writeByte", "(", "0", ")", ";", "return", ";", "}", ...
Writes the {@link Integer} to the output. <p> This method and its equivalent {@link #readInteger(ObjectInput) read-variant} store {@code i} in a more efficient way than serializing the {@link Integer} class. </p> @param out Non-null {@link ObjectOutput} @param i {@link Integer}; may be null @throws IOException Thrown if an I/O error occurred @see #readInteger(ObjectInput)
[ "Writes", "the", "{", "@link", "Integer", "}", "to", "the", "output", ".", "<p", ">", "This", "method", "and", "its", "equivalent", "{", "@link", "#readInteger", "(", "ObjectInput", ")", "read", "-", "variant", "}", "store", "{", "@code", "i", "}", "in...
train
https://github.com/OpenBEL/openbel-framework/blob/149f80b1d6eabb15ab15815b6f745b0afa9fd2d3/org.openbel.framework.common/src/main/java/org/openbel/framework/common/external/ExternalType.java#L102-L110
Azure/azure-sdk-for-java
appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceCertificateOrdersInner.java
AppServiceCertificateOrdersInner.verifyDomainOwnershipAsync
public Observable<Void> verifyDomainOwnershipAsync(String resourceGroupName, String certificateOrderName) { return verifyDomainOwnershipWithServiceResponseAsync(resourceGroupName, certificateOrderName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> verifyDomainOwnershipAsync(String resourceGroupName, String certificateOrderName) { return verifyDomainOwnershipWithServiceResponseAsync(resourceGroupName, certificateOrderName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "verifyDomainOwnershipAsync", "(", "String", "resourceGroupName", ",", "String", "certificateOrderName", ")", "{", "return", "verifyDomainOwnershipWithServiceResponseAsync", "(", "resourceGroupName", ",", "certificateOrderName", ")", ...
Verify domain ownership for this certificate order. Verify domain ownership for this certificate order. @param resourceGroupName Name of the resource group to which the resource belongs. @param certificateOrderName Name of the certificate order. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Verify", "domain", "ownership", "for", "this", "certificate", "order", ".", "Verify", "domain", "ownership", "for", "this", "certificate", "order", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/AppServiceCertificateOrdersInner.java#L2171-L2178
TakahikoKawasaki/nv-websocket-client
src/main/java/com/neovisionaries/ws/client/ByteArray.java
ByteArray.put
public void put(byte[] source, int index, int length) { // If the buffer is small. if (mBuffer.capacity() < (mLength + length)) { expandBuffer(mLength + length + ADDITIONAL_BUFFER_SIZE); } mBuffer.put(source, index, length); mLength += length; }
java
public void put(byte[] source, int index, int length) { // If the buffer is small. if (mBuffer.capacity() < (mLength + length)) { expandBuffer(mLength + length + ADDITIONAL_BUFFER_SIZE); } mBuffer.put(source, index, length); mLength += length; }
[ "public", "void", "put", "(", "byte", "[", "]", "source", ",", "int", "index", ",", "int", "length", ")", "{", "// If the buffer is small.", "if", "(", "mBuffer", ".", "capacity", "(", ")", "<", "(", "mLength", "+", "length", ")", ")", "{", "expandBuff...
Add data at the current position. @param source Source data. @param index The index in the source data. Data from the index is copied. @param length The length of data to copy.
[ "Add", "data", "at", "the", "current", "position", "." ]
train
https://github.com/TakahikoKawasaki/nv-websocket-client/blob/efaec21181d740ad3808313acf679313179e0825/src/main/java/com/neovisionaries/ws/client/ByteArray.java#L154-L164
Azure/azure-sdk-for-java
iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java
IotHubResourcesInner.exportDevices
public JobResponseInner exportDevices(String resourceGroupName, String resourceName, ExportDevicesRequest exportDevicesParameters) { return exportDevicesWithServiceResponseAsync(resourceGroupName, resourceName, exportDevicesParameters).toBlocking().single().body(); }
java
public JobResponseInner exportDevices(String resourceGroupName, String resourceName, ExportDevicesRequest exportDevicesParameters) { return exportDevicesWithServiceResponseAsync(resourceGroupName, resourceName, exportDevicesParameters).toBlocking().single().body(); }
[ "public", "JobResponseInner", "exportDevices", "(", "String", "resourceGroupName", ",", "String", "resourceName", ",", "ExportDevicesRequest", "exportDevicesParameters", ")", "{", "return", "exportDevicesWithServiceResponseAsync", "(", "resourceGroupName", ",", "resourceName", ...
Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. Exports all the device identities in the IoT hub identity registry to an Azure Storage blob container. For more information, see: https://docs.microsoft.com/azure/iot-hub/iot-hub-devguide-identity-registry#import-and-export-device-identities. @param resourceGroupName The name of the resource group that contains the IoT hub. @param resourceName The name of the IoT hub. @param exportDevicesParameters The parameters that specify the export devices operation. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorDetailsException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the JobResponseInner object if successful.
[ "Exports", "all", "the", "device", "identities", "in", "the", "IoT", "hub", "identity", "registry", "to", "an", "Azure", "Storage", "blob", "container", ".", "For", "more", "information", "see", ":", "https", ":", "//", "docs", ".", "microsoft", ".", "com"...
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/iothub/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/iothub/v2018_04_01/implementation/IotHubResourcesInner.java#L3067-L3069
craftercms/commons
utilities/src/main/java/org/craftercms/commons/crypto/CryptoUtils.java
CryptoUtils.matchPassword
public static boolean matchPassword(String hashedPswdAndSalt, String clearPswd) { if (StringUtils.isNotEmpty(hashedPswdAndSalt) && StringUtils.isNotEmpty(clearPswd)) { int idxOfSep = hashedPswdAndSalt.indexOf(PASSWORD_SEP); String storedHash = hashedPswdAndSalt.substring(0, idxOfSep); String salt = hashedPswdAndSalt.substring(idxOfSep + 1); SimpleDigest digest = new SimpleDigest(); digest.setBase64Salt(salt); return storedHash.equals(digest.digestBase64(clearPswd)); } else if (hashedPswdAndSalt == null && clearPswd == null) { return true; } else if (hashedPswdAndSalt.isEmpty() && clearPswd.isEmpty()) { return true; } else { return false; } }
java
public static boolean matchPassword(String hashedPswdAndSalt, String clearPswd) { if (StringUtils.isNotEmpty(hashedPswdAndSalt) && StringUtils.isNotEmpty(clearPswd)) { int idxOfSep = hashedPswdAndSalt.indexOf(PASSWORD_SEP); String storedHash = hashedPswdAndSalt.substring(0, idxOfSep); String salt = hashedPswdAndSalt.substring(idxOfSep + 1); SimpleDigest digest = new SimpleDigest(); digest.setBase64Salt(salt); return storedHash.equals(digest.digestBase64(clearPswd)); } else if (hashedPswdAndSalt == null && clearPswd == null) { return true; } else if (hashedPswdAndSalt.isEmpty() && clearPswd.isEmpty()) { return true; } else { return false; } }
[ "public", "static", "boolean", "matchPassword", "(", "String", "hashedPswdAndSalt", ",", "String", "clearPswd", ")", "{", "if", "(", "StringUtils", ".", "isNotEmpty", "(", "hashedPswdAndSalt", ")", "&&", "StringUtils", ".", "isNotEmpty", "(", "clearPswd", ")", "...
Returns true if it's a password match, that is, if the hashed clear password equals the given hash. @param hashedPswdAndSalt the hashed password + {@link #PASSWORD_SEP} + salt, as returned by {@link #hashPassword(String)} @param clearPswd the password that we're trying to match, in clear @return if the password matches
[ "Returns", "true", "if", "it", "s", "a", "password", "match", "that", "is", "if", "the", "hashed", "clear", "password", "equals", "the", "given", "hash", "." ]
train
https://github.com/craftercms/commons/blob/3074fe49e56c2a4aae0832f40b17ae563335dc83/utilities/src/main/java/org/craftercms/commons/crypto/CryptoUtils.java#L120-L137
SonarSource/sonarqube
sonar-plugin-api/src/main/java/org/sonar/api/config/internal/MultivalueProperty.java
MultivalueProperty.retroTrim
private static int retroTrim(char[] res, int resI) { int i = resI; while (i >= 1) { if (!istrimmable(res[i - 1])) { return i; } i--; } return i; }
java
private static int retroTrim(char[] res, int resI) { int i = resI; while (i >= 1) { if (!istrimmable(res[i - 1])) { return i; } i--; } return i; }
[ "private", "static", "int", "retroTrim", "(", "char", "[", "]", "res", ",", "int", "resI", ")", "{", "int", "i", "=", "resI", ";", "while", "(", "i", ">=", "1", ")", "{", "if", "(", "!", "istrimmable", "(", "res", "[", "i", "-", "1", "]", ")"...
Reads from index {@code resI} to the beginning into {@code res} looking up the location of the trimmable char with the lowest index before encountering a non-trimmable char. <p> This basically trims {@code res} from any trimmable char at its end. @return index of next location to put new char in res
[ "Reads", "from", "index", "{", "@code", "resI", "}", "to", "the", "beginning", "into", "{", "@code", "res", "}", "looking", "up", "the", "location", "of", "the", "trimmable", "char", "with", "the", "lowest", "index", "before", "encountering", "a", "non", ...
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/config/internal/MultivalueProperty.java#L199-L208
haraldk/TwelveMonkeys
imageio/imageio-jpeg/src/main/java/com/twelvemonkeys/imageio/plugins/jpeg/JPEGLosslessDecoderWrapper.java
JPEGLosslessDecoderWrapper.to16Bit1ComponentGrayScale
private BufferedImage to16Bit1ComponentGrayScale(int[][] decoded, int precision, int width, int height) { BufferedImage image; if (precision == 16) { image = new BufferedImage(width, height, BufferedImage.TYPE_USHORT_GRAY); } else { ColorModel colorModel = new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_GRAY), new int[] {precision}, false, false, Transparency.OPAQUE, DataBuffer.TYPE_USHORT); image = new BufferedImage(colorModel, colorModel.createCompatibleWritableRaster(width, height), colorModel.isAlphaPremultiplied(), null); } short[] imageBuffer = ((DataBufferUShort) image.getRaster().getDataBuffer()).getData(); for (int i = 0; i < imageBuffer.length; i++) { imageBuffer[i] = (short) decoded[0][i]; } return image; }
java
private BufferedImage to16Bit1ComponentGrayScale(int[][] decoded, int precision, int width, int height) { BufferedImage image; if (precision == 16) { image = new BufferedImage(width, height, BufferedImage.TYPE_USHORT_GRAY); } else { ColorModel colorModel = new ComponentColorModel(ColorSpace.getInstance(ColorSpace.CS_GRAY), new int[] {precision}, false, false, Transparency.OPAQUE, DataBuffer.TYPE_USHORT); image = new BufferedImage(colorModel, colorModel.createCompatibleWritableRaster(width, height), colorModel.isAlphaPremultiplied(), null); } short[] imageBuffer = ((DataBufferUShort) image.getRaster().getDataBuffer()).getData(); for (int i = 0; i < imageBuffer.length; i++) { imageBuffer[i] = (short) decoded[0][i]; } return image; }
[ "private", "BufferedImage", "to16Bit1ComponentGrayScale", "(", "int", "[", "]", "[", "]", "decoded", ",", "int", "precision", ",", "int", "width", ",", "int", "height", ")", "{", "BufferedImage", "image", ";", "if", "(", "precision", "==", "16", ")", "{", ...
Converts the decoded buffer into a BufferedImage. precision: 16 bit, componentCount = 1 @param decoded data buffer @param precision @param width of the image @param height of the image @return a BufferedImage.TYPE_USHORT_GRAY
[ "Converts", "the", "decoded", "buffer", "into", "a", "BufferedImage", ".", "precision", ":", "16", "bit", "componentCount", "=", "1" ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/imageio/imageio-jpeg/src/main/java/com/twelvemonkeys/imageio/plugins/jpeg/JPEGLosslessDecoderWrapper.java#L132-L149
aws/aws-sdk-java
aws-java-sdk-cognitoidp/src/main/java/com/amazonaws/services/cognitoidp/model/RespondToAuthChallengeRequest.java
RespondToAuthChallengeRequest.withChallengeResponses
public RespondToAuthChallengeRequest withChallengeResponses(java.util.Map<String, String> challengeResponses) { setChallengeResponses(challengeResponses); return this; }
java
public RespondToAuthChallengeRequest withChallengeResponses(java.util.Map<String, String> challengeResponses) { setChallengeResponses(challengeResponses); return this; }
[ "public", "RespondToAuthChallengeRequest", "withChallengeResponses", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "challengeResponses", ")", "{", "setChallengeResponses", "(", "challengeResponses", ")", ";", "return", "this", ";", "}" ]
<p> The challenge responses. These are inputs corresponding to the value of <code>ChallengeName</code>, for example: </p> <ul> <li> <p> <code>SMS_MFA</code>: <code>SMS_MFA_CODE</code>, <code>USERNAME</code>, <code>SECRET_HASH</code> (if app client is configured with client secret). </p> </li> <li> <p> <code>PASSWORD_VERIFIER</code>: <code>PASSWORD_CLAIM_SIGNATURE</code>, <code>PASSWORD_CLAIM_SECRET_BLOCK</code>, <code>TIMESTAMP</code>, <code>USERNAME</code>, <code>SECRET_HASH</code> (if app client is configured with client secret). </p> </li> <li> <p> <code>NEW_PASSWORD_REQUIRED</code>: <code>NEW_PASSWORD</code>, any other required attributes, <code>USERNAME</code>, <code>SECRET_HASH</code> (if app client is configured with client secret). </p> </li> </ul> @param challengeResponses The challenge responses. These are inputs corresponding to the value of <code>ChallengeName</code>, for example:</p> <ul> <li> <p> <code>SMS_MFA</code>: <code>SMS_MFA_CODE</code>, <code>USERNAME</code>, <code>SECRET_HASH</code> (if app client is configured with client secret). </p> </li> <li> <p> <code>PASSWORD_VERIFIER</code>: <code>PASSWORD_CLAIM_SIGNATURE</code>, <code>PASSWORD_CLAIM_SECRET_BLOCK</code>, <code>TIMESTAMP</code>, <code>USERNAME</code>, <code>SECRET_HASH</code> (if app client is configured with client secret). </p> </li> <li> <p> <code>NEW_PASSWORD_REQUIRED</code>: <code>NEW_PASSWORD</code>, any other required attributes, <code>USERNAME</code>, <code>SECRET_HASH</code> (if app client is configured with client secret). </p> </li> @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "challenge", "responses", ".", "These", "are", "inputs", "corresponding", "to", "the", "value", "of", "<code", ">", "ChallengeName<", "/", "code", ">", "for", "example", ":", "<", "/", "p", ">", "<ul", ">", "<li", ">", "<p", ">", "<...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-cognitoidp/src/main/java/com/amazonaws/services/cognitoidp/model/RespondToAuthChallengeRequest.java#L453-L456
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/internal/util/LogQueryTool.java
LogQueryTool.exceptionWithQuery
public SQLException exceptionWithQuery(ParameterHolder[] parameters, SQLException sqlEx, PrepareResult serverPrepareResult) { if (sqlEx.getCause() instanceof SocketTimeoutException) { return new SQLException("Connection timed out", CONNECTION_EXCEPTION.getSqlState(), sqlEx); } if (options.dumpQueriesOnException) { return new SQLException(exWithQuery(sqlEx.getMessage(), serverPrepareResult, parameters), sqlEx.getSQLState(), sqlEx.getErrorCode(), sqlEx.getCause()); } return sqlEx; }
java
public SQLException exceptionWithQuery(ParameterHolder[] parameters, SQLException sqlEx, PrepareResult serverPrepareResult) { if (sqlEx.getCause() instanceof SocketTimeoutException) { return new SQLException("Connection timed out", CONNECTION_EXCEPTION.getSqlState(), sqlEx); } if (options.dumpQueriesOnException) { return new SQLException(exWithQuery(sqlEx.getMessage(), serverPrepareResult, parameters), sqlEx.getSQLState(), sqlEx.getErrorCode(), sqlEx.getCause()); } return sqlEx; }
[ "public", "SQLException", "exceptionWithQuery", "(", "ParameterHolder", "[", "]", "parameters", ",", "SQLException", "sqlEx", ",", "PrepareResult", "serverPrepareResult", ")", "{", "if", "(", "sqlEx", ".", "getCause", "(", ")", "instanceof", "SocketTimeoutException", ...
Return exception with query information's. @param parameters query parameters @param sqlEx current exception @param serverPrepareResult prepare results @return exception with query information
[ "Return", "exception", "with", "query", "information", "s", "." ]
train
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/util/LogQueryTool.java#L155-L166
b3dgs/lionengine
lionengine-core-awt/src/main/java/com/b3dgs/lionengine/awt/graphic/ToolsAwt.java
ToolsAwt.applyMask
public static BufferedImage applyMask(BufferedImage image, int rgba) { final BufferedImage mask = copyImage(image); final int height = mask.getHeight(); final int width = mask.getWidth(); for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { final int col = mask.getRGB(x, y); final int flag = 0x00_FF_FF_FF; if (col == rgba) { mask.setRGB(x, y, col & flag); } } } return mask; }
java
public static BufferedImage applyMask(BufferedImage image, int rgba) { final BufferedImage mask = copyImage(image); final int height = mask.getHeight(); final int width = mask.getWidth(); for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { final int col = mask.getRGB(x, y); final int flag = 0x00_FF_FF_FF; if (col == rgba) { mask.setRGB(x, y, col & flag); } } } return mask; }
[ "public", "static", "BufferedImage", "applyMask", "(", "BufferedImage", "image", ",", "int", "rgba", ")", "{", "final", "BufferedImage", "mask", "=", "copyImage", "(", "image", ")", ";", "final", "int", "height", "=", "mask", ".", "getHeight", "(", ")", ";...
Apply a mask to an existing image. @param image The existing image. @param rgba The rgba color value. @return The masked image.
[ "Apply", "a", "mask", "to", "an", "existing", "image", "." ]
train
https://github.com/b3dgs/lionengine/blob/cac3d5578532cf11724a737b9f09e71bf9995ab2/lionengine-core-awt/src/main/java/com/b3dgs/lionengine/awt/graphic/ToolsAwt.java#L188-L207
threerings/narya
core/src/main/java/com/threerings/crowd/server/PlaceRegistry.java
PlaceRegistry.createPlace
public PlaceManager createPlace (PlaceConfig config, PreStartupHook hook) throws InstantiationException, InvocationException { return createPlace(config, null, hook); }
java
public PlaceManager createPlace (PlaceConfig config, PreStartupHook hook) throws InstantiationException, InvocationException { return createPlace(config, null, hook); }
[ "public", "PlaceManager", "createPlace", "(", "PlaceConfig", "config", ",", "PreStartupHook", "hook", ")", "throws", "InstantiationException", ",", "InvocationException", "{", "return", "createPlace", "(", "config", ",", "null", ",", "hook", ")", ";", "}" ]
Don't use this method, see {@link #createPlace(PlaceConfig)}. @param hook an optional pre-startup hook that allows a place manager to be configured prior to having {@link PlaceManager#startup} called. This mainly exists because it used to be possible to do such things. Try not to use this in new code.
[ "Don", "t", "use", "this", "method", "see", "{", "@link", "#createPlace", "(", "PlaceConfig", ")", "}", "." ]
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/crowd/server/PlaceRegistry.java#L122-L126
anotheria/moskito
moskito-core/src/main/java/net/anotheria/moskito/core/predefined/PageInBrowserStats.java
PageInBrowserStats.getAverageWindowLoadTime
public double getAverageWindowLoadTime(final String intervalName, final TimeUnit unit) { return unit.transformMillis(totalWindowLoadTime.getValueAsLong(intervalName)) / numberOfLoads.getValueAsDouble(intervalName); }
java
public double getAverageWindowLoadTime(final String intervalName, final TimeUnit unit) { return unit.transformMillis(totalWindowLoadTime.getValueAsLong(intervalName)) / numberOfLoads.getValueAsDouble(intervalName); }
[ "public", "double", "getAverageWindowLoadTime", "(", "final", "String", "intervalName", ",", "final", "TimeUnit", "unit", ")", "{", "return", "unit", ".", "transformMillis", "(", "totalWindowLoadTime", ".", "getValueAsLong", "(", "intervalName", ")", ")", "/", "nu...
Returns the average web page load time for given interval and {@link TimeUnit}. @param intervalName name of the interval @param unit {@link TimeUnit} @return average web page load time
[ "Returns", "the", "average", "web", "page", "load", "time", "for", "given", "interval", "and", "{", "@link", "TimeUnit", "}", "." ]
train
https://github.com/anotheria/moskito/blob/0fdb79053b98a6ece610fa159f59bc3331e4cf05/moskito-core/src/main/java/net/anotheria/moskito/core/predefined/PageInBrowserStats.java#L221-L223
apiman/apiman
common/auth/src/main/java/io/apiman/common/auth/AuthTokenUtil.java
AuthTokenUtil.produceToken
public static final String produceToken(String principal, Set<String> roles, int expiresInMillis) { AuthToken authToken = createAuthToken(principal, roles, expiresInMillis); String json = toJSON(authToken); return StringUtils.newStringUtf8(Base64.encodeBase64(StringUtils.getBytesUtf8(json))); }
java
public static final String produceToken(String principal, Set<String> roles, int expiresInMillis) { AuthToken authToken = createAuthToken(principal, roles, expiresInMillis); String json = toJSON(authToken); return StringUtils.newStringUtf8(Base64.encodeBase64(StringUtils.getBytesUtf8(json))); }
[ "public", "static", "final", "String", "produceToken", "(", "String", "principal", ",", "Set", "<", "String", ">", "roles", ",", "int", "expiresInMillis", ")", "{", "AuthToken", "authToken", "=", "createAuthToken", "(", "principal", ",", "roles", ",", "expires...
Produce a token suitable for transmission. This will generate the auth token, then serialize it to a JSON string, then Base64 encode the JSON. @param principal the auth principal @param roles the auth roles @param expiresInMillis the number of millis to expiry @return the token
[ "Produce", "a", "token", "suitable", "for", "transmission", ".", "This", "will", "generate", "the", "auth", "token", "then", "serialize", "it", "to", "a", "JSON", "string", "then", "Base64", "encode", "the", "JSON", "." ]
train
https://github.com/apiman/apiman/blob/8c049c2a2f2e4a69bbb6125686a15edd26f29c21/common/auth/src/main/java/io/apiman/common/auth/AuthTokenUtil.java#L74-L78
OpenLiberty/open-liberty
dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/FeatureDependencyChecker.java
FeatureDependencyChecker.toBeUninstalled
public boolean toBeUninstalled(String name, List<UninstallAsset> list) { for (UninstallAsset asset : list) { String featureName = InstallUtils.getShortName(asset.getProvisioningFeatureDefinition()); if (asset.getName().equals(name) || (featureName != null && featureName.equals(name))) { InstallLogUtils.getInstallLogger().log(Level.FINEST, "The dependent feature is specified to be uninstalled : " + featureName); return true; } } return false; }
java
public boolean toBeUninstalled(String name, List<UninstallAsset> list) { for (UninstallAsset asset : list) { String featureName = InstallUtils.getShortName(asset.getProvisioningFeatureDefinition()); if (asset.getName().equals(name) || (featureName != null && featureName.equals(name))) { InstallLogUtils.getInstallLogger().log(Level.FINEST, "The dependent feature is specified to be uninstalled : " + featureName); return true; } } return false; }
[ "public", "boolean", "toBeUninstalled", "(", "String", "name", ",", "List", "<", "UninstallAsset", ">", "list", ")", "{", "for", "(", "UninstallAsset", "asset", ":", "list", ")", "{", "String", "featureName", "=", "InstallUtils", ".", "getShortName", "(", "a...
Verify the name is on the uninstall list @param name symbolic name of the feature @param list list of the uninstalling features @return true if the feature is going to be uninstalled, otherwise, return false.
[ "Verify", "the", "name", "is", "on", "the", "uninstall", "list" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.install/src/com/ibm/ws/install/internal/FeatureDependencyChecker.java#L42-L52
advantageous/boon
reflekt/src/main/java/io/advantageous/boon/core/reflection/ClassMeta.java
ClassMeta.respondsTo
public static boolean respondsTo(Object object, String method) { if (object instanceof Class) { return Reflection.respondsTo((Class) object, method); } else { return Reflection.respondsTo(object, method); } }
java
public static boolean respondsTo(Object object, String method) { if (object instanceof Class) { return Reflection.respondsTo((Class) object, method); } else { return Reflection.respondsTo(object, method); } }
[ "public", "static", "boolean", "respondsTo", "(", "Object", "object", ",", "String", "method", ")", "{", "if", "(", "object", "instanceof", "Class", ")", "{", "return", "Reflection", ".", "respondsTo", "(", "(", "Class", ")", "object", ",", "method", ")", ...
Checks to see if an object responds to a method. Helper facade over Reflection library. @param object object in question @param method method name in question. @return true or false
[ "Checks", "to", "see", "if", "an", "object", "responds", "to", "a", "method", ".", "Helper", "facade", "over", "Reflection", "library", "." ]
train
https://github.com/advantageous/boon/blob/12712d376761aa3b33223a9f1716720ddb67cb5e/reflekt/src/main/java/io/advantageous/boon/core/reflection/ClassMeta.java#L596-L602
overturetool/overture
ide/ui/src/main/java/org/overture/ide/ui/VdmPluginImages.java
VdmPluginImages.createUnManaged
private static ImageDescriptor createUnManaged(String prefix, String name) { return create(prefix, name, true); }
java
private static ImageDescriptor createUnManaged(String prefix, String name) { return create(prefix, name, true); }
[ "private", "static", "ImageDescriptor", "createUnManaged", "(", "String", "prefix", ",", "String", "name", ")", "{", "return", "create", "(", "prefix", ",", "name", ",", "true", ")", ";", "}" ]
/* Creates an image descriptor for the given prefix and name in the JDT UI bundle. The path can contain variables like $NL$. If no image could be found, the 'missing image descriptor' is returned.
[ "/", "*", "Creates", "an", "image", "descriptor", "for", "the", "given", "prefix", "and", "name", "in", "the", "JDT", "UI", "bundle", ".", "The", "path", "can", "contain", "variables", "like", "$NL$", ".", "If", "no", "image", "could", "be", "found", "...
train
https://github.com/overturetool/overture/blob/83175dc6c24fa171cde4fcf61ecb648eba3bdbc1/ide/ui/src/main/java/org/overture/ide/ui/VdmPluginImages.java#L793-L796
kazocsaba/matrix
src/main/java/hu/kazocsaba/math/matrix/immutable/ImmutableMatrixFactory.java
ImmutableMatrixFactory.zeros
public static ImmutableMatrix zeros(final int rows, final int cols) { if (rows <= 0 || cols <= 0) throw new IllegalArgumentException("Invalid dimensions"); return create(new ImmutableData(rows, cols) { @Override public double getQuick(int row, int col) { return 0; } }); }
java
public static ImmutableMatrix zeros(final int rows, final int cols) { if (rows <= 0 || cols <= 0) throw new IllegalArgumentException("Invalid dimensions"); return create(new ImmutableData(rows, cols) { @Override public double getQuick(int row, int col) { return 0; } }); }
[ "public", "static", "ImmutableMatrix", "zeros", "(", "final", "int", "rows", ",", "final", "int", "cols", ")", "{", "if", "(", "rows", "<=", "0", "||", "cols", "<=", "0", ")", "throw", "new", "IllegalArgumentException", "(", "\"Invalid dimensions\"", ")", ...
Returns an immutable matrix of the specified size whose elements are all 0. @param rows the number of rows @param cols the number of columns @return a <code>rows</code>×<code>cols</code> matrix whose elements are all 0 @throws IllegalArgumentException if either argument is non-positive
[ "Returns", "an", "immutable", "matrix", "of", "the", "specified", "size", "whose", "elements", "are", "all", "0", "." ]
train
https://github.com/kazocsaba/matrix/blob/018570db945fe616b25606fe605fa6e0c180ab5b/src/main/java/hu/kazocsaba/math/matrix/immutable/ImmutableMatrixFactory.java#L223-L231
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker08.java
WebSocketClientHandshaker08.newHandshakeRequest
@Override protected FullHttpRequest newHandshakeRequest() { // Get path URI wsURL = uri(); String path = rawPath(wsURL); // Get 16 bit nonce and base 64 encode it byte[] nonce = WebSocketUtil.randomBytes(16); String key = WebSocketUtil.base64(nonce); String acceptSeed = key + MAGIC_GUID; byte[] sha1 = WebSocketUtil.sha1(acceptSeed.getBytes(CharsetUtil.US_ASCII)); expectedChallengeResponseString = WebSocketUtil.base64(sha1); if (logger.isDebugEnabled()) { logger.debug( "WebSocket version 08 client handshake key: {}, expected response: {}", key, expectedChallengeResponseString); } // Format request FullHttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, path); HttpHeaders headers = request.headers(); if (customHeaders != null) { headers.add(customHeaders); } headers.set(HttpHeaderNames.UPGRADE, HttpHeaderValues.WEBSOCKET) .set(HttpHeaderNames.CONNECTION, HttpHeaderValues.UPGRADE) .set(HttpHeaderNames.SEC_WEBSOCKET_KEY, key) .set(HttpHeaderNames.HOST, websocketHostValue(wsURL)) .set(HttpHeaderNames.SEC_WEBSOCKET_ORIGIN, websocketOriginValue(wsURL)); String expectedSubprotocol = expectedSubprotocol(); if (expectedSubprotocol != null && !expectedSubprotocol.isEmpty()) { headers.set(HttpHeaderNames.SEC_WEBSOCKET_PROTOCOL, expectedSubprotocol); } headers.set(HttpHeaderNames.SEC_WEBSOCKET_VERSION, "8"); return request; }
java
@Override protected FullHttpRequest newHandshakeRequest() { // Get path URI wsURL = uri(); String path = rawPath(wsURL); // Get 16 bit nonce and base 64 encode it byte[] nonce = WebSocketUtil.randomBytes(16); String key = WebSocketUtil.base64(nonce); String acceptSeed = key + MAGIC_GUID; byte[] sha1 = WebSocketUtil.sha1(acceptSeed.getBytes(CharsetUtil.US_ASCII)); expectedChallengeResponseString = WebSocketUtil.base64(sha1); if (logger.isDebugEnabled()) { logger.debug( "WebSocket version 08 client handshake key: {}, expected response: {}", key, expectedChallengeResponseString); } // Format request FullHttpRequest request = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, path); HttpHeaders headers = request.headers(); if (customHeaders != null) { headers.add(customHeaders); } headers.set(HttpHeaderNames.UPGRADE, HttpHeaderValues.WEBSOCKET) .set(HttpHeaderNames.CONNECTION, HttpHeaderValues.UPGRADE) .set(HttpHeaderNames.SEC_WEBSOCKET_KEY, key) .set(HttpHeaderNames.HOST, websocketHostValue(wsURL)) .set(HttpHeaderNames.SEC_WEBSOCKET_ORIGIN, websocketOriginValue(wsURL)); String expectedSubprotocol = expectedSubprotocol(); if (expectedSubprotocol != null && !expectedSubprotocol.isEmpty()) { headers.set(HttpHeaderNames.SEC_WEBSOCKET_PROTOCOL, expectedSubprotocol); } headers.set(HttpHeaderNames.SEC_WEBSOCKET_VERSION, "8"); return request; }
[ "@", "Override", "protected", "FullHttpRequest", "newHandshakeRequest", "(", ")", "{", "// Get path", "URI", "wsURL", "=", "uri", "(", ")", ";", "String", "path", "=", "rawPath", "(", "wsURL", ")", ";", "// Get 16 bit nonce and base 64 encode it", "byte", "[", "...
/** <p> Sends the opening request to the server: </p> <pre> GET /chat HTTP/1.1 Host: server.example.com Upgrade: websocket Connection: Upgrade Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ== Sec-WebSocket-Origin: http://example.com Sec-WebSocket-Protocol: chat, superchat Sec-WebSocket-Version: 8 </pre>
[ "/", "**", "<p", ">", "Sends", "the", "opening", "request", "to", "the", "server", ":", "<", "/", "p", ">" ]
train
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketClientHandshaker08.java#L159-L200
dbracewell/hermes
hermes-core/src/main/java/com/davidbracewell/hermes/HString.java
HString.annotationGraph
public RelationGraph annotationGraph(@NonNull Tuple relationTypes, @NonNull AnnotationType... annotationTypes) { RelationGraph g = new RelationGraph(); List<Annotation> vertices = interleaved(annotationTypes); Set<RelationType> relationTypeList = Streams .asStream(relationTypes.iterator()) .filter(r -> r instanceof RelationType) .map(Cast::<RelationType>as) .collect(Collectors.toSet()); g.addVertices(vertices); for (Annotation source : vertices) { Collection<Relation> relations = source.relations(true); for (Relation relation : relations) { if (relationTypeList.contains(relation.getType())) { relation .getTarget(document()) .ifPresent(target -> { target = g.containsVertex(target) ? target : target .stream(AnnotationType.ROOT) .filter(g::containsVertex) .findFirst() .orElse(null); if (target != null) { if (!g.containsEdge(source, target)) { RelationEdge edge = g.addEdge(source, target); edge.setRelation(relation.getValue()); edge.setRelationType(relation.getType()); } } }); } } } return g; }
java
public RelationGraph annotationGraph(@NonNull Tuple relationTypes, @NonNull AnnotationType... annotationTypes) { RelationGraph g = new RelationGraph(); List<Annotation> vertices = interleaved(annotationTypes); Set<RelationType> relationTypeList = Streams .asStream(relationTypes.iterator()) .filter(r -> r instanceof RelationType) .map(Cast::<RelationType>as) .collect(Collectors.toSet()); g.addVertices(vertices); for (Annotation source : vertices) { Collection<Relation> relations = source.relations(true); for (Relation relation : relations) { if (relationTypeList.contains(relation.getType())) { relation .getTarget(document()) .ifPresent(target -> { target = g.containsVertex(target) ? target : target .stream(AnnotationType.ROOT) .filter(g::containsVertex) .findFirst() .orElse(null); if (target != null) { if (!g.containsEdge(source, target)) { RelationEdge edge = g.addEdge(source, target); edge.setRelation(relation.getValue()); edge.setRelationType(relation.getType()); } } }); } } } return g; }
[ "public", "RelationGraph", "annotationGraph", "(", "@", "NonNull", "Tuple", "relationTypes", ",", "@", "NonNull", "AnnotationType", "...", "annotationTypes", ")", "{", "RelationGraph", "g", "=", "new", "RelationGraph", "(", ")", ";", "List", "<", "Annotation", "...
<p>Constructs a relation graph with the given relation types as the edges and the given annotation types as the vertices (the {@link #interleaved(AnnotationType...)} method is used to get the annotations). Relations will be determine for annotations by including the relations of their sub-annotations (i.e. sub-spans). This allows, for example, a dependency graph to be built over other annotation types, e.g. phrase chunks.</p> @param relationTypes the relation types making up the edges @param annotationTypes annotation types making up the vertices @return the relation graph
[ "<p", ">", "Constructs", "a", "relation", "graph", "with", "the", "given", "relation", "types", "as", "the", "edges", "and", "the", "given", "annotation", "types", "as", "the", "vertices", "(", "the", "{", "@link", "#interleaved", "(", "AnnotationType", "......
train
https://github.com/dbracewell/hermes/blob/9ebefe7ad5dea1b731ae6931a30771eb75325ea3/hermes-core/src/main/java/com/davidbracewell/hermes/HString.java#L132-L167
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/FastStringBuffer.java
FastStringBuffer.isWhitespace
public boolean isWhitespace(int start, int length) { int sourcechunk = start >>> m_chunkBits; int sourcecolumn = start & m_chunkMask; int available = m_chunkSize - sourcecolumn; boolean chunkOK; while (length > 0) { int runlength = (length <= available) ? length : available; if (sourcechunk == 0 && m_innerFSB != null) chunkOK = m_innerFSB.isWhitespace(sourcecolumn, runlength); else chunkOK = org.apache.xml.utils.XMLCharacterRecognizer.isWhiteSpace( m_array[sourcechunk], sourcecolumn, runlength); if (!chunkOK) return false; length -= runlength; ++sourcechunk; sourcecolumn = 0; available = m_chunkSize; } return true; }
java
public boolean isWhitespace(int start, int length) { int sourcechunk = start >>> m_chunkBits; int sourcecolumn = start & m_chunkMask; int available = m_chunkSize - sourcecolumn; boolean chunkOK; while (length > 0) { int runlength = (length <= available) ? length : available; if (sourcechunk == 0 && m_innerFSB != null) chunkOK = m_innerFSB.isWhitespace(sourcecolumn, runlength); else chunkOK = org.apache.xml.utils.XMLCharacterRecognizer.isWhiteSpace( m_array[sourcechunk], sourcecolumn, runlength); if (!chunkOK) return false; length -= runlength; ++sourcechunk; sourcecolumn = 0; available = m_chunkSize; } return true; }
[ "public", "boolean", "isWhitespace", "(", "int", "start", ",", "int", "length", ")", "{", "int", "sourcechunk", "=", "start", ">>>", "m_chunkBits", ";", "int", "sourcecolumn", "=", "start", "&", "m_chunkMask", ";", "int", "available", "=", "m_chunkSize", "-"...
@return true if the specified range of characters are all whitespace, as defined by XMLCharacterRecognizer. <p> CURRENTLY DOES NOT CHECK FOR OUT-OF-RANGE. @param start Offset of first character in the range. @param length Number of characters to send.
[ "@return", "true", "if", "the", "specified", "range", "of", "characters", "are", "all", "whitespace", "as", "defined", "by", "XMLCharacterRecognizer", ".", "<p", ">", "CURRENTLY", "DOES", "NOT", "CHECK", "FOR", "OUT", "-", "OF", "-", "RANGE", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/FastStringBuffer.java#L824-L854
mirage-sql/mirage
src/main/java/com/miragesql/miragesql/util/MirageUtil.java
MirageUtil.buildSelectSQL
public static String buildSelectSQL(BeanDescFactory beanDescFactory, EntityOperator entityOperator, Class<?> clazz, NameConverter nameConverter){ StringBuilder sb = new StringBuilder(); BeanDesc beanDesc = beanDescFactory.getBeanDesc(clazz); sb.append("SELECT * FROM "); sb.append(MirageUtil.getTableName(clazz, nameConverter)); sb.append(" WHERE "); int count = 0; for(int i=0; i<beanDesc.getPropertyDescSize(); i++){ PropertyDesc pd = beanDesc.getPropertyDesc(i); PrimaryKeyInfo primaryKey = entityOperator.getPrimaryKeyInfo(clazz, pd, nameConverter); if(primaryKey != null){ if(count != 0){ sb.append(" AND "); } sb.append(MirageUtil.getColumnName(entityOperator, clazz, pd, nameConverter)); sb.append(" = ?"); count++; } } if(count == 0){ throw new RuntimeException( "Primary key is not found: " + clazz.getName()); } return sb.toString(); }
java
public static String buildSelectSQL(BeanDescFactory beanDescFactory, EntityOperator entityOperator, Class<?> clazz, NameConverter nameConverter){ StringBuilder sb = new StringBuilder(); BeanDesc beanDesc = beanDescFactory.getBeanDesc(clazz); sb.append("SELECT * FROM "); sb.append(MirageUtil.getTableName(clazz, nameConverter)); sb.append(" WHERE "); int count = 0; for(int i=0; i<beanDesc.getPropertyDescSize(); i++){ PropertyDesc pd = beanDesc.getPropertyDesc(i); PrimaryKeyInfo primaryKey = entityOperator.getPrimaryKeyInfo(clazz, pd, nameConverter); if(primaryKey != null){ if(count != 0){ sb.append(" AND "); } sb.append(MirageUtil.getColumnName(entityOperator, clazz, pd, nameConverter)); sb.append(" = ?"); count++; } } if(count == 0){ throw new RuntimeException( "Primary key is not found: " + clazz.getName()); } return sb.toString(); }
[ "public", "static", "String", "buildSelectSQL", "(", "BeanDescFactory", "beanDescFactory", ",", "EntityOperator", "entityOperator", ",", "Class", "<", "?", ">", "clazz", ",", "NameConverter", "nameConverter", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuild...
Builds select (by primary keys) SQL from the entity class. @param beanDescFactory the bean descriptor factory @param entityOperator the entity operator @param clazz the entity class to select @param nameConverter the name converter @return Select SQL @throws RuntimeException the entity class has no primary keys @deprecated use {@link #buildSelectSQL(String, BeanDescFactory, EntityOperator, Class, NameConverter)} instead
[ "Builds", "select", "(", "by", "primary", "keys", ")", "SQL", "from", "the", "entity", "class", "." ]
train
https://github.com/mirage-sql/mirage/blob/29a44b7ad267b5a48bc250cd0ef7d74813d46889/src/main/java/com/miragesql/miragesql/util/MirageUtil.java#L124-L152
redbox-mint/redbox
plugins/transformer/vital-fedora2/src/main/java/com/googlecode/fascinator/redbox/VitalTransformer.java
VitalTransformer.createNewObject
private String createNewObject(FedoraClient fedora, String oid) throws Exception { InputStream in = null; byte[] template = null; // Start by reading our FOXML template into memory try { if (foxmlTemplate != null) { // We have a user provided template in = new FileInputStream(foxmlTemplate); template = IOUtils.toByteArray(in); } else { // Use the built in template in = getClass().getResourceAsStream("/foxml_template.xml"); template = IOUtils.toByteArray(in); } } catch (IOException ex) { throw new Exception( "Error accessing FOXML Template, please check system configuration!"); } finally { if (in != null) { in.close(); } } String vitalPid = fedora.getAPIM().ingest(template, Strings.FOXML_VERSION, "ReDBox creating new object: '" + oid + "'"); log.info("New VITAL PID: '{}'", vitalPid); return vitalPid; }
java
private String createNewObject(FedoraClient fedora, String oid) throws Exception { InputStream in = null; byte[] template = null; // Start by reading our FOXML template into memory try { if (foxmlTemplate != null) { // We have a user provided template in = new FileInputStream(foxmlTemplate); template = IOUtils.toByteArray(in); } else { // Use the built in template in = getClass().getResourceAsStream("/foxml_template.xml"); template = IOUtils.toByteArray(in); } } catch (IOException ex) { throw new Exception( "Error accessing FOXML Template, please check system configuration!"); } finally { if (in != null) { in.close(); } } String vitalPid = fedora.getAPIM().ingest(template, Strings.FOXML_VERSION, "ReDBox creating new object: '" + oid + "'"); log.info("New VITAL PID: '{}'", vitalPid); return vitalPid; }
[ "private", "String", "createNewObject", "(", "FedoraClient", "fedora", ",", "String", "oid", ")", "throws", "Exception", "{", "InputStream", "in", "=", "null", ";", "byte", "[", "]", "template", "=", "null", ";", "// Start by reading our FOXML template into memory",...
Create a new VITAL object and return the PID. @param fedora An instantiated fedora client @param oid The ID of the ReDBox object we will store here. For logging @return String The new VITAL PID that was just created
[ "Create", "a", "new", "VITAL", "object", "and", "return", "the", "PID", "." ]
train
https://github.com/redbox-mint/redbox/blob/1db230f218031b85c48c8603cbb04fce7ac6de0c/plugins/transformer/vital-fedora2/src/main/java/com/googlecode/fascinator/redbox/VitalTransformer.java#L667-L696
apache/flink
flink-core/src/main/java/org/apache/flink/types/Record.java
Record.getField
@SuppressWarnings("unchecked") public <T extends Value> T getField(int fieldNum, T target) { // range check if (fieldNum < 0 || fieldNum >= this.numFields) { throw new IndexOutOfBoundsException(); } if (target == null) { throw new NullPointerException("The target object may not be null"); } // get offset and check for null final int offset = this.offsets[fieldNum]; if (offset == NULL_INDICATOR_OFFSET) { return null; } else if (offset == MODIFIED_INDICATOR_OFFSET) { // value that has been set is new or modified // bring the binary in sync so that the deserialization gives the correct result return (T) this.writeFields[fieldNum]; } final int limit = offset + this.lengths[fieldNum]; deserialize(target, offset, limit, fieldNum); return target; }
java
@SuppressWarnings("unchecked") public <T extends Value> T getField(int fieldNum, T target) { // range check if (fieldNum < 0 || fieldNum >= this.numFields) { throw new IndexOutOfBoundsException(); } if (target == null) { throw new NullPointerException("The target object may not be null"); } // get offset and check for null final int offset = this.offsets[fieldNum]; if (offset == NULL_INDICATOR_OFFSET) { return null; } else if (offset == MODIFIED_INDICATOR_OFFSET) { // value that has been set is new or modified // bring the binary in sync so that the deserialization gives the correct result return (T) this.writeFields[fieldNum]; } final int limit = offset + this.lengths[fieldNum]; deserialize(target, offset, limit, fieldNum); return target; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "T", "extends", "Value", ">", "T", "getField", "(", "int", "fieldNum", ",", "T", "target", ")", "{", "// range check", "if", "(", "fieldNum", "<", "0", "||", "fieldNum", ">=", "this", "."...
Gets the field at the given position. The method tries to deserialize the fields into the given target value. If the fields has been changed since the last (de)serialization, or is null, them the target value is left unchanged and the changed value (or null) is returned. <p> In all cases, the returned value contains the correct data (or is correctly null). @param fieldNum The position of the field. @param target The value to deserialize the field into. @return The value with the contents of the requested field, or null, if the field is null.
[ "Gets", "the", "field", "at", "the", "given", "position", ".", "The", "method", "tries", "to", "deserialize", "the", "fields", "into", "the", "given", "target", "value", ".", "If", "the", "fields", "has", "been", "changed", "since", "the", "last", "(", "...
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-core/src/main/java/org/apache/flink/types/Record.java#L269-L293
looly/hutool
hutool-http/src/main/java/cn/hutool/http/HttpUtil.java
HttpUtil.download
public static long download(String url, OutputStream out, boolean isCloseOut) { return download(url, out, isCloseOut, null); }
java
public static long download(String url, OutputStream out, boolean isCloseOut) { return download(url, out, isCloseOut, null); }
[ "public", "static", "long", "download", "(", "String", "url", ",", "OutputStream", "out", ",", "boolean", "isCloseOut", ")", "{", "return", "download", "(", "url", ",", "out", ",", "isCloseOut", ",", "null", ")", ";", "}" ]
下载远程文件 @param url 请求的url @param out 将下载内容写到输出流中 {@link OutputStream} @param isCloseOut 是否关闭输出流 @return 文件大小
[ "下载远程文件" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-http/src/main/java/cn/hutool/http/HttpUtil.java#L326-L328
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/denoise/wavelet/DenoiseVisuShrink_F32.java
DenoiseVisuShrink_F32.denoise
@Override public void denoise(GrayF32 transform , int numLevels ) { int scale = UtilWavelet.computeScale(numLevels); final int h = transform.height; final int w = transform.width; // width and height of scaling image final int innerWidth = w/scale; final int innerHeight = h/scale; GrayF32 subbandHH = transform.subimage(w/2,h/2,w,h, null); float sigma = UtilDenoiseWavelet.estimateNoiseStdDev(subbandHH,null); float threshold = (float) UtilDenoiseWavelet.universalThreshold(subbandHH,sigma); // apply same threshold to all wavelet coefficients rule.process(transform.subimage(innerWidth,0,w,h, null),threshold); rule.process(transform.subimage(0,innerHeight,innerWidth,h, null),threshold); }
java
@Override public void denoise(GrayF32 transform , int numLevels ) { int scale = UtilWavelet.computeScale(numLevels); final int h = transform.height; final int w = transform.width; // width and height of scaling image final int innerWidth = w/scale; final int innerHeight = h/scale; GrayF32 subbandHH = transform.subimage(w/2,h/2,w,h, null); float sigma = UtilDenoiseWavelet.estimateNoiseStdDev(subbandHH,null); float threshold = (float) UtilDenoiseWavelet.universalThreshold(subbandHH,sigma); // apply same threshold to all wavelet coefficients rule.process(transform.subimage(innerWidth,0,w,h, null),threshold); rule.process(transform.subimage(0,innerHeight,innerWidth,h, null),threshold); }
[ "@", "Override", "public", "void", "denoise", "(", "GrayF32", "transform", ",", "int", "numLevels", ")", "{", "int", "scale", "=", "UtilWavelet", ".", "computeScale", "(", "numLevels", ")", ";", "final", "int", "h", "=", "transform", ".", "height", ";", ...
Applies VisuShrink denoising to the provided multilevel wavelet transform using the provided threshold. @param transform Mult-level wavelet transform. Modified. @param numLevels Number of levels in the transform.
[ "Applies", "VisuShrink", "denoising", "to", "the", "provided", "multilevel", "wavelet", "transform", "using", "the", "provided", "threshold", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/denoise/wavelet/DenoiseVisuShrink_F32.java#L51-L69
jtablesaw/tablesaw
core/src/main/java/tech/tablesaw/sorting/SortUtils.java
SortUtils.getChain
public static IntComparatorChain getChain(Table table, Sort key) { Iterator<Map.Entry<String, Sort.Order>> entries = key.iterator(); Map.Entry<String, Sort.Order> sort = entries.next(); Column<?> column = table.column(sort.getKey()); IntComparator comparator = rowComparator(column, sort.getValue()); IntComparatorChain chain = new IntComparatorChain(comparator); while (entries.hasNext()) { sort = entries.next(); chain.addComparator(rowComparator(table.column(sort.getKey()), sort.getValue())); } return chain; }
java
public static IntComparatorChain getChain(Table table, Sort key) { Iterator<Map.Entry<String, Sort.Order>> entries = key.iterator(); Map.Entry<String, Sort.Order> sort = entries.next(); Column<?> column = table.column(sort.getKey()); IntComparator comparator = rowComparator(column, sort.getValue()); IntComparatorChain chain = new IntComparatorChain(comparator); while (entries.hasNext()) { sort = entries.next(); chain.addComparator(rowComparator(table.column(sort.getKey()), sort.getValue())); } return chain; }
[ "public", "static", "IntComparatorChain", "getChain", "(", "Table", "table", ",", "Sort", "key", ")", "{", "Iterator", "<", "Map", ".", "Entry", "<", "String", ",", "Sort", ".", "Order", ">", ">", "entries", "=", "key", ".", "iterator", "(", ")", ";", ...
Returns a comparator chain for sorting according to the given key
[ "Returns", "a", "comparator", "chain", "for", "sorting", "according", "to", "the", "given", "key" ]
train
https://github.com/jtablesaw/tablesaw/blob/68a75b4098ac677e9486df5572cf13ec39f9f701/core/src/main/java/tech/tablesaw/sorting/SortUtils.java#L17-L29
astrapi69/jaulp-wicket
jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/factory/ComponentFactory.java
ComponentFactory.newPasswordTextField
public static PasswordTextField newPasswordTextField(final String id, final IModel<String> model) { final PasswordTextField passwordTextField = new PasswordTextField(id, model); passwordTextField.setOutputMarkupId(true); return passwordTextField; }
java
public static PasswordTextField newPasswordTextField(final String id, final IModel<String> model) { final PasswordTextField passwordTextField = new PasswordTextField(id, model); passwordTextField.setOutputMarkupId(true); return passwordTextField; }
[ "public", "static", "PasswordTextField", "newPasswordTextField", "(", "final", "String", "id", ",", "final", "IModel", "<", "String", ">", "model", ")", "{", "final", "PasswordTextField", "passwordTextField", "=", "new", "PasswordTextField", "(", "id", ",", "model...
Factory method for create a new {@link PasswordTextField}. @param id the id @param model the model @return the new {@link PasswordTextField}
[ "Factory", "method", "for", "create", "a", "new", "{", "@link", "PasswordTextField", "}", "." ]
train
https://github.com/astrapi69/jaulp-wicket/blob/85d74368d00abd9bb97659b5794e38c0f8a013d4/jaulp-wicket-components/src/main/java/de/alpharogroup/wicket/components/factory/ComponentFactory.java#L536-L542
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/workspace/VoiceApi.java
VoiceApi.initiateConference
public void initiateConference( String connId, String destination, String location, String outboundCallerId, KeyValueCollection userData, KeyValueCollection reasons, KeyValueCollection extensions ) throws WorkspaceApiException { try { VoicecallsidinitiateconferenceData initData = new VoicecallsidinitiateconferenceData(); initData.setDestination(destination); initData.setLocation(location); initData.setOutboundCallerId(outboundCallerId); initData.setUserData(Util.toKVList(userData)); initData.setReasons(Util.toKVList(reasons)); initData.setExtensions(Util.toKVList(extensions)); InitiateConferenceData data = new InitiateConferenceData(); data.data(initData); ApiSuccessResponse response = this.voiceApi.initiateConference(connId, data); throwIfNotOk("initiateConference", response); } catch (ApiException e) { throw new WorkspaceApiException("initiateConference failed.", e); } }
java
public void initiateConference( String connId, String destination, String location, String outboundCallerId, KeyValueCollection userData, KeyValueCollection reasons, KeyValueCollection extensions ) throws WorkspaceApiException { try { VoicecallsidinitiateconferenceData initData = new VoicecallsidinitiateconferenceData(); initData.setDestination(destination); initData.setLocation(location); initData.setOutboundCallerId(outboundCallerId); initData.setUserData(Util.toKVList(userData)); initData.setReasons(Util.toKVList(reasons)); initData.setExtensions(Util.toKVList(extensions)); InitiateConferenceData data = new InitiateConferenceData(); data.data(initData); ApiSuccessResponse response = this.voiceApi.initiateConference(connId, data); throwIfNotOk("initiateConference", response); } catch (ApiException e) { throw new WorkspaceApiException("initiateConference failed.", e); } }
[ "public", "void", "initiateConference", "(", "String", "connId", ",", "String", "destination", ",", "String", "location", ",", "String", "outboundCallerId", ",", "KeyValueCollection", "userData", ",", "KeyValueCollection", "reasons", ",", "KeyValueCollection", "extensio...
Initiate a two-step conference to the specified destination. This places the existing call on hold and creates a new call in the dialing state. After initiating the conference you can use completeConference to complete the conference and bring all parties into the same call. @param connId The connection ID of the call to start the conference from. This call will be placed on hold. @param destination The number to be dialed. @param location Name of the remote location in the form of <SwitchName> or <T-ServerApplicationName>@<SwitchName>. This value is used by Workspace to set the location attribute for the corresponding T-Server requests. (optional) @param outboundCallerId The caller ID information to display on the destination party's phone. The value should be set as CPNDigits. For more information about caller ID, see the SIP Server Deployment Guide. (optional) @param userData Key/value data to include with the call. (optional) @param reasons Information on causes for, and results of, actions taken by the user of the current DN. For details about reasons, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Reasons). (optional) @param extensions Media device/hardware reason codes and similar information. For details about extensions, refer to the [*Genesys Events and Models Reference Manual*](https://docs.genesys.com/Documentation/System/Current/GenEM/Extensions). (optional)
[ "Initiate", "a", "two", "-", "step", "conference", "to", "the", "specified", "destination", ".", "This", "places", "the", "existing", "call", "on", "hold", "and", "creates", "a", "new", "call", "in", "the", "dialing", "state", ".", "After", "initiating", "...
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/workspace/VoiceApi.java#L695-L721
alkacon/opencms-core
src/org/opencms/ade/containerpage/CmsDetailOnlyContainerUtil.java
CmsDetailOnlyContainerUtil.isDetailContainersPage
public static boolean isDetailContainersPage(CmsObject cms, String detailContainersPage) { boolean result = false; try { String detailName = CmsResource.getName(detailContainersPage); String parentFolder = CmsResource.getParentFolder(detailContainersPage); if (!parentFolder.endsWith("/" + DETAIL_CONTAINERS_FOLDER_NAME + "/")) { // this will be the case for locale dependent detail only pages, move one level up parentFolder = CmsResource.getParentFolder(parentFolder); } detailName = CmsStringUtil.joinPaths(CmsResource.getParentFolder(parentFolder), detailName); result = parentFolder.endsWith("/" + DETAIL_CONTAINERS_FOLDER_NAME + "/") && cms.existsResource(detailName, CmsResourceFilter.IGNORE_EXPIRATION); } catch (Throwable t) { // may happen in case string operations fail LOG.debug(t.getLocalizedMessage(), t); } return result; }
java
public static boolean isDetailContainersPage(CmsObject cms, String detailContainersPage) { boolean result = false; try { String detailName = CmsResource.getName(detailContainersPage); String parentFolder = CmsResource.getParentFolder(detailContainersPage); if (!parentFolder.endsWith("/" + DETAIL_CONTAINERS_FOLDER_NAME + "/")) { // this will be the case for locale dependent detail only pages, move one level up parentFolder = CmsResource.getParentFolder(parentFolder); } detailName = CmsStringUtil.joinPaths(CmsResource.getParentFolder(parentFolder), detailName); result = parentFolder.endsWith("/" + DETAIL_CONTAINERS_FOLDER_NAME + "/") && cms.existsResource(detailName, CmsResourceFilter.IGNORE_EXPIRATION); } catch (Throwable t) { // may happen in case string operations fail LOG.debug(t.getLocalizedMessage(), t); } return result; }
[ "public", "static", "boolean", "isDetailContainersPage", "(", "CmsObject", "cms", ",", "String", "detailContainersPage", ")", "{", "boolean", "result", "=", "false", ";", "try", "{", "String", "detailName", "=", "CmsResource", ".", "getName", "(", "detailContainer...
Checks whether the given resource path is of a detail containers page.<p> @param cms the cms context @param detailContainersPage the resource site path @return <code>true</code> if the given resource path is of a detail containers page
[ "Checks", "whether", "the", "given", "resource", "path", "is", "of", "a", "detail", "containers", "page", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/containerpage/CmsDetailOnlyContainerUtil.java#L305-L323
ribot/easy-adapter
library/src/main/java/uk/co/ribot/easyadapter/annotations/FieldAnnotationParser.java
FieldAnnotationParser.setViewFields
public static void setViewFields(final Object object, final View view) { setViewFields(object, new ViewFinder() { @Override public View findViewById(int viewId) { return view.findViewById(viewId); } }); }
java
public static void setViewFields(final Object object, final View view) { setViewFields(object, new ViewFinder() { @Override public View findViewById(int viewId) { return view.findViewById(viewId); } }); }
[ "public", "static", "void", "setViewFields", "(", "final", "Object", "object", ",", "final", "View", "view", ")", "{", "setViewFields", "(", "object", ",", "new", "ViewFinder", "(", ")", "{", "@", "Override", "public", "View", "findViewById", "(", "int", "...
Parse {@link ViewId} annotation and try to assign the view with that id to the annotated field. It will throw a {@link ClassCastException} if the field and the view with the given ID have different types. @param object object where the annotation is. @param view parent view that contains a view with the viewId given in the annotation.
[ "Parse", "{", "@link", "ViewId", "}", "annotation", "and", "try", "to", "assign", "the", "view", "with", "that", "id", "to", "the", "annotated", "field", ".", "It", "will", "throw", "a", "{", "@link", "ClassCastException", "}", "if", "the", "field", "and...
train
https://github.com/ribot/easy-adapter/blob/8cf85023a79c781aa2013e9dc39fd66734fb2019/library/src/main/java/uk/co/ribot/easyadapter/annotations/FieldAnnotationParser.java#L33-L40
ehcache/ehcache3
impl/src/main/java/org/ehcache/config/builders/CacheEventListenerConfigurationBuilder.java
CacheEventListenerConfigurationBuilder.constructedWith
public CacheEventListenerConfigurationBuilder constructedWith(Object... arguments) { if (this.listenerClass == null) { throw new IllegalArgumentException("Arguments only are meaningful with class-based builder, this one seems to be an instance-based one"); } CacheEventListenerConfigurationBuilder otherBuilder = new CacheEventListenerConfigurationBuilder(this); otherBuilder.listenerArguments = arguments; return otherBuilder; }
java
public CacheEventListenerConfigurationBuilder constructedWith(Object... arguments) { if (this.listenerClass == null) { throw new IllegalArgumentException("Arguments only are meaningful with class-based builder, this one seems to be an instance-based one"); } CacheEventListenerConfigurationBuilder otherBuilder = new CacheEventListenerConfigurationBuilder(this); otherBuilder.listenerArguments = arguments; return otherBuilder; }
[ "public", "CacheEventListenerConfigurationBuilder", "constructedWith", "(", "Object", "...", "arguments", ")", "{", "if", "(", "this", ".", "listenerClass", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Arguments only are meaningful with clas...
Adds arguments that will be passed to the constructor of the {@link CacheEventListener} subclass configured previously. @param arguments the constructor arguments @return a new builder with the added constructor arguments @throws IllegalArgumentException if this builder is instance based
[ "Adds", "arguments", "that", "will", "be", "passed", "to", "the", "constructor", "of", "the", "{", "@link", "CacheEventListener", "}", "subclass", "configured", "previously", "." ]
train
https://github.com/ehcache/ehcache3/blob/3cceda57185e522f8d241ddb75146d67ee2af898/impl/src/main/java/org/ehcache/config/builders/CacheEventListenerConfigurationBuilder.java#L159-L166
orbisgis/h2gis
h2gis-functions/src/main/java/org/h2gis/functions/spatial/earth/SunCalc.java
SunCalc.getPosition
public static Coordinate getPosition(Date date, double lat, double lng) { if (isGeographic(lat, lng)) { double lw = rad * -lng; double phi = rad * lat; double J = dateToJulianDate(date); double M = getSolarMeanAnomaly(J); double C = getEquationOfCenter(M); double Ls = getEclipticLongitude(M, C); double d = getSunDeclination(Ls); double a = getRightAscension(Ls); double th = getSiderealTime(J, lw); double H = th - a; return new Coordinate(getAzimuth(H, phi, d),getAltitude(H, phi, d)); } else { throw new IllegalArgumentException("The coordinate of the point must in latitude and longitude."); } }
java
public static Coordinate getPosition(Date date, double lat, double lng) { if (isGeographic(lat, lng)) { double lw = rad * -lng; double phi = rad * lat; double J = dateToJulianDate(date); double M = getSolarMeanAnomaly(J); double C = getEquationOfCenter(M); double Ls = getEclipticLongitude(M, C); double d = getSunDeclination(Ls); double a = getRightAscension(Ls); double th = getSiderealTime(J, lw); double H = th - a; return new Coordinate(getAzimuth(H, phi, d),getAltitude(H, phi, d)); } else { throw new IllegalArgumentException("The coordinate of the point must in latitude and longitude."); } }
[ "public", "static", "Coordinate", "getPosition", "(", "Date", "date", ",", "double", "lat", ",", "double", "lng", ")", "{", "if", "(", "isGeographic", "(", "lat", ",", "lng", ")", ")", "{", "double", "lw", "=", "rad", "*", "-", "lng", ";", "double", ...
Returns the sun position as a coordinate with the following properties x: sun azimuth in radians (direction along the horizon, measured from south to west), e.g. 0 is south and Math.PI * 3/4 is northwest. y: sun altitude above the horizon in radians, e.g. 0 at the horizon and PI/2 at the zenith (straight over your head). @param date @param lat @param lng @return
[ "Returns", "the", "sun", "position", "as", "a", "coordinate", "with", "the", "following", "properties" ]
train
https://github.com/orbisgis/h2gis/blob/9cd70b447e6469cecbc2fc64b16774b59491df3b/h2gis-functions/src/main/java/org/h2gis/functions/spatial/earth/SunCalc.java#L155-L172
alkacon/opencms-core
src/org/opencms/xml/page/CmsXmlPage.java
CmsXmlPage.renameValue
public void renameValue(String oldValue, String newValue, Locale locale) throws CmsIllegalArgumentException { CmsXmlHtmlValue oldXmlHtmlValue = (CmsXmlHtmlValue)getValue(oldValue, locale); if (oldXmlHtmlValue == null) { throw new CmsIllegalArgumentException( Messages.get().container(Messages.ERR_XML_PAGE_NO_ELEM_FOR_LANG_2, oldValue, locale)); } if (hasValue(newValue, locale)) { throw new CmsIllegalArgumentException( Messages.get().container(Messages.ERR_XML_PAGE_LANG_ELEM_EXISTS_2, newValue, locale)); } if (newValue.indexOf('[') >= 0) { throw new CmsIllegalArgumentException( Messages.get().container(Messages.ERR_XML_PAGE_CONTAINS_INDEX_1, newValue)); } // get the element Element element = oldXmlHtmlValue.getElement(); // update value of the element attribute 'NAME' element.addAttribute(ATTRIBUTE_NAME, newValue); // re-initialize the document to update the bookmarks initDocument(m_document, m_encoding, getContentDefinition()); }
java
public void renameValue(String oldValue, String newValue, Locale locale) throws CmsIllegalArgumentException { CmsXmlHtmlValue oldXmlHtmlValue = (CmsXmlHtmlValue)getValue(oldValue, locale); if (oldXmlHtmlValue == null) { throw new CmsIllegalArgumentException( Messages.get().container(Messages.ERR_XML_PAGE_NO_ELEM_FOR_LANG_2, oldValue, locale)); } if (hasValue(newValue, locale)) { throw new CmsIllegalArgumentException( Messages.get().container(Messages.ERR_XML_PAGE_LANG_ELEM_EXISTS_2, newValue, locale)); } if (newValue.indexOf('[') >= 0) { throw new CmsIllegalArgumentException( Messages.get().container(Messages.ERR_XML_PAGE_CONTAINS_INDEX_1, newValue)); } // get the element Element element = oldXmlHtmlValue.getElement(); // update value of the element attribute 'NAME' element.addAttribute(ATTRIBUTE_NAME, newValue); // re-initialize the document to update the bookmarks initDocument(m_document, m_encoding, getContentDefinition()); }
[ "public", "void", "renameValue", "(", "String", "oldValue", ",", "String", "newValue", ",", "Locale", "locale", ")", "throws", "CmsIllegalArgumentException", "{", "CmsXmlHtmlValue", "oldXmlHtmlValue", "=", "(", "CmsXmlHtmlValue", ")", "getValue", "(", "oldValue", ",...
Renames the page-element value from the old to the new one.<p> @param oldValue the old value @param newValue the new value @param locale the locale @throws CmsIllegalArgumentException if the name contains an index ("[&lt;number&gt;]"), the new value for the given locale already exists in the xmlpage or the the old value does not exist for the locale in the xmlpage.
[ "Renames", "the", "page", "-", "element", "value", "from", "the", "old", "to", "the", "new", "one", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/xml/page/CmsXmlPage.java#L371-L396
box/box-android-sdk
box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiFile.java
BoxApiFile.getDownloadUrlRequest
public BoxRequestsFile.DownloadFile getDownloadUrlRequest(File target, String url) throws IOException{ if (!target.exists()){ throw new FileNotFoundException(); } BoxRequestsFile.DownloadFile request = new BoxRequestsFile.DownloadFile(target, url,mSession); return request; }
java
public BoxRequestsFile.DownloadFile getDownloadUrlRequest(File target, String url) throws IOException{ if (!target.exists()){ throw new FileNotFoundException(); } BoxRequestsFile.DownloadFile request = new BoxRequestsFile.DownloadFile(target, url,mSession); return request; }
[ "public", "BoxRequestsFile", ".", "DownloadFile", "getDownloadUrlRequest", "(", "File", "target", ",", "String", "url", ")", "throws", "IOException", "{", "if", "(", "!", "target", ".", "exists", "(", ")", ")", "{", "throw", "new", "FileNotFoundException", "("...
Gets a request that downloads a given asset from the url to a target file This is used to download miscellaneous url assets for instance from the representations endpoint. @param target target file to download to, target can be either a directory or a file @param url url of the asset to download @return request to download a file to a target file @throws IOException throws FileNotFoundException if target file does not exist.
[ "Gets", "a", "request", "that", "downloads", "a", "given", "asset", "from", "the", "url", "to", "a", "target", "file", "This", "is", "used", "to", "download", "miscellaneous", "url", "assets", "for", "instance", "from", "the", "representations", "endpoint", ...
train
https://github.com/box/box-android-sdk/blob/a621ad5ddebf23067fec27529130d72718fc0e88/box-content-sdk/src/main/java/com/box/androidsdk/content/BoxApiFile.java#L383-L389
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WButton.java
WButton.setPressed
protected void setPressed(final boolean pressed, final Request request) { if (pressed && isDisabled()) { // Protect against client-side tampering of disabled/read-only fields. LOG.warn("A disabled button has been triggered. " + getText() + ". " + getId()); return; } if (pressed != isPressed()) { getOrCreateComponentModel().isPressed = pressed; } // If an action has been supplied then execute it, but only after // handle request has been performed on the entire component tree. if (pressed) { final Action action = getAction(); if (action == null) { // Reset focus only if the current Request is an Ajax request. if (AjaxHelper.isCurrentAjaxTrigger(this)) { // Need to run the "afterActionExecute" as late as possible. Runnable later = new Runnable() { @Override public void run() { focusMe(); } }; invokeLater(later); } } else { final ActionEvent event = new ActionEvent(this, getActionCommand(), getActionObject()); Runnable later = new Runnable() { @Override public void run() { beforeActionExecute(request); action.execute(event); afterActionExecute(request); } }; invokeLater(later); } } }
java
protected void setPressed(final boolean pressed, final Request request) { if (pressed && isDisabled()) { // Protect against client-side tampering of disabled/read-only fields. LOG.warn("A disabled button has been triggered. " + getText() + ". " + getId()); return; } if (pressed != isPressed()) { getOrCreateComponentModel().isPressed = pressed; } // If an action has been supplied then execute it, but only after // handle request has been performed on the entire component tree. if (pressed) { final Action action = getAction(); if (action == null) { // Reset focus only if the current Request is an Ajax request. if (AjaxHelper.isCurrentAjaxTrigger(this)) { // Need to run the "afterActionExecute" as late as possible. Runnable later = new Runnable() { @Override public void run() { focusMe(); } }; invokeLater(later); } } else { final ActionEvent event = new ActionEvent(this, getActionCommand(), getActionObject()); Runnable later = new Runnable() { @Override public void run() { beforeActionExecute(request); action.execute(event); afterActionExecute(request); } }; invokeLater(later); } } }
[ "protected", "void", "setPressed", "(", "final", "boolean", "pressed", ",", "final", "Request", "request", ")", "{", "if", "(", "pressed", "&&", "isDisabled", "(", ")", ")", "{", "// Protect against client-side tampering of disabled/read-only fields.", "LOG", ".", "...
Sets whether this button is pressed. You probably do not want to invoke this manually, it is called from {@link #handleRequest}. If the button is pressed its Action is queued so it is invoked after the entire request has been handled. @param pressed true for pressed, false for not pressed @param request the Request that is being responded to
[ "Sets", "whether", "this", "button", "is", "pressed", ".", "You", "probably", "do", "not", "want", "to", "invoke", "this", "manually", "it", "is", "called", "from", "{", "@link", "#handleRequest", "}", ".", "If", "the", "button", "is", "pressed", "its", ...
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WButton.java#L194-L237
casmi/casmi
src/main/java/casmi/graphics/element/Polygon.java
Polygon.setCornerColor
public void setCornerColor(int index, Color color) { if (cornerColor == null) { for (int i = 0; i < cornerX.size(); i++) { cornerColor.add(new RGBColor(this.fillColor.getRed(), this.fillColor.getGreen(), this.fillColor.getBlue(), this.fillColor.getAlpha())); } setGradation(true); } if (cornerColor.size() < cornerX.size()) { while (cornerColor.size() != cornerX.size()) { cornerColor.add(new RGBColor(this.fillColor.getRed(), this.fillColor.getGreen(), this.fillColor.getBlue(), this.fillColor.getAlpha())); } } cornerColor.set(index, color); }
java
public void setCornerColor(int index, Color color) { if (cornerColor == null) { for (int i = 0; i < cornerX.size(); i++) { cornerColor.add(new RGBColor(this.fillColor.getRed(), this.fillColor.getGreen(), this.fillColor.getBlue(), this.fillColor.getAlpha())); } setGradation(true); } if (cornerColor.size() < cornerX.size()) { while (cornerColor.size() != cornerX.size()) { cornerColor.add(new RGBColor(this.fillColor.getRed(), this.fillColor.getGreen(), this.fillColor.getBlue(), this.fillColor.getAlpha())); } } cornerColor.set(index, color); }
[ "public", "void", "setCornerColor", "(", "int", "index", ",", "Color", "color", ")", "{", "if", "(", "cornerColor", "==", "null", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "cornerX", ".", "size", "(", ")", ";", "i", "++", ")", ...
Sets the color of a corner. @param index The index number of a corner. @param color The color of a corner.
[ "Sets", "the", "color", "of", "a", "corner", "." ]
train
https://github.com/casmi/casmi/blob/90f6514a9cbce0685186e7a92beb69e22a3b11c4/src/main/java/casmi/graphics/element/Polygon.java#L286-L301
SonarSource/sonarqube
sonar-plugin-api/src/main/java/org/sonar/api/utils/UriReader.java
UriReader.readString
public String readString(URI uri, Charset charset) { return searchForSupportedProcessor(uri).readString(uri, charset); }
java
public String readString(URI uri, Charset charset) { return searchForSupportedProcessor(uri).readString(uri, charset); }
[ "public", "String", "readString", "(", "URI", "uri", ",", "Charset", "charset", ")", "{", "return", "searchForSupportedProcessor", "(", "uri", ")", ".", "readString", "(", "uri", ",", "charset", ")", ";", "}" ]
Reads all characters from uri, using the given character set. It throws an unchecked exception if an error occurs.
[ "Reads", "all", "characters", "from", "uri", "using", "the", "given", "character", "set", ".", "It", "throws", "an", "unchecked", "exception", "if", "an", "error", "occurs", "." ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/sonar-plugin-api/src/main/java/org/sonar/api/utils/UriReader.java#L69-L71
bazaarvoice/emodb
databus-client-common/src/main/java/com/bazaarvoice/emodb/databus/client/DatabusClient.java
DatabusClient.replayAsync
@Override public String replayAsync(String apiKey, String subscription) { return replayAsyncSince(apiKey, subscription, null); }
java
@Override public String replayAsync(String apiKey, String subscription) { return replayAsyncSince(apiKey, subscription, null); }
[ "@", "Override", "public", "String", "replayAsync", "(", "String", "apiKey", ",", "String", "subscription", ")", "{", "return", "replayAsyncSince", "(", "apiKey", ",", "subscription", ",", "null", ")", ";", "}" ]
Any server can initiate a replay request, no need for @PartitionKey
[ "Any", "server", "can", "initiate", "a", "replay", "request", "no", "need", "for" ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/databus-client-common/src/main/java/com/bazaarvoice/emodb/databus/client/DatabusClient.java#L289-L292
gosu-lang/gosu-lang
gosu-core-api/src/main/java/gw/util/GosuRefactorUtil.java
GosuRefactorUtil.boundingParent
public static IParsedElement boundingParent( List<IParseTree> locations, int position, Class<? extends IParsedElement>... possibleTypes ) { IParseTree location = IParseTree.Search.getDeepestLocation( locations, position, true ); IParsedElement pe = null; if( location != null ) { pe = location.getParsedElement(); while( pe != null && !isOneOfTypes( pe, possibleTypes ) ) { pe = pe.getParent(); } } return pe; }
java
public static IParsedElement boundingParent( List<IParseTree> locations, int position, Class<? extends IParsedElement>... possibleTypes ) { IParseTree location = IParseTree.Search.getDeepestLocation( locations, position, true ); IParsedElement pe = null; if( location != null ) { pe = location.getParsedElement(); while( pe != null && !isOneOfTypes( pe, possibleTypes ) ) { pe = pe.getParent(); } } return pe; }
[ "public", "static", "IParsedElement", "boundingParent", "(", "List", "<", "IParseTree", ">", "locations", ",", "int", "position", ",", "Class", "<", "?", "extends", "IParsedElement", ">", "...", "possibleTypes", ")", "{", "IParseTree", "location", "=", "IParseTr...
Finds a bounding parent of any of the possible types passed in from the list of locations, starting at the position given.
[ "Finds", "a", "bounding", "parent", "of", "any", "of", "the", "possible", "types", "passed", "in", "from", "the", "list", "of", "locations", "starting", "at", "the", "position", "given", "." ]
train
https://github.com/gosu-lang/gosu-lang/blob/d6e9261b137ce66fef3726cabe7826d4a1f946b7/gosu-core-api/src/main/java/gw/util/GosuRefactorUtil.java#L23-L37
eclipse/hawkbit
hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/JpaSystemManagement.java
JpaSystemManagement.createInitialTenantMetaData
private TenantMetaData createInitialTenantMetaData(final String tenant) { return systemSecurityContext.runAsSystemAsTenant( () -> DeploymentHelper.runInNewTransaction(txManager, "initial-tenant-creation", status -> { final DistributionSetType defaultDsType = createStandardSoftwareDataSetup(); return tenantMetaDataRepository.save(new JpaTenantMetaData(defaultDsType, tenant)); }), tenant); }
java
private TenantMetaData createInitialTenantMetaData(final String tenant) { return systemSecurityContext.runAsSystemAsTenant( () -> DeploymentHelper.runInNewTransaction(txManager, "initial-tenant-creation", status -> { final DistributionSetType defaultDsType = createStandardSoftwareDataSetup(); return tenantMetaDataRepository.save(new JpaTenantMetaData(defaultDsType, tenant)); }), tenant); }
[ "private", "TenantMetaData", "createInitialTenantMetaData", "(", "final", "String", "tenant", ")", "{", "return", "systemSecurityContext", ".", "runAsSystemAsTenant", "(", "(", ")", "->", "DeploymentHelper", ".", "runInNewTransaction", "(", "txManager", ",", "\"initial-...
Creating the initial tenant meta-data in a new transaction. Due the {@link MultiTenantJpaTransactionManager} is using the current tenant to set the necessary tenant discriminator to the query. This is not working if we don't have a current tenant set. Due the {@link #getTenantMetadata(String)} is maybe called without having a current tenant we need to re-open a new transaction so the {@link MultiTenantJpaTransactionManager} is called again and set the tenant for this transaction. @param tenant the tenant to be created @return the initial created {@link TenantMetaData}
[ "Creating", "the", "initial", "tenant", "meta", "-", "data", "in", "a", "new", "transaction", ".", "Due", "the", "{", "@link", "MultiTenantJpaTransactionManager", "}", "is", "using", "the", "current", "tenant", "to", "set", "the", "necessary", "tenant", "discr...
train
https://github.com/eclipse/hawkbit/blob/9884452ad42f3b4827461606d8a9215c8625a7fe/hawkbit-repository/hawkbit-repository-jpa/src/main/java/org/eclipse/hawkbit/repository/jpa/JpaSystemManagement.java#L208-L214
puniverse/capsule
capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java
Jar.toInputStream
public static InputStream toInputStream(String str, Charset charset) { return new ByteArrayInputStream(str.getBytes(charset)); }
java
public static InputStream toInputStream(String str, Charset charset) { return new ByteArrayInputStream(str.getBytes(charset)); }
[ "public", "static", "InputStream", "toInputStream", "(", "String", "str", ",", "Charset", "charset", ")", "{", "return", "new", "ByteArrayInputStream", "(", "str", ".", "getBytes", "(", "charset", ")", ")", ";", "}" ]
Turns a {@code String} into an {@code InputStream} containing the string's encoded characters. @param str the string @param charset the {@link Charset} to use when encoding the string. @return an {@link InputStream} containing the string's encoded characters.
[ "Turns", "a", "{", "@code", "String", "}", "into", "an", "{", "@code", "InputStream", "}", "containing", "the", "string", "s", "encoded", "characters", "." ]
train
https://github.com/puniverse/capsule/blob/291a54e501a32aaf0284707b8c1fbff6a566822b/capsule-util/src/main/java/co/paralleluniverse/capsule/Jar.java#L767-L769
spotify/helios
helios-services/src/main/java/com/spotify/helios/agent/AgentService.java
AgentService.setupZookeeperClient
private ZooKeeperClient setupZookeeperClient(final AgentConfig config, final String id, final CountDownLatch zkRegistrationSignal) { ACLProvider aclProvider = null; List<AuthInfo> authorization = null; final String agentUser = config.getZookeeperAclAgentUser(); final String agentPassword = config.getZooKeeperAclAgentPassword(); final String masterUser = config.getZookeeperAclMasterUser(); final String masterDigest = config.getZooKeeperAclMasterDigest(); if (!isNullOrEmpty(agentPassword)) { if (isNullOrEmpty(agentUser)) { throw new HeliosRuntimeException( "Agent username must be set if a password is set"); } authorization = Lists.newArrayList(new AuthInfo( "digest", String.format("%s:%s", agentUser, agentPassword).getBytes())); } if (config.isZooKeeperEnableAcls()) { if (isNullOrEmpty(agentUser) || isNullOrEmpty(agentPassword)) { throw new HeliosRuntimeException( "ZooKeeper ACLs enabled but agent username and/or password not set"); } if (isNullOrEmpty(masterUser) || isNullOrEmpty(masterDigest)) { throw new HeliosRuntimeException( "ZooKeeper ACLs enabled but master username and/or digest not set"); } aclProvider = heliosAclProvider( masterUser, masterDigest, agentUser, digest(agentUser, agentPassword)); } final RetryPolicy zooKeeperRetryPolicy = new ExponentialBackoffRetry(1000, 3); final CuratorFramework curator = new CuratorClientFactoryImpl().newClient( config.getZooKeeperConnectionString(), config.getZooKeeperSessionTimeoutMillis(), config.getZooKeeperConnectionTimeoutMillis(), zooKeeperRetryPolicy, aclProvider, authorization); final ZooKeeperClient client = new DefaultZooKeeperClient(curator, config.getZooKeeperClusterId()); client.start(); // Register the agent final AgentZooKeeperRegistrar agentZooKeeperRegistrar = new AgentZooKeeperRegistrar( config.getName(), id, config.getZooKeeperRegistrationTtlMinutes(), new SystemClock()); zkRegistrar = ZooKeeperRegistrarService.newBuilder() .setZooKeeperClient(client) .setZooKeeperRegistrar(agentZooKeeperRegistrar) .setZkRegistrationSignal(zkRegistrationSignal) .build(); return client; }
java
private ZooKeeperClient setupZookeeperClient(final AgentConfig config, final String id, final CountDownLatch zkRegistrationSignal) { ACLProvider aclProvider = null; List<AuthInfo> authorization = null; final String agentUser = config.getZookeeperAclAgentUser(); final String agentPassword = config.getZooKeeperAclAgentPassword(); final String masterUser = config.getZookeeperAclMasterUser(); final String masterDigest = config.getZooKeeperAclMasterDigest(); if (!isNullOrEmpty(agentPassword)) { if (isNullOrEmpty(agentUser)) { throw new HeliosRuntimeException( "Agent username must be set if a password is set"); } authorization = Lists.newArrayList(new AuthInfo( "digest", String.format("%s:%s", agentUser, agentPassword).getBytes())); } if (config.isZooKeeperEnableAcls()) { if (isNullOrEmpty(agentUser) || isNullOrEmpty(agentPassword)) { throw new HeliosRuntimeException( "ZooKeeper ACLs enabled but agent username and/or password not set"); } if (isNullOrEmpty(masterUser) || isNullOrEmpty(masterDigest)) { throw new HeliosRuntimeException( "ZooKeeper ACLs enabled but master username and/or digest not set"); } aclProvider = heliosAclProvider( masterUser, masterDigest, agentUser, digest(agentUser, agentPassword)); } final RetryPolicy zooKeeperRetryPolicy = new ExponentialBackoffRetry(1000, 3); final CuratorFramework curator = new CuratorClientFactoryImpl().newClient( config.getZooKeeperConnectionString(), config.getZooKeeperSessionTimeoutMillis(), config.getZooKeeperConnectionTimeoutMillis(), zooKeeperRetryPolicy, aclProvider, authorization); final ZooKeeperClient client = new DefaultZooKeeperClient(curator, config.getZooKeeperClusterId()); client.start(); // Register the agent final AgentZooKeeperRegistrar agentZooKeeperRegistrar = new AgentZooKeeperRegistrar( config.getName(), id, config.getZooKeeperRegistrationTtlMinutes(), new SystemClock()); zkRegistrar = ZooKeeperRegistrarService.newBuilder() .setZooKeeperClient(client) .setZooKeeperRegistrar(agentZooKeeperRegistrar) .setZkRegistrationSignal(zkRegistrationSignal) .build(); return client; }
[ "private", "ZooKeeperClient", "setupZookeeperClient", "(", "final", "AgentConfig", "config", ",", "final", "String", "id", ",", "final", "CountDownLatch", "zkRegistrationSignal", ")", "{", "ACLProvider", "aclProvider", "=", "null", ";", "List", "<", "AuthInfo", ">",...
Create a Zookeeper client and create the control and state nodes if needed. @param config The service configuration. @return A zookeeper client.
[ "Create", "a", "Zookeeper", "client", "and", "create", "the", "control", "and", "state", "nodes", "if", "needed", "." ]
train
https://github.com/spotify/helios/blob/c9000bc1d6908651570be8b057d4981bba4df5b4/helios-services/src/main/java/com/spotify/helios/agent/AgentService.java#L398-L457
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/openal/SoundStore.java
SoundStore.getOggStream
public Audio getOggStream(String ref) throws IOException { if (!soundWorks) { return new NullAudio(); } setMOD(null); setStream(null); if (currentMusic != -1) { AL10.alSourceStop(sources.get(0)); } getMusicSource(); currentMusic = sources.get(0); return new StreamSound(new OpenALStreamPlayer(currentMusic, ref)); }
java
public Audio getOggStream(String ref) throws IOException { if (!soundWorks) { return new NullAudio(); } setMOD(null); setStream(null); if (currentMusic != -1) { AL10.alSourceStop(sources.get(0)); } getMusicSource(); currentMusic = sources.get(0); return new StreamSound(new OpenALStreamPlayer(currentMusic, ref)); }
[ "public", "Audio", "getOggStream", "(", "String", "ref", ")", "throws", "IOException", "{", "if", "(", "!", "soundWorks", ")", "{", "return", "new", "NullAudio", "(", ")", ";", "}", "setMOD", "(", "null", ")", ";", "setStream", "(", "null", ")", ";", ...
Get the Sound based on a specified OGG file @param ref The reference to the OGG file in the classpath @return The Sound read from the OGG file @throws IOException Indicates a failure to load the OGG
[ "Get", "the", "Sound", "based", "on", "a", "specified", "OGG", "file" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/openal/SoundStore.java#L742-L758
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java
Constraints.gtProperty
public PropertyConstraint gtProperty(String propertyName, String otherPropertyName) { return valueProperties(propertyName, GreaterThan.instance(), otherPropertyName); }
java
public PropertyConstraint gtProperty(String propertyName, String otherPropertyName) { return valueProperties(propertyName, GreaterThan.instance(), otherPropertyName); }
[ "public", "PropertyConstraint", "gtProperty", "(", "String", "propertyName", ",", "String", "otherPropertyName", ")", "{", "return", "valueProperties", "(", "propertyName", ",", "GreaterThan", ".", "instance", "(", ")", ",", "otherPropertyName", ")", ";", "}" ]
Apply a "greater than" constraint to two properties @param propertyName The first property @param otherPropertyName The other property @return The constraint
[ "Apply", "a", "greater", "than", "constraint", "to", "two", "properties" ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/rules/constraint/Constraints.java#L853-L855
pip-services3-java/pip-services3-components-java
src/org/pipservices3/components/build/Factory.java
Factory.registerAsType
public void registerAsType(Object locator, Class<?> type) { if (locator == null) throw new NullPointerException("Locator cannot be null"); if (type == null) throw new NullPointerException("Type cannot be null"); IComponentFactory factory = new DefaultComponentFactory(type); _registrations.add(new Registration(locator, factory)); }
java
public void registerAsType(Object locator, Class<?> type) { if (locator == null) throw new NullPointerException("Locator cannot be null"); if (type == null) throw new NullPointerException("Type cannot be null"); IComponentFactory factory = new DefaultComponentFactory(type); _registrations.add(new Registration(locator, factory)); }
[ "public", "void", "registerAsType", "(", "Object", "locator", ",", "Class", "<", "?", ">", "type", ")", "{", "if", "(", "locator", "==", "null", ")", "throw", "new", "NullPointerException", "(", "\"Locator cannot be null\"", ")", ";", "if", "(", "type", "=...
Registers a component using its type (a constructor function). @param locator a locator to identify component to be created. @param type a component type.
[ "Registers", "a", "component", "using", "its", "type", "(", "a", "constructor", "function", ")", "." ]
train
https://github.com/pip-services3-java/pip-services3-components-java/blob/122352fbf9b208f6417376da7b8ad725bc85ee58/src/org/pipservices3/components/build/Factory.java#L94-L102
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/structure/ProjectiveStructureFromHomographies.java
ProjectiveStructureFromHomographies.constructLinearSystem
void constructLinearSystem(List<DMatrixRMaj> homographies, List<List<PointIndex2D_F64>> observations) { // parameters are encoded points first then the int startView = totalFeatures*3; A.reshape(numEquations,numUnknown); DMatrixRMaj H = new DMatrixRMaj(3,3); Point2D_F64 p = new Point2D_F64(); int row = 0; for (int viewIdx = 0; viewIdx < homographies.size(); viewIdx++) { N.apply(homographies.get(viewIdx),H); int colView = startView + viewIdx*3; List<PointIndex2D_F64> obs = observations.get(viewIdx); for (int i = 0; i < obs.size(); i++) { PointIndex2D_F64 p_pixel = obs.get(i); N.apply(p_pixel,p); // column this feature is at int col = p_pixel.index*3; // x component of pixel // A(row,colView) = ... A.data[row*A.numCols + col ] = p.x*H.get(2,0) - H.get(0,0); A.data[row*A.numCols + col + 1] = p.x*H.get(2,1) - H.get(0,1); A.data[row*A.numCols + col + 2] = p.x*H.get(2,2) - H.get(0,2); A.data[row*A.numCols + colView ] = -1; A.data[row*A.numCols + colView + 1 ] = 0; A.data[row*A.numCols + colView + 2 ] = p.x; // y component of pixel row += 1; A.data[row*A.numCols + col ] = p.y*H.get(2,0) - H.get(1,0); A.data[row*A.numCols + col + 1] = p.y*H.get(2,1) - H.get(1,1); A.data[row*A.numCols + col + 2] = p.y*H.get(2,2) - H.get(1,2); A.data[row*A.numCols + colView ] = 0; A.data[row*A.numCols + colView + 1 ] = -1; A.data[row*A.numCols + colView + 2 ] = p.y; row += 1; } } }
java
void constructLinearSystem(List<DMatrixRMaj> homographies, List<List<PointIndex2D_F64>> observations) { // parameters are encoded points first then the int startView = totalFeatures*3; A.reshape(numEquations,numUnknown); DMatrixRMaj H = new DMatrixRMaj(3,3); Point2D_F64 p = new Point2D_F64(); int row = 0; for (int viewIdx = 0; viewIdx < homographies.size(); viewIdx++) { N.apply(homographies.get(viewIdx),H); int colView = startView + viewIdx*3; List<PointIndex2D_F64> obs = observations.get(viewIdx); for (int i = 0; i < obs.size(); i++) { PointIndex2D_F64 p_pixel = obs.get(i); N.apply(p_pixel,p); // column this feature is at int col = p_pixel.index*3; // x component of pixel // A(row,colView) = ... A.data[row*A.numCols + col ] = p.x*H.get(2,0) - H.get(0,0); A.data[row*A.numCols + col + 1] = p.x*H.get(2,1) - H.get(0,1); A.data[row*A.numCols + col + 2] = p.x*H.get(2,2) - H.get(0,2); A.data[row*A.numCols + colView ] = -1; A.data[row*A.numCols + colView + 1 ] = 0; A.data[row*A.numCols + colView + 2 ] = p.x; // y component of pixel row += 1; A.data[row*A.numCols + col ] = p.y*H.get(2,0) - H.get(1,0); A.data[row*A.numCols + col + 1] = p.y*H.get(2,1) - H.get(1,1); A.data[row*A.numCols + col + 2] = p.y*H.get(2,2) - H.get(1,2); A.data[row*A.numCols + colView ] = 0; A.data[row*A.numCols + colView + 1 ] = -1; A.data[row*A.numCols + colView + 2 ] = p.y; row += 1; } } }
[ "void", "constructLinearSystem", "(", "List", "<", "DMatrixRMaj", ">", "homographies", ",", "List", "<", "List", "<", "PointIndex2D_F64", ">", ">", "observations", ")", "{", "// parameters are encoded points first then the", "int", "startView", "=", "totalFeatures", "...
Constructs the linear systems. Unknowns are sorted in index order. structure (3D points) are first followed by unknown t from projective.
[ "Constructs", "the", "linear", "systems", ".", "Unknowns", "are", "sorted", "in", "index", "order", ".", "structure", "(", "3D", "points", ")", "are", "first", "followed", "by", "unknown", "t", "from", "projective", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/structure/ProjectiveStructureFromHomographies.java#L156-L204
ThreeTen/threetenbp
src/main/java/org/threeten/bp/Period.java
Period.plusMonths
public Period plusMonths(long monthsToAdd) { if (monthsToAdd == 0) { return this; } return create(years, Jdk8Methods.safeToInt(Jdk8Methods.safeAdd(months, monthsToAdd)), days); }
java
public Period plusMonths(long monthsToAdd) { if (monthsToAdd == 0) { return this; } return create(years, Jdk8Methods.safeToInt(Jdk8Methods.safeAdd(months, monthsToAdd)), days); }
[ "public", "Period", "plusMonths", "(", "long", "monthsToAdd", ")", "{", "if", "(", "monthsToAdd", "==", "0", ")", "{", "return", "this", ";", "}", "return", "create", "(", "years", ",", "Jdk8Methods", ".", "safeToInt", "(", "Jdk8Methods", ".", "safeAdd", ...
Returns a copy of this period with the specified months added. <p> This adds the amount to the months unit in a copy of this period. The years and days units are unaffected. For example, "1 year, 6 months and 3 days" plus 2 months returns "1 year, 8 months and 3 days". <p> This instance is immutable and unaffected by this method call. @param monthsToAdd the months to add, positive or negative @return a {@code Period} based on this period with the specified months added, not null @throws ArithmeticException if numeric overflow occurs
[ "Returns", "a", "copy", "of", "this", "period", "with", "the", "specified", "months", "added", ".", "<p", ">", "This", "adds", "the", "amount", "to", "the", "months", "unit", "in", "a", "copy", "of", "this", "period", ".", "The", "years", "and", "days"...
train
https://github.com/ThreeTen/threetenbp/blob/5f05b649f89f205aabd96b2f83c36796ec616fe6/src/main/java/org/threeten/bp/Period.java#L589-L594
alkacon/opencms-core
src/org/opencms/workflow/CmsExtendedWorkflowManager.java
CmsExtendedWorkflowManager.actionRelease
protected CmsWorkflowResponse actionRelease(CmsObject userCms, List<CmsResource> resources) throws CmsException { checkNewParentsInList(userCms, resources); String projectName = generateProjectName(userCms); String projectDescription = generateProjectDescription(userCms); CmsObject offlineAdminCms = OpenCms.initCmsObject(m_adminCms); offlineAdminCms.getRequestContext().setCurrentProject(userCms.getRequestContext().getCurrentProject()); String managerGroup = getWorkflowProjectManagerGroup(); String userGroup = getWorkflowProjectUserGroup(); CmsProject workflowProject = m_adminCms.createProject( projectName, projectDescription, userGroup, managerGroup, CmsProject.PROJECT_TYPE_WORKFLOW); CmsObject newProjectCms = OpenCms.initCmsObject(offlineAdminCms); newProjectCms.getRequestContext().setCurrentProject(workflowProject); newProjectCms.getRequestContext().setSiteRoot(""); newProjectCms.copyResourceToProject("/"); CmsUser admin = offlineAdminCms.getRequestContext().getCurrentUser(); clearLocks(userCms.getRequestContext().getCurrentProject(), resources); for (CmsResource resource : resources) { CmsLock lock = offlineAdminCms.getLock(resource); if (lock.isUnlocked()) { offlineAdminCms.lockResource(resource); } else if (!lock.isOwnedBy(admin)) { offlineAdminCms.changeLock(resource); } offlineAdminCms.writeProjectLastModified(resource, workflowProject); offlineAdminCms.unlockResource(resource); } for (CmsUser user : getNotificationMailRecipients()) { sendNotification(userCms, user, workflowProject, resources); } return new CmsWorkflowResponse( true, "", new ArrayList<CmsPublishResource>(), new ArrayList<CmsWorkflowAction>(), workflowProject.getUuid()); }
java
protected CmsWorkflowResponse actionRelease(CmsObject userCms, List<CmsResource> resources) throws CmsException { checkNewParentsInList(userCms, resources); String projectName = generateProjectName(userCms); String projectDescription = generateProjectDescription(userCms); CmsObject offlineAdminCms = OpenCms.initCmsObject(m_adminCms); offlineAdminCms.getRequestContext().setCurrentProject(userCms.getRequestContext().getCurrentProject()); String managerGroup = getWorkflowProjectManagerGroup(); String userGroup = getWorkflowProjectUserGroup(); CmsProject workflowProject = m_adminCms.createProject( projectName, projectDescription, userGroup, managerGroup, CmsProject.PROJECT_TYPE_WORKFLOW); CmsObject newProjectCms = OpenCms.initCmsObject(offlineAdminCms); newProjectCms.getRequestContext().setCurrentProject(workflowProject); newProjectCms.getRequestContext().setSiteRoot(""); newProjectCms.copyResourceToProject("/"); CmsUser admin = offlineAdminCms.getRequestContext().getCurrentUser(); clearLocks(userCms.getRequestContext().getCurrentProject(), resources); for (CmsResource resource : resources) { CmsLock lock = offlineAdminCms.getLock(resource); if (lock.isUnlocked()) { offlineAdminCms.lockResource(resource); } else if (!lock.isOwnedBy(admin)) { offlineAdminCms.changeLock(resource); } offlineAdminCms.writeProjectLastModified(resource, workflowProject); offlineAdminCms.unlockResource(resource); } for (CmsUser user : getNotificationMailRecipients()) { sendNotification(userCms, user, workflowProject, resources); } return new CmsWorkflowResponse( true, "", new ArrayList<CmsPublishResource>(), new ArrayList<CmsWorkflowAction>(), workflowProject.getUuid()); }
[ "protected", "CmsWorkflowResponse", "actionRelease", "(", "CmsObject", "userCms", ",", "List", "<", "CmsResource", ">", "resources", ")", "throws", "CmsException", "{", "checkNewParentsInList", "(", "userCms", ",", "resources", ")", ";", "String", "projectName", "="...
Implementation of the 'release' workflow action.<p> @param userCms the current user's CMS context @param resources the resources which should be released @return the workflow response for this action @throws CmsException if something goes wrong
[ "Implementation", "of", "the", "release", "workflow", "action", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workflow/CmsExtendedWorkflowManager.java#L318-L358
jeremylong/DependencyCheck
core/src/main/java/org/owasp/dependencycheck/xml/assembly/GrokHandler.java
GrokHandler.endElement
@Override public void endElement(String uri, String localName, String qName) throws SAXException { if (null != qName) { switch (qName) { case COMPANY_NAME: data.setCompanyName(currentText.toString()); break; case PRODUCT_NAME: data.setProductName(currentText.toString()); break; case PRODUCT_VERSION: data.setProductVersion(currentText.toString()); break; case COMMENTS: data.setComments(currentText.toString()); break; case FILE_DESCRIPTION: data.setFileDescription(currentText.toString()); break; case FILE_NAME: data.setFileName(currentText.toString()); break; case FILE_VERSION: data.setFileVersion(currentText.toString()); break; case INTERNAL_NAME: data.setInternalName(currentText.toString()); break; case ORIGINAL_FILE_NAME: data.setOriginalFilename(currentText.toString()); break; case FULLNAME: data.setFullName(currentText.toString()); break; case NAMESPACE: data.addNamespace(currentText.toString()); break; case ERROR: data.setError(currentText.toString()); break; case WARNING: data.setWarning(currentText.toString()); break; default: break; } } }
java
@Override public void endElement(String uri, String localName, String qName) throws SAXException { if (null != qName) { switch (qName) { case COMPANY_NAME: data.setCompanyName(currentText.toString()); break; case PRODUCT_NAME: data.setProductName(currentText.toString()); break; case PRODUCT_VERSION: data.setProductVersion(currentText.toString()); break; case COMMENTS: data.setComments(currentText.toString()); break; case FILE_DESCRIPTION: data.setFileDescription(currentText.toString()); break; case FILE_NAME: data.setFileName(currentText.toString()); break; case FILE_VERSION: data.setFileVersion(currentText.toString()); break; case INTERNAL_NAME: data.setInternalName(currentText.toString()); break; case ORIGINAL_FILE_NAME: data.setOriginalFilename(currentText.toString()); break; case FULLNAME: data.setFullName(currentText.toString()); break; case NAMESPACE: data.addNamespace(currentText.toString()); break; case ERROR: data.setError(currentText.toString()); break; case WARNING: data.setWarning(currentText.toString()); break; default: break; } } }
[ "@", "Override", "public", "void", "endElement", "(", "String", "uri", ",", "String", "localName", ",", "String", "qName", ")", "throws", "SAXException", "{", "if", "(", "null", "!=", "qName", ")", "{", "switch", "(", "qName", ")", "{", "case", "COMPANY_...
Handles the end element event. @param uri the URI of the element @param localName the local name of the element @param qName the qName of the element @throws SAXException thrown if there is an exception processing
[ "Handles", "the", "end", "element", "event", "." ]
train
https://github.com/jeremylong/DependencyCheck/blob/6cc7690ea12e4ca1454210ceaa2e9a5523f0926c/core/src/main/java/org/owasp/dependencycheck/xml/assembly/GrokHandler.java#L117-L164
fcrepo3/fcrepo
fcrepo-common/src/main/java/org/fcrepo/common/rdf/JRDF.java
JRDF.sameResource
public static boolean sameResource(URIReference u1, URIReference u2) { return sameResource(u1, u2.getURI().toString()); }
java
public static boolean sameResource(URIReference u1, URIReference u2) { return sameResource(u1, u2.getURI().toString()); }
[ "public", "static", "boolean", "sameResource", "(", "URIReference", "u1", ",", "URIReference", "u2", ")", "{", "return", "sameResource", "(", "u1", ",", "u2", ".", "getURI", "(", ")", ".", "toString", "(", ")", ")", ";", "}" ]
Tells whether the given resources are equivalent. <p> Two resources are equivalent if their URIs match. @param u1 first resource. @param u2 second resource. @return true if equivalent, false otherwise.
[ "Tells", "whether", "the", "given", "resources", "are", "equivalent", ".", "<p", ">", "Two", "resources", "are", "equivalent", "if", "their", "URIs", "match", "." ]
train
https://github.com/fcrepo3/fcrepo/blob/37df51b9b857fd12c6ab8269820d406c3c4ad774/fcrepo-common/src/main/java/org/fcrepo/common/rdf/JRDF.java#L56-L58
Azure/azure-sdk-for-java
mixedreality/resource-manager/v2019_02_28_preview/src/main/java/com/microsoft/azure/management/mixedreality/v2019_02_28_preview/implementation/SpatialAnchorsAccountsInner.java
SpatialAnchorsAccountsInner.getByResourceGroup
public SpatialAnchorsAccountInner getByResourceGroup(String resourceGroupName, String spatialAnchorsAccountName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, spatialAnchorsAccountName).toBlocking().single().body(); }
java
public SpatialAnchorsAccountInner getByResourceGroup(String resourceGroupName, String spatialAnchorsAccountName) { return getByResourceGroupWithServiceResponseAsync(resourceGroupName, spatialAnchorsAccountName).toBlocking().single().body(); }
[ "public", "SpatialAnchorsAccountInner", "getByResourceGroup", "(", "String", "resourceGroupName", ",", "String", "spatialAnchorsAccountName", ")", "{", "return", "getByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", "spatialAnchorsAccountName", ")", ".", ...
Retrieve a Spatial Anchors Account. @param resourceGroupName Name of an Azure resource group. @param spatialAnchorsAccountName Name of an Mixed Reality Spatial Anchors Account. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the SpatialAnchorsAccountInner object if successful.
[ "Retrieve", "a", "Spatial", "Anchors", "Account", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mixedreality/resource-manager/v2019_02_28_preview/src/main/java/com/microsoft/azure/management/mixedreality/v2019_02_28_preview/implementation/SpatialAnchorsAccountsInner.java#L430-L432
alkacon/opencms-core
src/org/opencms/workplace/editors/CmsEditor.java
CmsEditor.decodeParamValue
@Override protected String decodeParamValue(String paramName, String paramValue) { if ((paramName != null) && (paramValue != null)) { if (PARAM_CONTENT.equals(paramName)) { // content will be always encoded in UTF-8 unicode by the editor client return CmsEncoder.decode(paramValue, CmsEncoder.ENCODING_UTF_8); } else if (PARAM_RESOURCE.equals(paramName) || PARAM_TEMPFILE.equals(paramName)) { String filename = CmsEncoder.decode(paramValue, getCms().getRequestContext().getEncoding()); if (PARAM_TEMPFILE.equals(paramName) || CmsStringUtil.isEmpty(getParamTempfile())) { // always use value from temp file if it is available setFileEncoding(getFileEncoding(getCms(), filename)); } return filename; } else { return CmsEncoder.decode(paramValue, getCms().getRequestContext().getEncoding()); } } else { return null; } }
java
@Override protected String decodeParamValue(String paramName, String paramValue) { if ((paramName != null) && (paramValue != null)) { if (PARAM_CONTENT.equals(paramName)) { // content will be always encoded in UTF-8 unicode by the editor client return CmsEncoder.decode(paramValue, CmsEncoder.ENCODING_UTF_8); } else if (PARAM_RESOURCE.equals(paramName) || PARAM_TEMPFILE.equals(paramName)) { String filename = CmsEncoder.decode(paramValue, getCms().getRequestContext().getEncoding()); if (PARAM_TEMPFILE.equals(paramName) || CmsStringUtil.isEmpty(getParamTempfile())) { // always use value from temp file if it is available setFileEncoding(getFileEncoding(getCms(), filename)); } return filename; } else { return CmsEncoder.decode(paramValue, getCms().getRequestContext().getEncoding()); } } else { return null; } }
[ "@", "Override", "protected", "String", "decodeParamValue", "(", "String", "paramName", ",", "String", "paramValue", ")", "{", "if", "(", "(", "paramName", "!=", "null", ")", "&&", "(", "paramValue", "!=", "null", ")", ")", "{", "if", "(", "PARAM_CONTENT",...
Decodes an individual parameter value, ensuring the content is always decoded in UTF-8.<p> For editors the content is always encoded using the JavaScript encodeURIComponent() method on the client, which always encodes in UTF-8.<p> @param paramName the name of the parameter @param paramValue the unencoded value of the parameter @return the encoded value of the parameter
[ "Decodes", "an", "individual", "parameter", "value", "ensuring", "the", "content", "is", "always", "decoded", "in", "UTF", "-", "8", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/workplace/editors/CmsEditor.java#L876-L896
BBN-E/bue-common-open
common-core-open/src/main/java/com/bbn/bue/common/converters/StringToClassInstance.java
StringToClassInstance.decode
@Override public T decode(final String s) { checkNotNull(s); try { return constructor.newInstance(s); } catch (final IllegalAccessException iae) { throw new ConversionException("Cannot access a single-string constructor for type " + type, iae); } catch (final InstantiationException ie) { throw new ConversionException( "Cannot instantiate " + type + ", probably because it is not concrete", ie); } catch (final InvocationTargetException ite) { throw new ConversionException("Exception thrown in constructor for " + type, ite); } catch (final ExceptionInInitializerError eiie) { throw new ConversionException( "Exception thrown when initializing classes for construction of " + type, eiie); } }
java
@Override public T decode(final String s) { checkNotNull(s); try { return constructor.newInstance(s); } catch (final IllegalAccessException iae) { throw new ConversionException("Cannot access a single-string constructor for type " + type, iae); } catch (final InstantiationException ie) { throw new ConversionException( "Cannot instantiate " + type + ", probably because it is not concrete", ie); } catch (final InvocationTargetException ite) { throw new ConversionException("Exception thrown in constructor for " + type, ite); } catch (final ExceptionInInitializerError eiie) { throw new ConversionException( "Exception thrown when initializing classes for construction of " + type, eiie); } }
[ "@", "Override", "public", "T", "decode", "(", "final", "String", "s", ")", "{", "checkNotNull", "(", "s", ")", ";", "try", "{", "return", "constructor", ".", "newInstance", "(", "s", ")", ";", "}", "catch", "(", "final", "IllegalAccessException", "iae",...
Constructs a new instance of {@code T} by invoking its single-string constructor. @param s the string to convert from @return a new instance of {@code T}, instantiated as though {@code new T(s)} had been invoked @throws ConversionException if the constructor isn't accessible, {@code T} isn't a concrete type, an exception is thrown by {@code T}'s constructor, or an exception is thrown when loading {@code T} or one of its dependency classes @throws NullPointerException if {@code s} is null
[ "Constructs", "a", "new", "instance", "of", "{", "@code", "T", "}", "by", "invoking", "its", "single", "-", "string", "constructor", "." ]
train
https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/converters/StringToClassInstance.java#L58-L75