repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
218
func_name
stringlengths
4
140
whole_func_string
stringlengths
153
5.32k
language
stringclasses
1 value
func_code_string
stringlengths
72
4k
func_code_tokens
sequencelengths
20
832
func_documentation_string
stringlengths
61
2k
func_documentation_tokens
sequencelengths
1
647
split_name
stringclasses
1 value
func_code_url
stringlengths
102
339
jbundle/jbundle
base/db/physical/src/main/java/org/jbundle/base/db/physical/PhysicalDatabase.java
PhysicalDatabase.doMakeTable
public BaseTable doMakeTable(Record record) { """ Make a table for this database. @param record The record to make a table for. @return BaseTable The new table. """ BaseTable table = null; boolean bIsQueryRecord = record.isQueryRecord(); if (m_pDatabase == null) { try { this.open(); } catch (DBException ex) { return null; // No database } } if (bIsQueryRecord) { // Physical Tables cannot process SQL queries, so use QueryTable! PassThruTable passThruTable = new QueryTable(this, record); passThruTable.addTable(record.getRecordlistAt(0).getTable()); return passThruTable; } table = this.makePhysicalTable(record); return table; }
java
public BaseTable doMakeTable(Record record) { BaseTable table = null; boolean bIsQueryRecord = record.isQueryRecord(); if (m_pDatabase == null) { try { this.open(); } catch (DBException ex) { return null; // No database } } if (bIsQueryRecord) { // Physical Tables cannot process SQL queries, so use QueryTable! PassThruTable passThruTable = new QueryTable(this, record); passThruTable.addTable(record.getRecordlistAt(0).getTable()); return passThruTable; } table = this.makePhysicalTable(record); return table; }
[ "public", "BaseTable", "doMakeTable", "(", "Record", "record", ")", "{", "BaseTable", "table", "=", "null", ";", "boolean", "bIsQueryRecord", "=", "record", ".", "isQueryRecord", "(", ")", ";", "if", "(", "m_pDatabase", "==", "null", ")", "{", "try", "{", "this", ".", "open", "(", ")", ";", "}", "catch", "(", "DBException", "ex", ")", "{", "return", "null", ";", "// No database", "}", "}", "if", "(", "bIsQueryRecord", ")", "{", "// Physical Tables cannot process SQL queries, so use QueryTable!", "PassThruTable", "passThruTable", "=", "new", "QueryTable", "(", "this", ",", "record", ")", ";", "passThruTable", ".", "addTable", "(", "record", ".", "getRecordlistAt", "(", "0", ")", ".", "getTable", "(", ")", ")", ";", "return", "passThruTable", ";", "}", "table", "=", "this", ".", "makePhysicalTable", "(", "record", ")", ";", "return", "table", ";", "}" ]
Make a table for this database. @param record The record to make a table for. @return BaseTable The new table.
[ "Make", "a", "table", "for", "this", "database", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/db/physical/src/main/java/org/jbundle/base/db/physical/PhysicalDatabase.java#L143-L163
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CompactDecimalFormat.java
CompactDecimalFormat.getInstance
public static CompactDecimalFormat getInstance(Locale locale, CompactStyle style) { """ Create a CompactDecimalFormat appropriate for a locale. The result may be affected by the number system in the locale, such as ar-u-nu-latn. @param locale the desired locale @param style the compact style """ return new CompactDecimalFormat(ULocale.forLocale(locale), style); }
java
public static CompactDecimalFormat getInstance(Locale locale, CompactStyle style) { return new CompactDecimalFormat(ULocale.forLocale(locale), style); }
[ "public", "static", "CompactDecimalFormat", "getInstance", "(", "Locale", "locale", ",", "CompactStyle", "style", ")", "{", "return", "new", "CompactDecimalFormat", "(", "ULocale", ".", "forLocale", "(", "locale", ")", ",", "style", ")", ";", "}" ]
Create a CompactDecimalFormat appropriate for a locale. The result may be affected by the number system in the locale, such as ar-u-nu-latn. @param locale the desired locale @param style the compact style
[ "Create", "a", "CompactDecimalFormat", "appropriate", "for", "a", "locale", ".", "The", "result", "may", "be", "affected", "by", "the", "number", "system", "in", "the", "locale", "such", "as", "ar", "-", "u", "-", "nu", "-", "latn", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CompactDecimalFormat.java#L112-L114
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DateTimeFormatter.java
DateTimeFormatter.formatTo
public void formatTo(TemporalAccessor temporal, Appendable appendable) { """ Formats a date-time object to an {@code Appendable} using this formatter. <p> This outputs the formatted date-time to the specified destination. {@link Appendable} is a general purpose interface that is implemented by all key character output classes including {@code StringBuffer}, {@code StringBuilder}, {@code PrintStream} and {@code Writer}. <p> Although {@code Appendable} methods throw an {@code IOException}, this method does not. Instead, any {@code IOException} is wrapped in a runtime exception. @param temporal the temporal object to format, not null @param appendable the appendable to format to, not null @throws DateTimeException if an error occurs during formatting """ Objects.requireNonNull(temporal, "temporal"); Objects.requireNonNull(appendable, "appendable"); try { DateTimePrintContext context = new DateTimePrintContext(temporal, this); if (appendable instanceof StringBuilder) { printerParser.format(context, (StringBuilder) appendable); } else { // buffer output to avoid writing to appendable in case of error StringBuilder buf = new StringBuilder(32); printerParser.format(context, buf); appendable.append(buf); } } catch (IOException ex) { throw new DateTimeException(ex.getMessage(), ex); } }
java
public void formatTo(TemporalAccessor temporal, Appendable appendable) { Objects.requireNonNull(temporal, "temporal"); Objects.requireNonNull(appendable, "appendable"); try { DateTimePrintContext context = new DateTimePrintContext(temporal, this); if (appendable instanceof StringBuilder) { printerParser.format(context, (StringBuilder) appendable); } else { // buffer output to avoid writing to appendable in case of error StringBuilder buf = new StringBuilder(32); printerParser.format(context, buf); appendable.append(buf); } } catch (IOException ex) { throw new DateTimeException(ex.getMessage(), ex); } }
[ "public", "void", "formatTo", "(", "TemporalAccessor", "temporal", ",", "Appendable", "appendable", ")", "{", "Objects", ".", "requireNonNull", "(", "temporal", ",", "\"temporal\"", ")", ";", "Objects", ".", "requireNonNull", "(", "appendable", ",", "\"appendable\"", ")", ";", "try", "{", "DateTimePrintContext", "context", "=", "new", "DateTimePrintContext", "(", "temporal", ",", "this", ")", ";", "if", "(", "appendable", "instanceof", "StringBuilder", ")", "{", "printerParser", ".", "format", "(", "context", ",", "(", "StringBuilder", ")", "appendable", ")", ";", "}", "else", "{", "// buffer output to avoid writing to appendable in case of error", "StringBuilder", "buf", "=", "new", "StringBuilder", "(", "32", ")", ";", "printerParser", ".", "format", "(", "context", ",", "buf", ")", ";", "appendable", ".", "append", "(", "buf", ")", ";", "}", "}", "catch", "(", "IOException", "ex", ")", "{", "throw", "new", "DateTimeException", "(", "ex", ".", "getMessage", "(", ")", ",", "ex", ")", ";", "}", "}" ]
Formats a date-time object to an {@code Appendable} using this formatter. <p> This outputs the formatted date-time to the specified destination. {@link Appendable} is a general purpose interface that is implemented by all key character output classes including {@code StringBuffer}, {@code StringBuilder}, {@code PrintStream} and {@code Writer}. <p> Although {@code Appendable} methods throw an {@code IOException}, this method does not. Instead, any {@code IOException} is wrapped in a runtime exception. @param temporal the temporal object to format, not null @param appendable the appendable to format to, not null @throws DateTimeException if an error occurs during formatting
[ "Formats", "a", "date", "-", "time", "object", "to", "an", "{", "@code", "Appendable", "}", "using", "this", "formatter", ".", "<p", ">", "This", "outputs", "the", "formatted", "date", "-", "time", "to", "the", "specified", "destination", ".", "{", "@link", "Appendable", "}", "is", "a", "general", "purpose", "interface", "that", "is", "implemented", "by", "all", "key", "character", "output", "classes", "including", "{", "@code", "StringBuffer", "}", "{", "@code", "StringBuilder", "}", "{", "@code", "PrintStream", "}", "and", "{", "@code", "Writer", "}", ".", "<p", ">", "Although", "{", "@code", "Appendable", "}", "methods", "throw", "an", "{", "@code", "IOException", "}", "this", "method", "does", "not", ".", "Instead", "any", "{", "@code", "IOException", "}", "is", "wrapped", "in", "a", "runtime", "exception", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DateTimeFormatter.java#L1740-L1756
Activiti/Activiti
activiti-engine/src/main/java/org/activiti/engine/impl/cfg/ProcessEngineConfigurationImpl.java
ProcessEngineConfigurationImpl.addWsEndpointAddress
public ProcessEngineConfiguration addWsEndpointAddress(QName endpointName, URL address) { """ Add or replace the address of the given web-service endpoint with the given value @param endpointName The endpoint name for which a new address must be set @param address The new address of the endpoint """ this.wsOverridenEndpointAddresses.put(endpointName, address); return this; }
java
public ProcessEngineConfiguration addWsEndpointAddress(QName endpointName, URL address) { this.wsOverridenEndpointAddresses.put(endpointName, address); return this; }
[ "public", "ProcessEngineConfiguration", "addWsEndpointAddress", "(", "QName", "endpointName", ",", "URL", "address", ")", "{", "this", ".", "wsOverridenEndpointAddresses", ".", "put", "(", "endpointName", ",", "address", ")", ";", "return", "this", ";", "}" ]
Add or replace the address of the given web-service endpoint with the given value @param endpointName The endpoint name for which a new address must be set @param address The new address of the endpoint
[ "Add", "or", "replace", "the", "address", "of", "the", "given", "web", "-", "service", "endpoint", "with", "the", "given", "value" ]
train
https://github.com/Activiti/Activiti/blob/82e2b2cd2083b2f734ca0efc7815389c0f2517d9/activiti-engine/src/main/java/org/activiti/engine/impl/cfg/ProcessEngineConfigurationImpl.java#L2427-L2430
alkacon/opencms-core
src/org/opencms/ade/configuration/CmsResourceTypeConfig.java
CmsResourceTypeConfig.tryToUnlock
protected void tryToUnlock(CmsObject cms, String folderPath) throws CmsException { """ Tries to remove a lock on an ancestor of a given path owned by the current user.<p> @param cms the CMS context @param folderPath the path for which the lock should be removed @throws CmsException if something goes wrong """ // Get path of first ancestor that actually exists while (!cms.existsResource(folderPath)) { folderPath = CmsResource.getParentFolder(folderPath); } CmsResource resource = cms.readResource(folderPath); CmsLock lock = cms.getLock(resource); // we are only interested in locks we can safely unlock, i.e. locks by the current user if (lock.isOwnedBy(cms.getRequestContext().getCurrentUser())) { // walk up the tree until we get to the location from which the lock is inherited while (lock.isInherited()) { folderPath = CmsResource.getParentFolder(folderPath); resource = cms.readResource(folderPath); lock = cms.getLock(resource); } cms.unlockResource(folderPath); } }
java
protected void tryToUnlock(CmsObject cms, String folderPath) throws CmsException { // Get path of first ancestor that actually exists while (!cms.existsResource(folderPath)) { folderPath = CmsResource.getParentFolder(folderPath); } CmsResource resource = cms.readResource(folderPath); CmsLock lock = cms.getLock(resource); // we are only interested in locks we can safely unlock, i.e. locks by the current user if (lock.isOwnedBy(cms.getRequestContext().getCurrentUser())) { // walk up the tree until we get to the location from which the lock is inherited while (lock.isInherited()) { folderPath = CmsResource.getParentFolder(folderPath); resource = cms.readResource(folderPath); lock = cms.getLock(resource); } cms.unlockResource(folderPath); } }
[ "protected", "void", "tryToUnlock", "(", "CmsObject", "cms", ",", "String", "folderPath", ")", "throws", "CmsException", "{", "// Get path of first ancestor that actually exists", "while", "(", "!", "cms", ".", "existsResource", "(", "folderPath", ")", ")", "{", "folderPath", "=", "CmsResource", ".", "getParentFolder", "(", "folderPath", ")", ";", "}", "CmsResource", "resource", "=", "cms", ".", "readResource", "(", "folderPath", ")", ";", "CmsLock", "lock", "=", "cms", ".", "getLock", "(", "resource", ")", ";", "// we are only interested in locks we can safely unlock, i.e. locks by the current user", "if", "(", "lock", ".", "isOwnedBy", "(", "cms", ".", "getRequestContext", "(", ")", ".", "getCurrentUser", "(", ")", ")", ")", "{", "// walk up the tree until we get to the location from which the lock is inherited", "while", "(", "lock", ".", "isInherited", "(", ")", ")", "{", "folderPath", "=", "CmsResource", ".", "getParentFolder", "(", "folderPath", ")", ";", "resource", "=", "cms", ".", "readResource", "(", "folderPath", ")", ";", "lock", "=", "cms", ".", "getLock", "(", "resource", ")", ";", "}", "cms", ".", "unlockResource", "(", "folderPath", ")", ";", "}", "}" ]
Tries to remove a lock on an ancestor of a given path owned by the current user.<p> @param cms the CMS context @param folderPath the path for which the lock should be removed @throws CmsException if something goes wrong
[ "Tries", "to", "remove", "a", "lock", "on", "an", "ancestor", "of", "a", "given", "path", "owned", "by", "the", "current", "user", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/configuration/CmsResourceTypeConfig.java#L749-L767
albfernandez/itext2
src/main/java/com/lowagie/text/rtf/parser/RtfImportMgr.java
RtfImportMgr.importFont
public boolean importFont(String fontNr, String fontName, String fontFamily, int charset) { """ Imports a font. The font name is looked up in the RtfDocumentHeader and then the mapping from original font number to actual font number is added. @param fontNr The original font number. @param fontName The font name to look up. @param charset The character set to use for the font. """ RtfFont rtfFont = new RtfFont(fontName); if(charset>= 0) rtfFont.setCharset(charset); if(fontFamily != null && fontFamily.length() > 0) rtfFont.setFamily(fontFamily); rtfFont.setRtfDocument(this.rtfDoc); this.importFontMapping.put(fontNr, Integer.toString(this.rtfDoc.getDocumentHeader().getFontNumber(rtfFont))); return true; }
java
public boolean importFont(String fontNr, String fontName, String fontFamily, int charset) { RtfFont rtfFont = new RtfFont(fontName); if(charset>= 0) rtfFont.setCharset(charset); if(fontFamily != null && fontFamily.length() > 0) rtfFont.setFamily(fontFamily); rtfFont.setRtfDocument(this.rtfDoc); this.importFontMapping.put(fontNr, Integer.toString(this.rtfDoc.getDocumentHeader().getFontNumber(rtfFont))); return true; }
[ "public", "boolean", "importFont", "(", "String", "fontNr", ",", "String", "fontName", ",", "String", "fontFamily", ",", "int", "charset", ")", "{", "RtfFont", "rtfFont", "=", "new", "RtfFont", "(", "fontName", ")", ";", "if", "(", "charset", ">=", "0", ")", "rtfFont", ".", "setCharset", "(", "charset", ")", ";", "if", "(", "fontFamily", "!=", "null", "&&", "fontFamily", ".", "length", "(", ")", ">", "0", ")", "rtfFont", ".", "setFamily", "(", "fontFamily", ")", ";", "rtfFont", ".", "setRtfDocument", "(", "this", ".", "rtfDoc", ")", ";", "this", ".", "importFontMapping", ".", "put", "(", "fontNr", ",", "Integer", ".", "toString", "(", "this", ".", "rtfDoc", ".", "getDocumentHeader", "(", ")", ".", "getFontNumber", "(", "rtfFont", ")", ")", ")", ";", "return", "true", ";", "}" ]
Imports a font. The font name is looked up in the RtfDocumentHeader and then the mapping from original font number to actual font number is added. @param fontNr The original font number. @param fontName The font name to look up. @param charset The character set to use for the font.
[ "Imports", "a", "font", ".", "The", "font", "name", "is", "looked", "up", "in", "the", "RtfDocumentHeader", "and", "then", "the", "mapping", "from", "original", "font", "number", "to", "actual", "font", "number", "is", "added", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/rtf/parser/RtfImportMgr.java#L157-L167
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/P2sVpnServerConfigurationsInner.java
P2sVpnServerConfigurationsInner.createOrUpdate
public P2SVpnServerConfigurationInner createOrUpdate(String resourceGroupName, String virtualWanName, String p2SVpnServerConfigurationName, P2SVpnServerConfigurationInner p2SVpnServerConfigurationParameters) { """ Creates a P2SVpnServerConfiguration to associate with a VirtualWan if it doesn't exist else updates the existing P2SVpnServerConfiguration. @param resourceGroupName The resource group name of the VirtualWan. @param virtualWanName The name of the VirtualWan. @param p2SVpnServerConfigurationName The name of the P2SVpnServerConfiguration. @param p2SVpnServerConfigurationParameters Parameters supplied to create or Update a P2SVpnServerConfiguration. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the P2SVpnServerConfigurationInner object if successful. """ return createOrUpdateWithServiceResponseAsync(resourceGroupName, virtualWanName, p2SVpnServerConfigurationName, p2SVpnServerConfigurationParameters).toBlocking().last().body(); }
java
public P2SVpnServerConfigurationInner createOrUpdate(String resourceGroupName, String virtualWanName, String p2SVpnServerConfigurationName, P2SVpnServerConfigurationInner p2SVpnServerConfigurationParameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, virtualWanName, p2SVpnServerConfigurationName, p2SVpnServerConfigurationParameters).toBlocking().last().body(); }
[ "public", "P2SVpnServerConfigurationInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "virtualWanName", ",", "String", "p2SVpnServerConfigurationName", ",", "P2SVpnServerConfigurationInner", "p2SVpnServerConfigurationParameters", ")", "{", "return", "createOrUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "virtualWanName", ",", "p2SVpnServerConfigurationName", ",", "p2SVpnServerConfigurationParameters", ")", ".", "toBlocking", "(", ")", ".", "last", "(", ")", ".", "body", "(", ")", ";", "}" ]
Creates a P2SVpnServerConfiguration to associate with a VirtualWan if it doesn't exist else updates the existing P2SVpnServerConfiguration. @param resourceGroupName The resource group name of the VirtualWan. @param virtualWanName The name of the VirtualWan. @param p2SVpnServerConfigurationName The name of the P2SVpnServerConfiguration. @param p2SVpnServerConfigurationParameters Parameters supplied to create or Update a P2SVpnServerConfiguration. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the P2SVpnServerConfigurationInner object if successful.
[ "Creates", "a", "P2SVpnServerConfiguration", "to", "associate", "with", "a", "VirtualWan", "if", "it", "doesn", "t", "exist", "else", "updates", "the", "existing", "P2SVpnServerConfiguration", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/P2sVpnServerConfigurationsInner.java#L197-L199
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/ProxyQueueConversationGroupImpl.java
ProxyQueueConversationGroupImpl.createBrowserProxyQueue
public synchronized BrowserProxyQueue createBrowserProxyQueue() // F171893 throws SIResourceException, SIIncorrectCallException { """ Creates a new browser proxy queue for this group. @see com.ibm.ws.sib.comms.client.proxyqueue.ProxyQueueConversationGroup#createBrowserProxyQueue() """ if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createBrowserProxyQueue"); // F171893 checkClosed(); short id = nextId(); BrowserProxyQueue proxyQueue = new BrowserProxyQueueImpl(this, id, conversation); idToProxyQueueMap.put(new ImmutableId(id), proxyQueue); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createBrowserProxyQueue", proxyQueue); return proxyQueue; }
java
public synchronized BrowserProxyQueue createBrowserProxyQueue() // F171893 throws SIResourceException, SIIncorrectCallException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "createBrowserProxyQueue"); // F171893 checkClosed(); short id = nextId(); BrowserProxyQueue proxyQueue = new BrowserProxyQueueImpl(this, id, conversation); idToProxyQueueMap.put(new ImmutableId(id), proxyQueue); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "createBrowserProxyQueue", proxyQueue); return proxyQueue; }
[ "public", "synchronized", "BrowserProxyQueue", "createBrowserProxyQueue", "(", ")", "// F171893", "throws", "SIResourceException", ",", "SIIncorrectCallException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "tc", ",", "\"createBrowserProxyQueue\"", ")", ";", "// F171893", "checkClosed", "(", ")", ";", "short", "id", "=", "nextId", "(", ")", ";", "BrowserProxyQueue", "proxyQueue", "=", "new", "BrowserProxyQueueImpl", "(", "this", ",", "id", ",", "conversation", ")", ";", "idToProxyQueueMap", ".", "put", "(", "new", "ImmutableId", "(", "id", ")", ",", "proxyQueue", ")", ";", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "exit", "(", "tc", ",", "\"createBrowserProxyQueue\"", ",", "proxyQueue", ")", ";", "return", "proxyQueue", ";", "}" ]
Creates a new browser proxy queue for this group. @see com.ibm.ws.sib.comms.client.proxyqueue.ProxyQueueConversationGroup#createBrowserProxyQueue()
[ "Creates", "a", "new", "browser", "proxy", "queue", "for", "this", "group", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.comms.client/src/com/ibm/ws/sib/comms/client/proxyqueue/impl/ProxyQueueConversationGroupImpl.java#L120-L131
hawkular/hawkular-agent
hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/SocketBindingJBossASClient.java
SocketBindingJBossASClient.isSocketBinding
public boolean isSocketBinding(String socketBindingGroupName, String socketBindingName) throws Exception { """ Checks to see if there is already a socket binding in the given group. @param socketBindingGroupName the name of the socket binding group in which to look for the named socket binding @param socketBindingName the name of the socket binding to look for @return true if there is an existing socket binding in the given group @throws Exception any error """ Address addr = Address.root().add(SOCKET_BINDING_GROUP, socketBindingGroupName); String haystack = SOCKET_BINDING; return null != findNodeInList(addr, haystack, socketBindingName); }
java
public boolean isSocketBinding(String socketBindingGroupName, String socketBindingName) throws Exception { Address addr = Address.root().add(SOCKET_BINDING_GROUP, socketBindingGroupName); String haystack = SOCKET_BINDING; return null != findNodeInList(addr, haystack, socketBindingName); }
[ "public", "boolean", "isSocketBinding", "(", "String", "socketBindingGroupName", ",", "String", "socketBindingName", ")", "throws", "Exception", "{", "Address", "addr", "=", "Address", ".", "root", "(", ")", ".", "add", "(", "SOCKET_BINDING_GROUP", ",", "socketBindingGroupName", ")", ";", "String", "haystack", "=", "SOCKET_BINDING", ";", "return", "null", "!=", "findNodeInList", "(", "addr", ",", "haystack", ",", "socketBindingName", ")", ";", "}" ]
Checks to see if there is already a socket binding in the given group. @param socketBindingGroupName the name of the socket binding group in which to look for the named socket binding @param socketBindingName the name of the socket binding to look for @return true if there is an existing socket binding in the given group @throws Exception any error
[ "Checks", "to", "see", "if", "there", "is", "already", "a", "socket", "binding", "in", "the", "given", "group", "." ]
train
https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/SocketBindingJBossASClient.java#L74-L78
google/error-prone-javac
src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java
HtmlDocletWriter.getDocLink
public Content getDocLink(LinkInfoImpl.Kind context, Element element, CharSequence label) { """ Get the link for the given member. @param context the id of the context where the link will be added @param element the member being linked to @param label the label for the link @return a content tree for the element link """ return getDocLink(context, utils.getEnclosingTypeElement(element), element, new StringContent(label)); }
java
public Content getDocLink(LinkInfoImpl.Kind context, Element element, CharSequence label) { return getDocLink(context, utils.getEnclosingTypeElement(element), element, new StringContent(label)); }
[ "public", "Content", "getDocLink", "(", "LinkInfoImpl", ".", "Kind", "context", ",", "Element", "element", ",", "CharSequence", "label", ")", "{", "return", "getDocLink", "(", "context", ",", "utils", ".", "getEnclosingTypeElement", "(", "element", ")", ",", "element", ",", "new", "StringContent", "(", "label", ")", ")", ";", "}" ]
Get the link for the given member. @param context the id of the context where the link will be added @param element the member being linked to @param label the label for the link @return a content tree for the element link
[ "Get", "the", "link", "for", "the", "given", "member", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/HtmlDocletWriter.java#L1351-L1354
sdl/odata
odata_renderer/src/main/java/com/sdl/odata/ODataRendererUtils.java
ODataRendererUtils.getContextURL
public static String getContextURL(ODataUri oDataUri, EntityDataModel entityDataModel, boolean isPrimitive) throws ODataRenderException { """ This method returns odata context based on oDataUri. Throws ODataRenderException in case context is not defined. @param entityDataModel The entity data model. @param oDataUri is object which is the root of an abstract syntax tree that describes @param isPrimitive True if the context URL is for primitive. @return string that represents context @throws ODataRenderException if unable to get context from url """ if (ODataUriUtil.isActionCallUri(oDataUri) || ODataUriUtil.isFunctionCallUri(oDataUri)) { return buildContextUrlFromOperationCall(oDataUri, entityDataModel, isPrimitive); } Option<String> contextOption = getContextUrl(oDataUri); if (contextOption.isEmpty()) { throw new ODataRenderException("Could not construct context"); } return contextOption.get(); }
java
public static String getContextURL(ODataUri oDataUri, EntityDataModel entityDataModel, boolean isPrimitive) throws ODataRenderException { if (ODataUriUtil.isActionCallUri(oDataUri) || ODataUriUtil.isFunctionCallUri(oDataUri)) { return buildContextUrlFromOperationCall(oDataUri, entityDataModel, isPrimitive); } Option<String> contextOption = getContextUrl(oDataUri); if (contextOption.isEmpty()) { throw new ODataRenderException("Could not construct context"); } return contextOption.get(); }
[ "public", "static", "String", "getContextURL", "(", "ODataUri", "oDataUri", ",", "EntityDataModel", "entityDataModel", ",", "boolean", "isPrimitive", ")", "throws", "ODataRenderException", "{", "if", "(", "ODataUriUtil", ".", "isActionCallUri", "(", "oDataUri", ")", "||", "ODataUriUtil", ".", "isFunctionCallUri", "(", "oDataUri", ")", ")", "{", "return", "buildContextUrlFromOperationCall", "(", "oDataUri", ",", "entityDataModel", ",", "isPrimitive", ")", ";", "}", "Option", "<", "String", ">", "contextOption", "=", "getContextUrl", "(", "oDataUri", ")", ";", "if", "(", "contextOption", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "ODataRenderException", "(", "\"Could not construct context\"", ")", ";", "}", "return", "contextOption", ".", "get", "(", ")", ";", "}" ]
This method returns odata context based on oDataUri. Throws ODataRenderException in case context is not defined. @param entityDataModel The entity data model. @param oDataUri is object which is the root of an abstract syntax tree that describes @param isPrimitive True if the context URL is for primitive. @return string that represents context @throws ODataRenderException if unable to get context from url
[ "This", "method", "returns", "odata", "context", "based", "on", "oDataUri", ".", "Throws", "ODataRenderException", "in", "case", "context", "is", "not", "defined", "." ]
train
https://github.com/sdl/odata/blob/eb747d73e9af0f4e59a25b82ed656e526a7e2189/odata_renderer/src/main/java/com/sdl/odata/ODataRendererUtils.java#L65-L77
twilio/twilio-java
src/main/java/com/twilio/base/Reader.java
Reader.nextPage
public Page<T> nextPage(final Page<T> page) { """ Fetch the following page of resources. @param page current page of resources @return Page containing the next pageSize of resources """ return nextPage(page, Twilio.getRestClient()); }
java
public Page<T> nextPage(final Page<T> page) { return nextPage(page, Twilio.getRestClient()); }
[ "public", "Page", "<", "T", ">", "nextPage", "(", "final", "Page", "<", "T", ">", "page", ")", "{", "return", "nextPage", "(", "page", ",", "Twilio", ".", "getRestClient", "(", ")", ")", ";", "}" ]
Fetch the following page of resources. @param page current page of resources @return Page containing the next pageSize of resources
[ "Fetch", "the", "following", "page", "of", "resources", "." ]
train
https://github.com/twilio/twilio-java/blob/0318974c0a6a152994af167d430255684d5e9b9f/src/main/java/com/twilio/base/Reader.java#L101-L103
mebigfatguy/fb-contrib
src/main/java/com/mebigfatguy/fbcontrib/detect/JPAIssues.java
JPAIssues.visitClassContext
@Override public void visitClassContext(ClassContext clsContext) { """ implements the visitor to find @Entity classes that have both generated @Ids and have implemented hashCode/equals. Also looks for eager one to many join fetches as that leads to 1+n queries. @param clsContext the context object of the currently parsed class """ try { cls = clsContext.getJavaClass(); catalogClass(cls); if (isEntity) { if (hasHCEquals && hasId && hasGeneratedValue) { bugReporter.reportBug(new BugInstance(this, BugType.JPAI_HC_EQUALS_ON_MANAGED_ENTITY.name(), LOW_PRIORITY).addClass(cls)); } if (hasEagerOneToMany && !hasFetch) { bugReporter.reportBug(new BugInstance(this, BugType.JPAI_INEFFICIENT_EAGER_FETCH.name(), LOW_PRIORITY).addClass(cls)); } } if (!transactionalMethods.isEmpty()) { stack = new OpcodeStack(); super.visitClassContext(clsContext); } } finally { transactionalMethods = null; stack = null; } }
java
@Override public void visitClassContext(ClassContext clsContext) { try { cls = clsContext.getJavaClass(); catalogClass(cls); if (isEntity) { if (hasHCEquals && hasId && hasGeneratedValue) { bugReporter.reportBug(new BugInstance(this, BugType.JPAI_HC_EQUALS_ON_MANAGED_ENTITY.name(), LOW_PRIORITY).addClass(cls)); } if (hasEagerOneToMany && !hasFetch) { bugReporter.reportBug(new BugInstance(this, BugType.JPAI_INEFFICIENT_EAGER_FETCH.name(), LOW_PRIORITY).addClass(cls)); } } if (!transactionalMethods.isEmpty()) { stack = new OpcodeStack(); super.visitClassContext(clsContext); } } finally { transactionalMethods = null; stack = null; } }
[ "@", "Override", "public", "void", "visitClassContext", "(", "ClassContext", "clsContext", ")", "{", "try", "{", "cls", "=", "clsContext", ".", "getJavaClass", "(", ")", ";", "catalogClass", "(", "cls", ")", ";", "if", "(", "isEntity", ")", "{", "if", "(", "hasHCEquals", "&&", "hasId", "&&", "hasGeneratedValue", ")", "{", "bugReporter", ".", "reportBug", "(", "new", "BugInstance", "(", "this", ",", "BugType", ".", "JPAI_HC_EQUALS_ON_MANAGED_ENTITY", ".", "name", "(", ")", ",", "LOW_PRIORITY", ")", ".", "addClass", "(", "cls", ")", ")", ";", "}", "if", "(", "hasEagerOneToMany", "&&", "!", "hasFetch", ")", "{", "bugReporter", ".", "reportBug", "(", "new", "BugInstance", "(", "this", ",", "BugType", ".", "JPAI_INEFFICIENT_EAGER_FETCH", ".", "name", "(", ")", ",", "LOW_PRIORITY", ")", ".", "addClass", "(", "cls", ")", ")", ";", "}", "}", "if", "(", "!", "transactionalMethods", ".", "isEmpty", "(", ")", ")", "{", "stack", "=", "new", "OpcodeStack", "(", ")", ";", "super", ".", "visitClassContext", "(", "clsContext", ")", ";", "}", "}", "finally", "{", "transactionalMethods", "=", "null", ";", "stack", "=", "null", ";", "}", "}" ]
implements the visitor to find @Entity classes that have both generated @Ids and have implemented hashCode/equals. Also looks for eager one to many join fetches as that leads to 1+n queries. @param clsContext the context object of the currently parsed class
[ "implements", "the", "visitor", "to", "find", "@Entity", "classes", "that", "have", "both", "generated", "@Ids", "and", "have", "implemented", "hashCode", "/", "equals", ".", "Also", "looks", "for", "eager", "one", "to", "many", "join", "fetches", "as", "that", "leads", "to", "1", "+", "n", "queries", "." ]
train
https://github.com/mebigfatguy/fb-contrib/blob/3b5203196f627b399fbcea3c2ab2b1f4e56cc7b8/src/main/java/com/mebigfatguy/fbcontrib/detect/JPAIssues.java#L122-L145
opsmatters/newrelic-api
src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java
HttpContext.executeGetRequest
protected <T> Optional<T> executeGetRequest(URI uri, Map<String, Object> headers, List<String> queryParams, GenericType<T> returnType) { """ Execute a GET request and return the result. @param <T> The type parameter used for the return object @param uri The URI to call @param returnType The type to marshall the result back into @param headers A set of headers to add to the request @param queryParams A set of query parameters to add to the request @return The return type """ WebTarget target = this.client.target(uri); target = applyQueryParams(target, queryParams); Invocation.Builder invocation = target.request(MediaType.APPLICATION_JSON); applyHeaders(invocation, headers); Response response = invocation.get(); handleResponseError("GET", uri, response); logResponse(uri, response); return extractEntityFromResponse(response, returnType); }
java
protected <T> Optional<T> executeGetRequest(URI uri, Map<String, Object> headers, List<String> queryParams, GenericType<T> returnType) { WebTarget target = this.client.target(uri); target = applyQueryParams(target, queryParams); Invocation.Builder invocation = target.request(MediaType.APPLICATION_JSON); applyHeaders(invocation, headers); Response response = invocation.get(); handleResponseError("GET", uri, response); logResponse(uri, response); return extractEntityFromResponse(response, returnType); }
[ "protected", "<", "T", ">", "Optional", "<", "T", ">", "executeGetRequest", "(", "URI", "uri", ",", "Map", "<", "String", ",", "Object", ">", "headers", ",", "List", "<", "String", ">", "queryParams", ",", "GenericType", "<", "T", ">", "returnType", ")", "{", "WebTarget", "target", "=", "this", ".", "client", ".", "target", "(", "uri", ")", ";", "target", "=", "applyQueryParams", "(", "target", ",", "queryParams", ")", ";", "Invocation", ".", "Builder", "invocation", "=", "target", ".", "request", "(", "MediaType", ".", "APPLICATION_JSON", ")", ";", "applyHeaders", "(", "invocation", ",", "headers", ")", ";", "Response", "response", "=", "invocation", ".", "get", "(", ")", ";", "handleResponseError", "(", "\"GET\"", ",", "uri", ",", "response", ")", ";", "logResponse", "(", "uri", ",", "response", ")", ";", "return", "extractEntityFromResponse", "(", "response", ",", "returnType", ")", ";", "}" ]
Execute a GET request and return the result. @param <T> The type parameter used for the return object @param uri The URI to call @param returnType The type to marshall the result back into @param headers A set of headers to add to the request @param queryParams A set of query parameters to add to the request @return The return type
[ "Execute", "a", "GET", "request", "and", "return", "the", "result", "." ]
train
https://github.com/opsmatters/newrelic-api/blob/5bc2ea62ec368db891e4fd5fe3dcdf529d086b5e/src/main/java/com/opsmatters/newrelic/api/services/HttpContext.java#L342-L353
albfernandez/itext2
src/main/java/com/lowagie/text/pdf/PdfStamper.java
PdfStamper.setPageAction
public void setPageAction(PdfName actionType, PdfAction action, int page) throws PdfException { """ Sets the open and close page additional action. @param actionType the action type. It can be <CODE>PdfWriter.PAGE_OPEN</CODE> or <CODE>PdfWriter.PAGE_CLOSE</CODE> @param action the action to perform @param page the page where the action will be applied. The first page is 1 @throws PdfException if the action type is invalid """ stamper.setPageAction(actionType, action, page); }
java
public void setPageAction(PdfName actionType, PdfAction action, int page) throws PdfException { stamper.setPageAction(actionType, action, page); }
[ "public", "void", "setPageAction", "(", "PdfName", "actionType", ",", "PdfAction", "action", ",", "int", "page", ")", "throws", "PdfException", "{", "stamper", ".", "setPageAction", "(", "actionType", ",", "action", ",", "page", ")", ";", "}" ]
Sets the open and close page additional action. @param actionType the action type. It can be <CODE>PdfWriter.PAGE_OPEN</CODE> or <CODE>PdfWriter.PAGE_CLOSE</CODE> @param action the action to perform @param page the page where the action will be applied. The first page is 1 @throws PdfException if the action type is invalid
[ "Sets", "the", "open", "and", "close", "page", "additional", "action", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/pdf/PdfStamper.java#L596-L598
JRebirth/JRebirth
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/util/CheckerUtility.java
CheckerUtility.checkMethodSignature
public static boolean checkMethodSignature(final Method method, final List<WaveItem<?>> wParams) { """ Compare method parameters with wave parameters. @param method the method to check @param wParams the wave parameters taht define the contract @return true if the method has the right signature """ boolean isCompliant = false; final Type[] mParams = method.getGenericParameterTypes(); if (wParams.isEmpty() && Wave.class.isAssignableFrom(ClassUtility.getClassFromType(mParams[0]))) { isCompliant = true; } else if (mParams.length - 1 == wParams.size()) { // Flag used to skip a method not compliant boolean skipMethod = false; // Check each parameter for (int i = 0; !skipMethod && i < mParams.length - 1 && !isCompliant; i++) { if (!ClassUtility.getClassFromType(mParams[i]).isAssignableFrom(ClassUtility.getClassFromType(wParams.get(i).type()))) { // This method has not the right parameters skipMethod = true; } if (i == mParams.length - 2 && Wave.class.isAssignableFrom(ClassUtility.getClassFromType(mParams[i + 1]))) { // This method is compliant with wave type isCompliant = true; } } } return isCompliant; }
java
public static boolean checkMethodSignature(final Method method, final List<WaveItem<?>> wParams) { boolean isCompliant = false; final Type[] mParams = method.getGenericParameterTypes(); if (wParams.isEmpty() && Wave.class.isAssignableFrom(ClassUtility.getClassFromType(mParams[0]))) { isCompliant = true; } else if (mParams.length - 1 == wParams.size()) { // Flag used to skip a method not compliant boolean skipMethod = false; // Check each parameter for (int i = 0; !skipMethod && i < mParams.length - 1 && !isCompliant; i++) { if (!ClassUtility.getClassFromType(mParams[i]).isAssignableFrom(ClassUtility.getClassFromType(wParams.get(i).type()))) { // This method has not the right parameters skipMethod = true; } if (i == mParams.length - 2 && Wave.class.isAssignableFrom(ClassUtility.getClassFromType(mParams[i + 1]))) { // This method is compliant with wave type isCompliant = true; } } } return isCompliant; }
[ "public", "static", "boolean", "checkMethodSignature", "(", "final", "Method", "method", ",", "final", "List", "<", "WaveItem", "<", "?", ">", ">", "wParams", ")", "{", "boolean", "isCompliant", "=", "false", ";", "final", "Type", "[", "]", "mParams", "=", "method", ".", "getGenericParameterTypes", "(", ")", ";", "if", "(", "wParams", ".", "isEmpty", "(", ")", "&&", "Wave", ".", "class", ".", "isAssignableFrom", "(", "ClassUtility", ".", "getClassFromType", "(", "mParams", "[", "0", "]", ")", ")", ")", "{", "isCompliant", "=", "true", ";", "}", "else", "if", "(", "mParams", ".", "length", "-", "1", "==", "wParams", ".", "size", "(", ")", ")", "{", "// Flag used to skip a method not compliant", "boolean", "skipMethod", "=", "false", ";", "// Check each parameter", "for", "(", "int", "i", "=", "0", ";", "!", "skipMethod", "&&", "i", "<", "mParams", ".", "length", "-", "1", "&&", "!", "isCompliant", ";", "i", "++", ")", "{", "if", "(", "!", "ClassUtility", ".", "getClassFromType", "(", "mParams", "[", "i", "]", ")", ".", "isAssignableFrom", "(", "ClassUtility", ".", "getClassFromType", "(", "wParams", ".", "get", "(", "i", ")", ".", "type", "(", ")", ")", ")", ")", "{", "// This method has not the right parameters", "skipMethod", "=", "true", ";", "}", "if", "(", "i", "==", "mParams", ".", "length", "-", "2", "&&", "Wave", ".", "class", ".", "isAssignableFrom", "(", "ClassUtility", ".", "getClassFromType", "(", "mParams", "[", "i", "+", "1", "]", ")", ")", ")", "{", "// This method is compliant with wave type", "isCompliant", "=", "true", ";", "}", "}", "}", "return", "isCompliant", ";", "}" ]
Compare method parameters with wave parameters. @param method the method to check @param wParams the wave parameters taht define the contract @return true if the method has the right signature
[ "Compare", "method", "parameters", "with", "wave", "parameters", "." ]
train
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/util/CheckerUtility.java#L110-L135
LGoodDatePicker/LGoodDatePicker
Project/src/main/java/com/github/lgooddatepicker/components/CalendarPanel.java
CalendarPanel.labelIndicatorMouseEntered
private void labelIndicatorMouseEntered(MouseEvent e) { """ labelIndicatorMouseEntered, This event is called when the user move the mouse inside a monitored label. This is used to generate mouse over effects for the calendar panel. """ // Skip this function if the settings have not been applied. if (settings == null) { return; } JLabel label = ((JLabel) e.getSource()); // Do not highlight the today label if today is vetoed. if (label == labelSetDateToToday) { DateVetoPolicy vetoPolicy = settings.getVetoPolicy(); boolean todayIsVetoed = InternalUtilities.isDateVetoed(vetoPolicy, LocalDate.now()); if (todayIsVetoed) { return; } } // Do not highlight the month label if the month menu is disabled. if ((label == labelMonth) && (settings.getEnableMonthMenu() == false)) { return; } // Do not highlight the year label if the year menu is disabled. if ((label == labelYear) && (settings.getEnableYearMenu() == false)) { return; } // Highlight the label. label.setBackground(new Color(184, 207, 229)); label.setBorder(new CompoundBorder( new LineBorder(Color.GRAY), labelIndicatorEmptyBorder)); }
java
private void labelIndicatorMouseEntered(MouseEvent e) { // Skip this function if the settings have not been applied. if (settings == null) { return; } JLabel label = ((JLabel) e.getSource()); // Do not highlight the today label if today is vetoed. if (label == labelSetDateToToday) { DateVetoPolicy vetoPolicy = settings.getVetoPolicy(); boolean todayIsVetoed = InternalUtilities.isDateVetoed(vetoPolicy, LocalDate.now()); if (todayIsVetoed) { return; } } // Do not highlight the month label if the month menu is disabled. if ((label == labelMonth) && (settings.getEnableMonthMenu() == false)) { return; } // Do not highlight the year label if the year menu is disabled. if ((label == labelYear) && (settings.getEnableYearMenu() == false)) { return; } // Highlight the label. label.setBackground(new Color(184, 207, 229)); label.setBorder(new CompoundBorder( new LineBorder(Color.GRAY), labelIndicatorEmptyBorder)); }
[ "private", "void", "labelIndicatorMouseEntered", "(", "MouseEvent", "e", ")", "{", "// Skip this function if the settings have not been applied.", "if", "(", "settings", "==", "null", ")", "{", "return", ";", "}", "JLabel", "label", "=", "(", "(", "JLabel", ")", "e", ".", "getSource", "(", ")", ")", ";", "// Do not highlight the today label if today is vetoed.", "if", "(", "label", "==", "labelSetDateToToday", ")", "{", "DateVetoPolicy", "vetoPolicy", "=", "settings", ".", "getVetoPolicy", "(", ")", ";", "boolean", "todayIsVetoed", "=", "InternalUtilities", ".", "isDateVetoed", "(", "vetoPolicy", ",", "LocalDate", ".", "now", "(", ")", ")", ";", "if", "(", "todayIsVetoed", ")", "{", "return", ";", "}", "}", "// Do not highlight the month label if the month menu is disabled.", "if", "(", "(", "label", "==", "labelMonth", ")", "&&", "(", "settings", ".", "getEnableMonthMenu", "(", ")", "==", "false", ")", ")", "{", "return", ";", "}", "// Do not highlight the year label if the year menu is disabled.", "if", "(", "(", "label", "==", "labelYear", ")", "&&", "(", "settings", ".", "getEnableYearMenu", "(", ")", "==", "false", ")", ")", "{", "return", ";", "}", "// Highlight the label.", "label", ".", "setBackground", "(", "new", "Color", "(", "184", ",", "207", ",", "229", ")", ")", ";", "label", ".", "setBorder", "(", "new", "CompoundBorder", "(", "new", "LineBorder", "(", "Color", ".", "GRAY", ")", ",", "labelIndicatorEmptyBorder", ")", ")", ";", "}" ]
labelIndicatorMouseEntered, This event is called when the user move the mouse inside a monitored label. This is used to generate mouse over effects for the calendar panel.
[ "labelIndicatorMouseEntered", "This", "event", "is", "called", "when", "the", "user", "move", "the", "mouse", "inside", "a", "monitored", "label", ".", "This", "is", "used", "to", "generate", "mouse", "over", "effects", "for", "the", "calendar", "panel", "." ]
train
https://github.com/LGoodDatePicker/LGoodDatePicker/blob/c7df05a5fe382e1e08a6237e9391d8dc5fd48692/Project/src/main/java/com/github/lgooddatepicker/components/CalendarPanel.java#L920-L946
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java
AsynchronousRequest.getGuildTeamsInfo
public void getGuildTeamsInfo(String id, String api, Callback<List<GuildTeam>> callback) throws GuildWars2Exception, NullPointerException { """ For more info on guild teams API go <a href="https://wiki.guildwars2.com/wiki/API:2/guild/:id/teams">here</a><br/> Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions<br/> @param id guild id @param api Guild leader's Guild Wars 2 API key @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws NullPointerException if given {@link Callback} is empty @see GuildTeam guild team info """ isParamValid(new ParamChecker(ParamType.GUILD, id), new ParamChecker(ParamType.API, api)); gw2API.getGuildTeamsInfo(id, api).enqueue(callback); }
java
public void getGuildTeamsInfo(String id, String api, Callback<List<GuildTeam>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ParamType.GUILD, id), new ParamChecker(ParamType.API, api)); gw2API.getGuildTeamsInfo(id, api).enqueue(callback); }
[ "public", "void", "getGuildTeamsInfo", "(", "String", "id", ",", "String", "api", ",", "Callback", "<", "List", "<", "GuildTeam", ">", ">", "callback", ")", "throws", "GuildWars2Exception", ",", "NullPointerException", "{", "isParamValid", "(", "new", "ParamChecker", "(", "ParamType", ".", "GUILD", ",", "id", ")", ",", "new", "ParamChecker", "(", "ParamType", ".", "API", ",", "api", ")", ")", ";", "gw2API", ".", "getGuildTeamsInfo", "(", "id", ",", "api", ")", ".", "enqueue", "(", "callback", ")", ";", "}" ]
For more info on guild teams API go <a href="https://wiki.guildwars2.com/wiki/API:2/guild/:id/teams">here</a><br/> Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions<br/> @param id guild id @param api Guild leader's Guild Wars 2 API key @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws NullPointerException if given {@link Callback} is empty @see GuildTeam guild team info
[ "For", "more", "info", "on", "guild", "teams", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "guild", "/", ":", "id", "/", "teams", ">", "here<", "/", "a", ">", "<br", "/", ">", "Give", "user", "the", "access", "to", "{", "@link", "Callback#onResponse", "(", "Call", "Response", ")", "}", "and", "{", "@link", "Callback#onFailure", "(", "Call", "Throwable", ")", "}", "methods", "for", "custom", "interactions<br", "/", ">" ]
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L1552-L1555
SpartaTech/sparta-spring-web-utils
src/main/java/org/sparta/springwebutils/ManifestUtils.java
ManifestUtils.getExplodedWarManifestAttributes
private Map<Object, Object> getExplodedWarManifestAttributes() { """ reads the manifest from a exploded WAR @return Map<Object, Object> manifest entries if found otherwise empty map """ Map<Object, Object> manifestAttributes = null; FileInputStream fis = null; try { if (servletContext != null) { final String appServerHome = servletContext.getRealPath(""); final File manifestFile = new File(appServerHome, MANIFEST); LOGGER.debug("Using Manifest file:{}", manifestFile.getPath()); fis = new FileInputStream(manifestFile); Manifest mf = new Manifest(fis); manifestAttributes = mf.getMainAttributes(); } } catch (Exception e) { LOGGER.warn("Unable to read the manifest file from the servlet context."); LOGGER.debug("Unable to read the manifest file", e); } finally { IOUtils.closeQuietly(fis); } return manifestAttributes; }
java
private Map<Object, Object> getExplodedWarManifestAttributes() { Map<Object, Object> manifestAttributes = null; FileInputStream fis = null; try { if (servletContext != null) { final String appServerHome = servletContext.getRealPath(""); final File manifestFile = new File(appServerHome, MANIFEST); LOGGER.debug("Using Manifest file:{}", manifestFile.getPath()); fis = new FileInputStream(manifestFile); Manifest mf = new Manifest(fis); manifestAttributes = mf.getMainAttributes(); } } catch (Exception e) { LOGGER.warn("Unable to read the manifest file from the servlet context."); LOGGER.debug("Unable to read the manifest file", e); } finally { IOUtils.closeQuietly(fis); } return manifestAttributes; }
[ "private", "Map", "<", "Object", ",", "Object", ">", "getExplodedWarManifestAttributes", "(", ")", "{", "Map", "<", "Object", ",", "Object", ">", "manifestAttributes", "=", "null", ";", "FileInputStream", "fis", "=", "null", ";", "try", "{", "if", "(", "servletContext", "!=", "null", ")", "{", "final", "String", "appServerHome", "=", "servletContext", ".", "getRealPath", "(", "\"\"", ")", ";", "final", "File", "manifestFile", "=", "new", "File", "(", "appServerHome", ",", "MANIFEST", ")", ";", "LOGGER", ".", "debug", "(", "\"Using Manifest file:{}\"", ",", "manifestFile", ".", "getPath", "(", ")", ")", ";", "fis", "=", "new", "FileInputStream", "(", "manifestFile", ")", ";", "Manifest", "mf", "=", "new", "Manifest", "(", "fis", ")", ";", "manifestAttributes", "=", "mf", ".", "getMainAttributes", "(", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "LOGGER", ".", "warn", "(", "\"Unable to read the manifest file from the servlet context.\"", ")", ";", "LOGGER", ".", "debug", "(", "\"Unable to read the manifest file\"", ",", "e", ")", ";", "}", "finally", "{", "IOUtils", ".", "closeQuietly", "(", "fis", ")", ";", "}", "return", "manifestAttributes", ";", "}" ]
reads the manifest from a exploded WAR @return Map<Object, Object> manifest entries if found otherwise empty map
[ "reads", "the", "manifest", "from", "a", "exploded", "WAR" ]
train
https://github.com/SpartaTech/sparta-spring-web-utils/blob/f5382474d46a6048d58707fc64e7936277e8b2ce/src/main/java/org/sparta/springwebutils/ManifestUtils.java#L84-L106
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/transform/SubGraphPredicate.java
SubGraphPredicate.withInputMatching
public SubGraphPredicate withInputMatching(int inputNum, @NonNull OpPredicate opPredicate) { """ Require the subgraph to match the specified predicate for the specified input.<br> Note that this does NOT add the specified input to part of the subgraph<br> i.e., the subgraph matches if the input matches the predicate, but when returning the SubGraph itself, the function for this input is not added to the SubGraph @param inputNum Input number @param opPredicate Predicate that the input must match @return This predicate with the additional requirement added """ opInputMatchPredicates.put(inputNum, opPredicate); return this; }
java
public SubGraphPredicate withInputMatching(int inputNum, @NonNull OpPredicate opPredicate){ opInputMatchPredicates.put(inputNum, opPredicate); return this; }
[ "public", "SubGraphPredicate", "withInputMatching", "(", "int", "inputNum", ",", "@", "NonNull", "OpPredicate", "opPredicate", ")", "{", "opInputMatchPredicates", ".", "put", "(", "inputNum", ",", "opPredicate", ")", ";", "return", "this", ";", "}" ]
Require the subgraph to match the specified predicate for the specified input.<br> Note that this does NOT add the specified input to part of the subgraph<br> i.e., the subgraph matches if the input matches the predicate, but when returning the SubGraph itself, the function for this input is not added to the SubGraph @param inputNum Input number @param opPredicate Predicate that the input must match @return This predicate with the additional requirement added
[ "Require", "the", "subgraph", "to", "match", "the", "specified", "predicate", "for", "the", "specified", "input", ".", "<br", ">", "Note", "that", "this", "does", "NOT", "add", "the", "specified", "input", "to", "part", "of", "the", "subgraph<br", ">", "i", ".", "e", ".", "the", "subgraph", "matches", "if", "the", "input", "matches", "the", "predicate", "but", "when", "returning", "the", "SubGraph", "itself", "the", "function", "for", "this", "input", "is", "not", "added", "to", "the", "SubGraph" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/autodiff/samediff/transform/SubGraphPredicate.java#L163-L166
haraldk/TwelveMonkeys
servlet/src/main/java/com/twelvemonkeys/servlet/image/ContentNegotiationFilter.java
ContentNegotiationFilter.adjustQuality
private static void adjustQuality(Map<String, Float> pFormatQuality, String pFormat, float pFactor) { """ Updates the quality in the map. @param pFormatQuality Map<String,Float> @param pFormat the format @param pFactor the quality factor """ Float oldValue = pFormatQuality.get(pFormat); if (oldValue != null) { pFormatQuality.put(pFormat, oldValue * pFactor); //System.out.println("New vallue after multiplying with " + pFactor + " is " + pFormatQuality.get(pFormat)); } }
java
private static void adjustQuality(Map<String, Float> pFormatQuality, String pFormat, float pFactor) { Float oldValue = pFormatQuality.get(pFormat); if (oldValue != null) { pFormatQuality.put(pFormat, oldValue * pFactor); //System.out.println("New vallue after multiplying with " + pFactor + " is " + pFormatQuality.get(pFormat)); } }
[ "private", "static", "void", "adjustQuality", "(", "Map", "<", "String", ",", "Float", ">", "pFormatQuality", ",", "String", "pFormat", ",", "float", "pFactor", ")", "{", "Float", "oldValue", "=", "pFormatQuality", ".", "get", "(", "pFormat", ")", ";", "if", "(", "oldValue", "!=", "null", ")", "{", "pFormatQuality", ".", "put", "(", "pFormat", ",", "oldValue", "*", "pFactor", ")", ";", "//System.out.println(\"New vallue after multiplying with \" + pFactor + \" is \" + pFormatQuality.get(pFormat));\r", "}", "}" ]
Updates the quality in the map. @param pFormatQuality Map<String,Float> @param pFormat the format @param pFactor the quality factor
[ "Updates", "the", "quality", "in", "the", "map", "." ]
train
https://github.com/haraldk/TwelveMonkeys/blob/7fad4d5cd8cb3a6728c7fd3f28a7b84d8ce0101d/servlet/src/main/java/com/twelvemonkeys/servlet/image/ContentNegotiationFilter.java#L419-L425
apache/groovy
src/main/java/org/codehaus/groovy/runtime/ProcessGroovyMethods.java
ProcessGroovyMethods.waitForOrKill
public static void waitForOrKill(Process self, long numberOfMillis) { """ Wait for the process to finish during a certain amount of time, otherwise stops the process. @param self a Process @param numberOfMillis the number of milliseconds to wait before stopping the process @since 1.0 """ ProcessRunner runnable = new ProcessRunner(self); Thread thread = new Thread(runnable); thread.start(); runnable.waitForOrKill(numberOfMillis); }
java
public static void waitForOrKill(Process self, long numberOfMillis) { ProcessRunner runnable = new ProcessRunner(self); Thread thread = new Thread(runnable); thread.start(); runnable.waitForOrKill(numberOfMillis); }
[ "public", "static", "void", "waitForOrKill", "(", "Process", "self", ",", "long", "numberOfMillis", ")", "{", "ProcessRunner", "runnable", "=", "new", "ProcessRunner", "(", "self", ")", ";", "Thread", "thread", "=", "new", "Thread", "(", "runnable", ")", ";", "thread", ".", "start", "(", ")", ";", "runnable", ".", "waitForOrKill", "(", "numberOfMillis", ")", ";", "}" ]
Wait for the process to finish during a certain amount of time, otherwise stops the process. @param self a Process @param numberOfMillis the number of milliseconds to wait before stopping the process @since 1.0
[ "Wait", "for", "the", "process", "to", "finish", "during", "a", "certain", "amount", "of", "time", "otherwise", "stops", "the", "process", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/runtime/ProcessGroovyMethods.java#L139-L144
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemElement.java
ElemElement.callChildVisitors
protected void callChildVisitors(XSLTVisitor visitor, boolean callAttrs) { """ Call the children visitors. @param visitor The visitor whose appropriate method will be called. """ if(callAttrs) { if(null != m_name_avt) m_name_avt.callVisitors(visitor); if(null != m_namespace_avt) m_namespace_avt.callVisitors(visitor); } super.callChildVisitors(visitor, callAttrs); }
java
protected void callChildVisitors(XSLTVisitor visitor, boolean callAttrs) { if(callAttrs) { if(null != m_name_avt) m_name_avt.callVisitors(visitor); if(null != m_namespace_avt) m_namespace_avt.callVisitors(visitor); } super.callChildVisitors(visitor, callAttrs); }
[ "protected", "void", "callChildVisitors", "(", "XSLTVisitor", "visitor", ",", "boolean", "callAttrs", ")", "{", "if", "(", "callAttrs", ")", "{", "if", "(", "null", "!=", "m_name_avt", ")", "m_name_avt", ".", "callVisitors", "(", "visitor", ")", ";", "if", "(", "null", "!=", "m_namespace_avt", ")", "m_namespace_avt", ".", "callVisitors", "(", "visitor", ")", ";", "}", "super", ".", "callChildVisitors", "(", "visitor", ",", "callAttrs", ")", ";", "}" ]
Call the children visitors. @param visitor The visitor whose appropriate method will be called.
[ "Call", "the", "children", "visitors", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemElement.java#L358-L370
adorsys/hbci4java-adorsys
src/main/java/org/kapott/hbci/manager/HBCIJobFactory.java
HBCIJobFactory.newJob
public static AbstractHBCIJob newJob(String jobname, HBCIPassportInternal passport) { """ <p>Erzeugen eines neuen Highlevel-HBCI-Jobs. Diese Methode gibt ein neues Job-Objekt zurück. Dieses Objekt wird allerdings noch <em>nicht</em> zum HBCI-Dialog hinzugefügt. Statt dessen müssen erst alle zur Beschreibung des jeweiligen Jobs benötigten Parameter gesetzt werden. <p>Eine Beschreibung aller unterstützten Geschäftsvorfälle befindet sich im Package <code>org.kapott.hbci.GV</code>.</p> @param jobname der Name des Jobs, der erzeugt werden soll. Gültige Job-Namen sowie die benötigten Parameter sind in der Beschreibung des Packages <code>org.kapott.hbci.GV</code> zu finden. @return ein Job-Objekt, für das die entsprechenden Job-Parameter gesetzt werden müssen und welches anschließend zum HBCI-Dialog hinzugefügt werden kann. """ log.debug("creating new job " + jobname); if (jobname == null || jobname.length() == 0) throw new InvalidArgumentException(HBCIUtils.getLocMsg("EXCMSG_EMPTY_JOBNAME")); AbstractHBCIJob ret = null; String className = "org.kapott.hbci.GV.GV" + jobname; try { Class cl = Class.forName(className); Constructor cons = cl.getConstructor(HBCIPassportInternal.class); ret = (AbstractHBCIJob) cons.newInstance(new Object[]{passport}); } catch (ClassNotFoundException e) { throw new InvalidUserDataException("*** there is no highlevel job named " + jobname + " - need class " + className); } catch (Exception e) { String msg = HBCIUtils.getLocMsg("EXCMSG_JOB_CREATE_ERR", jobname); throw new HBCI_Exception(msg, e); } return ret; }
java
public static AbstractHBCIJob newJob(String jobname, HBCIPassportInternal passport) { log.debug("creating new job " + jobname); if (jobname == null || jobname.length() == 0) throw new InvalidArgumentException(HBCIUtils.getLocMsg("EXCMSG_EMPTY_JOBNAME")); AbstractHBCIJob ret = null; String className = "org.kapott.hbci.GV.GV" + jobname; try { Class cl = Class.forName(className); Constructor cons = cl.getConstructor(HBCIPassportInternal.class); ret = (AbstractHBCIJob) cons.newInstance(new Object[]{passport}); } catch (ClassNotFoundException e) { throw new InvalidUserDataException("*** there is no highlevel job named " + jobname + " - need class " + className); } catch (Exception e) { String msg = HBCIUtils.getLocMsg("EXCMSG_JOB_CREATE_ERR", jobname); throw new HBCI_Exception(msg, e); } return ret; }
[ "public", "static", "AbstractHBCIJob", "newJob", "(", "String", "jobname", ",", "HBCIPassportInternal", "passport", ")", "{", "log", ".", "debug", "(", "\"creating new job \"", "+", "jobname", ")", ";", "if", "(", "jobname", "==", "null", "||", "jobname", ".", "length", "(", ")", "==", "0", ")", "throw", "new", "InvalidArgumentException", "(", "HBCIUtils", ".", "getLocMsg", "(", "\"EXCMSG_EMPTY_JOBNAME\"", ")", ")", ";", "AbstractHBCIJob", "ret", "=", "null", ";", "String", "className", "=", "\"org.kapott.hbci.GV.GV\"", "+", "jobname", ";", "try", "{", "Class", "cl", "=", "Class", ".", "forName", "(", "className", ")", ";", "Constructor", "cons", "=", "cl", ".", "getConstructor", "(", "HBCIPassportInternal", ".", "class", ")", ";", "ret", "=", "(", "AbstractHBCIJob", ")", "cons", ".", "newInstance", "(", "new", "Object", "[", "]", "{", "passport", "}", ")", ";", "}", "catch", "(", "ClassNotFoundException", "e", ")", "{", "throw", "new", "InvalidUserDataException", "(", "\"*** there is no highlevel job named \"", "+", "jobname", "+", "\" - need class \"", "+", "className", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "String", "msg", "=", "HBCIUtils", ".", "getLocMsg", "(", "\"EXCMSG_JOB_CREATE_ERR\"", ",", "jobname", ")", ";", "throw", "new", "HBCI_Exception", "(", "msg", ",", "e", ")", ";", "}", "return", "ret", ";", "}" ]
<p>Erzeugen eines neuen Highlevel-HBCI-Jobs. Diese Methode gibt ein neues Job-Objekt zurück. Dieses Objekt wird allerdings noch <em>nicht</em> zum HBCI-Dialog hinzugefügt. Statt dessen müssen erst alle zur Beschreibung des jeweiligen Jobs benötigten Parameter gesetzt werden. <p>Eine Beschreibung aller unterstützten Geschäftsvorfälle befindet sich im Package <code>org.kapott.hbci.GV</code>.</p> @param jobname der Name des Jobs, der erzeugt werden soll. Gültige Job-Namen sowie die benötigten Parameter sind in der Beschreibung des Packages <code>org.kapott.hbci.GV</code> zu finden. @return ein Job-Objekt, für das die entsprechenden Job-Parameter gesetzt werden müssen und welches anschließend zum HBCI-Dialog hinzugefügt werden kann.
[ "<p", ">", "Erzeugen", "eines", "neuen", "Highlevel", "-", "HBCI", "-", "Jobs", ".", "Diese", "Methode", "gibt", "ein", "neues", "Job", "-", "Objekt", "zurück", ".", "Dieses", "Objekt", "wird", "allerdings", "noch", "<em", ">", "nicht<", "/", "em", ">", "zum", "HBCI", "-", "Dialog", "hinzugefügt", ".", "Statt", "dessen", "müssen", "erst", "alle", "zur", "Beschreibung", "des", "jeweiligen", "Jobs", "benötigten", "Parameter", "gesetzt", "werden", ".", "<p", ">", "Eine", "Beschreibung", "aller", "unterstützten", "Geschäftsvorfälle", "befindet", "sich", "im", "Package", "<code", ">", "org", ".", "kapott", ".", "hbci", ".", "GV<", "/", "code", ">", ".", "<", "/", "p", ">" ]
train
https://github.com/adorsys/hbci4java-adorsys/blob/5e24f7e429d6b555e1d993196b4cf1adda6433cf/src/main/java/org/kapott/hbci/manager/HBCIJobFactory.java#L28-L49
elki-project/elki
elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/ids/DBIDUtil.java
DBIDUtil.randomShuffle
public static void randomShuffle(ArrayModifiableDBIDs ids, Random random, final int limit) { """ Produce a random shuffling of the given DBID array. Only the first {@code limit} elements will be fully randomized, but the remaining objects will also be changed. @param ids Original DBIDs, no duplicates allowed @param random Random generator @param limit Shuffling limit. """ final int end = ids.size(); for(int i = 1; i < limit; i++) { ids.swap(i - 1, i + random.nextInt(end - i)); } }
java
public static void randomShuffle(ArrayModifiableDBIDs ids, Random random, final int limit) { final int end = ids.size(); for(int i = 1; i < limit; i++) { ids.swap(i - 1, i + random.nextInt(end - i)); } }
[ "public", "static", "void", "randomShuffle", "(", "ArrayModifiableDBIDs", "ids", ",", "Random", "random", ",", "final", "int", "limit", ")", "{", "final", "int", "end", "=", "ids", ".", "size", "(", ")", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "limit", ";", "i", "++", ")", "{", "ids", ".", "swap", "(", "i", "-", "1", ",", "i", "+", "random", ".", "nextInt", "(", "end", "-", "i", ")", ")", ";", "}", "}" ]
Produce a random shuffling of the given DBID array. Only the first {@code limit} elements will be fully randomized, but the remaining objects will also be changed. @param ids Original DBIDs, no duplicates allowed @param random Random generator @param limit Shuffling limit.
[ "Produce", "a", "random", "shuffling", "of", "the", "given", "DBID", "array", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-dbids/src/main/java/de/lmu/ifi/dbs/elki/database/ids/DBIDUtil.java#L534-L539
katharsis-project/katharsis-framework
katharsis-core/src/main/java/io/katharsis/core/internal/registry/ResourceRegistryImpl.java
ResourceRegistryImpl.findEntry
public RegistryEntry findEntry(String searchType, Class<?> clazz) { """ Searches the registry for a resource identified by, 1) JSON API resource type. 2) JSON API resource class. <p> If a resource cannot be found, {@link ResourceNotFoundInitializationException} is thrown. @param searchType resource type @param clazz resource type @return registry entry @throws ResourceNotFoundInitializationException if resource is not found """ RegistryEntry entry = getEntry(searchType); if (entry == null) { return getEntry(clazz, false); } return entry; }
java
public RegistryEntry findEntry(String searchType, Class<?> clazz) { RegistryEntry entry = getEntry(searchType); if (entry == null) { return getEntry(clazz, false); } return entry; }
[ "public", "RegistryEntry", "findEntry", "(", "String", "searchType", ",", "Class", "<", "?", ">", "clazz", ")", "{", "RegistryEntry", "entry", "=", "getEntry", "(", "searchType", ")", ";", "if", "(", "entry", "==", "null", ")", "{", "return", "getEntry", "(", "clazz", ",", "false", ")", ";", "}", "return", "entry", ";", "}" ]
Searches the registry for a resource identified by, 1) JSON API resource type. 2) JSON API resource class. <p> If a resource cannot be found, {@link ResourceNotFoundInitializationException} is thrown. @param searchType resource type @param clazz resource type @return registry entry @throws ResourceNotFoundInitializationException if resource is not found
[ "Searches", "the", "registry", "for", "a", "resource", "identified", "by", "1", ")", "JSON", "API", "resource", "type", ".", "2", ")", "JSON", "API", "resource", "class", ".", "<p", ">", "If", "a", "resource", "cannot", "be", "found", "{", "@link", "ResourceNotFoundInitializationException", "}", "is", "thrown", "." ]
train
https://github.com/katharsis-project/katharsis-framework/blob/73d1a8763c49c5cf4643d43e2dbfedb647630c46/katharsis-core/src/main/java/io/katharsis/core/internal/registry/ResourceRegistryImpl.java#L88-L94
gallandarakhneorg/afc
advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java
GISCoordinates.L3_WSG84
@Pure public static GeodesicPosition L3_WSG84(double x, double y) { """ This function convert France Lambert III coordinate to geographic WSG84 Data. @param x is the coordinate in France Lambert III @param y is the coordinate in France Lambert III @return lambda and phi in geographic WSG84 in degrees. """ final Point2d ntfLambdaPhi = NTFLambert_NTFLambdaPhi(x, y, LAMBERT_3_N, LAMBERT_3_C, LAMBERT_3_XS, LAMBERT_3_YS); return NTFLambdaPhi_WSG84(ntfLambdaPhi.getX(), ntfLambdaPhi.getY()); }
java
@Pure public static GeodesicPosition L3_WSG84(double x, double y) { final Point2d ntfLambdaPhi = NTFLambert_NTFLambdaPhi(x, y, LAMBERT_3_N, LAMBERT_3_C, LAMBERT_3_XS, LAMBERT_3_YS); return NTFLambdaPhi_WSG84(ntfLambdaPhi.getX(), ntfLambdaPhi.getY()); }
[ "@", "Pure", "public", "static", "GeodesicPosition", "L3_WSG84", "(", "double", "x", ",", "double", "y", ")", "{", "final", "Point2d", "ntfLambdaPhi", "=", "NTFLambert_NTFLambdaPhi", "(", "x", ",", "y", ",", "LAMBERT_3_N", ",", "LAMBERT_3_C", ",", "LAMBERT_3_XS", ",", "LAMBERT_3_YS", ")", ";", "return", "NTFLambdaPhi_WSG84", "(", "ntfLambdaPhi", ".", "getX", "(", ")", ",", "ntfLambdaPhi", ".", "getY", "(", ")", ")", ";", "}" ]
This function convert France Lambert III coordinate to geographic WSG84 Data. @param x is the coordinate in France Lambert III @param y is the coordinate in France Lambert III @return lambda and phi in geographic WSG84 in degrees.
[ "This", "function", "convert", "France", "Lambert", "III", "coordinate", "to", "geographic", "WSG84", "Data", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java#L541-L549
Netflix/astyanax
astyanax-cql/src/main/java/com/netflix/astyanax/cql/reads/QueryGenCache.java
QueryGenCache.getPreparedStatement
public PreparedStatement getPreparedStatement(Q query, boolean useCaching) { """ Get the bound statemnent by either constructing the query or using the cached statement underneath. Note that the caller can provide useCaching as a knob to turn caching ON/OFF. If false, then the query is just constructed using the extending class and returned. If true, then the cached reference is consulted. If the cache is empty, then the query is constructed and used to seed the cache. @param query @param useCaching @return PreparedStatement """ PreparedStatement pStatement = null; if (useCaching) { pStatement = cachedStatement.get(); } if (pStatement == null) { try { RegularStatement stmt = getQueryGen(query).call(); if (LOG.isDebugEnabled()) { LOG.debug("Query: " + stmt.getQueryString()); } pStatement = sessionRef.get().prepare(stmt.getQueryString()); } catch (Exception e) { throw new RuntimeException(e); } } if (useCaching && cachedStatement.get() == null) { cachedStatement.set(pStatement); } return pStatement; }
java
public PreparedStatement getPreparedStatement(Q query, boolean useCaching) { PreparedStatement pStatement = null; if (useCaching) { pStatement = cachedStatement.get(); } if (pStatement == null) { try { RegularStatement stmt = getQueryGen(query).call(); if (LOG.isDebugEnabled()) { LOG.debug("Query: " + stmt.getQueryString()); } pStatement = sessionRef.get().prepare(stmt.getQueryString()); } catch (Exception e) { throw new RuntimeException(e); } } if (useCaching && cachedStatement.get() == null) { cachedStatement.set(pStatement); } return pStatement; }
[ "public", "PreparedStatement", "getPreparedStatement", "(", "Q", "query", ",", "boolean", "useCaching", ")", "{", "PreparedStatement", "pStatement", "=", "null", ";", "if", "(", "useCaching", ")", "{", "pStatement", "=", "cachedStatement", ".", "get", "(", ")", ";", "}", "if", "(", "pStatement", "==", "null", ")", "{", "try", "{", "RegularStatement", "stmt", "=", "getQueryGen", "(", "query", ")", ".", "call", "(", ")", ";", "if", "(", "LOG", ".", "isDebugEnabled", "(", ")", ")", "{", "LOG", ".", "debug", "(", "\"Query: \"", "+", "stmt", ".", "getQueryString", "(", ")", ")", ";", "}", "pStatement", "=", "sessionRef", ".", "get", "(", ")", ".", "prepare", "(", "stmt", ".", "getQueryString", "(", ")", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "RuntimeException", "(", "e", ")", ";", "}", "}", "if", "(", "useCaching", "&&", "cachedStatement", ".", "get", "(", ")", "==", "null", ")", "{", "cachedStatement", ".", "set", "(", "pStatement", ")", ";", "}", "return", "pStatement", ";", "}" ]
Get the bound statemnent by either constructing the query or using the cached statement underneath. Note that the caller can provide useCaching as a knob to turn caching ON/OFF. If false, then the query is just constructed using the extending class and returned. If true, then the cached reference is consulted. If the cache is empty, then the query is constructed and used to seed the cache. @param query @param useCaching @return PreparedStatement
[ "Get", "the", "bound", "statemnent", "by", "either", "constructing", "the", "query", "or", "using", "the", "cached", "statement", "underneath", ".", "Note", "that", "the", "caller", "can", "provide", "useCaching", "as", "a", "knob", "to", "turn", "caching", "ON", "/", "OFF", ".", "If", "false", "then", "the", "query", "is", "just", "constructed", "using", "the", "extending", "class", "and", "returned", ".", "If", "true", "then", "the", "cached", "reference", "is", "consulted", ".", "If", "the", "cache", "is", "empty", "then", "the", "query", "is", "constructed", "and", "used", "to", "seed", "the", "cache", "." ]
train
https://github.com/Netflix/astyanax/blob/bcc3fd26e2dda05a923751aa32b139f6209fecdf/astyanax-cql/src/main/java/com/netflix/astyanax/cql/reads/QueryGenCache.java#L79-L103
OpenTSDB/opentsdb
src/tsd/HttpSerializer.java
HttpSerializer.formatQueryStatsV1
public ChannelBuffer formatQueryStatsV1(final Map<String, Object> query_stats) { """ Format the query stats @param query_stats Map of query statistics @return A ChannelBuffer object to pass on to the caller @throws BadRequestException if the plugin has not implemented this method @since 2.2 """ throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED, "The requested API endpoint has not been implemented", this.getClass().getCanonicalName() + " has not implemented formatQueryStatsV1"); }
java
public ChannelBuffer formatQueryStatsV1(final Map<String, Object> query_stats) { throw new BadRequestException(HttpResponseStatus.NOT_IMPLEMENTED, "The requested API endpoint has not been implemented", this.getClass().getCanonicalName() + " has not implemented formatQueryStatsV1"); }
[ "public", "ChannelBuffer", "formatQueryStatsV1", "(", "final", "Map", "<", "String", ",", "Object", ">", "query_stats", ")", "{", "throw", "new", "BadRequestException", "(", "HttpResponseStatus", ".", "NOT_IMPLEMENTED", ",", "\"The requested API endpoint has not been implemented\"", ",", "this", ".", "getClass", "(", ")", ".", "getCanonicalName", "(", ")", "+", "\" has not implemented formatQueryStatsV1\"", ")", ";", "}" ]
Format the query stats @param query_stats Map of query statistics @return A ChannelBuffer object to pass on to the caller @throws BadRequestException if the plugin has not implemented this method @since 2.2
[ "Format", "the", "query", "stats" ]
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tsd/HttpSerializer.java#L768-L773
geomajas/geomajas-project-client-gwt2
common-gwt/command/src/main/java/org/geomajas/gwt/client/command/GwtCommandDispatcher.java
GwtCommandDispatcher.handleLogin
private void handleLogin(GwtCommand command, Deferred deferred) { """ Method which forces retry of a command after login. <p/> This method assumes the single threaded nature of JavaScript execution for correctness. @param command command which needs to be retried @param deferred callbacks for the command """ final String oldToken = notNull(command.getUserToken()); if (!afterLoginCommands.containsKey(oldToken)) { afterLoginCommands.put(oldToken, new ArrayList<RetryCommand>()); login(oldToken); } afterLogin(command, deferred); }
java
private void handleLogin(GwtCommand command, Deferred deferred) { final String oldToken = notNull(command.getUserToken()); if (!afterLoginCommands.containsKey(oldToken)) { afterLoginCommands.put(oldToken, new ArrayList<RetryCommand>()); login(oldToken); } afterLogin(command, deferred); }
[ "private", "void", "handleLogin", "(", "GwtCommand", "command", ",", "Deferred", "deferred", ")", "{", "final", "String", "oldToken", "=", "notNull", "(", "command", ".", "getUserToken", "(", ")", ")", ";", "if", "(", "!", "afterLoginCommands", ".", "containsKey", "(", "oldToken", ")", ")", "{", "afterLoginCommands", ".", "put", "(", "oldToken", ",", "new", "ArrayList", "<", "RetryCommand", ">", "(", ")", ")", ";", "login", "(", "oldToken", ")", ";", "}", "afterLogin", "(", "command", ",", "deferred", ")", ";", "}" ]
Method which forces retry of a command after login. <p/> This method assumes the single threaded nature of JavaScript execution for correctness. @param command command which needs to be retried @param deferred callbacks for the command
[ "Method", "which", "forces", "retry", "of", "a", "command", "after", "login", ".", "<p", "/", ">", "This", "method", "assumes", "the", "single", "threaded", "nature", "of", "JavaScript", "execution", "for", "correctness", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/common-gwt/command/src/main/java/org/geomajas/gwt/client/command/GwtCommandDispatcher.java#L315-L322
VoltDB/voltdb
src/frontend/org/voltcore/messaging/HostMessenger.java
HostMessenger.waitForJoiningHostsToBeReady
public void waitForJoiningHostsToBeReady(int expectedHosts, int localHostId) { """ For elastic join. Block on this call until the number of ready hosts is equal to the number of expected joining hosts. """ try { //register this host as joining. The host registration will be deleted after joining is completed. m_zk.create(ZKUtil.joinZKPath(CoreZK.readyjoininghosts, Integer.toString(localHostId)) , null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); while (true) { ZKUtil.FutureWatcher fw = new ZKUtil.FutureWatcher(); int readyHosts = m_zk.getChildren(CoreZK.readyjoininghosts, fw).size(); if ( readyHosts == expectedHosts) { break; } fw.get(); } } catch (KeeperException | InterruptedException e) { org.voltdb.VoltDB.crashLocalVoltDB("Error waiting for hosts to be ready", false, e); } }
java
public void waitForJoiningHostsToBeReady(int expectedHosts, int localHostId) { try { //register this host as joining. The host registration will be deleted after joining is completed. m_zk.create(ZKUtil.joinZKPath(CoreZK.readyjoininghosts, Integer.toString(localHostId)) , null, Ids.OPEN_ACL_UNSAFE, CreateMode.PERSISTENT); while (true) { ZKUtil.FutureWatcher fw = new ZKUtil.FutureWatcher(); int readyHosts = m_zk.getChildren(CoreZK.readyjoininghosts, fw).size(); if ( readyHosts == expectedHosts) { break; } fw.get(); } } catch (KeeperException | InterruptedException e) { org.voltdb.VoltDB.crashLocalVoltDB("Error waiting for hosts to be ready", false, e); } }
[ "public", "void", "waitForJoiningHostsToBeReady", "(", "int", "expectedHosts", ",", "int", "localHostId", ")", "{", "try", "{", "//register this host as joining. The host registration will be deleted after joining is completed.", "m_zk", ".", "create", "(", "ZKUtil", ".", "joinZKPath", "(", "CoreZK", ".", "readyjoininghosts", ",", "Integer", ".", "toString", "(", "localHostId", ")", ")", ",", "null", ",", "Ids", ".", "OPEN_ACL_UNSAFE", ",", "CreateMode", ".", "PERSISTENT", ")", ";", "while", "(", "true", ")", "{", "ZKUtil", ".", "FutureWatcher", "fw", "=", "new", "ZKUtil", ".", "FutureWatcher", "(", ")", ";", "int", "readyHosts", "=", "m_zk", ".", "getChildren", "(", "CoreZK", ".", "readyjoininghosts", ",", "fw", ")", ".", "size", "(", ")", ";", "if", "(", "readyHosts", "==", "expectedHosts", ")", "{", "break", ";", "}", "fw", ".", "get", "(", ")", ";", "}", "}", "catch", "(", "KeeperException", "|", "InterruptedException", "e", ")", "{", "org", ".", "voltdb", ".", "VoltDB", ".", "crashLocalVoltDB", "(", "\"Error waiting for hosts to be ready\"", ",", "false", ",", "e", ")", ";", "}", "}" ]
For elastic join. Block on this call until the number of ready hosts is equal to the number of expected joining hosts.
[ "For", "elastic", "join", ".", "Block", "on", "this", "call", "until", "the", "number", "of", "ready", "hosts", "is", "equal", "to", "the", "number", "of", "expected", "joining", "hosts", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltcore/messaging/HostMessenger.java#L1675-L1690
TheHortonMachine/hortonmachine
gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/DxfUtils.java
DxfUtils.feature2Dxf
public static String feature2Dxf( FeatureMate featureMate, String layerName, String elevationAttrName, boolean suffix, boolean force2CoordsToLine ) { """ Write a {@link SimpleFeature} to dxf string. @param featureMate the feature to convert. @param layerName the layer name in case none is in the attributes. @param elevationAttrName the attribute defining elevation or <code>null</code>. @param suffix <code>true</code> if suffix is needed. @param force2CoordsToLine if <code>true</code>, lines that are composed of just 2 coordinates will be handled as LINE instead of the default which is POLYLINE. @return the string representation. """ Geometry g = featureMate.getGeometry(); if (EGeometryType.isPoint(g)) { return point2Dxf(featureMate, layerName, elevationAttrName); } else if (EGeometryType.isLine(g)) { return lineString2Dxf(featureMate, layerName, elevationAttrName, force2CoordsToLine); } else if (EGeometryType.isPolygon(g)) { return polygon2Dxf(featureMate, layerName, elevationAttrName, suffix); } else if (g instanceof GeometryCollection) { StringBuilder sb = new StringBuilder(); for( int i = 0; i < g.getNumGeometries(); i++ ) { SimpleFeature ff = SimpleFeatureBuilder.copy(featureMate.getFeature()); ff.setDefaultGeometry(g.getGeometryN(i)); FeatureMate fm = new FeatureMate(ff); sb.append(feature2Dxf(fm, layerName, elevationAttrName, suffix, force2CoordsToLine)); } return sb.toString(); } else { return null; } }
java
public static String feature2Dxf( FeatureMate featureMate, String layerName, String elevationAttrName, boolean suffix, boolean force2CoordsToLine ) { Geometry g = featureMate.getGeometry(); if (EGeometryType.isPoint(g)) { return point2Dxf(featureMate, layerName, elevationAttrName); } else if (EGeometryType.isLine(g)) { return lineString2Dxf(featureMate, layerName, elevationAttrName, force2CoordsToLine); } else if (EGeometryType.isPolygon(g)) { return polygon2Dxf(featureMate, layerName, elevationAttrName, suffix); } else if (g instanceof GeometryCollection) { StringBuilder sb = new StringBuilder(); for( int i = 0; i < g.getNumGeometries(); i++ ) { SimpleFeature ff = SimpleFeatureBuilder.copy(featureMate.getFeature()); ff.setDefaultGeometry(g.getGeometryN(i)); FeatureMate fm = new FeatureMate(ff); sb.append(feature2Dxf(fm, layerName, elevationAttrName, suffix, force2CoordsToLine)); } return sb.toString(); } else { return null; } }
[ "public", "static", "String", "feature2Dxf", "(", "FeatureMate", "featureMate", ",", "String", "layerName", ",", "String", "elevationAttrName", ",", "boolean", "suffix", ",", "boolean", "force2CoordsToLine", ")", "{", "Geometry", "g", "=", "featureMate", ".", "getGeometry", "(", ")", ";", "if", "(", "EGeometryType", ".", "isPoint", "(", "g", ")", ")", "{", "return", "point2Dxf", "(", "featureMate", ",", "layerName", ",", "elevationAttrName", ")", ";", "}", "else", "if", "(", "EGeometryType", ".", "isLine", "(", "g", ")", ")", "{", "return", "lineString2Dxf", "(", "featureMate", ",", "layerName", ",", "elevationAttrName", ",", "force2CoordsToLine", ")", ";", "}", "else", "if", "(", "EGeometryType", ".", "isPolygon", "(", "g", ")", ")", "{", "return", "polygon2Dxf", "(", "featureMate", ",", "layerName", ",", "elevationAttrName", ",", "suffix", ")", ";", "}", "else", "if", "(", "g", "instanceof", "GeometryCollection", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "g", ".", "getNumGeometries", "(", ")", ";", "i", "++", ")", "{", "SimpleFeature", "ff", "=", "SimpleFeatureBuilder", ".", "copy", "(", "featureMate", ".", "getFeature", "(", ")", ")", ";", "ff", ".", "setDefaultGeometry", "(", "g", ".", "getGeometryN", "(", "i", ")", ")", ";", "FeatureMate", "fm", "=", "new", "FeatureMate", "(", "ff", ")", ";", "sb", ".", "append", "(", "feature2Dxf", "(", "fm", ",", "layerName", ",", "elevationAttrName", ",", "suffix", ",", "force2CoordsToLine", ")", ")", ";", "}", "return", "sb", ".", "toString", "(", ")", ";", "}", "else", "{", "return", "null", ";", "}", "}" ]
Write a {@link SimpleFeature} to dxf string. @param featureMate the feature to convert. @param layerName the layer name in case none is in the attributes. @param elevationAttrName the attribute defining elevation or <code>null</code>. @param suffix <code>true</code> if suffix is needed. @param force2CoordsToLine if <code>true</code>, lines that are composed of just 2 coordinates will be handled as LINE instead of the default which is POLYLINE. @return the string representation.
[ "Write", "a", "{", "@link", "SimpleFeature", "}", "to", "dxf", "string", "." ]
train
https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/DxfUtils.java#L74-L96
wdullaer/MaterialDateTimePicker
library/src/main/java/com/wdullaer/materialdatetimepicker/Utils.java
Utils.tryAccessibilityAnnounce
public static void tryAccessibilityAnnounce(View view, CharSequence text) { """ Try to speak the specified text, for accessibility. Only available on JB or later. @param text Text to announce. """ if (view != null && text != null) { view.announceForAccessibility(text); } }
java
public static void tryAccessibilityAnnounce(View view, CharSequence text) { if (view != null && text != null) { view.announceForAccessibility(text); } }
[ "public", "static", "void", "tryAccessibilityAnnounce", "(", "View", "view", ",", "CharSequence", "text", ")", "{", "if", "(", "view", "!=", "null", "&&", "text", "!=", "null", ")", "{", "view", ".", "announceForAccessibility", "(", "text", ")", ";", "}", "}" ]
Try to speak the specified text, for accessibility. Only available on JB or later. @param text Text to announce.
[ "Try", "to", "speak", "the", "specified", "text", "for", "accessibility", ".", "Only", "available", "on", "JB", "or", "later", "." ]
train
https://github.com/wdullaer/MaterialDateTimePicker/blob/0a8fe28f19db4f5a5a6cfc525a852416232873a8/library/src/main/java/com/wdullaer/materialdatetimepicker/Utils.java#L53-L57
bazaarvoice/emodb
event/src/main/java/com/bazaarvoice/emodb/event/dedup/DefaultDedupEventStore.java
DefaultDedupEventStore.getQueueReadOnly
private SortedQueue getQueueReadOnly(String queueName, Duration waitDuration) { """ Returns the persistent sorted queue managed by this JVM, or a stub that supports only read-only operations if not managed by this JVM. """ DedupQueue service = getQueueReadWrite(queueName, waitDuration); if (service != null) { try { return service.getQueue(); } catch (ReadOnlyQueueException e) { // Fall through } } return _sortedQueueFactory.create(queueName, true, _queueDAO); }
java
private SortedQueue getQueueReadOnly(String queueName, Duration waitDuration) { DedupQueue service = getQueueReadWrite(queueName, waitDuration); if (service != null) { try { return service.getQueue(); } catch (ReadOnlyQueueException e) { // Fall through } } return _sortedQueueFactory.create(queueName, true, _queueDAO); }
[ "private", "SortedQueue", "getQueueReadOnly", "(", "String", "queueName", ",", "Duration", "waitDuration", ")", "{", "DedupQueue", "service", "=", "getQueueReadWrite", "(", "queueName", ",", "waitDuration", ")", ";", "if", "(", "service", "!=", "null", ")", "{", "try", "{", "return", "service", ".", "getQueue", "(", ")", ";", "}", "catch", "(", "ReadOnlyQueueException", "e", ")", "{", "// Fall through", "}", "}", "return", "_sortedQueueFactory", ".", "create", "(", "queueName", ",", "true", ",", "_queueDAO", ")", ";", "}" ]
Returns the persistent sorted queue managed by this JVM, or a stub that supports only read-only operations if not managed by this JVM.
[ "Returns", "the", "persistent", "sorted", "queue", "managed", "by", "this", "JVM", "or", "a", "stub", "that", "supports", "only", "read", "-", "only", "operations", "if", "not", "managed", "by", "this", "JVM", "." ]
train
https://github.com/bazaarvoice/emodb/blob/97ec7671bc78b47fc2a1c11298c0c872bd5ec7fb/event/src/main/java/com/bazaarvoice/emodb/event/dedup/DefaultDedupEventStore.java#L171-L181
looly/hutool
hutool-core/src/main/java/cn/hutool/core/lang/Assert.java
Assert.isInstanceOf
public static <T> T isInstanceOf(Class<?> type, T obj, String errorMsgTemplate, Object... params) throws IllegalArgumentException { """ 断言给定对象是否是给定类的实例 <pre class="code"> Assert.instanceOf(Foo.class, foo); </pre> @param <T> 被检查对象泛型类型 @param type 被检查对象匹配的类型 @param obj 被检查对象 @param errorMsgTemplate 异常时的消息模板 @param params 参数列表 @return 被检查对象 @throws IllegalArgumentException if the object is not an instance of clazz @see Class#isInstance(Object) """ notNull(type, "Type to check against must not be null"); if (false == type.isInstance(obj)) { throw new IllegalArgumentException(StrUtil.format(errorMsgTemplate, params)); } return obj; }
java
public static <T> T isInstanceOf(Class<?> type, T obj, String errorMsgTemplate, Object... params) throws IllegalArgumentException { notNull(type, "Type to check against must not be null"); if (false == type.isInstance(obj)) { throw new IllegalArgumentException(StrUtil.format(errorMsgTemplate, params)); } return obj; }
[ "public", "static", "<", "T", ">", "T", "isInstanceOf", "(", "Class", "<", "?", ">", "type", ",", "T", "obj", ",", "String", "errorMsgTemplate", ",", "Object", "...", "params", ")", "throws", "IllegalArgumentException", "{", "notNull", "(", "type", ",", "\"Type to check against must not be null\"", ")", ";", "if", "(", "false", "==", "type", ".", "isInstance", "(", "obj", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "StrUtil", ".", "format", "(", "errorMsgTemplate", ",", "params", ")", ")", ";", "}", "return", "obj", ";", "}" ]
断言给定对象是否是给定类的实例 <pre class="code"> Assert.instanceOf(Foo.class, foo); </pre> @param <T> 被检查对象泛型类型 @param type 被检查对象匹配的类型 @param obj 被检查对象 @param errorMsgTemplate 异常时的消息模板 @param params 参数列表 @return 被检查对象 @throws IllegalArgumentException if the object is not an instance of clazz @see Class#isInstance(Object)
[ "断言给定对象是否是给定类的实例" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/lang/Assert.java#L449-L455
apache/incubator-gobblin
gobblin-modules/gobblin-compliance/src/main/java/org/apache/gobblin/compliance/purger/HivePurgerSource.java
HivePurgerSource.setJobWatermark
protected void setJobWatermark(SourceState state, String watermark) { """ Sets Job Watermark in the SourceState which will be copied to all WorkUnitStates. Job Watermark is a complete partition name. During next run of this job, fresh work units will be created starting from this partition. """ state.setProp(ComplianceConfigurationKeys.HIVE_PURGER_WATERMARK, watermark); log.info("Setting job watermark for the job: " + watermark); }
java
protected void setJobWatermark(SourceState state, String watermark) { state.setProp(ComplianceConfigurationKeys.HIVE_PURGER_WATERMARK, watermark); log.info("Setting job watermark for the job: " + watermark); }
[ "protected", "void", "setJobWatermark", "(", "SourceState", "state", ",", "String", "watermark", ")", "{", "state", ".", "setProp", "(", "ComplianceConfigurationKeys", ".", "HIVE_PURGER_WATERMARK", ",", "watermark", ")", ";", "log", ".", "info", "(", "\"Setting job watermark for the job: \"", "+", "watermark", ")", ";", "}" ]
Sets Job Watermark in the SourceState which will be copied to all WorkUnitStates. Job Watermark is a complete partition name. During next run of this job, fresh work units will be created starting from this partition.
[ "Sets", "Job", "Watermark", "in", "the", "SourceState", "which", "will", "be", "copied", "to", "all", "WorkUnitStates", ".", "Job", "Watermark", "is", "a", "complete", "partition", "name", ".", "During", "next", "run", "of", "this", "job", "fresh", "work", "units", "will", "be", "created", "starting", "from", "this", "partition", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-modules/gobblin-compliance/src/main/java/org/apache/gobblin/compliance/purger/HivePurgerSource.java#L327-L330
graphhopper/graphhopper
core/src/main/java/com/graphhopper/routing/ch/NodeBasedNodeContractor.java
NodeBasedNodeContractor.calculatePriority
@Override public float calculatePriority(int node) { """ Warning: the calculated priority must NOT depend on priority(v) and therefore findShortcuts should also not depend on the priority(v). Otherwise updating the priority before contracting in contractNodes() could lead to a slowish or even endless loop. """ CalcShortcutsResult calcShortcutsResult = calcShortcutCount(node); // # huge influence: the bigger the less shortcuts gets created and the faster is the preparation // // every adjNode has an 'original edge' number associated. initially it is r=1 // when a new shortcut is introduced then r of the associated edges is summed up: // r(u,w)=r(u,v)+r(v,w) now we can define // originalEdgesCount = σ(v) := sum_{ (u,w) ∈ shortcuts(v) } of r(u, w) int originalEdgesCount = calcShortcutsResult.originalEdgesCount; // # lowest influence on preparation speed or shortcut creation count // (but according to paper should speed up queries) // // number of already contracted neighbors of v int contractedNeighbors = 0; int degree = 0; CHEdgeIterator iter = remainingEdgeExplorer.setBaseNode(node); while (iter.next()) { degree++; if (iter.isShortcut()) contractedNeighbors++; } // from shortcuts we can compute the edgeDifference // # low influence: with it the shortcut creation is slightly faster // // |shortcuts(v)| − |{(u, v) | v uncontracted}| − |{(v, w) | v uncontracted}| // meanDegree is used instead of outDegree+inDegree as if one adjNode is in both directions // only one bucket memory is used. Additionally one shortcut could also stand for two directions. int edgeDifference = calcShortcutsResult.shortcutsCount - degree; // according to the paper do a simple linear combination of the properties to get the priority. return params.edgeDifferenceWeight * edgeDifference + params.originalEdgesCountWeight * originalEdgesCount + params.contractedNeighborsWeight * contractedNeighbors; }
java
@Override public float calculatePriority(int node) { CalcShortcutsResult calcShortcutsResult = calcShortcutCount(node); // # huge influence: the bigger the less shortcuts gets created and the faster is the preparation // // every adjNode has an 'original edge' number associated. initially it is r=1 // when a new shortcut is introduced then r of the associated edges is summed up: // r(u,w)=r(u,v)+r(v,w) now we can define // originalEdgesCount = σ(v) := sum_{ (u,w) ∈ shortcuts(v) } of r(u, w) int originalEdgesCount = calcShortcutsResult.originalEdgesCount; // # lowest influence on preparation speed or shortcut creation count // (but according to paper should speed up queries) // // number of already contracted neighbors of v int contractedNeighbors = 0; int degree = 0; CHEdgeIterator iter = remainingEdgeExplorer.setBaseNode(node); while (iter.next()) { degree++; if (iter.isShortcut()) contractedNeighbors++; } // from shortcuts we can compute the edgeDifference // # low influence: with it the shortcut creation is slightly faster // // |shortcuts(v)| − |{(u, v) | v uncontracted}| − |{(v, w) | v uncontracted}| // meanDegree is used instead of outDegree+inDegree as if one adjNode is in both directions // only one bucket memory is used. Additionally one shortcut could also stand for two directions. int edgeDifference = calcShortcutsResult.shortcutsCount - degree; // according to the paper do a simple linear combination of the properties to get the priority. return params.edgeDifferenceWeight * edgeDifference + params.originalEdgesCountWeight * originalEdgesCount + params.contractedNeighborsWeight * contractedNeighbors; }
[ "@", "Override", "public", "float", "calculatePriority", "(", "int", "node", ")", "{", "CalcShortcutsResult", "calcShortcutsResult", "=", "calcShortcutCount", "(", "node", ")", ";", "// # huge influence: the bigger the less shortcuts gets created and the faster is the preparation", "//", "// every adjNode has an 'original edge' number associated. initially it is r=1", "// when a new shortcut is introduced then r of the associated edges is summed up:", "// r(u,w)=r(u,v)+r(v,w) now we can define", "// originalEdgesCount = σ(v) := sum_{ (u,w) ∈ shortcuts(v) } of r(u, w)", "int", "originalEdgesCount", "=", "calcShortcutsResult", ".", "originalEdgesCount", ";", "// # lowest influence on preparation speed or shortcut creation count", "// (but according to paper should speed up queries)", "//", "// number of already contracted neighbors of v", "int", "contractedNeighbors", "=", "0", ";", "int", "degree", "=", "0", ";", "CHEdgeIterator", "iter", "=", "remainingEdgeExplorer", ".", "setBaseNode", "(", "node", ")", ";", "while", "(", "iter", ".", "next", "(", ")", ")", "{", "degree", "++", ";", "if", "(", "iter", ".", "isShortcut", "(", ")", ")", "contractedNeighbors", "++", ";", "}", "// from shortcuts we can compute the edgeDifference", "// # low influence: with it the shortcut creation is slightly faster", "//", "// |shortcuts(v)| − |{(u, v) | v uncontracted}| − |{(v, w) | v uncontracted}|", "// meanDegree is used instead of outDegree+inDegree as if one adjNode is in both directions", "// only one bucket memory is used. Additionally one shortcut could also stand for two directions.", "int", "edgeDifference", "=", "calcShortcutsResult", ".", "shortcutsCount", "-", "degree", ";", "// according to the paper do a simple linear combination of the properties to get the priority.", "return", "params", ".", "edgeDifferenceWeight", "*", "edgeDifference", "+", "params", ".", "originalEdgesCountWeight", "*", "originalEdgesCount", "+", "params", ".", "contractedNeighborsWeight", "*", "contractedNeighbors", ";", "}" ]
Warning: the calculated priority must NOT depend on priority(v) and therefore findShortcuts should also not depend on the priority(v). Otherwise updating the priority before contracting in contractNodes() could lead to a slowish or even endless loop.
[ "Warning", ":", "the", "calculated", "priority", "must", "NOT", "depend", "on", "priority", "(", "v", ")", "and", "therefore", "findShortcuts", "should", "also", "not", "depend", "on", "the", "priority", "(", "v", ")", ".", "Otherwise", "updating", "the", "priority", "before", "contracting", "in", "contractNodes", "()", "could", "lead", "to", "a", "slowish", "or", "even", "endless", "loop", "." ]
train
https://github.com/graphhopper/graphhopper/blob/c235e306e6e823043cadcc41ead0e685bdebf737/core/src/main/java/com/graphhopper/routing/ch/NodeBasedNodeContractor.java#L98-L135
lucee/Lucee
core/src/main/java/lucee/runtime/net/mail/MailClient.java
MailClient.deleteMails
public void deleteMails(String as[], String as1[]) throws MessagingException, IOException { """ delete all message in ibox that match given criteria @param messageNumbers @param uIds @throws MessagingException @throws IOException """ Folder folder; Message amessage[]; folder = _store.getFolder("INBOX"); folder.open(2); Map<String, Message> map = getMessages(null, folder, as1, as, startrow, maxrows, false); Iterator<String> iterator = map.keySet().iterator(); amessage = new Message[map.size()]; int i = 0; while (iterator.hasNext()) { amessage[i++] = map.get(iterator.next()); } try { folder.setFlags(amessage, new Flags(javax.mail.Flags.Flag.DELETED), true); } finally { folder.close(true); } }
java
public void deleteMails(String as[], String as1[]) throws MessagingException, IOException { Folder folder; Message amessage[]; folder = _store.getFolder("INBOX"); folder.open(2); Map<String, Message> map = getMessages(null, folder, as1, as, startrow, maxrows, false); Iterator<String> iterator = map.keySet().iterator(); amessage = new Message[map.size()]; int i = 0; while (iterator.hasNext()) { amessage[i++] = map.get(iterator.next()); } try { folder.setFlags(amessage, new Flags(javax.mail.Flags.Flag.DELETED), true); } finally { folder.close(true); } }
[ "public", "void", "deleteMails", "(", "String", "as", "[", "]", ",", "String", "as1", "[", "]", ")", "throws", "MessagingException", ",", "IOException", "{", "Folder", "folder", ";", "Message", "amessage", "[", "]", ";", "folder", "=", "_store", ".", "getFolder", "(", "\"INBOX\"", ")", ";", "folder", ".", "open", "(", "2", ")", ";", "Map", "<", "String", ",", "Message", ">", "map", "=", "getMessages", "(", "null", ",", "folder", ",", "as1", ",", "as", ",", "startrow", ",", "maxrows", ",", "false", ")", ";", "Iterator", "<", "String", ">", "iterator", "=", "map", ".", "keySet", "(", ")", ".", "iterator", "(", ")", ";", "amessage", "=", "new", "Message", "[", "map", ".", "size", "(", ")", "]", ";", "int", "i", "=", "0", ";", "while", "(", "iterator", ".", "hasNext", "(", ")", ")", "{", "amessage", "[", "i", "++", "]", "=", "map", ".", "get", "(", "iterator", ".", "next", "(", ")", ")", ";", "}", "try", "{", "folder", ".", "setFlags", "(", "amessage", ",", "new", "Flags", "(", "javax", ".", "mail", ".", "Flags", ".", "Flag", ".", "DELETED", ")", ",", "true", ")", ";", "}", "finally", "{", "folder", ".", "close", "(", "true", ")", ";", "}", "}" ]
delete all message in ibox that match given criteria @param messageNumbers @param uIds @throws MessagingException @throws IOException
[ "delete", "all", "message", "in", "ibox", "that", "match", "given", "criteria" ]
train
https://github.com/lucee/Lucee/blob/29b153fc4e126e5edb97da937f2ee2e231b87593/core/src/main/java/lucee/runtime/net/mail/MailClient.java#L279-L297
xhsun/gw2wrapper
src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java
AsynchronousRequest.getContinentFloorInfo
public void getContinentFloorInfo(int continentID, int[] ids, Callback<List<ContinentFloor>> callback) throws GuildWars2Exception, NullPointerException { """ For more info on continents API go <a href="https://wiki.guildwars2.com/wiki/API:2/continents">here</a><br/> Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @param continentID {@link Continent#id} @param ids list of floor id @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws GuildWars2Exception empty ID list @throws NullPointerException if given {@link Callback} is empty @see ContinentFloor continents floor info """ isParamValid(new ParamChecker(ids)); gw2API.getContinentFloorInfo(Integer.toString(continentID), processIds(ids), GuildWars2.lang.getValue()).enqueue(callback); }
java
public void getContinentFloorInfo(int continentID, int[] ids, Callback<List<ContinentFloor>> callback) throws GuildWars2Exception, NullPointerException { isParamValid(new ParamChecker(ids)); gw2API.getContinentFloorInfo(Integer.toString(continentID), processIds(ids), GuildWars2.lang.getValue()).enqueue(callback); }
[ "public", "void", "getContinentFloorInfo", "(", "int", "continentID", ",", "int", "[", "]", "ids", ",", "Callback", "<", "List", "<", "ContinentFloor", ">", ">", "callback", ")", "throws", "GuildWars2Exception", ",", "NullPointerException", "{", "isParamValid", "(", "new", "ParamChecker", "(", "ids", ")", ")", ";", "gw2API", ".", "getContinentFloorInfo", "(", "Integer", ".", "toString", "(", "continentID", ")", ",", "processIds", "(", "ids", ")", ",", "GuildWars2", ".", "lang", ".", "getValue", "(", ")", ")", ".", "enqueue", "(", "callback", ")", ";", "}" ]
For more info on continents API go <a href="https://wiki.guildwars2.com/wiki/API:2/continents">here</a><br/> Give user the access to {@link Callback#onResponse(Call, Response)} and {@link Callback#onFailure(Call, Throwable)} methods for custom interactions @param continentID {@link Continent#id} @param ids list of floor id @param callback callback that is going to be used for {@link Call#enqueue(Callback)} @throws GuildWars2Exception empty ID list @throws NullPointerException if given {@link Callback} is empty @see ContinentFloor continents floor info
[ "For", "more", "info", "on", "continents", "API", "go", "<a", "href", "=", "https", ":", "//", "wiki", ".", "guildwars2", ".", "com", "/", "wiki", "/", "API", ":", "2", "/", "continents", ">", "here<", "/", "a", ">", "<br", "/", ">", "Give", "user", "the", "access", "to", "{", "@link", "Callback#onResponse", "(", "Call", "Response", ")", "}", "and", "{", "@link", "Callback#onFailure", "(", "Call", "Throwable", ")", "}", "methods", "for", "custom", "interactions" ]
train
https://github.com/xhsun/gw2wrapper/blob/c8a43b51f363b032074fb152ee6efe657e33e525/src/main/java/me/xhsun/guildwars2wrapper/AsynchronousRequest.java#L1061-L1064
ironjacamar/ironjacamar
codegenerator/src/main/java/org/ironjacamar/codegenerator/code/ConnInterfaceCodeGen.java
ConnInterfaceCodeGen.writeClassBody
@Override public void writeClassBody(Definition def, Writer out) throws IOException { """ Output class @param def definition @param out Writer @throws IOException ioException """ int indent = 1; out.write("public interface " + getClassName(def)); writeLeftCurlyBracket(out, 0); if (def.getMcfDefs().get(getNumOfMcf()).isDefineMethodInConnection()) { if (def.getMcfDefs().get(getNumOfMcf()).getMethods().size() > 0) { for (MethodForConnection method : def.getMcfDefs().get(getNumOfMcf()).getMethods()) { writeMethodSignature(out, indent, method); out.write(";\n"); } } } else { writeSimpleMethodSignature(out, indent, " * Call me", "public void callMe();"); } writeEol(out); writeSimpleMethodSignature(out, indent, " * Close", "public void close();"); writeRightCurlyBracket(out, 0); }
java
@Override public void writeClassBody(Definition def, Writer out) throws IOException { int indent = 1; out.write("public interface " + getClassName(def)); writeLeftCurlyBracket(out, 0); if (def.getMcfDefs().get(getNumOfMcf()).isDefineMethodInConnection()) { if (def.getMcfDefs().get(getNumOfMcf()).getMethods().size() > 0) { for (MethodForConnection method : def.getMcfDefs().get(getNumOfMcf()).getMethods()) { writeMethodSignature(out, indent, method); out.write(";\n"); } } } else { writeSimpleMethodSignature(out, indent, " * Call me", "public void callMe();"); } writeEol(out); writeSimpleMethodSignature(out, indent, " * Close", "public void close();"); writeRightCurlyBracket(out, 0); }
[ "@", "Override", "public", "void", "writeClassBody", "(", "Definition", "def", ",", "Writer", "out", ")", "throws", "IOException", "{", "int", "indent", "=", "1", ";", "out", ".", "write", "(", "\"public interface \"", "+", "getClassName", "(", "def", ")", ")", ";", "writeLeftCurlyBracket", "(", "out", ",", "0", ")", ";", "if", "(", "def", ".", "getMcfDefs", "(", ")", ".", "get", "(", "getNumOfMcf", "(", ")", ")", ".", "isDefineMethodInConnection", "(", ")", ")", "{", "if", "(", "def", ".", "getMcfDefs", "(", ")", ".", "get", "(", "getNumOfMcf", "(", ")", ")", ".", "getMethods", "(", ")", ".", "size", "(", ")", ">", "0", ")", "{", "for", "(", "MethodForConnection", "method", ":", "def", ".", "getMcfDefs", "(", ")", ".", "get", "(", "getNumOfMcf", "(", ")", ")", ".", "getMethods", "(", ")", ")", "{", "writeMethodSignature", "(", "out", ",", "indent", ",", "method", ")", ";", "out", ".", "write", "(", "\";\\n\"", ")", ";", "}", "}", "}", "else", "{", "writeSimpleMethodSignature", "(", "out", ",", "indent", ",", "\" * Call me\"", ",", "\"public void callMe();\"", ")", ";", "}", "writeEol", "(", "out", ")", ";", "writeSimpleMethodSignature", "(", "out", ",", "indent", ",", "\" * Close\"", ",", "\"public void close();\"", ")", ";", "writeRightCurlyBracket", "(", "out", ",", "0", ")", ";", "}" ]
Output class @param def definition @param out Writer @throws IOException ioException
[ "Output", "class" ]
train
https://github.com/ironjacamar/ironjacamar/blob/f0389ee7e62aa8b40ba09b251edad76d220ea796/codegenerator/src/main/java/org/ironjacamar/codegenerator/code/ConnInterfaceCodeGen.java#L45-L73
roboconf/roboconf-platform
core/roboconf-messaging-api/src/main/java/net/roboconf/messaging/api/factory/MessagingClientFactoryRegistry.java
MessagingClientFactoryRegistry.notifyListeners
private void notifyListeners(IMessagingClientFactory factory, boolean isAdded) { """ Notifies the messaging client factory listeners that a factory has been added/removed. @param factory the incoming/outgoing messaging client factory. @param isAdded flag indicating whether the factory has been added or removed. """ for (MessagingClientFactoryListener listener : this.listeners) { try { if (isAdded) listener.addMessagingClientFactory(factory); else listener.removeMessagingClientFactory(factory); } catch (Throwable t) { // Log the exception, but *do not* interrupt the notification of the other listeners. this.logger.warning("Messaging client factory listener has thrown an exception: " + listener); Utils.logException(this.logger, new RuntimeException(t)); } } }
java
private void notifyListeners(IMessagingClientFactory factory, boolean isAdded) { for (MessagingClientFactoryListener listener : this.listeners) { try { if (isAdded) listener.addMessagingClientFactory(factory); else listener.removeMessagingClientFactory(factory); } catch (Throwable t) { // Log the exception, but *do not* interrupt the notification of the other listeners. this.logger.warning("Messaging client factory listener has thrown an exception: " + listener); Utils.logException(this.logger, new RuntimeException(t)); } } }
[ "private", "void", "notifyListeners", "(", "IMessagingClientFactory", "factory", ",", "boolean", "isAdded", ")", "{", "for", "(", "MessagingClientFactoryListener", "listener", ":", "this", ".", "listeners", ")", "{", "try", "{", "if", "(", "isAdded", ")", "listener", ".", "addMessagingClientFactory", "(", "factory", ")", ";", "else", "listener", ".", "removeMessagingClientFactory", "(", "factory", ")", ";", "}", "catch", "(", "Throwable", "t", ")", "{", "// Log the exception, but *do not* interrupt the notification of the other listeners.", "this", ".", "logger", ".", "warning", "(", "\"Messaging client factory listener has thrown an exception: \"", "+", "listener", ")", ";", "Utils", ".", "logException", "(", "this", ".", "logger", ",", "new", "RuntimeException", "(", "t", ")", ")", ";", "}", "}", "}" ]
Notifies the messaging client factory listeners that a factory has been added/removed. @param factory the incoming/outgoing messaging client factory. @param isAdded flag indicating whether the factory has been added or removed.
[ "Notifies", "the", "messaging", "client", "factory", "listeners", "that", "a", "factory", "has", "been", "added", "/", "removed", "." ]
train
https://github.com/roboconf/roboconf-platform/blob/add54eead479effb138d0ff53a2d637902b82702/core/roboconf-messaging-api/src/main/java/net/roboconf/messaging/api/factory/MessagingClientFactoryRegistry.java#L137-L152
before/quality-check
modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java
Check.notEmpty
@ArgumentsChecked @Throws( { """ Ensures that a passed iterable as a parameter of the calling method is not empty. <p> The following example describes how to use it. <pre> &#064;ArgumentsChecked public setIterable(Iterable&lt;String&gt; iterable) { this.iterable = Check.notEmpty(iterable, &quot;iterable&quot;); } </pre> @param iterable an iterable which should not be empty @param name name of object reference (in source code) @return the passed reference that is not empty @throws IllegalNullArgumentException if the given argument {@code iterable} is {@code null} @throws IllegalEmptyArgumentException if the given argument {@code iterable} is empty """ IllegalNullArgumentException.class, IllegalEmptyArgumentException.class }) public static <T extends Iterable<?>> T notEmpty(@Nonnull final T iterable, @Nullable final String name) { notNull(iterable, name); notEmpty(iterable, !iterable.iterator().hasNext(), name); return iterable; }
java
@ArgumentsChecked @Throws({ IllegalNullArgumentException.class, IllegalEmptyArgumentException.class }) public static <T extends Iterable<?>> T notEmpty(@Nonnull final T iterable, @Nullable final String name) { notNull(iterable, name); notEmpty(iterable, !iterable.iterator().hasNext(), name); return iterable; }
[ "@", "ArgumentsChecked", "@", "Throws", "(", "{", "IllegalNullArgumentException", ".", "class", ",", "IllegalEmptyArgumentException", ".", "class", "}", ")", "public", "static", "<", "T", "extends", "Iterable", "<", "?", ">", ">", "T", "notEmpty", "(", "@", "Nonnull", "final", "T", "iterable", ",", "@", "Nullable", "final", "String", "name", ")", "{", "notNull", "(", "iterable", ",", "name", ")", ";", "notEmpty", "(", "iterable", ",", "!", "iterable", ".", "iterator", "(", ")", ".", "hasNext", "(", ")", ",", "name", ")", ";", "return", "iterable", ";", "}" ]
Ensures that a passed iterable as a parameter of the calling method is not empty. <p> The following example describes how to use it. <pre> &#064;ArgumentsChecked public setIterable(Iterable&lt;String&gt; iterable) { this.iterable = Check.notEmpty(iterable, &quot;iterable&quot;); } </pre> @param iterable an iterable which should not be empty @param name name of object reference (in source code) @return the passed reference that is not empty @throws IllegalNullArgumentException if the given argument {@code iterable} is {@code null} @throws IllegalEmptyArgumentException if the given argument {@code iterable} is empty
[ "Ensures", "that", "a", "passed", "iterable", "as", "a", "parameter", "of", "the", "calling", "method", "is", "not", "empty", "." ]
train
https://github.com/before/quality-check/blob/a75c32c39434ddb1f89bece57acae0536724c15a/modules/quality-check/src/main/java/net/sf/qualitycheck/Check.java#L2178-L2184
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/interceptor/Interceptors.java
Interceptors.doPreIntercept
public static void doPreIntercept( InterceptorContext context, List/*< Interceptor >*/ interceptors ) throws InterceptorException { """ Execute a "pre" interceptor chain. This will execute the {@link Interceptor#preInvoke(InterceptorContext, InterceptorChain)} method to be invoked on each interceptor in a chain. @param context the context for a set of interceptors @param interceptors the list of interceptors @throws InterceptorException """ if ( interceptors != null ) { PreInvokeInterceptorChain chain = new PreInvokeInterceptorChain( context, interceptors ); chain.continueChain(); } }
java
public static void doPreIntercept( InterceptorContext context, List/*< Interceptor >*/ interceptors ) throws InterceptorException { if ( interceptors != null ) { PreInvokeInterceptorChain chain = new PreInvokeInterceptorChain( context, interceptors ); chain.continueChain(); } }
[ "public", "static", "void", "doPreIntercept", "(", "InterceptorContext", "context", ",", "List", "/*< Interceptor >*/", "interceptors", ")", "throws", "InterceptorException", "{", "if", "(", "interceptors", "!=", "null", ")", "{", "PreInvokeInterceptorChain", "chain", "=", "new", "PreInvokeInterceptorChain", "(", "context", ",", "interceptors", ")", ";", "chain", ".", "continueChain", "(", ")", ";", "}", "}" ]
Execute a "pre" interceptor chain. This will execute the {@link Interceptor#preInvoke(InterceptorContext, InterceptorChain)} method to be invoked on each interceptor in a chain. @param context the context for a set of interceptors @param interceptors the list of interceptors @throws InterceptorException
[ "Execute", "a", "pre", "interceptor", "chain", ".", "This", "will", "execute", "the", "{", "@link", "Interceptor#preInvoke", "(", "InterceptorContext", "InterceptorChain", ")", "}", "method", "to", "be", "invoked", "on", "each", "interceptor", "in", "a", "chain", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/interceptor/Interceptors.java#L40-L48
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/geometry/Octahedron.java
Octahedron.getVertices
@Override public Point3d[] getVertices() { """ Returns the vertices of an n-fold polygon of given radius and center @param n @param radius @param center @return """ Point3d[] octahedron = new Point3d[6]; octahedron[0] = new Point3d(-cirumscribedRadius, 0, 0); octahedron[1] = new Point3d( cirumscribedRadius, 0, 0); octahedron[2] = new Point3d(0, -cirumscribedRadius, 0); octahedron[3] = new Point3d(0, cirumscribedRadius, 0); octahedron[4] = new Point3d(0, 0, -cirumscribedRadius); octahedron[5] = new Point3d(0, 0, cirumscribedRadius); return octahedron; }
java
@Override public Point3d[] getVertices() { Point3d[] octahedron = new Point3d[6]; octahedron[0] = new Point3d(-cirumscribedRadius, 0, 0); octahedron[1] = new Point3d( cirumscribedRadius, 0, 0); octahedron[2] = new Point3d(0, -cirumscribedRadius, 0); octahedron[3] = new Point3d(0, cirumscribedRadius, 0); octahedron[4] = new Point3d(0, 0, -cirumscribedRadius); octahedron[5] = new Point3d(0, 0, cirumscribedRadius); return octahedron; }
[ "@", "Override", "public", "Point3d", "[", "]", "getVertices", "(", ")", "{", "Point3d", "[", "]", "octahedron", "=", "new", "Point3d", "[", "6", "]", ";", "octahedron", "[", "0", "]", "=", "new", "Point3d", "(", "-", "cirumscribedRadius", ",", "0", ",", "0", ")", ";", "octahedron", "[", "1", "]", "=", "new", "Point3d", "(", "cirumscribedRadius", ",", "0", ",", "0", ")", ";", "octahedron", "[", "2", "]", "=", "new", "Point3d", "(", "0", ",", "-", "cirumscribedRadius", ",", "0", ")", ";", "octahedron", "[", "3", "]", "=", "new", "Point3d", "(", "0", ",", "cirumscribedRadius", ",", "0", ")", ";", "octahedron", "[", "4", "]", "=", "new", "Point3d", "(", "0", ",", "0", ",", "-", "cirumscribedRadius", ")", ";", "octahedron", "[", "5", "]", "=", "new", "Point3d", "(", "0", ",", "0", ",", "cirumscribedRadius", ")", ";", "return", "octahedron", ";", "}" ]
Returns the vertices of an n-fold polygon of given radius and center @param n @param radius @param center @return
[ "Returns", "the", "vertices", "of", "an", "n", "-", "fold", "polygon", "of", "given", "radius", "and", "center" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/symmetry/geometry/Octahedron.java#L100-L111
OpenLiberty/open-liberty
dev/com.ibm.ws.wsoc/src/com/ibm/ws/wsoc/EndpointManager.java
EndpointManager.removeSession
public synchronized void removeSession(Endpoint ep, SessionExt sess) { """ /* closeAllSessions will call this with the session already removed... """ Class<?> cl = ep.getClass(); if (cl.equals(AnnotatedEndpoint.class)) { AnnotatedEndpoint ae = (AnnotatedEndpoint) ep; cl = ae.getServerEndpointClass(); } // Always try to remove http session if we can. String id = sess.getSessionImpl().getHttpSessionID(); if (id != null) { httpSessionMap.remove(id); } // find the session array for the given endpoint ArrayList<Session> sa = endpointSessionMap.get(cl); // nothing to remove if we don't have a session if (sa == null) { return; } // remove the new session from the list for this endpoint sa.remove(sess); // put the updated list back into the Map endpointSessionMap.put(cl, sa); if (tc.isDebugEnabled()) { Tr.debug(tc, "removed session of: " + sess.getId() + " from endpoint class of: " + cl.getName() + " in endpointmanager of: " + this.hashCode()); } }
java
public synchronized void removeSession(Endpoint ep, SessionExt sess) { Class<?> cl = ep.getClass(); if (cl.equals(AnnotatedEndpoint.class)) { AnnotatedEndpoint ae = (AnnotatedEndpoint) ep; cl = ae.getServerEndpointClass(); } // Always try to remove http session if we can. String id = sess.getSessionImpl().getHttpSessionID(); if (id != null) { httpSessionMap.remove(id); } // find the session array for the given endpoint ArrayList<Session> sa = endpointSessionMap.get(cl); // nothing to remove if we don't have a session if (sa == null) { return; } // remove the new session from the list for this endpoint sa.remove(sess); // put the updated list back into the Map endpointSessionMap.put(cl, sa); if (tc.isDebugEnabled()) { Tr.debug(tc, "removed session of: " + sess.getId() + " from endpoint class of: " + cl.getName() + " in endpointmanager of: " + this.hashCode()); } }
[ "public", "synchronized", "void", "removeSession", "(", "Endpoint", "ep", ",", "SessionExt", "sess", ")", "{", "Class", "<", "?", ">", "cl", "=", "ep", ".", "getClass", "(", ")", ";", "if", "(", "cl", ".", "equals", "(", "AnnotatedEndpoint", ".", "class", ")", ")", "{", "AnnotatedEndpoint", "ae", "=", "(", "AnnotatedEndpoint", ")", "ep", ";", "cl", "=", "ae", ".", "getServerEndpointClass", "(", ")", ";", "}", "// Always try to remove http session if we can.", "String", "id", "=", "sess", ".", "getSessionImpl", "(", ")", ".", "getHttpSessionID", "(", ")", ";", "if", "(", "id", "!=", "null", ")", "{", "httpSessionMap", ".", "remove", "(", "id", ")", ";", "}", "// find the session array for the given endpoint", "ArrayList", "<", "Session", ">", "sa", "=", "endpointSessionMap", ".", "get", "(", "cl", ")", ";", "// nothing to remove if we don't have a session", "if", "(", "sa", "==", "null", ")", "{", "return", ";", "}", "// remove the new session from the list for this endpoint", "sa", ".", "remove", "(", "sess", ")", ";", "// put the updated list back into the Map", "endpointSessionMap", ".", "put", "(", "cl", ",", "sa", ")", ";", "if", "(", "tc", ".", "isDebugEnabled", "(", ")", ")", "{", "Tr", ".", "debug", "(", "tc", ",", "\"removed session of: \"", "+", "sess", ".", "getId", "(", ")", "+", "\" from endpoint class of: \"", "+", "cl", ".", "getName", "(", ")", "+", "\" in endpointmanager of: \"", "+", "this", ".", "hashCode", "(", ")", ")", ";", "}", "}" ]
/* closeAllSessions will call this with the session already removed...
[ "/", "*", "closeAllSessions", "will", "call", "this", "with", "the", "session", "already", "removed", "..." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.wsoc/src/com/ibm/ws/wsoc/EndpointManager.java#L114-L145
jMotif/SAX
src/main/java/net/seninp/util/HeatChart.java
HeatChart.getCellColour
private Color getCellColour(double data, double min, double max) { """ /* Determines what colour a heat map cell should be based upon the cell values. """ double range = max - min; double position = data - min; // What proportion of the way through the possible values is that. double percentPosition = position / range; // Which colour group does that put us in. // int colourPosition = getColourPosition(percentPosition); int r = (int) (255 * red(percentPosition * 2 - 1)); int g = (int) (255 * green(percentPosition * 2 - 1)); int b = (int) (255 * blue(percentPosition * 2 - 1)); // int r = lowValueColour.getRed(); // int g = lowValueColour.getGreen(); // int b = lowValueColour.getBlue(); // // // Make n shifts of the colour, where n is the colourPosition. // for (int i = 0; i < colourPosition; i++) { // int rDistance = r - highValueColour.getRed(); // int gDistance = g - highValueColour.getGreen(); // int bDistance = b - highValueColour.getBlue(); // // if ((Math.abs(rDistance) >= Math.abs(gDistance)) // && (Math.abs(rDistance) >= Math.abs(bDistance))) { // // Red must be the largest. // r = changeColourValue(r, rDistance); // } // else if (Math.abs(gDistance) >= Math.abs(bDistance)) { // // Green must be the largest. // g = changeColourValue(g, gDistance); // } // else { // // Blue must be the largest. // b = changeColourValue(b, bDistance); // } // } return new Color(r, g, b); }
java
private Color getCellColour(double data, double min, double max) { double range = max - min; double position = data - min; // What proportion of the way through the possible values is that. double percentPosition = position / range; // Which colour group does that put us in. // int colourPosition = getColourPosition(percentPosition); int r = (int) (255 * red(percentPosition * 2 - 1)); int g = (int) (255 * green(percentPosition * 2 - 1)); int b = (int) (255 * blue(percentPosition * 2 - 1)); // int r = lowValueColour.getRed(); // int g = lowValueColour.getGreen(); // int b = lowValueColour.getBlue(); // // // Make n shifts of the colour, where n is the colourPosition. // for (int i = 0; i < colourPosition; i++) { // int rDistance = r - highValueColour.getRed(); // int gDistance = g - highValueColour.getGreen(); // int bDistance = b - highValueColour.getBlue(); // // if ((Math.abs(rDistance) >= Math.abs(gDistance)) // && (Math.abs(rDistance) >= Math.abs(bDistance))) { // // Red must be the largest. // r = changeColourValue(r, rDistance); // } // else if (Math.abs(gDistance) >= Math.abs(bDistance)) { // // Green must be the largest. // g = changeColourValue(g, gDistance); // } // else { // // Blue must be the largest. // b = changeColourValue(b, bDistance); // } // } return new Color(r, g, b); }
[ "private", "Color", "getCellColour", "(", "double", "data", ",", "double", "min", ",", "double", "max", ")", "{", "double", "range", "=", "max", "-", "min", ";", "double", "position", "=", "data", "-", "min", ";", "// What proportion of the way through the possible values is that.", "double", "percentPosition", "=", "position", "/", "range", ";", "// Which colour group does that put us in.", "// int colourPosition = getColourPosition(percentPosition);", "int", "r", "=", "(", "int", ")", "(", "255", "*", "red", "(", "percentPosition", "*", "2", "-", "1", ")", ")", ";", "int", "g", "=", "(", "int", ")", "(", "255", "*", "green", "(", "percentPosition", "*", "2", "-", "1", ")", ")", ";", "int", "b", "=", "(", "int", ")", "(", "255", "*", "blue", "(", "percentPosition", "*", "2", "-", "1", ")", ")", ";", "// int r = lowValueColour.getRed();", "// int g = lowValueColour.getGreen();", "// int b = lowValueColour.getBlue();", "//", "// // Make n shifts of the colour, where n is the colourPosition.", "// for (int i = 0; i < colourPosition; i++) {", "// int rDistance = r - highValueColour.getRed();", "// int gDistance = g - highValueColour.getGreen();", "// int bDistance = b - highValueColour.getBlue();", "//", "// if ((Math.abs(rDistance) >= Math.abs(gDistance))", "// && (Math.abs(rDistance) >= Math.abs(bDistance))) {", "// // Red must be the largest.", "// r = changeColourValue(r, rDistance);", "// }", "// else if (Math.abs(gDistance) >= Math.abs(bDistance)) {", "// // Green must be the largest.", "// g = changeColourValue(g, gDistance);", "// }", "// else {", "// // Blue must be the largest.", "// b = changeColourValue(b, bDistance);", "// }", "// }", "return", "new", "Color", "(", "r", ",", "g", ",", "b", ")", ";", "}" ]
/* Determines what colour a heat map cell should be based upon the cell values.
[ "/", "*", "Determines", "what", "colour", "a", "heat", "map", "cell", "should", "be", "based", "upon", "the", "cell", "values", "." ]
train
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/util/HeatChart.java#L1626-L1666
google/error-prone-javac
src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PropertyBuilder.java
PropertyBuilder.getInstance
public static PropertyBuilder getInstance(Context context, ClassDoc classDoc, PropertyWriter writer) { """ Construct a new PropertyBuilder. @param context the build context. @param classDoc the class whoses members are being documented. @param writer the doclet specific writer. """ return new PropertyBuilder(context, classDoc, writer); }
java
public static PropertyBuilder getInstance(Context context, ClassDoc classDoc, PropertyWriter writer) { return new PropertyBuilder(context, classDoc, writer); }
[ "public", "static", "PropertyBuilder", "getInstance", "(", "Context", "context", ",", "ClassDoc", "classDoc", ",", "PropertyWriter", "writer", ")", "{", "return", "new", "PropertyBuilder", "(", "context", ",", "classDoc", ",", "writer", ")", ";", "}" ]
Construct a new PropertyBuilder. @param context the build context. @param classDoc the class whoses members are being documented. @param writer the doclet specific writer.
[ "Construct", "a", "new", "PropertyBuilder", "." ]
train
https://github.com/google/error-prone-javac/blob/a53d069bbdb2c60232ed3811c19b65e41c3e60e0/src/jdk.javadoc/share/classes/com/sun/tools/doclets/internal/toolkit/builders/PropertyBuilder.java#L107-L111
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/peak/MeanShiftPeak.java
MeanShiftPeak.setRegion
protected void setRegion(float cx, float cy) { """ Updates the location of the rectangular bounding box @param cx Image center x-axis @param cy Image center y-axis """ x0 = cx - radius; y0 = cy - radius; if( x0 < 0 ) { x0 = 0;} else if( x0+width > image.width ) { x0 = image.width-width; } if( y0 < 0 ) { y0 = 0;} else if( y0+width > image.height ) { y0 = image.height-width; } }
java
protected void setRegion(float cx, float cy) { x0 = cx - radius; y0 = cy - radius; if( x0 < 0 ) { x0 = 0;} else if( x0+width > image.width ) { x0 = image.width-width; } if( y0 < 0 ) { y0 = 0;} else if( y0+width > image.height ) { y0 = image.height-width; } }
[ "protected", "void", "setRegion", "(", "float", "cx", ",", "float", "cy", ")", "{", "x0", "=", "cx", "-", "radius", ";", "y0", "=", "cy", "-", "radius", ";", "if", "(", "x0", "<", "0", ")", "{", "x0", "=", "0", ";", "}", "else", "if", "(", "x0", "+", "width", ">", "image", ".", "width", ")", "{", "x0", "=", "image", ".", "width", "-", "width", ";", "}", "if", "(", "y0", "<", "0", ")", "{", "y0", "=", "0", ";", "}", "else", "if", "(", "y0", "+", "width", ">", "image", ".", "height", ")", "{", "y0", "=", "image", ".", "height", "-", "width", ";", "}", "}" ]
Updates the location of the rectangular bounding box @param cx Image center x-axis @param cy Image center y-axis
[ "Updates", "the", "location", "of", "the", "rectangular", "bounding", "box" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/peak/MeanShiftPeak.java#L153-L162
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WCollapsibleToggleRenderer.java
WCollapsibleToggleRenderer.doRender
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { """ Paints the given WCollapsibleToggle. @param component the WCollapsibleToggle to paint. @param renderContext the RenderContext to paint to. """ WCollapsibleToggle toggle = (WCollapsibleToggle) component; XmlStringBuilder xml = renderContext.getWriter(); xml.appendTagOpen("ui:collapsibletoggle"); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); xml.appendAttribute("groupName", toggle.getGroupName()); xml.appendEnd(); }
java
@Override public void doRender(final WComponent component, final WebXmlRenderContext renderContext) { WCollapsibleToggle toggle = (WCollapsibleToggle) component; XmlStringBuilder xml = renderContext.getWriter(); xml.appendTagOpen("ui:collapsibletoggle"); xml.appendAttribute("id", component.getId()); xml.appendOptionalAttribute("class", component.getHtmlClass()); xml.appendOptionalAttribute("track", component.isTracking(), "true"); xml.appendAttribute("groupName", toggle.getGroupName()); xml.appendEnd(); }
[ "@", "Override", "public", "void", "doRender", "(", "final", "WComponent", "component", ",", "final", "WebXmlRenderContext", "renderContext", ")", "{", "WCollapsibleToggle", "toggle", "=", "(", "WCollapsibleToggle", ")", "component", ";", "XmlStringBuilder", "xml", "=", "renderContext", ".", "getWriter", "(", ")", ";", "xml", ".", "appendTagOpen", "(", "\"ui:collapsibletoggle\"", ")", ";", "xml", ".", "appendAttribute", "(", "\"id\"", ",", "component", ".", "getId", "(", ")", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"class\"", ",", "component", ".", "getHtmlClass", "(", ")", ")", ";", "xml", ".", "appendOptionalAttribute", "(", "\"track\"", ",", "component", ".", "isTracking", "(", ")", ",", "\"true\"", ")", ";", "xml", ".", "appendAttribute", "(", "\"groupName\"", ",", "toggle", ".", "getGroupName", "(", ")", ")", ";", "xml", ".", "appendEnd", "(", ")", ";", "}" ]
Paints the given WCollapsibleToggle. @param component the WCollapsibleToggle to paint. @param renderContext the RenderContext to paint to.
[ "Paints", "the", "given", "WCollapsibleToggle", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/render/webxml/WCollapsibleToggleRenderer.java#L22-L33
Azure/azure-sdk-for-java
batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java
PoolsImpl.listUsageMetricsNextAsync
public Observable<Page<PoolUsageMetrics>> listUsageMetricsNextAsync(final String nextPageLink, final PoolListUsageMetricsNextOptions poolListUsageMetricsNextOptions) { """ Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account. If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned. @param nextPageLink The NextLink from the previous successful call to List operation. @param poolListUsageMetricsNextOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;PoolUsageMetrics&gt; object """ return listUsageMetricsNextWithServiceResponseAsync(nextPageLink, poolListUsageMetricsNextOptions) .map(new Func1<ServiceResponseWithHeaders<Page<PoolUsageMetrics>, PoolListUsageMetricsHeaders>, Page<PoolUsageMetrics>>() { @Override public Page<PoolUsageMetrics> call(ServiceResponseWithHeaders<Page<PoolUsageMetrics>, PoolListUsageMetricsHeaders> response) { return response.body(); } }); }
java
public Observable<Page<PoolUsageMetrics>> listUsageMetricsNextAsync(final String nextPageLink, final PoolListUsageMetricsNextOptions poolListUsageMetricsNextOptions) { return listUsageMetricsNextWithServiceResponseAsync(nextPageLink, poolListUsageMetricsNextOptions) .map(new Func1<ServiceResponseWithHeaders<Page<PoolUsageMetrics>, PoolListUsageMetricsHeaders>, Page<PoolUsageMetrics>>() { @Override public Page<PoolUsageMetrics> call(ServiceResponseWithHeaders<Page<PoolUsageMetrics>, PoolListUsageMetricsHeaders> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "PoolUsageMetrics", ">", ">", "listUsageMetricsNextAsync", "(", "final", "String", "nextPageLink", ",", "final", "PoolListUsageMetricsNextOptions", "poolListUsageMetricsNextOptions", ")", "{", "return", "listUsageMetricsNextWithServiceResponseAsync", "(", "nextPageLink", ",", "poolListUsageMetricsNextOptions", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponseWithHeaders", "<", "Page", "<", "PoolUsageMetrics", ">", ",", "PoolListUsageMetricsHeaders", ">", ",", "Page", "<", "PoolUsageMetrics", ">", ">", "(", ")", "{", "@", "Override", "public", "Page", "<", "PoolUsageMetrics", ">", "call", "(", "ServiceResponseWithHeaders", "<", "Page", "<", "PoolUsageMetrics", ">", ",", "PoolListUsageMetricsHeaders", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Lists the usage metrics, aggregated by pool across individual time intervals, for the specified account. If you do not specify a $filter clause including a poolId, the response includes all pools that existed in the account in the time range of the returned aggregation intervals. If you do not specify a $filter clause including a startTime or endTime these filters default to the start and end times of the last aggregation interval currently available; that is, only the last aggregation interval is returned. @param nextPageLink The NextLink from the previous successful call to List operation. @param poolListUsageMetricsNextOptions Additional parameters for the operation @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;PoolUsageMetrics&gt; object
[ "Lists", "the", "usage", "metrics", "aggregated", "by", "pool", "across", "individual", "time", "intervals", "for", "the", "specified", "account", ".", "If", "you", "do", "not", "specify", "a", "$filter", "clause", "including", "a", "poolId", "the", "response", "includes", "all", "pools", "that", "existed", "in", "the", "account", "in", "the", "time", "range", "of", "the", "returned", "aggregation", "intervals", ".", "If", "you", "do", "not", "specify", "a", "$filter", "clause", "including", "a", "startTime", "or", "endTime", "these", "filters", "default", "to", "the", "start", "and", "end", "times", "of", "the", "last", "aggregation", "interval", "currently", "available", ";", "that", "is", "only", "the", "last", "aggregation", "interval", "is", "returned", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/batch/data-plane/src/main/java/com/microsoft/azure/batch/protocol/implementation/PoolsImpl.java#L3809-L3817
apache/groovy
src/main/java/org/codehaus/groovy/classgen/asm/CompileStack.java
CompileStack.defineVariable
public BytecodeVariable defineVariable(Variable v, boolean initFromStack) { """ Defines a new Variable using an AST variable. @param initFromStack if true the last element of the stack will be used to initialize the new variable. If false null will be used. """ return defineVariable(v, v.getOriginType(), initFromStack); }
java
public BytecodeVariable defineVariable(Variable v, boolean initFromStack) { return defineVariable(v, v.getOriginType(), initFromStack); }
[ "public", "BytecodeVariable", "defineVariable", "(", "Variable", "v", ",", "boolean", "initFromStack", ")", "{", "return", "defineVariable", "(", "v", ",", "v", ".", "getOriginType", "(", ")", ",", "initFromStack", ")", ";", "}" ]
Defines a new Variable using an AST variable. @param initFromStack if true the last element of the stack will be used to initialize the new variable. If false null will be used.
[ "Defines", "a", "new", "Variable", "using", "an", "AST", "variable", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/classgen/asm/CompileStack.java#L662-L664
apache/groovy
src/main/java/org/codehaus/groovy/tools/LoaderConfiguration.java
LoaderConfiguration.addClassPath
public void addClassPath(String path) { """ Adds a classpath to this configuration. It expects a string with multiple paths, separated by the system dependent path separator. Expands wildcards, e.g. dir/* into all the jars in dir. @param path the path as a path separator delimited string @see java.io.File#pathSeparator """ String[] paths = path.split(File.pathSeparator); for (String cpPath : paths) { // Check to support wild card classpath if (cpPath.endsWith("*")) { File dir = new File(cpPath.substring(0, cpPath.length() - 1)); File[] files = dir.listFiles(); if (files != null) { for (File file : files) { if (file.isFile() && file.getName().endsWith(".jar")) addFile(file); } } } else { addFile(new File(cpPath)); } } }
java
public void addClassPath(String path) { String[] paths = path.split(File.pathSeparator); for (String cpPath : paths) { // Check to support wild card classpath if (cpPath.endsWith("*")) { File dir = new File(cpPath.substring(0, cpPath.length() - 1)); File[] files = dir.listFiles(); if (files != null) { for (File file : files) { if (file.isFile() && file.getName().endsWith(".jar")) addFile(file); } } } else { addFile(new File(cpPath)); } } }
[ "public", "void", "addClassPath", "(", "String", "path", ")", "{", "String", "[", "]", "paths", "=", "path", ".", "split", "(", "File", ".", "pathSeparator", ")", ";", "for", "(", "String", "cpPath", ":", "paths", ")", "{", "// Check to support wild card classpath", "if", "(", "cpPath", ".", "endsWith", "(", "\"*\"", ")", ")", "{", "File", "dir", "=", "new", "File", "(", "cpPath", ".", "substring", "(", "0", ",", "cpPath", ".", "length", "(", ")", "-", "1", ")", ")", ";", "File", "[", "]", "files", "=", "dir", ".", "listFiles", "(", ")", ";", "if", "(", "files", "!=", "null", ")", "{", "for", "(", "File", "file", ":", "files", ")", "{", "if", "(", "file", ".", "isFile", "(", ")", "&&", "file", ".", "getName", "(", ")", ".", "endsWith", "(", "\".jar\"", ")", ")", "addFile", "(", "file", ")", ";", "}", "}", "}", "else", "{", "addFile", "(", "new", "File", "(", "cpPath", ")", ")", ";", "}", "}", "}" ]
Adds a classpath to this configuration. It expects a string with multiple paths, separated by the system dependent path separator. Expands wildcards, e.g. dir/* into all the jars in dir. @param path the path as a path separator delimited string @see java.io.File#pathSeparator
[ "Adds", "a", "classpath", "to", "this", "configuration", ".", "It", "expects", "a", "string", "with", "multiple", "paths", "separated", "by", "the", "system", "dependent", "path", "separator", ".", "Expands", "wildcards", "e", ".", "g", ".", "dir", "/", "*", "into", "all", "the", "jars", "in", "dir", "." ]
train
https://github.com/apache/groovy/blob/71cf20addb611bb8d097a59e395fd20bc7f31772/src/main/java/org/codehaus/groovy/tools/LoaderConfiguration.java#L303-L319
googleads/googleads-java-lib
examples/admanager_axis/src/main/java/admanager/axis/v201808/labelservice/CreateLabels.java
CreateLabels.runExample
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws RemoteException { """ Runs the example. @param adManagerServices the services factory. @param session the session. @throws ApiException if the API request failed with one or more service errors. @throws RemoteException if the API request failed due to other errors. """ // Get the LabelService. LabelServiceInterface labelService = adManagerServices.get(session, LabelServiceInterface.class); // Create a competitive exclusion label. Label competitiveExclusionLabel = new Label(); competitiveExclusionLabel.setName( "Car company label #" + new Random().nextInt(Integer.MAX_VALUE)); competitiveExclusionLabel.setTypes(new LabelType[] {LabelType.COMPETITIVE_EXCLUSION}); // Create an ad unit frequency cap label. Label adUnitFrequencyCapLabel = new Label(); adUnitFrequencyCapLabel.setName( "Don't run too often label #" + new Random().nextInt(Integer.MAX_VALUE)); adUnitFrequencyCapLabel.setTypes(new LabelType[] {LabelType.AD_UNIT_FREQUENCY_CAP}); // Create the labels on the server. Label[] labels = labelService.createLabels(new Label[] {competitiveExclusionLabel, adUnitFrequencyCapLabel}); for (Label createdLabel : labels) { System.out.printf("A label with ID %d and name '%s' was created.%n", createdLabel.getId(), createdLabel.getName()); } }
java
public static void runExample(AdManagerServices adManagerServices, AdManagerSession session) throws RemoteException { // Get the LabelService. LabelServiceInterface labelService = adManagerServices.get(session, LabelServiceInterface.class); // Create a competitive exclusion label. Label competitiveExclusionLabel = new Label(); competitiveExclusionLabel.setName( "Car company label #" + new Random().nextInt(Integer.MAX_VALUE)); competitiveExclusionLabel.setTypes(new LabelType[] {LabelType.COMPETITIVE_EXCLUSION}); // Create an ad unit frequency cap label. Label adUnitFrequencyCapLabel = new Label(); adUnitFrequencyCapLabel.setName( "Don't run too often label #" + new Random().nextInt(Integer.MAX_VALUE)); adUnitFrequencyCapLabel.setTypes(new LabelType[] {LabelType.AD_UNIT_FREQUENCY_CAP}); // Create the labels on the server. Label[] labels = labelService.createLabels(new Label[] {competitiveExclusionLabel, adUnitFrequencyCapLabel}); for (Label createdLabel : labels) { System.out.printf("A label with ID %d and name '%s' was created.%n", createdLabel.getId(), createdLabel.getName()); } }
[ "public", "static", "void", "runExample", "(", "AdManagerServices", "adManagerServices", ",", "AdManagerSession", "session", ")", "throws", "RemoteException", "{", "// Get the LabelService.", "LabelServiceInterface", "labelService", "=", "adManagerServices", ".", "get", "(", "session", ",", "LabelServiceInterface", ".", "class", ")", ";", "// Create a competitive exclusion label.", "Label", "competitiveExclusionLabel", "=", "new", "Label", "(", ")", ";", "competitiveExclusionLabel", ".", "setName", "(", "\"Car company label #\"", "+", "new", "Random", "(", ")", ".", "nextInt", "(", "Integer", ".", "MAX_VALUE", ")", ")", ";", "competitiveExclusionLabel", ".", "setTypes", "(", "new", "LabelType", "[", "]", "{", "LabelType", ".", "COMPETITIVE_EXCLUSION", "}", ")", ";", "// Create an ad unit frequency cap label.", "Label", "adUnitFrequencyCapLabel", "=", "new", "Label", "(", ")", ";", "adUnitFrequencyCapLabel", ".", "setName", "(", "\"Don't run too often label #\"", "+", "new", "Random", "(", ")", ".", "nextInt", "(", "Integer", ".", "MAX_VALUE", ")", ")", ";", "adUnitFrequencyCapLabel", ".", "setTypes", "(", "new", "LabelType", "[", "]", "{", "LabelType", ".", "AD_UNIT_FREQUENCY_CAP", "}", ")", ";", "// Create the labels on the server.", "Label", "[", "]", "labels", "=", "labelService", ".", "createLabels", "(", "new", "Label", "[", "]", "{", "competitiveExclusionLabel", ",", "adUnitFrequencyCapLabel", "}", ")", ";", "for", "(", "Label", "createdLabel", ":", "labels", ")", "{", "System", ".", "out", ".", "printf", "(", "\"A label with ID %d and name '%s' was created.%n\"", ",", "createdLabel", ".", "getId", "(", ")", ",", "createdLabel", ".", "getName", "(", ")", ")", ";", "}", "}" ]
Runs the example. @param adManagerServices the services factory. @param session the session. @throws ApiException if the API request failed with one or more service errors. @throws RemoteException if the API request failed due to other errors.
[ "Runs", "the", "example", "." ]
train
https://github.com/googleads/googleads-java-lib/blob/967957cc4f6076514e3a7926fe653e4f1f7cc9c9/examples/admanager_axis/src/main/java/admanager/axis/v201808/labelservice/CreateLabels.java#L52-L78
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/DatabaseOperationsInner.java
DatabaseOperationsInner.cancelAsync
public Observable<Void> cancelAsync(String resourceGroupName, String serverName, String databaseName, UUID operationId) { """ Cancels the asynchronous operation on the database. @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 databaseName The name of the database. @param operationId The operation identifier. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful. """ return cancelWithServiceResponseAsync(resourceGroupName, serverName, databaseName, operationId).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> cancelAsync(String resourceGroupName, String serverName, String databaseName, UUID operationId) { return cancelWithServiceResponseAsync(resourceGroupName, serverName, databaseName, operationId).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "cancelAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ",", "UUID", "operationId", ")", "{", "return", "cancelWithServiceResponseAsync", "(", "resourceGroupName", ",", "serverName", ",", "databaseName", ",", "operationId", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "Void", ">", ",", "Void", ">", "(", ")", "{", "@", "Override", "public", "Void", "call", "(", "ServiceResponse", "<", "Void", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
Cancels the asynchronous operation on the database. @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 databaseName The name of the database. @param operationId The operation identifier. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Cancels", "the", "asynchronous", "operation", "on", "the", "database", "." ]
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/DatabaseOperationsInner.java#L116-L123
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/server/namenode/ListPathsServlet.java
ListPathsServlet.writeInfo
static void writeInfo(String parent, HdfsFileStatus i, XMLOutputter doc) throws IOException { """ Write a node to output. Node information includes path, modification, permission, owner and group. For files, it also includes size, replication and block-size. """ final SimpleDateFormat ldf = df.get(); doc.startTag(i.isDir() ? "directory" : "file"); doc.attribute("path", i.getFullPath(new Path(parent)).toUri().getPath()); doc.attribute("modified", ldf.format(new Date(i.getModificationTime()))); doc.attribute("accesstime", ldf.format(new Date(i.getAccessTime()))); if (!i.isDir()) { doc.attribute("size", String.valueOf(i.getLen())); doc.attribute("replication", String.valueOf(i.getReplication())); doc.attribute("blocksize", String.valueOf(i.getBlockSize())); } doc.attribute("permission", (i.isDir()? "d": "-") + i.getPermission()); doc.attribute("owner", i.getOwner()); doc.attribute("group", i.getGroup()); doc.endTag(); }
java
static void writeInfo(String parent, HdfsFileStatus i, XMLOutputter doc) throws IOException { final SimpleDateFormat ldf = df.get(); doc.startTag(i.isDir() ? "directory" : "file"); doc.attribute("path", i.getFullPath(new Path(parent)).toUri().getPath()); doc.attribute("modified", ldf.format(new Date(i.getModificationTime()))); doc.attribute("accesstime", ldf.format(new Date(i.getAccessTime()))); if (!i.isDir()) { doc.attribute("size", String.valueOf(i.getLen())); doc.attribute("replication", String.valueOf(i.getReplication())); doc.attribute("blocksize", String.valueOf(i.getBlockSize())); } doc.attribute("permission", (i.isDir()? "d": "-") + i.getPermission()); doc.attribute("owner", i.getOwner()); doc.attribute("group", i.getGroup()); doc.endTag(); }
[ "static", "void", "writeInfo", "(", "String", "parent", ",", "HdfsFileStatus", "i", ",", "XMLOutputter", "doc", ")", "throws", "IOException", "{", "final", "SimpleDateFormat", "ldf", "=", "df", ".", "get", "(", ")", ";", "doc", ".", "startTag", "(", "i", ".", "isDir", "(", ")", "?", "\"directory\"", ":", "\"file\"", ")", ";", "doc", ".", "attribute", "(", "\"path\"", ",", "i", ".", "getFullPath", "(", "new", "Path", "(", "parent", ")", ")", ".", "toUri", "(", ")", ".", "getPath", "(", ")", ")", ";", "doc", ".", "attribute", "(", "\"modified\"", ",", "ldf", ".", "format", "(", "new", "Date", "(", "i", ".", "getModificationTime", "(", ")", ")", ")", ")", ";", "doc", ".", "attribute", "(", "\"accesstime\"", ",", "ldf", ".", "format", "(", "new", "Date", "(", "i", ".", "getAccessTime", "(", ")", ")", ")", ")", ";", "if", "(", "!", "i", ".", "isDir", "(", ")", ")", "{", "doc", ".", "attribute", "(", "\"size\"", ",", "String", ".", "valueOf", "(", "i", ".", "getLen", "(", ")", ")", ")", ";", "doc", ".", "attribute", "(", "\"replication\"", ",", "String", ".", "valueOf", "(", "i", ".", "getReplication", "(", ")", ")", ")", ";", "doc", ".", "attribute", "(", "\"blocksize\"", ",", "String", ".", "valueOf", "(", "i", ".", "getBlockSize", "(", ")", ")", ")", ";", "}", "doc", ".", "attribute", "(", "\"permission\"", ",", "(", "i", ".", "isDir", "(", ")", "?", "\"d\"", ":", "\"-\"", ")", "+", "i", ".", "getPermission", "(", ")", ")", ";", "doc", ".", "attribute", "(", "\"owner\"", ",", "i", ".", "getOwner", "(", ")", ")", ";", "doc", ".", "attribute", "(", "\"group\"", ",", "i", ".", "getGroup", "(", ")", ")", ";", "doc", ".", "endTag", "(", ")", ";", "}" ]
Write a node to output. Node information includes path, modification, permission, owner and group. For files, it also includes size, replication and block-size.
[ "Write", "a", "node", "to", "output", ".", "Node", "information", "includes", "path", "modification", "permission", "owner", "and", "group", ".", "For", "files", "it", "also", "includes", "size", "replication", "and", "block", "-", "size", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/ListPathsServlet.java#L64-L79
knowm/XChange
xchange-lakebtc/src/main/java/org/knowm/xchange/lakebtc/LakeBTCAdapters.java
LakeBTCAdapters.adaptTrade
public static Trade adaptTrade( LakeBTCTradeResponse tx, CurrencyPair currencyPair, int timeScale) { """ Adapts a Transaction to a Trade Object @param tx The LakeBtc transaction @param currencyPair (e.g. BTC/USD) @param timeScale polled order books provide a timestamp in seconds, stream in ms @return The XChange Trade """ final String tradeId = String.valueOf(tx.getId()); Date date = DateUtils.fromMillisUtc(tx.getAt() * timeScale); // polled order // books provide // a timestamp // in seconds, // stream in ms return new Trade(null, tx.getAmount(), currencyPair, tx.getTotal(), date, tradeId); }
java
public static Trade adaptTrade( LakeBTCTradeResponse tx, CurrencyPair currencyPair, int timeScale) { final String tradeId = String.valueOf(tx.getId()); Date date = DateUtils.fromMillisUtc(tx.getAt() * timeScale); // polled order // books provide // a timestamp // in seconds, // stream in ms return new Trade(null, tx.getAmount(), currencyPair, tx.getTotal(), date, tradeId); }
[ "public", "static", "Trade", "adaptTrade", "(", "LakeBTCTradeResponse", "tx", ",", "CurrencyPair", "currencyPair", ",", "int", "timeScale", ")", "{", "final", "String", "tradeId", "=", "String", ".", "valueOf", "(", "tx", ".", "getId", "(", ")", ")", ";", "Date", "date", "=", "DateUtils", ".", "fromMillisUtc", "(", "tx", ".", "getAt", "(", ")", "*", "timeScale", ")", ";", "// polled order", "// books provide", "// a timestamp", "// in seconds,", "// stream in ms", "return", "new", "Trade", "(", "null", ",", "tx", ".", "getAmount", "(", ")", ",", "currencyPair", ",", "tx", ".", "getTotal", "(", ")", ",", "date", ",", "tradeId", ")", ";", "}" ]
Adapts a Transaction to a Trade Object @param tx The LakeBtc transaction @param currencyPair (e.g. BTC/USD) @param timeScale polled order books provide a timestamp in seconds, stream in ms @return The XChange Trade
[ "Adapts", "a", "Transaction", "to", "a", "Trade", "Object" ]
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-lakebtc/src/main/java/org/knowm/xchange/lakebtc/LakeBTCAdapters.java#L106-L116
stripe/stripe-android
stripe/src/main/java/com/stripe/android/view/LockableHorizontalScrollView.java
LockableHorizontalScrollView.wrappedSmoothScrollBy
void wrappedSmoothScrollBy(int dx, int dy) { """ Wrapping the {@link HorizontalScrollView#smoothScrollBy(int, int)} function to increase testability. @param dx the number of pixels to scroll by on the X axis @param dy the number of pixels to scroll by on the Y axis """ if (!mScrollable) { return; } smoothScrollBy(dx, dy); if (mLockableScrollChangedListener != null) { mLockableScrollChangedListener.onSmoothScrollBy(dx, dy); } }
java
void wrappedSmoothScrollBy(int dx, int dy) { if (!mScrollable) { return; } smoothScrollBy(dx, dy); if (mLockableScrollChangedListener != null) { mLockableScrollChangedListener.onSmoothScrollBy(dx, dy); } }
[ "void", "wrappedSmoothScrollBy", "(", "int", "dx", ",", "int", "dy", ")", "{", "if", "(", "!", "mScrollable", ")", "{", "return", ";", "}", "smoothScrollBy", "(", "dx", ",", "dy", ")", ";", "if", "(", "mLockableScrollChangedListener", "!=", "null", ")", "{", "mLockableScrollChangedListener", ".", "onSmoothScrollBy", "(", "dx", ",", "dy", ")", ";", "}", "}" ]
Wrapping the {@link HorizontalScrollView#smoothScrollBy(int, int)} function to increase testability. @param dx the number of pixels to scroll by on the X axis @param dy the number of pixels to scroll by on the Y axis
[ "Wrapping", "the", "{", "@link", "HorizontalScrollView#smoothScrollBy", "(", "int", "int", ")", "}", "function", "to", "increase", "testability", "." ]
train
https://github.com/stripe/stripe-android/blob/0f199255f3769a3b84583fe3ace47bfae8c3b1c8/stripe/src/main/java/com/stripe/android/view/LockableHorizontalScrollView.java#L90-L99
pip-services3-java/pip-services3-commons-java
src/org/pipservices3/commons/reflect/TypeReflector.java
TypeReflector.createInstanceByType
public static Object createInstanceByType(Class<?> type, Object... args) throws Exception { """ Creates an instance of an object type. @param type an object type (factory function) to create. @param args arguments for the object constructor. @return the created object instance. @throws Exception when constructors with parameters are not supported """ if (args.length == 0) { Constructor<?> constructor = type.getConstructor(); return constructor.newInstance(); } else { throw new UnsupportedException(null, "NOT_SUPPORTED", "Constructors with parameters are not supported"); } }
java
public static Object createInstanceByType(Class<?> type, Object... args) throws Exception { if (args.length == 0) { Constructor<?> constructor = type.getConstructor(); return constructor.newInstance(); } else { throw new UnsupportedException(null, "NOT_SUPPORTED", "Constructors with parameters are not supported"); } }
[ "public", "static", "Object", "createInstanceByType", "(", "Class", "<", "?", ">", "type", ",", "Object", "...", "args", ")", "throws", "Exception", "{", "if", "(", "args", ".", "length", "==", "0", ")", "{", "Constructor", "<", "?", ">", "constructor", "=", "type", ".", "getConstructor", "(", ")", ";", "return", "constructor", ".", "newInstance", "(", ")", ";", "}", "else", "{", "throw", "new", "UnsupportedException", "(", "null", ",", "\"NOT_SUPPORTED\"", ",", "\"Constructors with parameters are not supported\"", ")", ";", "}", "}" ]
Creates an instance of an object type. @param type an object type (factory function) to create. @param args arguments for the object constructor. @return the created object instance. @throws Exception when constructors with parameters are not supported
[ "Creates", "an", "instance", "of", "an", "object", "type", "." ]
train
https://github.com/pip-services3-java/pip-services3-commons-java/blob/a8a0c3e5ec58f0663c295aa855c6b3afad2af86a/src/org/pipservices3/commons/reflect/TypeReflector.java#L91-L98
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/misc/PixelMath.java
PixelMath.boundImage
public static void boundImage( GrayS64 img , long min , long max ) { """ Bounds image pixels to be between these two values @param img Image @param min minimum value. @param max maximum value. """ ImplPixelMath.boundImage(img,min,max); }
java
public static void boundImage( GrayS64 img , long min , long max ) { ImplPixelMath.boundImage(img,min,max); }
[ "public", "static", "void", "boundImage", "(", "GrayS64", "img", ",", "long", "min", ",", "long", "max", ")", "{", "ImplPixelMath", ".", "boundImage", "(", "img", ",", "min", ",", "max", ")", ";", "}" ]
Bounds image pixels to be between these two values @param img Image @param min minimum value. @param max maximum value.
[ "Bounds", "image", "pixels", "to", "be", "between", "these", "two", "values" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/misc/PixelMath.java#L4453-L4455
ow2-chameleon/fuchsia
bases/knx/calimero/src/main/java/tuwien/auto/calimero/tools/ProcComm.java
ProcComm.createLink
private KNXNetworkLink createLink() throws KNXException { """ Creates the KNX network link to access the network specified in <code>options</code>. <p> @return the KNX network link @throws KNXException on problems on link creation """ final KNXMediumSettings medium = (KNXMediumSettings) options.get("medium"); if (options.containsKey("serial")) { // create FT1.2 network link final String p = (String) options.get("serial"); try { return new KNXNetworkLinkFT12(Integer.parseInt(p), medium); } catch (final NumberFormatException e) { return new KNXNetworkLinkFT12(p, medium); } } // create local and remote socket address for network link final InetSocketAddress local = createLocalSocket((InetAddress) options.get("localhost"), (Integer) options.get("localport")); final InetSocketAddress host = new InetSocketAddress((InetAddress) options.get("host"), ((Integer) options.get("port")).intValue()); final int mode = options.containsKey("routing") ? KNXNetworkLinkIP.ROUTER : KNXNetworkLinkIP.TUNNEL; return new KNXNetworkLinkIP(mode, local, host, options.containsKey("nat"), medium); }
java
private KNXNetworkLink createLink() throws KNXException { final KNXMediumSettings medium = (KNXMediumSettings) options.get("medium"); if (options.containsKey("serial")) { // create FT1.2 network link final String p = (String) options.get("serial"); try { return new KNXNetworkLinkFT12(Integer.parseInt(p), medium); } catch (final NumberFormatException e) { return new KNXNetworkLinkFT12(p, medium); } } // create local and remote socket address for network link final InetSocketAddress local = createLocalSocket((InetAddress) options.get("localhost"), (Integer) options.get("localport")); final InetSocketAddress host = new InetSocketAddress((InetAddress) options.get("host"), ((Integer) options.get("port")).intValue()); final int mode = options.containsKey("routing") ? KNXNetworkLinkIP.ROUTER : KNXNetworkLinkIP.TUNNEL; return new KNXNetworkLinkIP(mode, local, host, options.containsKey("nat"), medium); }
[ "private", "KNXNetworkLink", "createLink", "(", ")", "throws", "KNXException", "{", "final", "KNXMediumSettings", "medium", "=", "(", "KNXMediumSettings", ")", "options", ".", "get", "(", "\"medium\"", ")", ";", "if", "(", "options", ".", "containsKey", "(", "\"serial\"", ")", ")", "{", "// create FT1.2 network link\r", "final", "String", "p", "=", "(", "String", ")", "options", ".", "get", "(", "\"serial\"", ")", ";", "try", "{", "return", "new", "KNXNetworkLinkFT12", "(", "Integer", ".", "parseInt", "(", "p", ")", ",", "medium", ")", ";", "}", "catch", "(", "final", "NumberFormatException", "e", ")", "{", "return", "new", "KNXNetworkLinkFT12", "(", "p", ",", "medium", ")", ";", "}", "}", "// create local and remote socket address for network link\r", "final", "InetSocketAddress", "local", "=", "createLocalSocket", "(", "(", "InetAddress", ")", "options", ".", "get", "(", "\"localhost\"", ")", ",", "(", "Integer", ")", "options", ".", "get", "(", "\"localport\"", ")", ")", ";", "final", "InetSocketAddress", "host", "=", "new", "InetSocketAddress", "(", "(", "InetAddress", ")", "options", ".", "get", "(", "\"host\"", ")", ",", "(", "(", "Integer", ")", "options", ".", "get", "(", "\"port\"", ")", ")", ".", "intValue", "(", ")", ")", ";", "final", "int", "mode", "=", "options", ".", "containsKey", "(", "\"routing\"", ")", "?", "KNXNetworkLinkIP", ".", "ROUTER", ":", "KNXNetworkLinkIP", ".", "TUNNEL", ";", "return", "new", "KNXNetworkLinkIP", "(", "mode", ",", "local", ",", "host", ",", "options", ".", "containsKey", "(", "\"nat\"", ")", ",", "medium", ")", ";", "}" ]
Creates the KNX network link to access the network specified in <code>options</code>. <p> @return the KNX network link @throws KNXException on problems on link creation
[ "Creates", "the", "KNX", "network", "link", "to", "access", "the", "network", "specified", "in", "<code", ">", "options<", "/", "code", ">", ".", "<p", ">" ]
train
https://github.com/ow2-chameleon/fuchsia/blob/4e9318eadbdeb945e529789f573b45386e619bed/bases/knx/calimero/src/main/java/tuwien/auto/calimero/tools/ProcComm.java#L240-L262
beangle/beangle3
commons/core/src/main/java/org/beangle/commons/lang/Strings.java
Strings.splitToLong
public static Long[] splitToLong(final String ids) { """ <p> splitToLong. </p> @param ids a {@link java.lang.String} object. @return an array of {@link java.lang.Long} objects. """ if (isEmpty(ids)) { return new Long[0]; } else { return transformToLong(split(ids, ',')); } }
java
public static Long[] splitToLong(final String ids) { if (isEmpty(ids)) { return new Long[0]; } else { return transformToLong(split(ids, ',')); } }
[ "public", "static", "Long", "[", "]", "splitToLong", "(", "final", "String", "ids", ")", "{", "if", "(", "isEmpty", "(", "ids", ")", ")", "{", "return", "new", "Long", "[", "0", "]", ";", "}", "else", "{", "return", "transformToLong", "(", "split", "(", "ids", ",", "'", "'", ")", ")", ";", "}", "}" ]
<p> splitToLong. </p> @param ids a {@link java.lang.String} object. @return an array of {@link java.lang.Long} objects.
[ "<p", ">", "splitToLong", ".", "<", "/", "p", ">" ]
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/commons/core/src/main/java/org/beangle/commons/lang/Strings.java#L954-L960
elastic/elasticsearch-hadoop
mr/src/main/java/org/elasticsearch/hadoop/util/encoding/HttpEncodingTools.java
HttpEncodingTools.concatenateAndUriEncode
public static String concatenateAndUriEncode(Collection<?> list, String delimiter) { """ Encodes each string value of the list and concatenates the results using the supplied delimiter. @param list To be encoded and concatenated. @param delimiter Separator for concatenation. @return Concatenated and encoded string representation. """ Collection<String> escaped = new ArrayList<String>(); if (list != null) { for (Object object : list) { escaped.add(encode(object.toString())); } } return StringUtils.concatenate(escaped, delimiter); }
java
public static String concatenateAndUriEncode(Collection<?> list, String delimiter) { Collection<String> escaped = new ArrayList<String>(); if (list != null) { for (Object object : list) { escaped.add(encode(object.toString())); } } return StringUtils.concatenate(escaped, delimiter); }
[ "public", "static", "String", "concatenateAndUriEncode", "(", "Collection", "<", "?", ">", "list", ",", "String", "delimiter", ")", "{", "Collection", "<", "String", ">", "escaped", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "if", "(", "list", "!=", "null", ")", "{", "for", "(", "Object", "object", ":", "list", ")", "{", "escaped", ".", "add", "(", "encode", "(", "object", ".", "toString", "(", ")", ")", ")", ";", "}", "}", "return", "StringUtils", ".", "concatenate", "(", "escaped", ",", "delimiter", ")", ";", "}" ]
Encodes each string value of the list and concatenates the results using the supplied delimiter. @param list To be encoded and concatenated. @param delimiter Separator for concatenation. @return Concatenated and encoded string representation.
[ "Encodes", "each", "string", "value", "of", "the", "list", "and", "concatenates", "the", "results", "using", "the", "supplied", "delimiter", "." ]
train
https://github.com/elastic/elasticsearch-hadoop/blob/f3acaba268ff96efae8eb946088c748c777c22cc/mr/src/main/java/org/elasticsearch/hadoop/util/encoding/HttpEncodingTools.java#L115-L124
google/closure-templates
java/src/com/google/template/soy/passes/StrictDepsPass.java
StrictDepsPass.checkBasicCall
private void checkBasicCall(CallBasicNode node, TemplateRegistry registry) { """ in a different part of the dependency graph (if it's late-bound). """ TemplateMetadata callee = registry.getBasicTemplateOrElement(node.getCalleeName()); if (callee == null) { String extraErrorMessage = SoyErrors.getDidYouMeanMessage( registry.getBasicTemplateOrElementNames(), node.getCalleeName()); errorReporter.report( node.getSourceLocation(), CALL_TO_UNDEFINED_TEMPLATE, node.getCalleeName(), extraErrorMessage); } else { SoyFileKind calleeKind = callee.getSoyFileKind(); String callerFilePath = node.getSourceLocation().getFilePath(); String calleeFilePath = callee.getSourceLocation().getFilePath(); if (calleeKind == SoyFileKind.INDIRECT_DEP) { errorReporter.report( node.getSourceLocation(), CALL_TO_INDIRECT_DEPENDENCY, calleeFilePath); } } }
java
private void checkBasicCall(CallBasicNode node, TemplateRegistry registry) { TemplateMetadata callee = registry.getBasicTemplateOrElement(node.getCalleeName()); if (callee == null) { String extraErrorMessage = SoyErrors.getDidYouMeanMessage( registry.getBasicTemplateOrElementNames(), node.getCalleeName()); errorReporter.report( node.getSourceLocation(), CALL_TO_UNDEFINED_TEMPLATE, node.getCalleeName(), extraErrorMessage); } else { SoyFileKind calleeKind = callee.getSoyFileKind(); String callerFilePath = node.getSourceLocation().getFilePath(); String calleeFilePath = callee.getSourceLocation().getFilePath(); if (calleeKind == SoyFileKind.INDIRECT_DEP) { errorReporter.report( node.getSourceLocation(), CALL_TO_INDIRECT_DEPENDENCY, calleeFilePath); } } }
[ "private", "void", "checkBasicCall", "(", "CallBasicNode", "node", ",", "TemplateRegistry", "registry", ")", "{", "TemplateMetadata", "callee", "=", "registry", ".", "getBasicTemplateOrElement", "(", "node", ".", "getCalleeName", "(", ")", ")", ";", "if", "(", "callee", "==", "null", ")", "{", "String", "extraErrorMessage", "=", "SoyErrors", ".", "getDidYouMeanMessage", "(", "registry", ".", "getBasicTemplateOrElementNames", "(", ")", ",", "node", ".", "getCalleeName", "(", ")", ")", ";", "errorReporter", ".", "report", "(", "node", ".", "getSourceLocation", "(", ")", ",", "CALL_TO_UNDEFINED_TEMPLATE", ",", "node", ".", "getCalleeName", "(", ")", ",", "extraErrorMessage", ")", ";", "}", "else", "{", "SoyFileKind", "calleeKind", "=", "callee", ".", "getSoyFileKind", "(", ")", ";", "String", "callerFilePath", "=", "node", ".", "getSourceLocation", "(", ")", ".", "getFilePath", "(", ")", ";", "String", "calleeFilePath", "=", "callee", ".", "getSourceLocation", "(", ")", ".", "getFilePath", "(", ")", ";", "if", "(", "calleeKind", "==", "SoyFileKind", ".", "INDIRECT_DEP", ")", "{", "errorReporter", ".", "report", "(", "node", ".", "getSourceLocation", "(", ")", ",", "CALL_TO_INDIRECT_DEPENDENCY", ",", "calleeFilePath", ")", ";", "}", "}", "}" ]
in a different part of the dependency graph (if it's late-bound).
[ "in", "a", "different", "part", "of", "the", "dependency", "graph", "(", "if", "it", "s", "late", "-", "bound", ")", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/passes/StrictDepsPass.java#L66-L89
blinkfox/zealot
src/main/java/com/blinkfox/zealot/core/builder/XmlSqlInfoBuilder.java
XmlSqlInfoBuilder.buildLikeSql
public SqlInfo buildLikeSql(String fieldText, String valueText, String patternText) { """ 构建Like模糊查询的sqlInfo信息. @param fieldText 字段文本值 @param valueText 参数值 @param patternText 模式字符串文本 @return 返回SqlInfo信息 """ if (StringHelper.isNotBlank(valueText) && StringHelper.isBlank(patternText)) { return super.buildLikeSql(fieldText, ParseHelper.parseExpressWithException(valueText, context)); } else if (StringHelper.isBlank(valueText) && StringHelper.isNotBlank(patternText)) { return super.buildLikePatternSql(fieldText, patternText); } else { throw new ValidFailException("<like /> 标签中的'value'属性和'pattern'属性不能同时为空或者同时不为空!"); } }
java
public SqlInfo buildLikeSql(String fieldText, String valueText, String patternText) { if (StringHelper.isNotBlank(valueText) && StringHelper.isBlank(patternText)) { return super.buildLikeSql(fieldText, ParseHelper.parseExpressWithException(valueText, context)); } else if (StringHelper.isBlank(valueText) && StringHelper.isNotBlank(patternText)) { return super.buildLikePatternSql(fieldText, patternText); } else { throw new ValidFailException("<like /> 标签中的'value'属性和'pattern'属性不能同时为空或者同时不为空!"); } }
[ "public", "SqlInfo", "buildLikeSql", "(", "String", "fieldText", ",", "String", "valueText", ",", "String", "patternText", ")", "{", "if", "(", "StringHelper", ".", "isNotBlank", "(", "valueText", ")", "&&", "StringHelper", ".", "isBlank", "(", "patternText", ")", ")", "{", "return", "super", ".", "buildLikeSql", "(", "fieldText", ",", "ParseHelper", ".", "parseExpressWithException", "(", "valueText", ",", "context", ")", ")", ";", "}", "else", "if", "(", "StringHelper", ".", "isBlank", "(", "valueText", ")", "&&", "StringHelper", ".", "isNotBlank", "(", "patternText", ")", ")", "{", "return", "super", ".", "buildLikePatternSql", "(", "fieldText", ",", "patternText", ")", ";", "}", "else", "{", "throw", "new", "ValidFailException", "(", "\"<like /> 标签中的'value'属性和'pattern'属性不能同时为空或者同时不为空!\");", "", "", "}", "}" ]
构建Like模糊查询的sqlInfo信息. @param fieldText 字段文本值 @param valueText 参数值 @param patternText 模式字符串文本 @return 返回SqlInfo信息
[ "构建Like模糊查询的sqlInfo信息", "." ]
train
https://github.com/blinkfox/zealot/blob/21b00fa3e4ed42188eef3116d494e112e7a4194c/src/main/java/com/blinkfox/zealot/core/builder/XmlSqlInfoBuilder.java#L54-L62
rundeck/rundeck
core/src/main/java/com/dtolabs/utils/Streams.java
Streams.copyStreamCount
public static int copyStreamCount(final InputStream in, final OutputStream out) throws IOException { """ Read the data from the input stream and copy to the outputstream. @param in inputstream @param out outpustream @return number of bytes copied @throws java.io.IOException if thrown by underlying io operations """ final byte[] buffer = new byte[10240]; int tot=0; int c; c = in.read(buffer); while (c >= 0) { if (c > 0) { out.write(buffer, 0, c); tot += c; } c = in.read(buffer); } return tot; }
java
public static int copyStreamCount(final InputStream in, final OutputStream out) throws IOException { final byte[] buffer = new byte[10240]; int tot=0; int c; c = in.read(buffer); while (c >= 0) { if (c > 0) { out.write(buffer, 0, c); tot += c; } c = in.read(buffer); } return tot; }
[ "public", "static", "int", "copyStreamCount", "(", "final", "InputStream", "in", ",", "final", "OutputStream", "out", ")", "throws", "IOException", "{", "final", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "10240", "]", ";", "int", "tot", "=", "0", ";", "int", "c", ";", "c", "=", "in", ".", "read", "(", "buffer", ")", ";", "while", "(", "c", ">=", "0", ")", "{", "if", "(", "c", ">", "0", ")", "{", "out", ".", "write", "(", "buffer", ",", "0", ",", "c", ")", ";", "tot", "+=", "c", ";", "}", "c", "=", "in", ".", "read", "(", "buffer", ")", ";", "}", "return", "tot", ";", "}" ]
Read the data from the input stream and copy to the outputstream. @param in inputstream @param out outpustream @return number of bytes copied @throws java.io.IOException if thrown by underlying io operations
[ "Read", "the", "data", "from", "the", "input", "stream", "and", "copy", "to", "the", "outputstream", "." ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/utils/Streams.java#L60-L73
derari/cthul
xml/src/main/java/org/cthul/resolve/UriMappingResolver.java
UriMappingResolver.addDomain
public UriMappingResolver addDomain(String domain, String replacement) { """ Adds a domain for relative lookup. All uris starting with {@code domain} will be replaced with {@code replacement}. In the replacement string {@code "$1"}, will be replaced with path of the request uri. Path separators ({@code '/'}) between the domain and the path will be removed. @param domain @param replacement @return this """ addDomainPattern(quote(domain) + "[/]*(.*)", replacement); return this; }
java
public UriMappingResolver addDomain(String domain, String replacement) { addDomainPattern(quote(domain) + "[/]*(.*)", replacement); return this; }
[ "public", "UriMappingResolver", "addDomain", "(", "String", "domain", ",", "String", "replacement", ")", "{", "addDomainPattern", "(", "quote", "(", "domain", ")", "+", "\"[/]*(.*)\"", ",", "replacement", ")", ";", "return", "this", ";", "}" ]
Adds a domain for relative lookup. All uris starting with {@code domain} will be replaced with {@code replacement}. In the replacement string {@code "$1"}, will be replaced with path of the request uri. Path separators ({@code '/'}) between the domain and the path will be removed. @param domain @param replacement @return this
[ "Adds", "a", "domain", "for", "relative", "lookup", ".", "All", "uris", "starting", "with", "{" ]
train
https://github.com/derari/cthul/blob/74a31e3cb6a94f5f25cc5253d1dbd42e19a17ebc/xml/src/main/java/org/cthul/resolve/UriMappingResolver.java#L129-L132
PunchThrough/bean-sdk-android
sdk/src/main/java/com/punchthrough/bean/sdk/internal/utility/Chunk.java
Chunk.chunkCountFrom
public static <T extends Chunkable> int chunkCountFrom(T chunkable, int chunkLength) { """ Retrieve the count of chunks for a given chunk length. @param chunkLength The length of each chunk @return The number of chunks generated for a given chunk length """ byte[] data = chunkable.getChunkableData(); return (int) Math.ceil(data.length * 1.0 / chunkLength); }
java
public static <T extends Chunkable> int chunkCountFrom(T chunkable, int chunkLength) { byte[] data = chunkable.getChunkableData(); return (int) Math.ceil(data.length * 1.0 / chunkLength); }
[ "public", "static", "<", "T", "extends", "Chunkable", ">", "int", "chunkCountFrom", "(", "T", "chunkable", ",", "int", "chunkLength", ")", "{", "byte", "[", "]", "data", "=", "chunkable", ".", "getChunkableData", "(", ")", ";", "return", "(", "int", ")", "Math", ".", "ceil", "(", "data", ".", "length", "*", "1.0", "/", "chunkLength", ")", ";", "}" ]
Retrieve the count of chunks for a given chunk length. @param chunkLength The length of each chunk @return The number of chunks generated for a given chunk length
[ "Retrieve", "the", "count", "of", "chunks", "for", "a", "given", "chunk", "length", "." ]
train
https://github.com/PunchThrough/bean-sdk-android/blob/dc33e8cc9258d6e028e0788d74735c75b54d1133/sdk/src/main/java/com/punchthrough/bean/sdk/internal/utility/Chunk.java#L65-L68
zaproxy/zaproxy
src/org/zaproxy/zap/extension/ascan/ScanProgressDialog.java
ScanProgressDialog.getMainPanel
private JTable getMainPanel() { """ Get the main content panel of the dialog @return the main panel """ if (table == null) { model = new ScanProgressTableModel(); table = new JTable(); table.setModel(model); table.setRowSelectionAllowed(false); table.setColumnSelectionAllowed(false); table.setDoubleBuffered(true); // First column is for plugin's name table.getColumnModel().getColumn(0).setPreferredWidth(256); table.getColumnModel().getColumn(1).setPreferredWidth(80); // Second column is for plugin's status table.getColumnModel().getColumn(2).setPreferredWidth(80); table.getColumnModel().getColumn(2).setCellRenderer(new ScanProgressBarRenderer()); // Third column is for plugin's elapsed time DefaultTableCellRenderer centerRenderer = new DefaultTableCellRenderer(); centerRenderer.setHorizontalAlignment(JLabel.CENTER); table.getColumnModel().getColumn(3).setPreferredWidth(85); table.getColumnModel().getColumn(3).setCellRenderer(centerRenderer); // Forth column is for plugin's request count DefaultTableCellRenderer rightRenderer = new DefaultTableCellRenderer(); rightRenderer.setHorizontalAlignment(JLabel.RIGHT); table.getColumnModel().getColumn(4).setPreferredWidth(60); table.getColumnModel().getColumn(4).setCellRenderer(rightRenderer); table.getColumnModel().getColumn(5).setPreferredWidth(60); table.getColumnModel().getColumn(5).setCellRenderer(rightRenderer); // Fifth column is for plugin's completion and actions table.getColumnModel().getColumn(6).setPreferredWidth(40); table.getColumnModel().getColumn(6).setCellRenderer(new ScanProgressActionRenderer()); ScanProgressActionListener listener = new ScanProgressActionListener(table, model); table.addMouseListener(listener); table.addMouseMotionListener(listener); } return table; }
java
private JTable getMainPanel() { if (table == null) { model = new ScanProgressTableModel(); table = new JTable(); table.setModel(model); table.setRowSelectionAllowed(false); table.setColumnSelectionAllowed(false); table.setDoubleBuffered(true); // First column is for plugin's name table.getColumnModel().getColumn(0).setPreferredWidth(256); table.getColumnModel().getColumn(1).setPreferredWidth(80); // Second column is for plugin's status table.getColumnModel().getColumn(2).setPreferredWidth(80); table.getColumnModel().getColumn(2).setCellRenderer(new ScanProgressBarRenderer()); // Third column is for plugin's elapsed time DefaultTableCellRenderer centerRenderer = new DefaultTableCellRenderer(); centerRenderer.setHorizontalAlignment(JLabel.CENTER); table.getColumnModel().getColumn(3).setPreferredWidth(85); table.getColumnModel().getColumn(3).setCellRenderer(centerRenderer); // Forth column is for plugin's request count DefaultTableCellRenderer rightRenderer = new DefaultTableCellRenderer(); rightRenderer.setHorizontalAlignment(JLabel.RIGHT); table.getColumnModel().getColumn(4).setPreferredWidth(60); table.getColumnModel().getColumn(4).setCellRenderer(rightRenderer); table.getColumnModel().getColumn(5).setPreferredWidth(60); table.getColumnModel().getColumn(5).setCellRenderer(rightRenderer); // Fifth column is for plugin's completion and actions table.getColumnModel().getColumn(6).setPreferredWidth(40); table.getColumnModel().getColumn(6).setCellRenderer(new ScanProgressActionRenderer()); ScanProgressActionListener listener = new ScanProgressActionListener(table, model); table.addMouseListener(listener); table.addMouseMotionListener(listener); } return table; }
[ "private", "JTable", "getMainPanel", "(", ")", "{", "if", "(", "table", "==", "null", ")", "{", "model", "=", "new", "ScanProgressTableModel", "(", ")", ";", "table", "=", "new", "JTable", "(", ")", ";", "table", ".", "setModel", "(", "model", ")", ";", "table", ".", "setRowSelectionAllowed", "(", "false", ")", ";", "table", ".", "setColumnSelectionAllowed", "(", "false", ")", ";", "table", ".", "setDoubleBuffered", "(", "true", ")", ";", "// First column is for plugin's name", "table", ".", "getColumnModel", "(", ")", ".", "getColumn", "(", "0", ")", ".", "setPreferredWidth", "(", "256", ")", ";", "table", ".", "getColumnModel", "(", ")", ".", "getColumn", "(", "1", ")", ".", "setPreferredWidth", "(", "80", ")", ";", "// Second column is for plugin's status", "table", ".", "getColumnModel", "(", ")", ".", "getColumn", "(", "2", ")", ".", "setPreferredWidth", "(", "80", ")", ";", "table", ".", "getColumnModel", "(", ")", ".", "getColumn", "(", "2", ")", ".", "setCellRenderer", "(", "new", "ScanProgressBarRenderer", "(", ")", ")", ";", "// Third column is for plugin's elapsed time", "DefaultTableCellRenderer", "centerRenderer", "=", "new", "DefaultTableCellRenderer", "(", ")", ";", "centerRenderer", ".", "setHorizontalAlignment", "(", "JLabel", ".", "CENTER", ")", ";", "table", ".", "getColumnModel", "(", ")", ".", "getColumn", "(", "3", ")", ".", "setPreferredWidth", "(", "85", ")", ";", "table", ".", "getColumnModel", "(", ")", ".", "getColumn", "(", "3", ")", ".", "setCellRenderer", "(", "centerRenderer", ")", ";", "// Forth column is for plugin's request count", "DefaultTableCellRenderer", "rightRenderer", "=", "new", "DefaultTableCellRenderer", "(", ")", ";", "rightRenderer", ".", "setHorizontalAlignment", "(", "JLabel", ".", "RIGHT", ")", ";", "table", ".", "getColumnModel", "(", ")", ".", "getColumn", "(", "4", ")", ".", "setPreferredWidth", "(", "60", ")", ";", "table", ".", "getColumnModel", "(", ")", ".", "getColumn", "(", "4", ")", ".", "setCellRenderer", "(", "rightRenderer", ")", ";", "table", ".", "getColumnModel", "(", ")", ".", "getColumn", "(", "5", ")", ".", "setPreferredWidth", "(", "60", ")", ";", "table", ".", "getColumnModel", "(", ")", ".", "getColumn", "(", "5", ")", ".", "setCellRenderer", "(", "rightRenderer", ")", ";", "// Fifth column is for plugin's completion and actions", "table", ".", "getColumnModel", "(", ")", ".", "getColumn", "(", "6", ")", ".", "setPreferredWidth", "(", "40", ")", ";", "table", ".", "getColumnModel", "(", ")", ".", "getColumn", "(", "6", ")", ".", "setCellRenderer", "(", "new", "ScanProgressActionRenderer", "(", ")", ")", ";", "ScanProgressActionListener", "listener", "=", "new", "ScanProgressActionListener", "(", "table", ",", "model", ")", ";", "table", ".", "addMouseListener", "(", "listener", ")", ";", "table", ".", "addMouseMotionListener", "(", "listener", ")", ";", "}", "return", "table", ";", "}" ]
Get the main content panel of the dialog @return the main panel
[ "Get", "the", "main", "content", "panel", "of", "the", "dialog" ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/ascan/ScanProgressDialog.java#L311-L354
shekhargulati/strman-java
src/main/java/strman/Strman.java
Strman.toDecamelize
public static String toDecamelize(final String value, final String chr) { """ Decamelize String @param value The input String @param chr string to use @return String decamelized. """ String camelCasedString = toCamelCase(value); String[] words = camelCasedString.split("(?=\\p{Upper})"); return Arrays.stream(words).map(String::toLowerCase).collect(joining(Optional.ofNullable(chr).orElse(" "))); }
java
public static String toDecamelize(final String value, final String chr) { String camelCasedString = toCamelCase(value); String[] words = camelCasedString.split("(?=\\p{Upper})"); return Arrays.stream(words).map(String::toLowerCase).collect(joining(Optional.ofNullable(chr).orElse(" "))); }
[ "public", "static", "String", "toDecamelize", "(", "final", "String", "value", ",", "final", "String", "chr", ")", "{", "String", "camelCasedString", "=", "toCamelCase", "(", "value", ")", ";", "String", "[", "]", "words", "=", "camelCasedString", ".", "split", "(", "\"(?=\\\\p{Upper})\"", ")", ";", "return", "Arrays", ".", "stream", "(", "words", ")", ".", "map", "(", "String", "::", "toLowerCase", ")", ".", "collect", "(", "joining", "(", "Optional", ".", "ofNullable", "(", "chr", ")", ".", "orElse", "(", "\" \"", ")", ")", ")", ";", "}" ]
Decamelize String @param value The input String @param chr string to use @return String decamelized.
[ "Decamelize", "String" ]
train
https://github.com/shekhargulati/strman-java/blob/d0c2a10a6273fd6082f084e95156653ca55ce1be/src/main/java/strman/Strman.java#L1092-L1096
cloudfoundry/uaa
server/src/main/java/org/cloudfoundry/identity/uaa/provider/saml/idp/IdpMetadataGeneratorFilter.java
IdpMetadataGeneratorFilter.processMetadataInitialization
protected void processMetadataInitialization(HttpServletRequest request) throws ServletException { """ Verifies whether generation is needed and if so the metadata document is created and stored in metadata manager. @param request request @throws javax.servlet.ServletException error """ // In case the hosted IdP metadata weren't initialized, let's do it now if (manager.getHostedIdpName() == null) { synchronized (IdpMetadataManager.class) { if (manager.getHostedIdpName() == null) { try { log.info( "No default metadata configured, generating with default values, please pre-configure metadata for production use"); // Defaults String alias = generator.getEntityAlias(); String baseURL = getDefaultBaseURL(request); // Use default baseURL if not set if (generator.getEntityBaseURL() == null) { log.warn( "Generated default entity base URL {} based on values in the first server request. Please set property entityBaseURL on MetadataGenerator bean to fixate the value.", baseURL); generator.setEntityBaseURL(baseURL); } else { baseURL = generator.getEntityBaseURL(); } // Use default entityID if not set if (generator.getEntityId() == null) { generator.setEntityId(getDefaultEntityID(baseURL, alias)); } // Ensure supported nameID formats in uaa are listed in the metadata Collection<String> supportedNameID = Arrays.asList(NameIDType.EMAIL, NameIDType.PERSISTENT, NameIDType.UNSPECIFIED); generator.setNameID(supportedNameID); EntityDescriptor descriptor = generator.generateMetadata(); ExtendedMetadata extendedMetadata = generator.generateExtendedMetadata(); log.info("Created default metadata for system with entityID: " + descriptor.getEntityID()); MetadataMemoryProvider memoryProvider = new MetadataMemoryProvider(descriptor); memoryProvider.initialize(); MetadataProvider metadataProvider = new ExtendedMetadataDelegate(memoryProvider, extendedMetadata); manager.addMetadataProvider(metadataProvider); manager.setHostedIdpName(descriptor.getEntityID()); manager.refreshMetadata(); } catch (MetadataProviderException e) { log.error("Error generating system metadata", e); throw new ServletException("Error generating system metadata", e); } } } } }
java
protected void processMetadataInitialization(HttpServletRequest request) throws ServletException { // In case the hosted IdP metadata weren't initialized, let's do it now if (manager.getHostedIdpName() == null) { synchronized (IdpMetadataManager.class) { if (manager.getHostedIdpName() == null) { try { log.info( "No default metadata configured, generating with default values, please pre-configure metadata for production use"); // Defaults String alias = generator.getEntityAlias(); String baseURL = getDefaultBaseURL(request); // Use default baseURL if not set if (generator.getEntityBaseURL() == null) { log.warn( "Generated default entity base URL {} based on values in the first server request. Please set property entityBaseURL on MetadataGenerator bean to fixate the value.", baseURL); generator.setEntityBaseURL(baseURL); } else { baseURL = generator.getEntityBaseURL(); } // Use default entityID if not set if (generator.getEntityId() == null) { generator.setEntityId(getDefaultEntityID(baseURL, alias)); } // Ensure supported nameID formats in uaa are listed in the metadata Collection<String> supportedNameID = Arrays.asList(NameIDType.EMAIL, NameIDType.PERSISTENT, NameIDType.UNSPECIFIED); generator.setNameID(supportedNameID); EntityDescriptor descriptor = generator.generateMetadata(); ExtendedMetadata extendedMetadata = generator.generateExtendedMetadata(); log.info("Created default metadata for system with entityID: " + descriptor.getEntityID()); MetadataMemoryProvider memoryProvider = new MetadataMemoryProvider(descriptor); memoryProvider.initialize(); MetadataProvider metadataProvider = new ExtendedMetadataDelegate(memoryProvider, extendedMetadata); manager.addMetadataProvider(metadataProvider); manager.setHostedIdpName(descriptor.getEntityID()); manager.refreshMetadata(); } catch (MetadataProviderException e) { log.error("Error generating system metadata", e); throw new ServletException("Error generating system metadata", e); } } } } }
[ "protected", "void", "processMetadataInitialization", "(", "HttpServletRequest", "request", ")", "throws", "ServletException", "{", "// In case the hosted IdP metadata weren't initialized, let's do it now", "if", "(", "manager", ".", "getHostedIdpName", "(", ")", "==", "null", ")", "{", "synchronized", "(", "IdpMetadataManager", ".", "class", ")", "{", "if", "(", "manager", ".", "getHostedIdpName", "(", ")", "==", "null", ")", "{", "try", "{", "log", ".", "info", "(", "\"No default metadata configured, generating with default values, please pre-configure metadata for production use\"", ")", ";", "// Defaults", "String", "alias", "=", "generator", ".", "getEntityAlias", "(", ")", ";", "String", "baseURL", "=", "getDefaultBaseURL", "(", "request", ")", ";", "// Use default baseURL if not set", "if", "(", "generator", ".", "getEntityBaseURL", "(", ")", "==", "null", ")", "{", "log", ".", "warn", "(", "\"Generated default entity base URL {} based on values in the first server request. Please set property entityBaseURL on MetadataGenerator bean to fixate the value.\"", ",", "baseURL", ")", ";", "generator", ".", "setEntityBaseURL", "(", "baseURL", ")", ";", "}", "else", "{", "baseURL", "=", "generator", ".", "getEntityBaseURL", "(", ")", ";", "}", "// Use default entityID if not set", "if", "(", "generator", ".", "getEntityId", "(", ")", "==", "null", ")", "{", "generator", ".", "setEntityId", "(", "getDefaultEntityID", "(", "baseURL", ",", "alias", ")", ")", ";", "}", "// Ensure supported nameID formats in uaa are listed in the metadata", "Collection", "<", "String", ">", "supportedNameID", "=", "Arrays", ".", "asList", "(", "NameIDType", ".", "EMAIL", ",", "NameIDType", ".", "PERSISTENT", ",", "NameIDType", ".", "UNSPECIFIED", ")", ";", "generator", ".", "setNameID", "(", "supportedNameID", ")", ";", "EntityDescriptor", "descriptor", "=", "generator", ".", "generateMetadata", "(", ")", ";", "ExtendedMetadata", "extendedMetadata", "=", "generator", ".", "generateExtendedMetadata", "(", ")", ";", "log", ".", "info", "(", "\"Created default metadata for system with entityID: \"", "+", "descriptor", ".", "getEntityID", "(", ")", ")", ";", "MetadataMemoryProvider", "memoryProvider", "=", "new", "MetadataMemoryProvider", "(", "descriptor", ")", ";", "memoryProvider", ".", "initialize", "(", ")", ";", "MetadataProvider", "metadataProvider", "=", "new", "ExtendedMetadataDelegate", "(", "memoryProvider", ",", "extendedMetadata", ")", ";", "manager", ".", "addMetadataProvider", "(", "metadataProvider", ")", ";", "manager", ".", "setHostedIdpName", "(", "descriptor", ".", "getEntityID", "(", ")", ")", ";", "manager", ".", "refreshMetadata", "(", ")", ";", "}", "catch", "(", "MetadataProviderException", "e", ")", "{", "log", ".", "error", "(", "\"Error generating system metadata\"", ",", "e", ")", ";", "throw", "new", "ServletException", "(", "\"Error generating system metadata\"", ",", "e", ")", ";", "}", "}", "}", "}", "}" ]
Verifies whether generation is needed and if so the metadata document is created and stored in metadata manager. @param request request @throws javax.servlet.ServletException error
[ "Verifies", "whether", "generation", "is", "needed", "and", "if", "so", "the", "metadata", "document", "is", "created", "and", "stored", "in", "metadata", "manager", "." ]
train
https://github.com/cloudfoundry/uaa/blob/e8df3d7060580c92d33461106399f9e4f36e3cd2/server/src/main/java/org/cloudfoundry/identity/uaa/provider/saml/idp/IdpMetadataGeneratorFilter.java#L101-L163
phax/ph-datetime
ph-holiday/src/main/java/com/helger/holiday/parser/AbstractHolidayParser.java
AbstractHolidayParser.moveDate
protected static final LocalDate moveDate (final MoveableHoliday aMoveableHoliday, final LocalDate aFixed) { """ Moves a date if there are any moving conditions for this holiday and any of them fit. @param aMoveableHoliday Date @param aFixed Optional fixed date @return the moved date """ for (final MovingCondition aMoveCond : aMoveableHoliday.getMovingCondition ()) if (shallBeMoved (aFixed, aMoveCond)) return _moveDate (aMoveCond, aFixed); return aFixed; }
java
protected static final LocalDate moveDate (final MoveableHoliday aMoveableHoliday, final LocalDate aFixed) { for (final MovingCondition aMoveCond : aMoveableHoliday.getMovingCondition ()) if (shallBeMoved (aFixed, aMoveCond)) return _moveDate (aMoveCond, aFixed); return aFixed; }
[ "protected", "static", "final", "LocalDate", "moveDate", "(", "final", "MoveableHoliday", "aMoveableHoliday", ",", "final", "LocalDate", "aFixed", ")", "{", "for", "(", "final", "MovingCondition", "aMoveCond", ":", "aMoveableHoliday", ".", "getMovingCondition", "(", ")", ")", "if", "(", "shallBeMoved", "(", "aFixed", ",", "aMoveCond", ")", ")", "return", "_moveDate", "(", "aMoveCond", ",", "aFixed", ")", ";", "return", "aFixed", ";", "}" ]
Moves a date if there are any moving conditions for this holiday and any of them fit. @param aMoveableHoliday Date @param aFixed Optional fixed date @return the moved date
[ "Moves", "a", "date", "if", "there", "are", "any", "moving", "conditions", "for", "this", "holiday", "and", "any", "of", "them", "fit", "." ]
train
https://github.com/phax/ph-datetime/blob/cfaff01cb76d9affb934800ff55734b5a7d8983e/ph-holiday/src/main/java/com/helger/holiday/parser/AbstractHolidayParser.java#L162-L168
apache/flink
flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/asm/translate/Translate.java
Translate.translateVertexValues
public static <K, OLD, NEW> DataSet<Vertex<K, NEW>> translateVertexValues(DataSet<Vertex<K, OLD>> vertices, TranslateFunction<OLD, NEW> translator) { """ Translate {@link Vertex} values using the given {@link TranslateFunction}. @param vertices input vertices @param translator implements conversion from {@code OLD} to {@code NEW} @param <K> vertex ID type @param <OLD> old vertex value type @param <NEW> new vertex value type @return translated vertices """ return translateVertexValues(vertices, translator, PARALLELISM_DEFAULT); }
java
public static <K, OLD, NEW> DataSet<Vertex<K, NEW>> translateVertexValues(DataSet<Vertex<K, OLD>> vertices, TranslateFunction<OLD, NEW> translator) { return translateVertexValues(vertices, translator, PARALLELISM_DEFAULT); }
[ "public", "static", "<", "K", ",", "OLD", ",", "NEW", ">", "DataSet", "<", "Vertex", "<", "K", ",", "NEW", ">", ">", "translateVertexValues", "(", "DataSet", "<", "Vertex", "<", "K", ",", "OLD", ">", ">", "vertices", ",", "TranslateFunction", "<", "OLD", ",", "NEW", ">", "translator", ")", "{", "return", "translateVertexValues", "(", "vertices", ",", "translator", ",", "PARALLELISM_DEFAULT", ")", ";", "}" ]
Translate {@link Vertex} values using the given {@link TranslateFunction}. @param vertices input vertices @param translator implements conversion from {@code OLD} to {@code NEW} @param <K> vertex ID type @param <OLD> old vertex value type @param <NEW> new vertex value type @return translated vertices
[ "Translate", "{", "@link", "Vertex", "}", "values", "using", "the", "given", "{", "@link", "TranslateFunction", "}", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-libraries/flink-gelly/src/main/java/org/apache/flink/graph/asm/translate/Translate.java#L221-L223
tvesalainen/util
util/src/main/java/org/vesalainen/math/Circles.java
Circles.isInside
public static boolean isInside(Circle c1, Circle c2) { """ Returns true if c2 is inside of c1 @param c1 @param c2 @return """ return distanceFromCenter(c1, c2.getX(), c2.getY())+c2.getRadius() < c1.getRadius(); }
java
public static boolean isInside(Circle c1, Circle c2) { return distanceFromCenter(c1, c2.getX(), c2.getY())+c2.getRadius() < c1.getRadius(); }
[ "public", "static", "boolean", "isInside", "(", "Circle", "c1", ",", "Circle", "c2", ")", "{", "return", "distanceFromCenter", "(", "c1", ",", "c2", ".", "getX", "(", ")", ",", "c2", ".", "getY", "(", ")", ")", "+", "c2", ".", "getRadius", "(", ")", "<", "c1", ".", "getRadius", "(", ")", ";", "}" ]
Returns true if c2 is inside of c1 @param c1 @param c2 @return
[ "Returns", "true", "if", "c2", "is", "inside", "of", "c1" ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/math/Circles.java#L60-L63
petergeneric/stdlib
stdlib/src/main/java/com/peterphi/std/types/CompareHelper.java
CompareHelper.ge
public static <T> boolean ge(Comparable<T> a, T b) { """ <code>a >= b</code> @param <T> @param a @param b @return true if a >= b """ return ge(a.compareTo(b)); }
java
public static <T> boolean ge(Comparable<T> a, T b) { return ge(a.compareTo(b)); }
[ "public", "static", "<", "T", ">", "boolean", "ge", "(", "Comparable", "<", "T", ">", "a", ",", "T", "b", ")", "{", "return", "ge", "(", "a", ".", "compareTo", "(", "b", ")", ")", ";", "}" ]
<code>a >= b</code> @param <T> @param a @param b @return true if a >= b
[ "<code", ">", "a", ">", "=", "b<", "/", "code", ">" ]
train
https://github.com/petergeneric/stdlib/blob/d4025d2f881bc0542b1e004c5f65a1ccaf895836/stdlib/src/main/java/com/peterphi/std/types/CompareHelper.java#L128-L131
foundation-runtime/service-directory
2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/connect/DirectoryConnection.java
DirectoryConnection.sendPing
private ErrorCode sendPing() throws IOException { """ Send the Ping Request. @return the ErrorCode, OK for success. @throws IOException the IOException. """ if(LOGGER.isTraceEnabled()){ LOGGER.trace("......................send Ping"); } lastPingSentNs = System.currentTimeMillis(); ProtocolHeader h = new ProtocolHeader(-2, ProtocolType.Ping); sendAdminPacket(h, null); int waitTime = session.pingWaitTimeOut; synchronized(pingResponse){ while(waitTime > 0){ try { pingResponse.wait(waitTime); } catch (InterruptedException e) { // Do nothing. } ResponseHeader header = pingResponse.get(); if (header != null) { pingResponse.set(null); return header.getErr(); } waitTime -= (System.currentTimeMillis() - lastPingSentNs); } } return ErrorCode.PING_TIMEOUT; }
java
private ErrorCode sendPing() throws IOException { if(LOGGER.isTraceEnabled()){ LOGGER.trace("......................send Ping"); } lastPingSentNs = System.currentTimeMillis(); ProtocolHeader h = new ProtocolHeader(-2, ProtocolType.Ping); sendAdminPacket(h, null); int waitTime = session.pingWaitTimeOut; synchronized(pingResponse){ while(waitTime > 0){ try { pingResponse.wait(waitTime); } catch (InterruptedException e) { // Do nothing. } ResponseHeader header = pingResponse.get(); if (header != null) { pingResponse.set(null); return header.getErr(); } waitTime -= (System.currentTimeMillis() - lastPingSentNs); } } return ErrorCode.PING_TIMEOUT; }
[ "private", "ErrorCode", "sendPing", "(", ")", "throws", "IOException", "{", "if", "(", "LOGGER", ".", "isTraceEnabled", "(", ")", ")", "{", "LOGGER", ".", "trace", "(", "\"......................send Ping\"", ")", ";", "}", "lastPingSentNs", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "ProtocolHeader", "h", "=", "new", "ProtocolHeader", "(", "-", "2", ",", "ProtocolType", ".", "Ping", ")", ";", "sendAdminPacket", "(", "h", ",", "null", ")", ";", "int", "waitTime", "=", "session", ".", "pingWaitTimeOut", ";", "synchronized", "(", "pingResponse", ")", "{", "while", "(", "waitTime", ">", "0", ")", "{", "try", "{", "pingResponse", ".", "wait", "(", "waitTime", ")", ";", "}", "catch", "(", "InterruptedException", "e", ")", "{", "// Do nothing.", "}", "ResponseHeader", "header", "=", "pingResponse", ".", "get", "(", ")", ";", "if", "(", "header", "!=", "null", ")", "{", "pingResponse", ".", "set", "(", "null", ")", ";", "return", "header", ".", "getErr", "(", ")", ";", "}", "waitTime", "-=", "(", "System", ".", "currentTimeMillis", "(", ")", "-", "lastPingSentNs", ")", ";", "}", "}", "return", "ErrorCode", ".", "PING_TIMEOUT", ";", "}" ]
Send the Ping Request. @return the ErrorCode, OK for success. @throws IOException the IOException.
[ "Send", "the", "Ping", "Request", "." ]
train
https://github.com/foundation-runtime/service-directory/blob/a7bdefe173dc99e75eff4a24e07e6407e62f2ed4/2.0/sd-api/src/main/java/com/cisco/oss/foundation/directory/connect/DirectoryConnection.java#L911-L938
pili-engineering/pili-sdk-java
src/main/java/com/qiniu/pili/Client.java
Client.RTMPPublishURL
public String RTMPPublishURL(String domain, String hub, String streamKey, int expireAfterSeconds) { """ /* RTMPPublishURL generates RTMP publish URL expireAfterSeconds means URL will be invalid after expireAfterSeconds. """ long expire = System.currentTimeMillis() / 1000 + expireAfterSeconds; String path = String.format("/%s/%s?e=%d", hub, streamKey, expire); String token; try { token = this.cli.getMac().sign(path); } catch (Exception e) { e.printStackTrace(); return null; } return String.format("rtmp://%s%s&token=%s", domain, path, token); }
java
public String RTMPPublishURL(String domain, String hub, String streamKey, int expireAfterSeconds) { long expire = System.currentTimeMillis() / 1000 + expireAfterSeconds; String path = String.format("/%s/%s?e=%d", hub, streamKey, expire); String token; try { token = this.cli.getMac().sign(path); } catch (Exception e) { e.printStackTrace(); return null; } return String.format("rtmp://%s%s&token=%s", domain, path, token); }
[ "public", "String", "RTMPPublishURL", "(", "String", "domain", ",", "String", "hub", ",", "String", "streamKey", ",", "int", "expireAfterSeconds", ")", "{", "long", "expire", "=", "System", ".", "currentTimeMillis", "(", ")", "/", "1000", "+", "expireAfterSeconds", ";", "String", "path", "=", "String", ".", "format", "(", "\"/%s/%s?e=%d\"", ",", "hub", ",", "streamKey", ",", "expire", ")", ";", "String", "token", ";", "try", "{", "token", "=", "this", ".", "cli", ".", "getMac", "(", ")", ".", "sign", "(", "path", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "e", ".", "printStackTrace", "(", ")", ";", "return", "null", ";", "}", "return", "String", ".", "format", "(", "\"rtmp://%s%s&token=%s\"", ",", "domain", ",", "path", ",", "token", ")", ";", "}" ]
/* RTMPPublishURL generates RTMP publish URL expireAfterSeconds means URL will be invalid after expireAfterSeconds.
[ "/", "*", "RTMPPublishURL", "generates", "RTMP", "publish", "URL", "expireAfterSeconds", "means", "URL", "will", "be", "invalid", "after", "expireAfterSeconds", "." ]
train
https://github.com/pili-engineering/pili-sdk-java/blob/7abadbd2baaa389d226a6f9351d82e2e5a60fe32/src/main/java/com/qiniu/pili/Client.java#L14-L25
RestComm/Restcomm-Connect
restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/AccountsEndpoint.java
AccountsEndpoint.switchAccountStatusTree
private void switchAccountStatusTree(Account parentAccount, UserIdentityContext userIdentityContext) { """ Switches status of account along with all its children (the whole tree). @param parentAccount """ logger.debug("Status transition requested"); // transition child accounts List<String> subAccountsToSwitch = accountsDao.getSubAccountSidsRecursive(parentAccount.getSid()); if (subAccountsToSwitch != null && !subAccountsToSwitch.isEmpty()) { int i = subAccountsToSwitch.size(); // is is the count of accounts left to process // we iterate backwards to handle child accounts first, parent accounts next while (i > 0) { i --; String removedSid = subAccountsToSwitch.get(i); try { Account subAccount = accountsDao.getAccount(new Sid(removedSid)); switchAccountStatus(subAccount, parentAccount.getStatus(), userIdentityContext); } catch (Exception e) { // if anything bad happens, log the error and continue removing the rest of the accounts. logger.error("Failed switching status (child) account '" + removedSid + "'"); } } } // switch parent account too switchAccountStatus(parentAccount, parentAccount.getStatus(), userIdentityContext); }
java
private void switchAccountStatusTree(Account parentAccount, UserIdentityContext userIdentityContext) { logger.debug("Status transition requested"); // transition child accounts List<String> subAccountsToSwitch = accountsDao.getSubAccountSidsRecursive(parentAccount.getSid()); if (subAccountsToSwitch != null && !subAccountsToSwitch.isEmpty()) { int i = subAccountsToSwitch.size(); // is is the count of accounts left to process // we iterate backwards to handle child accounts first, parent accounts next while (i > 0) { i --; String removedSid = subAccountsToSwitch.get(i); try { Account subAccount = accountsDao.getAccount(new Sid(removedSid)); switchAccountStatus(subAccount, parentAccount.getStatus(), userIdentityContext); } catch (Exception e) { // if anything bad happens, log the error and continue removing the rest of the accounts. logger.error("Failed switching status (child) account '" + removedSid + "'"); } } } // switch parent account too switchAccountStatus(parentAccount, parentAccount.getStatus(), userIdentityContext); }
[ "private", "void", "switchAccountStatusTree", "(", "Account", "parentAccount", ",", "UserIdentityContext", "userIdentityContext", ")", "{", "logger", ".", "debug", "(", "\"Status transition requested\"", ")", ";", "// transition child accounts", "List", "<", "String", ">", "subAccountsToSwitch", "=", "accountsDao", ".", "getSubAccountSidsRecursive", "(", "parentAccount", ".", "getSid", "(", ")", ")", ";", "if", "(", "subAccountsToSwitch", "!=", "null", "&&", "!", "subAccountsToSwitch", ".", "isEmpty", "(", ")", ")", "{", "int", "i", "=", "subAccountsToSwitch", ".", "size", "(", ")", ";", "// is is the count of accounts left to process", "// we iterate backwards to handle child accounts first, parent accounts next", "while", "(", "i", ">", "0", ")", "{", "i", "--", ";", "String", "removedSid", "=", "subAccountsToSwitch", ".", "get", "(", "i", ")", ";", "try", "{", "Account", "subAccount", "=", "accountsDao", ".", "getAccount", "(", "new", "Sid", "(", "removedSid", ")", ")", ";", "switchAccountStatus", "(", "subAccount", ",", "parentAccount", ".", "getStatus", "(", ")", ",", "userIdentityContext", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{", "// if anything bad happens, log the error and continue removing the rest of the accounts.", "logger", ".", "error", "(", "\"Failed switching status (child) account '\"", "+", "removedSid", "+", "\"'\"", ")", ";", "}", "}", "}", "// switch parent account too", "switchAccountStatus", "(", "parentAccount", ",", "parentAccount", ".", "getStatus", "(", ")", ",", "userIdentityContext", ")", ";", "}" ]
Switches status of account along with all its children (the whole tree). @param parentAccount
[ "Switches", "status", "of", "account", "along", "with", "all", "its", "children", "(", "the", "whole", "tree", ")", "." ]
train
https://github.com/RestComm/Restcomm-Connect/blob/2194dee4fc524cdfd0af77a218ba5f212f97f7c5/restcomm/restcomm.http/src/main/java/org/restcomm/connect/http/AccountsEndpoint.java#L806-L828
soi-toolkit/soi-toolkit-mule
commons/components/commons-mule/src/main/java/org/soitoolkit/commons/mule/monitor/MonitorEndpointHelper.java
MonitorEndpointHelper.isQueueEmpty
@SuppressWarnings("rawtypes") private static boolean isQueueEmpty(MuleContext muleContext, String muleJmsConnectorName, String queueName) throws JMSException { """ Browse a queue for messages @param muleJmsConnectorName @param queueName @return @throws JMSException """ JmsConnector muleCon = (JmsConnector)MuleUtil.getSpringBean(muleContext, muleJmsConnectorName); Session s = null; QueueBrowser b = null; try { // Get a jms connection from mule and create a jms session s = muleCon.getConnection().createSession(false, Session.AUTO_ACKNOWLEDGE); Queue q = s.createQueue(queueName); b = s.createBrowser(q); Enumeration e = b.getEnumeration(); return !e.hasMoreElements(); } finally { try {if (b != null) b.close();} catch (JMSException e) {} try {if (s != null) s.close();} catch (JMSException e) {} } }
java
@SuppressWarnings("rawtypes") private static boolean isQueueEmpty(MuleContext muleContext, String muleJmsConnectorName, String queueName) throws JMSException { JmsConnector muleCon = (JmsConnector)MuleUtil.getSpringBean(muleContext, muleJmsConnectorName); Session s = null; QueueBrowser b = null; try { // Get a jms connection from mule and create a jms session s = muleCon.getConnection().createSession(false, Session.AUTO_ACKNOWLEDGE); Queue q = s.createQueue(queueName); b = s.createBrowser(q); Enumeration e = b.getEnumeration(); return !e.hasMoreElements(); } finally { try {if (b != null) b.close();} catch (JMSException e) {} try {if (s != null) s.close();} catch (JMSException e) {} } }
[ "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "private", "static", "boolean", "isQueueEmpty", "(", "MuleContext", "muleContext", ",", "String", "muleJmsConnectorName", ",", "String", "queueName", ")", "throws", "JMSException", "{", "JmsConnector", "muleCon", "=", "(", "JmsConnector", ")", "MuleUtil", ".", "getSpringBean", "(", "muleContext", ",", "muleJmsConnectorName", ")", ";", "Session", "s", "=", "null", ";", "QueueBrowser", "b", "=", "null", ";", "try", "{", "// Get a jms connection from mule and create a jms session", "s", "=", "muleCon", ".", "getConnection", "(", ")", ".", "createSession", "(", "false", ",", "Session", ".", "AUTO_ACKNOWLEDGE", ")", ";", "Queue", "q", "=", "s", ".", "createQueue", "(", "queueName", ")", ";", "b", "=", "s", ".", "createBrowser", "(", "q", ")", ";", "Enumeration", "e", "=", "b", ".", "getEnumeration", "(", ")", ";", "return", "!", "e", ".", "hasMoreElements", "(", ")", ";", "}", "finally", "{", "try", "{", "if", "(", "b", "!=", "null", ")", "b", ".", "close", "(", ")", ";", "}", "catch", "(", "JMSException", "e", ")", "{", "}", "try", "{", "if", "(", "s", "!=", "null", ")", "s", ".", "close", "(", ")", ";", "}", "catch", "(", "JMSException", "e", ")", "{", "}", "}", "}" ]
Browse a queue for messages @param muleJmsConnectorName @param queueName @return @throws JMSException
[ "Browse", "a", "queue", "for", "messages" ]
train
https://github.com/soi-toolkit/soi-toolkit-mule/blob/e891350dbf55e6307be94d193d056bdb785b37d3/commons/components/commons-mule/src/main/java/org/soitoolkit/commons/mule/monitor/MonitorEndpointHelper.java#L205-L226
GenesysPureEngage/workspace-client-java
src/main/java/com/genesys/internal/workspace/api/EmailApi.java
EmailApi.acceptEmail
public ApiSuccessResponse acceptEmail(String id, AcceptData5 acceptData) throws ApiException { """ Accept the email interaction Accept the interaction specified in the id path parameter @param id id of interaction to accept (required) @param acceptData Request parameters. (optional) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body """ ApiResponse<ApiSuccessResponse> resp = acceptEmailWithHttpInfo(id, acceptData); return resp.getData(); }
java
public ApiSuccessResponse acceptEmail(String id, AcceptData5 acceptData) throws ApiException { ApiResponse<ApiSuccessResponse> resp = acceptEmailWithHttpInfo(id, acceptData); return resp.getData(); }
[ "public", "ApiSuccessResponse", "acceptEmail", "(", "String", "id", ",", "AcceptData5", "acceptData", ")", "throws", "ApiException", "{", "ApiResponse", "<", "ApiSuccessResponse", ">", "resp", "=", "acceptEmailWithHttpInfo", "(", "id", ",", "acceptData", ")", ";", "return", "resp", ".", "getData", "(", ")", ";", "}" ]
Accept the email interaction Accept the interaction specified in the id path parameter @param id id of interaction to accept (required) @param acceptData Request parameters. (optional) @return ApiSuccessResponse @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body
[ "Accept", "the", "email", "interaction", "Accept", "the", "interaction", "specified", "in", "the", "id", "path", "parameter" ]
train
https://github.com/GenesysPureEngage/workspace-client-java/blob/509fdd9e89b9359d012f9a72be95037a3cef53e6/src/main/java/com/genesys/internal/workspace/api/EmailApi.java#L138-L141
kuali/kc-s2sgen
coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRSF424BaseGenerator.java
RRSF424BaseGenerator.isSponsorInHierarchy
public boolean isSponsorInHierarchy(DevelopmentProposalContract sponsorable, String sponsorHierarchy,String level1) { """ This method tests whether a document's sponsor is in a given sponsor hierarchy. """ return sponsorHierarchyService.isSponsorInHierarchy(sponsorable.getSponsor().getSponsorCode(), sponsorHierarchy, 1, level1); }
java
public boolean isSponsorInHierarchy(DevelopmentProposalContract sponsorable, String sponsorHierarchy,String level1) { return sponsorHierarchyService.isSponsorInHierarchy(sponsorable.getSponsor().getSponsorCode(), sponsorHierarchy, 1, level1); }
[ "public", "boolean", "isSponsorInHierarchy", "(", "DevelopmentProposalContract", "sponsorable", ",", "String", "sponsorHierarchy", ",", "String", "level1", ")", "{", "return", "sponsorHierarchyService", ".", "isSponsorInHierarchy", "(", "sponsorable", ".", "getSponsor", "(", ")", ".", "getSponsorCode", "(", ")", ",", "sponsorHierarchy", ",", "1", ",", "level1", ")", ";", "}" ]
This method tests whether a document's sponsor is in a given sponsor hierarchy.
[ "This", "method", "tests", "whether", "a", "document", "s", "sponsor", "is", "in", "a", "given", "sponsor", "hierarchy", "." ]
train
https://github.com/kuali/kc-s2sgen/blob/2886380e1e3cb8bdd732ba99b2afa6ffc630bb37/coeus-s2sgen-impl/src/main/java/org/kuali/coeus/s2sgen/impl/generate/support/RRSF424BaseGenerator.java#L156-L158
web3j/web3j
core/src/main/java/org/web3j/ens/EnsResolver.java
EnsResolver.obtainPublicResolver
public PublicResolver obtainPublicResolver(String ensName) { """ Provides an access to a valid public resolver in order to access other API methods. @param ensName our user input ENS name @return PublicResolver """ if (isValidEnsName(ensName)) { try { if (!isSynced()) { throw new EnsResolutionException("Node is not currently synced"); } else { return lookupResolver(ensName); } } catch (Exception e) { throw new EnsResolutionException("Unable to determine sync status of node", e); } } else { throw new EnsResolutionException("EnsName is invalid: " + ensName); } }
java
public PublicResolver obtainPublicResolver(String ensName) { if (isValidEnsName(ensName)) { try { if (!isSynced()) { throw new EnsResolutionException("Node is not currently synced"); } else { return lookupResolver(ensName); } } catch (Exception e) { throw new EnsResolutionException("Unable to determine sync status of node", e); } } else { throw new EnsResolutionException("EnsName is invalid: " + ensName); } }
[ "public", "PublicResolver", "obtainPublicResolver", "(", "String", "ensName", ")", "{", "if", "(", "isValidEnsName", "(", "ensName", ")", ")", "{", "try", "{", "if", "(", "!", "isSynced", "(", ")", ")", "{", "throw", "new", "EnsResolutionException", "(", "\"Node is not currently synced\"", ")", ";", "}", "else", "{", "return", "lookupResolver", "(", "ensName", ")", ";", "}", "}", "catch", "(", "Exception", "e", ")", "{", "throw", "new", "EnsResolutionException", "(", "\"Unable to determine sync status of node\"", ",", "e", ")", ";", "}", "}", "else", "{", "throw", "new", "EnsResolutionException", "(", "\"EnsName is invalid: \"", "+", "ensName", ")", ";", "}", "}" ]
Provides an access to a valid public resolver in order to access other API methods. @param ensName our user input ENS name @return PublicResolver
[ "Provides", "an", "access", "to", "a", "valid", "public", "resolver", "in", "order", "to", "access", "other", "API", "methods", "." ]
train
https://github.com/web3j/web3j/blob/f99ceb19cdd65895c18e0a565034767ca18ea9fc/core/src/main/java/org/web3j/ens/EnsResolver.java#L52-L67
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java
KeyVaultClientBaseImpl.getSecretsWithServiceResponseAsync
public Observable<ServiceResponse<Page<SecretItem>>> getSecretsWithServiceResponseAsync(final String vaultBaseUrl, final Integer maxresults) { """ List secrets in a specified key vault. The Get Secrets operation is applicable to the entire vault. However, only the base secret identifier and its attributes are provided in the response. Individual secret versions are not listed in the response. This operation requires the secrets/list permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param maxresults Maximum number of results to return in a page. If not specified, the service will return up to 25 results. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;SecretItem&gt; object """ return getSecretsSinglePageAsync(vaultBaseUrl, maxresults) .concatMap(new Func1<ServiceResponse<Page<SecretItem>>, Observable<ServiceResponse<Page<SecretItem>>>>() { @Override public Observable<ServiceResponse<Page<SecretItem>>> call(ServiceResponse<Page<SecretItem>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(getSecretsNextWithServiceResponseAsync(nextPageLink)); } }); }
java
public Observable<ServiceResponse<Page<SecretItem>>> getSecretsWithServiceResponseAsync(final String vaultBaseUrl, final Integer maxresults) { return getSecretsSinglePageAsync(vaultBaseUrl, maxresults) .concatMap(new Func1<ServiceResponse<Page<SecretItem>>, Observable<ServiceResponse<Page<SecretItem>>>>() { @Override public Observable<ServiceResponse<Page<SecretItem>>> call(ServiceResponse<Page<SecretItem>> page) { String nextPageLink = page.body().nextPageLink(); if (nextPageLink == null) { return Observable.just(page); } return Observable.just(page).concatWith(getSecretsNextWithServiceResponseAsync(nextPageLink)); } }); }
[ "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "SecretItem", ">", ">", ">", "getSecretsWithServiceResponseAsync", "(", "final", "String", "vaultBaseUrl", ",", "final", "Integer", "maxresults", ")", "{", "return", "getSecretsSinglePageAsync", "(", "vaultBaseUrl", ",", "maxresults", ")", ".", "concatMap", "(", "new", "Func1", "<", "ServiceResponse", "<", "Page", "<", "SecretItem", ">", ">", ",", "Observable", "<", "ServiceResponse", "<", "Page", "<", "SecretItem", ">", ">", ">", ">", "(", ")", "{", "@", "Override", "public", "Observable", "<", "ServiceResponse", "<", "Page", "<", "SecretItem", ">", ">", ">", "call", "(", "ServiceResponse", "<", "Page", "<", "SecretItem", ">", ">", "page", ")", "{", "String", "nextPageLink", "=", "page", ".", "body", "(", ")", ".", "nextPageLink", "(", ")", ";", "if", "(", "nextPageLink", "==", "null", ")", "{", "return", "Observable", ".", "just", "(", "page", ")", ";", "}", "return", "Observable", ".", "just", "(", "page", ")", ".", "concatWith", "(", "getSecretsNextWithServiceResponseAsync", "(", "nextPageLink", ")", ")", ";", "}", "}", ")", ";", "}" ]
List secrets in a specified key vault. The Get Secrets operation is applicable to the entire vault. However, only the base secret identifier and its attributes are provided in the response. Individual secret versions are not listed in the response. This operation requires the secrets/list permission. @param vaultBaseUrl The vault name, for example https://myvault.vault.azure.net. @param maxresults Maximum number of results to return in a page. If not specified, the service will return up to 25 results. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;SecretItem&gt; object
[ "List", "secrets", "in", "a", "specified", "key", "vault", ".", "The", "Get", "Secrets", "operation", "is", "applicable", "to", "the", "entire", "vault", ".", "However", "only", "the", "base", "secret", "identifier", "and", "its", "attributes", "are", "provided", "in", "the", "response", ".", "Individual", "secret", "versions", "are", "not", "listed", "in", "the", "response", ".", "This", "operation", "requires", "the", "secrets", "/", "list", "permission", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/implementation/KeyVaultClientBaseImpl.java#L4094-L4106
liferay/com-liferay-commerce
commerce-product-api/src/main/java/com/liferay/commerce/product/model/CPDefinitionOptionRelWrapper.java
CPDefinitionOptionRelWrapper.getName
@Override public String getName(String languageId, boolean useDefault) { """ Returns the localized name of this cp definition option rel in the language, optionally using the default language if no localization exists for the requested language. @param languageId the ID of the language @param useDefault whether to use the default language if no localization exists for the requested language @return the localized name of this cp definition option rel """ return _cpDefinitionOptionRel.getName(languageId, useDefault); }
java
@Override public String getName(String languageId, boolean useDefault) { return _cpDefinitionOptionRel.getName(languageId, useDefault); }
[ "@", "Override", "public", "String", "getName", "(", "String", "languageId", ",", "boolean", "useDefault", ")", "{", "return", "_cpDefinitionOptionRel", ".", "getName", "(", "languageId", ",", "useDefault", ")", ";", "}" ]
Returns the localized name of this cp definition option rel in the language, optionally using the default language if no localization exists for the requested language. @param languageId the ID of the language @param useDefault whether to use the default language if no localization exists for the requested language @return the localized name of this cp definition option rel
[ "Returns", "the", "localized", "name", "of", "this", "cp", "definition", "option", "rel", "in", "the", "language", "optionally", "using", "the", "default", "language", "if", "no", "localization", "exists", "for", "the", "requested", "language", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-api/src/main/java/com/liferay/commerce/product/model/CPDefinitionOptionRelWrapper.java#L451-L454
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowControllerFactory.java
FlowControllerFactory.getPageFlowForRequest
public PageFlowController getPageFlowForRequest( RequestContext context ) throws InstantiationException, IllegalAccessException { """ Get the page flow instance that should be associated with the given request. If it doesn't exist, create it. If one is created, the page flow stack (for nesting) will be cleared or pushed, and the new instance will be stored as the current page flow. @param context a {@link RequestContext} object which contains the current request and response. @return the {@link PageFlowController} for the request, or <code>null</code> if none was found. """ String servletPath = InternalUtils.getDecodedServletPath( context.getHttpRequest() ); return getPageFlowForPath( context, servletPath ); }
java
public PageFlowController getPageFlowForRequest( RequestContext context ) throws InstantiationException, IllegalAccessException { String servletPath = InternalUtils.getDecodedServletPath( context.getHttpRequest() ); return getPageFlowForPath( context, servletPath ); }
[ "public", "PageFlowController", "getPageFlowForRequest", "(", "RequestContext", "context", ")", "throws", "InstantiationException", ",", "IllegalAccessException", "{", "String", "servletPath", "=", "InternalUtils", ".", "getDecodedServletPath", "(", "context", ".", "getHttpRequest", "(", ")", ")", ";", "return", "getPageFlowForPath", "(", "context", ",", "servletPath", ")", ";", "}" ]
Get the page flow instance that should be associated with the given request. If it doesn't exist, create it. If one is created, the page flow stack (for nesting) will be cleared or pushed, and the new instance will be stored as the current page flow. @param context a {@link RequestContext} object which contains the current request and response. @return the {@link PageFlowController} for the request, or <code>null</code> if none was found.
[ "Get", "the", "page", "flow", "instance", "that", "should", "be", "associated", "with", "the", "given", "request", ".", "If", "it", "doesn", "t", "exist", "create", "it", ".", "If", "one", "is", "created", "the", "page", "flow", "stack", "(", "for", "nesting", ")", "will", "be", "cleared", "or", "pushed", "and", "the", "new", "instance", "will", "be", "stored", "as", "the", "current", "page", "flow", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/FlowControllerFactory.java#L123-L128
JodaOrg/joda-beans
src/main/java/org/joda/beans/gen/PropertyData.java
PropertyData.resolveEqualsHashCodeStyle
public void resolveEqualsHashCodeStyle(File file, int lineIndex) { """ Resolves the equals hashCode generator. @param file the file @param lineIndex the line index """ if (equalsHashCodeStyle.equals("smart")) { equalsHashCodeStyle = (bean.isImmutable() ? "field" : "getter"); } if (equalsHashCodeStyle.equals("omit") || equalsHashCodeStyle.equals("getter") || equalsHashCodeStyle.equals("field")) { return; } throw new BeanCodeGenException("Invalid equals/hashCode style: " + equalsHashCodeStyle + " in " + getBean().getTypeRaw() + "." + getPropertyName(), file, lineIndex); }
java
public void resolveEqualsHashCodeStyle(File file, int lineIndex) { if (equalsHashCodeStyle.equals("smart")) { equalsHashCodeStyle = (bean.isImmutable() ? "field" : "getter"); } if (equalsHashCodeStyle.equals("omit") || equalsHashCodeStyle.equals("getter") || equalsHashCodeStyle.equals("field")) { return; } throw new BeanCodeGenException("Invalid equals/hashCode style: " + equalsHashCodeStyle + " in " + getBean().getTypeRaw() + "." + getPropertyName(), file, lineIndex); }
[ "public", "void", "resolveEqualsHashCodeStyle", "(", "File", "file", ",", "int", "lineIndex", ")", "{", "if", "(", "equalsHashCodeStyle", ".", "equals", "(", "\"smart\"", ")", ")", "{", "equalsHashCodeStyle", "=", "(", "bean", ".", "isImmutable", "(", ")", "?", "\"field\"", ":", "\"getter\"", ")", ";", "}", "if", "(", "equalsHashCodeStyle", ".", "equals", "(", "\"omit\"", ")", "||", "equalsHashCodeStyle", ".", "equals", "(", "\"getter\"", ")", "||", "equalsHashCodeStyle", ".", "equals", "(", "\"field\"", ")", ")", "{", "return", ";", "}", "throw", "new", "BeanCodeGenException", "(", "\"Invalid equals/hashCode style: \"", "+", "equalsHashCodeStyle", "+", "\" in \"", "+", "getBean", "(", ")", ".", "getTypeRaw", "(", ")", "+", "\".\"", "+", "getPropertyName", "(", ")", ",", "file", ",", "lineIndex", ")", ";", "}" ]
Resolves the equals hashCode generator. @param file the file @param lineIndex the line index
[ "Resolves", "the", "equals", "hashCode", "generator", "." ]
train
https://github.com/JodaOrg/joda-beans/blob/f07dbe42947150b23a173f35984c6ab33c5529bf/src/main/java/org/joda/beans/gen/PropertyData.java#L453-L464
Azure/azure-sdk-for-java
compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineExtensionsInner.java
VirtualMachineExtensionsInner.beginUpdateAsync
public Observable<VirtualMachineExtensionInner> beginUpdateAsync(String resourceGroupName, String vmName, String vmExtensionName, VirtualMachineExtensionUpdate extensionParameters) { """ The operation to update the extension. @param resourceGroupName The name of the resource group. @param vmName The name of the virtual machine where the extension should be updated. @param vmExtensionName The name of the virtual machine extension. @param extensionParameters Parameters supplied to the Update Virtual Machine Extension operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VirtualMachineExtensionInner object """ return beginUpdateWithServiceResponseAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters).map(new Func1<ServiceResponse<VirtualMachineExtensionInner>, VirtualMachineExtensionInner>() { @Override public VirtualMachineExtensionInner call(ServiceResponse<VirtualMachineExtensionInner> response) { return response.body(); } }); }
java
public Observable<VirtualMachineExtensionInner> beginUpdateAsync(String resourceGroupName, String vmName, String vmExtensionName, VirtualMachineExtensionUpdate extensionParameters) { return beginUpdateWithServiceResponseAsync(resourceGroupName, vmName, vmExtensionName, extensionParameters).map(new Func1<ServiceResponse<VirtualMachineExtensionInner>, VirtualMachineExtensionInner>() { @Override public VirtualMachineExtensionInner call(ServiceResponse<VirtualMachineExtensionInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VirtualMachineExtensionInner", ">", "beginUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "vmName", ",", "String", "vmExtensionName", ",", "VirtualMachineExtensionUpdate", "extensionParameters", ")", "{", "return", "beginUpdateWithServiceResponseAsync", "(", "resourceGroupName", ",", "vmName", ",", "vmExtensionName", ",", "extensionParameters", ")", ".", "map", "(", "new", "Func1", "<", "ServiceResponse", "<", "VirtualMachineExtensionInner", ">", ",", "VirtualMachineExtensionInner", ">", "(", ")", "{", "@", "Override", "public", "VirtualMachineExtensionInner", "call", "(", "ServiceResponse", "<", "VirtualMachineExtensionInner", ">", "response", ")", "{", "return", "response", ".", "body", "(", ")", ";", "}", "}", ")", ";", "}" ]
The operation to update the extension. @param resourceGroupName The name of the resource group. @param vmName The name of the virtual machine where the extension should be updated. @param vmExtensionName The name of the virtual machine extension. @param extensionParameters Parameters supplied to the Update Virtual Machine Extension operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the VirtualMachineExtensionInner object
[ "The", "operation", "to", "update", "the", "extension", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachineExtensionsInner.java#L401-L408
rabbitmq/hop
src/main/java/com/rabbitmq/http/client/Client.java
Client.declareShovel
public void declareShovel(String vhost, ShovelInfo info) { """ Declares a shovel. @param vhost virtual host where to declare the shovel @param info Shovel info. """ Map<String, Object> props = info.getDetails().getPublishProperties(); if(props != null && props.isEmpty()) { throw new IllegalArgumentException("Shovel publish properties must be a non-empty map or null"); } final URI uri = uriWithPath("./parameters/shovel/" + encodePathSegment(vhost) + "/" + encodePathSegment(info.getName())); this.rt.put(uri, info); }
java
public void declareShovel(String vhost, ShovelInfo info) { Map<String, Object> props = info.getDetails().getPublishProperties(); if(props != null && props.isEmpty()) { throw new IllegalArgumentException("Shovel publish properties must be a non-empty map or null"); } final URI uri = uriWithPath("./parameters/shovel/" + encodePathSegment(vhost) + "/" + encodePathSegment(info.getName())); this.rt.put(uri, info); }
[ "public", "void", "declareShovel", "(", "String", "vhost", ",", "ShovelInfo", "info", ")", "{", "Map", "<", "String", ",", "Object", ">", "props", "=", "info", ".", "getDetails", "(", ")", ".", "getPublishProperties", "(", ")", ";", "if", "(", "props", "!=", "null", "&&", "props", ".", "isEmpty", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Shovel publish properties must be a non-empty map or null\"", ")", ";", "}", "final", "URI", "uri", "=", "uriWithPath", "(", "\"./parameters/shovel/\"", "+", "encodePathSegment", "(", "vhost", ")", "+", "\"/\"", "+", "encodePathSegment", "(", "info", ".", "getName", "(", ")", ")", ")", ";", "this", ".", "rt", ".", "put", "(", "uri", ",", "info", ")", ";", "}" ]
Declares a shovel. @param vhost virtual host where to declare the shovel @param info Shovel info.
[ "Declares", "a", "shovel", "." ]
train
https://github.com/rabbitmq/hop/blob/94e70f1f7e39f523a11ab3162b4efc976311ee03/src/main/java/com/rabbitmq/http/client/Client.java#L768-L775
fozziethebeat/S-Space
src/main/java/edu/ucla/sspace/common/Similarity.java
Similarity.linSimilarity
public static double linSimilarity(int[] a, int[] b) { """ Computes the lin similarity measure, which is motivated by information theory priniciples. This works best if both vectors have already been weighted using point-wise mutual information. This similarity measure is described in more detail in the following paper: <li style="font-family:Garamond, Georgia, serif">D. Lin, "Automatic Retrieval and Clustering of Similar Words" <i> Proceedings of the 36th Annual Meeting of the Association for Computational Linguistics and 17th International Conference on Computational Linguistics, Volume 2 </i>, Montreal, Quebec, Canada, 1998. </li> @throws IllegalArgumentException when the length of the two vectors are not the same. """ check(a, b); // The total amount of information contained in a. double aInformation = 0; // The total amount of information contained in b. double bInformation = 0; // The total amount of information contained in both vectors. double combinedInformation = 0; // Compute the information between the two vectors by iterating over // all known values. for (int i = 0; i < a.length; ++i) { aInformation += a[i]; bInformation += b[i]; if (a[i] != 0d && b[i] != 0d) combinedInformation += a[i] + b[i]; } return combinedInformation / (aInformation + bInformation); }
java
public static double linSimilarity(int[] a, int[] b) { check(a, b); // The total amount of information contained in a. double aInformation = 0; // The total amount of information contained in b. double bInformation = 0; // The total amount of information contained in both vectors. double combinedInformation = 0; // Compute the information between the two vectors by iterating over // all known values. for (int i = 0; i < a.length; ++i) { aInformation += a[i]; bInformation += b[i]; if (a[i] != 0d && b[i] != 0d) combinedInformation += a[i] + b[i]; } return combinedInformation / (aInformation + bInformation); }
[ "public", "static", "double", "linSimilarity", "(", "int", "[", "]", "a", ",", "int", "[", "]", "b", ")", "{", "check", "(", "a", ",", "b", ")", ";", "// The total amount of information contained in a.", "double", "aInformation", "=", "0", ";", "// The total amount of information contained in b.", "double", "bInformation", "=", "0", ";", "// The total amount of information contained in both vectors.", "double", "combinedInformation", "=", "0", ";", "// Compute the information between the two vectors by iterating over", "// all known values.", "for", "(", "int", "i", "=", "0", ";", "i", "<", "a", ".", "length", ";", "++", "i", ")", "{", "aInformation", "+=", "a", "[", "i", "]", ";", "bInformation", "+=", "b", "[", "i", "]", ";", "if", "(", "a", "[", "i", "]", "!=", "0d", "&&", "b", "[", "i", "]", "!=", "0d", ")", "combinedInformation", "+=", "a", "[", "i", "]", "+", "b", "[", "i", "]", ";", "}", "return", "combinedInformation", "/", "(", "aInformation", "+", "bInformation", ")", ";", "}" ]
Computes the lin similarity measure, which is motivated by information theory priniciples. This works best if both vectors have already been weighted using point-wise mutual information. This similarity measure is described in more detail in the following paper: <li style="font-family:Garamond, Georgia, serif">D. Lin, "Automatic Retrieval and Clustering of Similar Words" <i> Proceedings of the 36th Annual Meeting of the Association for Computational Linguistics and 17th International Conference on Computational Linguistics, Volume 2 </i>, Montreal, Quebec, Canada, 1998. </li> @throws IllegalArgumentException when the length of the two vectors are not the same.
[ "Computes", "the", "lin", "similarity", "measure", "which", "is", "motivated", "by", "information", "theory", "priniciples", ".", "This", "works", "best", "if", "both", "vectors", "have", "already", "been", "weighted", "using", "point", "-", "wise", "mutual", "information", ".", "This", "similarity", "measure", "is", "described", "in", "more", "detail", "in", "the", "following", "paper", ":" ]
train
https://github.com/fozziethebeat/S-Space/blob/a608102737dfd3d59038a9ead33fe60356bc6029/src/main/java/edu/ucla/sspace/common/Similarity.java#L1751-L1770
groovy/groovy-core
src/main/org/codehaus/groovy/runtime/IOGroovyMethods.java
IOGroovyMethods.withCloseable
public static <T, U extends Closeable> T withCloseable(U self, @ClosureParams(value=FirstParam.class) Closure<T> action) throws IOException { """ Allows this closeable to be used within the closure, ensuring that it is closed once the closure has been executed and before this method returns. @param self the Closeable @param action the closure taking the Closeable as parameter @return the value returned by the closure @throws IOException if an IOException occurs. @since 2.4.0 """ try { T result = action.call(self); Closeable temp = self; self = null; temp.close(); return result; } finally { DefaultGroovyMethodsSupport.closeWithWarning(self); } }
java
public static <T, U extends Closeable> T withCloseable(U self, @ClosureParams(value=FirstParam.class) Closure<T> action) throws IOException { try { T result = action.call(self); Closeable temp = self; self = null; temp.close(); return result; } finally { DefaultGroovyMethodsSupport.closeWithWarning(self); } }
[ "public", "static", "<", "T", ",", "U", "extends", "Closeable", ">", "T", "withCloseable", "(", "U", "self", ",", "@", "ClosureParams", "(", "value", "=", "FirstParam", ".", "class", ")", "Closure", "<", "T", ">", "action", ")", "throws", "IOException", "{", "try", "{", "T", "result", "=", "action", ".", "call", "(", "self", ")", ";", "Closeable", "temp", "=", "self", ";", "self", "=", "null", ";", "temp", ".", "close", "(", ")", ";", "return", "result", ";", "}", "finally", "{", "DefaultGroovyMethodsSupport", ".", "closeWithWarning", "(", "self", ")", ";", "}", "}" ]
Allows this closeable to be used within the closure, ensuring that it is closed once the closure has been executed and before this method returns. @param self the Closeable @param action the closure taking the Closeable as parameter @return the value returned by the closure @throws IOException if an IOException occurs. @since 2.4.0
[ "Allows", "this", "closeable", "to", "be", "used", "within", "the", "closure", "ensuring", "that", "it", "is", "closed", "once", "the", "closure", "has", "been", "executed", "and", "before", "this", "method", "returns", "." ]
train
https://github.com/groovy/groovy-core/blob/01309f9d4be34ddf93c4a9943b5a97843bff6181/src/main/org/codehaus/groovy/runtime/IOGroovyMethods.java#L1620-L1632
biojava/biojava
biojava-structure/src/main/java/org/biojava/nbio/structure/AtomPositionMap.java
AtomPositionMap.getRanges
public List<ResidueRangeAndLength> getRanges() { """ Returns a list of {@link ResidueRange ResidueRanges} corresponding to this entire AtomPositionMap. """ String currentChain = ""; ResidueNumber first = null; ResidueNumber prev = null; List<ResidueRangeAndLength> ranges = new ArrayList<ResidueRangeAndLength>(); for (ResidueNumber rn : treeMap.keySet()) { if (!rn.getChainName().equals(currentChain)) { if (first != null) { ResidueRangeAndLength newRange = new ResidueRangeAndLength(currentChain, first, prev, this.getLength(first, prev)); ranges.add(newRange); } first = rn; } prev = rn; currentChain = rn.getChainName(); } ResidueRangeAndLength newRange = new ResidueRangeAndLength(currentChain, first, prev, this.getLength(first, prev)); ranges.add(newRange); return ranges; }
java
public List<ResidueRangeAndLength> getRanges() { String currentChain = ""; ResidueNumber first = null; ResidueNumber prev = null; List<ResidueRangeAndLength> ranges = new ArrayList<ResidueRangeAndLength>(); for (ResidueNumber rn : treeMap.keySet()) { if (!rn.getChainName().equals(currentChain)) { if (first != null) { ResidueRangeAndLength newRange = new ResidueRangeAndLength(currentChain, first, prev, this.getLength(first, prev)); ranges.add(newRange); } first = rn; } prev = rn; currentChain = rn.getChainName(); } ResidueRangeAndLength newRange = new ResidueRangeAndLength(currentChain, first, prev, this.getLength(first, prev)); ranges.add(newRange); return ranges; }
[ "public", "List", "<", "ResidueRangeAndLength", ">", "getRanges", "(", ")", "{", "String", "currentChain", "=", "\"\"", ";", "ResidueNumber", "first", "=", "null", ";", "ResidueNumber", "prev", "=", "null", ";", "List", "<", "ResidueRangeAndLength", ">", "ranges", "=", "new", "ArrayList", "<", "ResidueRangeAndLength", ">", "(", ")", ";", "for", "(", "ResidueNumber", "rn", ":", "treeMap", ".", "keySet", "(", ")", ")", "{", "if", "(", "!", "rn", ".", "getChainName", "(", ")", ".", "equals", "(", "currentChain", ")", ")", "{", "if", "(", "first", "!=", "null", ")", "{", "ResidueRangeAndLength", "newRange", "=", "new", "ResidueRangeAndLength", "(", "currentChain", ",", "first", ",", "prev", ",", "this", ".", "getLength", "(", "first", ",", "prev", ")", ")", ";", "ranges", ".", "add", "(", "newRange", ")", ";", "}", "first", "=", "rn", ";", "}", "prev", "=", "rn", ";", "currentChain", "=", "rn", ".", "getChainName", "(", ")", ";", "}", "ResidueRangeAndLength", "newRange", "=", "new", "ResidueRangeAndLength", "(", "currentChain", ",", "first", ",", "prev", ",", "this", ".", "getLength", "(", "first", ",", "prev", ")", ")", ";", "ranges", ".", "add", "(", "newRange", ")", ";", "return", "ranges", ";", "}" ]
Returns a list of {@link ResidueRange ResidueRanges} corresponding to this entire AtomPositionMap.
[ "Returns", "a", "list", "of", "{" ]
train
https://github.com/biojava/biojava/blob/a1c71a8e3d40cc32104b1d387a3d3b560b43356e/biojava-structure/src/main/java/org/biojava/nbio/structure/AtomPositionMap.java#L340-L359
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/RepositoryApi.java
RepositoryApi.getBranch
public Branch getBranch(Object projectIdOrPath, String branchName) throws GitLabApiException { """ Get a single project repository branch. <pre><code>GitLab Endpoint: GET /projects/:id/repository/branches/:branch</code></pre> @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param branchName the name of the branch to get @return the branch info for the specified project ID/branch name pair @throws GitLabApiException if any exception occurs """ Response response = get(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "repository", "branches", urlEncode(branchName)); return (response.readEntity(Branch.class)); }
java
public Branch getBranch(Object projectIdOrPath, String branchName) throws GitLabApiException { Response response = get(Response.Status.OK, null, "projects", getProjectIdOrPath(projectIdOrPath), "repository", "branches", urlEncode(branchName)); return (response.readEntity(Branch.class)); }
[ "public", "Branch", "getBranch", "(", "Object", "projectIdOrPath", ",", "String", "branchName", ")", "throws", "GitLabApiException", "{", "Response", "response", "=", "get", "(", "Response", ".", "Status", ".", "OK", ",", "null", ",", "\"projects\"", ",", "getProjectIdOrPath", "(", "projectIdOrPath", ")", ",", "\"repository\"", ",", "\"branches\"", ",", "urlEncode", "(", "branchName", ")", ")", ";", "return", "(", "response", ".", "readEntity", "(", "Branch", ".", "class", ")", ")", ";", "}" ]
Get a single project repository branch. <pre><code>GitLab Endpoint: GET /projects/:id/repository/branches/:branch</code></pre> @param projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance @param branchName the name of the branch to get @return the branch info for the specified project ID/branch name pair @throws GitLabApiException if any exception occurs
[ "Get", "a", "single", "project", "repository", "branch", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/RepositoryApi.java#L104-L108
PeterisP/LVTagger
src/main/java/edu/stanford/nlp/stats/Counters.java
Counters.subtractInPlace
public static <E> void subtractInPlace(Counter<E> target, Counter<E> arg) { """ Sets each value of target to be target[k]-arg[k] for all keys k in target. """ for (E key : arg.keySet()) { target.decrementCount(key, arg.getCount(key)); } }
java
public static <E> void subtractInPlace(Counter<E> target, Counter<E> arg) { for (E key : arg.keySet()) { target.decrementCount(key, arg.getCount(key)); } }
[ "public", "static", "<", "E", ">", "void", "subtractInPlace", "(", "Counter", "<", "E", ">", "target", ",", "Counter", "<", "E", ">", "arg", ")", "{", "for", "(", "E", "key", ":", "arg", ".", "keySet", "(", ")", ")", "{", "target", ".", "decrementCount", "(", "key", ",", "arg", ".", "getCount", "(", "key", ")", ")", ";", "}", "}" ]
Sets each value of target to be target[k]-arg[k] for all keys k in target.
[ "Sets", "each", "value", "of", "target", "to", "be", "target", "[", "k", "]", "-", "arg", "[", "k", "]", "for", "all", "keys", "k", "in", "target", "." ]
train
https://github.com/PeterisP/LVTagger/blob/b3d44bab9ec07ace0d13612c448a6b7298c1f681/src/main/java/edu/stanford/nlp/stats/Counters.java#L391-L395
davidmarquis/fluent-interface-proxy
src/main/java/com/fluentinterface/beans/ObjectWrapper.java
ObjectWrapper.setIndexedValue
public void setIndexedValue(String propertyName, int index, Object value) { """ Sets the value of the specified indexed property in the wrapped object. @param propertyName the name of the indexed property whose value is to be updated, cannot be {@code null} @param index the index position of the property value to be set @param value the indexed value to set, can be {@code null} @throws ReflectionException if a reflection error occurs @throws IllegalArgumentException if the propertyName parameter is {@code null} @throws IllegalArgumentException if the indexed object in the wrapped object is not a {@link List} or {@code array} type @throws IndexOutOfBoundsException if the indexed object in the wrapped object is out of bounds with the given index and autogrowing is disabled @throws NullPointerException if the indexed object in the wrapped object is {@code null} @throws NullPointerException if the indexed object in the wrapped object is out of bounds with the given index, but autogrowing (if enabled) is unable to fill the blank positions with {@code null} @throws NullPointerException if the wrapped object does not have a property with the given name """ setIndexedValue(object, getPropertyOrThrow(bean, propertyName), index, value, this); }
java
public void setIndexedValue(String propertyName, int index, Object value) { setIndexedValue(object, getPropertyOrThrow(bean, propertyName), index, value, this); }
[ "public", "void", "setIndexedValue", "(", "String", "propertyName", ",", "int", "index", ",", "Object", "value", ")", "{", "setIndexedValue", "(", "object", ",", "getPropertyOrThrow", "(", "bean", ",", "propertyName", ")", ",", "index", ",", "value", ",", "this", ")", ";", "}" ]
Sets the value of the specified indexed property in the wrapped object. @param propertyName the name of the indexed property whose value is to be updated, cannot be {@code null} @param index the index position of the property value to be set @param value the indexed value to set, can be {@code null} @throws ReflectionException if a reflection error occurs @throws IllegalArgumentException if the propertyName parameter is {@code null} @throws IllegalArgumentException if the indexed object in the wrapped object is not a {@link List} or {@code array} type @throws IndexOutOfBoundsException if the indexed object in the wrapped object is out of bounds with the given index and autogrowing is disabled @throws NullPointerException if the indexed object in the wrapped object is {@code null} @throws NullPointerException if the indexed object in the wrapped object is out of bounds with the given index, but autogrowing (if enabled) is unable to fill the blank positions with {@code null} @throws NullPointerException if the wrapped object does not have a property with the given name
[ "Sets", "the", "value", "of", "the", "specified", "indexed", "property", "in", "the", "wrapped", "object", "." ]
train
https://github.com/davidmarquis/fluent-interface-proxy/blob/8e72fff6cd1f496c76a01773269caead994fea65/src/main/java/com/fluentinterface/beans/ObjectWrapper.java#L343-L345
google/closure-templates
java/src/com/google/template/soy/parsepasses/contextautoesc/Context.java
Context.getMsgEscapingStrategy
Optional<MsgEscapingStrategy> getMsgEscapingStrategy(SoyNode node) { """ Determines the strategy to escape Soy msg tags. <p>Importantly, this determines the context that the message should be considered in, how the print nodes will be escaped, and how the entire message will be escaped. We need different strategies in different contexts because messages in general aren't trusted, but we also need to be able to include markup interspersed in an HTML message; for example, an anchor that Soy factored out of the message. <p>Note that it'd be very nice to be able to simply escape the strings that came out of the translation database, and distribute the escaping entirely over the print nodes. However, the translation machinery, especially in Javascript, doesn't offer a way to escape just the bits that come from the translation database without also re-escaping the substitutions. @param node The node, for error messages @return relevant strategy, or absent in case there's no valid strategy and it is an error to have a message in this context """ switch (state) { case HTML_PCDATA: // In normal HTML PCDATA context, it makes sense to escape all of the print nodes, but not // escape the entire message. This allows Soy to support putting anchors and other small // bits of HTML in messages. return Optional.of(new MsgEscapingStrategy(this, ImmutableList.of())); case CSS_DQ_STRING: case CSS_SQ_STRING: case JS_DQ_STRING: case JS_SQ_STRING: case TEXT: case URI: if (state == HtmlContext.URI && uriPart != UriPart.QUERY) { // NOTE: Only support the query portion of URIs. return Optional.absent(); } // In other contexts like JS and CSS strings, it makes sense to treat the message's // placeholders as plain text, but escape the entire result of message evaluation. return Optional.of( new MsgEscapingStrategy( new Context(HtmlContext.TEXT), getEscapingModes(node, ImmutableList.of()))); case HTML_RCDATA: case HTML_NORMAL_ATTR_VALUE: case HTML_COMMENT: // The weirdest case is HTML attributes. Ideally, we'd like to treat these as a text string // and escape when done. However, many messages have HTML entities such as &raquo; in them. // A good way around this is to escape the print nodes in the message, but normalize // (escape except for ampersands) the final message. // Also, content inside <title>, <textarea>, and HTML comments have a similar requirement, // where any entities in the messages are probably intended to be preserved. return Optional.of( new MsgEscapingStrategy(this, ImmutableList.of(EscapingMode.NORMALIZE_HTML))); default: // Other contexts, primarily source code contexts, don't have a meaningful way to support // natural language text. return Optional.absent(); } }
java
Optional<MsgEscapingStrategy> getMsgEscapingStrategy(SoyNode node) { switch (state) { case HTML_PCDATA: // In normal HTML PCDATA context, it makes sense to escape all of the print nodes, but not // escape the entire message. This allows Soy to support putting anchors and other small // bits of HTML in messages. return Optional.of(new MsgEscapingStrategy(this, ImmutableList.of())); case CSS_DQ_STRING: case CSS_SQ_STRING: case JS_DQ_STRING: case JS_SQ_STRING: case TEXT: case URI: if (state == HtmlContext.URI && uriPart != UriPart.QUERY) { // NOTE: Only support the query portion of URIs. return Optional.absent(); } // In other contexts like JS and CSS strings, it makes sense to treat the message's // placeholders as plain text, but escape the entire result of message evaluation. return Optional.of( new MsgEscapingStrategy( new Context(HtmlContext.TEXT), getEscapingModes(node, ImmutableList.of()))); case HTML_RCDATA: case HTML_NORMAL_ATTR_VALUE: case HTML_COMMENT: // The weirdest case is HTML attributes. Ideally, we'd like to treat these as a text string // and escape when done. However, many messages have HTML entities such as &raquo; in them. // A good way around this is to escape the print nodes in the message, but normalize // (escape except for ampersands) the final message. // Also, content inside <title>, <textarea>, and HTML comments have a similar requirement, // where any entities in the messages are probably intended to be preserved. return Optional.of( new MsgEscapingStrategy(this, ImmutableList.of(EscapingMode.NORMALIZE_HTML))); default: // Other contexts, primarily source code contexts, don't have a meaningful way to support // natural language text. return Optional.absent(); } }
[ "Optional", "<", "MsgEscapingStrategy", ">", "getMsgEscapingStrategy", "(", "SoyNode", "node", ")", "{", "switch", "(", "state", ")", "{", "case", "HTML_PCDATA", ":", "// In normal HTML PCDATA context, it makes sense to escape all of the print nodes, but not", "// escape the entire message. This allows Soy to support putting anchors and other small", "// bits of HTML in messages.", "return", "Optional", ".", "of", "(", "new", "MsgEscapingStrategy", "(", "this", ",", "ImmutableList", ".", "of", "(", ")", ")", ")", ";", "case", "CSS_DQ_STRING", ":", "case", "CSS_SQ_STRING", ":", "case", "JS_DQ_STRING", ":", "case", "JS_SQ_STRING", ":", "case", "TEXT", ":", "case", "URI", ":", "if", "(", "state", "==", "HtmlContext", ".", "URI", "&&", "uriPart", "!=", "UriPart", ".", "QUERY", ")", "{", "// NOTE: Only support the query portion of URIs.", "return", "Optional", ".", "absent", "(", ")", ";", "}", "// In other contexts like JS and CSS strings, it makes sense to treat the message's", "// placeholders as plain text, but escape the entire result of message evaluation.", "return", "Optional", ".", "of", "(", "new", "MsgEscapingStrategy", "(", "new", "Context", "(", "HtmlContext", ".", "TEXT", ")", ",", "getEscapingModes", "(", "node", ",", "ImmutableList", ".", "of", "(", ")", ")", ")", ")", ";", "case", "HTML_RCDATA", ":", "case", "HTML_NORMAL_ATTR_VALUE", ":", "case", "HTML_COMMENT", ":", "// The weirdest case is HTML attributes. Ideally, we'd like to treat these as a text string", "// and escape when done. However, many messages have HTML entities such as &raquo; in them.", "// A good way around this is to escape the print nodes in the message, but normalize", "// (escape except for ampersands) the final message.", "// Also, content inside <title>, <textarea>, and HTML comments have a similar requirement,", "// where any entities in the messages are probably intended to be preserved.", "return", "Optional", ".", "of", "(", "new", "MsgEscapingStrategy", "(", "this", ",", "ImmutableList", ".", "of", "(", "EscapingMode", ".", "NORMALIZE_HTML", ")", ")", ")", ";", "default", ":", "// Other contexts, primarily source code contexts, don't have a meaningful way to support", "// natural language text.", "return", "Optional", ".", "absent", "(", ")", ";", "}", "}" ]
Determines the strategy to escape Soy msg tags. <p>Importantly, this determines the context that the message should be considered in, how the print nodes will be escaped, and how the entire message will be escaped. We need different strategies in different contexts because messages in general aren't trusted, but we also need to be able to include markup interspersed in an HTML message; for example, an anchor that Soy factored out of the message. <p>Note that it'd be very nice to be able to simply escape the strings that came out of the translation database, and distribute the escaping entirely over the print nodes. However, the translation machinery, especially in Javascript, doesn't offer a way to escape just the bits that come from the translation database without also re-escaping the substitutions. @param node The node, for error messages @return relevant strategy, or absent in case there's no valid strategy and it is an error to have a message in this context
[ "Determines", "the", "strategy", "to", "escape", "Soy", "msg", "tags", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/parsepasses/contextautoesc/Context.java#L557-L598
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/subordinate/AbstractSetMandatory.java
AbstractSetMandatory.applyMandatoryAction
private void applyMandatoryAction(final WComponent target, final boolean mandatory) { """ Apply the mandatory action against the target and its children. @param target the target of this action @param mandatory is the evaluated value """ if (target instanceof Mandatable) { ((Mandatable) target).setMandatory(mandatory); } else if (target instanceof Container) { // Apply to the Mandatable children Container cont = (Container) target; final int size = cont.getChildCount(); for (int i = 0; i < size; i++) { WComponent child = cont.getChildAt(i); applyMandatoryAction(child, mandatory); } } }
java
private void applyMandatoryAction(final WComponent target, final boolean mandatory) { if (target instanceof Mandatable) { ((Mandatable) target).setMandatory(mandatory); } else if (target instanceof Container) { // Apply to the Mandatable children Container cont = (Container) target; final int size = cont.getChildCount(); for (int i = 0; i < size; i++) { WComponent child = cont.getChildAt(i); applyMandatoryAction(child, mandatory); } } }
[ "private", "void", "applyMandatoryAction", "(", "final", "WComponent", "target", ",", "final", "boolean", "mandatory", ")", "{", "if", "(", "target", "instanceof", "Mandatable", ")", "{", "(", "(", "Mandatable", ")", "target", ")", ".", "setMandatory", "(", "mandatory", ")", ";", "}", "else", "if", "(", "target", "instanceof", "Container", ")", "{", "// Apply to the Mandatable children", "Container", "cont", "=", "(", "Container", ")", "target", ";", "final", "int", "size", "=", "cont", ".", "getChildCount", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "size", ";", "i", "++", ")", "{", "WComponent", "child", "=", "cont", ".", "getChildAt", "(", "i", ")", ";", "applyMandatoryAction", "(", "child", ",", "mandatory", ")", ";", "}", "}", "}" ]
Apply the mandatory action against the target and its children. @param target the target of this action @param mandatory is the evaluated value
[ "Apply", "the", "mandatory", "action", "against", "the", "target", "and", "its", "children", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/subordinate/AbstractSetMandatory.java#L46-L58
ecclesia/kipeto
kipeto-core/src/main/java/de/ecclesia/kipeto/blueprint/FileItem.java
FileItem.fromStream
public static FileItem fromStream(DataInputStream dataInputStream) throws IOException { """ Deserialisiert ein FileItem aus einem übergebenen InputStream. @param dataInputStream Quelle der Deserialisierung @return FileItem @throws IOException """ // Über die Version kann gesteuert werden, wieviele Felder gelesen // werden. Das ist aus Gründen der Abwärtskompatibilität notwendig. // Neue Felder dürfen nur am Ende hinzugefügt werden. Die Version // muss dann heraufgesetzt werden. byte binaryVersion = dataInputStream.readByte(); if (binaryVersion >= 1) { String name = dataInputStream.readUTF(); long length = dataInputStream.readLong(); long lastModified = dataInputStream.readLong(); String blobId = dataInputStream.readUTF(); return new FileItem(name, blobId, length, lastModified); } else { throw new IllegalStateException("Unsupported binary version <" + binaryVersion + ">"); } }
java
public static FileItem fromStream(DataInputStream dataInputStream) throws IOException { // Über die Version kann gesteuert werden, wieviele Felder gelesen // werden. Das ist aus Gründen der Abwärtskompatibilität notwendig. // Neue Felder dürfen nur am Ende hinzugefügt werden. Die Version // muss dann heraufgesetzt werden. byte binaryVersion = dataInputStream.readByte(); if (binaryVersion >= 1) { String name = dataInputStream.readUTF(); long length = dataInputStream.readLong(); long lastModified = dataInputStream.readLong(); String blobId = dataInputStream.readUTF(); return new FileItem(name, blobId, length, lastModified); } else { throw new IllegalStateException("Unsupported binary version <" + binaryVersion + ">"); } }
[ "public", "static", "FileItem", "fromStream", "(", "DataInputStream", "dataInputStream", ")", "throws", "IOException", "{", "// Über die Version kann gesteuert werden, wieviele Felder gelesen", "// werden. Das ist aus Gründen der Abwärtskompatibilität notwendig.", "// Neue Felder dürfen nur am Ende hinzugefügt werden. Die Version", "// muss dann heraufgesetzt werden.", "byte", "binaryVersion", "=", "dataInputStream", ".", "readByte", "(", ")", ";", "if", "(", "binaryVersion", ">=", "1", ")", "{", "String", "name", "=", "dataInputStream", ".", "readUTF", "(", ")", ";", "long", "length", "=", "dataInputStream", ".", "readLong", "(", ")", ";", "long", "lastModified", "=", "dataInputStream", ".", "readLong", "(", ")", ";", "String", "blobId", "=", "dataInputStream", ".", "readUTF", "(", ")", ";", "return", "new", "FileItem", "(", "name", ",", "blobId", ",", "length", ",", "lastModified", ")", ";", "}", "else", "{", "throw", "new", "IllegalStateException", "(", "\"Unsupported binary version <\"", "+", "binaryVersion", "+", "\">\"", ")", ";", "}", "}" ]
Deserialisiert ein FileItem aus einem übergebenen InputStream. @param dataInputStream Quelle der Deserialisierung @return FileItem @throws IOException
[ "Deserialisiert", "ein", "FileItem", "aus", "einem", "übergebenen", "InputStream", "." ]
train
https://github.com/ecclesia/kipeto/blob/ea39a10ae4eaa550f71a856ab2f2845270a64913/kipeto-core/src/main/java/de/ecclesia/kipeto/blueprint/FileItem.java#L128-L146
alkacon/opencms-core
src/org/opencms/ade/sitemap/CmsVfsSitemapService.java
CmsVfsSitemapService.ensureSingleLocale
void ensureSingleLocale(CmsXmlContainerPage containerPage, CmsResource localeRes) throws CmsException { """ Removes unnecessary locales from a container page.<p> @param containerPage the container page which should be changed @param localeRes the resource used to determine the locale @throws CmsException if something goes wrong """ CmsObject cms = getCmsObject(); Locale mainLocale = CmsLocaleManager.getMainLocale(cms, localeRes); OpenCms.getLocaleManager(); Locale defaultLocale = CmsLocaleManager.getDefaultLocale(); if (containerPage.hasLocale(mainLocale)) { removeAllLocalesExcept(containerPage, mainLocale); // remove other locales } else if (containerPage.hasLocale(defaultLocale)) { containerPage.copyLocale(defaultLocale, mainLocale); removeAllLocalesExcept(containerPage, mainLocale); } else if (containerPage.getLocales().size() > 0) { containerPage.copyLocale(containerPage.getLocales().get(0), mainLocale); removeAllLocalesExcept(containerPage, mainLocale); } else { containerPage.addLocale(cms, mainLocale); } }
java
void ensureSingleLocale(CmsXmlContainerPage containerPage, CmsResource localeRes) throws CmsException { CmsObject cms = getCmsObject(); Locale mainLocale = CmsLocaleManager.getMainLocale(cms, localeRes); OpenCms.getLocaleManager(); Locale defaultLocale = CmsLocaleManager.getDefaultLocale(); if (containerPage.hasLocale(mainLocale)) { removeAllLocalesExcept(containerPage, mainLocale); // remove other locales } else if (containerPage.hasLocale(defaultLocale)) { containerPage.copyLocale(defaultLocale, mainLocale); removeAllLocalesExcept(containerPage, mainLocale); } else if (containerPage.getLocales().size() > 0) { containerPage.copyLocale(containerPage.getLocales().get(0), mainLocale); removeAllLocalesExcept(containerPage, mainLocale); } else { containerPage.addLocale(cms, mainLocale); } }
[ "void", "ensureSingleLocale", "(", "CmsXmlContainerPage", "containerPage", ",", "CmsResource", "localeRes", ")", "throws", "CmsException", "{", "CmsObject", "cms", "=", "getCmsObject", "(", ")", ";", "Locale", "mainLocale", "=", "CmsLocaleManager", ".", "getMainLocale", "(", "cms", ",", "localeRes", ")", ";", "OpenCms", ".", "getLocaleManager", "(", ")", ";", "Locale", "defaultLocale", "=", "CmsLocaleManager", ".", "getDefaultLocale", "(", ")", ";", "if", "(", "containerPage", ".", "hasLocale", "(", "mainLocale", ")", ")", "{", "removeAllLocalesExcept", "(", "containerPage", ",", "mainLocale", ")", ";", "// remove other locales", "}", "else", "if", "(", "containerPage", ".", "hasLocale", "(", "defaultLocale", ")", ")", "{", "containerPage", ".", "copyLocale", "(", "defaultLocale", ",", "mainLocale", ")", ";", "removeAllLocalesExcept", "(", "containerPage", ",", "mainLocale", ")", ";", "}", "else", "if", "(", "containerPage", ".", "getLocales", "(", ")", ".", "size", "(", ")", ">", "0", ")", "{", "containerPage", ".", "copyLocale", "(", "containerPage", ".", "getLocales", "(", ")", ".", "get", "(", "0", ")", ",", "mainLocale", ")", ";", "removeAllLocalesExcept", "(", "containerPage", ",", "mainLocale", ")", ";", "}", "else", "{", "containerPage", ".", "addLocale", "(", "cms", ",", "mainLocale", ")", ";", "}", "}" ]
Removes unnecessary locales from a container page.<p> @param containerPage the container page which should be changed @param localeRes the resource used to determine the locale @throws CmsException if something goes wrong
[ "Removes", "unnecessary", "locales", "from", "a", "container", "page", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ade/sitemap/CmsVfsSitemapService.java#L1262-L1280
j-a-w-r/jawr-main-repo
jawr/jawr-core/src/main/java/net/jawr/web/config/JawrConfig.java
JawrConfig.registerResolver
private VariantResolver registerResolver(VariantResolver defaultResolver, String configPropertyName) { """ Register a resolver in the generator registry @param defaultResolver the default resolver @param configPropertyName the configuration property whose the value define the resolver class @return """ VariantResolver resolver = null; if (configProperties.getProperty(configPropertyName) == null) { resolver = defaultResolver; } else { resolver = (VariantResolver) ClassLoaderResourceUtils .buildObjectInstance(configProperties.getProperty(configPropertyName)); } this.generatorRegistry.registerVariantResolver(resolver); return resolver; }
java
private VariantResolver registerResolver(VariantResolver defaultResolver, String configPropertyName) { VariantResolver resolver = null; if (configProperties.getProperty(configPropertyName) == null) { resolver = defaultResolver; } else { resolver = (VariantResolver) ClassLoaderResourceUtils .buildObjectInstance(configProperties.getProperty(configPropertyName)); } this.generatorRegistry.registerVariantResolver(resolver); return resolver; }
[ "private", "VariantResolver", "registerResolver", "(", "VariantResolver", "defaultResolver", ",", "String", "configPropertyName", ")", "{", "VariantResolver", "resolver", "=", "null", ";", "if", "(", "configProperties", ".", "getProperty", "(", "configPropertyName", ")", "==", "null", ")", "{", "resolver", "=", "defaultResolver", ";", "}", "else", "{", "resolver", "=", "(", "VariantResolver", ")", "ClassLoaderResourceUtils", ".", "buildObjectInstance", "(", "configProperties", ".", "getProperty", "(", "configPropertyName", ")", ")", ";", "}", "this", ".", "generatorRegistry", ".", "registerVariantResolver", "(", "resolver", ")", ";", "return", "resolver", ";", "}" ]
Register a resolver in the generator registry @param defaultResolver the default resolver @param configPropertyName the configuration property whose the value define the resolver class @return
[ "Register", "a", "resolver", "in", "the", "generator", "registry" ]
train
https://github.com/j-a-w-r/jawr-main-repo/blob/5381f6acf461cd2502593c67a77bd6ef9eab848d/jawr/jawr-core/src/main/java/net/jawr/web/config/JawrConfig.java#L1235-L1246
h2oai/h2o-3
h2o-genmodel/src/main/java/hex/genmodel/algos/tree/SharedTreeGraph.java
SharedTreeGraph.printDot
public void printDot(PrintStream os, int maxLevelsToPrintPerEdge, boolean detail, String optionalTitle, PrintMojo.PrintTreeOptions treeOptions) { """ Print graph output in a format readable by dot (graphviz). @param os Stream to write the output to @param maxLevelsToPrintPerEdge Limit the number of individual categorical level names printed per edge @param detail include addtional node detail information @param optionalTitle Optional title to override the default @param treeOptions object of PrintTreeOptions to control how trees are printed in terms of font size and number of decimal places for numerical values """ os.println("/*"); os.println("Generated by:"); os.println(" http://https://github.com/h2oai/h2o-3/tree/master/h2o-genmodel/src/main/java/hex/genmodel/tools/PrintMojo.java"); os.println("*/"); os.println(""); os.println("/*"); os.println("On a mac:"); os.println(""); os.println("$ brew install graphviz"); os.println("$ dot -Tpng file.gv -o file.png"); os.println("$ open file.png"); os.println("*/"); os.println(""); os.println("digraph G {"); for (SharedTreeSubgraph sg : subgraphArray) { sg.printDot(os, maxLevelsToPrintPerEdge, detail, optionalTitle, treeOptions); } os.println(""); os.println("}"); os.println(""); }
java
public void printDot(PrintStream os, int maxLevelsToPrintPerEdge, boolean detail, String optionalTitle, PrintMojo.PrintTreeOptions treeOptions) { os.println("/*"); os.println("Generated by:"); os.println(" http://https://github.com/h2oai/h2o-3/tree/master/h2o-genmodel/src/main/java/hex/genmodel/tools/PrintMojo.java"); os.println("*/"); os.println(""); os.println("/*"); os.println("On a mac:"); os.println(""); os.println("$ brew install graphviz"); os.println("$ dot -Tpng file.gv -o file.png"); os.println("$ open file.png"); os.println("*/"); os.println(""); os.println("digraph G {"); for (SharedTreeSubgraph sg : subgraphArray) { sg.printDot(os, maxLevelsToPrintPerEdge, detail, optionalTitle, treeOptions); } os.println(""); os.println("}"); os.println(""); }
[ "public", "void", "printDot", "(", "PrintStream", "os", ",", "int", "maxLevelsToPrintPerEdge", ",", "boolean", "detail", ",", "String", "optionalTitle", ",", "PrintMojo", ".", "PrintTreeOptions", "treeOptions", ")", "{", "os", ".", "println", "(", "\"/*\"", ")", ";", "os", ".", "println", "(", "\"Generated by:\"", ")", ";", "os", ".", "println", "(", "\" http://https://github.com/h2oai/h2o-3/tree/master/h2o-genmodel/src/main/java/hex/genmodel/tools/PrintMojo.java\"", ")", ";", "os", ".", "println", "(", "\"*/\"", ")", ";", "os", ".", "println", "(", "\"\"", ")", ";", "os", ".", "println", "(", "\"/*\"", ")", ";", "os", ".", "println", "(", "\"On a mac:\"", ")", ";", "os", ".", "println", "(", "\"\"", ")", ";", "os", ".", "println", "(", "\"$ brew install graphviz\"", ")", ";", "os", ".", "println", "(", "\"$ dot -Tpng file.gv -o file.png\"", ")", ";", "os", ".", "println", "(", "\"$ open file.png\"", ")", ";", "os", ".", "println", "(", "\"*/\"", ")", ";", "os", ".", "println", "(", "\"\"", ")", ";", "os", ".", "println", "(", "\"digraph G {\"", ")", ";", "for", "(", "SharedTreeSubgraph", "sg", ":", "subgraphArray", ")", "{", "sg", ".", "printDot", "(", "os", ",", "maxLevelsToPrintPerEdge", ",", "detail", ",", "optionalTitle", ",", "treeOptions", ")", ";", "}", "os", ".", "println", "(", "\"\"", ")", ";", "os", ".", "println", "(", "\"}\"", ")", ";", "os", ".", "println", "(", "\"\"", ")", ";", "}" ]
Print graph output in a format readable by dot (graphviz). @param os Stream to write the output to @param maxLevelsToPrintPerEdge Limit the number of individual categorical level names printed per edge @param detail include addtional node detail information @param optionalTitle Optional title to override the default @param treeOptions object of PrintTreeOptions to control how trees are printed in terms of font size and number of decimal places for numerical values
[ "Print", "graph", "output", "in", "a", "format", "readable", "by", "dot", "(", "graphviz", ")", ".", "@param", "os", "Stream", "to", "write", "the", "output", "to", "@param", "maxLevelsToPrintPerEdge", "Limit", "the", "number", "of", "individual", "categorical", "level", "names", "printed", "per", "edge", "@param", "detail", "include", "addtional", "node", "detail", "information", "@param", "optionalTitle", "Optional", "title", "to", "override", "the", "default", "@param", "treeOptions", "object", "of", "PrintTreeOptions", "to", "control", "how", "trees", "are", "printed", "in", "terms", "of", "font", "size", "and", "number", "of", "decimal", "places", "for", "numerical", "values" ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-genmodel/src/main/java/hex/genmodel/algos/tree/SharedTreeGraph.java#L59-L80
tingley/snax-xml
src/main/java/net/sundell/snax/ElementSelector.java
ElementSelector.addTransition
public void addTransition(String localName, ElementSelector<T> target) { """ Create a transition to another node state represented by its {@link ElementSelector}. @param localName Local name of the element on which to transition (namespace is ignored) @param target target node state to which the transition leads """ addTransition(new QName(localName), target); }
java
public void addTransition(String localName, ElementSelector<T> target) { addTransition(new QName(localName), target); }
[ "public", "void", "addTransition", "(", "String", "localName", ",", "ElementSelector", "<", "T", ">", "target", ")", "{", "addTransition", "(", "new", "QName", "(", "localName", ")", ",", "target", ")", ";", "}" ]
Create a transition to another node state represented by its {@link ElementSelector}. @param localName Local name of the element on which to transition (namespace is ignored) @param target target node state to which the transition leads
[ "Create", "a", "transition", "to", "another", "node", "state", "represented", "by", "its", "{", "@link", "ElementSelector", "}", "." ]
train
https://github.com/tingley/snax-xml/blob/73858b9a53136694bc49d5c521d21fa33931e8df/src/main/java/net/sundell/snax/ElementSelector.java#L83-L85