repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
204
func_name
stringlengths
5
103
whole_func_string
stringlengths
87
3.44k
language
stringclasses
1 value
func_code_string
stringlengths
87
3.44k
func_code_tokens
listlengths
21
714
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
482
split_name
stringclasses
1 value
func_code_url
stringlengths
102
309
hazelcast/hazelcast
hazelcast/src/main/java/com/hazelcast/mapreduce/aggregation/Aggregations.java
Aggregations.integerSum
public static <Key, Value> Aggregation<Key, Integer, Integer> integerSum() { return new AggregationAdapter(new IntegerSumAggregation<Key, Value>()); }
java
public static <Key, Value> Aggregation<Key, Integer, Integer> integerSum() { return new AggregationAdapter(new IntegerSumAggregation<Key, Value>()); }
[ "public", "static", "<", "Key", ",", "Value", ">", "Aggregation", "<", "Key", ",", "Integer", ",", "Integer", ">", "integerSum", "(", ")", "{", "return", "new", "AggregationAdapter", "(", "new", "IntegerSumAggregation", "<", "Key", ",", "Value", ">", "(", ...
Returns an aggregation to calculate the integer sum of all supplied values.<br/> This aggregation is similar to: <pre>SELECT SUM(value) FROM x</pre> @param <Key> the input key type @param <Value> the supplied value type @return the sum over all supplied values
[ "Returns", "an", "aggregation", "to", "calculate", "the", "integer", "sum", "of", "all", "supplied", "values", ".", "<br", "/", ">", "This", "aggregation", "is", "similar", "to", ":", "<pre", ">", "SELECT", "SUM", "(", "value", ")", "FROM", "x<", "/", ...
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast/src/main/java/com/hazelcast/mapreduce/aggregation/Aggregations.java#L114-L116
VoltDB/voltdb
third_party/java/src/org/apache/commons_voltpatches/cli/CommandLine.java
CommandLine.getOptionValue
public String getOptionValue(String opt, String defaultValue) { String answer = getOptionValue(opt); return (answer != null) ? answer : defaultValue; }
java
public String getOptionValue(String opt, String defaultValue) { String answer = getOptionValue(opt); return (answer != null) ? answer : defaultValue; }
[ "public", "String", "getOptionValue", "(", "String", "opt", ",", "String", "defaultValue", ")", "{", "String", "answer", "=", "getOptionValue", "(", "opt", ")", ";", "return", "(", "answer", "!=", "null", ")", "?", "answer", ":", "defaultValue", ";", "}" ]
Retrieve the first argument, if any, of an option. @param opt name of the option @param defaultValue is the default value to be returned if the option is not specified @return Value of the argument if option is set, and has an argument, otherwise <code>defaultValue</code>.
[ "Retrieve", "the", "first", "argument", "if", "any", "of", "an", "option", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/third_party/java/src/org/apache/commons_voltpatches/cli/CommandLine.java#L229-L234
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.osgi/src/com/ibm/ws/logging/internal/osgi/WsTraceRouterImpl.java
WsTraceRouterImpl.setWsTraceHandler
public void setWsTraceHandler(String id, WsTraceHandler ref) { if (id != null && ref != null) { RERWLOCK.writeLock().lock(); try { wsTraceHandlerServices.put(id, ref); /* * Route prev traces to the new LogHandler. * * This is primarily for solving the problem during server init where the WsTraceRouterImpl * is registered *after* we've already issued some early startup traces. We cache * these early traces in the "earlierTraces" queue in BaseTraceService, which then * passes them to WsTraceRouterImpl once it's registered. */ if (earlierTraces == null) { return; } for (RoutedMessage earlierTrace : earlierTraces.toArray(new RoutedMessage[earlierTraces.size()])) { if (earlierTrace != null) { routeTo(earlierTrace, id); } } } finally { RERWLOCK.writeLock().unlock(); } } }
java
public void setWsTraceHandler(String id, WsTraceHandler ref) { if (id != null && ref != null) { RERWLOCK.writeLock().lock(); try { wsTraceHandlerServices.put(id, ref); /* * Route prev traces to the new LogHandler. * * This is primarily for solving the problem during server init where the WsTraceRouterImpl * is registered *after* we've already issued some early startup traces. We cache * these early traces in the "earlierTraces" queue in BaseTraceService, which then * passes them to WsTraceRouterImpl once it's registered. */ if (earlierTraces == null) { return; } for (RoutedMessage earlierTrace : earlierTraces.toArray(new RoutedMessage[earlierTraces.size()])) { if (earlierTrace != null) { routeTo(earlierTrace, id); } } } finally { RERWLOCK.writeLock().unlock(); } } }
[ "public", "void", "setWsTraceHandler", "(", "String", "id", ",", "WsTraceHandler", "ref", ")", "{", "if", "(", "id", "!=", "null", "&&", "ref", "!=", "null", ")", "{", "RERWLOCK", ".", "writeLock", "(", ")", ".", "lock", "(", ")", ";", "try", "{", ...
Add the wsTraceHandler ref. 1 or more LogHandlers may be set.
[ "Add", "the", "wsTraceHandler", "ref", ".", "1", "or", "more", "LogHandlers", "may", "be", "set", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.osgi/src/com/ibm/ws/logging/internal/osgi/WsTraceRouterImpl.java#L67-L93
moparisthebest/beehive
beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java
InternalUtils.setCurrentActionResolver
public static void setCurrentActionResolver( ActionResolver resolver, HttpServletRequest request, ServletContext servletContext ) { StorageHandler sh = Handlers.get( servletContext ).getStorageHandler(); HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart( request ); RequestContext rc = new RequestContext( unwrappedRequest, null ); String currentJpfAttrName = ScopedServletUtils.getScopedSessionAttrName( CURRENT_JPF_ATTR, unwrappedRequest ); String currentLongLivedJpfAttrName = ScopedServletUtils.getScopedSessionAttrName( CURRENT_LONGLIVED_ATTR, unwrappedRequest ); // // This case occurs when the previous page flow is no longer active and there is no new page flow // if ( resolver == null ) { sh.removeAttribute( rc, currentJpfAttrName ); sh.removeAttribute( rc, currentLongLivedJpfAttrName ); return; } // // If this is a long-lived page flow, also store the instance in an attribute that never goes away. // if ( resolver.isPageFlow() && isLongLived( ( ( PageFlowController ) resolver ).theModuleConfig() ) ) { String longLivedAttrName = getLongLivedFlowAttr( resolver.getModulePath() ); longLivedAttrName = ScopedServletUtils.getScopedSessionAttrName( longLivedAttrName, unwrappedRequest ); // Only set this attribute if it's not already there. We want to avoid our onDestroy() callback that's // invoked when the page flow's session attribute is unbound. if ( sh.getAttribute( rc, longLivedAttrName ) != resolver ) { sh.setAttribute( rc, longLivedAttrName, resolver ); } sh.setAttribute( rc, currentLongLivedJpfAttrName, resolver.getModulePath() ); sh.removeAttribute( rc, currentJpfAttrName ); } // // Default case for removing a previous page flow in the presence of a new page flow. // else { sh.setAttribute( rc, currentJpfAttrName, resolver ); sh.removeAttribute( rc, currentLongLivedJpfAttrName ); } }
java
public static void setCurrentActionResolver( ActionResolver resolver, HttpServletRequest request, ServletContext servletContext ) { StorageHandler sh = Handlers.get( servletContext ).getStorageHandler(); HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart( request ); RequestContext rc = new RequestContext( unwrappedRequest, null ); String currentJpfAttrName = ScopedServletUtils.getScopedSessionAttrName( CURRENT_JPF_ATTR, unwrappedRequest ); String currentLongLivedJpfAttrName = ScopedServletUtils.getScopedSessionAttrName( CURRENT_LONGLIVED_ATTR, unwrappedRequest ); // // This case occurs when the previous page flow is no longer active and there is no new page flow // if ( resolver == null ) { sh.removeAttribute( rc, currentJpfAttrName ); sh.removeAttribute( rc, currentLongLivedJpfAttrName ); return; } // // If this is a long-lived page flow, also store the instance in an attribute that never goes away. // if ( resolver.isPageFlow() && isLongLived( ( ( PageFlowController ) resolver ).theModuleConfig() ) ) { String longLivedAttrName = getLongLivedFlowAttr( resolver.getModulePath() ); longLivedAttrName = ScopedServletUtils.getScopedSessionAttrName( longLivedAttrName, unwrappedRequest ); // Only set this attribute if it's not already there. We want to avoid our onDestroy() callback that's // invoked when the page flow's session attribute is unbound. if ( sh.getAttribute( rc, longLivedAttrName ) != resolver ) { sh.setAttribute( rc, longLivedAttrName, resolver ); } sh.setAttribute( rc, currentLongLivedJpfAttrName, resolver.getModulePath() ); sh.removeAttribute( rc, currentJpfAttrName ); } // // Default case for removing a previous page flow in the presence of a new page flow. // else { sh.setAttribute( rc, currentJpfAttrName, resolver ); sh.removeAttribute( rc, currentLongLivedJpfAttrName ); } }
[ "public", "static", "void", "setCurrentActionResolver", "(", "ActionResolver", "resolver", ",", "HttpServletRequest", "request", ",", "ServletContext", "servletContext", ")", "{", "StorageHandler", "sh", "=", "Handlers", ".", "get", "(", "servletContext", ")", ".", ...
Set the current {@link ActionResolver} (or {@link PageFlowController}) in the user session. @param resolver the {@link ActionResolver} to set as the current one in the user session. @deprecated Will be removed in the next version.
[ "Set", "the", "current", "{", "@link", "ActionResolver", "}", "(", "or", "{", "@link", "PageFlowController", "}", ")", "in", "the", "user", "session", "." ]
train
https://github.com/moparisthebest/beehive/blob/4246a0cc40ce3c05f1a02c2da2653ac622703d77/beehive-netui-core/src/main/java/org/apache/beehive/netui/pageflow/internal/InternalUtils.java#L694-L741
box/box-java-sdk
src/main/java/com/box/sdk/BoxFolder.java
BoxFolder.createWebLink
public BoxWebLink.Info createWebLink(URL linkURL, String description) { return this.createWebLink(null, linkURL, description); }
java
public BoxWebLink.Info createWebLink(URL linkURL, String description) { return this.createWebLink(null, linkURL, description); }
[ "public", "BoxWebLink", ".", "Info", "createWebLink", "(", "URL", "linkURL", ",", "String", "description", ")", "{", "return", "this", ".", "createWebLink", "(", "null", ",", "linkURL", ",", "description", ")", ";", "}" ]
Uploads a new weblink to this folder. @param linkURL the URL the weblink points to. @param description the weblink's description. @return the uploaded weblink's info.
[ "Uploads", "a", "new", "weblink", "to", "this", "folder", "." ]
train
https://github.com/box/box-java-sdk/blob/35b4ba69417f9d6a002c19dfaab57527750ef349/src/main/java/com/box/sdk/BoxFolder.java#L594-L596
zaproxy/zaproxy
src/org/zaproxy/zap/extension/httpsessions/ExtensionHttpSessions.java
ExtensionHttpSessions.isSessionToken
public boolean isSessionToken(String site, String token) { // Add a default port if (!site.contains(":")) { site = site + (":80"); } HttpSessionTokensSet siteTokens = sessionTokens.get(site); if (siteTokens == null) return false; return siteTokens.isSessionToken(token); }
java
public boolean isSessionToken(String site, String token) { // Add a default port if (!site.contains(":")) { site = site + (":80"); } HttpSessionTokensSet siteTokens = sessionTokens.get(site); if (siteTokens == null) return false; return siteTokens.isSessionToken(token); }
[ "public", "boolean", "isSessionToken", "(", "String", "site", ",", "String", "token", ")", "{", "// Add a default port", "if", "(", "!", "site", ".", "contains", "(", "\":\"", ")", ")", "{", "site", "=", "site", "+", "(", "\":80\"", ")", ";", "}", "Htt...
Checks if a particular token is a session token name for a particular site. @param site the site. This parameter has to be formed as defined in the {@link ExtensionHttpSessions} class documentation. However, if the protocol is missing, a default protocol of 80 is used. @param token the token @return true, if it is session token
[ "Checks", "if", "a", "particular", "token", "is", "a", "session", "token", "name", "for", "a", "particular", "site", "." ]
train
https://github.com/zaproxy/zaproxy/blob/0cbe5121f2ae1ecca222513d182759210c569bec/src/org/zaproxy/zap/extension/httpsessions/ExtensionHttpSessions.java#L361-L370
looly/hutool
hutool-core/src/main/java/cn/hutool/core/date/format/FormatCache.java
FormatCache.getDateTimeInstance
F getDateTimeInstance(final int dateStyle, final int timeStyle, final TimeZone timeZone, final Locale locale) { return getDateTimeInstance(Integer.valueOf(dateStyle), Integer.valueOf(timeStyle), timeZone, locale); }
java
F getDateTimeInstance(final int dateStyle, final int timeStyle, final TimeZone timeZone, final Locale locale) { return getDateTimeInstance(Integer.valueOf(dateStyle), Integer.valueOf(timeStyle), timeZone, locale); }
[ "F", "getDateTimeInstance", "(", "final", "int", "dateStyle", ",", "final", "int", "timeStyle", ",", "final", "TimeZone", "timeZone", ",", "final", "Locale", "locale", ")", "{", "return", "getDateTimeInstance", "(", "Integer", ".", "valueOf", "(", "dateStyle", ...
package protected, for access from FastDateFormat; do not make public or protected
[ "package", "protected", "for", "access", "from", "FastDateFormat", ";", "do", "not", "make", "public", "or", "protected" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/date/format/FormatCache.java#L115-L117
liferay/com-liferay-commerce
commerce-tax-engine-fixed-service/src/main/java/com/liferay/commerce/tax/engine/fixed/service/persistence/impl/CommerceTaxFixedRateAddressRelPersistenceImpl.java
CommerceTaxFixedRateAddressRelPersistenceImpl.findByCPTaxCategoryId
@Override public List<CommerceTaxFixedRateAddressRel> findByCPTaxCategoryId( long CPTaxCategoryId, int start, int end) { return findByCPTaxCategoryId(CPTaxCategoryId, start, end, null); }
java
@Override public List<CommerceTaxFixedRateAddressRel> findByCPTaxCategoryId( long CPTaxCategoryId, int start, int end) { return findByCPTaxCategoryId(CPTaxCategoryId, start, end, null); }
[ "@", "Override", "public", "List", "<", "CommerceTaxFixedRateAddressRel", ">", "findByCPTaxCategoryId", "(", "long", "CPTaxCategoryId", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByCPTaxCategoryId", "(", "CPTaxCategoryId", ",", "start", ",", ...
Returns a range of all the commerce tax fixed rate address rels where CPTaxCategoryId = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CommerceTaxFixedRateAddressRelModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param CPTaxCategoryId the cp tax category ID @param start the lower bound of the range of commerce tax fixed rate address rels @param end the upper bound of the range of commerce tax fixed rate address rels (not inclusive) @return the range of matching commerce tax fixed rate address rels
[ "Returns", "a", "range", "of", "all", "the", "commerce", "tax", "fixed", "rate", "address", "rels", "where", "CPTaxCategoryId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-tax-engine-fixed-service/src/main/java/com/liferay/commerce/tax/engine/fixed/service/persistence/impl/CommerceTaxFixedRateAddressRelPersistenceImpl.java#L675-L679
briandilley/jsonrpc4j
src/main/java/com/googlecode/jsonrpc4j/JsonRpcClient.java
JsonRpcClient.writeAndFlushValue
private void writeAndFlushValue(OutputStream output, Object value) throws IOException { mapper.writeValue(new NoCloseOutputStream(output), value); output.flush(); }
java
private void writeAndFlushValue(OutputStream output, Object value) throws IOException { mapper.writeValue(new NoCloseOutputStream(output), value); output.flush(); }
[ "private", "void", "writeAndFlushValue", "(", "OutputStream", "output", ",", "Object", "value", ")", "throws", "IOException", "{", "mapper", ".", "writeValue", "(", "new", "NoCloseOutputStream", "(", "output", ")", ",", "value", ")", ";", "output", ".", "flush...
Writes and flushes a value to the given {@link OutputStream} and prevents Jackson from closing it. @param output the {@link OutputStream} @param value the value to write @throws IOException on error
[ "Writes", "and", "flushes", "a", "value", "to", "the", "given", "{", "@link", "OutputStream", "}", "and", "prevents", "Jackson", "from", "closing", "it", "." ]
train
https://github.com/briandilley/jsonrpc4j/blob/d749762c9295b92d893677a8c7be2a14dd43b3bb/src/main/java/com/googlecode/jsonrpc4j/JsonRpcClient.java#L357-L360
grails/gorm-hibernate5
grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsHibernateUtil.java
GrailsHibernateUtil.setObjectToReadWrite
public static void setObjectToReadWrite(final Object target, SessionFactory sessionFactory) { Session session = sessionFactory.getCurrentSession(); if (!canModifyReadWriteState(session, target)) { return; } SessionImplementor sessionImpl = (SessionImplementor) session; EntityEntry ee = sessionImpl.getPersistenceContext().getEntry(target); if (ee == null || ee.getStatus() != Status.READ_ONLY) { return; } Object actualTarget = target; if (target instanceof HibernateProxy) { actualTarget = ((HibernateProxy)target).getHibernateLazyInitializer().getImplementation(); } session.setReadOnly(actualTarget, false); session.setHibernateFlushMode(FlushMode.AUTO); incrementVersion(target); }
java
public static void setObjectToReadWrite(final Object target, SessionFactory sessionFactory) { Session session = sessionFactory.getCurrentSession(); if (!canModifyReadWriteState(session, target)) { return; } SessionImplementor sessionImpl = (SessionImplementor) session; EntityEntry ee = sessionImpl.getPersistenceContext().getEntry(target); if (ee == null || ee.getStatus() != Status.READ_ONLY) { return; } Object actualTarget = target; if (target instanceof HibernateProxy) { actualTarget = ((HibernateProxy)target).getHibernateLazyInitializer().getImplementation(); } session.setReadOnly(actualTarget, false); session.setHibernateFlushMode(FlushMode.AUTO); incrementVersion(target); }
[ "public", "static", "void", "setObjectToReadWrite", "(", "final", "Object", "target", ",", "SessionFactory", "sessionFactory", ")", "{", "Session", "session", "=", "sessionFactory", ".", "getCurrentSession", "(", ")", ";", "if", "(", "!", "canModifyReadWriteState", ...
Sets the target object to read-write, allowing Hibernate to dirty check it and auto-flush changes. @see #setObjectToReadyOnly(Object, org.hibernate.SessionFactory) @param target The target object @param sessionFactory The SessionFactory instance
[ "Sets", "the", "target", "object", "to", "read", "-", "write", "allowing", "Hibernate", "to", "dirty", "check", "it", "and", "auto", "-", "flush", "changes", "." ]
train
https://github.com/grails/gorm-hibernate5/blob/0ebb80cd769ef2bea955723d4543828a3e9542ef/grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsHibernateUtil.java#L319-L340
opencb/biodata
biodata-tools/src/main/java/org/opencb/biodata/tools/variant/LeftAligner.java
LeftAligner.isValidBase
static boolean isValidBase(char base, boolean acceptAmbiguous) { boolean isValidBase = PRECISE_BASES.contains(base); if (!isValidBase && acceptAmbiguous) { isValidBase = N.equals(base) || AMBIGUOUS_BASES.contains(base); } return isValidBase; }
java
static boolean isValidBase(char base, boolean acceptAmbiguous) { boolean isValidBase = PRECISE_BASES.contains(base); if (!isValidBase && acceptAmbiguous) { isValidBase = N.equals(base) || AMBIGUOUS_BASES.contains(base); } return isValidBase; }
[ "static", "boolean", "isValidBase", "(", "char", "base", ",", "boolean", "acceptAmbiguous", ")", "{", "boolean", "isValidBase", "=", "PRECISE_BASES", ".", "contains", "(", "base", ")", ";", "if", "(", "!", "isValidBase", "&&", "acceptAmbiguous", ")", "{", "i...
Only accepts as a valid base A, C, G and T or IUPAC ambiguous if enabled @param base @return
[ "Only", "accepts", "as", "a", "valid", "base", "A", "C", "G", "and", "T", "or", "IUPAC", "ambiguous", "if", "enabled" ]
train
https://github.com/opencb/biodata/blob/21b3d51d71f578efab908422aca4bab7a73097b1/biodata-tools/src/main/java/org/opencb/biodata/tools/variant/LeftAligner.java#L124-L130
JodaOrg/joda-time
src/main/java/org/joda/time/format/PeriodFormatterBuilder.java
PeriodFormatterBuilder.appendSeparator
public PeriodFormatterBuilder appendSeparator(String text) { return appendSeparator(text, text, null, true, true); }
java
public PeriodFormatterBuilder appendSeparator(String text) { return appendSeparator(text, text, null, true, true); }
[ "public", "PeriodFormatterBuilder", "appendSeparator", "(", "String", "text", ")", "{", "return", "appendSeparator", "(", "text", ",", "text", ",", "null", ",", "true", ",", "true", ")", ";", "}" ]
Append a separator, which is output if fields are printed both before and after the separator. <p> For example, <code>builder.appendDays().appendSeparator(",").appendHours()</code> will only output the comma if both the days and hours fields are output. <p> The text will be parsed case-insensitively. <p> Note: appending a separator discontinues any further work on the latest appended field. @param text the text to use as a separator @return this PeriodFormatterBuilder @throws IllegalStateException if this separator follows a previous one
[ "Append", "a", "separator", "which", "is", "output", "if", "fields", "are", "printed", "both", "before", "and", "after", "the", "separator", ".", "<p", ">", "For", "example", "<code", ">", "builder", ".", "appendDays", "()", ".", "appendSeparator", "(", ")...
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/format/PeriodFormatterBuilder.java#L727-L729
knowm/XChange
xchange-wex/src/main/java/org/knowm/xchange/wex/v3/service/WexMarketDataServiceRaw.java
WexMarketDataServiceRaw.getBTCETrades
public WexTradesWrapper getBTCETrades(String pairs, int size) throws IOException { size = size < 1 ? 1 : (size > FULL_SIZE ? FULL_SIZE : size); return btce.getTrades(pairs.toLowerCase(), size, 1); }
java
public WexTradesWrapper getBTCETrades(String pairs, int size) throws IOException { size = size < 1 ? 1 : (size > FULL_SIZE ? FULL_SIZE : size); return btce.getTrades(pairs.toLowerCase(), size, 1); }
[ "public", "WexTradesWrapper", "getBTCETrades", "(", "String", "pairs", ",", "int", "size", ")", "throws", "IOException", "{", "size", "=", "size", "<", "1", "?", "1", ":", "(", "size", ">", "FULL_SIZE", "?", "FULL_SIZE", ":", "size", ")", ";", "return", ...
Get recent trades from exchange @param pairs Dash-delimited string of currency pairs to retrieve (e.g. "btc_usd-ltc_btc") @param size Integer value from 1 to 2000 -> get corresponding number of items @return WexTradesWrapper object @throws IOException
[ "Get", "recent", "trades", "from", "exchange" ]
train
https://github.com/knowm/XChange/blob/e45f437ac8e0b89cd66cdcb3258bdb1bf3d88186/xchange-wex/src/main/java/org/knowm/xchange/wex/v3/service/WexMarketDataServiceRaw.java#L64-L69
OpenLiberty/open-liberty
dev/com.ibm.websphere.javaee.el.3.0/src/javax/el/ELContext.java
ELContext.notifyPropertyResolved
public void notifyPropertyResolved(Object base, Object property) { for (EvaluationListener listener : listeners) { try { listener.propertyResolved(this, base, property); } catch (Throwable t) { Util.handleThrowable(t); // Ignore - no option to log } } }
java
public void notifyPropertyResolved(Object base, Object property) { for (EvaluationListener listener : listeners) { try { listener.propertyResolved(this, base, property); } catch (Throwable t) { Util.handleThrowable(t); // Ignore - no option to log } } }
[ "public", "void", "notifyPropertyResolved", "(", "Object", "base", ",", "Object", "property", ")", "{", "for", "(", "EvaluationListener", "listener", ":", "listeners", ")", "{", "try", "{", "listener", ".", "propertyResolved", "(", "this", ",", "base", ",", ...
Notify interested listeners that a property has been resolved. @param base The object on which the property was resolved @param property The property that was resolved @since EL 3.0
[ "Notify", "interested", "listeners", "that", "a", "property", "has", "been", "resolved", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.websphere.javaee.el.3.0/src/javax/el/ELContext.java#L205-L214
dadoonet/elasticsearch-beyonder
src/main/java/fr/pilato/elasticsearch/tools/index/IndexSettingsReader.java
IndexSettingsReader.readUpdateSettings
public static String readUpdateSettings(String root, String index) { return readSettings(root, index, Defaults.UpdateIndexSettingsFileName); }
java
public static String readUpdateSettings(String root, String index) { return readSettings(root, index, Defaults.UpdateIndexSettingsFileName); }
[ "public", "static", "String", "readUpdateSettings", "(", "String", "root", ",", "String", "index", ")", "{", "return", "readSettings", "(", "root", ",", "index", ",", "Defaults", ".", "UpdateIndexSettingsFileName", ")", ";", "}" ]
Read index settings @param root dir within the classpath @param index index name @return Update Settings
[ "Read", "index", "settings" ]
train
https://github.com/dadoonet/elasticsearch-beyonder/blob/275bf63432b97169a90a266e983143cca9ad7629/src/main/java/fr/pilato/elasticsearch/tools/index/IndexSettingsReader.java#L80-L82
duracloud/snapshot
snapshot-bridge-webapp/src/main/java/org/duracloud/snapshot/bridge/rest/SnapshotResource.java
SnapshotResource.updateHistory
@Path("{snapshotId}/history") @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response updateHistory(@PathParam("snapshotId") String snapshotId, UpdateSnapshotHistoryBridgeParameters params) { try { if (params.getAlternate() == null) { return Response.serverError() .entity(new ResponseDetails("Incorrect parameters submitted!")) .build(); } Snapshot snapshot = (params.getAlternate() ? this.snapshotRepo.findBySnapshotAlternateIds(snapshotId) : this.snapshotRepo.findByName(snapshotId)); // sanity check to make sure snapshot exists if (snapshot != null) { // sanity check input from history if (params.getHistory() != null && params.getHistory().length() > 0) { // set history, and refresh our variable from the DB snapshot = this.snapshotManager.updateHistory(snapshot, params.getHistory()); log.info("successfully processed snapshot " + "history update: {}", snapshot); } else { log.info("did not process empty or null snapshot " + "history update: {}", snapshot); } SnapshotSummary snapSummary = createSnapshotSummary(snapshot); List<SnapshotHistory> snapMeta = snapshot.getSnapshotHistory(); String history = // retrieve latest history update ((snapMeta != null && snapMeta.size() > 0) ? snapMeta.get(snapMeta.size() - 1).getHistory() : ""); UpdateSnapshotHistoryBridgeResult result = new UpdateSnapshotHistoryBridgeResult(snapSummary, history); log.debug("Returning results of update snapshot history: {}", result); return Response.ok(null) .entity(result) .build(); } else { String error = "Snapshot with " + (params.getAlternate() ? "alternate " : "") + "id [" + snapshotId + "] not found!"; return Response.serverError() .entity(new ResponseDetails(error)) .build(); } } catch (Exception ex) { log.error(ex.getMessage(), ex); return Response.serverError() .entity(new ResponseDetails(ex.getMessage())) .build(); } }
java
@Path("{snapshotId}/history") @POST @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) public Response updateHistory(@PathParam("snapshotId") String snapshotId, UpdateSnapshotHistoryBridgeParameters params) { try { if (params.getAlternate() == null) { return Response.serverError() .entity(new ResponseDetails("Incorrect parameters submitted!")) .build(); } Snapshot snapshot = (params.getAlternate() ? this.snapshotRepo.findBySnapshotAlternateIds(snapshotId) : this.snapshotRepo.findByName(snapshotId)); // sanity check to make sure snapshot exists if (snapshot != null) { // sanity check input from history if (params.getHistory() != null && params.getHistory().length() > 0) { // set history, and refresh our variable from the DB snapshot = this.snapshotManager.updateHistory(snapshot, params.getHistory()); log.info("successfully processed snapshot " + "history update: {}", snapshot); } else { log.info("did not process empty or null snapshot " + "history update: {}", snapshot); } SnapshotSummary snapSummary = createSnapshotSummary(snapshot); List<SnapshotHistory> snapMeta = snapshot.getSnapshotHistory(); String history = // retrieve latest history update ((snapMeta != null && snapMeta.size() > 0) ? snapMeta.get(snapMeta.size() - 1).getHistory() : ""); UpdateSnapshotHistoryBridgeResult result = new UpdateSnapshotHistoryBridgeResult(snapSummary, history); log.debug("Returning results of update snapshot history: {}", result); return Response.ok(null) .entity(result) .build(); } else { String error = "Snapshot with " + (params.getAlternate() ? "alternate " : "") + "id [" + snapshotId + "] not found!"; return Response.serverError() .entity(new ResponseDetails(error)) .build(); } } catch (Exception ex) { log.error(ex.getMessage(), ex); return Response.serverError() .entity(new ResponseDetails(ex.getMessage())) .build(); } }
[ "@", "Path", "(", "\"{snapshotId}/history\"", ")", "@", "POST", "@", "Consumes", "(", "MediaType", ".", "APPLICATION_JSON", ")", "@", "Produces", "(", "MediaType", ".", "APPLICATION_JSON", ")", "public", "Response", "updateHistory", "(", "@", "PathParam", "(", ...
Updates a snapshot's history @param snapshotId - a snapshot's ID or it's alternate ID @param params - JSON object that contains the history String and a Boolean of whether this request is using a snapshot's ID or an alternate ID @return
[ "Updates", "a", "snapshot", "s", "history" ]
train
https://github.com/duracloud/snapshot/blob/7cb387b22fd4a9425087f654276138727c2c0b73/snapshot-bridge-webapp/src/main/java/org/duracloud/snapshot/bridge/rest/SnapshotResource.java#L653-L709
twitter/cloudhopper-commons
ch-commons-util/src/main/java/com/cloudhopper/commons/util/windowing/Window.java
Window.cancelAll
public List<WindowFuture<K,R,P>> cancelAll() { if (this.futures.size() <= 0) { return null; } List<WindowFuture<K,R,P>> cancelled = new ArrayList<WindowFuture<K,R,P>>(); long now = System.currentTimeMillis(); this.lock.lock(); try { // check every request this window contains and see if it's expired for (DefaultWindowFuture<K,R,P> future : this.futures.values()) { cancelled.add(future); future.cancelHelper(now); } if (cancelled.size() > 0) { this.futures.clear(); // signal that a future is completed this.completedCondition.signalAll(); } } finally { this.lock.unlock(); } return cancelled; }
java
public List<WindowFuture<K,R,P>> cancelAll() { if (this.futures.size() <= 0) { return null; } List<WindowFuture<K,R,P>> cancelled = new ArrayList<WindowFuture<K,R,P>>(); long now = System.currentTimeMillis(); this.lock.lock(); try { // check every request this window contains and see if it's expired for (DefaultWindowFuture<K,R,P> future : this.futures.values()) { cancelled.add(future); future.cancelHelper(now); } if (cancelled.size() > 0) { this.futures.clear(); // signal that a future is completed this.completedCondition.signalAll(); } } finally { this.lock.unlock(); } return cancelled; }
[ "public", "List", "<", "WindowFuture", "<", "K", ",", "R", ",", "P", ">", ">", "cancelAll", "(", ")", "{", "if", "(", "this", ".", "futures", ".", "size", "(", ")", "<=", "0", ")", "{", "return", "null", ";", "}", "List", "<", "WindowFuture", "...
Cancels (completes) all requests. Any callers/threads waiting for completion will be signaled. Also, since this frees up all slots in the window, all callers/threads blocked with pending offers will be signaled to continue. @return A list of all futures that were cancelled. @throws InterruptedException Thrown if the calling thread is interrupted and we're currently waiting to acquire the internal "windowLock".
[ "Cancels", "(", "completes", ")", "all", "requests", ".", "Any", "callers", "/", "threads", "waiting", "for", "completion", "will", "be", "signaled", ".", "Also", "since", "this", "frees", "up", "all", "slots", "in", "the", "window", "all", "callers", "/",...
train
https://github.com/twitter/cloudhopper-commons/blob/b5bc397dbec4537e8149e7ec0733c1d7ed477499/ch-commons-util/src/main/java/com/cloudhopper/commons/util/windowing/Window.java#L633-L657
Pi4J/pi4j
pi4j-gpio-extension/src/main/java/com/pi4j/gpio/extension/pca/PCA9685GpioProvider.java
PCA9685GpioProvider.setPwm
@Override public void setPwm(Pin pin, int duration) { int offPosition = calculateOffPositionForPulseDuration(duration); setPwm(pin, 0, offPosition); }
java
@Override public void setPwm(Pin pin, int duration) { int offPosition = calculateOffPositionForPulseDuration(duration); setPwm(pin, 0, offPosition); }
[ "@", "Override", "public", "void", "setPwm", "(", "Pin", "pin", ",", "int", "duration", ")", "{", "int", "offPosition", "=", "calculateOffPositionForPulseDuration", "(", "duration", ")", ";", "setPwm", "(", "pin", ",", "0", ",", "offPosition", ")", ";", "}...
Set pulse duration in microseconds.<br> Make sure duration doesn't exceed period time(1'000'000/freq)! @param pin represents channel 0..15 @param duration pulse duration in microseconds
[ "Set", "pulse", "duration", "in", "microseconds", ".", "<br", ">", "Make", "sure", "duration", "doesn", "t", "exceed", "period", "time", "(", "1", "000", "000", "/", "freq", ")", "!" ]
train
https://github.com/Pi4J/pi4j/blob/03cacc62223cc59b3118bfcefadabab979fd84c7/pi4j-gpio-extension/src/main/java/com/pi4j/gpio/extension/pca/PCA9685GpioProvider.java#L167-L171
michel-kraemer/bson4jackson
src/main/java/de/undercouch/bson4jackson/BsonParser.java
BsonParser.readTimestamp
protected Timestamp readTimestamp() throws IOException { int inc = _in.readInt(); int time = _in.readInt(); return new Timestamp(time, inc); }
java
protected Timestamp readTimestamp() throws IOException { int inc = _in.readInt(); int time = _in.readInt(); return new Timestamp(time, inc); }
[ "protected", "Timestamp", "readTimestamp", "(", ")", "throws", "IOException", "{", "int", "inc", "=", "_in", ".", "readInt", "(", ")", ";", "int", "time", "=", "_in", ".", "readInt", "(", ")", ";", "return", "new", "Timestamp", "(", "time", ",", "inc",...
Reads a timestamp object from the input stream @return the timestamp @throws IOException if the timestamp could not be read
[ "Reads", "a", "timestamp", "object", "from", "the", "input", "stream" ]
train
https://github.com/michel-kraemer/bson4jackson/blob/32d2ab3c516b3c07490fdfcf0c5e4ed0a2ee3979/src/main/java/de/undercouch/bson4jackson/BsonParser.java#L607-L611
apache/incubator-gobblin
gobblin-core/src/main/java/org/apache/gobblin/source/extractor/extract/QueryBasedExtractor.java
QueryBasedExtractor.setRangePredicates
private void setRangePredicates(String watermarkColumn, WatermarkType watermarkType, long lwmValue, long hwmValue) { log.debug("Getting range predicates"); String lwmOperator = partition.isLowWatermarkInclusive() ? ">=" : ">"; String hwmOperator = (partition.isLastPartition() || partition.isHighWatermarkInclusive()) ? "<=" : "<"; WatermarkPredicate watermark = new WatermarkPredicate(watermarkColumn, watermarkType); this.addPredicates(watermark.getPredicate(this, lwmValue, lwmOperator, Predicate.PredicateType.LWM)); this.addPredicates(watermark.getPredicate(this, hwmValue, hwmOperator, Predicate.PredicateType.HWM)); if (Boolean.valueOf(this.workUnitState.getProp(ConfigurationKeys.SOURCE_QUERYBASED_IS_HOURLY_EXTRACT))) { String hourColumn = this.workUnitState.getProp(ConfigurationKeys.SOURCE_QUERYBASED_HOUR_COLUMN); if (StringUtils.isNotBlank(hourColumn)) { WatermarkPredicate hourlyWatermark = new WatermarkPredicate(hourColumn, WatermarkType.HOUR); this.addPredicates(hourlyWatermark.getPredicate(this, lwmValue, lwmOperator, Predicate.PredicateType.LWM)); this.addPredicates(hourlyWatermark.getPredicate(this, hwmValue, hwmOperator, Predicate.PredicateType.HWM)); } } }
java
private void setRangePredicates(String watermarkColumn, WatermarkType watermarkType, long lwmValue, long hwmValue) { log.debug("Getting range predicates"); String lwmOperator = partition.isLowWatermarkInclusive() ? ">=" : ">"; String hwmOperator = (partition.isLastPartition() || partition.isHighWatermarkInclusive()) ? "<=" : "<"; WatermarkPredicate watermark = new WatermarkPredicate(watermarkColumn, watermarkType); this.addPredicates(watermark.getPredicate(this, lwmValue, lwmOperator, Predicate.PredicateType.LWM)); this.addPredicates(watermark.getPredicate(this, hwmValue, hwmOperator, Predicate.PredicateType.HWM)); if (Boolean.valueOf(this.workUnitState.getProp(ConfigurationKeys.SOURCE_QUERYBASED_IS_HOURLY_EXTRACT))) { String hourColumn = this.workUnitState.getProp(ConfigurationKeys.SOURCE_QUERYBASED_HOUR_COLUMN); if (StringUtils.isNotBlank(hourColumn)) { WatermarkPredicate hourlyWatermark = new WatermarkPredicate(hourColumn, WatermarkType.HOUR); this.addPredicates(hourlyWatermark.getPredicate(this, lwmValue, lwmOperator, Predicate.PredicateType.LWM)); this.addPredicates(hourlyWatermark.getPredicate(this, hwmValue, hwmOperator, Predicate.PredicateType.HWM)); } } }
[ "private", "void", "setRangePredicates", "(", "String", "watermarkColumn", ",", "WatermarkType", "watermarkType", ",", "long", "lwmValue", ",", "long", "hwmValue", ")", "{", "log", ".", "debug", "(", "\"Getting range predicates\"", ")", ";", "String", "lwmOperator",...
range predicates for watermark column and transaction columns. @param watermarkColumn name of the column used as watermark @param watermarkType watermark type @param lwmValue estimated low watermark value @param hwmValue estimated high watermark value
[ "range", "predicates", "for", "watermark", "column", "and", "transaction", "columns", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core/src/main/java/org/apache/gobblin/source/extractor/extract/QueryBasedExtractor.java#L411-L428
duracloud/duracloud
s3storageprovider/src/main/java/org/duracloud/s3task/streaming/EnableStreamingTaskRunner.java
EnableStreamingTaskRunner.setBucketAccessPolicy
private void setBucketAccessPolicy(String bucketName, String oaIdentityId) { CloudFrontOriginAccessIdentity cfOAIdentity = cfClient.getCloudFrontOriginAccessIdentity( new GetCloudFrontOriginAccessIdentityRequest(oaIdentityId)) .getCloudFrontOriginAccessIdentity(); String s3UserId = cfOAIdentity.getS3CanonicalUserId(); StringBuilder policyText = new StringBuilder(); policyText.append("{\"Version\":\"2012-10-17\","); policyText.append("\"Id\":\"PolicyForCloudFrontPrivateContent\","); policyText.append("\"Statement\":[{"); policyText.append("\"Sid\":\"Grant CloudFront access to private content\","); policyText.append("\"Effect\":\"Allow\","); policyText.append("\"Principal\":{\"CanonicalUser\":\"" + s3UserId + "\"},"); policyText.append("\"Action\":\"s3:GetObject\","); policyText.append("\"Resource\":\"arn:aws:s3:::" + bucketName + "/*\""); policyText.append("}]}"); s3Client.setBucketPolicy(bucketName, policyText.toString()); }
java
private void setBucketAccessPolicy(String bucketName, String oaIdentityId) { CloudFrontOriginAccessIdentity cfOAIdentity = cfClient.getCloudFrontOriginAccessIdentity( new GetCloudFrontOriginAccessIdentityRequest(oaIdentityId)) .getCloudFrontOriginAccessIdentity(); String s3UserId = cfOAIdentity.getS3CanonicalUserId(); StringBuilder policyText = new StringBuilder(); policyText.append("{\"Version\":\"2012-10-17\","); policyText.append("\"Id\":\"PolicyForCloudFrontPrivateContent\","); policyText.append("\"Statement\":[{"); policyText.append("\"Sid\":\"Grant CloudFront access to private content\","); policyText.append("\"Effect\":\"Allow\","); policyText.append("\"Principal\":{\"CanonicalUser\":\"" + s3UserId + "\"},"); policyText.append("\"Action\":\"s3:GetObject\","); policyText.append("\"Resource\":\"arn:aws:s3:::" + bucketName + "/*\""); policyText.append("}]}"); s3Client.setBucketPolicy(bucketName, policyText.toString()); }
[ "private", "void", "setBucketAccessPolicy", "(", "String", "bucketName", ",", "String", "oaIdentityId", ")", "{", "CloudFrontOriginAccessIdentity", "cfOAIdentity", "=", "cfClient", ".", "getCloudFrontOriginAccessIdentity", "(", "new", "GetCloudFrontOriginAccessIdentityRequest",...
/* Updates the bucket policy to allow GET access to the cloudfront origin access identity. This allows Cloudfront to access content in S3 @return results of the ACL setting activity
[ "/", "*", "Updates", "the", "bucket", "policy", "to", "allow", "GET", "access", "to", "the", "cloudfront", "origin", "access", "identity", ".", "This", "allows", "Cloudfront", "to", "access", "content", "in", "S3" ]
train
https://github.com/duracloud/duracloud/blob/dc4f3a1716d43543cc3b2e1880605f9389849b66/s3storageprovider/src/main/java/org/duracloud/s3task/streaming/EnableStreamingTaskRunner.java#L192-L210
graknlabs/grakn
server/src/server/kb/concept/ConceptUtils.java
ConceptUtils.mergeAnswers
public static ConceptMap mergeAnswers(ConceptMap answerA, ConceptMap answerB) { if (answerB.isEmpty()) return answerA; if (answerA.isEmpty()) return answerB; Sets.SetView<Variable> varUnion = Sets.union(answerA.vars(), answerB.vars()); Set<Variable> varIntersection = Sets.intersection(answerA.vars(), answerB.vars()); Map<Variable, Concept> entryMap = Sets.union( answerA.map().entrySet(), answerB.map().entrySet() ) .stream() .filter(e -> !varIntersection.contains(e.getKey())) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); varIntersection .forEach(var -> { Concept concept = answerA.get(var); Concept otherConcept = answerB.get(var); if (concept.equals(otherConcept)) entryMap.put(var, concept); else { if (concept.isSchemaConcept() && otherConcept.isSchemaConcept() && !ConceptUtils.areDisjointTypes(concept.asSchemaConcept(), otherConcept.asSchemaConcept(), false)) { entryMap.put( var, Iterables.getOnlyElement(ConceptUtils.topOrMeta( Sets.newHashSet( concept.asSchemaConcept(), otherConcept.asSchemaConcept()) ) ) ); } } }); if (!entryMap.keySet().equals(varUnion)) return new ConceptMap(); return new ConceptMap(entryMap, answerA.explanation()); }
java
public static ConceptMap mergeAnswers(ConceptMap answerA, ConceptMap answerB) { if (answerB.isEmpty()) return answerA; if (answerA.isEmpty()) return answerB; Sets.SetView<Variable> varUnion = Sets.union(answerA.vars(), answerB.vars()); Set<Variable> varIntersection = Sets.intersection(answerA.vars(), answerB.vars()); Map<Variable, Concept> entryMap = Sets.union( answerA.map().entrySet(), answerB.map().entrySet() ) .stream() .filter(e -> !varIntersection.contains(e.getKey())) .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue)); varIntersection .forEach(var -> { Concept concept = answerA.get(var); Concept otherConcept = answerB.get(var); if (concept.equals(otherConcept)) entryMap.put(var, concept); else { if (concept.isSchemaConcept() && otherConcept.isSchemaConcept() && !ConceptUtils.areDisjointTypes(concept.asSchemaConcept(), otherConcept.asSchemaConcept(), false)) { entryMap.put( var, Iterables.getOnlyElement(ConceptUtils.topOrMeta( Sets.newHashSet( concept.asSchemaConcept(), otherConcept.asSchemaConcept()) ) ) ); } } }); if (!entryMap.keySet().equals(varUnion)) return new ConceptMap(); return new ConceptMap(entryMap, answerA.explanation()); }
[ "public", "static", "ConceptMap", "mergeAnswers", "(", "ConceptMap", "answerA", ",", "ConceptMap", "answerB", ")", "{", "if", "(", "answerB", ".", "isEmpty", "(", ")", ")", "return", "answerA", ";", "if", "(", "answerA", ".", "isEmpty", "(", ")", ")", "r...
perform an answer merge with optional explanation NB:assumes answers are compatible (concept corresponding to join vars if any are the same) @return merged answer
[ "perform", "an", "answer", "merge", "with", "optional", "explanation", "NB", ":", "assumes", "answers", "are", "compatible", "(", "concept", "corresponding", "to", "join", "vars", "if", "any", "are", "the", "same", ")" ]
train
https://github.com/graknlabs/grakn/blob/6aaee75ea846202474d591f8809d62028262fac5/server/src/server/kb/concept/ConceptUtils.java#L118-L154
Azure/azure-sdk-for-java
compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/DisksInner.java
DisksInner.beginRevokeAccessAsync
public Observable<Void> beginRevokeAccessAsync(String resourceGroupName, String diskName) { return beginRevokeAccessWithServiceResponseAsync(resourceGroupName, diskName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> beginRevokeAccessAsync(String resourceGroupName, String diskName) { return beginRevokeAccessWithServiceResponseAsync(resourceGroupName, diskName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "beginRevokeAccessAsync", "(", "String", "resourceGroupName", ",", "String", "diskName", ")", "{", "return", "beginRevokeAccessWithServiceResponseAsync", "(", "resourceGroupName", ",", "diskName", ")", ".", "map", "(", "new", ...
Revokes access to a disk. @param resourceGroupName The name of the resource group. @param diskName The name of the managed disk that is being created. The name can't be changed after the disk is created. Supported characters for the name are a-z, A-Z, 0-9 and _. The maximum name length is 80 characters. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Revokes", "access", "to", "a", "disk", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2018_04_01/src/main/java/com/microsoft/azure/management/compute/v2018_04_01/implementation/DisksInner.java#L1214-L1221
Azure/azure-sdk-for-java
network/resource-manager/v2018_08_01/src/main/java/com/microsoft/azure/management/network/v2018_08_01/implementation/ExpressRouteCrossConnectionPeeringsInner.java
ExpressRouteCrossConnectionPeeringsInner.createOrUpdateAsync
public Observable<ExpressRouteCrossConnectionPeeringInner> createOrUpdateAsync(String resourceGroupName, String crossConnectionName, String peeringName, ExpressRouteCrossConnectionPeeringInner peeringParameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, crossConnectionName, peeringName, peeringParameters).map(new Func1<ServiceResponse<ExpressRouteCrossConnectionPeeringInner>, ExpressRouteCrossConnectionPeeringInner>() { @Override public ExpressRouteCrossConnectionPeeringInner call(ServiceResponse<ExpressRouteCrossConnectionPeeringInner> response) { return response.body(); } }); }
java
public Observable<ExpressRouteCrossConnectionPeeringInner> createOrUpdateAsync(String resourceGroupName, String crossConnectionName, String peeringName, ExpressRouteCrossConnectionPeeringInner peeringParameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, crossConnectionName, peeringName, peeringParameters).map(new Func1<ServiceResponse<ExpressRouteCrossConnectionPeeringInner>, ExpressRouteCrossConnectionPeeringInner>() { @Override public ExpressRouteCrossConnectionPeeringInner call(ServiceResponse<ExpressRouteCrossConnectionPeeringInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "ExpressRouteCrossConnectionPeeringInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "crossConnectionName", ",", "String", "peeringName", ",", "ExpressRouteCrossConnectionPeeringInner", "peeringParameters", ")", ...
Creates or updates a peering in the specified ExpressRouteCrossConnection. @param resourceGroupName The name of the resource group. @param crossConnectionName The name of the ExpressRouteCrossConnection. @param peeringName The name of the peering. @param peeringParameters Parameters supplied to the create or update ExpressRouteCrossConnection peering operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Creates", "or", "updates", "a", "peering", "in", "the", "specified", "ExpressRouteCrossConnection", "." ]
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/ExpressRouteCrossConnectionPeeringsInner.java#L512-L519
icode/ameba
src/main/java/ameba/db/ebean/support/ModelResourceStructure.java
ModelResourceStructure.fetchHistory
public Response fetchHistory(@PathParam("id") URI_ID id) throws Exception { final MODEL_ID mId = tryConvertId(id); matchedFetchHistory(mId); final Query<MODEL> query = server.find(modelType); defaultFindOrderBy(query); final Ref<FutureRowCount> rowCount = Refs.emptyRef(); Object entity = executeTx(t -> { configDefaultQuery(query); configFetchHistoryQuery(query, mId); applyUriQuery(query, false); applyPageConfig(query); List<Version<MODEL>> list = query.findVersions(); rowCount.set(fetchRowCount(query)); return processFetchedHistoryModelList(list, mId); }); if (isEmptyEntity(entity)) { return Response.noContent().build(); } Response response = Response.ok(entity).build(); applyRowCountHeader(response.getHeaders(), query, rowCount.get()); return response; }
java
public Response fetchHistory(@PathParam("id") URI_ID id) throws Exception { final MODEL_ID mId = tryConvertId(id); matchedFetchHistory(mId); final Query<MODEL> query = server.find(modelType); defaultFindOrderBy(query); final Ref<FutureRowCount> rowCount = Refs.emptyRef(); Object entity = executeTx(t -> { configDefaultQuery(query); configFetchHistoryQuery(query, mId); applyUriQuery(query, false); applyPageConfig(query); List<Version<MODEL>> list = query.findVersions(); rowCount.set(fetchRowCount(query)); return processFetchedHistoryModelList(list, mId); }); if (isEmptyEntity(entity)) { return Response.noContent().build(); } Response response = Response.ok(entity).build(); applyRowCountHeader(response.getHeaders(), query, rowCount.get()); return response; }
[ "public", "Response", "fetchHistory", "(", "@", "PathParam", "(", "\"id\"", ")", "URI_ID", "id", ")", "throws", "Exception", "{", "final", "MODEL_ID", "mId", "=", "tryConvertId", "(", "id", ")", ";", "matchedFetchHistory", "(", "mId", ")", ";", "final", "Q...
<p>fetchHistory.</p> @param id a URI_ID object. @return a {@link javax.ws.rs.core.Response} object. @throws java.lang.Exception if any.
[ "<p", ">", "fetchHistory", ".", "<", "/", "p", ">" ]
train
https://github.com/icode/ameba/blob/9d4956e935898e41331b2745e400ef869cd265e0/src/main/java/ameba/db/ebean/support/ModelResourceStructure.java#L835-L859
sawano/java-commons
src/main/java/se/sawano/java/commons/lang/validate/AbstractValidate.java
AbstractValidate.notBlank
public <T extends CharSequence> T notBlank(final T chars, final String message, final Object... values) { if (chars == null) { failNull(String.format(message, values)); } if (StringUtils.isBlank(chars)) { fail(String.format(message, values)); } return chars; }
java
public <T extends CharSequence> T notBlank(final T chars, final String message, final Object... values) { if (chars == null) { failNull(String.format(message, values)); } if (StringUtils.isBlank(chars)) { fail(String.format(message, values)); } return chars; }
[ "public", "<", "T", "extends", "CharSequence", ">", "T", "notBlank", "(", "final", "T", "chars", ",", "final", "String", "message", ",", "final", "Object", "...", "values", ")", "{", "if", "(", "chars", "==", "null", ")", "{", "failNull", "(", "String"...
<p>Validate that the specified argument character sequence is neither {@code null}, a length of zero (no characters), empty nor whitespace; otherwise throwing an exception with the specified message. </p> <pre>Validate.notBlank(myString, "The string must not be blank");</pre> @param <T> the character sequence type @param chars the character sequence to check, validated not null by this method @param message the {@link String#format(String, Object...)} exception message if invalid, not null @param values the optional values for the formatted exception message, null array not recommended @return the validated character sequence (never {@code null} method for chaining) @throws NullPointerValidationException if the character sequence is {@code null} @throws IllegalArgumentException if the character sequence is blank @see #notBlank(CharSequence)
[ "<p", ">", "Validate", "that", "the", "specified", "argument", "character", "sequence", "is", "neither", "{", "@code", "null", "}", "a", "length", "of", "zero", "(", "no", "characters", ")", "empty", "nor", "whitespace", ";", "otherwise", "throwing", "an", ...
train
https://github.com/sawano/java-commons/blob/6f219c9e8dec4401dbe528d17ae6ec1ef9c0d284/src/main/java/se/sawano/java/commons/lang/validate/AbstractValidate.java#L776-L784
Azure/azure-sdk-for-java
compute/resource-manager/v2017_12_01/src/main/java/com/microsoft/azure/management/compute/v2017_12_01/implementation/VirtualMachinesInner.java
VirtualMachinesInner.updateAsync
public Observable<VirtualMachineInner> updateAsync(String resourceGroupName, String vmName, VirtualMachineUpdate parameters) { return updateWithServiceResponseAsync(resourceGroupName, vmName, parameters).map(new Func1<ServiceResponse<VirtualMachineInner>, VirtualMachineInner>() { @Override public VirtualMachineInner call(ServiceResponse<VirtualMachineInner> response) { return response.body(); } }); }
java
public Observable<VirtualMachineInner> updateAsync(String resourceGroupName, String vmName, VirtualMachineUpdate parameters) { return updateWithServiceResponseAsync(resourceGroupName, vmName, parameters).map(new Func1<ServiceResponse<VirtualMachineInner>, VirtualMachineInner>() { @Override public VirtualMachineInner call(ServiceResponse<VirtualMachineInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "VirtualMachineInner", ">", "updateAsync", "(", "String", "resourceGroupName", ",", "String", "vmName", ",", "VirtualMachineUpdate", "parameters", ")", "{", "return", "updateWithServiceResponseAsync", "(", "resourceGroupName", ",", "vmName", ...
The operation to update a virtual machine. @param resourceGroupName The name of the resource group. @param vmName The name of the virtual machine. @param parameters Parameters supplied to the Update Virtual Machine operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "The", "operation", "to", "update", "a", "virtual", "machine", "." ]
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/VirtualMachinesInner.java#L759-L766
elki-project/elki
elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/GaussianUniformMixture.java
GaussianUniformMixture.loglikelihoodNormal
private double loglikelihoodNormal(DBIDs objids, SetDBIDs anomalous, CovarianceMatrix builder, Relation<V> relation) { double[] mean = builder.getMeanVector(); final LUDecomposition lu = new LUDecomposition(builder.makeSampleMatrix()); double[][] covInv = lu.inverse(); // for each object compute probability and sum double prob = (objids.size() - anomalous.size()) * -FastMath.log(FastMath.sqrt(MathUtil.powi(MathUtil.TWOPI, RelationUtil.dimensionality(relation)) * lu.det())); for(DBIDIter iter = objids.iter(); iter.valid(); iter.advance()) { if(!anomalous.contains(iter)) { double[] xcent = minusEquals(relation.get(iter).toArray(), mean); prob -= .5 * transposeTimesTimes(xcent, covInv, xcent); } } return prob; }
java
private double loglikelihoodNormal(DBIDs objids, SetDBIDs anomalous, CovarianceMatrix builder, Relation<V> relation) { double[] mean = builder.getMeanVector(); final LUDecomposition lu = new LUDecomposition(builder.makeSampleMatrix()); double[][] covInv = lu.inverse(); // for each object compute probability and sum double prob = (objids.size() - anomalous.size()) * -FastMath.log(FastMath.sqrt(MathUtil.powi(MathUtil.TWOPI, RelationUtil.dimensionality(relation)) * lu.det())); for(DBIDIter iter = objids.iter(); iter.valid(); iter.advance()) { if(!anomalous.contains(iter)) { double[] xcent = minusEquals(relation.get(iter).toArray(), mean); prob -= .5 * transposeTimesTimes(xcent, covInv, xcent); } } return prob; }
[ "private", "double", "loglikelihoodNormal", "(", "DBIDs", "objids", ",", "SetDBIDs", "anomalous", ",", "CovarianceMatrix", "builder", ",", "Relation", "<", "V", ">", "relation", ")", "{", "double", "[", "]", "mean", "=", "builder", ".", "getMeanVector", "(", ...
Computes the loglikelihood of all normal objects. Gaussian model @param objids Object IDs for 'normal' objects. @param builder Covariance matrix builder @param relation Database @return loglikelihood for normal objects
[ "Computes", "the", "loglikelihood", "of", "all", "normal", "objects", ".", "Gaussian", "model" ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-outlier/src/main/java/de/lmu/ifi/dbs/elki/algorithm/outlier/GaussianUniformMixture.java#L199-L212
nguyenq/tess4j
src/main/java/net/sourceforge/tess4j/util/Utils.java
Utils.writeFile
public static void writeFile(byte[] data, File outFile) throws IOException { // create parent dirs when necessary if (outFile.getParentFile() != null) { outFile.getParentFile().mkdirs(); } try (FileOutputStream fos = new FileOutputStream(outFile)) { fos.write(data); } }
java
public static void writeFile(byte[] data, File outFile) throws IOException { // create parent dirs when necessary if (outFile.getParentFile() != null) { outFile.getParentFile().mkdirs(); } try (FileOutputStream fos = new FileOutputStream(outFile)) { fos.write(data); } }
[ "public", "static", "void", "writeFile", "(", "byte", "[", "]", "data", ",", "File", "outFile", ")", "throws", "IOException", "{", "// create parent dirs when necessary", "if", "(", "outFile", ".", "getParentFile", "(", ")", "!=", "null", ")", "{", "outFile", ...
Writes byte array to file. @param data byte array @param outFile output file @throws IOException
[ "Writes", "byte", "array", "to", "file", "." ]
train
https://github.com/nguyenq/tess4j/blob/cfcd4a8a44042f150b4aaf7bdf5ffc485a2236e1/src/main/java/net/sourceforge/tess4j/util/Utils.java#L38-L46
codelibs/jcifs
src/main/java/jcifs/smb1/smb1/AndXServerMessageBlock.java
AndXServerMessageBlock.decode
int decode( byte[] buffer, int bufferIndex ) { int start = headerStart = bufferIndex; bufferIndex += readHeaderWireFormat( buffer, bufferIndex ); bufferIndex += readAndXWireFormat( buffer, bufferIndex ); length = bufferIndex - start; return length; }
java
int decode( byte[] buffer, int bufferIndex ) { int start = headerStart = bufferIndex; bufferIndex += readHeaderWireFormat( buffer, bufferIndex ); bufferIndex += readAndXWireFormat( buffer, bufferIndex ); length = bufferIndex - start; return length; }
[ "int", "decode", "(", "byte", "[", "]", "buffer", ",", "int", "bufferIndex", ")", "{", "int", "start", "=", "headerStart", "=", "bufferIndex", ";", "bufferIndex", "+=", "readHeaderWireFormat", "(", "buffer", ",", "bufferIndex", ")", ";", "bufferIndex", "+=",...
/* We overload this because we want readAndXWireFormat to read the parameter words and bytes. This is so when commands are batched together we can recursivly call readAndXWireFormat without reading the non-existent header.
[ "/", "*", "We", "overload", "this", "because", "we", "want", "readAndXWireFormat", "to", "read", "the", "parameter", "words", "and", "bytes", ".", "This", "is", "so", "when", "commands", "are", "batched", "together", "we", "can", "recursivly", "call", "readA...
train
https://github.com/codelibs/jcifs/blob/ac6a8ba2925648ae003ca2508aec32316065dc34/src/main/java/jcifs/smb1/smb1/AndXServerMessageBlock.java#L84-L92
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDisplayLayoutPersistenceImpl.java
CPDisplayLayoutPersistenceImpl.removeByUuid_C
@Override public void removeByUuid_C(String uuid, long companyId) { for (CPDisplayLayout cpDisplayLayout : findByUuid_C(uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(cpDisplayLayout); } }
java
@Override public void removeByUuid_C(String uuid, long companyId) { for (CPDisplayLayout cpDisplayLayout : findByUuid_C(uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(cpDisplayLayout); } }
[ "@", "Override", "public", "void", "removeByUuid_C", "(", "String", "uuid", ",", "long", "companyId", ")", "{", "for", "(", "CPDisplayLayout", "cpDisplayLayout", ":", "findByUuid_C", "(", "uuid", ",", "companyId", ",", "QueryUtil", ".", "ALL_POS", ",", "QueryU...
Removes all the cp display layouts where uuid = &#63; and companyId = &#63; from the database. @param uuid the uuid @param companyId the company ID
[ "Removes", "all", "the", "cp", "display", "layouts", "where", "uuid", "=", "&#63", ";", "and", "companyId", "=", "&#63", ";", "from", "the", "database", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDisplayLayoutPersistenceImpl.java#L1400-L1406
trellis-ldp/trellis
core/http/src/main/java/org/trellisldp/http/impl/DeleteHandler.java
DeleteHandler.initialize
public ResponseBuilder initialize(final Resource parent, final Resource resource) { // Check that the persistence layer supports LDP-R if (MISSING_RESOURCE.equals(resource)) { // Can't delete a non-existent resources throw new NotFoundException(); } else if (DELETED_RESOURCE.equals(resource)) { // Can't delete a non-existent resources throw new ClientErrorException(GONE); } else if (!supportsInteractionModel(LDP.Resource)) { throw new ClientErrorException(status(BAD_REQUEST) .link(UnsupportedInteractionModel.getIRIString(), LDP.constrainedBy.getIRIString()) .entity("Unsupported interaction model provided").type(TEXT_PLAIN_TYPE).build()); } // Check the cache final EntityTag etag = new EntityTag(buildEtagHash(getIdentifier(), resource.getModified(), null)); checkCache(resource.getModified(), etag); setResource(resource); resource.getContainer().ifPresent(p -> setParent(parent)); return noContent(); }
java
public ResponseBuilder initialize(final Resource parent, final Resource resource) { // Check that the persistence layer supports LDP-R if (MISSING_RESOURCE.equals(resource)) { // Can't delete a non-existent resources throw new NotFoundException(); } else if (DELETED_RESOURCE.equals(resource)) { // Can't delete a non-existent resources throw new ClientErrorException(GONE); } else if (!supportsInteractionModel(LDP.Resource)) { throw new ClientErrorException(status(BAD_REQUEST) .link(UnsupportedInteractionModel.getIRIString(), LDP.constrainedBy.getIRIString()) .entity("Unsupported interaction model provided").type(TEXT_PLAIN_TYPE).build()); } // Check the cache final EntityTag etag = new EntityTag(buildEtagHash(getIdentifier(), resource.getModified(), null)); checkCache(resource.getModified(), etag); setResource(resource); resource.getContainer().ifPresent(p -> setParent(parent)); return noContent(); }
[ "public", "ResponseBuilder", "initialize", "(", "final", "Resource", "parent", ",", "final", "Resource", "resource", ")", "{", "// Check that the persistence layer supports LDP-R", "if", "(", "MISSING_RESOURCE", ".", "equals", "(", "resource", ")", ")", "{", "// Can't...
Initialze the handler with a Trellis resource. @param parent the parent resource @param resource the Trellis resource @return a response builder
[ "Initialze", "the", "handler", "with", "a", "Trellis", "resource", "." ]
train
https://github.com/trellis-ldp/trellis/blob/789fd7a3df86cab7ebba63e72bf4e58397e5f42d/core/http/src/main/java/org/trellisldp/http/impl/DeleteHandler.java#L80-L102
neo4j-contrib/neo4j-apoc-procedures
src/main/java/apoc/algo/CoreGraphAlgorithms.java
CoreGraphAlgorithms.loadDegrees
public int[] loadDegrees(String relName, Direction direction) { int relType = relName == null ? ANY_RELATIONSHIP_TYPE : ktx.tokenRead().relationshipType(relName); return loadDegrees(relType, direction); }
java
public int[] loadDegrees(String relName, Direction direction) { int relType = relName == null ? ANY_RELATIONSHIP_TYPE : ktx.tokenRead().relationshipType(relName); return loadDegrees(relType, direction); }
[ "public", "int", "[", "]", "loadDegrees", "(", "String", "relName", ",", "Direction", "direction", ")", "{", "int", "relType", "=", "relName", "==", "null", "?", "ANY_RELATIONSHIP_TYPE", ":", "ktx", ".", "tokenRead", "(", ")", ".", "relationshipType", "(", ...
/* private int[] loadDegrees(ReadOperations ops, PrimitiveLongIterator nodeIds, int size, int relType, Direction direction) { int[] degrees = new int[size]; Arrays.fill(degrees,-1); while (nodeIds.hasNext()) { long nodeId = nodeIds.next(); degrees[mapId(nodeId)] = relType == ANY_RELATIONSHIP_TYPE ? ops.nodeGetDegree(nodeId, direction) : ops.nodeGetDegree(nodeId, direction, relType); } return degrees; }
[ "/", "*", "private", "int", "[]", "loadDegrees", "(", "ReadOperations", "ops", "PrimitiveLongIterator", "nodeIds", "int", "size", "int", "relType", "Direction", "direction", ")", "{", "int", "[]", "degrees", "=", "new", "int", "[", "size", "]", ";", "Arrays"...
train
https://github.com/neo4j-contrib/neo4j-apoc-procedures/blob/e8386975d1c512c0e4388a1a61f5496121c04f86/src/main/java/apoc/algo/CoreGraphAlgorithms.java#L228-L231
sshtools/j2ssh-maverick
j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpClient.java
SftpClient.getFiles
public SftpFile[] getFiles(String remote, String local) throws FileNotFoundException, SftpStatusException, SshException, TransferCancelledException { return getFiles(remote, local, false); }
java
public SftpFile[] getFiles(String remote, String local) throws FileNotFoundException, SftpStatusException, SshException, TransferCancelledException { return getFiles(remote, local, false); }
[ "public", "SftpFile", "[", "]", "getFiles", "(", "String", "remote", ",", "String", "local", ")", "throws", "FileNotFoundException", ",", "SftpStatusException", ",", "SshException", ",", "TransferCancelledException", "{", "return", "getFiles", "(", "remote", ",", ...
Download the remote files into the local file. @param remote @param local @return SftpFile[] @throws FileNotFoundException @throws SftpStatusException @throws SshException @throws TransferCancelledException
[ "Download", "the", "remote", "files", "into", "the", "local", "file", "." ]
train
https://github.com/sshtools/j2ssh-maverick/blob/ce11ceaf0aa0b129b54327a6891973e1e34689f7/j2ssh-maverick/src/main/java/com/sshtools/sftp/SftpClient.java#L2972-L2976
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Holiday.java
Holiday.firstBetween
@Override public Date firstBetween(Date start, Date end) { return rule.firstBetween(start, end); }
java
@Override public Date firstBetween(Date start, Date end) { return rule.firstBetween(start, end); }
[ "@", "Override", "public", "Date", "firstBetween", "(", "Date", "start", ",", "Date", "end", ")", "{", "return", "rule", ".", "firstBetween", "(", "start", ",", "end", ")", ";", "}" ]
Return the first occurrence of this holiday that is on or after the given start date and before the given end date. @param start Only occurrences on or after this date are returned. @param end Only occurrences before this date are returned. @return The date on which this event occurs, or null if it does not occur between the start and end dates. @see #firstAfter @hide draft / provisional / internal are hidden on Android
[ "Return", "the", "first", "occurrence", "of", "this", "holiday", "that", "is", "on", "or", "after", "the", "given", "start", "date", "and", "before", "the", "given", "end", "date", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Holiday.java#L92-L95
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTable.java
WTable.setSort
protected void setSort(final int index, final boolean ascending) { WTableComponentModel model = getOrCreateComponentModel(); model.sortColIndex = index; model.sortAscending = ascending; }
java
protected void setSort(final int index, final boolean ascending) { WTableComponentModel model = getOrCreateComponentModel(); model.sortColIndex = index; model.sortAscending = ascending; }
[ "protected", "void", "setSort", "(", "final", "int", "index", ",", "final", "boolean", "ascending", ")", "{", "WTableComponentModel", "model", "=", "getOrCreateComponentModel", "(", ")", ";", "model", ".", "sortColIndex", "=", "index", ";", "model", ".", "sort...
For rendering purposes only - has no effect on model. @param index the sort column index, or -1 for no sort. @param ascending true for ascending order, false for descending
[ "For", "rendering", "purposes", "only", "-", "has", "no", "effect", "on", "model", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/WTable.java#L1136-L1140
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/search/aggregate/DBEntitySequenceFactory.java
DBEntitySequenceFactory.toIteratorCategory
static String toIteratorCategory(String type, String link, List<String> fields) { return toEntityCategory(type + "." + link, fields); //return type + '.' + link; }
java
static String toIteratorCategory(String type, String link, List<String> fields) { return toEntityCategory(type + "." + link, fields); //return type + '.' + link; }
[ "static", "String", "toIteratorCategory", "(", "String", "type", ",", "String", "link", ",", "List", "<", "String", ">", "fields", ")", "{", "return", "toEntityCategory", "(", "type", "+", "\".\"", "+", "link", ",", "fields", ")", ";", "//return type + '.' +...
Converts an iterator category and the link name to a child iterator category. Iterator category is represented as String: "Type.link1.link2...". For instance "Message.Sender.Person" @param type parent iterator category @param link link name @return child iterator category
[ "Converts", "an", "iterator", "category", "and", "the", "link", "name", "to", "a", "child", "iterator", "category", ".", "Iterator", "category", "is", "represented", "as", "String", ":", "Type", ".", "link1", ".", "link2", "...", ".", "For", "instance", "M...
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/search/aggregate/DBEntitySequenceFactory.java#L506-L509
line/armeria
zipkin/src/main/java/com/linecorp/armeria/internal/tracing/SpanContextUtil.java
SpanContextUtil.closeSpan
public static void closeSpan(Span span, RequestLog log) { SpanTags.addTags(span, log); span.finish(wallTimeMicros(log, log.responseEndTimeNanos())); }
java
public static void closeSpan(Span span, RequestLog log) { SpanTags.addTags(span, log); span.finish(wallTimeMicros(log, log.responseEndTimeNanos())); }
[ "public", "static", "void", "closeSpan", "(", "Span", "span", ",", "RequestLog", "log", ")", "{", "SpanTags", ".", "addTags", "(", "span", ",", "log", ")", ";", "span", ".", "finish", "(", "wallTimeMicros", "(", "log", ",", "log", ".", "responseEndTimeNa...
Adds logging tags to the provided {@link Span} and closes it when the log is finished. The span cannot be used further after this method has been called.
[ "Adds", "logging", "tags", "to", "the", "provided", "{" ]
train
https://github.com/line/armeria/blob/67d29e019fd35a35f89c45cc8f9119ff9b12b44d/zipkin/src/main/java/com/linecorp/armeria/internal/tracing/SpanContextUtil.java#L38-L41
BlueBrain/bluima
modules/bluima_abbreviations/src/main/java/com/wcohen/ss/TagLink.java
TagLink.sortCandidateList
private void sortCandidateList(ArrayList list) { java.util.Collections.sort(list, new java.util.Comparator() { public int compare(Object o1, Object o2) { // First sort, by score in index double scoreT = ( (Candidates) o1).getScore(), scoreU = ( (Candidates) o2).getScore(); if (scoreU > scoreT) { return 1; } if (scoreU < scoreT) { return -1; } return 0; } } ); }
java
private void sortCandidateList(ArrayList list) { java.util.Collections.sort(list, new java.util.Comparator() { public int compare(Object o1, Object o2) { // First sort, by score in index double scoreT = ( (Candidates) o1).getScore(), scoreU = ( (Candidates) o2).getScore(); if (scoreU > scoreT) { return 1; } if (scoreU < scoreT) { return -1; } return 0; } } ); }
[ "private", "void", "sortCandidateList", "(", "ArrayList", "list", ")", "{", "java", ".", "util", ".", "Collections", ".", "sort", "(", "list", ",", "new", "java", ".", "util", ".", "Comparator", "(", ")", "{", "public", "int", "compare", "(", "Object", ...
sortCandidateList sort a list of candidate pair of tokens. @param tokenArray String[] @return float[]
[ "sortCandidateList", "sort", "a", "list", "of", "candidate", "pair", "of", "tokens", "." ]
train
https://github.com/BlueBrain/bluima/blob/793ea3f46761dce72094e057a56cddfa677156ae/modules/bluima_abbreviations/src/main/java/com/wcohen/ss/TagLink.java#L416-L432
matthewhorridge/owlapi-gwt
owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDifferentIndividualsAxiomImpl_CustomFieldSerializer.java
OWLDifferentIndividualsAxiomImpl_CustomFieldSerializer.deserializeInstance
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLDifferentIndividualsAxiomImpl instance) throws SerializationException { deserialize(streamReader, instance); }
java
@Override public void deserializeInstance(SerializationStreamReader streamReader, OWLDifferentIndividualsAxiomImpl instance) throws SerializationException { deserialize(streamReader, instance); }
[ "@", "Override", "public", "void", "deserializeInstance", "(", "SerializationStreamReader", "streamReader", ",", "OWLDifferentIndividualsAxiomImpl", "instance", ")", "throws", "SerializationException", "{", "deserialize", "(", "streamReader", ",", "instance", ")", ";", "}...
Deserializes the content of the object from the {@link com.google.gwt.user.client.rpc.SerializationStreamReader}. @param streamReader the {@link com.google.gwt.user.client.rpc.SerializationStreamReader} to read the object's content from @param instance the object instance to deserialize @throws com.google.gwt.user.client.rpc.SerializationException if the deserialization operation is not successful
[ "Deserializes", "the", "content", "of", "the", "object", "from", "the", "{", "@link", "com", ".", "google", ".", "gwt", ".", "user", ".", "client", ".", "rpc", ".", "SerializationStreamReader", "}", "." ]
train
https://github.com/matthewhorridge/owlapi-gwt/blob/7ab975fb6cef3c8947099983551672a3b5d4e2fd/owlapi-gwt-serialization/src/main/java/uk/ac/manchester/cs/owl/owlapi/OWLDifferentIndividualsAxiomImpl_CustomFieldSerializer.java#L95-L98
rhuss/jolokia
agent/core/src/main/java/org/jolokia/converter/json/MapExtractor.java
MapExtractor.setObjectValue
public Object setObjectValue(StringToObjectConverter pConverter, Object pMap, String pKey, Object pValue) throws IllegalAccessException, InvocationTargetException { Map<Object,Object> map = (Map<Object,Object>) pMap; Object oldValue = null; Object oldKey = pKey; for (Map.Entry entry : map.entrySet()) { // We dont access the map via a lookup since the key // are potentially object but we have to deal with string // representations if(pKey.equals(entry.getKey().toString())) { oldValue = entry.getValue(); oldKey = entry.getKey(); break; } } Object value = oldValue != null ? pConverter.prepareValue(oldValue.getClass().getName(), pValue) : pValue; map.put(oldKey,value); return oldValue; }
java
public Object setObjectValue(StringToObjectConverter pConverter, Object pMap, String pKey, Object pValue) throws IllegalAccessException, InvocationTargetException { Map<Object,Object> map = (Map<Object,Object>) pMap; Object oldValue = null; Object oldKey = pKey; for (Map.Entry entry : map.entrySet()) { // We dont access the map via a lookup since the key // are potentially object but we have to deal with string // representations if(pKey.equals(entry.getKey().toString())) { oldValue = entry.getValue(); oldKey = entry.getKey(); break; } } Object value = oldValue != null ? pConverter.prepareValue(oldValue.getClass().getName(), pValue) : pValue; map.put(oldKey,value); return oldValue; }
[ "public", "Object", "setObjectValue", "(", "StringToObjectConverter", "pConverter", ",", "Object", "pMap", ",", "String", "pKey", ",", "Object", "pValue", ")", "throws", "IllegalAccessException", ",", "InvocationTargetException", "{", "Map", "<", "Object", ",", "Obj...
Set the value within a map, where the attribute is taken as key into the map. @param pConverter the global converter in order to be able do dispatch for serializing inner data types @param pMap map on which to set the value @param pKey key in the map where to put the value @param pValue the new value to set @return the old value or <code>null</code> if a new map entry was created/ @throws IllegalAccessException @throws InvocationTargetException
[ "Set", "the", "value", "within", "a", "map", "where", "the", "attribute", "is", "taken", "as", "key", "into", "the", "map", "." ]
train
https://github.com/rhuss/jolokia/blob/dc95e7bef859b1829776c5a84c8f7738f5d7d9c3/agent/core/src/main/java/org/jolokia/converter/json/MapExtractor.java#L118-L139
h2oai/h2o-3
h2o-core/src/main/java/water/jdbc/SQLManager.java
SQLManager.initializeDatabaseDriver
static void initializeDatabaseDriver(String databaseType) { String driverClass = System.getProperty(JDBC_DRIVER_CLASS_KEY_PREFIX + databaseType); if (driverClass != null) { Log.debug("Loading " + driverClass + " to initialize database of type " + databaseType); try { Class.forName(driverClass); } catch (ClassNotFoundException e) { throw new RuntimeException("Connection to '" + databaseType + "' database is not possible due to missing JDBC driver. " + "User specified driver class: " + driverClass, e); } return; } // use built-in defaults switch (databaseType) { case HIVE_DB_TYPE: try { Class.forName(HIVE_JDBC_DRIVER_CLASS); } catch (ClassNotFoundException e) { throw new RuntimeException("Connection to HIVE database is not possible due to missing JDBC driver.", e); } break; case NETEZZA_DB_TYPE: try { Class.forName(NETEZZA_JDBC_DRIVER_CLASS); } catch (ClassNotFoundException e) { throw new RuntimeException("Connection to Netezza database is not possible due to missing JDBC driver.", e); } break; default: //nothing to do } }
java
static void initializeDatabaseDriver(String databaseType) { String driverClass = System.getProperty(JDBC_DRIVER_CLASS_KEY_PREFIX + databaseType); if (driverClass != null) { Log.debug("Loading " + driverClass + " to initialize database of type " + databaseType); try { Class.forName(driverClass); } catch (ClassNotFoundException e) { throw new RuntimeException("Connection to '" + databaseType + "' database is not possible due to missing JDBC driver. " + "User specified driver class: " + driverClass, e); } return; } // use built-in defaults switch (databaseType) { case HIVE_DB_TYPE: try { Class.forName(HIVE_JDBC_DRIVER_CLASS); } catch (ClassNotFoundException e) { throw new RuntimeException("Connection to HIVE database is not possible due to missing JDBC driver.", e); } break; case NETEZZA_DB_TYPE: try { Class.forName(NETEZZA_JDBC_DRIVER_CLASS); } catch (ClassNotFoundException e) { throw new RuntimeException("Connection to Netezza database is not possible due to missing JDBC driver.", e); } break; default: //nothing to do } }
[ "static", "void", "initializeDatabaseDriver", "(", "String", "databaseType", ")", "{", "String", "driverClass", "=", "System", ".", "getProperty", "(", "JDBC_DRIVER_CLASS_KEY_PREFIX", "+", "databaseType", ")", ";", "if", "(", "driverClass", "!=", "null", ")", "{",...
Initializes database driver for databases with JDBC driver version lower than 4.0 @param databaseType Name of target database from JDBC connection string
[ "Initializes", "database", "driver", "for", "databases", "with", "JDBC", "driver", "version", "lower", "than", "4", ".", "0" ]
train
https://github.com/h2oai/h2o-3/blob/845eb49dfeaadf638b6e2f779d82fac996391fad/h2o-core/src/main/java/water/jdbc/SQLManager.java#L497-L528
yegor256/takes
src/main/java/org/takes/rs/RsFluent.java
RsFluent.withHeader
public RsFluent withHeader(final CharSequence key, final CharSequence value) { return new RsFluent(new RsWithHeader(this, key, value)); }
java
public RsFluent withHeader(final CharSequence key, final CharSequence value) { return new RsFluent(new RsWithHeader(this, key, value)); }
[ "public", "RsFluent", "withHeader", "(", "final", "CharSequence", "key", ",", "final", "CharSequence", "value", ")", "{", "return", "new", "RsFluent", "(", "new", "RsWithHeader", "(", "this", ",", "key", ",", "value", ")", ")", ";", "}" ]
With this header. @param key Key @param value Value @return New fluent response
[ "With", "this", "header", "." ]
train
https://github.com/yegor256/takes/blob/a4f4d939c8f8e0af190025716ad7f22b7de40e70/src/main/java/org/takes/rs/RsFluent.java#L81-L84
mangstadt/biweekly
src/main/java/biweekly/component/ICalComponent.java
ICalComponent.setComponent
public <T extends ICalComponent> List<T> setComponent(Class<T> clazz, T component) { List<ICalComponent> replaced = components.replace(clazz, component); return castList(replaced, clazz); }
java
public <T extends ICalComponent> List<T> setComponent(Class<T> clazz, T component) { List<ICalComponent> replaced = components.replace(clazz, component); return castList(replaced, clazz); }
[ "public", "<", "T", "extends", "ICalComponent", ">", "List", "<", "T", ">", "setComponent", "(", "Class", "<", "T", ">", "clazz", ",", "T", "component", ")", "{", "List", "<", "ICalComponent", ">", "replaced", "=", "components", ".", "replace", "(", "c...
Replaces all sub-components of a given class with the given component. If the component instance is null, then all instances of that component will be removed. @param clazz the component's class @param component the component or null to remove all components of the given class @param <T> the component class @return the replaced sub-components (this list is immutable)
[ "Replaces", "all", "sub", "-", "components", "of", "a", "given", "class", "with", "the", "given", "component", ".", "If", "the", "component", "instance", "is", "null", "then", "all", "instances", "of", "that", "component", "will", "be", "removed", "." ]
train
https://github.com/mangstadt/biweekly/blob/2e21350f85c13dfff52fdef98fdbebe2976fcf61/src/main/java/biweekly/component/ICalComponent.java#L345-L348
js-lib-com/commons
src/main/java/js/util/Classes.java
Classes.getOptionalFieldValue
@SafeVarargs public static <T> T getOptionalFieldValue(Object object, String fieldName, Class<T>... fieldType) { Class<?> clazz = null; if(object instanceof Class<?>) { clazz = (Class<?>)object; object = null; } else { clazz = object.getClass(); } return getFieldValue(object, clazz, fieldName, fieldType.length == 1 ? fieldType[0] : null, true); }
java
@SafeVarargs public static <T> T getOptionalFieldValue(Object object, String fieldName, Class<T>... fieldType) { Class<?> clazz = null; if(object instanceof Class<?>) { clazz = (Class<?>)object; object = null; } else { clazz = object.getClass(); } return getFieldValue(object, clazz, fieldName, fieldType.length == 1 ? fieldType[0] : null, true); }
[ "@", "SafeVarargs", "public", "static", "<", "T", ">", "T", "getOptionalFieldValue", "(", "Object", "object", ",", "String", "fieldName", ",", "Class", "<", "T", ">", "...", "fieldType", ")", "{", "Class", "<", "?", ">", "clazz", "=", "null", ";", "if"...
Get optional field value from instance or class. Retrieve named field value from given instance or class; if field is missing return null. Note that this method does not throw exceptions. Also, if optional desired field type is present and named field is of different type returns null. @param object instance or class to retrieve field value from, @param fieldName field name, @param fieldType optional desired field type. @param <T> field value type. @return instance or class field value or null if field not found.
[ "Get", "optional", "field", "value", "from", "instance", "or", "class", ".", "Retrieve", "named", "field", "value", "from", "given", "instance", "or", "class", ";", "if", "field", "is", "missing", "return", "null", ".", "Note", "that", "this", "method", "d...
train
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/Classes.java#L743-L755
Pkmmte/CircularImageView
circularimageview-eclipse/CircularImageView/src/com/pkmmte/circularimageview/CircularImageView.java
CircularImageView.refreshBitmapShader
public void refreshBitmapShader() { shader = new BitmapShader(Bitmap.createScaledBitmap(image, canvasSize, canvasSize, false), Shader.TileMode.CLAMP, Shader.TileMode.CLAMP); }
java
public void refreshBitmapShader() { shader = new BitmapShader(Bitmap.createScaledBitmap(image, canvasSize, canvasSize, false), Shader.TileMode.CLAMP, Shader.TileMode.CLAMP); }
[ "public", "void", "refreshBitmapShader", "(", ")", "{", "shader", "=", "new", "BitmapShader", "(", "Bitmap", ".", "createScaledBitmap", "(", "image", ",", "canvasSize", ",", "canvasSize", ",", "false", ")", ",", "Shader", ".", "TileMode", ".", "CLAMP", ",", ...
Reinitializes the shader texture used to fill in the Circle upon drawing.
[ "Reinitializes", "the", "shader", "texture", "used", "to", "fill", "in", "the", "Circle", "upon", "drawing", "." ]
train
https://github.com/Pkmmte/CircularImageView/blob/aca59f32d9267c943eb6c930bdaed59c417a4d16/circularimageview-eclipse/CircularImageView/src/com/pkmmte/circularimageview/CircularImageView.java#L354-L357
tvesalainen/util
util/src/main/java/org/vesalainen/nio/FileUtil.java
FileUtil.copyResource
public static final void copyResource(String source, Path target, Class<?> cls) throws IOException { try (InputStream is = cls.getResourceAsStream(source)) { Files.copy(is, target, REPLACE_EXISTING); } }
java
public static final void copyResource(String source, Path target, Class<?> cls) throws IOException { try (InputStream is = cls.getResourceAsStream(source)) { Files.copy(is, target, REPLACE_EXISTING); } }
[ "public", "static", "final", "void", "copyResource", "(", "String", "source", ",", "Path", "target", ",", "Class", "<", "?", ">", "cls", ")", "throws", "IOException", "{", "try", "(", "InputStream", "is", "=", "cls", ".", "getResourceAsStream", "(", "sourc...
Copies class resource to path @param source As in getResourceAsStream @param target Target file @param cls A class for finding class loader. @throws IOException @see java.lang.Class#getResourceAsStream(java.lang.String)
[ "Copies", "class", "resource", "to", "path" ]
train
https://github.com/tvesalainen/util/blob/bba7a44689f638ffabc8be40a75bdc9a33676433/util/src/main/java/org/vesalainen/nio/FileUtil.java#L218-L224
OpenLiberty/open-liberty
dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/FileUtils.java
FileUtils.isUnderDirectory
public static boolean isUnderDirectory(File child, File parent) { if (child == null || parent == null) return false; URI childUri = child.toURI(); URI relativeUri = parent.toURI().relativize(childUri); return relativeUri.equals(childUri) ? false : true; }
java
public static boolean isUnderDirectory(File child, File parent) { if (child == null || parent == null) return false; URI childUri = child.toURI(); URI relativeUri = parent.toURI().relativize(childUri); return relativeUri.equals(childUri) ? false : true; }
[ "public", "static", "boolean", "isUnderDirectory", "(", "File", "child", ",", "File", "parent", ")", "{", "if", "(", "child", "==", "null", "||", "parent", "==", "null", ")", "return", "false", ";", "URI", "childUri", "=", "child", ".", "toURI", "(", "...
If child is under parent, will return true, otherwise, return false. @param child @param parent @return
[ "If", "child", "is", "under", "parent", "will", "return", "true", "otherwise", "return", "false", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.kernel.boot.core/src/com/ibm/ws/kernel/boot/internal/FileUtils.java#L218-L226
wmdietl/jsr308-langtools
src/share/classes/com/sun/tools/javac/jvm/CRTable.java
CRTable.put
public void put(Object tree, int flags, int startPc, int endPc) { entries.append(new CRTEntry(tree, flags, startPc, endPc)); }
java
public void put(Object tree, int flags, int startPc, int endPc) { entries.append(new CRTEntry(tree, flags, startPc, endPc)); }
[ "public", "void", "put", "(", "Object", "tree", ",", "int", "flags", ",", "int", "startPc", ",", "int", "endPc", ")", "{", "entries", ".", "append", "(", "new", "CRTEntry", "(", "tree", ",", "flags", ",", "startPc", ",", "endPc", ")", ")", ";", "}"...
Create a new CRTEntry and add it to the entries. @param tree The tree or the list of trees for which we are storing the code pointers. @param flags The set of flags designating type of the entry. @param startPc The starting code position. @param endPc The ending code position.
[ "Create", "a", "new", "CRTEntry", "and", "add", "it", "to", "the", "entries", "." ]
train
https://github.com/wmdietl/jsr308-langtools/blob/8812d28c20f4de070a0dd6de1b45602431379834/src/share/classes/com/sun/tools/javac/jvm/CRTable.java#L81-L83
calimero-project/calimero-core
src/tuwien/auto/calimero/dptxlator/TranslatorTypes.java
TranslatorTypes.createTranslator
public static DPTXlator createTranslator(final String dptId, final byte... data) throws KNXException, KNXIllegalArgumentException { final DPTXlator t = createTranslator(0, dptId); if (data.length > 0) t.setData(data); return t; }
java
public static DPTXlator createTranslator(final String dptId, final byte... data) throws KNXException, KNXIllegalArgumentException { final DPTXlator t = createTranslator(0, dptId); if (data.length > 0) t.setData(data); return t; }
[ "public", "static", "DPTXlator", "createTranslator", "(", "final", "String", "dptId", ",", "final", "byte", "...", "data", ")", "throws", "KNXException", ",", "KNXIllegalArgumentException", "{", "final", "DPTXlator", "t", "=", "createTranslator", "(", "0", ",", ...
Creates a DPT translator for the given datapoint type ID. @param dptId datapoint type ID, formatted as <code>&lt;main number&gt;.&lt;sub number&gt;</code> with a sub number &lt; 100 zero-padded to 3 digits, e.g. "1.001" @param data (optional) KNX datapoint data to set in the created translator for translation @return the new {@link DPTXlator} object @throws KNXException if no matching DPT translator is available or creation failed (see {@link MainType#createTranslator(String)})
[ "Creates", "a", "DPT", "translator", "for", "the", "given", "datapoint", "type", "ID", "." ]
train
https://github.com/calimero-project/calimero-core/blob/7e6f547c6bd75fa985bfeb5b47ba671df2ea01e8/src/tuwien/auto/calimero/dptxlator/TranslatorTypes.java#L649-L656
rolfl/MicroBench
src/main/java/net/tuis/ubench/UBench.java
UBench.addDoubleTask
public UBench addDoubleTask(String name, DoubleSupplier task, DoublePredicate check) { return putTask(name, () -> { long start = System.nanoTime(); double result = task.getAsDouble(); long time = System.nanoTime() - start; if (check != null && !check.test(result)) { throw new UBenchRuntimeException(String.format("Task %s failed Result: %f", name, result)); } return time; }); }
java
public UBench addDoubleTask(String name, DoubleSupplier task, DoublePredicate check) { return putTask(name, () -> { long start = System.nanoTime(); double result = task.getAsDouble(); long time = System.nanoTime() - start; if (check != null && !check.test(result)) { throw new UBenchRuntimeException(String.format("Task %s failed Result: %f", name, result)); } return time; }); }
[ "public", "UBench", "addDoubleTask", "(", "String", "name", ",", "DoubleSupplier", "task", ",", "DoublePredicate", "check", ")", "{", "return", "putTask", "(", "name", ",", "(", ")", "->", "{", "long", "start", "=", "System", ".", "nanoTime", "(", ")", "...
Include a double-specialized named task (and validator) in to the benchmark. @param name The name of the task. Only one task with any one name is allowed. @param task The task to perform @param check The check of the results from the task. @return The same object, for chaining calls.
[ "Include", "a", "double", "-", "specialized", "named", "task", "(", "and", "validator", ")", "in", "to", "the", "benchmark", "." ]
train
https://github.com/rolfl/MicroBench/blob/f2bfa92dacd7ea0d6b8eae4d4fe2975139d317ce/src/main/java/net/tuis/ubench/UBench.java#L248-L258
micronaut-projects/micronaut-core
cli/src/main/groovy/io/micronaut/cli/console/logging/MicronautConsole.java
MicronautConsole.createConsoleReader
protected ConsoleReader createConsoleReader(InputStream systemIn) throws IOException { // need to swap out the output to avoid logging during init final PrintStream nullOutput = new PrintStream(new ByteArrayOutputStream()); final PrintStream originalOut = Log.getOutput(); try { Log.setOutput(nullOutput); ConsoleReader consoleReader = new ConsoleReader(systemIn, out); consoleReader.setExpandEvents(false); return consoleReader; } finally { Log.setOutput(originalOut); } }
java
protected ConsoleReader createConsoleReader(InputStream systemIn) throws IOException { // need to swap out the output to avoid logging during init final PrintStream nullOutput = new PrintStream(new ByteArrayOutputStream()); final PrintStream originalOut = Log.getOutput(); try { Log.setOutput(nullOutput); ConsoleReader consoleReader = new ConsoleReader(systemIn, out); consoleReader.setExpandEvents(false); return consoleReader; } finally { Log.setOutput(originalOut); } }
[ "protected", "ConsoleReader", "createConsoleReader", "(", "InputStream", "systemIn", ")", "throws", "IOException", "{", "// need to swap out the output to avoid logging during init", "final", "PrintStream", "nullOutput", "=", "new", "PrintStream", "(", "new", "ByteArrayOutputSt...
Create a console reader. @param systemIn The input stream @return The console reader @throws IOException if there is an error
[ "Create", "a", "console", "reader", "." ]
train
https://github.com/micronaut-projects/micronaut-core/blob/c31f5b03ce0eb88c2f6470710987db03b8967d5c/cli/src/main/groovy/io/micronaut/cli/console/logging/MicronautConsole.java#L311-L323
joniles/mpxj
src/main/java/net/sf/mpxj/synchro/SynchroData.java
SynchroData.readTableData
private void readTableData(List<SynchroTable> tables, InputStream is) throws IOException { for (SynchroTable table : tables) { if (REQUIRED_TABLES.contains(table.getName())) { readTable(is, table); } } }
java
private void readTableData(List<SynchroTable> tables, InputStream is) throws IOException { for (SynchroTable table : tables) { if (REQUIRED_TABLES.contains(table.getName())) { readTable(is, table); } } }
[ "private", "void", "readTableData", "(", "List", "<", "SynchroTable", ">", "tables", ",", "InputStream", "is", ")", "throws", "IOException", "{", "for", "(", "SynchroTable", "table", ":", "tables", ")", "{", "if", "(", "REQUIRED_TABLES", ".", "contains", "("...
Read the data for all of the tables we're interested in. @param tables list of all available tables @param is input stream
[ "Read", "the", "data", "for", "all", "of", "the", "tables", "we", "re", "interested", "in", "." ]
train
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/SynchroData.java#L158-L167
ist-dresden/composum
sling/core/commons/src/main/java/com/composum/sling/core/AbstractSlingBean.java
AbstractSlingBean.initialize
public void initialize(BeanContext context, Resource resource) { if (LOG.isDebugEnabled()) { LOG.debug("initialize (" + context + ", " + resource + ")"); } this.context = context; this.resource = ResourceHandle.use(resource); }
java
public void initialize(BeanContext context, Resource resource) { if (LOG.isDebugEnabled()) { LOG.debug("initialize (" + context + ", " + resource + ")"); } this.context = context; this.resource = ResourceHandle.use(resource); }
[ "public", "void", "initialize", "(", "BeanContext", "context", ",", "Resource", "resource", ")", "{", "if", "(", "LOG", ".", "isDebugEnabled", "(", ")", ")", "{", "LOG", ".", "debug", "(", "\"initialize (\"", "+", "context", "+", "\", \"", "+", "resource",...
This basic initialization sets up the context and resource attributes only, all the other attributes are set 'lazy' during their getter calls. @param context the scripting context (e.g. a JSP PageContext or a Groovy scripting context) @param resource the resource to use (normally the resource addressed by the request)
[ "This", "basic", "initialization", "sets", "up", "the", "context", "and", "resource", "attributes", "only", "all", "the", "other", "attributes", "are", "set", "lazy", "during", "their", "getter", "calls", "." ]
train
https://github.com/ist-dresden/composum/blob/ebc79f559f6022c935240c19102539bdfb1bd1e2/sling/core/commons/src/main/java/com/composum/sling/core/AbstractSlingBean.java#L104-L110
jbundle/jbundle
base/message/trx/src/main/java/org/jbundle/base/message/trx/transport/fax/FaxMessageTransport.java
FaxMessageTransport.logMessage
public String logMessage(String strTrxID, BaseMessage trxMessage, String strMessageInfoType, String strMessageProcessType, String strMessageStatus, String strContactType, String strPerson, String strMessageDescription, int iUserID, int iMessageReferenceID, Message message, String strDest) { return super.logMessage(strTrxID, trxMessage, strMessageInfoType, strMessageProcessType, strMessageStatus, strContactType, strPerson, strMessageDescription, iUserID, iMessageReferenceID, message, strDest); }
java
public String logMessage(String strTrxID, BaseMessage trxMessage, String strMessageInfoType, String strMessageProcessType, String strMessageStatus, String strContactType, String strPerson, String strMessageDescription, int iUserID, int iMessageReferenceID, Message message, String strDest) { return super.logMessage(strTrxID, trxMessage, strMessageInfoType, strMessageProcessType, strMessageStatus, strContactType, strPerson, strMessageDescription, iUserID, iMessageReferenceID, message, strDest); }
[ "public", "String", "logMessage", "(", "String", "strTrxID", ",", "BaseMessage", "trxMessage", ",", "String", "strMessageInfoType", ",", "String", "strMessageProcessType", ",", "String", "strMessageStatus", ",", "String", "strContactType", ",", "String", "strPerson", ...
Write this outgoing SOAP message into the log. @param msg The message. @urlEndpoint The destination. @return The message log transaction number.
[ "Write", "this", "outgoing", "SOAP", "message", "into", "the", "log", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/message/trx/src/main/java/org/jbundle/base/message/trx/transport/fax/FaxMessageTransport.java#L117-L120
citrusframework/citrus
modules/citrus-ws/src/main/java/com/consol/citrus/ws/interceptor/LoggingInterceptorSupport.java
LoggingInterceptorSupport.logRequest
protected void logRequest(String logMessage, MessageContext messageContext, boolean incoming) throws TransformerException { if (messageContext.getRequest() instanceof SoapMessage) { logSoapMessage(logMessage, (SoapMessage) messageContext.getRequest(), incoming); } else { logWebServiceMessage(logMessage, messageContext.getRequest(), incoming); } }
java
protected void logRequest(String logMessage, MessageContext messageContext, boolean incoming) throws TransformerException { if (messageContext.getRequest() instanceof SoapMessage) { logSoapMessage(logMessage, (SoapMessage) messageContext.getRequest(), incoming); } else { logWebServiceMessage(logMessage, messageContext.getRequest(), incoming); } }
[ "protected", "void", "logRequest", "(", "String", "logMessage", ",", "MessageContext", "messageContext", ",", "boolean", "incoming", ")", "throws", "TransformerException", "{", "if", "(", "messageContext", ".", "getRequest", "(", ")", "instanceof", "SoapMessage", ")...
Logs request message from message context. SOAP messages get logged with envelope transformation other messages with serialization. @param logMessage @param messageContext @param incoming @throws TransformerException
[ "Logs", "request", "message", "from", "message", "context", ".", "SOAP", "messages", "get", "logged", "with", "envelope", "transformation", "other", "messages", "with", "serialization", "." ]
train
https://github.com/citrusframework/citrus/blob/55c58ef74c01d511615e43646ca25c1b2301c56d/modules/citrus-ws/src/main/java/com/consol/citrus/ws/interceptor/LoggingInterceptorSupport.java#L62-L68
aws/aws-sdk-java
aws-java-sdk-emr/src/main/java/com/amazonaws/services/elasticmapreduce/util/BootstrapActions.java
BootstrapActions.newRunIf
public BootstrapActionConfig newRunIf(String condition, BootstrapActionConfig config) { List<String> args = config.getScriptBootstrapAction().getArgs(); args.add(0, condition); args.add(1, config.getScriptBootstrapAction().getPath()); return new BootstrapActionConfig() .withName("Run If, " + config.getName()) .withScriptBootstrapAction(new ScriptBootstrapActionConfig() .withPath("s3://" + bucket + "/bootstrap-actions/run-if") .withArgs(args)); }
java
public BootstrapActionConfig newRunIf(String condition, BootstrapActionConfig config) { List<String> args = config.getScriptBootstrapAction().getArgs(); args.add(0, condition); args.add(1, config.getScriptBootstrapAction().getPath()); return new BootstrapActionConfig() .withName("Run If, " + config.getName()) .withScriptBootstrapAction(new ScriptBootstrapActionConfig() .withPath("s3://" + bucket + "/bootstrap-actions/run-if") .withArgs(args)); }
[ "public", "BootstrapActionConfig", "newRunIf", "(", "String", "condition", ",", "BootstrapActionConfig", "config", ")", "{", "List", "<", "String", ">", "args", "=", "config", ".", "getScriptBootstrapAction", "(", ")", ".", "getArgs", "(", ")", ";", "args", "....
Create a new run-if bootstrap action which lets you conditionally run bootstrap actions. @param condition The condition to evaluate, if true the bootstrap action executes. @param config The bootstrap action to execute in case of successful evaluation. @return A BootstrapActionConfig to be provided when running a job flow.
[ "Create", "a", "new", "run", "-", "if", "bootstrap", "action", "which", "lets", "you", "conditionally", "run", "bootstrap", "actions", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-emr/src/main/java/com/amazonaws/services/elasticmapreduce/util/BootstrapActions.java#L77-L87
googleapis/google-cloud-java
google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/ContainerAnalysisV1Beta1Client.java
ContainerAnalysisV1Beta1Client.updateScanConfig
public final ScanConfig updateScanConfig(ScanConfigName name, ScanConfig scanConfig) { UpdateScanConfigRequest request = UpdateScanConfigRequest.newBuilder() .setName(name == null ? null : name.toString()) .setScanConfig(scanConfig) .build(); return updateScanConfig(request); }
java
public final ScanConfig updateScanConfig(ScanConfigName name, ScanConfig scanConfig) { UpdateScanConfigRequest request = UpdateScanConfigRequest.newBuilder() .setName(name == null ? null : name.toString()) .setScanConfig(scanConfig) .build(); return updateScanConfig(request); }
[ "public", "final", "ScanConfig", "updateScanConfig", "(", "ScanConfigName", "name", ",", "ScanConfig", "scanConfig", ")", "{", "UpdateScanConfigRequest", "request", "=", "UpdateScanConfigRequest", ".", "newBuilder", "(", ")", ".", "setName", "(", "name", "==", "null...
Updates the specified scan configuration. <p>Sample code: <pre><code> try (ContainerAnalysisV1Beta1Client containerAnalysisV1Beta1Client = ContainerAnalysisV1Beta1Client.create()) { ScanConfigName name = ScanConfigName.of("[PROJECT]", "[SCAN_CONFIG]"); ScanConfig scanConfig = ScanConfig.newBuilder().build(); ScanConfig response = containerAnalysisV1Beta1Client.updateScanConfig(name, scanConfig); } </code></pre> @param name The name of the scan configuration in the form of `projects/[PROJECT_ID]/scanConfigs/[SCAN_CONFIG_ID]`. @param scanConfig The updated scan configuration. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Updates", "the", "specified", "scan", "configuration", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-containeranalysis/src/main/java/com/google/cloud/devtools/containeranalysis/v1beta1/ContainerAnalysisV1Beta1Client.java#L811-L819
samskivert/samskivert
src/main/java/com/samskivert/jdbc/JDBCUtil.java
JDBCUtil.warnedUpdate
public static void warnedUpdate (PreparedStatement stmt, int expectedCount) throws SQLException { int modified = stmt.executeUpdate(); if (modified != expectedCount) { log.warning("Statement did not modify expected number of rows", "stmt", stmt, "expected", expectedCount, "modified", modified); } }
java
public static void warnedUpdate (PreparedStatement stmt, int expectedCount) throws SQLException { int modified = stmt.executeUpdate(); if (modified != expectedCount) { log.warning("Statement did not modify expected number of rows", "stmt", stmt, "expected", expectedCount, "modified", modified); } }
[ "public", "static", "void", "warnedUpdate", "(", "PreparedStatement", "stmt", ",", "int", "expectedCount", ")", "throws", "SQLException", "{", "int", "modified", "=", "stmt", ".", "executeUpdate", "(", ")", ";", "if", "(", "modified", "!=", "expectedCount", ")...
Calls <code>stmt.executeUpdate()</code> on the supplied statement, checking to see that it returns the expected update count and logging a warning if it does not.
[ "Calls", "<code", ">", "stmt", ".", "executeUpdate", "()", "<", "/", "code", ">", "on", "the", "supplied", "statement", "checking", "to", "see", "that", "it", "returns", "the", "expected", "update", "count", "and", "logging", "a", "warning", "if", "it", ...
train
https://github.com/samskivert/samskivert/blob/a64d9ef42b69819bdb2c66bddac6a64caef928b6/src/main/java/com/samskivert/jdbc/JDBCUtil.java#L125-L133
MGunlogson/CuckooFilter4J
src/main/java/com/github/mgunlogson/cuckoofilter4j/FilterTable.java
FilterTable.checkTag
boolean checkTag(long bucketIndex, int posInBucket, long tag) { long tagStartIdx = getTagOffset(bucketIndex, posInBucket); final int bityPerTag = bitsPerTag; for (long i = 0; i < bityPerTag; i++) { if (memBlock.get(i + tagStartIdx) != ((tag & (1L << i)) != 0)) return false; } return true; }
java
boolean checkTag(long bucketIndex, int posInBucket, long tag) { long tagStartIdx = getTagOffset(bucketIndex, posInBucket); final int bityPerTag = bitsPerTag; for (long i = 0; i < bityPerTag; i++) { if (memBlock.get(i + tagStartIdx) != ((tag & (1L << i)) != 0)) return false; } return true; }
[ "boolean", "checkTag", "(", "long", "bucketIndex", ",", "int", "posInBucket", ",", "long", "tag", ")", "{", "long", "tagStartIdx", "=", "getTagOffset", "(", "bucketIndex", ",", "posInBucket", ")", ";", "final", "int", "bityPerTag", "=", "bitsPerTag", ";", "f...
Check if a tag in a given position in a bucket matches the tag you passed it. Faster than regular read because it stops checking if it finds a non-matching bit.
[ "Check", "if", "a", "tag", "in", "a", "given", "position", "in", "a", "bucket", "matches", "the", "tag", "you", "passed", "it", ".", "Faster", "than", "regular", "read", "because", "it", "stops", "checking", "if", "it", "finds", "a", "non", "-", "match...
train
https://github.com/MGunlogson/CuckooFilter4J/blob/e8472aa150b201f05046d1c81cac5a5ca4348db8/src/main/java/com/github/mgunlogson/cuckoofilter4j/FilterTable.java#L207-L215
Jasig/uPortal
uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/utils/SmartCache.java
SmartCache.put
@Override public synchronized Object put(Object key, Object value) { ValueWrapper valueWrapper = new ValueWrapper(value); return super.put(key, valueWrapper); }
java
@Override public synchronized Object put(Object key, Object value) { ValueWrapper valueWrapper = new ValueWrapper(value); return super.put(key, valueWrapper); }
[ "@", "Override", "public", "synchronized", "Object", "put", "(", "Object", "key", ",", "Object", "value", ")", "{", "ValueWrapper", "valueWrapper", "=", "new", "ValueWrapper", "(", "value", ")", ";", "return", "super", ".", "put", "(", "key", ",", "valueWr...
Add a new value to the cache. The value will expire in accordance with the cache's expiration timeout value which was set when the cache was created. @param key the key, typically a String @param value the value @return the previous value of the specified key in this hashtable, or null if it did not have one.
[ "Add", "a", "new", "value", "to", "the", "cache", ".", "The", "value", "will", "expire", "in", "accordance", "with", "the", "cache", "s", "expiration", "timeout", "value", "which", "was", "set", "when", "the", "cache", "was", "created", "." ]
train
https://github.com/Jasig/uPortal/blob/c1986542abb9acd214268f2df21c6305ad2f262b/uPortal-utils/uPortal-utils-core/src/main/java/org/apereo/portal/utils/SmartCache.java#L80-L84
nguillaumin/slick2d-maven
slick2d-core/src/main/java/org/newdawn/slick/Image.java
Image.drawFlash
public void drawFlash(float x,float y,float width,float height, Color col) { init(); col.bind(); texture.bind(); if (GL.canSecondaryColor()) { GL.glEnable(SGL.GL_COLOR_SUM_EXT); GL.glSecondaryColor3ubEXT((byte)(col.r * 255), (byte)(col.g * 255), (byte)(col.b * 255)); } GL.glTexEnvi(SGL.GL_TEXTURE_ENV, SGL.GL_TEXTURE_ENV_MODE, SGL.GL_MODULATE); GL.glTranslatef(x, y, 0); if (angle != 0) { GL.glTranslatef(centerX, centerY, 0.0f); GL.glRotatef(angle, 0.0f, 0.0f, 1.0f); GL.glTranslatef(-centerX, -centerY, 0.0f); } GL.glBegin(SGL.GL_QUADS); drawEmbedded(0,0,width,height); GL.glEnd(); if (angle != 0) { GL.glTranslatef(centerX, centerY, 0.0f); GL.glRotatef(-angle, 0.0f, 0.0f, 1.0f); GL.glTranslatef(-centerX, -centerY, 0.0f); } GL.glTranslatef(-x, -y, 0); if (GL.canSecondaryColor()) { GL.glDisable(SGL.GL_COLOR_SUM_EXT); } }
java
public void drawFlash(float x,float y,float width,float height, Color col) { init(); col.bind(); texture.bind(); if (GL.canSecondaryColor()) { GL.glEnable(SGL.GL_COLOR_SUM_EXT); GL.glSecondaryColor3ubEXT((byte)(col.r * 255), (byte)(col.g * 255), (byte)(col.b * 255)); } GL.glTexEnvi(SGL.GL_TEXTURE_ENV, SGL.GL_TEXTURE_ENV_MODE, SGL.GL_MODULATE); GL.glTranslatef(x, y, 0); if (angle != 0) { GL.glTranslatef(centerX, centerY, 0.0f); GL.glRotatef(angle, 0.0f, 0.0f, 1.0f); GL.glTranslatef(-centerX, -centerY, 0.0f); } GL.glBegin(SGL.GL_QUADS); drawEmbedded(0,0,width,height); GL.glEnd(); if (angle != 0) { GL.glTranslatef(centerX, centerY, 0.0f); GL.glRotatef(-angle, 0.0f, 0.0f, 1.0f); GL.glTranslatef(-centerX, -centerY, 0.0f); } GL.glTranslatef(-x, -y, 0); if (GL.canSecondaryColor()) { GL.glDisable(SGL.GL_COLOR_SUM_EXT); } }
[ "public", "void", "drawFlash", "(", "float", "x", ",", "float", "y", ",", "float", "width", ",", "float", "height", ",", "Color", "col", ")", "{", "init", "(", ")", ";", "col", ".", "bind", "(", ")", ";", "texture", ".", "bind", "(", ")", ";", ...
Draw this image at a specified location and size as a silohette @param x The x location to draw the image at @param y The y location to draw the image at @param width The width to render the image at @param height The height to render the image at @param col The color for the sillohette
[ "Draw", "this", "image", "at", "a", "specified", "location", "and", "size", "as", "a", "silohette" ]
train
https://github.com/nguillaumin/slick2d-maven/blob/8251f88a0ed6a70e726d2468842455cd1f80893f/slick2d-core/src/main/java/org/newdawn/slick/Image.java#L851-L887
Appendium/objectlabkit
utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java
BigDecimalUtil.setScale
public static BigDecimal setScale(final BigDecimal bd, final Integer scale, final int rounding) { if (bd != null && scale != null) { return bd.setScale(scale, rounding); } return null; }
java
public static BigDecimal setScale(final BigDecimal bd, final Integer scale, final int rounding) { if (bd != null && scale != null) { return bd.setScale(scale, rounding); } return null; }
[ "public", "static", "BigDecimal", "setScale", "(", "final", "BigDecimal", "bd", ",", "final", "Integer", "scale", ",", "final", "int", "rounding", ")", "{", "if", "(", "bd", "!=", "null", "&&", "scale", "!=", "null", ")", "{", "return", "bd", ".", "set...
returns a new BigDecimal with correct Scales.PERCENT_SCALE. This is used by the table renderer. @param bd @return new bd or null
[ "returns", "a", "new", "BigDecimal", "with", "correct", "Scales", ".", "PERCENT_SCALE", ".", "This", "is", "used", "by", "the", "table", "renderer", "." ]
train
https://github.com/Appendium/objectlabkit/blob/cd649bce7a32e4e926520e62cb765f3b1d451594/utils/src/main/java/net/objectlab/kit/util/BigDecimalUtil.java#L428-L433
ManfredTremmel/gwt-commons-lang3
src/main/java/org/apache/commons/lang3/StringUtils.java
StringUtils.removePattern
public static String removePattern(final String source, final String regex) { return replacePattern(source, regex, StringUtils.EMPTY); }
java
public static String removePattern(final String source, final String regex) { return replacePattern(source, regex, StringUtils.EMPTY); }
[ "public", "static", "String", "removePattern", "(", "final", "String", "source", ",", "final", "String", "regex", ")", "{", "return", "replacePattern", "(", "source", ",", "regex", ",", "StringUtils", ".", "EMPTY", ")", ";", "}" ]
<p>Removes each substring of the source String that matches the given regular expression using the DOTALL option. </p> This call is a {@code null} safe equivalent to: <ul> <li>{@code source.replaceAll(&quot;(?s)&quot; + regex, StringUtils.EMPTY)}</li> <li>{@code Pattern.compile(regex, Pattern.DOTALL).matcher(source).replaceAll(StringUtils.EMPTY)}</li> </ul> <p>A {@code null} reference passed to this method is a no-op.</p> <pre> StringUtils.removePattern(null, *) = null StringUtils.removePattern("any", null) = "any" StringUtils.removePattern("A&lt;__&gt;\n&lt;__&gt;B", "&lt;.*&gt;") = "AB" StringUtils.removePattern("ABCabc123", "[a-z]") = "ABC123" </pre> @param source the source string @param regex the regular expression to which this string is to be matched @return The resulting {@code String} @see #replacePattern(String, String, String) @see String#replaceAll(String, String) @see Pattern#DOTALL @since 3.2 @since 3.5 Changed {@code null} reference passed to this method is a no-op.
[ "<p", ">", "Removes", "each", "substring", "of", "the", "source", "String", "that", "matches", "the", "given", "regular", "expression", "using", "the", "DOTALL", "option", ".", "<", "/", "p", ">" ]
train
https://github.com/ManfredTremmel/gwt-commons-lang3/blob/9e2dfbbda3668cfa5d935fe76479d1426c294504/src/main/java/org/apache/commons/lang3/StringUtils.java#L5278-L5280
JOML-CI/JOML
src/org/joml/Matrix4x3d.java
Matrix4x3d.ortho2DLH
public Matrix4x3d ortho2DLH(double left, double right, double bottom, double top) { return ortho2DLH(left, right, bottom, top, this); }
java
public Matrix4x3d ortho2DLH(double left, double right, double bottom, double top) { return ortho2DLH(left, right, bottom, top, this); }
[ "public", "Matrix4x3d", "ortho2DLH", "(", "double", "left", ",", "double", "right", ",", "double", "bottom", ",", "double", "top", ")", "{", "return", "ortho2DLH", "(", "left", ",", "right", ",", "bottom", ",", "top", ",", "this", ")", ";", "}" ]
Apply an orthographic projection transformation for a left-handed coordinate system to this matrix. <p> This method is equivalent to calling {@link #orthoLH(double, double, double, double, double, double) orthoLH()} with <code>zNear=-1</code> and <code>zFar=+1</code>. <p> If <code>M</code> is <code>this</code> matrix and <code>O</code> the orthographic projection matrix, then the new matrix will be <code>M * O</code>. So when transforming a vector <code>v</code> with the new matrix by using <code>M * O * v</code>, the orthographic projection transformation will be applied first! <p> In order to set the matrix to an orthographic projection without post-multiplying it, use {@link #setOrtho2DLH(double, double, double, double) setOrtho2DLH()}. <p> Reference: <a href="http://www.songho.ca/opengl/gl_projectionmatrix.html#ortho">http://www.songho.ca</a> @see #orthoLH(double, double, double, double, double, double) @see #setOrtho2DLH(double, double, double, double) @param left the distance from the center to the left frustum edge @param right the distance from the center to the right frustum edge @param bottom the distance from the center to the bottom frustum edge @param top the distance from the center to the top frustum edge @return this
[ "Apply", "an", "orthographic", "projection", "transformation", "for", "a", "left", "-", "handed", "coordinate", "system", "to", "this", "matrix", ".", "<p", ">", "This", "method", "is", "equivalent", "to", "calling", "{", "@link", "#orthoLH", "(", "double", ...
train
https://github.com/JOML-CI/JOML/blob/ce2652fc236b42bda3875c591f8e6645048a678f/src/org/joml/Matrix4x3d.java#L7684-L7686
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DecimalStyle.java
DecimalStyle.withNegativeSign
public DecimalStyle withNegativeSign(char negativeSign) { if (negativeSign == this.negativeSign) { return this; } return new DecimalStyle(zeroDigit, positiveSign, negativeSign, decimalSeparator); }
java
public DecimalStyle withNegativeSign(char negativeSign) { if (negativeSign == this.negativeSign) { return this; } return new DecimalStyle(zeroDigit, positiveSign, negativeSign, decimalSeparator); }
[ "public", "DecimalStyle", "withNegativeSign", "(", "char", "negativeSign", ")", "{", "if", "(", "negativeSign", "==", "this", ".", "negativeSign", ")", "{", "return", "this", ";", "}", "return", "new", "DecimalStyle", "(", "zeroDigit", ",", "positiveSign", ","...
Returns a copy of the info with a new character that represents the negative sign. <p> The character used to represent a negative number may vary by culture. This method specifies the character to use. @param negativeSign the character for the negative sign @return a copy with a new character that represents the negative sign, not null
[ "Returns", "a", "copy", "of", "the", "info", "with", "a", "new", "character", "that", "represents", "the", "negative", "sign", ".", "<p", ">", "The", "character", "used", "to", "represent", "a", "negative", "number", "may", "vary", "by", "culture", ".", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DecimalStyle.java#L274-L279
Stratio/stratio-cassandra
src/java/org/apache/cassandra/cli/CliClient.java
CliClient.getTypeByFunction
public static AbstractType<?> getTypeByFunction(String functionName) { Function function; try { function = Function.valueOf(functionName.toUpperCase()); } catch (IllegalArgumentException e) { String message = String.format("Function '%s' not found. Available functions: %s", functionName, Function.getFunctionNames()); throw new RuntimeException(message, e); } return function.getValidator(); }
java
public static AbstractType<?> getTypeByFunction(String functionName) { Function function; try { function = Function.valueOf(functionName.toUpperCase()); } catch (IllegalArgumentException e) { String message = String.format("Function '%s' not found. Available functions: %s", functionName, Function.getFunctionNames()); throw new RuntimeException(message, e); } return function.getValidator(); }
[ "public", "static", "AbstractType", "<", "?", ">", "getTypeByFunction", "(", "String", "functionName", ")", "{", "Function", "function", ";", "try", "{", "function", "=", "Function", ".", "valueOf", "(", "functionName", ".", "toUpperCase", "(", ")", ")", ";"...
Get AbstractType by function name @param functionName - name of the function e.g. utf8, integer, long etc. @return AbstractType type corresponding to the function name
[ "Get", "AbstractType", "by", "function", "name" ]
train
https://github.com/Stratio/stratio-cassandra/blob/f6416b43ad5309083349ad56266450fa8c6a2106/src/java/org/apache/cassandra/cli/CliClient.java#L2827-L2842
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionLinkPersistenceImpl.java
CPDefinitionLinkPersistenceImpl.findByCPD_T
@Override public List<CPDefinitionLink> findByCPD_T(long CPDefinitionId, String type, int start, int end) { return findByCPD_T(CPDefinitionId, type, start, end, null); }
java
@Override public List<CPDefinitionLink> findByCPD_T(long CPDefinitionId, String type, int start, int end) { return findByCPD_T(CPDefinitionId, type, start, end, null); }
[ "@", "Override", "public", "List", "<", "CPDefinitionLink", ">", "findByCPD_T", "(", "long", "CPDefinitionId", ",", "String", "type", ",", "int", "start", ",", "int", "end", ")", "{", "return", "findByCPD_T", "(", "CPDefinitionId", ",", "type", ",", "start",...
Returns a range of all the cp definition links where CPDefinitionId = &#63; and type = &#63;. <p> Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link QueryUtil#ALL_POS} will return the full result set. If <code>orderByComparator</code> is specified, then the query will include the given ORDER BY logic. If <code>orderByComparator</code> is absent and pagination is required (<code>start</code> and <code>end</code> are not {@link QueryUtil#ALL_POS}), then the query will include the default ORDER BY logic from {@link CPDefinitionLinkModelImpl}. If both <code>orderByComparator</code> and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. </p> @param CPDefinitionId the cp definition ID @param type the type @param start the lower bound of the range of cp definition links @param end the upper bound of the range of cp definition links (not inclusive) @return the range of matching cp definition links
[ "Returns", "a", "range", "of", "all", "the", "cp", "definition", "links", "where", "CPDefinitionId", "=", "&#63", ";", "and", "type", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPDefinitionLinkPersistenceImpl.java#L2562-L2566
looly/hutool
hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelBase.java
ExcelBase.getOrCreateCellStyle
public CellStyle getOrCreateCellStyle(int x, int y) { final Cell cell = getOrCreateCell(x, y); CellStyle cellStyle = cell.getCellStyle(); if (null == cellStyle) { cellStyle = this.workbook.createCellStyle(); cell.setCellStyle(cellStyle); } return cellStyle; }
java
public CellStyle getOrCreateCellStyle(int x, int y) { final Cell cell = getOrCreateCell(x, y); CellStyle cellStyle = cell.getCellStyle(); if (null == cellStyle) { cellStyle = this.workbook.createCellStyle(); cell.setCellStyle(cellStyle); } return cellStyle; }
[ "public", "CellStyle", "getOrCreateCellStyle", "(", "int", "x", ",", "int", "y", ")", "{", "final", "Cell", "cell", "=", "getOrCreateCell", "(", "x", ",", "y", ")", ";", "CellStyle", "cellStyle", "=", "cell", ".", "getCellStyle", "(", ")", ";", "if", "...
为指定单元格获取或者创建样式,返回样式后可以设置样式内容 @param x X坐标,从0计数,既列号 @param y Y坐标,从0计数,既行号 @return {@link CellStyle} @since 4.1.4
[ "为指定单元格获取或者创建样式,返回样式后可以设置样式内容" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-poi/src/main/java/cn/hutool/poi/excel/ExcelBase.java#L199-L207
geomajas/geomajas-project-client-gwt
plugin/javascript-api/javascript-api-gwt/src/main/java/org/geomajas/plugin/jsapi/gwt/client/exporter/GeomajasServiceImpl.java
GeomajasServiceImpl.getMap
@Export public Map getMap(String applicationId, String mapId) { HashMap<String, Map> application = maps.get(applicationId); if (null == application) { return null; } return application.get(mapId); }
java
@Export public Map getMap(String applicationId, String mapId) { HashMap<String, Map> application = maps.get(applicationId); if (null == application) { return null; } return application.get(mapId); }
[ "@", "Export", "public", "Map", "getMap", "(", "String", "applicationId", ",", "String", "mapId", ")", "{", "HashMap", "<", "String", ",", "Map", ">", "application", "=", "maps", ".", "get", "(", "applicationId", ")", ";", "if", "(", "null", "==", "app...
Return the {@link Map} that is registered with the given application and map ID. @param applicationId the application id. @param mapId the map id. @return the map.
[ "Return", "the", "{", "@link", "Map", "}", "that", "is", "registered", "with", "the", "given", "application", "and", "map", "ID", "." ]
train
https://github.com/geomajas/geomajas-project-client-gwt/blob/1c1adc48deb192ed825265eebcc74d70bbf45670/plugin/javascript-api/javascript-api-gwt/src/main/java/org/geomajas/plugin/jsapi/gwt/client/exporter/GeomajasServiceImpl.java#L144-L151
exoplatform/jcr
exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/GenericResource.java
GenericResource.supportedLock
protected HierarchicalProperty supportedLock() { HierarchicalProperty supportedLock = new HierarchicalProperty(new QName("DAV:", "supportedlock")); HierarchicalProperty lockEntry = new HierarchicalProperty(new QName("DAV:", "lockentry")); supportedLock.addChild(lockEntry); HierarchicalProperty lockScope = new HierarchicalProperty(new QName("DAV:", "lockscope")); lockScope.addChild(new HierarchicalProperty(new QName("DAV:", "exclusive"))); lockEntry.addChild(lockScope); HierarchicalProperty lockType = new HierarchicalProperty(new QName("DAV:", "locktype")); lockType.addChild(new HierarchicalProperty(new QName("DAV:", "write"))); lockEntry.addChild(lockType); return supportedLock; }
java
protected HierarchicalProperty supportedLock() { HierarchicalProperty supportedLock = new HierarchicalProperty(new QName("DAV:", "supportedlock")); HierarchicalProperty lockEntry = new HierarchicalProperty(new QName("DAV:", "lockentry")); supportedLock.addChild(lockEntry); HierarchicalProperty lockScope = new HierarchicalProperty(new QName("DAV:", "lockscope")); lockScope.addChild(new HierarchicalProperty(new QName("DAV:", "exclusive"))); lockEntry.addChild(lockScope); HierarchicalProperty lockType = new HierarchicalProperty(new QName("DAV:", "locktype")); lockType.addChild(new HierarchicalProperty(new QName("DAV:", "write"))); lockEntry.addChild(lockType); return supportedLock; }
[ "protected", "HierarchicalProperty", "supportedLock", "(", ")", "{", "HierarchicalProperty", "supportedLock", "=", "new", "HierarchicalProperty", "(", "new", "QName", "(", "\"DAV:\"", ",", "\"supportedlock\"", ")", ")", ";", "HierarchicalProperty", "lockEntry", "=", "...
The information about supported locks. @return information about supported locks
[ "The", "information", "about", "supported", "locks", "." ]
train
https://github.com/exoplatform/jcr/blob/3e7f9ee1b5683640d73a4316fb4b0ad5eac5b8a2/exo.jcr.component.webdav/src/main/java/org/exoplatform/services/jcr/webdav/resource/GenericResource.java#L186-L202
Samsung/GearVRf
GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/JaiDebug.java
JaiDebug.dumpColorset
public static void dumpColorset(AiMesh mesh, int colorset) { if (!mesh.hasColors(colorset)) { System.out.println("mesh has no vertex color set " + colorset); return; } for (int i = 0; i < mesh.getNumVertices(); i++) { System.out.println("[" + mesh.getColorR(i, colorset) + ", " + mesh.getColorG(i, colorset) + ", " + mesh.getColorB(i, colorset) + ", " + mesh.getColorA(i, colorset) + "]" ); } }
java
public static void dumpColorset(AiMesh mesh, int colorset) { if (!mesh.hasColors(colorset)) { System.out.println("mesh has no vertex color set " + colorset); return; } for (int i = 0; i < mesh.getNumVertices(); i++) { System.out.println("[" + mesh.getColorR(i, colorset) + ", " + mesh.getColorG(i, colorset) + ", " + mesh.getColorB(i, colorset) + ", " + mesh.getColorA(i, colorset) + "]" ); } }
[ "public", "static", "void", "dumpColorset", "(", "AiMesh", "mesh", ",", "int", "colorset", ")", "{", "if", "(", "!", "mesh", ".", "hasColors", "(", "colorset", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"mesh has no vertex color set \"", "...
Dumps a vertex color set of a mesh to stdout.<p> @param mesh the mesh @param colorset the color set
[ "Dumps", "a", "vertex", "color", "set", "of", "a", "mesh", "to", "stdout", ".", "<p", ">" ]
train
https://github.com/Samsung/GearVRf/blob/05034d465a7b0a494fabb9e9f2971ac19392f32d/GVRf/Framework/framework/src/main/java/org/gearvrf/jassimp/JaiDebug.java#L116-L130
fuinorg/event-store-commons
eshttp/src/main/java/org/fuin/esc/eshttp/ESHttpUtils.java
ESHttpUtils.createDocumentBuilder
@NotNull public static DocumentBuilder createDocumentBuilder() { try { final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); return factory.newDocumentBuilder(); } catch (final ParserConfigurationException ex) { throw new RuntimeException("Couldn't create document builder", ex); } }
java
@NotNull public static DocumentBuilder createDocumentBuilder() { try { final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); factory.setNamespaceAware(true); return factory.newDocumentBuilder(); } catch (final ParserConfigurationException ex) { throw new RuntimeException("Couldn't create document builder", ex); } }
[ "@", "NotNull", "public", "static", "DocumentBuilder", "createDocumentBuilder", "(", ")", "{", "try", "{", "final", "DocumentBuilderFactory", "factory", "=", "DocumentBuilderFactory", ".", "newInstance", "(", ")", ";", "factory", ".", "setNamespaceAware", "(", "true...
Creates a namespace aware document builder. @return New instance.
[ "Creates", "a", "namespace", "aware", "document", "builder", "." ]
train
https://github.com/fuinorg/event-store-commons/blob/ea175582d8cda2b5a6d2fe52bbb2f1c183eee77c/eshttp/src/main/java/org/fuin/esc/eshttp/ESHttpUtils.java#L186-L195
thorstenwagner/TraJ
src/main/java/de/biomedical_imaging/traJ/TrajectoryUtil.java
TrajectoryUtil.concactTrajectorie
public static Trajectory concactTrajectorie(Trajectory a, Trajectory b){ if(a.getDimension()!=b.getDimension()){ throw new IllegalArgumentException("Combination not possible: The trajectorys does not have the same dimension"); } Trajectory c = new Trajectory(a.getDimension()); for(int i = 0 ; i < a.size(); i++){ Point3d pos = new Point3d(a.get(i).x, a.get(i).y, a.get(i).z); c.add(pos); } double dx = a.get(a.size()-1).x - b.get(0).x; double dy = a.get(a.size()-1).y - b.get(0).y; double dz = a.get(a.size()-1).z - b.get(0).z; for(int i = 1 ; i < b.size(); i++){ Point3d pos = new Point3d(b.get(i).x+dx, b.get(i).y+dy, b.get(i).z+dz); c.add(pos); } return c; }
java
public static Trajectory concactTrajectorie(Trajectory a, Trajectory b){ if(a.getDimension()!=b.getDimension()){ throw new IllegalArgumentException("Combination not possible: The trajectorys does not have the same dimension"); } Trajectory c = new Trajectory(a.getDimension()); for(int i = 0 ; i < a.size(); i++){ Point3d pos = new Point3d(a.get(i).x, a.get(i).y, a.get(i).z); c.add(pos); } double dx = a.get(a.size()-1).x - b.get(0).x; double dy = a.get(a.size()-1).y - b.get(0).y; double dz = a.get(a.size()-1).z - b.get(0).z; for(int i = 1 ; i < b.size(); i++){ Point3d pos = new Point3d(b.get(i).x+dx, b.get(i).y+dy, b.get(i).z+dz); c.add(pos); } return c; }
[ "public", "static", "Trajectory", "concactTrajectorie", "(", "Trajectory", "a", ",", "Trajectory", "b", ")", "{", "if", "(", "a", ".", "getDimension", "(", ")", "!=", "b", ".", "getDimension", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", ...
Concatenates the trajectory a and b @param a The end of this trajectory will be connected to the start of trajectory b @param b The start of this trajectory will be connected to the end of trajectory a @return Concatenated trajectory
[ "Concatenates", "the", "trajectory", "a", "and", "b" ]
train
https://github.com/thorstenwagner/TraJ/blob/505fafb1f2f77a2d67bb2a089a2fdebe2c9bc7cb/src/main/java/de/biomedical_imaging/traJ/TrajectoryUtil.java#L71-L97
alkacon/opencms-core
src/org/opencms/relations/CmsExternalLinksValidator.java
CmsExternalLinksValidator.launch
public String launch(CmsObject cms, Map<String, String> parameters) throws CmsException { if (Boolean.valueOf(parameters.get("writeLog")).booleanValue()) { m_report = new CmsLogReport(cms.getRequestContext().getLocale(), CmsExternalLinksValidator.class); } validateLinks(cms); return "CmsExternLinkValidator.launch(): Links checked."; }
java
public String launch(CmsObject cms, Map<String, String> parameters) throws CmsException { if (Boolean.valueOf(parameters.get("writeLog")).booleanValue()) { m_report = new CmsLogReport(cms.getRequestContext().getLocale(), CmsExternalLinksValidator.class); } validateLinks(cms); return "CmsExternLinkValidator.launch(): Links checked."; }
[ "public", "String", "launch", "(", "CmsObject", "cms", ",", "Map", "<", "String", ",", "String", ">", "parameters", ")", "throws", "CmsException", "{", "if", "(", "Boolean", ".", "valueOf", "(", "parameters", ".", "get", "(", "\"writeLog\"", ")", ")", "....
This method is called by the cron scheduler.<p> @param cms a OpenCms context object @param parameters link check parameters @return the String that is written to the OpenCms log @throws CmsException if something goes wrong
[ "This", "method", "is", "called", "by", "the", "cron", "scheduler", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/relations/CmsExternalLinksValidator.java#L109-L116
facebookarchive/hadoop-20
src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/datanode/AvatarDataNode.java
AvatarDataNode.instantiateDataNode
public static AvatarDataNode instantiateDataNode(String args[], Configuration conf) throws IOException { if (conf == null) conf = new Configuration(); if (!parseArguments(args, conf)) { printUsage(); return null; } if (conf.get("dfs.network.script") != null) { LOG.error("This configuration for rack identification is not supported" + " anymore. RackID resolution is handled by the NameNode."); System.exit(-1); } String[] dataDirs = getListOfDataDirs(conf); return makeInstance(dataDirs, conf); }
java
public static AvatarDataNode instantiateDataNode(String args[], Configuration conf) throws IOException { if (conf == null) conf = new Configuration(); if (!parseArguments(args, conf)) { printUsage(); return null; } if (conf.get("dfs.network.script") != null) { LOG.error("This configuration for rack identification is not supported" + " anymore. RackID resolution is handled by the NameNode."); System.exit(-1); } String[] dataDirs = getListOfDataDirs(conf); return makeInstance(dataDirs, conf); }
[ "public", "static", "AvatarDataNode", "instantiateDataNode", "(", "String", "args", "[", "]", ",", "Configuration", "conf", ")", "throws", "IOException", "{", "if", "(", "conf", "==", "null", ")", "conf", "=", "new", "Configuration", "(", ")", ";", "if", "...
Instantiate a single datanode object. This must be run by invoking {@link DataNode#runDatanodeDaemon(DataNode)} subsequently.
[ "Instantiate", "a", "single", "datanode", "object", ".", "This", "must", "be", "run", "by", "invoking", "{" ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/highavailability/src/java/org/apache/hadoop/hdfs/server/datanode/AvatarDataNode.java#L1261-L1276
google/closure-templates
java/src/com/google/template/soy/jssrc/internal/GenJsCodeVisitor.java
GenJsCodeVisitor.addCodeToDeclareGoogModule
private void addCodeToDeclareGoogModule(StringBuilder header, SoyFileNode soyFile) { String exportNamespace = getGoogModuleNamespace(soyFile.getNamespace()); header.append("goog.module('").append(exportNamespace).append("');\n\n"); }
java
private void addCodeToDeclareGoogModule(StringBuilder header, SoyFileNode soyFile) { String exportNamespace = getGoogModuleNamespace(soyFile.getNamespace()); header.append("goog.module('").append(exportNamespace).append("');\n\n"); }
[ "private", "void", "addCodeToDeclareGoogModule", "(", "StringBuilder", "header", ",", "SoyFileNode", "soyFile", ")", "{", "String", "exportNamespace", "=", "getGoogModuleNamespace", "(", "soyFile", ".", "getNamespace", "(", ")", ")", ";", "header", ".", "append", ...
Helper for visitSoyFileNode(SoyFileNode) to generate a module definition. @param header @param soyFile The node we're visiting.
[ "Helper", "for", "visitSoyFileNode", "(", "SoyFileNode", ")", "to", "generate", "a", "module", "definition", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/jssrc/internal/GenJsCodeVisitor.java#L526-L529
kohsuke/jcifs
src/jcifs/smb/SigningDigest.java
SigningDigest.verify
boolean verify(byte[] data, int offset, ServerMessageBlock response) { update(macSigningKey, 0, macSigningKey.length); int index = offset; update(data, index, ServerMessageBlock.SIGNATURE_OFFSET); index += ServerMessageBlock.SIGNATURE_OFFSET; byte[] sequence = new byte[8]; ServerMessageBlock.writeInt4(response.signSeq, sequence, 0); update(sequence, 0, sequence.length); index += 8; if( response.command == ServerMessageBlock.SMB_COM_READ_ANDX ) { /* SmbComReadAndXResponse reads directly from the stream into separate byte[] b. */ SmbComReadAndXResponse raxr = (SmbComReadAndXResponse)response; int length = response.length - raxr.dataLength; update(data, index, length - ServerMessageBlock.SIGNATURE_OFFSET - 8); update(raxr.b, raxr.off, raxr.dataLength); } else { update(data, index, response.length - ServerMessageBlock.SIGNATURE_OFFSET - 8); } byte[] signature = digest(); for (int i = 0; i < 8; i++) { if (signature[i] != data[offset + ServerMessageBlock.SIGNATURE_OFFSET + i]) { if( log.level >= 2 ) { log.println( "signature verification failure" ); Hexdump.hexdump( log, signature, 0, 8 ); Hexdump.hexdump( log, data, offset + ServerMessageBlock.SIGNATURE_OFFSET, 8 ); } return response.verifyFailed = true; } } return response.verifyFailed = false; }
java
boolean verify(byte[] data, int offset, ServerMessageBlock response) { update(macSigningKey, 0, macSigningKey.length); int index = offset; update(data, index, ServerMessageBlock.SIGNATURE_OFFSET); index += ServerMessageBlock.SIGNATURE_OFFSET; byte[] sequence = new byte[8]; ServerMessageBlock.writeInt4(response.signSeq, sequence, 0); update(sequence, 0, sequence.length); index += 8; if( response.command == ServerMessageBlock.SMB_COM_READ_ANDX ) { /* SmbComReadAndXResponse reads directly from the stream into separate byte[] b. */ SmbComReadAndXResponse raxr = (SmbComReadAndXResponse)response; int length = response.length - raxr.dataLength; update(data, index, length - ServerMessageBlock.SIGNATURE_OFFSET - 8); update(raxr.b, raxr.off, raxr.dataLength); } else { update(data, index, response.length - ServerMessageBlock.SIGNATURE_OFFSET - 8); } byte[] signature = digest(); for (int i = 0; i < 8; i++) { if (signature[i] != data[offset + ServerMessageBlock.SIGNATURE_OFFSET + i]) { if( log.level >= 2 ) { log.println( "signature verification failure" ); Hexdump.hexdump( log, signature, 0, 8 ); Hexdump.hexdump( log, data, offset + ServerMessageBlock.SIGNATURE_OFFSET, 8 ); } return response.verifyFailed = true; } } return response.verifyFailed = false; }
[ "boolean", "verify", "(", "byte", "[", "]", "data", ",", "int", "offset", ",", "ServerMessageBlock", "response", ")", "{", "update", "(", "macSigningKey", ",", "0", ",", "macSigningKey", ".", "length", ")", ";", "int", "index", "=", "offset", ";", "updat...
Performs MAC signature verification. This calculates the signature of the SMB and compares it to the signature field on the SMB itself. @param data The data. @param offset The starting offset at which the SMB header begins. @param length The length of the SMB data starting at offset.
[ "Performs", "MAC", "signature", "verification", ".", "This", "calculates", "the", "signature", "of", "the", "SMB", "and", "compares", "it", "to", "the", "signature", "field", "on", "the", "SMB", "itself", "." ]
train
https://github.com/kohsuke/jcifs/blob/7751f4e4826c35614d237a70c2582553f95b58de/src/jcifs/smb/SigningDigest.java#L158-L191
sundrio/sundrio
annotations/builder/src/main/java/io/sundr/builder/internal/functions/Descendants.java
Descendants.isDescendant
public static boolean isDescendant(TypeDef item, TypeDef candidate) { if (item == null || candidate == null) { return false; } else if (candidate.isAssignableFrom(item)) { return true; } return false; }
java
public static boolean isDescendant(TypeDef item, TypeDef candidate) { if (item == null || candidate == null) { return false; } else if (candidate.isAssignableFrom(item)) { return true; } return false; }
[ "public", "static", "boolean", "isDescendant", "(", "TypeDef", "item", ",", "TypeDef", "candidate", ")", "{", "if", "(", "item", "==", "null", "||", "candidate", "==", "null", ")", "{", "return", "false", ";", "}", "else", "if", "(", "candidate", ".", ...
Checks if a type is an descendant of an other type @param item The base type. @param candidate The candidate type. @return true if candidate is a descendant of base type.
[ "Checks", "if", "a", "type", "is", "an", "descendant", "of", "an", "other", "type" ]
train
https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/annotations/builder/src/main/java/io/sundr/builder/internal/functions/Descendants.java#L152-L159
Azure/azure-sdk-for-java
recoveryservices.backup/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2016_06_01/implementation/ProtectionContainersInner.java
ProtectionContainersInner.unregisterAsync
public Observable<Void> unregisterAsync(String resourceGroupName, String vaultName, String identityName) { return unregisterWithServiceResponseAsync(resourceGroupName, vaultName, identityName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> unregisterAsync(String resourceGroupName, String vaultName, String identityName) { return unregisterWithServiceResponseAsync(resourceGroupName, vaultName, identityName).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "unregisterAsync", "(", "String", "resourceGroupName", ",", "String", "vaultName", ",", "String", "identityName", ")", "{", "return", "unregisterWithServiceResponseAsync", "(", "resourceGroupName", ",", "vaultName", ",", "iden...
Unregisters the given container from your Recovery Services vault. @param resourceGroupName The name of the resource group associated with the Recovery Services vault. @param vaultName The name of the Recovery Services vault. @param identityName Name of the protection container to unregister. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Unregisters", "the", "given", "container", "from", "your", "Recovery", "Services", "vault", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/recoveryservices.backup/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/recoveryservices/backup/v2016_06_01/implementation/ProtectionContainersInner.java#L484-L491
stapler/stapler
core/src/main/java/org/kohsuke/stapler/Stapler.java
Stapler.getViewURL
public static String getViewURL(Class clazz,String jspName) { return "/WEB-INF/side-files/"+clazz.getName().replace('.','/')+'/'+jspName; }
java
public static String getViewURL(Class clazz,String jspName) { return "/WEB-INF/side-files/"+clazz.getName().replace('.','/')+'/'+jspName; }
[ "public", "static", "String", "getViewURL", "(", "Class", "clazz", ",", "String", "jspName", ")", "{", "return", "\"/WEB-INF/side-files/\"", "+", "clazz", ".", "getName", "(", ")", ".", "replace", "(", "'", "'", ",", "'", "'", ")", "+", "'", "'", "+", ...
Gets the URL (e.g., "/WEB-INF/side-files/fully/qualified/class/name/jspName") from a class and the JSP name.
[ "Gets", "the", "URL", "(", "e", ".", "g", ".", "/", "WEB", "-", "INF", "/", "side", "-", "files", "/", "fully", "/", "qualified", "/", "class", "/", "name", "/", "jspName", ")", "from", "a", "class", "and", "the", "JSP", "name", "." ]
train
https://github.com/stapler/stapler/blob/11ad5af185e062fb46e01bf9fbed66f3ebf2a8f7/core/src/main/java/org/kohsuke/stapler/Stapler.java#L927-L929
ibm-bluemix-mobile-services/bms-clientsdk-android-push
lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/push/api/MFPPush.java
MFPPush.initialize
public void initialize(Context context, String appGUID, String pushClientSecret,MFPPushNotificationOptions options) { try { if (MFPPushUtils.validateString(pushClientSecret) && MFPPushUtils.validateString(appGUID)) { // Get the applicationId and backend route from core clientSecret = pushClientSecret; applicationId = appGUID; appContext = context.getApplicationContext(); isInitialized = true; validateAndroidContext(); //Storing the messages url and the client secret. //This is because when the app is not running and notification is dismissed/cleared, //there wont be applicationId and clientSecret details available to //MFPPushNotificationDismissHandler. SharedPreferences sharedPreferences = appContext.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE); MFPPushUtils.storeContentInSharedPreferences(sharedPreferences, MFPPush.PREFS_MESSAGES_URL, buildMessagesURL()); MFPPushUtils.storeContentInSharedPreferences(sharedPreferences, MFPPush.PREFS_MESSAGES_URL_CLIENT_SECRET, clientSecret); MFPPushUtils.storeContentInSharedPreferences(sharedPreferences, PREFS_BMS_REGION, BMSClient.getInstance().getBluemixRegionSuffix()); if (options != null){ setNotificationOptions(context,options); this.regId = options.getDeviceid(); } } else { logger.error("MFPPush:initialize() - An error occured while initializing MFPPush service. Add a valid ClientSecret and push service instance ID Value"); throw new MFPPushException("MFPPush:initialize() - An error occured while initializing MFPPush service. Add a valid ClientSecret and push service instance ID Value", INITIALISATION_ERROR); } } catch (Exception e) { logger.error("MFPPush:initialize() - An error occured while initializing MFPPush service."); throw new RuntimeException(e); } }
java
public void initialize(Context context, String appGUID, String pushClientSecret,MFPPushNotificationOptions options) { try { if (MFPPushUtils.validateString(pushClientSecret) && MFPPushUtils.validateString(appGUID)) { // Get the applicationId and backend route from core clientSecret = pushClientSecret; applicationId = appGUID; appContext = context.getApplicationContext(); isInitialized = true; validateAndroidContext(); //Storing the messages url and the client secret. //This is because when the app is not running and notification is dismissed/cleared, //there wont be applicationId and clientSecret details available to //MFPPushNotificationDismissHandler. SharedPreferences sharedPreferences = appContext.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE); MFPPushUtils.storeContentInSharedPreferences(sharedPreferences, MFPPush.PREFS_MESSAGES_URL, buildMessagesURL()); MFPPushUtils.storeContentInSharedPreferences(sharedPreferences, MFPPush.PREFS_MESSAGES_URL_CLIENT_SECRET, clientSecret); MFPPushUtils.storeContentInSharedPreferences(sharedPreferences, PREFS_BMS_REGION, BMSClient.getInstance().getBluemixRegionSuffix()); if (options != null){ setNotificationOptions(context,options); this.regId = options.getDeviceid(); } } else { logger.error("MFPPush:initialize() - An error occured while initializing MFPPush service. Add a valid ClientSecret and push service instance ID Value"); throw new MFPPushException("MFPPush:initialize() - An error occured while initializing MFPPush service. Add a valid ClientSecret and push service instance ID Value", INITIALISATION_ERROR); } } catch (Exception e) { logger.error("MFPPush:initialize() - An error occured while initializing MFPPush service."); throw new RuntimeException(e); } }
[ "public", "void", "initialize", "(", "Context", "context", ",", "String", "appGUID", ",", "String", "pushClientSecret", ",", "MFPPushNotificationOptions", "options", ")", "{", "try", "{", "if", "(", "MFPPushUtils", ".", "validateString", "(", "pushClientSecret", "...
MFPPush Intitialization method with clientSecret and Push App GUID. <p/> @param context this is the Context of the application from getApplicationContext() @param appGUID The unique ID of the Push service instance that the application must connect to. @param pushClientSecret ClientSecret from the push service. @param options - The MFPPushNotificationOptions with the default parameters
[ "MFPPush", "Intitialization", "method", "with", "clientSecret", "and", "Push", "App", "GUID", ".", "<p", "/", ">" ]
train
https://github.com/ibm-bluemix-mobile-services/bms-clientsdk-android-push/blob/26c048637e81a6942004693919558f3d9aa8c674/lib/src/main/java/com/ibm/mobilefirstplatform/clientsdk/android/push/api/MFPPush.java#L255-L288
looly/hulu
src/main/java/com/xiaoleilu/hulu/ActionFilter.java
ActionFilter.doFilter
@Override public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { //-- 处理请求,如果处理失败(无对应的Action),继续后续步骤 if(false == ActionContext.handle(req, res)) { chain.doFilter(req, res); } }
java
@Override public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { //-- 处理请求,如果处理失败(无对应的Action),继续后续步骤 if(false == ActionContext.handle(req, res)) { chain.doFilter(req, res); } }
[ "@", "Override", "public", "void", "doFilter", "(", "ServletRequest", "req", ",", "ServletResponse", "res", ",", "FilterChain", "chain", ")", "throws", "IOException", ",", "ServletException", "{", "//-- 处理请求,如果处理失败(无对应的Action),继续后续步骤\r", "if", "(", "false", "==", "A...
拦截请求 @param req ServletRequest @param res ServletResponse @param chain FilterChain
[ "拦截请求" ]
train
https://github.com/looly/hulu/blob/4072de684e2e2f28ac8a3a44c0d5a690b289ef28/src/main/java/com/xiaoleilu/hulu/ActionFilter.java#L36-L42
OpenNTF/JavascriptAggregator
jaggr-core/src/main/java/com/ibm/jaggr/core/impl/layer/LayerCacheImpl.java
LayerCacheImpl.setLayerBuildAccessors
private void setLayerBuildAccessors(Set<String> buildKeys) { NavigableSet<String> sorted = new TreeSet<String>(buildKeys); Set<String> evictionKeys = new HashSet<String>(); // list of layer keys to remove because they // have no layer builds in the layerBuildMap for (Map.Entry<String, ILayer> entry : cacheMap.entrySet()) { LayerImpl layer = (LayerImpl)entry.getValue(); LayerBuildsAccessor accessor = new LayerBuildsAccessor(layer.getId(), layerBuildMap, aggregator.getCacheManager(), cloneLock, sorted, this); if (accessor.getCount() > 0) { layer.setLayerBuildsAccessor(accessor); } else { evictionKeys.add(entry.getKey()); } } // Now remove the layers that are missing layer builds in the layerBuildMap for (String key : evictionKeys) { cacheMap.remove(key); } }
java
private void setLayerBuildAccessors(Set<String> buildKeys) { NavigableSet<String> sorted = new TreeSet<String>(buildKeys); Set<String> evictionKeys = new HashSet<String>(); // list of layer keys to remove because they // have no layer builds in the layerBuildMap for (Map.Entry<String, ILayer> entry : cacheMap.entrySet()) { LayerImpl layer = (LayerImpl)entry.getValue(); LayerBuildsAccessor accessor = new LayerBuildsAccessor(layer.getId(), layerBuildMap, aggregator.getCacheManager(), cloneLock, sorted, this); if (accessor.getCount() > 0) { layer.setLayerBuildsAccessor(accessor); } else { evictionKeys.add(entry.getKey()); } } // Now remove the layers that are missing layer builds in the layerBuildMap for (String key : evictionKeys) { cacheMap.remove(key); } }
[ "private", "void", "setLayerBuildAccessors", "(", "Set", "<", "String", ">", "buildKeys", ")", "{", "NavigableSet", "<", "String", ">", "sorted", "=", "new", "TreeSet", "<", "String", ">", "(", "buildKeys", ")", ";", "Set", "<", "String", ">", "evictionKey...
Calls setLayerBuildAccessor for each layer in <code>layerMap</code>. @param buildKeys Set of keys in the build map. This is not necessarily the same as <code>layerBuildMap.keySet()</code> because we may be migrating th builds to a new map in the event that the maximum size has changed.
[ "Calls", "setLayerBuildAccessor", "for", "each", "layer", "in", "<code", ">", "layerMap<", "/", "code", ">", "." ]
train
https://github.com/OpenNTF/JavascriptAggregator/blob/9f47a96d778251638b1df9a368462176216d5b29/jaggr-core/src/main/java/com/ibm/jaggr/core/impl/layer/LayerCacheImpl.java#L255-L272
UrielCh/ovh-java-sdk
ovh-java-sdk-overTheBox/src/main/java/net/minidev/ovh/api/ApiOvhOverTheBox.java
ApiOvhOverTheBox.serviceName_backups_backupId_GET
public OvhBackup serviceName_backups_backupId_GET(String serviceName, String backupId) throws IOException { String qPath = "/overTheBox/{serviceName}/backups/{backupId}"; StringBuilder sb = path(qPath, serviceName, backupId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhBackup.class); }
java
public OvhBackup serviceName_backups_backupId_GET(String serviceName, String backupId) throws IOException { String qPath = "/overTheBox/{serviceName}/backups/{backupId}"; StringBuilder sb = path(qPath, serviceName, backupId); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhBackup.class); }
[ "public", "OvhBackup", "serviceName_backups_backupId_GET", "(", "String", "serviceName", ",", "String", "backupId", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/overTheBox/{serviceName}/backups/{backupId}\"", ";", "StringBuilder", "sb", "=", "path", "(",...
Get this object properties REST: GET /overTheBox/{serviceName}/backups/{backupId} @param serviceName [required] The internal name of your overTheBox offer @param backupId [required] The id of the backup API beta
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-overTheBox/src/main/java/net/minidev/ovh/api/ApiOvhOverTheBox.java#L395-L400
santhosh-tekuri/jlibs
core/src/main/java/jlibs/core/io/IOUtil.java
IOUtil.readFully
public static int readFully(Reader reader, char ch[]) throws IOException { return readFully(reader, ch, 0, ch.length); }
java
public static int readFully(Reader reader, char ch[]) throws IOException { return readFully(reader, ch, 0, ch.length); }
[ "public", "static", "int", "readFully", "(", "Reader", "reader", ",", "char", "ch", "[", "]", ")", "throws", "IOException", "{", "return", "readFully", "(", "reader", ",", "ch", ",", "0", ",", "ch", ".", "length", ")", ";", "}" ]
Reads data from given reader into specified buffer.<br> If the given reader doesn't have number of chars equal to the length of the buffer available, it simply reads only the available number of chars. @param reader reader from which data is read @param ch the buffer into which the data is read. @return the number of chars read. if the reader doen't have enough chars available to fill the buffer, it returns the the number of chars read @throws IOException if an I/O error occurs.
[ "Reads", "data", "from", "given", "reader", "into", "specified", "buffer", ".", "<br", ">", "If", "the", "given", "reader", "doesn", "t", "have", "number", "of", "chars", "equal", "to", "the", "length", "of", "the", "buffer", "available", "it", "simply", ...
train
https://github.com/santhosh-tekuri/jlibs/blob/59c28719f054123cf778278154e1b92e943ad232/core/src/main/java/jlibs/core/io/IOUtil.java#L261-L263
hankcs/HanLP
src/main/java/com/hankcs/hanlp/model/perceptron/PerceptronClassifier.java
PerceptronClassifier.readInstance
private Instance[] readInstance(String corpus, FeatureMap featureMap) { IOUtil.LineIterator lineIterator = new IOUtil.LineIterator(corpus); List<Instance> instanceList = new LinkedList<Instance>(); for (String line : lineIterator) { String[] cells = line.split(","); String text = cells[0], label = cells[1]; List<Integer> x = extractFeature(text, featureMap); int y = featureMap.tagSet.add(label); if (y == 0) y = -1; // 感知机标签约定为±1 else if (y > 1) throw new IllegalArgumentException("类别数大于2,目前只支持二分类。"); instanceList.add(new Instance(x, y)); } return instanceList.toArray(new Instance[0]); }
java
private Instance[] readInstance(String corpus, FeatureMap featureMap) { IOUtil.LineIterator lineIterator = new IOUtil.LineIterator(corpus); List<Instance> instanceList = new LinkedList<Instance>(); for (String line : lineIterator) { String[] cells = line.split(","); String text = cells[0], label = cells[1]; List<Integer> x = extractFeature(text, featureMap); int y = featureMap.tagSet.add(label); if (y == 0) y = -1; // 感知机标签约定为±1 else if (y > 1) throw new IllegalArgumentException("类别数大于2,目前只支持二分类。"); instanceList.add(new Instance(x, y)); } return instanceList.toArray(new Instance[0]); }
[ "private", "Instance", "[", "]", "readInstance", "(", "String", "corpus", ",", "FeatureMap", "featureMap", ")", "{", "IOUtil", ".", "LineIterator", "lineIterator", "=", "new", "IOUtil", ".", "LineIterator", "(", "corpus", ")", ";", "List", "<", "Instance", "...
从语料库读取实例 @param corpus 语料库 @param featureMap 特征映射 @return 数据集
[ "从语料库读取实例" ]
train
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/model/perceptron/PerceptronClassifier.java#L193-L210
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceRegionPersistenceImpl.java
CommerceRegionPersistenceImpl.findByC_C
@Override public CommerceRegion findByC_C(long commerceCountryId, String code) throws NoSuchRegionException { CommerceRegion commerceRegion = fetchByC_C(commerceCountryId, code); if (commerceRegion == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("commerceCountryId="); msg.append(commerceCountryId); msg.append(", code="); msg.append(code); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchRegionException(msg.toString()); } return commerceRegion; }
java
@Override public CommerceRegion findByC_C(long commerceCountryId, String code) throws NoSuchRegionException { CommerceRegion commerceRegion = fetchByC_C(commerceCountryId, code); if (commerceRegion == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("commerceCountryId="); msg.append(commerceCountryId); msg.append(", code="); msg.append(code); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchRegionException(msg.toString()); } return commerceRegion; }
[ "@", "Override", "public", "CommerceRegion", "findByC_C", "(", "long", "commerceCountryId", ",", "String", "code", ")", "throws", "NoSuchRegionException", "{", "CommerceRegion", "commerceRegion", "=", "fetchByC_C", "(", "commerceCountryId", ",", "code", ")", ";", "i...
Returns the commerce region where commerceCountryId = &#63; and code = &#63; or throws a {@link NoSuchRegionException} if it could not be found. @param commerceCountryId the commerce country ID @param code the code @return the matching commerce region @throws NoSuchRegionException if a matching commerce region could not be found
[ "Returns", "the", "commerce", "region", "where", "commerceCountryId", "=", "&#63", ";", "and", "code", "=", "&#63", ";", "or", "throws", "a", "{", "@link", "NoSuchRegionException", "}", "if", "it", "could", "not", "be", "found", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceRegionPersistenceImpl.java#L2023-L2049
Azure/azure-sdk-for-java
appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/WebSiteManagementClientImpl.java
WebSiteManagementClientImpl.checkNameAvailability
public ResourceNameAvailabilityInner checkNameAvailability(String name, CheckNameResourceTypes type) { return checkNameAvailabilityWithServiceResponseAsync(name, type).toBlocking().single().body(); }
java
public ResourceNameAvailabilityInner checkNameAvailability(String name, CheckNameResourceTypes type) { return checkNameAvailabilityWithServiceResponseAsync(name, type).toBlocking().single().body(); }
[ "public", "ResourceNameAvailabilityInner", "checkNameAvailability", "(", "String", "name", ",", "CheckNameResourceTypes", "type", ")", "{", "return", "checkNameAvailabilityWithServiceResponseAsync", "(", "name", ",", "type", ")", ".", "toBlocking", "(", ")", ".", "singl...
Check if a resource name is available. Check if a resource name is available. @param name Resource name to verify. @param type Resource type used for verification. Possible values include: 'Site', 'Slot', 'HostingEnvironment', 'PublishingUser', 'Microsoft.Web/sites', 'Microsoft.Web/sites/slots', 'Microsoft.Web/hostingEnvironments', 'Microsoft.Web/publishingUsers' @throws IllegalArgumentException thrown if parameters fail the validation @throws DefaultErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the ResourceNameAvailabilityInner object if successful.
[ "Check", "if", "a", "resource", "name", "is", "available", ".", "Check", "if", "a", "resource", "name", "is", "available", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/appservice/resource-manager/v2018_02_01/src/main/java/com/microsoft/azure/management/appservice/v2018_02_01/implementation/WebSiteManagementClientImpl.java#L1160-L1162
jayantk/jklol
src/com/jayantkrish/jklol/sequence/SequenceModelUtils.java
SequenceModelUtils.buildSequenceModel
public static ParametricFactorGraph buildSequenceModel(Iterable<String> emissionFeatureLines, String featureDelimiter) { // Read in the possible values of each variable. List<String> words = StringUtils.readColumnFromDelimitedLines(emissionFeatureLines, 0, featureDelimiter); List<String> labels = StringUtils.readColumnFromDelimitedLines(emissionFeatureLines, 1, featureDelimiter); List<String> emissionFeatures = StringUtils.readColumnFromDelimitedLines(emissionFeatureLines, 2, featureDelimiter); // Create dictionaries for each variable's values. DiscreteVariable wordType = new DiscreteVariable("word", words); DiscreteVariable labelType = new DiscreteVariable("label", labels); DiscreteVariable emissionFeatureType = new DiscreteVariable("emissionFeature", emissionFeatures); // Create a dynamic factor graph with a single plate replicating // the input/output variables. ParametricFactorGraphBuilder builder = new ParametricFactorGraphBuilder(); builder.addPlate(PLATE_NAME, new VariableNumMap(Ints.asList(1, 2), Arrays.asList(INPUT_NAME, OUTPUT_NAME), Arrays.asList(wordType, labelType)), 10000); String inputPattern = PLATE_NAME + "/?(0)/" + INPUT_NAME; String outputPattern = PLATE_NAME + "/?(0)/" + OUTPUT_NAME; String nextOutputPattern = PLATE_NAME + "/?(1)/" + OUTPUT_NAME; VariableNumMap plateVars = new VariableNumMap(Ints.asList(1, 2), Arrays.asList(inputPattern, outputPattern), Arrays.asList(wordType, labelType)); // Read in the emission features (for the word/label weights). VariableNumMap x = plateVars.getVariablesByName(inputPattern); VariableNumMap y = plateVars.getVariablesByName(outputPattern); VariableNumMap emissionFeatureVar = VariableNumMap.singleton(0, "emissionFeature", emissionFeatureType); TableFactor emissionFeatureFactor = TableFactor.fromDelimitedFile( Arrays.asList(x, y, emissionFeatureVar), emissionFeatureLines, featureDelimiter, false, SparseTensorBuilder.getFactory()) .cacheWeightPermutations(); System.out.println(emissionFeatureFactor.getVars()); // Add a parametric factor for the word/label weights DiscreteLogLinearFactor emissionFactor = new DiscreteLogLinearFactor(x.union(y), emissionFeatureVar, emissionFeatureFactor); builder.addFactor(WORD_LABEL_FACTOR, emissionFactor, VariableNamePattern.fromTemplateVariables(plateVars, VariableNumMap.EMPTY)); // Create a factor connecting adjacent labels VariableNumMap adjacentVars = new VariableNumMap(Ints.asList(0, 1), Arrays.asList(outputPattern, nextOutputPattern), Arrays.asList(labelType, labelType)); builder.addFactor(TRANSITION_FACTOR, DiscreteLogLinearFactor.createIndicatorFactor(adjacentVars), VariableNamePattern.fromTemplateVariables(adjacentVars, VariableNumMap.EMPTY)); return builder.build(); }
java
public static ParametricFactorGraph buildSequenceModel(Iterable<String> emissionFeatureLines, String featureDelimiter) { // Read in the possible values of each variable. List<String> words = StringUtils.readColumnFromDelimitedLines(emissionFeatureLines, 0, featureDelimiter); List<String> labels = StringUtils.readColumnFromDelimitedLines(emissionFeatureLines, 1, featureDelimiter); List<String> emissionFeatures = StringUtils.readColumnFromDelimitedLines(emissionFeatureLines, 2, featureDelimiter); // Create dictionaries for each variable's values. DiscreteVariable wordType = new DiscreteVariable("word", words); DiscreteVariable labelType = new DiscreteVariable("label", labels); DiscreteVariable emissionFeatureType = new DiscreteVariable("emissionFeature", emissionFeatures); // Create a dynamic factor graph with a single plate replicating // the input/output variables. ParametricFactorGraphBuilder builder = new ParametricFactorGraphBuilder(); builder.addPlate(PLATE_NAME, new VariableNumMap(Ints.asList(1, 2), Arrays.asList(INPUT_NAME, OUTPUT_NAME), Arrays.asList(wordType, labelType)), 10000); String inputPattern = PLATE_NAME + "/?(0)/" + INPUT_NAME; String outputPattern = PLATE_NAME + "/?(0)/" + OUTPUT_NAME; String nextOutputPattern = PLATE_NAME + "/?(1)/" + OUTPUT_NAME; VariableNumMap plateVars = new VariableNumMap(Ints.asList(1, 2), Arrays.asList(inputPattern, outputPattern), Arrays.asList(wordType, labelType)); // Read in the emission features (for the word/label weights). VariableNumMap x = plateVars.getVariablesByName(inputPattern); VariableNumMap y = plateVars.getVariablesByName(outputPattern); VariableNumMap emissionFeatureVar = VariableNumMap.singleton(0, "emissionFeature", emissionFeatureType); TableFactor emissionFeatureFactor = TableFactor.fromDelimitedFile( Arrays.asList(x, y, emissionFeatureVar), emissionFeatureLines, featureDelimiter, false, SparseTensorBuilder.getFactory()) .cacheWeightPermutations(); System.out.println(emissionFeatureFactor.getVars()); // Add a parametric factor for the word/label weights DiscreteLogLinearFactor emissionFactor = new DiscreteLogLinearFactor(x.union(y), emissionFeatureVar, emissionFeatureFactor); builder.addFactor(WORD_LABEL_FACTOR, emissionFactor, VariableNamePattern.fromTemplateVariables(plateVars, VariableNumMap.EMPTY)); // Create a factor connecting adjacent labels VariableNumMap adjacentVars = new VariableNumMap(Ints.asList(0, 1), Arrays.asList(outputPattern, nextOutputPattern), Arrays.asList(labelType, labelType)); builder.addFactor(TRANSITION_FACTOR, DiscreteLogLinearFactor.createIndicatorFactor(adjacentVars), VariableNamePattern.fromTemplateVariables(adjacentVars, VariableNumMap.EMPTY)); return builder.build(); }
[ "public", "static", "ParametricFactorGraph", "buildSequenceModel", "(", "Iterable", "<", "String", ">", "emissionFeatureLines", ",", "String", "featureDelimiter", ")", "{", "// Read in the possible values of each variable.", "List", "<", "String", ">", "words", "=", "Stri...
Constructs a sequence model from the lines of a file containing features of the emission distribution. @param emissionFeatureLines @param featureDelimiter @return
[ "Constructs", "a", "sequence", "model", "from", "the", "lines", "of", "a", "file", "containing", "features", "of", "the", "emission", "distribution", "." ]
train
https://github.com/jayantk/jklol/blob/d27532ca83e212d51066cf28f52621acc3fd44cc/src/com/jayantkrish/jklol/sequence/SequenceModelUtils.java#L40-L86
Pkmmte/CircularImageView
circularimageview/src/main/java/com/pkmmte/view/CircularImageView.java
CircularImageView.setShadow
public void setShadow(float radius, float dx, float dy, int color) { shadowRadius = radius; shadowDx = dx; shadowDy = dy; shadowColor = color; updateShadow(); }
java
public void setShadow(float radius, float dx, float dy, int color) { shadowRadius = radius; shadowDx = dx; shadowDy = dy; shadowColor = color; updateShadow(); }
[ "public", "void", "setShadow", "(", "float", "radius", ",", "float", "dx", ",", "float", "dy", ",", "int", "color", ")", "{", "shadowRadius", "=", "radius", ";", "shadowDx", "=", "dx", ";", "shadowDy", "=", "dy", ";", "shadowColor", "=", "color", ";", ...
Enables a dark shadow for this CircularImageView. If the radius is set to 0, the shadow is removed. @param radius Radius for the shadow to extend to. @param dx Horizontal shadow offset. @param dy Vertical shadow offset. @param color The color of the shadow to apply.
[ "Enables", "a", "dark", "shadow", "for", "this", "CircularImageView", ".", "If", "the", "radius", "is", "set", "to", "0", "the", "shadow", "is", "removed", "." ]
train
https://github.com/Pkmmte/CircularImageView/blob/aca59f32d9267c943eb6c930bdaed59c417a4d16/circularimageview/src/main/java/com/pkmmte/view/CircularImageView.java#L210-L216
Microsoft/azure-maven-plugins
azure-maven-plugin-lib/src/main/java/com/microsoft/azure/maven/Utils.java
Utils.getValueFromServerConfiguration
public static String getValueFromServerConfiguration(final Server server, final String key) { if (server == null) { return null; } final Xpp3Dom configuration = (Xpp3Dom) server.getConfiguration(); if (configuration == null) { return null; } final Xpp3Dom node = configuration.getChild(key); if (node == null) { return null; } return node.getValue(); }
java
public static String getValueFromServerConfiguration(final Server server, final String key) { if (server == null) { return null; } final Xpp3Dom configuration = (Xpp3Dom) server.getConfiguration(); if (configuration == null) { return null; } final Xpp3Dom node = configuration.getChild(key); if (node == null) { return null; } return node.getValue(); }
[ "public", "static", "String", "getValueFromServerConfiguration", "(", "final", "Server", "server", ",", "final", "String", "key", ")", "{", "if", "(", "server", "==", "null", ")", "{", "return", "null", ";", "}", "final", "Xpp3Dom", "configuration", "=", "("...
Get string value from server configuration section in settings.xml. @param server Server object. @param key Key string. @return String value if key exists; otherwise, return null.
[ "Get", "string", "value", "from", "server", "configuration", "section", "in", "settings", ".", "xml", "." ]
train
https://github.com/Microsoft/azure-maven-plugins/blob/a254902e820185df1823b1d692c7c1d119490b1e/azure-maven-plugin-lib/src/main/java/com/microsoft/azure/maven/Utils.java#L67-L83
EdwardRaff/JSAT
JSAT/src/jsat/classifiers/svm/DCDs.java
DCDs.setEps
public void setEps(double eps) { if(Double.isNaN(eps) || eps < 0 || Double.isInfinite(eps)) throw new IllegalArgumentException("eps must be non-negative, not "+eps); this.eps = eps; }
java
public void setEps(double eps) { if(Double.isNaN(eps) || eps < 0 || Double.isInfinite(eps)) throw new IllegalArgumentException("eps must be non-negative, not "+eps); this.eps = eps; }
[ "public", "void", "setEps", "(", "double", "eps", ")", "{", "if", "(", "Double", ".", "isNaN", "(", "eps", ")", "||", "eps", "<", "0", "||", "Double", ".", "isInfinite", "(", "eps", ")", ")", "throw", "new", "IllegalArgumentException", "(", "\"eps must...
Sets the {@code eps} used in the epsilon insensitive loss function used when performing regression. Errors in the output that less than {@code eps} during training are treated as correct. <br> This parameter has no impact on classification problems. @param eps the non-negative value to use as the error tolerance in regression
[ "Sets", "the", "{", "@code", "eps", "}", "used", "in", "the", "epsilon", "insensitive", "loss", "function", "used", "when", "performing", "regression", ".", "Errors", "in", "the", "output", "that", "less", "than", "{", "@code", "eps", "}", "during", "train...
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/classifiers/svm/DCDs.java#L139-L144
aws/aws-sdk-java
aws-java-sdk-stepfunctions/src/main/java/com/amazonaws/services/stepfunctions/builder/StepFunctionBuilder.java
StepFunctionBuilder.gt
public static StringGreaterThanCondition.Builder gt(String variable, String expectedValue) { return StringGreaterThanCondition.builder().variable(variable).expectedValue(expectedValue); }
java
public static StringGreaterThanCondition.Builder gt(String variable, String expectedValue) { return StringGreaterThanCondition.builder().variable(variable).expectedValue(expectedValue); }
[ "public", "static", "StringGreaterThanCondition", ".", "Builder", "gt", "(", "String", "variable", ",", "String", "expectedValue", ")", "{", "return", "StringGreaterThanCondition", ".", "builder", "(", ")", ".", "variable", "(", "variable", ")", ".", "expectedValu...
Binary condition for String greater than comparison. @param variable The JSONPath expression that determines which piece of the input document is used for the comparison. @param expectedValue The expected value for this condition. @see <a href="https://states-language.net/spec.html#choice-state">https://states-language.net/spec.html#choice-state</a> @see com.amazonaws.services.stepfunctions.builder.states.Choice
[ "Binary", "condition", "for", "String", "greater", "than", "comparison", "." ]
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-stepfunctions/src/main/java/com/amazonaws/services/stepfunctions/builder/StepFunctionBuilder.java#L272-L274
ykrasik/jaci
jaci-utils/src/main/java/com/github/ykrasik/jaci/util/string/StringUtils.java
StringUtils.removeLeadingAndTrailingDelimiter
public static String removeLeadingAndTrailingDelimiter(String str, String delimiter) { final int strLength = str.length(); final int delimiterLength = delimiter.length(); final boolean leadingDelimiter = str.startsWith(delimiter); final boolean trailingDelimiter = strLength > delimiterLength && str.endsWith(delimiter); if (!leadingDelimiter && !trailingDelimiter) { return str; } else { final int startingDelimiterIndex = leadingDelimiter ? delimiterLength : 0; final int endingDelimiterIndex = trailingDelimiter ? Math.max(strLength - delimiterLength, startingDelimiterIndex) : strLength; return str.substring(startingDelimiterIndex, endingDelimiterIndex); } }
java
public static String removeLeadingAndTrailingDelimiter(String str, String delimiter) { final int strLength = str.length(); final int delimiterLength = delimiter.length(); final boolean leadingDelimiter = str.startsWith(delimiter); final boolean trailingDelimiter = strLength > delimiterLength && str.endsWith(delimiter); if (!leadingDelimiter && !trailingDelimiter) { return str; } else { final int startingDelimiterIndex = leadingDelimiter ? delimiterLength : 0; final int endingDelimiterIndex = trailingDelimiter ? Math.max(strLength - delimiterLength, startingDelimiterIndex) : strLength; return str.substring(startingDelimiterIndex, endingDelimiterIndex); } }
[ "public", "static", "String", "removeLeadingAndTrailingDelimiter", "(", "String", "str", ",", "String", "delimiter", ")", "{", "final", "int", "strLength", "=", "str", ".", "length", "(", ")", ";", "final", "int", "delimiterLength", "=", "delimiter", ".", "len...
Removes the leading and trailing delimiter from a string. @param str String to process. @param delimiter Delimiter to remove. @return The string with the leading and trailing delimiter removed.
[ "Removes", "the", "leading", "and", "trailing", "delimiter", "from", "a", "string", "." ]
train
https://github.com/ykrasik/jaci/blob/4615edef7c76288ad5ea8d678132b161645ca1e3/jaci-utils/src/main/java/com/github/ykrasik/jaci/util/string/StringUtils.java#L38-L51
Sciss/abc4j
abc/src/main/java/abc/parser/AbcGrammar.java
AbcGrammar.ParenVoice
Rule ParenVoice() { return Sequence('(', SingleVoice(), OneOrMore(Sequence(OneOrMore(WSP()), SingleVoice()))) .label(ParenVoice); }
java
Rule ParenVoice() { return Sequence('(', SingleVoice(), OneOrMore(Sequence(OneOrMore(WSP()), SingleVoice()))) .label(ParenVoice); }
[ "Rule", "ParenVoice", "(", ")", "{", "return", "Sequence", "(", "'", "'", ",", "SingleVoice", "(", ")", ",", "OneOrMore", "(", "Sequence", "(", "OneOrMore", "(", "WSP", "(", ")", ")", ",", "SingleVoice", "(", ")", ")", ")", ")", ".", "label", "(", ...
paren-voice ::= "(" single-voice 1*( 1*WSP single-voice) ")" <p> on same staff
[ "paren", "-", "voice", "::", "=", "(", "single", "-", "voice", "1", "*", "(", "1", "*", "WSP", "single", "-", "voice", ")", ")", "<p", ">", "on", "same", "staff" ]
train
https://github.com/Sciss/abc4j/blob/117b405642c84a7bfca4e3e13668838258b90ca7/abc/src/main/java/abc/parser/AbcGrammar.java#L2142-L2146
irmen/Pyrolite
java/src/main/java/net/razorvine/pickle/Pickler.java
Pickler.lookupMemo
private boolean lookupMemo(Class<?> objectType, Object obj) throws IOException { if(!this.useMemo) return false; if(!objectType.isPrimitive()) { int hash = valueCompare ? obj.hashCode() : System.identityHashCode(obj); if(memo.containsKey(hash) && (valueCompare ? memo.get(hash).obj.equals(obj) : memo.get(hash).obj == obj)) { // same object or value int memo_index = memo.get(hash).index; if(memo_index <= 0xff) { out.write(Opcodes.BINGET); out.write((byte) memo_index); } else { out.write(Opcodes.LONG_BINGET); byte[] index_bytes = PickleUtils.integer_to_bytes(memo_index); out.write(index_bytes, 0, 4); } return true; } } return false; }
java
private boolean lookupMemo(Class<?> objectType, Object obj) throws IOException { if(!this.useMemo) return false; if(!objectType.isPrimitive()) { int hash = valueCompare ? obj.hashCode() : System.identityHashCode(obj); if(memo.containsKey(hash) && (valueCompare ? memo.get(hash).obj.equals(obj) : memo.get(hash).obj == obj)) { // same object or value int memo_index = memo.get(hash).index; if(memo_index <= 0xff) { out.write(Opcodes.BINGET); out.write((byte) memo_index); } else { out.write(Opcodes.LONG_BINGET); byte[] index_bytes = PickleUtils.integer_to_bytes(memo_index); out.write(index_bytes, 0, 4); } return true; } } return false; }
[ "private", "boolean", "lookupMemo", "(", "Class", "<", "?", ">", "objectType", ",", "Object", "obj", ")", "throws", "IOException", "{", "if", "(", "!", "this", ".", "useMemo", ")", "return", "false", ";", "if", "(", "!", "objectType", ".", "isPrimitive",...
Check the memo table and output a memo lookup if the object is found
[ "Check", "the", "memo", "table", "and", "output", "a", "memo", "lookup", "if", "the", "object", "is", "found" ]
train
https://github.com/irmen/Pyrolite/blob/060bc3c9069cd31560b6da4f67280736fb2cdf63/java/src/main/java/net/razorvine/pickle/Pickler.java#L231-L250
Azure/azure-sdk-for-java
compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java
VirtualMachinesInner.listAvailableSizes
public List<VirtualMachineSizeInner> listAvailableSizes(String resourceGroupName, String vmName) { return listAvailableSizesWithServiceResponseAsync(resourceGroupName, vmName).toBlocking().single().body(); }
java
public List<VirtualMachineSizeInner> listAvailableSizes(String resourceGroupName, String vmName) { return listAvailableSizesWithServiceResponseAsync(resourceGroupName, vmName).toBlocking().single().body(); }
[ "public", "List", "<", "VirtualMachineSizeInner", ">", "listAvailableSizes", "(", "String", "resourceGroupName", ",", "String", "vmName", ")", "{", "return", "listAvailableSizesWithServiceResponseAsync", "(", "resourceGroupName", ",", "vmName", ")", ".", "toBlocking", "...
Lists all available virtual machine sizes to which the specified virtual machine can be resized. @param resourceGroupName The name of the resource group. @param vmName The name of the virtual machine. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the List&lt;VirtualMachineSizeInner&gt; object if successful.
[ "Lists", "all", "available", "virtual", "machine", "sizes", "to", "which", "the", "specified", "virtual", "machine", "can", "be", "resized", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/compute/resource-manager/v2017_03_30/src/main/java/com/microsoft/azure/management/compute/v2017_03_30/implementation/VirtualMachinesInner.java#L1754-L1756
google/closure-templates
java/src/com/google/template/soy/data/SanitizedContents.java
SanitizedContents.constantTrustedResourceUri
public static SanitizedContent constantTrustedResourceUri( @CompileTimeConstant final String constant) { return fromConstant(constant, ContentKind.TRUSTED_RESOURCE_URI, Dir.LTR); }
java
public static SanitizedContent constantTrustedResourceUri( @CompileTimeConstant final String constant) { return fromConstant(constant, ContentKind.TRUSTED_RESOURCE_URI, Dir.LTR); }
[ "public", "static", "SanitizedContent", "constantTrustedResourceUri", "(", "@", "CompileTimeConstant", "final", "String", "constant", ")", "{", "return", "fromConstant", "(", "constant", ",", "ContentKind", ".", "TRUSTED_RESOURCE_URI", ",", "Dir", ".", "LTR", ")", "...
Wraps an assumed-safe trusted_resource_uri constant. <p>This only accepts compile-time constants, based on the assumption that trusted resource URIs that are controlled by the application (and not user input) are considered safe.
[ "Wraps", "an", "assumed", "-", "safe", "trusted_resource_uri", "constant", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/data/SanitizedContents.java#L238-L241
looly/hutool
hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/AbstractAsymmetricCrypto.java
AbstractAsymmetricCrypto.encrypt
public byte[] encrypt(String data, String charset, KeyType keyType) { return encrypt(StrUtil.bytes(data, charset), keyType); }
java
public byte[] encrypt(String data, String charset, KeyType keyType) { return encrypt(StrUtil.bytes(data, charset), keyType); }
[ "public", "byte", "[", "]", "encrypt", "(", "String", "data", ",", "String", "charset", ",", "KeyType", "keyType", ")", "{", "return", "encrypt", "(", "StrUtil", ".", "bytes", "(", "data", ",", "charset", ")", ",", "keyType", ")", ";", "}" ]
加密 @param data 被加密的字符串 @param charset 编码 @param keyType 私钥或公钥 {@link KeyType} @return 加密后的bytes
[ "加密" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-crypto/src/main/java/cn/hutool/crypto/asymmetric/AbstractAsymmetricCrypto.java#L77-L79