repository_name
stringlengths
7
54
func_path_in_repository
stringlengths
18
196
func_name
stringlengths
7
107
whole_func_string
stringlengths
76
3.82k
language
stringclasses
1 value
func_code_string
stringlengths
76
3.82k
func_code_tokens
listlengths
22
717
func_documentation_string
stringlengths
61
1.98k
func_documentation_tokens
listlengths
1
508
split_name
stringclasses
1 value
func_code_url
stringlengths
111
310
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Collator.java
Collator.registerInstance
public static final Object registerInstance(Collator collator, ULocale locale) { return getShim().registerInstance(collator, locale); }
java
public static final Object registerInstance(Collator collator, ULocale locale) { return getShim().registerInstance(collator, locale); }
[ "public", "static", "final", "Object", "registerInstance", "(", "Collator", "collator", ",", "ULocale", "locale", ")", "{", "return", "getShim", "(", ")", ".", "registerInstance", "(", "collator", ",", "locale", ")", ";", "}" ]
<strong>[icu]</strong> Registers a collator as the default collator for the provided locale. The collator should not be modified after it is registered. <p>Because ICU may choose to cache Collator objects internally, this must be called at application startup, prior to any calls to Collator.getInstance to avoid undefined behavior. @param collator the collator to register @param locale the locale for which this is the default collator @return an object that can be used to unregister the registered collator. @hide unsupported on Android
[ "<strong", ">", "[", "icu", "]", "<", "/", "strong", ">", "Registers", "a", "collator", "as", "the", "default", "collator", "for", "the", "provided", "locale", ".", "The", "collator", "should", "not", "be", "modified", "after", "it", "is", "registered", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Collator.java#L843-L845
javalite/activeweb
activeweb/src/main/java/org/javalite/activeweb/HttpSupport.java
HttpSupport.sendPermanentCookie
public void sendPermanentCookie(String name, String value) { Cookie cookie = new Cookie(name, value); cookie.setMaxAge(60*60*24*365*20); RequestContext.getHttpResponse().addCookie(Cookie.toServletCookie(cookie)); }
java
public void sendPermanentCookie(String name, String value) { Cookie cookie = new Cookie(name, value); cookie.setMaxAge(60*60*24*365*20); RequestContext.getHttpResponse().addCookie(Cookie.toServletCookie(cookie)); }
[ "public", "void", "sendPermanentCookie", "(", "String", "name", ",", "String", "value", ")", "{", "Cookie", "cookie", "=", "new", "Cookie", "(", "name", ",", "value", ")", ";", "cookie", ".", "setMaxAge", "(", "60", "*", "60", "*", "24", "*", "365", ...
Sends long to live cookie to browse with response. This cookie will be asked to live for 20 years. @param name name of cookie @param value value of cookie.
[ "Sends", "long", "to", "live", "cookie", "to", "browse", "with", "response", ".", "This", "cookie", "will", "be", "asked", "to", "live", "for", "20", "years", "." ]
train
https://github.com/javalite/activeweb/blob/f25f589da94852b6f5625182360732e0861794a6/activeweb/src/main/java/org/javalite/activeweb/HttpSupport.java#L1330-L1334
liferay/com-liferay-commerce
commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceWarehouseItemPersistenceImpl.java
CommerceWarehouseItemPersistenceImpl.countByCWI_CPIU
@Override public int countByCWI_CPIU(long commerceWarehouseId, String CPInstanceUuid) { FinderPath finderPath = FINDER_PATH_COUNT_BY_CWI_CPIU; Object[] finderArgs = new Object[] { commerceWarehouseId, CPInstanceUuid }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(3); query.append(_SQL_COUNT_COMMERCEWAREHOUSEITEM_WHERE); query.append(_FINDER_COLUMN_CWI_CPIU_COMMERCEWAREHOUSEID_2); boolean bindCPInstanceUuid = false; if (CPInstanceUuid == null) { query.append(_FINDER_COLUMN_CWI_CPIU_CPINSTANCEUUID_1); } else if (CPInstanceUuid.equals("")) { query.append(_FINDER_COLUMN_CWI_CPIU_CPINSTANCEUUID_3); } else { bindCPInstanceUuid = true; query.append(_FINDER_COLUMN_CWI_CPIU_CPINSTANCEUUID_2); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(commerceWarehouseId); if (bindCPInstanceUuid) { qPos.add(CPInstanceUuid); } count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
java
@Override public int countByCWI_CPIU(long commerceWarehouseId, String CPInstanceUuid) { FinderPath finderPath = FINDER_PATH_COUNT_BY_CWI_CPIU; Object[] finderArgs = new Object[] { commerceWarehouseId, CPInstanceUuid }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(3); query.append(_SQL_COUNT_COMMERCEWAREHOUSEITEM_WHERE); query.append(_FINDER_COLUMN_CWI_CPIU_COMMERCEWAREHOUSEID_2); boolean bindCPInstanceUuid = false; if (CPInstanceUuid == null) { query.append(_FINDER_COLUMN_CWI_CPIU_CPINSTANCEUUID_1); } else if (CPInstanceUuid.equals("")) { query.append(_FINDER_COLUMN_CWI_CPIU_CPINSTANCEUUID_3); } else { bindCPInstanceUuid = true; query.append(_FINDER_COLUMN_CWI_CPIU_CPINSTANCEUUID_2); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(commerceWarehouseId); if (bindCPInstanceUuid) { qPos.add(CPInstanceUuid); } count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); }
[ "@", "Override", "public", "int", "countByCWI_CPIU", "(", "long", "commerceWarehouseId", ",", "String", "CPInstanceUuid", ")", "{", "FinderPath", "finderPath", "=", "FINDER_PATH_COUNT_BY_CWI_CPIU", ";", "Object", "[", "]", "finderArgs", "=", "new", "Object", "[", ...
Returns the number of commerce warehouse items where commerceWarehouseId = &#63; and CPInstanceUuid = &#63;. @param commerceWarehouseId the commerce warehouse ID @param CPInstanceUuid the cp instance uuid @return the number of matching commerce warehouse items
[ "Returns", "the", "number", "of", "commerce", "warehouse", "items", "where", "commerceWarehouseId", "=", "&#63", ";", "and", "CPInstanceUuid", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-service/src/main/java/com/liferay/commerce/service/persistence/impl/CommerceWarehouseItemPersistenceImpl.java#L807-L868
looly/hutool
hutool-core/src/main/java/cn/hutool/core/swing/ScreenUtil.java
ScreenUtil.captureScreen
public static File captureScreen(Rectangle screenRect, File outFile) { return RobotUtil.captureScreen(screenRect, outFile); }
java
public static File captureScreen(Rectangle screenRect, File outFile) { return RobotUtil.captureScreen(screenRect, outFile); }
[ "public", "static", "File", "captureScreen", "(", "Rectangle", "screenRect", ",", "File", "outFile", ")", "{", "return", "RobotUtil", ".", "captureScreen", "(", "screenRect", ",", "outFile", ")", ";", "}" ]
截屏 @param screenRect 截屏的矩形区域 @param outFile 写出到的文件 @return 写出到的文件 @see RobotUtil#captureScreen(Rectangle, File)
[ "截屏" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/swing/ScreenUtil.java#L85-L87
motown-io/motown
operator-api/view-model/src/main/java/io/motown/operatorapi/viewmodel/TransactionEventListener.java
TransactionEventListener.addMeterValuesToTransaction
private void addMeterValuesToTransaction(final Transaction transaction, final List<MeterValue> meterValues) { for (MeterValue meterValue : meterValues) { addMeterValueToTransaction(transaction, meterValue); } }
java
private void addMeterValuesToTransaction(final Transaction transaction, final List<MeterValue> meterValues) { for (MeterValue meterValue : meterValues) { addMeterValueToTransaction(transaction, meterValue); } }
[ "private", "void", "addMeterValuesToTransaction", "(", "final", "Transaction", "transaction", ",", "final", "List", "<", "MeterValue", ">", "meterValues", ")", "{", "for", "(", "MeterValue", "meterValue", ":", "meterValues", ")", "{", "addMeterValueToTransaction", "...
Adds the {@code List} of {@code MeterValue}s to the {@code Transaction}. @param transaction the {@code Transaction} to which to add the {@code MeterValue}s. @param meterValues the {@code List} of {@code MeterValue}s to add.
[ "Adds", "the", "{", "@code", "List", "}", "of", "{", "@code", "MeterValue", "}", "s", "to", "the", "{", "@code", "Transaction", "}", "." ]
train
https://github.com/motown-io/motown/blob/783ccda7c28b273a529ddd47defe8673b1ea365b/operator-api/view-model/src/main/java/io/motown/operatorapi/viewmodel/TransactionEventListener.java#L87-L91
js-lib-com/commons
src/main/java/js/util/TextTemplate.java
TextTemplate.put
public void put(String name, Object value) { Params.notNullOrEmpty(name, "Variable name"); Params.notNull(value, "Variable %s value", name); variables.put(name, ConverterRegistry.getConverter().asString(value)); }
java
public void put(String name, Object value) { Params.notNullOrEmpty(name, "Variable name"); Params.notNull(value, "Variable %s value", name); variables.put(name, ConverterRegistry.getConverter().asString(value)); }
[ "public", "void", "put", "(", "String", "name", ",", "Object", "value", ")", "{", "Params", ".", "notNullOrEmpty", "(", "name", ",", "\"Variable name\"", ")", ";", "Params", ".", "notNull", "(", "value", ",", "\"Variable %s value\"", ",", "name", ")", ";",...
Set variables value. If variable name already exists its value is overridden. Convert variable value to string before storing to variables map. Null is not accepted for either variable name or its value. <p> This method uses {@link Converter} to convert variable value to string. If there is no converter able to handle given variable value type this method rise exception. @param name variable name, @param value variable value. @throws IllegalArgumentException if variable name is null or empty or value is null. @throws ConverterException if there is no converter able to handle given value type.
[ "Set", "variables", "value", ".", "If", "variable", "name", "already", "exists", "its", "value", "is", "overridden", ".", "Convert", "variable", "value", "to", "string", "before", "storing", "to", "variables", "map", ".", "Null", "is", "not", "accepted", "fo...
train
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/util/TextTemplate.java#L65-L69
facebookarchive/hadoop-20
src/hdfs/org/apache/hadoop/hdfs/qjournal/server/JNStorage.java
JNStorage.findFinalizedEditsFile
File findFinalizedEditsFile(long startTxId, long endTxId) throws IOException { File ret = new File(sd.getCurrentDir(), NNStorage.getFinalizedEditsFileName(startTxId, endTxId)); if (!ret.exists()) { throw new IOException( "No edits file for range " + startTxId + "-" + endTxId); } return ret; }
java
File findFinalizedEditsFile(long startTxId, long endTxId) throws IOException { File ret = new File(sd.getCurrentDir(), NNStorage.getFinalizedEditsFileName(startTxId, endTxId)); if (!ret.exists()) { throw new IOException( "No edits file for range " + startTxId + "-" + endTxId); } return ret; }
[ "File", "findFinalizedEditsFile", "(", "long", "startTxId", ",", "long", "endTxId", ")", "throws", "IOException", "{", "File", "ret", "=", "new", "File", "(", "sd", ".", "getCurrentDir", "(", ")", ",", "NNStorage", ".", "getFinalizedEditsFileName", "(", "start...
Find an edits file spanning the given transaction ID range. If no such file exists, an exception is thrown.
[ "Find", "an", "edits", "file", "spanning", "the", "given", "transaction", "ID", "range", ".", "If", "no", "such", "file", "exists", "an", "exception", "is", "thrown", "." ]
train
https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/qjournal/server/JNStorage.java#L101-L109
xm-online/xm-commons
xm-commons-migration-db/src/main/java/com/icthh/xm/commons/migration/db/util/DatabaseUtil.java
DatabaseUtil.createSchema
public static void createSchema(DataSource dataSource, String name) { try (Connection connection = dataSource.getConnection(); Statement statement = connection.createStatement()) { statement.executeUpdate(String.format(Constants.DDL_CREATE_SCHEMA, name)); } catch (SQLException e) { throw new RuntimeException("Can not connect to database", e); } }
java
public static void createSchema(DataSource dataSource, String name) { try (Connection connection = dataSource.getConnection(); Statement statement = connection.createStatement()) { statement.executeUpdate(String.format(Constants.DDL_CREATE_SCHEMA, name)); } catch (SQLException e) { throw new RuntimeException("Can not connect to database", e); } }
[ "public", "static", "void", "createSchema", "(", "DataSource", "dataSource", ",", "String", "name", ")", "{", "try", "(", "Connection", "connection", "=", "dataSource", ".", "getConnection", "(", ")", ";", "Statement", "statement", "=", "connection", ".", "cre...
Creates new database scheme. @param dataSource the datasource @param name schema name
[ "Creates", "new", "database", "scheme", "." ]
train
https://github.com/xm-online/xm-commons/blob/43eb2273adb96f40830d7b905ee3a767b8715caf/xm-commons-migration-db/src/main/java/com/icthh/xm/commons/migration/db/util/DatabaseUtil.java#L25-L32
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsBytesMessageImpl.java
JmsBytesMessageImpl.recordInteger
private void recordInteger(int offset, int length) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "recordInteger", new Object[] { offset, length }); // If the current arrays are full, save them in the vector and allocate some new ones if (integer_count == ARRAY_SIZE) { if (integers == null) integers = new Vector(); integers.addElement(integer_offsets); integers.addElement(integer_sizes); integer_offsets = new int[ARRAY_SIZE]; integer_sizes = new int[ARRAY_SIZE]; integer_count = 0; } // Add the offset and size of the current numeric item to the arrays integer_offsets[integer_count] = offset; integer_sizes[integer_count++] = length; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "recordInteger"); }
java
private void recordInteger(int offset, int length) { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "recordInteger", new Object[] { offset, length }); // If the current arrays are full, save them in the vector and allocate some new ones if (integer_count == ARRAY_SIZE) { if (integers == null) integers = new Vector(); integers.addElement(integer_offsets); integers.addElement(integer_sizes); integer_offsets = new int[ARRAY_SIZE]; integer_sizes = new int[ARRAY_SIZE]; integer_count = 0; } // Add the offset and size of the current numeric item to the arrays integer_offsets[integer_count] = offset; integer_sizes[integer_count++] = length; if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "recordInteger"); }
[ "private", "void", "recordInteger", "(", "int", "offset", ",", "int", "length", ")", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ".", "entry", "(", "this", ",", "tc", ...
Records the presence of an integer-style item in the bytes message stream. This method is called by the writeXXX methods to keep a track of where the integer items are, so they can be byteswapped if necessary at send time. NB. The arrays and vector maintained by this method are read directly by the _exportBody() method, so these two method implementations need to be kept in step @param offset int offset of start of numeric item @param length int length of the item (2,4,8 bytes)
[ "Records", "the", "presence", "of", "an", "integer", "-", "style", "item", "in", "the", "bytes", "message", "stream", ".", "This", "method", "is", "called", "by", "the", "writeXXX", "methods", "to", "keep", "a", "track", "of", "where", "the", "integer", ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.jms.2.0/src/com/ibm/ws/sib/api/jms/impl/JmsBytesMessageImpl.java#L2226-L2247
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/db/BaseTable.java
BaseTable.getDataRecord
public DataRecord getDataRecord(boolean bCacheData, int iFieldsTypes) { if ((this.getCurrentTable().getRecord().getEditMode() != Constants.EDIT_IN_PROGRESS) && (this.getCurrentTable().getRecord().getEditMode() != Constants.EDIT_CURRENT)) return null; DataRecord dataRecord = new DataRecord(null); try { dataRecord.setHandle(this.getHandle(DBConstants.BOOKMARK_HANDLE), DBConstants.BOOKMARK_HANDLE); dataRecord.setHandle(this.getHandle(DBConstants.DATA_SOURCE_HANDLE), DBConstants.DATA_SOURCE_HANDLE); dataRecord.setHandle(this.getHandle(DBConstants.OBJECT_ID_HANDLE), DBConstants.OBJECT_ID_HANDLE); dataRecord.setHandle(this.getHandle(DBConstants.OBJECT_SOURCE_HANDLE), DBConstants.OBJECT_SOURCE_HANDLE); } catch (DBException ex) { dataRecord.free(); dataRecord = null; } if (dataRecord != null) if (bCacheData) { BaseBuffer buffer = new VectorBuffer(null, iFieldsTypes); buffer.fieldsToBuffer(this.getCurrentTable().getRecord(), iFieldsTypes); dataRecord.setBuffer(buffer); } return dataRecord; }
java
public DataRecord getDataRecord(boolean bCacheData, int iFieldsTypes) { if ((this.getCurrentTable().getRecord().getEditMode() != Constants.EDIT_IN_PROGRESS) && (this.getCurrentTable().getRecord().getEditMode() != Constants.EDIT_CURRENT)) return null; DataRecord dataRecord = new DataRecord(null); try { dataRecord.setHandle(this.getHandle(DBConstants.BOOKMARK_HANDLE), DBConstants.BOOKMARK_HANDLE); dataRecord.setHandle(this.getHandle(DBConstants.DATA_SOURCE_HANDLE), DBConstants.DATA_SOURCE_HANDLE); dataRecord.setHandle(this.getHandle(DBConstants.OBJECT_ID_HANDLE), DBConstants.OBJECT_ID_HANDLE); dataRecord.setHandle(this.getHandle(DBConstants.OBJECT_SOURCE_HANDLE), DBConstants.OBJECT_SOURCE_HANDLE); } catch (DBException ex) { dataRecord.free(); dataRecord = null; } if (dataRecord != null) if (bCacheData) { BaseBuffer buffer = new VectorBuffer(null, iFieldsTypes); buffer.fieldsToBuffer(this.getCurrentTable().getRecord(), iFieldsTypes); dataRecord.setBuffer(buffer); } return dataRecord; }
[ "public", "DataRecord", "getDataRecord", "(", "boolean", "bCacheData", ",", "int", "iFieldsTypes", ")", "{", "if", "(", "(", "this", ".", "getCurrentTable", "(", ")", ".", "getRecord", "(", ")", ".", "getEditMode", "(", ")", "!=", "Constants", ".", "EDIT_I...
Create a representation of the current record and optionally cache all the data fields. <p>Use the setDataRecord call to make this record current again @param bCacheData boolean Cache the data? @param iFieldTypes The types of fields to cache (see BaseBuffer). @return DataRecord The information needed to recreate this record.
[ "Create", "a", "representation", "of", "the", "current", "record", "and", "optionally", "cache", "all", "the", "data", "fields", ".", "<p", ">", "Use", "the", "setDataRecord", "call", "to", "make", "this", "record", "current", "again" ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/db/BaseTable.java#L353-L375
mgormley/pacaya
src/main/java/edu/jhu/pacaya/parse/dep/EdgeScores.java
EdgeScores.childContains
public static boolean childContains(double[][] child, double value, double delta) { for (int i=0; i<child.length; i++) { for (int j=0; j<child.length; j++) { if (i == j) { continue; } if (Primitives.equals(child[i][j], value, delta)) { return true; } } } return false; }
java
public static boolean childContains(double[][] child, double value, double delta) { for (int i=0; i<child.length; i++) { for (int j=0; j<child.length; j++) { if (i == j) { continue; } if (Primitives.equals(child[i][j], value, delta)) { return true; } } } return false; }
[ "public", "static", "boolean", "childContains", "(", "double", "[", "]", "[", "]", "child", ",", "double", "value", ",", "double", "delta", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "child", ".", "length", ";", "i", "++", ")", "{...
Safely checks whether the child array contains a value -- ignoring diagonal entries.
[ "Safely", "checks", "whether", "the", "child", "array", "contains", "a", "value", "--", "ignoring", "diagonal", "entries", "." ]
train
https://github.com/mgormley/pacaya/blob/786294cbac7cc65dbc32210c10acc32ed0c69233/src/main/java/edu/jhu/pacaya/parse/dep/EdgeScores.java#L54-L64
UrielCh/ovh-java-sdk
ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java
ApiOvhCloud.serviceName_pca_pcaServiceName_sessions_sessionId_PUT
public void serviceName_pca_pcaServiceName_sessions_sessionId_PUT(String serviceName, String pcaServiceName, String sessionId, net.minidev.ovh.api.pca.OvhSession body) throws IOException { String qPath = "/cloud/{serviceName}/pca/{pcaServiceName}/sessions/{sessionId}"; StringBuilder sb = path(qPath, serviceName, pcaServiceName, sessionId); exec(qPath, "PUT", sb.toString(), body); }
java
public void serviceName_pca_pcaServiceName_sessions_sessionId_PUT(String serviceName, String pcaServiceName, String sessionId, net.minidev.ovh.api.pca.OvhSession body) throws IOException { String qPath = "/cloud/{serviceName}/pca/{pcaServiceName}/sessions/{sessionId}"; StringBuilder sb = path(qPath, serviceName, pcaServiceName, sessionId); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "serviceName_pca_pcaServiceName_sessions_sessionId_PUT", "(", "String", "serviceName", ",", "String", "pcaServiceName", ",", "String", "sessionId", ",", "net", ".", "minidev", ".", "ovh", ".", "api", ".", "pca", ".", "OvhSession", "body", ")", "t...
Alter this object properties REST: PUT /cloud/{serviceName}/pca/{pcaServiceName}/sessions/{sessionId} @param body [required] New object properties @param serviceName [required] The internal name of your public cloud passport @param pcaServiceName [required] The internal name of your PCA offer @param sessionId [required] Session ID @deprecated
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-cloud/src/main/java/net/minidev/ovh/api/ApiOvhCloud.java#L2483-L2487
Erudika/para
para-server/src/main/java/com/erudika/para/security/filters/GenericOAuth2Filter.java
GenericOAuth2Filter.attemptAuthentication
@Override public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws IOException { final String requestURI = request.getRequestURI(); UserAuthentication userAuth = null; if (requestURI.endsWith(OAUTH2_ACTION)) { String authCode = request.getParameter("code"); if (!StringUtils.isBlank(authCode)) { String appid = SecurityUtils.getAppidFromAuthRequest(request); String redirectURI = SecurityUtils.getRedirectUrl(request); App app = Para.getDAO().read(App.id(appid == null ? Config.getRootAppIdentifier() : appid)); String[] keys = SecurityUtils.getOAuthKeysForApp(app, Config.OAUTH2_PREFIX); String entity = Utils.formatMessage(PAYLOAD, authCode, Utils.urlEncode(redirectURI), URLEncoder.encode(SecurityUtils.getSettingForApp(app, "security.oauth.scope", ""), "UTF-8"), keys[0], keys[1]); String acceptHeader = SecurityUtils.getSettingForApp(app, "security.oauth.accept_header", ""); HttpPost tokenPost = new HttpPost(SecurityUtils.getSettingForApp(app, "security.oauth.token_url", "")); tokenPost.setHeader(HttpHeaders.CONTENT_TYPE, "application/x-www-form-urlencoded"); tokenPost.setEntity(new StringEntity(entity, "UTF-8")); if (!StringUtils.isBlank(acceptHeader)) { tokenPost.setHeader(HttpHeaders.ACCEPT, acceptHeader); } try (CloseableHttpResponse resp1 = httpclient.execute(tokenPost)) { if (resp1 != null && resp1.getEntity() != null) { Map<String, Object> token = jreader.readValue(resp1.getEntity().getContent()); if (token != null && token.containsKey("access_token")) { userAuth = getOrCreateUser(app, (String) token.get("access_token")); } EntityUtils.consumeQuietly(resp1.getEntity()); } } } } return SecurityUtils.checkIfActive(userAuth, SecurityUtils.getAuthenticatedUser(userAuth), true); }
java
@Override public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws IOException { final String requestURI = request.getRequestURI(); UserAuthentication userAuth = null; if (requestURI.endsWith(OAUTH2_ACTION)) { String authCode = request.getParameter("code"); if (!StringUtils.isBlank(authCode)) { String appid = SecurityUtils.getAppidFromAuthRequest(request); String redirectURI = SecurityUtils.getRedirectUrl(request); App app = Para.getDAO().read(App.id(appid == null ? Config.getRootAppIdentifier() : appid)); String[] keys = SecurityUtils.getOAuthKeysForApp(app, Config.OAUTH2_PREFIX); String entity = Utils.formatMessage(PAYLOAD, authCode, Utils.urlEncode(redirectURI), URLEncoder.encode(SecurityUtils.getSettingForApp(app, "security.oauth.scope", ""), "UTF-8"), keys[0], keys[1]); String acceptHeader = SecurityUtils.getSettingForApp(app, "security.oauth.accept_header", ""); HttpPost tokenPost = new HttpPost(SecurityUtils.getSettingForApp(app, "security.oauth.token_url", "")); tokenPost.setHeader(HttpHeaders.CONTENT_TYPE, "application/x-www-form-urlencoded"); tokenPost.setEntity(new StringEntity(entity, "UTF-8")); if (!StringUtils.isBlank(acceptHeader)) { tokenPost.setHeader(HttpHeaders.ACCEPT, acceptHeader); } try (CloseableHttpResponse resp1 = httpclient.execute(tokenPost)) { if (resp1 != null && resp1.getEntity() != null) { Map<String, Object> token = jreader.readValue(resp1.getEntity().getContent()); if (token != null && token.containsKey("access_token")) { userAuth = getOrCreateUser(app, (String) token.get("access_token")); } EntityUtils.consumeQuietly(resp1.getEntity()); } } } } return SecurityUtils.checkIfActive(userAuth, SecurityUtils.getAuthenticatedUser(userAuth), true); }
[ "@", "Override", "public", "Authentication", "attemptAuthentication", "(", "HttpServletRequest", "request", ",", "HttpServletResponse", "response", ")", "throws", "IOException", "{", "final", "String", "requestURI", "=", "request", ".", "getRequestURI", "(", ")", ";",...
Handles an authentication request. @param request HTTP request @param response HTTP response @return an authentication object that contains the principal object if successful. @throws IOException ex
[ "Handles", "an", "authentication", "request", "." ]
train
https://github.com/Erudika/para/blob/5ba096c477042ea7b18e9a0e8b5b1ee0f5bd6ce9/para-server/src/main/java/com/erudika/para/security/filters/GenericOAuth2Filter.java#L94-L133
mapfish/mapfish-print
core/src/main/java/org/mapfish/print/processor/http/AddHeadersProcessor.java
AddHeadersProcessor.setHeaders
@SuppressWarnings("unchecked") public void setHeaders(final Map<String, Object> headers) { this.headers.clear(); for (Map.Entry<String, Object> entry: headers.entrySet()) { if (entry.getValue() instanceof List) { List value = (List) entry.getValue(); // verify they are all strings for (Object o: value) { Assert.isTrue(o instanceof String, o + " is not a string it is a: '" + o.getClass() + "'"); } this.headers.put(entry.getKey(), (List<String>) entry.getValue()); } else if (entry.getValue() instanceof String) { final List<String> value = Collections.singletonList((String) entry.getValue()); this.headers.put(entry.getKey(), value); } else { throw new IllegalArgumentException("Only strings and list of strings may be headers"); } } }
java
@SuppressWarnings("unchecked") public void setHeaders(final Map<String, Object> headers) { this.headers.clear(); for (Map.Entry<String, Object> entry: headers.entrySet()) { if (entry.getValue() instanceof List) { List value = (List) entry.getValue(); // verify they are all strings for (Object o: value) { Assert.isTrue(o instanceof String, o + " is not a string it is a: '" + o.getClass() + "'"); } this.headers.put(entry.getKey(), (List<String>) entry.getValue()); } else if (entry.getValue() instanceof String) { final List<String> value = Collections.singletonList((String) entry.getValue()); this.headers.put(entry.getKey(), value); } else { throw new IllegalArgumentException("Only strings and list of strings may be headers"); } } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "void", "setHeaders", "(", "final", "Map", "<", "String", ",", "Object", ">", "headers", ")", "{", "this", ".", "headers", ".", "clear", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", ...
A map of the header key value pairs. Keys are strings and values are either list of strings or a string. @param headers the header map
[ "A", "map", "of", "the", "header", "key", "value", "pairs", ".", "Keys", "are", "strings", "and", "values", "are", "either", "list", "of", "strings", "or", "a", "string", "." ]
train
https://github.com/mapfish/mapfish-print/blob/25a452cb39f592bd8a53b20db1037703898e1e22/core/src/main/java/org/mapfish/print/processor/http/AddHeadersProcessor.java#L66-L85
tango-controls/JTango
server/src/main/java/org/tango/server/admin/AdminDevice.java
AdminDevice.getLoggingLevel
@Command(name = "GetLoggingLevel", inTypeDesc = "Device list", outTypeDesc = "Lg[i]=Logging Level. Str[i]=Device name.") public DevVarLongStringArray getLoggingLevel(final String[] deviceNames) { final int[] levels = new int[deviceNames.length]; for (int i = 0; i < levels.length; i++) { levels[i] = LoggingManager.getInstance().getLoggingLevel(deviceNames[i]); } return new DevVarLongStringArray(levels, deviceNames); }
java
@Command(name = "GetLoggingLevel", inTypeDesc = "Device list", outTypeDesc = "Lg[i]=Logging Level. Str[i]=Device name.") public DevVarLongStringArray getLoggingLevel(final String[] deviceNames) { final int[] levels = new int[deviceNames.length]; for (int i = 0; i < levels.length; i++) { levels[i] = LoggingManager.getInstance().getLoggingLevel(deviceNames[i]); } return new DevVarLongStringArray(levels, deviceNames); }
[ "@", "Command", "(", "name", "=", "\"GetLoggingLevel\"", ",", "inTypeDesc", "=", "\"Device list\"", ",", "outTypeDesc", "=", "\"Lg[i]=Logging Level. Str[i]=Device name.\"", ")", "public", "DevVarLongStringArray", "getLoggingLevel", "(", "final", "String", "[", "]", "dev...
Get the logging level @param deviceNames @return the current logging levels
[ "Get", "the", "logging", "level" ]
train
https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/server/admin/AdminDevice.java#L358-L365
apache/predictionio-sdk-java
client/src/main/java/org/apache/predictionio/sdk/java/EventClient.java
EventClient.setUser
public String setUser(String uid, Map<String, Object> properties) throws ExecutionException, InterruptedException, IOException { return setUser(uid, properties, new DateTime()); }
java
public String setUser(String uid, Map<String, Object> properties) throws ExecutionException, InterruptedException, IOException { return setUser(uid, properties, new DateTime()); }
[ "public", "String", "setUser", "(", "String", "uid", ",", "Map", "<", "String", ",", "Object", ">", "properties", ")", "throws", "ExecutionException", ",", "InterruptedException", ",", "IOException", "{", "return", "setUser", "(", "uid", ",", "properties", ","...
Sets properties of a user. Same as {@link #setUser(String, Map, DateTime)} except event time is not specified and recorded as the time when the function is called.
[ "Sets", "properties", "of", "a", "user", ".", "Same", "as", "{" ]
train
https://github.com/apache/predictionio-sdk-java/blob/16052c96b136340c175c3f9c2692e720850df219/client/src/main/java/org/apache/predictionio/sdk/java/EventClient.java#L333-L336
fhoeben/hsac-fitnesse-fixtures
src/main/java/nl/hsac/fitnesse/fixture/util/FileUtil.java
FileUtil.loadFile
public static String loadFile(String filename) { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); InputStream is = classLoader.getResourceAsStream(filename); if (is == null) { throw new IllegalArgumentException("Unable to locate: " + filename); } return streamToString(is, filename); }
java
public static String loadFile(String filename) { ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); InputStream is = classLoader.getResourceAsStream(filename); if (is == null) { throw new IllegalArgumentException("Unable to locate: " + filename); } return streamToString(is, filename); }
[ "public", "static", "String", "loadFile", "(", "String", "filename", ")", "{", "ClassLoader", "classLoader", "=", "Thread", ".", "currentThread", "(", ")", ".", "getContextClassLoader", "(", ")", ";", "InputStream", "is", "=", "classLoader", ".", "getResourceAsS...
Reads content of UTF-8 file on classpath to String. @param filename file to read. @return file's content. @throws IllegalArgumentException if file could not be found. @throws IllegalStateException if file could not be read.
[ "Reads", "content", "of", "UTF", "-", "8", "file", "on", "classpath", "to", "String", "." ]
train
https://github.com/fhoeben/hsac-fitnesse-fixtures/blob/4e9018d7386a9aa65bfcbf07eb28ae064edd1732/src/main/java/nl/hsac/fitnesse/fixture/util/FileUtil.java#L38-L45
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageBandMath.java
ImageBandMath.stdDev
public static void stdDev(Planar<GrayU8> input, GrayU8 output, @Nullable GrayU8 avg) { stdDev(input,output,avg,0,input.getNumBands() - 1); }
java
public static void stdDev(Planar<GrayU8> input, GrayU8 output, @Nullable GrayU8 avg) { stdDev(input,output,avg,0,input.getNumBands() - 1); }
[ "public", "static", "void", "stdDev", "(", "Planar", "<", "GrayU8", ">", "input", ",", "GrayU8", "output", ",", "@", "Nullable", "GrayU8", "avg", ")", "{", "stdDev", "(", "input", ",", "output", ",", "avg", ",", "0", ",", "input", ".", "getNumBands", ...
Computes the standard deviation for each pixel across all bands in the {@link Planar} image. @param input Planar image - not modified @param output Gray scale image containing average pixel values - modified @param avg Input Gray scale image containing average image. Can be null
[ "Computes", "the", "standard", "deviation", "for", "each", "pixel", "across", "all", "bands", "in", "the", "{" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/misc/ImageBandMath.java#L195-L197
hawkular/hawkular-agent
hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/LoggingJBossASClient.java
LoggingJBossASClient.getLoggerLevel
public String getLoggerLevel(String loggerName) throws Exception { Address addr = Address.root().add(SUBSYSTEM, LOGGING, LOGGER, loggerName); return getStringAttribute("level", addr); }
java
public String getLoggerLevel(String loggerName) throws Exception { Address addr = Address.root().add(SUBSYSTEM, LOGGING, LOGGER, loggerName); return getStringAttribute("level", addr); }
[ "public", "String", "getLoggerLevel", "(", "String", "loggerName", ")", "throws", "Exception", "{", "Address", "addr", "=", "Address", ".", "root", "(", ")", ".", "add", "(", "SUBSYSTEM", ",", "LOGGING", ",", "LOGGER", ",", "loggerName", ")", ";", "return"...
Returns the level of the given logger. @param loggerName the name of the logger (this is also known as the category name) @return level of the logger @throws Exception if the log level could not be obtained (typically because the logger doesn't exist)
[ "Returns", "the", "level", "of", "the", "given", "logger", "." ]
train
https://github.com/hawkular/hawkular-agent/blob/a7a88fc7e4f12302e4c4306d1c91e11f81c8b811/hawkular-dmr-client/src/main/java/org/hawkular/dmrclient/LoggingJBossASClient.java#L56-L59
Azure/azure-sdk-for-java
labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/LabsInner.java
LabsInner.addUsersAsync
public Observable<Void> addUsersAsync(String resourceGroupName, String labAccountName, String labName, List<String> emailAddresses) { return addUsersWithServiceResponseAsync(resourceGroupName, labAccountName, labName, emailAddresses).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> addUsersAsync(String resourceGroupName, String labAccountName, String labName, List<String> emailAddresses) { return addUsersWithServiceResponseAsync(resourceGroupName, labAccountName, labName, emailAddresses).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "addUsersAsync", "(", "String", "resourceGroupName", ",", "String", "labAccountName", ",", "String", "labName", ",", "List", "<", "String", ">", "emailAddresses", ")", "{", "return", "addUsersWithServiceResponseAsync", "(", ...
Add users to a lab. @param resourceGroupName The name of the resource group. @param labAccountName The name of the lab Account. @param labName The name of the lab. @param emailAddresses List of user emails addresses to add to the lab. @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Add", "users", "to", "a", "lab", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/labservices/resource-manager/v2018_10_15/src/main/java/com/microsoft/azure/management/labservices/v2018_10_15/implementation/LabsInner.java#L964-L971
lightblueseas/swing-components
src/main/java/de/alpharogroup/swing/img/ImageExtensions.java
ImageExtensions.newPdfPTable
public static PdfPTable newPdfPTable(int numColumns, List<String> headerNames) { PdfPTable table = new PdfPTable(numColumns); headerNames.stream().forEach(columnHeaderName -> { PdfPCell header = new PdfPCell(); header.setBackgroundColor(BaseColor.LIGHT_GRAY); header.setBorderWidth(2); header.setPhrase(new Phrase(columnHeaderName)); table.addCell(header); }); return table; }
java
public static PdfPTable newPdfPTable(int numColumns, List<String> headerNames) { PdfPTable table = new PdfPTable(numColumns); headerNames.stream().forEach(columnHeaderName -> { PdfPCell header = new PdfPCell(); header.setBackgroundColor(BaseColor.LIGHT_GRAY); header.setBorderWidth(2); header.setPhrase(new Phrase(columnHeaderName)); table.addCell(header); }); return table; }
[ "public", "static", "PdfPTable", "newPdfPTable", "(", "int", "numColumns", ",", "List", "<", "String", ">", "headerNames", ")", "{", "PdfPTable", "table", "=", "new", "PdfPTable", "(", "numColumns", ")", ";", "headerNames", ".", "stream", "(", ")", ".", "f...
Factory method for create a new {@link PdfPTable} with the given count of columns and the column header names @param numColumns the count of columns of the table @param headerNames the column header names @return the new {@link PdfPTable}
[ "Factory", "method", "for", "create", "a", "new", "{", "@link", "PdfPTable", "}", "with", "the", "given", "count", "of", "columns", "and", "the", "column", "header", "names" ]
train
https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/img/ImageExtensions.java#L217-L228
GoogleCloudPlatform/bigdata-interop
gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/auth/AbstractDelegationTokenBinding.java
AbstractDelegationTokenBinding.bindToFileSystem
public void bindToFileSystem(GoogleHadoopFileSystemBase fs, Text service) { this.fileSystem = requireNonNull(fs); this.service = requireNonNull(service); }
java
public void bindToFileSystem(GoogleHadoopFileSystemBase fs, Text service) { this.fileSystem = requireNonNull(fs); this.service = requireNonNull(service); }
[ "public", "void", "bindToFileSystem", "(", "GoogleHadoopFileSystemBase", "fs", ",", "Text", "service", ")", "{", "this", ".", "fileSystem", "=", "requireNonNull", "(", "fs", ")", ";", "this", ".", "service", "=", "requireNonNull", "(", "service", ")", ";", "...
Bind to the filesystem. Subclasses can use this to perform their own binding operations - but they must always call their superclass implementation. This <i>Must</i> be called before calling {@code init()}. <p><b>Important:</b> This binding will happen during FileSystem.initialize(); the FS is not live for actual use and will not yet have interacted with GCS services. @param fs owning FS. @param service name of the service (i.e. bucket name) for the FS.
[ "Bind", "to", "the", "filesystem", ".", "Subclasses", "can", "use", "this", "to", "perform", "their", "own", "binding", "operations", "-", "but", "they", "must", "always", "call", "their", "superclass", "implementation", ".", "This", "<i", ">", "Must<", "/",...
train
https://github.com/GoogleCloudPlatform/bigdata-interop/blob/918d91c80a63e36046edb28972a5c65d3326a858/gcs/src/main/java/com/google/cloud/hadoop/fs/gcs/auth/AbstractDelegationTokenBinding.java#L94-L97
lievendoclo/Valkyrie-RCP
valkyrie-rcp-core/src/main/java/org/valkyriercp/util/EventListenerListHelper.java
EventListenerListHelper.fire
public void fire(String methodName, Object arg) { if (listeners != EMPTY_OBJECT_ARRAY) { fireEventByReflection(methodName, new Object[] { arg }); } }
java
public void fire(String methodName, Object arg) { if (listeners != EMPTY_OBJECT_ARRAY) { fireEventByReflection(methodName, new Object[] { arg }); } }
[ "public", "void", "fire", "(", "String", "methodName", ",", "Object", "arg", ")", "{", "if", "(", "listeners", "!=", "EMPTY_OBJECT_ARRAY", ")", "{", "fireEventByReflection", "(", "methodName", ",", "new", "Object", "[", "]", "{", "arg", "}", ")", ";", "}...
Invokes the method with the given name and a single parameter on each of the listeners registered with this list. @param methodName the name of the method to invoke. @param arg the single argument to pass to each invocation. @throws IllegalArgumentException if no method with the given name and a single formal parameter exists on the listener class managed by this list helper.
[ "Invokes", "the", "method", "with", "the", "given", "name", "and", "a", "single", "parameter", "on", "each", "of", "the", "listeners", "registered", "with", "this", "list", "." ]
train
https://github.com/lievendoclo/Valkyrie-RCP/blob/6aad6e640b348cda8f3b0841f6e42025233f1eb8/valkyrie-rcp-core/src/main/java/org/valkyriercp/util/EventListenerListHelper.java#L233-L237
rundeck/rundeck
core/src/main/java/com/dtolabs/utils/Mapper.java
Mapper.mapKeys
public static Map mapKeys(Mapper mapper, Map map, boolean allowNull) { HashMap h = new HashMap(); for (Object e : map.entrySet()) { Map.Entry entry = (Map.Entry) e; Object o = mapper.map(entry.getKey()); if (allowNull || o != null) { h.put(o, entry.getValue()); } } return h; }
java
public static Map mapKeys(Mapper mapper, Map map, boolean allowNull) { HashMap h = new HashMap(); for (Object e : map.entrySet()) { Map.Entry entry = (Map.Entry) e; Object o = mapper.map(entry.getKey()); if (allowNull || o != null) { h.put(o, entry.getValue()); } } return h; }
[ "public", "static", "Map", "mapKeys", "(", "Mapper", "mapper", ",", "Map", "map", ",", "boolean", "allowNull", ")", "{", "HashMap", "h", "=", "new", "HashMap", "(", ")", ";", "for", "(", "Object", "e", ":", "map", ".", "entrySet", "(", ")", ")", "{...
Create a new Map by mapping all keys from the original map and maintaining the original value. @param mapper a Mapper to map the keys @param map a Map @param allowNull allow null values @return a new Map with keys mapped
[ "Create", "a", "new", "Map", "by", "mapping", "all", "keys", "from", "the", "original", "map", "and", "maintaining", "the", "original", "value", "." ]
train
https://github.com/rundeck/rundeck/blob/8070f774f55bffaa1118ff0c03aea319d40a9668/core/src/main/java/com/dtolabs/utils/Mapper.java#L390-L400
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/line/ConnectLinesGrid.java
ConnectLinesGrid.connectTry
private boolean connectTry( LineSegment2D_F32 target , int x , int y ) { if( !grid.isInBounds(x,y) ) return false; List<LineSegment2D_F32> lines = grid.get(x,y); int index = findBestCompatible(target,lines,0); if( index == -1 ) return false; LineSegment2D_F32 b = lines.remove(index); // join the two lines by connecting the farthest points from each other Point2D_F32 pt0 = farthestIndex < 2 ? target.a : target.b; Point2D_F32 pt1 = (farthestIndex %2) == 0 ? b.a : b.b; target.a.set(pt0); target.b.set(pt1); // adding the merged one back in allows it to be merged with other lines down // the line. It will be compared against others in 'target's grid though lines.add(target); return true; }
java
private boolean connectTry( LineSegment2D_F32 target , int x , int y ) { if( !grid.isInBounds(x,y) ) return false; List<LineSegment2D_F32> lines = grid.get(x,y); int index = findBestCompatible(target,lines,0); if( index == -1 ) return false; LineSegment2D_F32 b = lines.remove(index); // join the two lines by connecting the farthest points from each other Point2D_F32 pt0 = farthestIndex < 2 ? target.a : target.b; Point2D_F32 pt1 = (farthestIndex %2) == 0 ? b.a : b.b; target.a.set(pt0); target.b.set(pt1); // adding the merged one back in allows it to be merged with other lines down // the line. It will be compared against others in 'target's grid though lines.add(target); return true; }
[ "private", "boolean", "connectTry", "(", "LineSegment2D_F32", "target", ",", "int", "x", ",", "int", "y", ")", "{", "if", "(", "!", "grid", ".", "isInBounds", "(", "x", ",", "y", ")", ")", "return", "false", ";", "List", "<", "LineSegment2D_F32", ">", ...
See if there is a line that matches in this adjacent region. @param target Line being connected. @param x x-coordinate of adjacent region. @param y y-coordinate of adjacent region. @return true if a connection was made.
[ "See", "if", "there", "is", "a", "line", "that", "matches", "in", "this", "adjacent", "region", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/feature/detect/line/ConnectLinesGrid.java#L146-L171
CODAIT/stocator
src/main/java/com/ibm/stocator/fs/common/Utils.java
Utils.getOption
public static String getOption(Properties props, String key) throws IOException { String val = props.getProperty(key); if (val == null) { throw new IOException("Undefined property: " + key); } return val; }
java
public static String getOption(Properties props, String key) throws IOException { String val = props.getProperty(key); if (val == null) { throw new IOException("Undefined property: " + key); } return val; }
[ "public", "static", "String", "getOption", "(", "Properties", "props", ",", "String", "key", ")", "throws", "IOException", "{", "String", "val", "=", "props", ".", "getProperty", "(", "key", ")", ";", "if", "(", "val", "==", "null", ")", "{", "throw", ...
Get a mandatory configuration option @param props property set @param key key @return value of the configuration @throws IOException if there was no match for the key
[ "Get", "a", "mandatory", "configuration", "option" ]
train
https://github.com/CODAIT/stocator/blob/35969cadd2e8faa6fdac45e8bec1799fdd3d8299/src/main/java/com/ibm/stocator/fs/common/Utils.java#L198-L204
inmite/android-validation-komensky
library/src/main/java/eu/inmite/android/lib/validations/form/FormValidator.java
FormValidator.startLiveValidation
public static void startLiveValidation(final Object target, final View formContainer, final IValidationCallback callback) { if (formContainer == null) { throw new IllegalArgumentException("form container view cannot be null"); } if (target == null) { throw new IllegalArgumentException("target cannot be null"); } if (sLiveValidations == null) { sLiveValidations = new HashMap<>(); } else if (sLiveValidations.containsKey(target)) { // validation is already running return; } final Map<View, FieldInfo> infoMap = FieldFinder.getFieldsForTarget(target); final ViewGlobalFocusChangeListener listener = new ViewGlobalFocusChangeListener(infoMap, formContainer, target, callback); final ViewTreeObserver observer = formContainer.getViewTreeObserver(); observer.addOnGlobalFocusChangeListener(listener); sLiveValidations.put(target, listener); }
java
public static void startLiveValidation(final Object target, final View formContainer, final IValidationCallback callback) { if (formContainer == null) { throw new IllegalArgumentException("form container view cannot be null"); } if (target == null) { throw new IllegalArgumentException("target cannot be null"); } if (sLiveValidations == null) { sLiveValidations = new HashMap<>(); } else if (sLiveValidations.containsKey(target)) { // validation is already running return; } final Map<View, FieldInfo> infoMap = FieldFinder.getFieldsForTarget(target); final ViewGlobalFocusChangeListener listener = new ViewGlobalFocusChangeListener(infoMap, formContainer, target, callback); final ViewTreeObserver observer = formContainer.getViewTreeObserver(); observer.addOnGlobalFocusChangeListener(listener); sLiveValidations.put(target, listener); }
[ "public", "static", "void", "startLiveValidation", "(", "final", "Object", "target", ",", "final", "View", "formContainer", ",", "final", "IValidationCallback", "callback", ")", "{", "if", "(", "formContainer", "==", "null", ")", "{", "throw", "new", "IllegalArg...
Start live validation - whenever focus changes from view with validations upon itself, validators will run.<br/> Don't forget to call {@link #stopLiveValidation(Object)} once you are done. @param target target with views to validate, there can be only one continuous validation per target @param formContainer view that contains our form (views to validate) @param callback callback invoked whenever there is some validation fail, can be null @throws IllegalArgumentException if formContainer or target is null
[ "Start", "live", "validation", "-", "whenever", "focus", "changes", "from", "view", "with", "validations", "upon", "itself", "validators", "will", "run", ".", "<br", "/", ">", "Don", "t", "forget", "to", "call", "{", "@link", "#stopLiveValidation", "(", "Obj...
train
https://github.com/inmite/android-validation-komensky/blob/7c544f2d9f104a9800fcf4757eecb3caa8e76451/library/src/main/java/eu/inmite/android/lib/validations/form/FormValidator.java#L139-L160
apache/flink
flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/MurmurHashUtil.java
MurmurHashUtil.hashBytesByWords
public static int hashBytesByWords(MemorySegment segment, int offset, int lengthInBytes) { return hashBytesByWords(segment, offset, lengthInBytes, DEFAULT_SEED); }
java
public static int hashBytesByWords(MemorySegment segment, int offset, int lengthInBytes) { return hashBytesByWords(segment, offset, lengthInBytes, DEFAULT_SEED); }
[ "public", "static", "int", "hashBytesByWords", "(", "MemorySegment", "segment", ",", "int", "offset", ",", "int", "lengthInBytes", ")", "{", "return", "hashBytesByWords", "(", "segment", ",", "offset", ",", "lengthInBytes", ",", "DEFAULT_SEED", ")", ";", "}" ]
Hash bytes in MemorySegment, length must be aligned to 4 bytes. @param segment segment. @param offset offset for MemorySegment @param lengthInBytes length in MemorySegment @return hash code
[ "Hash", "bytes", "in", "MemorySegment", "length", "must", "be", "aligned", "to", "4", "bytes", "." ]
train
https://github.com/apache/flink/blob/b62db93bf63cb3bb34dd03d611a779d9e3fc61ac/flink-table/flink-table-runtime-blink/src/main/java/org/apache/flink/table/util/MurmurHashUtil.java#L62-L64
liferay/com-liferay-commerce
commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPRuleUserSegmentRelPersistenceImpl.java
CPRuleUserSegmentRelPersistenceImpl.findByCPRuleId
@Override public List<CPRuleUserSegmentRel> findByCPRuleId(long CPRuleId, int start, int end, OrderByComparator<CPRuleUserSegmentRel> orderByComparator) { return findByCPRuleId(CPRuleId, start, end, orderByComparator, true); }
java
@Override public List<CPRuleUserSegmentRel> findByCPRuleId(long CPRuleId, int start, int end, OrderByComparator<CPRuleUserSegmentRel> orderByComparator) { return findByCPRuleId(CPRuleId, start, end, orderByComparator, true); }
[ "@", "Override", "public", "List", "<", "CPRuleUserSegmentRel", ">", "findByCPRuleId", "(", "long", "CPRuleId", ",", "int", "start", ",", "int", "end", ",", "OrderByComparator", "<", "CPRuleUserSegmentRel", ">", "orderByComparator", ")", "{", "return", "findByCPRu...
Returns an ordered range of all the cp rule user segment rels where CPRuleId = &#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 CPRuleUserSegmentRelModelImpl}. 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 CPRuleId the cp rule ID @param start the lower bound of the range of cp rule user segment rels @param end the upper bound of the range of cp rule user segment rels (not inclusive) @param orderByComparator the comparator to order the results by (optionally <code>null</code>) @return the ordered range of matching cp rule user segment rels
[ "Returns", "an", "ordered", "range", "of", "all", "the", "cp", "rule", "user", "segment", "rels", "where", "CPRuleId", "=", "&#63", ";", "." ]
train
https://github.com/liferay/com-liferay-commerce/blob/9e54362d7f59531fc684016ba49ee7cdc3a2f22b/commerce-product-service/src/main/java/com/liferay/commerce/product/service/persistence/impl/CPRuleUserSegmentRelPersistenceImpl.java#L159-L163
datacleaner/AnalyzerBeans
env/xml-config/src/main/java/org/eobjects/analyzer/configuration/JaxbConfigurationReader.java
JaxbConfigurationReader.checkName
private static void checkName(String name, Class<?> type, List<? extends ReferenceData> previousEntries) throws IllegalStateException { if (StringUtils.isNullOrEmpty(name)) { throw new IllegalStateException(type.getSimpleName() + " name cannot be null"); } for (ReferenceData referenceData : previousEntries) { if (name.equals(referenceData.getName())) { throw new IllegalStateException(type.getSimpleName() + " name is not unique: " + name); } } }
java
private static void checkName(String name, Class<?> type, List<? extends ReferenceData> previousEntries) throws IllegalStateException { if (StringUtils.isNullOrEmpty(name)) { throw new IllegalStateException(type.getSimpleName() + " name cannot be null"); } for (ReferenceData referenceData : previousEntries) { if (name.equals(referenceData.getName())) { throw new IllegalStateException(type.getSimpleName() + " name is not unique: " + name); } } }
[ "private", "static", "void", "checkName", "(", "String", "name", ",", "Class", "<", "?", ">", "type", ",", "List", "<", "?", "extends", "ReferenceData", ">", "previousEntries", ")", "throws", "IllegalStateException", "{", "if", "(", "StringUtils", ".", "isNu...
Checks if a string is a valid name of a component. @param name the name to be validated @param type the type of component (used for error messages) @param previousEntries the previous entries of that component type (for uniqueness check) @throws IllegalStateException if the name is invalid
[ "Checks", "if", "a", "string", "is", "a", "valid", "name", "of", "a", "component", "." ]
train
https://github.com/datacleaner/AnalyzerBeans/blob/f82dae080d80d2a647b706a5fb22b3ea250613b3/env/xml-config/src/main/java/org/eobjects/analyzer/configuration/JaxbConfigurationReader.java#L1250-L1260
lmdbjava/lmdbjava
src/main/java/org/lmdbjava/ByteArrayProxy.java
ByteArrayProxy.compareArrays
@SuppressWarnings("checkstyle:ReturnCount") public static int compareArrays(final byte[] o1, final byte[] o2) { requireNonNull(o1); requireNonNull(o2); if (o1 == o2) { return 0; } final int minLength = Math.min(o1.length, o2.length); for (int i = 0; i < minLength; i++) { final int lw = Byte.toUnsignedInt(o1[i]); final int rw = Byte.toUnsignedInt(o2[i]); final int result = Integer.compareUnsigned(lw, rw); if (result != 0) { return result; } } return o1.length - o2.length; }
java
@SuppressWarnings("checkstyle:ReturnCount") public static int compareArrays(final byte[] o1, final byte[] o2) { requireNonNull(o1); requireNonNull(o2); if (o1 == o2) { return 0; } final int minLength = Math.min(o1.length, o2.length); for (int i = 0; i < minLength; i++) { final int lw = Byte.toUnsignedInt(o1[i]); final int rw = Byte.toUnsignedInt(o2[i]); final int result = Integer.compareUnsigned(lw, rw); if (result != 0) { return result; } } return o1.length - o2.length; }
[ "@", "SuppressWarnings", "(", "\"checkstyle:ReturnCount\"", ")", "public", "static", "int", "compareArrays", "(", "final", "byte", "[", "]", "o1", ",", "final", "byte", "[", "]", "o2", ")", "{", "requireNonNull", "(", "o1", ")", ";", "requireNonNull", "(", ...
Lexicographically compare two byte arrays. @param o1 left operand (required) @param o2 right operand (required) @return as specified by {@link Comparable} interface
[ "Lexicographically", "compare", "two", "byte", "arrays", "." ]
train
https://github.com/lmdbjava/lmdbjava/blob/5912beb1037722c71f3ddc05e70fcbe739dfa272/src/main/java/org/lmdbjava/ByteArrayProxy.java#L50-L69
google/j2objc
jre_emul/android/platform/external/mockwebserver/src/main/java/com/google/mockwebserver/MockResponse.java
MockResponse.throttleBody
public MockResponse throttleBody(int bytesPerPeriod, long period, TimeUnit unit) { this.throttleBytesPerPeriod = bytesPerPeriod; this.throttlePeriod = period; this.throttleUnit = unit; return this; }
java
public MockResponse throttleBody(int bytesPerPeriod, long period, TimeUnit unit) { this.throttleBytesPerPeriod = bytesPerPeriod; this.throttlePeriod = period; this.throttleUnit = unit; return this; }
[ "public", "MockResponse", "throttleBody", "(", "int", "bytesPerPeriod", ",", "long", "period", ",", "TimeUnit", "unit", ")", "{", "this", ".", "throttleBytesPerPeriod", "=", "bytesPerPeriod", ";", "this", ".", "throttlePeriod", "=", "period", ";", "this", ".", ...
Throttles the response body writer to sleep for the given period after each series of {@code bytesPerPeriod} bytes are written. Use this to simulate network behavior.
[ "Throttles", "the", "response", "body", "writer", "to", "sleep", "for", "the", "given", "period", "after", "each", "series", "of", "{" ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/mockwebserver/src/main/java/com/google/mockwebserver/MockResponse.java#L236-L241
apache/incubator-gobblin
gobblin-core-base/src/main/java/org/apache/gobblin/instrumented/converter/InstrumentedConverterBase.java
InstrumentedConverterBase.afterConvert
public void afterConvert(Iterable<DO> iterable, long startTimeNanos) { Instrumented.updateTimer(this.converterTimer, System.nanoTime() - startTimeNanos, TimeUnit.NANOSECONDS); }
java
public void afterConvert(Iterable<DO> iterable, long startTimeNanos) { Instrumented.updateTimer(this.converterTimer, System.nanoTime() - startTimeNanos, TimeUnit.NANOSECONDS); }
[ "public", "void", "afterConvert", "(", "Iterable", "<", "DO", ">", "iterable", ",", "long", "startTimeNanos", ")", "{", "Instrumented", ".", "updateTimer", "(", "this", ".", "converterTimer", ",", "System", ".", "nanoTime", "(", ")", "-", "startTimeNanos", "...
Called after conversion. @param iterable conversion result. @param startTimeNanos start time of conversion.
[ "Called", "after", "conversion", "." ]
train
https://github.com/apache/incubator-gobblin/blob/f029b4c0fea0fe4aa62f36dda2512344ff708bae/gobblin-core-base/src/main/java/org/apache/gobblin/instrumented/converter/InstrumentedConverterBase.java#L156-L158
bluelinelabs/Conductor
demo/src/main/java/com/bluelinelabs/conductor/demo/util/AnimUtils.java
AnimUtils.createIntProperty
public static <T> Property<T, Integer> createIntProperty(final IntProp<T> impl) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { return new IntProperty<T>(impl.name) { @Override public Integer get(T object) { return impl.get(object); } @Override public void setValue(T object, int value) { impl.set(object, value); } }; } else { return new Property<T, Integer>(Integer.class, impl.name) { @Override public Integer get(T object) { return impl.get(object); } @Override public void set(T object, Integer value) { impl.set(object, value); } }; } }
java
public static <T> Property<T, Integer> createIntProperty(final IntProp<T> impl) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { return new IntProperty<T>(impl.name) { @Override public Integer get(T object) { return impl.get(object); } @Override public void setValue(T object, int value) { impl.set(object, value); } }; } else { return new Property<T, Integer>(Integer.class, impl.name) { @Override public Integer get(T object) { return impl.get(object); } @Override public void set(T object, Integer value) { impl.set(object, value); } }; } }
[ "public", "static", "<", "T", ">", "Property", "<", "T", ",", "Integer", ">", "createIntProperty", "(", "final", "IntProp", "<", "T", ">", "impl", ")", "{", "if", "(", "Build", ".", "VERSION", ".", "SDK_INT", ">=", "Build", ".", "VERSION_CODES", ".", ...
The animation framework has an optimization for <code>Properties</code> of type <code>int</code> but it was only made public in API24, so wrap the impl in our own type and conditionally create the appropriate type, delegating the implementation.
[ "The", "animation", "framework", "has", "an", "optimization", "for", "<code", ">", "Properties<", "/", "code", ">", "of", "type", "<code", ">", "int<", "/", "code", ">", "but", "it", "was", "only", "made", "public", "in", "API24", "so", "wrap", "the", ...
train
https://github.com/bluelinelabs/Conductor/blob/94c9121bb16f93b481954513a8e3905846829fb2/demo/src/main/java/com/bluelinelabs/conductor/demo/util/AnimUtils.java#L109-L135
UrielCh/ovh-java-sdk
ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java
ApiOvhIpLoadbalancing.serviceName_udp_farm_farmId_PUT
public void serviceName_udp_farm_farmId_PUT(String serviceName, Long farmId, OvhBackendUdp body) throws IOException { String qPath = "/ipLoadbalancing/{serviceName}/udp/farm/{farmId}"; StringBuilder sb = path(qPath, serviceName, farmId); exec(qPath, "PUT", sb.toString(), body); }
java
public void serviceName_udp_farm_farmId_PUT(String serviceName, Long farmId, OvhBackendUdp body) throws IOException { String qPath = "/ipLoadbalancing/{serviceName}/udp/farm/{farmId}"; StringBuilder sb = path(qPath, serviceName, farmId); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "serviceName_udp_farm_farmId_PUT", "(", "String", "serviceName", ",", "Long", "farmId", ",", "OvhBackendUdp", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/ipLoadbalancing/{serviceName}/udp/farm/{farmId}\"", ";", "StringBuilder", ...
Alter this object properties REST: PUT /ipLoadbalancing/{serviceName}/udp/farm/{farmId} @param body [required] New object properties @param serviceName [required] The internal name of your IP load balancing @param farmId [required] Id of your farm API beta
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-ipLoadbalancing/src/main/java/net/minidev/ovh/api/ApiOvhIpLoadbalancing.java#L912-L916
threerings/narya
tools/src/main/java/com/threerings/presents/tools/GeneratedSourceMerger.java
GeneratedSourceMerger.extractGeneratedSection
protected Section extractGeneratedSection (Matcher m, String input) { int startIdx = m.start(); String name = m.group(1); if (m.group(2).equals("DISABLED")) { return new Section(name, input.substring(startIdx, m.end()), true); } Preconditions.checkArgument(m.group(2).equals("START"), "'%s' END without START", name); Preconditions.checkArgument(m.find(), "'%s' START without END", name); String endName = m.group(1); Preconditions.checkArgument(m.group(2).equals("END"), "'%s' START after '%s' START", endName, name); Preconditions.checkArgument(endName.equals(name), "'%s' END after '%s' START", endName, name); return new Section(name, input.substring(startIdx, m.end()), false); }
java
protected Section extractGeneratedSection (Matcher m, String input) { int startIdx = m.start(); String name = m.group(1); if (m.group(2).equals("DISABLED")) { return new Section(name, input.substring(startIdx, m.end()), true); } Preconditions.checkArgument(m.group(2).equals("START"), "'%s' END without START", name); Preconditions.checkArgument(m.find(), "'%s' START without END", name); String endName = m.group(1); Preconditions.checkArgument(m.group(2).equals("END"), "'%s' START after '%s' START", endName, name); Preconditions.checkArgument(endName.equals(name), "'%s' END after '%s' START", endName, name); return new Section(name, input.substring(startIdx, m.end()), false); }
[ "protected", "Section", "extractGeneratedSection", "(", "Matcher", "m", ",", "String", "input", ")", "{", "int", "startIdx", "=", "m", ".", "start", "(", ")", ";", "String", "name", "=", "m", ".", "group", "(", "1", ")", ";", "if", "(", "m", ".", "...
Returns a section name and its contents from the given matcher pointing to the start of a section. <code>m</code> is at the end of the section when this returns.
[ "Returns", "a", "section", "name", "and", "its", "contents", "from", "the", "given", "matcher", "pointing", "to", "the", "start", "of", "a", "section", ".", "<code", ">", "m<", "/", "code", ">", "is", "at", "the", "end", "of", "the", "section", "when",...
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/tools/src/main/java/com/threerings/presents/tools/GeneratedSourceMerger.java#L98-L114
scireum/parsii
src/main/java/parsii/eval/Parser.java
Parser.reOrder
protected Expression reOrder(Expression left, Expression right, BinaryOperation.Op op) { if (right instanceof BinaryOperation) { BinaryOperation rightOp = (BinaryOperation) right; if (!rightOp.isSealed() && rightOp.getOp().getPriority() == op.getPriority()) { replaceLeft(rightOp, left, op); return right; } } return new BinaryOperation(op, left, right); }
java
protected Expression reOrder(Expression left, Expression right, BinaryOperation.Op op) { if (right instanceof BinaryOperation) { BinaryOperation rightOp = (BinaryOperation) right; if (!rightOp.isSealed() && rightOp.getOp().getPriority() == op.getPriority()) { replaceLeft(rightOp, left, op); return right; } } return new BinaryOperation(op, left, right); }
[ "protected", "Expression", "reOrder", "(", "Expression", "left", ",", "Expression", "right", ",", "BinaryOperation", ".", "Op", "op", ")", "{", "if", "(", "right", "instanceof", "BinaryOperation", ")", "{", "BinaryOperation", "rightOp", "=", "(", "BinaryOperatio...
/* Reorders the operands of the given operation in order to generate a "left handed" AST which performs evaluations in natural order (from left to right).
[ "/", "*", "Reorders", "the", "operands", "of", "the", "given", "operation", "in", "order", "to", "generate", "a", "left", "handed", "AST", "which", "performs", "evaluations", "in", "natural", "order", "(", "from", "left", "to", "right", ")", "." ]
train
https://github.com/scireum/parsii/blob/fbf686155b1147b9e07ae21dcd02820b15c79a8c/src/main/java/parsii/eval/Parser.java#L299-L308
UrielCh/ovh-java-sdk
ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java
ApiOvhSms.serviceName_virtualNumbers_number_chatAccess_GET
public OvhChatAccess serviceName_virtualNumbers_number_chatAccess_GET(String serviceName, String number) throws IOException { String qPath = "/sms/{serviceName}/virtualNumbers/{number}/chatAccess"; StringBuilder sb = path(qPath, serviceName, number); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhChatAccess.class); }
java
public OvhChatAccess serviceName_virtualNumbers_number_chatAccess_GET(String serviceName, String number) throws IOException { String qPath = "/sms/{serviceName}/virtualNumbers/{number}/chatAccess"; StringBuilder sb = path(qPath, serviceName, number); String resp = exec(qPath, "GET", sb.toString(), null); return convertTo(resp, OvhChatAccess.class); }
[ "public", "OvhChatAccess", "serviceName_virtualNumbers_number_chatAccess_GET", "(", "String", "serviceName", ",", "String", "number", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/sms/{serviceName}/virtualNumbers/{number}/chatAccess\"", ";", "StringBuilder", "s...
Get this object properties REST: GET /sms/{serviceName}/virtualNumbers/{number}/chatAccess @param serviceName [required] The internal name of your SMS offer @param number [required] The virtual number
[ "Get", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-sms/src/main/java/net/minidev/ovh/api/ApiOvhSms.java#L471-L476
jbundle/jbundle
base/base/src/main/java/org/jbundle/base/field/event/MergeTableHandler.java
MergeTableHandler.fieldChanged
public int fieldChanged(boolean bDisplayOption, int iMoveMode) { boolean flag = this.getOwner().getState(); if (flag) m_mergeRecord.getTable().addTable(m_subRecord.getTable()); else m_mergeRecord.getTable().removeTable(m_subRecord.getTable()); m_mergeRecord.close(); // Must requery on Add, should close on delete if (m_gridScreen == null) return DBConstants.NORMAL_RETURN; else return super.fieldChanged(bDisplayOption, iMoveMode); }
java
public int fieldChanged(boolean bDisplayOption, int iMoveMode) { boolean flag = this.getOwner().getState(); if (flag) m_mergeRecord.getTable().addTable(m_subRecord.getTable()); else m_mergeRecord.getTable().removeTable(m_subRecord.getTable()); m_mergeRecord.close(); // Must requery on Add, should close on delete if (m_gridScreen == null) return DBConstants.NORMAL_RETURN; else return super.fieldChanged(bDisplayOption, iMoveMode); }
[ "public", "int", "fieldChanged", "(", "boolean", "bDisplayOption", ",", "int", "iMoveMode", ")", "{", "boolean", "flag", "=", "this", ".", "getOwner", "(", ")", ".", "getState", "(", ")", ";", "if", "(", "flag", ")", "m_mergeRecord", ".", "getTable", "("...
The Field has Changed. If this field is true, add the table back to the grid query and requery the grid table. @param bDisplayOption If true, display the change. @param iMoveMode The type of move being done (init/read/screen). @return The error code (or NORMAL_RETURN if okay).
[ "The", "Field", "has", "Changed", ".", "If", "this", "field", "is", "true", "add", "the", "table", "back", "to", "the", "grid", "query", "and", "requery", "the", "grid", "table", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/base/src/main/java/org/jbundle/base/field/event/MergeTableHandler.java#L111-L123
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/BasePretrainNetwork.java
BasePretrainNetwork.getCorruptedInput
public INDArray getCorruptedInput(INDArray x, double corruptionLevel) { INDArray corrupted = Nd4j.getDistributions().createBinomial(1, 1 - corruptionLevel).sample(x.ulike()); corrupted.muli(x.castTo(corrupted.dataType())); return corrupted; }
java
public INDArray getCorruptedInput(INDArray x, double corruptionLevel) { INDArray corrupted = Nd4j.getDistributions().createBinomial(1, 1 - corruptionLevel).sample(x.ulike()); corrupted.muli(x.castTo(corrupted.dataType())); return corrupted; }
[ "public", "INDArray", "getCorruptedInput", "(", "INDArray", "x", ",", "double", "corruptionLevel", ")", "{", "INDArray", "corrupted", "=", "Nd4j", ".", "getDistributions", "(", ")", ".", "createBinomial", "(", "1", ",", "1", "-", "corruptionLevel", ")", ".", ...
Corrupts the given input by doing a binomial sampling given the corruption level @param x the input to corrupt @param corruptionLevel the corruption value @return the binomial sampled corrupted input
[ "Corrupts", "the", "given", "input", "by", "doing", "a", "binomial", "sampling", "given", "the", "corruption", "level" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nn/src/main/java/org/deeplearning4j/nn/layers/BasePretrainNetwork.java#L61-L65
hazelcast/hazelcast
hazelcast-client/src/main/java/com/hazelcast/client/cache/impl/NearCachedClientCacheProxy.java
NearCachedClientCacheProxy.tryPublishReserved
private Object tryPublishReserved(Object key, Object remoteValue, long reservationId, boolean deserialize) { assert remoteValue != NOT_CACHED; // caching null value is not supported for ICache Near Cache if (remoteValue == null) { // needed to delete reserved record invalidateNearCache(key); return null; } Object cachedValue = null; if (reservationId != NOT_RESERVED) { cachedValue = nearCache.tryPublishReserved(key, remoteValue, reservationId, deserialize); } return cachedValue == null ? remoteValue : cachedValue; }
java
private Object tryPublishReserved(Object key, Object remoteValue, long reservationId, boolean deserialize) { assert remoteValue != NOT_CACHED; // caching null value is not supported for ICache Near Cache if (remoteValue == null) { // needed to delete reserved record invalidateNearCache(key); return null; } Object cachedValue = null; if (reservationId != NOT_RESERVED) { cachedValue = nearCache.tryPublishReserved(key, remoteValue, reservationId, deserialize); } return cachedValue == null ? remoteValue : cachedValue; }
[ "private", "Object", "tryPublishReserved", "(", "Object", "key", ",", "Object", "remoteValue", ",", "long", "reservationId", ",", "boolean", "deserialize", ")", "{", "assert", "remoteValue", "!=", "NOT_CACHED", ";", "// caching null value is not supported for ICache Near ...
Publishes value got from remote or deletes reserved record when remote value is {@code null}. @param key key to update in Near Cache @param remoteValue fetched value from server @param reservationId reservation ID for this key @param deserialize deserialize returned value @return last known value for the key
[ "Publishes", "value", "got", "from", "remote", "or", "deletes", "reserved", "record", "when", "remote", "value", "is", "{", "@code", "null", "}", "." ]
train
https://github.com/hazelcast/hazelcast/blob/8c4bc10515dbbfb41a33e0302c0caedf3cda1baf/hazelcast-client/src/main/java/com/hazelcast/client/cache/impl/NearCachedClientCacheProxy.java#L539-L554
mlhartme/jasmin
src/main/java/net/oneandone/jasmin/model/Engine.java
Engine.request
public int request(String path, HttpServletResponse response, boolean gzip) throws IOException { Content content; byte[] bytes; try { content = doRequest(path); } catch (IOException e) { Servlet.LOG.error("request failed: " + e.getMessage(), e); response.setStatus(500); response.setContentType("text/html"); try (Writer writer = response.getWriter()) { writer.write("<html><body><h1>" + e.getMessage() + "</h1>"); writer.write("<details><br/>"); printException(e, writer); writer.write("</body></html>"); } return -1; } if (gzip) { // see http://cs193h.stevesouders.com and "High Performance Websites", by Steve Souders response.setHeader("Content-Encoding", "gzip"); bytes = content.bytes; } else { bytes = unzip(content.bytes); } response.addHeader("Vary", "Accept-Encoding"); response.setBufferSize(0); response.setContentType(content.mimeType); response.setCharacterEncoding(ENCODING); // TODO: inspect header - does this have an effect? if (content.lastModified != -1) { response.setDateHeader("Last-Modified", content.lastModified); } response.getOutputStream().write(bytes); return bytes.length; }
java
public int request(String path, HttpServletResponse response, boolean gzip) throws IOException { Content content; byte[] bytes; try { content = doRequest(path); } catch (IOException e) { Servlet.LOG.error("request failed: " + e.getMessage(), e); response.setStatus(500); response.setContentType("text/html"); try (Writer writer = response.getWriter()) { writer.write("<html><body><h1>" + e.getMessage() + "</h1>"); writer.write("<details><br/>"); printException(e, writer); writer.write("</body></html>"); } return -1; } if (gzip) { // see http://cs193h.stevesouders.com and "High Performance Websites", by Steve Souders response.setHeader("Content-Encoding", "gzip"); bytes = content.bytes; } else { bytes = unzip(content.bytes); } response.addHeader("Vary", "Accept-Encoding"); response.setBufferSize(0); response.setContentType(content.mimeType); response.setCharacterEncoding(ENCODING); // TODO: inspect header - does this have an effect? if (content.lastModified != -1) { response.setDateHeader("Last-Modified", content.lastModified); } response.getOutputStream().write(bytes); return bytes.length; }
[ "public", "int", "request", "(", "String", "path", ",", "HttpServletResponse", "response", ",", "boolean", "gzip", ")", "throws", "IOException", "{", "Content", "content", ";", "byte", "[", "]", "bytes", ";", "try", "{", "content", "=", "doRequest", "(", "...
Output is prepared in-memory before the response is written because a) that's the common case where output is cached. If output is to big for this, that whole caching doesn't work b) I send sent proper error pages c) I can return the number of bytes actually written @return bytes written or -1 if building the module content failed.
[ "Output", "is", "prepared", "in", "-", "memory", "before", "the", "response", "is", "written", "because", "a", ")", "that", "s", "the", "common", "case", "where", "output", "is", "cached", ".", "If", "output", "is", "to", "big", "for", "this", "that", ...
train
https://github.com/mlhartme/jasmin/blob/1c44339a2555ae7ffb7d40fd3a7d80d81c3fc39d/src/main/java/net/oneandone/jasmin/model/Engine.java#L88-L122
sstrickx/yahoofinance-api
src/main/java/yahoofinance/Stock.java
Stock.getHistory
public List<HistoricalQuote> getHistory(Calendar from, Calendar to, Interval interval) throws IOException { if(YahooFinance.HISTQUOTES2_ENABLED.equalsIgnoreCase("true")) { HistQuotes2Request hist = new HistQuotes2Request(this.symbol, from, to, interval); this.setHistory(hist.getResult()); } else { HistQuotesRequest hist = new HistQuotesRequest(this.symbol, from, to, interval); this.setHistory(hist.getResult()); } return this.history; }
java
public List<HistoricalQuote> getHistory(Calendar from, Calendar to, Interval interval) throws IOException { if(YahooFinance.HISTQUOTES2_ENABLED.equalsIgnoreCase("true")) { HistQuotes2Request hist = new HistQuotes2Request(this.symbol, from, to, interval); this.setHistory(hist.getResult()); } else { HistQuotesRequest hist = new HistQuotesRequest(this.symbol, from, to, interval); this.setHistory(hist.getResult()); } return this.history; }
[ "public", "List", "<", "HistoricalQuote", ">", "getHistory", "(", "Calendar", "from", ",", "Calendar", "to", ",", "Interval", "interval", ")", "throws", "IOException", "{", "if", "(", "YahooFinance", ".", "HISTQUOTES2_ENABLED", ".", "equalsIgnoreCase", "(", "\"t...
Requests the historical quotes for this stock with the following characteristics. <ul> <li> from: specified value <li> to: specified value <li> interval: specified value </ul> @param from start date of the historical data @param to end date of the historical data @param interval the interval of the historical data @return a list of historical quotes from this stock @throws java.io.IOException when there's a connection problem @see #getHistory()
[ "Requests", "the", "historical", "quotes", "for", "this", "stock", "with", "the", "following", "characteristics", ".", "<ul", ">", "<li", ">", "from", ":", "specified", "value", "<li", ">", "to", ":", "specified", "value", "<li", ">", "interval", ":", "spe...
train
https://github.com/sstrickx/yahoofinance-api/blob/2766ba52fc5cccf9b4da5c06423d68059cf0a6e6/src/main/java/yahoofinance/Stock.java#L324-L333
MariaDB/mariadb-connector-j
src/main/java/org/mariadb/jdbc/internal/failover/thread/ConnectionValidator.java
ConnectionValidator.addListener
public void addListener(Listener listener, long listenerCheckMillis) { queue.add(listener); long newFrequency = Math.min(MINIMUM_CHECK_DELAY_MILLIS, listenerCheckMillis); //first listener if (currentScheduledFrequency.get() == -1) { if (currentScheduledFrequency.compareAndSet(-1, newFrequency)) { fixedSizedScheduler.schedule(checker, listenerCheckMillis, TimeUnit.MILLISECONDS); } } else { long frequency = currentScheduledFrequency.get(); if (frequency > newFrequency) { currentScheduledFrequency.compareAndSet(frequency, newFrequency); } } }
java
public void addListener(Listener listener, long listenerCheckMillis) { queue.add(listener); long newFrequency = Math.min(MINIMUM_CHECK_DELAY_MILLIS, listenerCheckMillis); //first listener if (currentScheduledFrequency.get() == -1) { if (currentScheduledFrequency.compareAndSet(-1, newFrequency)) { fixedSizedScheduler.schedule(checker, listenerCheckMillis, TimeUnit.MILLISECONDS); } } else { long frequency = currentScheduledFrequency.get(); if (frequency > newFrequency) { currentScheduledFrequency.compareAndSet(frequency, newFrequency); } } }
[ "public", "void", "addListener", "(", "Listener", "listener", ",", "long", "listenerCheckMillis", ")", "{", "queue", ".", "add", "(", "listener", ")", ";", "long", "newFrequency", "=", "Math", ".", "min", "(", "MINIMUM_CHECK_DELAY_MILLIS", ",", "listenerCheckMil...
Add listener to validation list. @param listener listener @param listenerCheckMillis schedule time
[ "Add", "listener", "to", "validation", "list", "." ]
train
https://github.com/MariaDB/mariadb-connector-j/blob/d148c7cd347c4680617be65d9e511b289d38a30b/src/main/java/org/mariadb/jdbc/internal/failover/thread/ConnectionValidator.java#L79-L96
Azure/azure-sdk-for-java
cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java
TrainingsImpl.deletePredictionAsync
public Observable<Void> deletePredictionAsync(UUID projectId, List<String> ids) { return deletePredictionWithServiceResponseAsync(projectId, ids).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
java
public Observable<Void> deletePredictionAsync(UUID projectId, List<String> ids) { return deletePredictionWithServiceResponseAsync(projectId, ids).map(new Func1<ServiceResponse<Void>, Void>() { @Override public Void call(ServiceResponse<Void> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Void", ">", "deletePredictionAsync", "(", "UUID", "projectId", ",", "List", "<", "String", ">", "ids", ")", "{", "return", "deletePredictionWithServiceResponseAsync", "(", "projectId", ",", "ids", ")", ".", "map", "(", "new", "Fun...
Delete a set of predicted images and their associated prediction results. @param projectId The project id @param ids The prediction ids. Limited to 64 @throws IllegalArgumentException thrown if parameters fail the validation @return the {@link ServiceResponse} object if successful.
[ "Delete", "a", "set", "of", "predicted", "images", "and", "their", "associated", "prediction", "results", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/cognitiveservices/data-plane/vision/customvision/training/src/main/java/com/microsoft/azure/cognitiveservices/vision/customvision/training/implementation/TrainingsImpl.java#L3111-L3118
JRebirth/JRebirth
org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/AbstractBaseParams.java
AbstractBaseParams.readDouble
protected double readDouble(final String doubleString, final double min, final double max) { return Math.max(Math.min(Double.parseDouble(doubleString), max), min); }
java
protected double readDouble(final String doubleString, final double min, final double max) { return Math.max(Math.min(Double.parseDouble(doubleString), max), min); }
[ "protected", "double", "readDouble", "(", "final", "String", "doubleString", ",", "final", "double", "min", ",", "final", "double", "max", ")", "{", "return", "Math", ".", "max", "(", "Math", ".", "min", "(", "Double", ".", "parseDouble", "(", "doubleStrin...
Read a double string value. @param doubleString the double value @param min the minimum value allowed @param max the maximum value allowed @return the value parsed according to its range
[ "Read", "a", "double", "string", "value", "." ]
train
https://github.com/JRebirth/JRebirth/blob/93f4fc087b83c73db540333b9686e97b4cec694d/org.jrebirth.af/core/src/main/java/org/jrebirth/af/core/resource/AbstractBaseParams.java#L153-L155
amaembo/streamex
src/main/java/one/util/streamex/LongStreamEx.java
LongStreamEx.chain
@Override public <U> U chain(Function<? super LongStreamEx, U> mapper) { return mapper.apply(this); }
java
@Override public <U> U chain(Function<? super LongStreamEx, U> mapper) { return mapper.apply(this); }
[ "@", "Override", "public", "<", "U", ">", "U", "chain", "(", "Function", "<", "?", "super", "LongStreamEx", ",", "U", ">", "mapper", ")", "{", "return", "mapper", ".", "apply", "(", "this", ")", ";", "}" ]
does not add overhead as it appears in bytecode anyways as bridge method
[ "does", "not", "add", "overhead", "as", "it", "appears", "in", "bytecode", "anyways", "as", "bridge", "method" ]
train
https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/LongStreamEx.java#L1535-L1538
google/closure-compiler
src/com/google/javascript/jscomp/Tracer.java
Tracer.longToPaddedString
private static String longToPaddedString(long v, int digitsColumnWidth) { int digitWidth = numDigits(v); StringBuilder sb = new StringBuilder(); appendSpaces(sb, digitsColumnWidth - digitWidth); sb.append(v); return sb.toString(); }
java
private static String longToPaddedString(long v, int digitsColumnWidth) { int digitWidth = numDigits(v); StringBuilder sb = new StringBuilder(); appendSpaces(sb, digitsColumnWidth - digitWidth); sb.append(v); return sb.toString(); }
[ "private", "static", "String", "longToPaddedString", "(", "long", "v", ",", "int", "digitsColumnWidth", ")", "{", "int", "digitWidth", "=", "numDigits", "(", "v", ")", ";", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "appendSpaces", "(...
Converts 'v' to a string and pads it with up to 16 spaces for improved alignment. @param v The value to convert. @param digitsColumnWidth The desired with of the string.
[ "Converts", "v", "to", "a", "string", "and", "pads", "it", "with", "up", "to", "16", "spaces", "for", "improved", "alignment", "." ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/Tracer.java#L295-L301
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/RandomUtil.java
RandomUtil.randomDay
public static DateTime randomDay(int min, int max) { return DateUtil.offsetDay(DateUtil.date(), randomInt(min, max)); }
java
public static DateTime randomDay(int min, int max) { return DateUtil.offsetDay(DateUtil.date(), randomInt(min, max)); }
[ "public", "static", "DateTime", "randomDay", "(", "int", "min", ",", "int", "max", ")", "{", "return", "DateUtil", ".", "offsetDay", "(", "DateUtil", ".", "date", "(", ")", ",", "randomInt", "(", "min", ",", "max", ")", ")", ";", "}" ]
以当天为基准,随机产生一个日期 @param min 偏移最小天,可以为负数表示过去的时间 @param max 偏移最大天,可以为负数表示过去的时间 @return 随机日期(随机天,其它时间不变) @since 4.0.8
[ "以当天为基准,随机产生一个日期" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/RandomUtil.java#L491-L493
JodaOrg/joda-time
src/main/java/org/joda/time/chrono/LimitChronology.java
LimitChronology.getInstance
public static LimitChronology getInstance(Chronology base, ReadableDateTime lowerLimit, ReadableDateTime upperLimit) { if (base == null) { throw new IllegalArgumentException("Must supply a chronology"); } lowerLimit = lowerLimit == null ? null : lowerLimit.toDateTime(); upperLimit = upperLimit == null ? null : upperLimit.toDateTime(); if (lowerLimit != null && upperLimit != null && !lowerLimit.isBefore(upperLimit)) { throw new IllegalArgumentException ("The lower limit must be come before than the upper limit"); } return new LimitChronology(base, (DateTime)lowerLimit, (DateTime)upperLimit); }
java
public static LimitChronology getInstance(Chronology base, ReadableDateTime lowerLimit, ReadableDateTime upperLimit) { if (base == null) { throw new IllegalArgumentException("Must supply a chronology"); } lowerLimit = lowerLimit == null ? null : lowerLimit.toDateTime(); upperLimit = upperLimit == null ? null : upperLimit.toDateTime(); if (lowerLimit != null && upperLimit != null && !lowerLimit.isBefore(upperLimit)) { throw new IllegalArgumentException ("The lower limit must be come before than the upper limit"); } return new LimitChronology(base, (DateTime)lowerLimit, (DateTime)upperLimit); }
[ "public", "static", "LimitChronology", "getInstance", "(", "Chronology", "base", ",", "ReadableDateTime", "lowerLimit", ",", "ReadableDateTime", "upperLimit", ")", "{", "if", "(", "base", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"...
Wraps another chronology, with datetime limits. When withUTC or withZone is called, the returned LimitChronology instance has the same limits, except they are time zone adjusted. @param base base chronology to wrap @param lowerLimit inclusive lower limit, or null if none @param upperLimit exclusive upper limit, or null if none @throws IllegalArgumentException if chronology is null or limits are invalid
[ "Wraps", "another", "chronology", "with", "datetime", "limits", ".", "When", "withUTC", "or", "withZone", "is", "called", "the", "returned", "LimitChronology", "instance", "has", "the", "same", "limits", "except", "they", "are", "time", "zone", "adjusted", "." ]
train
https://github.com/JodaOrg/joda-time/blob/bd79f1c4245e79b3c2c56d7b04fde2a6e191fa42/src/main/java/org/joda/time/chrono/LimitChronology.java#L64-L80
alibaba/vlayout
vlayout/src/main/java/com/alibaba/android/vlayout/LayoutHelper.java
LayoutHelper.setRange
public void setRange(int start, int end) { if (end < start) { throw new IllegalArgumentException("end should be larger or equeal then start position"); } if (start == -1 && end == -1) { this.mRange = RANGE_EMPTY; onRangeChange(start, end); return; } if ((end - start + 1) != getItemCount()) { throw new MismatchChildCountException("ItemCount mismatch when range: " + mRange.toString() + " childCount: " + getItemCount()); } if (start == mRange.getUpper() && end == mRange.getLower()) { // no change return; } this.mRange = Range.create(start, end); onRangeChange(start, end); }
java
public void setRange(int start, int end) { if (end < start) { throw new IllegalArgumentException("end should be larger or equeal then start position"); } if (start == -1 && end == -1) { this.mRange = RANGE_EMPTY; onRangeChange(start, end); return; } if ((end - start + 1) != getItemCount()) { throw new MismatchChildCountException("ItemCount mismatch when range: " + mRange.toString() + " childCount: " + getItemCount()); } if (start == mRange.getUpper() && end == mRange.getLower()) { // no change return; } this.mRange = Range.create(start, end); onRangeChange(start, end); }
[ "public", "void", "setRange", "(", "int", "start", ",", "int", "end", ")", "{", "if", "(", "end", "<", "start", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"end should be larger or equeal then start position\"", ")", ";", "}", "if", "(", "star...
Set range of items, which will be handled by this layoutHelper start position must be greater than end position, otherwise {@link IllegalArgumentException} will be thrown @param start start position of items handled by this layoutHelper @param end end position of items handled by this layoutHelper, if end < start, it will throw {@link IllegalArgumentException} @throws MismatchChildCountException when the (start - end) doesn't equal to itemCount
[ "Set", "range", "of", "items", "which", "will", "be", "handled", "by", "this", "layoutHelper", "start", "position", "must", "be", "greater", "than", "end", "position", "otherwise", "{", "@link", "IllegalArgumentException", "}", "will", "be", "thrown" ]
train
https://github.com/alibaba/vlayout/blob/8a5a51d9d2eeb91fed2ee331a4cf3496282452ce/vlayout/src/main/java/com/alibaba/android/vlayout/LayoutHelper.java#L83-L105
gallandarakhneorg/afc
core/vmutils/src/main/java/org/arakhne/afc/vmutil/Resources.java
Resources.getPropertyFile
@Pure @Inline(value = "Resources.getPropertyFile(($1).getClassLoader(), ($1), ($2))", imported = {Resources.class}) public static URL getPropertyFile(Class<?> classname, Locale locale) { return getPropertyFile(classname.getClassLoader(), classname, locale); }
java
@Pure @Inline(value = "Resources.getPropertyFile(($1).getClassLoader(), ($1), ($2))", imported = {Resources.class}) public static URL getPropertyFile(Class<?> classname, Locale locale) { return getPropertyFile(classname.getClassLoader(), classname, locale); }
[ "@", "Pure", "@", "Inline", "(", "value", "=", "\"Resources.getPropertyFile(($1).getClassLoader(), ($1), ($2))\"", ",", "imported", "=", "{", "Resources", ".", "class", "}", ")", "public", "static", "URL", "getPropertyFile", "(", "Class", "<", "?", ">", "classname...
Replies the URL of a property resource that is associated to the given class. @param classname is the class for which the property resource should be replied. @param locale is the expected localization of the resource file; or <code>null</code> for the default. @return the url of the property resource or <code>null</code> if the resource was not found in class paths. @since 7.0
[ "Replies", "the", "URL", "of", "a", "property", "resource", "that", "is", "associated", "to", "the", "given", "class", "." ]
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/Resources.java#L333-L337
googleapis/google-cloud-java
google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Watch.java
Watch.modifyDoc
@Nullable private DocumentChange modifyDoc(QueryDocumentSnapshot newDocument) { ResourcePath resourcePath = newDocument.getReference().getResourcePath(); DocumentSnapshot oldDocument = documentSet.getDocument(resourcePath); if (!oldDocument.getUpdateTime().equals(newDocument.getUpdateTime())) { int oldIndex = documentSet.indexOf(resourcePath); documentSet = documentSet.remove(resourcePath); documentSet = documentSet.add(newDocument); int newIndex = documentSet.indexOf(resourcePath); return new DocumentChange(newDocument, Type.MODIFIED, oldIndex, newIndex); } return null; }
java
@Nullable private DocumentChange modifyDoc(QueryDocumentSnapshot newDocument) { ResourcePath resourcePath = newDocument.getReference().getResourcePath(); DocumentSnapshot oldDocument = documentSet.getDocument(resourcePath); if (!oldDocument.getUpdateTime().equals(newDocument.getUpdateTime())) { int oldIndex = documentSet.indexOf(resourcePath); documentSet = documentSet.remove(resourcePath); documentSet = documentSet.add(newDocument); int newIndex = documentSet.indexOf(resourcePath); return new DocumentChange(newDocument, Type.MODIFIED, oldIndex, newIndex); } return null; }
[ "@", "Nullable", "private", "DocumentChange", "modifyDoc", "(", "QueryDocumentSnapshot", "newDocument", ")", "{", "ResourcePath", "resourcePath", "=", "newDocument", ".", "getReference", "(", ")", ".", "getResourcePath", "(", ")", ";", "DocumentSnapshot", "oldDocument...
Applies a document modification to the document tree. Returns the DocumentChange event for successful modifications.
[ "Applies", "a", "document", "modification", "to", "the", "document", "tree", ".", "Returns", "the", "DocumentChange", "event", "for", "successful", "modifications", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-firestore/src/main/java/com/google/cloud/firestore/Watch.java#L508-L521
mygreen/excel-cellformatter
src/main/java/com/github/mygreen/cellformatter/ConditionFormatterFactory.java
ConditionFormatterFactory.setupConditionLocaleSymbol
protected LocaleSymbol setupConditionLocaleSymbol(final ConditionFormatter formatter, final Token.Condition token) { final Matcher matcher = PATTERN_CONDITION_LOCALE_SYMBOL.matcher(token.getValue()); if(!matcher.matches()) { throw new IllegalArgumentException("not match condition:" + token.getValue()); } final String symbol = matcher.group(1); final String number = matcher.group(2); // 16進数=>10進数に直す final int value = Integer.valueOf(number, 16); MSLocale locale = MSLocale.createKnownLocale(value); if(locale == null) { locale = new MSLocale(value); } formatter.setLocale(locale); return new LocaleSymbol(locale, symbol); }
java
protected LocaleSymbol setupConditionLocaleSymbol(final ConditionFormatter formatter, final Token.Condition token) { final Matcher matcher = PATTERN_CONDITION_LOCALE_SYMBOL.matcher(token.getValue()); if(!matcher.matches()) { throw new IllegalArgumentException("not match condition:" + token.getValue()); } final String symbol = matcher.group(1); final String number = matcher.group(2); // 16進数=>10進数に直す final int value = Integer.valueOf(number, 16); MSLocale locale = MSLocale.createKnownLocale(value); if(locale == null) { locale = new MSLocale(value); } formatter.setLocale(locale); return new LocaleSymbol(locale, symbol); }
[ "protected", "LocaleSymbol", "setupConditionLocaleSymbol", "(", "final", "ConditionFormatter", "formatter", ",", "final", "Token", ".", "Condition", "token", ")", "{", "final", "Matcher", "matcher", "=", "PATTERN_CONDITION_LOCALE_SYMBOL", ".", "matcher", "(", "token", ...
{@literal '[$€-403]'}などの記号付きロケールの条件を組み立てる @since 0.8 @param formatter 現在の組み立て中のフォーマッタのインスタンス。 @param token 条件式のトークン。 @return 記号付きロケールの条件式。 @throws IllegalArgumentException 処理対象の条件として一致しない場合
[ "{" ]
train
https://github.com/mygreen/excel-cellformatter/blob/e802af273d49889500591e03799c9262cbf29185/src/main/java/com/github/mygreen/cellformatter/ConditionFormatterFactory.java#L201-L222
lessthanoptimal/BoofCV
main/boofcv-ip/src/main/java/boofcv/alg/distort/mls/ImageDeformPointMLS_F32.java
ImageDeformPointMLS_F32.add
public int add( float srcX , float srcY , float dstX , float dstY ) { int which = addControl(srcX,srcY); setUndistorted(which,dstX,dstY); return which; }
java
public int add( float srcX , float srcY , float dstX , float dstY ) { int which = addControl(srcX,srcY); setUndistorted(which,dstX,dstY); return which; }
[ "public", "int", "add", "(", "float", "srcX", ",", "float", "srcY", ",", "float", "dstX", ",", "float", "dstY", ")", "{", "int", "which", "=", "addControl", "(", "srcX", ",", "srcY", ")", ";", "setUndistorted", "(", "which", ",", "dstX", ",", "dstY",...
Function that let's you set control and undistorted points at the same time @param srcX distorted coordinate @param srcY distorted coordinate @param dstX undistorted coordinate @param dstY undistorted coordinate @return Index of control point
[ "Function", "that", "let", "s", "you", "set", "control", "and", "undistorted", "points", "at", "the", "same", "time" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-ip/src/main/java/boofcv/alg/distort/mls/ImageDeformPointMLS_F32.java#L164-L169
RestComm/jss7
mtp/mtp-impl/src/main/java/org/restcomm/protocols/ss7/mtp/util/MTPUtility.java
MTPUtility.writeRoutingLabel
public static void writeRoutingLabel(byte[] destination, int si, int ssi, int sls, int dpc, int opc) { // see Q.704.14.2 destination[0] = (byte) (((ssi & 0x0F) << 4) | (si & 0x0F)); destination[1] = (byte) dpc; destination[2] = (byte) (((dpc >> 8) & 0x3F) | ((opc & 0x03) << 6)); destination[3] = (byte) (opc >> 2); destination[4] = (byte) (((opc >> 10) & 0x0F) | ((sls & 0x0F) << 4)); // sif[4] = (byte) (((opc>> 10) & 0x0F) | ((0 & 0x0F) << 4)); }
java
public static void writeRoutingLabel(byte[] destination, int si, int ssi, int sls, int dpc, int opc) { // see Q.704.14.2 destination[0] = (byte) (((ssi & 0x0F) << 4) | (si & 0x0F)); destination[1] = (byte) dpc; destination[2] = (byte) (((dpc >> 8) & 0x3F) | ((opc & 0x03) << 6)); destination[3] = (byte) (opc >> 2); destination[4] = (byte) (((opc >> 10) & 0x0F) | ((sls & 0x0F) << 4)); // sif[4] = (byte) (((opc>> 10) & 0x0F) | ((0 & 0x0F) << 4)); }
[ "public", "static", "void", "writeRoutingLabel", "(", "byte", "[", "]", "destination", ",", "int", "si", ",", "int", "ssi", ",", "int", "sls", ",", "int", "dpc", ",", "int", "opc", ")", "{", "// see Q.704.14.2", "destination", "[", "0", "]", "=", "(", ...
Encodes routing label into passed byte[]. It has to be at least 5 bytes long! @param destination @param si @param ssi @param sls @param dpc @param opc
[ "Encodes", "routing", "label", "into", "passed", "byte", "[]", ".", "It", "has", "to", "be", "at", "least", "5", "bytes", "long!" ]
train
https://github.com/RestComm/jss7/blob/402b4b3984e581c581e309cb5f6a858fde6dbc33/mtp/mtp-impl/src/main/java/org/restcomm/protocols/ss7/mtp/util/MTPUtility.java#L110-L118
looly/hutool
hutool-db/src/main/java/cn/hutool/db/sql/SqlExecutor.java
SqlExecutor.executeUpdate
public static int executeUpdate(PreparedStatement ps, Object... params) throws SQLException { StatementUtil.fillParams(ps, params); return ps.executeUpdate(); }
java
public static int executeUpdate(PreparedStatement ps, Object... params) throws SQLException { StatementUtil.fillParams(ps, params); return ps.executeUpdate(); }
[ "public", "static", "int", "executeUpdate", "(", "PreparedStatement", "ps", ",", "Object", "...", "params", ")", "throws", "SQLException", "{", "StatementUtil", ".", "fillParams", "(", "ps", ",", "params", ")", ";", "return", "ps", ".", "executeUpdate", "(", ...
用于执行 INSERT、UPDATE 或 DELETE 语句以及 SQL DDL(数据定义语言)语句,例如 CREATE TABLE 和 DROP TABLE。<br> INSERT、UPDATE 或 DELETE 语句的效果是修改表中零行或多行中的一列或多列。<br> executeUpdate 的返回值是一个整数(int),指示受影响的行数(即更新计数)。<br> 对于 CREATE TABLE 或 DROP TABLE 等不操作行的语句,executeUpdate 的返回值总为零。<br> 此方法不会关闭PreparedStatement @param ps PreparedStatement对象 @param params 参数 @return 影响的行数 @throws SQLException SQL执行异常
[ "用于执行", "INSERT、UPDATE", "或", "DELETE", "语句以及", "SQL", "DDL(数据定义语言)语句,例如", "CREATE", "TABLE", "和", "DROP", "TABLE。<br", ">", "INSERT、UPDATE", "或", "DELETE", "语句的效果是修改表中零行或多行中的一列或多列。<br", ">", "executeUpdate", "的返回值是一个整数(int),指示受影响的行数(即更新计数)。<br", ">", "对于", "CREATE", "T...
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-db/src/main/java/cn/hutool/db/sql/SqlExecutor.java#L281-L284
jbundle/jbundle
base/remote/src/main/java/org/jbundle/base/remote/db/TableSession.java
TableSession.getGridTable
public GridTable getGridTable(Record gridRecord) { GridTable gridTable = null; if (!(gridRecord.getTable() instanceof GridTable)) { gridTable = new GridTable(null, gridRecord); boolean bCacheGrid = false; if (DBConstants.TRUE.equalsIgnoreCase(this.getProperty(CACHE_GRID_TABLE_PARAM))) bCacheGrid = true; gridTable.setCache(bCacheGrid); // Typically, the client is a gridscreen which caches the records (so I don't have to!) } gridTable = (GridTable)gridRecord.getTable(); return gridTable; }
java
public GridTable getGridTable(Record gridRecord) { GridTable gridTable = null; if (!(gridRecord.getTable() instanceof GridTable)) { gridTable = new GridTable(null, gridRecord); boolean bCacheGrid = false; if (DBConstants.TRUE.equalsIgnoreCase(this.getProperty(CACHE_GRID_TABLE_PARAM))) bCacheGrid = true; gridTable.setCache(bCacheGrid); // Typically, the client is a gridscreen which caches the records (so I don't have to!) } gridTable = (GridTable)gridRecord.getTable(); return gridTable; }
[ "public", "GridTable", "getGridTable", "(", "Record", "gridRecord", ")", "{", "GridTable", "gridTable", "=", "null", ";", "if", "(", "!", "(", "gridRecord", ".", "getTable", "(", ")", "instanceof", "GridTable", ")", ")", "{", "gridTable", "=", "new", "Grid...
Get the gridtable for this record (or create one if it doesn't exit). @param gridRecord The record to get/create a gridtable for. @return The gridtable.
[ "Get", "the", "gridtable", "for", "this", "record", "(", "or", "create", "one", "if", "it", "doesn", "t", "exit", ")", "." ]
train
https://github.com/jbundle/jbundle/blob/4037fcfa85f60c7d0096c453c1a3cd573c2b0abc/base/remote/src/main/java/org/jbundle/base/remote/db/TableSession.java#L694-L707
grails/gorm-hibernate5
grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsDomainBinder.java
GrailsDomainBinder.bindStringColumnConstraints
protected void bindStringColumnConstraints(Column column, PersistentProperty constrainedProperty) { final org.grails.datastore.mapping.config.Property mappedForm = constrainedProperty.getMapping().getMappedForm(); Number columnLength = mappedForm.getMaxSize(); List<?> inListValues = mappedForm.getInList(); if (columnLength != null) { column.setLength(columnLength.intValue()); } else if (inListValues != null) { column.setLength(getMaxSize(inListValues)); } }
java
protected void bindStringColumnConstraints(Column column, PersistentProperty constrainedProperty) { final org.grails.datastore.mapping.config.Property mappedForm = constrainedProperty.getMapping().getMappedForm(); Number columnLength = mappedForm.getMaxSize(); List<?> inListValues = mappedForm.getInList(); if (columnLength != null) { column.setLength(columnLength.intValue()); } else if (inListValues != null) { column.setLength(getMaxSize(inListValues)); } }
[ "protected", "void", "bindStringColumnConstraints", "(", "Column", "column", ",", "PersistentProperty", "constrainedProperty", ")", "{", "final", "org", ".", "grails", ".", "datastore", ".", "mapping", ".", "config", ".", "Property", "mappedForm", "=", "constrainedP...
Interrogates the specified constraints looking for any constraints that would limit the length of the property's value. If such constraints exist, this method adjusts the length of the column accordingly. @param column the column that corresponds to the property @param constrainedProperty the property's constraints
[ "Interrogates", "the", "specified", "constraints", "looking", "for", "any", "constraints", "that", "would", "limit", "the", "length", "of", "the", "property", "s", "value", ".", "If", "such", "constraints", "exist", "this", "method", "adjusts", "the", "length", ...
train
https://github.com/grails/gorm-hibernate5/blob/0ebb80cd769ef2bea955723d4543828a3e9542ef/grails-datastore-gorm-hibernate5/src/main/groovy/org/grails/orm/hibernate/cfg/GrailsDomainBinder.java#L3209-L3218
js-lib-com/commons
src/main/java/js/io/FilesOutputStream.java
FilesOutputStream.addFiles
public void addFiles(File baseDir) throws IOException { for (String file : FilesIterator.getRelativeNamesIterator(baseDir)) { addFileEntry(file, new FileInputStream(new File(baseDir, file))); } }
java
public void addFiles(File baseDir) throws IOException { for (String file : FilesIterator.getRelativeNamesIterator(baseDir)) { addFileEntry(file, new FileInputStream(new File(baseDir, file))); } }
[ "public", "void", "addFiles", "(", "File", "baseDir", ")", "throws", "IOException", "{", "for", "(", "String", "file", ":", "FilesIterator", ".", "getRelativeNamesIterator", "(", "baseDir", ")", ")", "{", "addFileEntry", "(", "file", ",", "new", "FileInputStre...
Add files hierarchy to this archive. Traverse all <code>baseDir</code> directory files, no matter how deep hierarchy is and delegate {@link #addFile(File)}. @param baseDir files hierarchy base directory. @throws IOException if archive writing operation fails.
[ "Add", "files", "hierarchy", "to", "this", "archive", ".", "Traverse", "all", "<code", ">", "baseDir<", "/", "code", ">", "directory", "files", "no", "matter", "how", "deep", "hierarchy", "is", "and", "delegate", "{", "@link", "#addFile", "(", "File", ")",...
train
https://github.com/js-lib-com/commons/blob/f8c64482142b163487745da74feb106f0765c16b/src/main/java/js/io/FilesOutputStream.java#L111-L115
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/SourceFile.java
SourceFile.getInputStreamFromOffset
public InputStream getInputStreamFromOffset(int offset) throws IOException { loadFileData(); return new ByteArrayInputStream(data, offset, data.length - offset); }
java
public InputStream getInputStreamFromOffset(int offset) throws IOException { loadFileData(); return new ByteArrayInputStream(data, offset, data.length - offset); }
[ "public", "InputStream", "getInputStreamFromOffset", "(", "int", "offset", ")", "throws", "IOException", "{", "loadFileData", "(", ")", ";", "return", "new", "ByteArrayInputStream", "(", "data", ",", "offset", ",", "data", ".", "length", "-", "offset", ")", ";...
Get an InputStream on data starting at given offset. @param offset the start offset @return an InputStream on the data in the source file, starting at the given offset
[ "Get", "an", "InputStream", "on", "data", "starting", "at", "given", "offset", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/SourceFile.java#L141-L144
actorapp/actor-platform
actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java
ImageLoading.loadBitmapOptimized
private static Bitmap loadBitmapOptimized(ImageSource source, int w, int h) throws ImageLoadException { int scale = getScaleFactor(source.getImageMetadata(), w, h); return loadBitmap(source, scale); }
java
private static Bitmap loadBitmapOptimized(ImageSource source, int w, int h) throws ImageLoadException { int scale = getScaleFactor(source.getImageMetadata(), w, h); return loadBitmap(source, scale); }
[ "private", "static", "Bitmap", "loadBitmapOptimized", "(", "ImageSource", "source", ",", "int", "w", ",", "int", "h", ")", "throws", "ImageLoadException", "{", "int", "scale", "=", "getScaleFactor", "(", "source", ".", "getImageMetadata", "(", ")", ",", "w", ...
Loading bitmap from ImageSource with limit of amout of pixels @param source image source @param w min width @param h min height @return loaded bitmap @throws ImageLoadException if it is unable to load image
[ "Loading", "bitmap", "from", "ImageSource", "with", "limit", "of", "amout", "of", "pixels" ]
train
https://github.com/actorapp/actor-platform/blob/5123c1584757c6eeea0ed2a0e7e043629871a0c6/actor-sdk/sdk-core-android/android-sdk/src/main/java/im/actor/sdk/util/images/ops/ImageLoading.java#L399-L402
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadLocalRandom.java
ThreadLocalRandom.doubles
public DoubleStream doubles(long streamSize, double randomNumberOrigin, double randomNumberBound) { if (streamSize < 0L) throw new IllegalArgumentException(BAD_SIZE); if (!(randomNumberOrigin < randomNumberBound)) throw new IllegalArgumentException(BAD_RANGE); return StreamSupport.doubleStream (new RandomDoublesSpliterator (0L, streamSize, randomNumberOrigin, randomNumberBound), false); }
java
public DoubleStream doubles(long streamSize, double randomNumberOrigin, double randomNumberBound) { if (streamSize < 0L) throw new IllegalArgumentException(BAD_SIZE); if (!(randomNumberOrigin < randomNumberBound)) throw new IllegalArgumentException(BAD_RANGE); return StreamSupport.doubleStream (new RandomDoublesSpliterator (0L, streamSize, randomNumberOrigin, randomNumberBound), false); }
[ "public", "DoubleStream", "doubles", "(", "long", "streamSize", ",", "double", "randomNumberOrigin", ",", "double", "randomNumberBound", ")", "{", "if", "(", "streamSize", "<", "0L", ")", "throw", "new", "IllegalArgumentException", "(", "BAD_SIZE", ")", ";", "if...
Returns a stream producing the given {@code streamSize} number of pseudorandom {@code double} values, each conforming to the given origin (inclusive) and bound (exclusive). @param streamSize the number of values to generate @param randomNumberOrigin the origin (inclusive) of each random value @param randomNumberBound the bound (exclusive) of each random value @return a stream of pseudorandom {@code double} values, each with the given origin (inclusive) and bound (exclusive) @throws IllegalArgumentException if {@code streamSize} is less than zero @throws IllegalArgumentException if {@code randomNumberOrigin} is greater than or equal to {@code randomNumberBound} @since 1.8
[ "Returns", "a", "stream", "producing", "the", "given", "{", "@code", "streamSize", "}", "number", "of", "pseudorandom", "{", "@code", "double", "}", "values", "each", "conforming", "to", "the", "given", "origin", "(", "inclusive", ")", "and", "bound", "(", ...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ThreadLocalRandom.java#L694-L704
osmdroid/osmdroid
osmdroid-android/src/main/java/org/osmdroid/tileprovider/cachemanager/CacheManager.java
CacheManager.downloadAreaAsyncNoUI
public CacheManagerTask downloadAreaAsyncNoUI(Context ctx, BoundingBox bb, final int zoomMin, final int zoomMax, final CacheManagerCallback callback) { final CacheManagerTask task = new CacheManagerTask(this, getDownloadingAction(), bb, zoomMin, zoomMax); task.addCallback(callback); execute(task); return task; }
java
public CacheManagerTask downloadAreaAsyncNoUI(Context ctx, BoundingBox bb, final int zoomMin, final int zoomMax, final CacheManagerCallback callback) { final CacheManagerTask task = new CacheManagerTask(this, getDownloadingAction(), bb, zoomMin, zoomMax); task.addCallback(callback); execute(task); return task; }
[ "public", "CacheManagerTask", "downloadAreaAsyncNoUI", "(", "Context", "ctx", ",", "BoundingBox", "bb", ",", "final", "int", "zoomMin", ",", "final", "int", "zoomMax", ",", "final", "CacheManagerCallback", "callback", ")", "{", "final", "CacheManagerTask", "task", ...
Download in background all tiles of the specified area in osmdroid cache without a user interface. @param ctx @param bb @param zoomMin @param zoomMax @since 5.3
[ "Download", "in", "background", "all", "tiles", "of", "the", "specified", "area", "in", "osmdroid", "cache", "without", "a", "user", "interface", "." ]
train
https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/tileprovider/cachemanager/CacheManager.java#L467-L472
pressgang-ccms/PressGangCCMSContentSpecProcessor
src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecParser.java
ContentSpecParser.processNewSpec
protected ParserResults processNewSpec(final ParserData parserData, final boolean processProcesses) { final String input = parserData.getLines().poll(); parserData.setLineCount(parserData.getLineCount() + 1); try { final Pair<String, String> keyValuePair = ProcessorUtilities.getAndValidateKeyValuePair(input); final String key = keyValuePair.getFirst(); final String value = keyValuePair.getSecond(); if (key.equalsIgnoreCase(CommonConstants.CS_TITLE_TITLE)) { parserData.getContentSpec().setTitle(value); // Process the rest of the spec now that we know the start is correct return processSpecContents(parserData, processProcesses); } else if (key.equalsIgnoreCase(CommonConstants.CS_CHECKSUM_TITLE)) { log.error(ProcessorConstants.ERROR_INCORRECT_NEW_MODE_MSG); return new ParserResults(false, null); } else { log.error(ProcessorConstants.ERROR_INCORRECT_FILE_FORMAT_MSG); return new ParserResults(false, null); } } catch (InvalidKeyValueException e) { log.error(ProcessorConstants.ERROR_INCORRECT_FILE_FORMAT_MSG, e); return new ParserResults(false, null); } }
java
protected ParserResults processNewSpec(final ParserData parserData, final boolean processProcesses) { final String input = parserData.getLines().poll(); parserData.setLineCount(parserData.getLineCount() + 1); try { final Pair<String, String> keyValuePair = ProcessorUtilities.getAndValidateKeyValuePair(input); final String key = keyValuePair.getFirst(); final String value = keyValuePair.getSecond(); if (key.equalsIgnoreCase(CommonConstants.CS_TITLE_TITLE)) { parserData.getContentSpec().setTitle(value); // Process the rest of the spec now that we know the start is correct return processSpecContents(parserData, processProcesses); } else if (key.equalsIgnoreCase(CommonConstants.CS_CHECKSUM_TITLE)) { log.error(ProcessorConstants.ERROR_INCORRECT_NEW_MODE_MSG); return new ParserResults(false, null); } else { log.error(ProcessorConstants.ERROR_INCORRECT_FILE_FORMAT_MSG); return new ParserResults(false, null); } } catch (InvalidKeyValueException e) { log.error(ProcessorConstants.ERROR_INCORRECT_FILE_FORMAT_MSG, e); return new ParserResults(false, null); } }
[ "protected", "ParserResults", "processNewSpec", "(", "final", "ParserData", "parserData", ",", "final", "boolean", "processProcesses", ")", "{", "final", "String", "input", "=", "parserData", ".", "getLines", "(", ")", ".", "poll", "(", ")", ";", "parserData", ...
Process a New Content Specification. That is that it should start with a Title, instead of a CHECKSUM and ID. @param parserData @param processProcesses If processes should be processed to populate the relationships. @return True if the content spec was processed successfully otherwise false.
[ "Process", "a", "New", "Content", "Specification", ".", "That", "is", "that", "it", "should", "start", "with", "a", "Title", "instead", "of", "a", "CHECKSUM", "and", "ID", "." ]
train
https://github.com/pressgang-ccms/PressGangCCMSContentSpecProcessor/blob/85ffac047c4ede0f972364ab1f03f7d61a4de5f1/src/main/java/org/jboss/pressgang/ccms/contentspec/processor/ContentSpecParser.java#L252-L277
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/WebhooksInner.java
WebhooksInner.getCallbackConfigAsync
public Observable<CallbackConfigInner> getCallbackConfigAsync(String resourceGroupName, String registryName, String webhookName) { return getCallbackConfigWithServiceResponseAsync(resourceGroupName, registryName, webhookName).map(new Func1<ServiceResponse<CallbackConfigInner>, CallbackConfigInner>() { @Override public CallbackConfigInner call(ServiceResponse<CallbackConfigInner> response) { return response.body(); } }); }
java
public Observable<CallbackConfigInner> getCallbackConfigAsync(String resourceGroupName, String registryName, String webhookName) { return getCallbackConfigWithServiceResponseAsync(resourceGroupName, registryName, webhookName).map(new Func1<ServiceResponse<CallbackConfigInner>, CallbackConfigInner>() { @Override public CallbackConfigInner call(ServiceResponse<CallbackConfigInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "CallbackConfigInner", ">", "getCallbackConfigAsync", "(", "String", "resourceGroupName", ",", "String", "registryName", ",", "String", "webhookName", ")", "{", "return", "getCallbackConfigWithServiceResponseAsync", "(", "resourceGroupName", ","...
Gets the configuration of service URI and custom headers for the webhook. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param webhookName The name of the webhook. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the CallbackConfigInner object
[ "Gets", "the", "configuration", "of", "service", "URI", "and", "custom", "headers", "for", "the", "webhook", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/WebhooksInner.java#L992-L999
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UCharacter.java
UCharacter.codePointAt
public static final int codePointAt(CharSequence seq, int index) { char c1 = seq.charAt(index++); if (isHighSurrogate(c1)) { if (index < seq.length()) { char c2 = seq.charAt(index); if (isLowSurrogate(c2)) { return toCodePoint(c1, c2); } } } return c1; }
java
public static final int codePointAt(CharSequence seq, int index) { char c1 = seq.charAt(index++); if (isHighSurrogate(c1)) { if (index < seq.length()) { char c2 = seq.charAt(index); if (isLowSurrogate(c2)) { return toCodePoint(c1, c2); } } } return c1; }
[ "public", "static", "final", "int", "codePointAt", "(", "CharSequence", "seq", ",", "int", "index", ")", "{", "char", "c1", "=", "seq", ".", "charAt", "(", "index", "++", ")", ";", "if", "(", "isHighSurrogate", "(", "c1", ")", ")", "{", "if", "(", ...
Same as {@link Character#codePointAt(CharSequence, int)}. Returns the code point at index. This examines only the characters at index and index+1. @param seq the characters to check @param index the index of the first or only char forming the code point @return the code point at the index
[ "Same", "as", "{", "@link", "Character#codePointAt", "(", "CharSequence", "int", ")", "}", ".", "Returns", "the", "code", "point", "at", "index", ".", "This", "examines", "only", "the", "characters", "at", "index", "and", "index", "+", "1", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UCharacter.java#L5322-L5333
spotbugs/spotbugs
spotbugs/src/main/java/edu/umd/cs/findbugs/ba/XFactory.java
XFactory.createXField
public static XField createXField(String className, Field field) { String fieldName = field.getName(); String fieldSig = field.getSignature(); XField xfield = getExactXField(className, fieldName, fieldSig, field.isStatic()); assert xfield.isResolved() : "Could not exactly resolve " + xfield; return xfield; }
java
public static XField createXField(String className, Field field) { String fieldName = field.getName(); String fieldSig = field.getSignature(); XField xfield = getExactXField(className, fieldName, fieldSig, field.isStatic()); assert xfield.isResolved() : "Could not exactly resolve " + xfield; return xfield; }
[ "public", "static", "XField", "createXField", "(", "String", "className", ",", "Field", "field", ")", "{", "String", "fieldName", "=", "field", ".", "getName", "(", ")", ";", "String", "fieldSig", "=", "field", ".", "getSignature", "(", ")", ";", "XField",...
Create an XField object from a BCEL Field. @param className the name of the Java class containing the field @param field the Field within the JavaClass @return the created XField
[ "Create", "an", "XField", "object", "from", "a", "BCEL", "Field", "." ]
train
https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/XFactory.java#L509-L516
codegist/crest
core/src/main/java/org/codegist/crest/CRestBuilder.java
CRestBuilder.bindSerializer
public CRestBuilder bindSerializer(Class<? extends Serializer> serializer, Class<?>[] classes, Map<String, Object> config){ classSerializerBuilder.register(serializer, classes, config); return this; }
java
public CRestBuilder bindSerializer(Class<? extends Serializer> serializer, Class<?>[] classes, Map<String, Object> config){ classSerializerBuilder.register(serializer, classes, config); return this; }
[ "public", "CRestBuilder", "bindSerializer", "(", "Class", "<", "?", "extends", "Serializer", ">", "serializer", ",", "Class", "<", "?", ">", "[", "]", "classes", ",", "Map", "<", "String", ",", "Object", ">", "config", ")", "{", "classSerializerBuilder", "...
<p>Binds a serializer to a list of interface method's parameter types</p> <p>By default, <b>CRest</b> handle the following types:</p> <ul> <li>java.util.Date</li> <li>java.lang.Boolean</li> <li>java.io.File</li> <li>java.io.InputStream</li> <li>java.io.Reader</li> </ul> <p>Meaning any interface method parameter type can be by default one of these types and be serialized properly.</p> @param serializer Serializer class to use to serialize the given interface method's parameter types @param classes Interface method's parameter types to bind the serializer to @param config State that will be passed to the serializer along with the CRestConfig object if the serializer has declared a single argument constructor with CRestConfig parameter type @return current builder @see CRestConfig#getDateFormat() @see CRestConfig#getBooleanTrue() @see CRestConfig#getBooleanFalse()
[ "<p", ">", "Binds", "a", "serializer", "to", "a", "list", "of", "interface", "method", "s", "parameter", "types<", "/", "p", ">", "<p", ">", "By", "default", "<b", ">", "CRest<", "/", "b", ">", "handle", "the", "following", "types", ":", "<", "/", ...
train
https://github.com/codegist/crest/blob/e99ba7728b27d2ddb2c247261350f1b6fa7a6698/core/src/main/java/org/codegist/crest/CRestBuilder.java#L611-L614
voldemort/voldemort
contrib/hadoop-store-builder/src/java/voldemort/store/readonly/mr/utils/HadoopUtils.java
HadoopUtils.getSanitizedPath
public static Path getSanitizedPath(FileSystem fs, Path directory) throws IOException { if(directory.getName().endsWith("#LATEST")) { // getparent strips out #LATEST return getLatestVersionedPath(fs, directory.getParent(), null); } return directory; }
java
public static Path getSanitizedPath(FileSystem fs, Path directory) throws IOException { if(directory.getName().endsWith("#LATEST")) { // getparent strips out #LATEST return getLatestVersionedPath(fs, directory.getParent(), null); } return directory; }
[ "public", "static", "Path", "getSanitizedPath", "(", "FileSystem", "fs", ",", "Path", "directory", ")", "throws", "IOException", "{", "if", "(", "directory", ".", "getName", "(", ")", ".", "endsWith", "(", "\"#LATEST\"", ")", ")", "{", "// getparent strips out...
Does the same thing as getLatestVersionedPath, but checks to see if the directory contains #LATEST. If it doesn't, it just returns what was passed in. @param fs @param directory @return @throws IOException
[ "Does", "the", "same", "thing", "as", "getLatestVersionedPath", "but", "checks", "to", "see", "if", "the", "directory", "contains", "#LATEST", ".", "If", "it", "doesn", "t", "it", "just", "returns", "what", "was", "passed", "in", "." ]
train
https://github.com/voldemort/voldemort/blob/a7dbdea58032021361680faacf2782cf981c5332/contrib/hadoop-store-builder/src/java/voldemort/store/readonly/mr/utils/HadoopUtils.java#L317-L324
maven-nar/nar-maven-plugin
src/main/java/com/github/maven_nar/cpptasks/openwatcom/OpenWatcomCompiler.java
OpenWatcomCompiler.getDefineSwitch
@Override protected final void getDefineSwitch(final StringBuffer buffer, final String define, final String value) { OpenWatcomProcessor.getDefineSwitch(buffer, define, value); }
java
@Override protected final void getDefineSwitch(final StringBuffer buffer, final String define, final String value) { OpenWatcomProcessor.getDefineSwitch(buffer, define, value); }
[ "@", "Override", "protected", "final", "void", "getDefineSwitch", "(", "final", "StringBuffer", "buffer", ",", "final", "String", "define", ",", "final", "String", "value", ")", "{", "OpenWatcomProcessor", ".", "getDefineSwitch", "(", "buffer", ",", "define", ",...
Get define switch. @param buffer StringBuffer buffer @param define String preprocessor macro @param value String value, may be null.
[ "Get", "define", "switch", "." ]
train
https://github.com/maven-nar/nar-maven-plugin/blob/3c622e2024296b4203431bbae3bde290a01dac00/src/main/java/com/github/maven_nar/cpptasks/openwatcom/OpenWatcomCompiler.java#L145-L148
kstateome/canvas-api
src/main/java/edu/ksu/canvas/CanvasApiFactory.java
CanvasApiFactory.getWriter
public <T extends CanvasWriter> T getWriter(Class<T> type, OauthToken oauthToken) { return getWriter(type, oauthToken, false); }
java
public <T extends CanvasWriter> T getWriter(Class<T> type, OauthToken oauthToken) { return getWriter(type, oauthToken, false); }
[ "public", "<", "T", "extends", "CanvasWriter", ">", "T", "getWriter", "(", "Class", "<", "T", ">", "type", ",", "OauthToken", "oauthToken", ")", "{", "return", "getWriter", "(", "type", ",", "oauthToken", ",", "false", ")", ";", "}" ]
Get a writer implementation to push data into Canvas. @param type Interface type you wish to get an implementation for @param oauthToken An OAuth token to use for authentication when making API calls @param <T> A writer implementation @return A writer implementation class
[ "Get", "a", "writer", "implementation", "to", "push", "data", "into", "Canvas", "." ]
train
https://github.com/kstateome/canvas-api/blob/426bf403a8fd7aca3f170348005feda25b374e5a/src/main/java/edu/ksu/canvas/CanvasApiFactory.java#L112-L114
CleverTap/clevertap-android-sdk
clevertap-android-sdk/src/main/java/com/clevertap/android/sdk/DBAdapter.java
DBAdapter.storeUserProfile
synchronized long storeUserProfile(String id, JSONObject obj) { if (id == null) return DB_UPDATE_ERROR; if (!this.belowMemThreshold()) { getConfigLogger().verbose("There is not enough space left on the device to store data, data discarded"); return DB_OUT_OF_MEMORY_ERROR; } final String tableName = Table.USER_PROFILES.getName(); long ret = DB_UPDATE_ERROR; try { final SQLiteDatabase db = dbHelper.getWritableDatabase(); final ContentValues cv = new ContentValues(); cv.put(KEY_DATA, obj.toString()); cv.put("_id", id); ret = db.insertWithOnConflict(tableName, null, cv, SQLiteDatabase.CONFLICT_REPLACE); } catch (final SQLiteException e) { getConfigLogger().verbose("Error adding data to table " + tableName + " Recreating DB"); dbHelper.deleteDatabase(); } finally { dbHelper.close(); } return ret; }
java
synchronized long storeUserProfile(String id, JSONObject obj) { if (id == null) return DB_UPDATE_ERROR; if (!this.belowMemThreshold()) { getConfigLogger().verbose("There is not enough space left on the device to store data, data discarded"); return DB_OUT_OF_MEMORY_ERROR; } final String tableName = Table.USER_PROFILES.getName(); long ret = DB_UPDATE_ERROR; try { final SQLiteDatabase db = dbHelper.getWritableDatabase(); final ContentValues cv = new ContentValues(); cv.put(KEY_DATA, obj.toString()); cv.put("_id", id); ret = db.insertWithOnConflict(tableName, null, cv, SQLiteDatabase.CONFLICT_REPLACE); } catch (final SQLiteException e) { getConfigLogger().verbose("Error adding data to table " + tableName + " Recreating DB"); dbHelper.deleteDatabase(); } finally { dbHelper.close(); } return ret; }
[ "synchronized", "long", "storeUserProfile", "(", "String", "id", ",", "JSONObject", "obj", ")", "{", "if", "(", "id", "==", "null", ")", "return", "DB_UPDATE_ERROR", ";", "if", "(", "!", "this", ".", "belowMemThreshold", "(", ")", ")", "{", "getConfigLogge...
Adds a JSON string representing to the DB. @param obj the JSON to record @return the number of rows in the table, or DB_OUT_OF_MEMORY_ERROR/DB_UPDATE_ERROR
[ "Adds", "a", "JSON", "string", "representing", "to", "the", "DB", "." ]
train
https://github.com/CleverTap/clevertap-android-sdk/blob/be134c06a4f07494c398335ad9ff4976633743e1/clevertap-android-sdk/src/main/java/com/clevertap/android/sdk/DBAdapter.java#L254-L280
google/closure-compiler
src/com/google/javascript/jscomp/parsing/TypeTransformationParser.java
TypeTransformationParser.validTemplateTypeExpression
private boolean validTemplateTypeExpression(Node expr) { // The expression must have at least three children the type keyword, // a type name (or type variable) and a type expression if (!checkParameterCount(expr, Keywords.TYPE)) { return false; } int paramCount = getCallParamCount(expr); // The first parameter must be a type variable or a type name Node firstParam = getCallArgument(expr, 0); if (!isTypeVar(firstParam) && !isTypeName(firstParam)) { warnInvalid("type name or type variable", expr); warnInvalidInside("template type operation", expr); return false; } // The rest of the parameters must be valid type expressions for (int i = 1; i < paramCount; i++) { if (!validTypeTransformationExpression(getCallArgument(expr, i))) { warnInvalidInside("template type operation", expr); return false; } } return true; }
java
private boolean validTemplateTypeExpression(Node expr) { // The expression must have at least three children the type keyword, // a type name (or type variable) and a type expression if (!checkParameterCount(expr, Keywords.TYPE)) { return false; } int paramCount = getCallParamCount(expr); // The first parameter must be a type variable or a type name Node firstParam = getCallArgument(expr, 0); if (!isTypeVar(firstParam) && !isTypeName(firstParam)) { warnInvalid("type name or type variable", expr); warnInvalidInside("template type operation", expr); return false; } // The rest of the parameters must be valid type expressions for (int i = 1; i < paramCount; i++) { if (!validTypeTransformationExpression(getCallArgument(expr, i))) { warnInvalidInside("template type operation", expr); return false; } } return true; }
[ "private", "boolean", "validTemplateTypeExpression", "(", "Node", "expr", ")", "{", "// The expression must have at least three children the type keyword,", "// a type name (or type variable) and a type expression", "if", "(", "!", "checkParameterCount", "(", "expr", ",", "Keywords...
A template type expression must be of the form type(typename, TTLExp,...) or type(typevar, TTLExp...)
[ "A", "template", "type", "expression", "must", "be", "of", "the", "form", "type", "(", "typename", "TTLExp", "...", ")", "or", "type", "(", "typevar", "TTLExp", "...", ")" ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/parsing/TypeTransformationParser.java#L292-L314
mikepenz/FastAdapter
library/src/main/java/com/mikepenz/fastadapter/commons/utils/FastAdapterUIUtils.java
FastAdapterUIUtils.getRippleMask
private static Drawable getRippleMask(int color, int radius) { float[] outerRadius = new float[8]; Arrays.fill(outerRadius, radius); RoundRectShape r = new RoundRectShape(outerRadius, null, null); ShapeDrawable shapeDrawable = new ShapeDrawable(r); shapeDrawable.getPaint().setColor(color); return shapeDrawable; }
java
private static Drawable getRippleMask(int color, int radius) { float[] outerRadius = new float[8]; Arrays.fill(outerRadius, radius); RoundRectShape r = new RoundRectShape(outerRadius, null, null); ShapeDrawable shapeDrawable = new ShapeDrawable(r); shapeDrawable.getPaint().setColor(color); return shapeDrawable; }
[ "private", "static", "Drawable", "getRippleMask", "(", "int", "color", ",", "int", "radius", ")", "{", "float", "[", "]", "outerRadius", "=", "new", "float", "[", "8", "]", ";", "Arrays", ".", "fill", "(", "outerRadius", ",", "radius", ")", ";", "Round...
helper to create an ripple mask with the given color and radius @param color the color @param radius the radius @return the mask drawable
[ "helper", "to", "create", "an", "ripple", "mask", "with", "the", "given", "color", "and", "radius" ]
train
https://github.com/mikepenz/FastAdapter/blob/3b2412abe001ba58422e0125846b704d4dba4ae9/library/src/main/java/com/mikepenz/fastadapter/commons/utils/FastAdapterUIUtils.java#L117-L124
OpenTSDB/opentsdb
src/tree/Tree.java
Tree.storeTree
public Deferred<Boolean> storeTree(final TSDB tsdb, final boolean overwrite) { if (tree_id < 1 || tree_id > 65535) { throw new IllegalArgumentException("Invalid Tree ID"); } // if there aren't any changes, save time and bandwidth by not writing to // storage boolean has_changes = false; for (Map.Entry<String, Boolean> entry : changed.entrySet()) { if (entry.getValue()) { has_changes = true; break; } } if (!has_changes) { LOG.debug(this + " does not have changes, skipping sync to storage"); throw new IllegalStateException("No changes detected in the tree"); } /** * Callback executed after loading a tree from storage so that we can * synchronize changes to the meta data and write them back to storage. */ final class StoreTreeCB implements Callback<Deferred<Boolean>, Tree> { final private Tree local_tree; public StoreTreeCB(final Tree local_tree) { this.local_tree = local_tree; } /** * Synchronizes the stored tree object (if found) with the local tree * and issues a CAS call to write the update to storage. * @return True if the CAS was successful, false if something changed * in flight */ @Override public Deferred<Boolean> call(final Tree fetched_tree) throws Exception { Tree stored_tree = fetched_tree; final byte[] original_tree = stored_tree == null ? new byte[0] : stored_tree.toStorageJson(); // now copy changes if (stored_tree == null) { stored_tree = local_tree; } else { stored_tree.copyChanges(local_tree, overwrite); } // reset the change map so we don't keep writing initializeChangedMap(); final PutRequest put = new PutRequest(tsdb.treeTable(), Tree.idToBytes(tree_id), TREE_FAMILY, TREE_QUALIFIER, stored_tree.toStorageJson()); return tsdb.getClient().compareAndSet(put, original_tree); } } // initiate the sync by attempting to fetch an existing tree from storage return fetchTree(tsdb, tree_id).addCallbackDeferring(new StoreTreeCB(this)); }
java
public Deferred<Boolean> storeTree(final TSDB tsdb, final boolean overwrite) { if (tree_id < 1 || tree_id > 65535) { throw new IllegalArgumentException("Invalid Tree ID"); } // if there aren't any changes, save time and bandwidth by not writing to // storage boolean has_changes = false; for (Map.Entry<String, Boolean> entry : changed.entrySet()) { if (entry.getValue()) { has_changes = true; break; } } if (!has_changes) { LOG.debug(this + " does not have changes, skipping sync to storage"); throw new IllegalStateException("No changes detected in the tree"); } /** * Callback executed after loading a tree from storage so that we can * synchronize changes to the meta data and write them back to storage. */ final class StoreTreeCB implements Callback<Deferred<Boolean>, Tree> { final private Tree local_tree; public StoreTreeCB(final Tree local_tree) { this.local_tree = local_tree; } /** * Synchronizes the stored tree object (if found) with the local tree * and issues a CAS call to write the update to storage. * @return True if the CAS was successful, false if something changed * in flight */ @Override public Deferred<Boolean> call(final Tree fetched_tree) throws Exception { Tree stored_tree = fetched_tree; final byte[] original_tree = stored_tree == null ? new byte[0] : stored_tree.toStorageJson(); // now copy changes if (stored_tree == null) { stored_tree = local_tree; } else { stored_tree.copyChanges(local_tree, overwrite); } // reset the change map so we don't keep writing initializeChangedMap(); final PutRequest put = new PutRequest(tsdb.treeTable(), Tree.idToBytes(tree_id), TREE_FAMILY, TREE_QUALIFIER, stored_tree.toStorageJson()); return tsdb.getClient().compareAndSet(put, original_tree); } } // initiate the sync by attempting to fetch an existing tree from storage return fetchTree(tsdb, tree_id).addCallbackDeferring(new StoreTreeCB(this)); }
[ "public", "Deferred", "<", "Boolean", ">", "storeTree", "(", "final", "TSDB", "tsdb", ",", "final", "boolean", "overwrite", ")", "{", "if", "(", "tree_id", "<", "1", "||", "tree_id", ">", "65535", ")", "{", "throw", "new", "IllegalArgumentException", "(", ...
Attempts to store the tree definition via a CompareAndSet call. @param tsdb The TSDB to use for access @param overwrite Whether or not tree data should be overwritten @return True if the write was successful, false if an error occurred @throws IllegalArgumentException if the tree ID is missing or invalid @throws HBaseException if a storage exception occurred
[ "Attempts", "to", "store", "the", "tree", "definition", "via", "a", "CompareAndSet", "call", "." ]
train
https://github.com/OpenTSDB/opentsdb/blob/3fc2d491c3c1ad397252c0a80203a69a3f9e3ef3/src/tree/Tree.java#L312-L375
elki-project/elki
elki-gui-minigui/src/main/java/de/lmu/ifi/dbs/elki/gui/util/SavedSettingsFile.java
SavedSettingsFile.put
public void put(String key, ArrayList<String> value) { Iterator<Pair<String, ArrayList<String>>> it = store.iterator(); while (it.hasNext()) { Pair<String, ArrayList<String>> pair = it.next(); if (key.equals(pair.first)) { pair.second = value; return; } } store.add(new Pair<>(key, value)); }
java
public void put(String key, ArrayList<String> value) { Iterator<Pair<String, ArrayList<String>>> it = store.iterator(); while (it.hasNext()) { Pair<String, ArrayList<String>> pair = it.next(); if (key.equals(pair.first)) { pair.second = value; return; } } store.add(new Pair<>(key, value)); }
[ "public", "void", "put", "(", "String", "key", ",", "ArrayList", "<", "String", ">", "value", ")", "{", "Iterator", "<", "Pair", "<", "String", ",", "ArrayList", "<", "String", ">", ">", ">", "it", "=", "store", ".", "iterator", "(", ")", ";", "whi...
Add/Replace a saved setting @param key Key @param value (New) value.
[ "Add", "/", "Replace", "a", "saved", "setting" ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-gui-minigui/src/main/java/de/lmu/ifi/dbs/elki/gui/util/SavedSettingsFile.java#L168-L178
UrielCh/ovh-java-sdk
ovh-java-sdk-paastimeseries/src/main/java/net/minidev/ovh/api/ApiOvhPaastimeseries.java
ApiOvhPaastimeseries.serviceName_PUT
public void serviceName_PUT(String serviceName, net.minidev.ovh.api.timeseries.OvhProject body) throws IOException { String qPath = "/paas/timeseries/{serviceName}"; StringBuilder sb = path(qPath, serviceName); exec(qPath, "PUT", sb.toString(), body); }
java
public void serviceName_PUT(String serviceName, net.minidev.ovh.api.timeseries.OvhProject body) throws IOException { String qPath = "/paas/timeseries/{serviceName}"; StringBuilder sb = path(qPath, serviceName); exec(qPath, "PUT", sb.toString(), body); }
[ "public", "void", "serviceName_PUT", "(", "String", "serviceName", ",", "net", ".", "minidev", ".", "ovh", ".", "api", ".", "timeseries", ".", "OvhProject", "body", ")", "throws", "IOException", "{", "String", "qPath", "=", "\"/paas/timeseries/{serviceName}\"", ...
Alter this object properties REST: PUT /paas/timeseries/{serviceName} @param body [required] New object properties @param serviceName [required] The internal name of your timeseries project @deprecated
[ "Alter", "this", "object", "properties" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-paastimeseries/src/main/java/net/minidev/ovh/api/ApiOvhPaastimeseries.java#L228-L232
davidmoten/rxjava-extras
src/main/java/com/github/davidmoten/rx/Transformers.java
Transformers.bufferWhile
public static final <T> Transformer<T, List<T>> bufferWhile( Func1<? super T, Boolean> predicate) { return bufferWhile(predicate, 10); }
java
public static final <T> Transformer<T, List<T>> bufferWhile( Func1<? super T, Boolean> predicate) { return bufferWhile(predicate, 10); }
[ "public", "static", "final", "<", "T", ">", "Transformer", "<", "T", ",", "List", "<", "T", ">", ">", "bufferWhile", "(", "Func1", "<", "?", "super", "T", ",", "Boolean", ">", "predicate", ")", "{", "return", "bufferWhile", "(", "predicate", ",", "10...
Buffers the elements into continuous, non-overlapping Lists where the boundary is determined by a predicate receiving each item, before or after being buffered, and returns true to indicate a new buffer should start. <p> The operator won't return an empty first or last buffer. <dl> <dt><b>Backpressure Support:</b></dt> <dd>This operator supports backpressure.</dd> <dt><b>Scheduler:</b></dt> <dd>This operator does not operate by default on a particular {@link Scheduler}.</dd> </dl> @param <T> the input value type @param predicate the Func1 that receives each item, before being buffered, and should return true to indicate a new buffer has to start. @return the new Observable instance @see #bufferWhile(Func1) @since (if this graduates from Experimental/Beta to supported, replace this parenthetical with the release number)
[ "Buffers", "the", "elements", "into", "continuous", "non", "-", "overlapping", "Lists", "where", "the", "boundary", "is", "determined", "by", "a", "predicate", "receiving", "each", "item", "before", "or", "after", "being", "buffered", "and", "returns", "true", ...
train
https://github.com/davidmoten/rxjava-extras/blob/a91d2ba7d454843250e0b0fce36084f9fb02a551/src/main/java/com/github/davidmoten/rx/Transformers.java#L1180-L1183
google/closure-compiler
src/com/google/javascript/jscomp/NodeUtil.java
NodeUtil.replaceDeclarationChild
public static void replaceDeclarationChild(Node declChild, Node newStatement) { checkArgument(isNameDeclaration(declChild.getParent())); checkArgument(null == newStatement.getParent()); Node decl = declChild.getParent(); Node declParent = decl.getParent(); if (decl.hasOneChild()) { declParent.replaceChild(decl, newStatement); } else if (declChild.getNext() == null) { decl.removeChild(declChild); declParent.addChildAfter(newStatement, decl); } else if (declChild.getPrevious() == null) { decl.removeChild(declChild); declParent.addChildBefore(newStatement, decl); } else { checkState(decl.hasMoreThanOneChild()); Node newDecl = new Node(decl.getToken()).srcref(decl); for (Node after = declChild.getNext(), next; after != null; after = next) { next = after.getNext(); newDecl.addChildToBack(after.detach()); } decl.removeChild(declChild); declParent.addChildAfter(newStatement, decl); declParent.addChildAfter(newDecl, newStatement); } }
java
public static void replaceDeclarationChild(Node declChild, Node newStatement) { checkArgument(isNameDeclaration(declChild.getParent())); checkArgument(null == newStatement.getParent()); Node decl = declChild.getParent(); Node declParent = decl.getParent(); if (decl.hasOneChild()) { declParent.replaceChild(decl, newStatement); } else if (declChild.getNext() == null) { decl.removeChild(declChild); declParent.addChildAfter(newStatement, decl); } else if (declChild.getPrevious() == null) { decl.removeChild(declChild); declParent.addChildBefore(newStatement, decl); } else { checkState(decl.hasMoreThanOneChild()); Node newDecl = new Node(decl.getToken()).srcref(decl); for (Node after = declChild.getNext(), next; after != null; after = next) { next = after.getNext(); newDecl.addChildToBack(after.detach()); } decl.removeChild(declChild); declParent.addChildAfter(newStatement, decl); declParent.addChildAfter(newDecl, newStatement); } }
[ "public", "static", "void", "replaceDeclarationChild", "(", "Node", "declChild", ",", "Node", "newStatement", ")", "{", "checkArgument", "(", "isNameDeclaration", "(", "declChild", ".", "getParent", "(", ")", ")", ")", ";", "checkArgument", "(", "null", "==", ...
Replace the child of a var/let/const declaration (usually a name) with a new statement. Preserves the order of side effects for all the other declaration children. @param declChild The name node to be replaced. @param newStatement The statement to replace with.
[ "Replace", "the", "child", "of", "a", "var", "/", "let", "/", "const", "declaration", "(", "usually", "a", "name", ")", "with", "a", "new", "statement", ".", "Preserves", "the", "order", "of", "side", "effects", "for", "all", "the", "other", "declaration...
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/NodeUtil.java#L2879-L2904
google/closure-templates
java/src/com/google/template/soy/parsepasses/contextautoesc/InferenceEngine.java
InferenceEngine.inferTemplateEndContext
public static Context inferTemplateEndContext( TemplateNode templateNode, Context startContext, Inferences inferences, ErrorReporter errorReporter) { InferenceEngine inferenceEngine = new InferenceEngine(inferences, errorReporter); // Context started off as startContext and we have propagated context through all of // template's children, so now return the template's end context. return inferenceEngine.infer(templateNode, startContext); }
java
public static Context inferTemplateEndContext( TemplateNode templateNode, Context startContext, Inferences inferences, ErrorReporter errorReporter) { InferenceEngine inferenceEngine = new InferenceEngine(inferences, errorReporter); // Context started off as startContext and we have propagated context through all of // template's children, so now return the template's end context. return inferenceEngine.infer(templateNode, startContext); }
[ "public", "static", "Context", "inferTemplateEndContext", "(", "TemplateNode", "templateNode", ",", "Context", "startContext", ",", "Inferences", "inferences", ",", "ErrorReporter", "errorReporter", ")", "{", "InferenceEngine", "inferenceEngine", "=", "new", "InferenceEng...
Infer an end context for the given template and, if requested, choose escaping directives for any <code>{print}</code>. @param templateNode A template that is visited in {@code startContext} and no other. If a template can be reached from multiple contexts, then it should be cloned. This class automatically does that for called templates. @param inferences Receives all suggested changes and inferences to tn. @return The end context when the given template is reached from {@code startContext}.
[ "Infer", "an", "end", "context", "for", "the", "given", "template", "and", "if", "requested", "choose", "escaping", "directives", "for", "any", "<code", ">", "{", "print", "}", "<", "/", "code", ">", "." ]
train
https://github.com/google/closure-templates/blob/cc61e1dff70ae97f24f417a57410081bc498bd56/java/src/com/google/template/soy/parsepasses/contextautoesc/InferenceEngine.java#L97-L106
lightblueseas/swing-components
src/main/java/de/alpharogroup/swing/menu/MenuExtensions.java
MenuExtensions.setAccelerator
public static void setAccelerator(final JMenuItem jmi, final String parsableKeystrokeString) { jmi.setAccelerator(KeyStroke.getKeyStroke(parsableKeystrokeString)); }
java
public static void setAccelerator(final JMenuItem jmi, final String parsableKeystrokeString) { jmi.setAccelerator(KeyStroke.getKeyStroke(parsableKeystrokeString)); }
[ "public", "static", "void", "setAccelerator", "(", "final", "JMenuItem", "jmi", ",", "final", "String", "parsableKeystrokeString", ")", "{", "jmi", ".", "setAccelerator", "(", "KeyStroke", ".", "getKeyStroke", "(", "parsableKeystrokeString", ")", ")", ";", "}" ]
Sets the accelerator for the given menuitem and the given parsable keystroke string. @param jmi The JMenuItem. @param parsableKeystrokeString the parsable keystroke string
[ "Sets", "the", "accelerator", "for", "the", "given", "menuitem", "and", "the", "given", "parsable", "keystroke", "string", "." ]
train
https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/menu/MenuExtensions.java#L108-L111
xwiki/xwiki-commons
xwiki-commons-core/xwiki-commons-job/src/main/java/org/xwiki/job/internal/DefaultJobProgressStep.java
DefaultJobProgressStep.addLevel
public DefaultJobProgressStep addLevel(int steps, Object newLevelSource, boolean levelStep) { assertModifiable(); this.maximumChildren = steps; this.levelSource = newLevelSource; if (steps > 0) { this.childSize = 1.0D / steps; } if (this.maximumChildren > 0) { this.children = new ArrayList<>(this.maximumChildren); } else { this.children = new ArrayList<>(); } this.levelStep = levelStep; // Create a virtual child return new DefaultJobProgressStep(null, newLevelSource, this); }
java
public DefaultJobProgressStep addLevel(int steps, Object newLevelSource, boolean levelStep) { assertModifiable(); this.maximumChildren = steps; this.levelSource = newLevelSource; if (steps > 0) { this.childSize = 1.0D / steps; } if (this.maximumChildren > 0) { this.children = new ArrayList<>(this.maximumChildren); } else { this.children = new ArrayList<>(); } this.levelStep = levelStep; // Create a virtual child return new DefaultJobProgressStep(null, newLevelSource, this); }
[ "public", "DefaultJobProgressStep", "addLevel", "(", "int", "steps", ",", "Object", "newLevelSource", ",", "boolean", "levelStep", ")", "{", "assertModifiable", "(", ")", ";", "this", ".", "maximumChildren", "=", "steps", ";", "this", ".", "levelSource", "=", ...
Add children to the step and return the first one. @param steps the number of step @param newLevelSource who asked to create this new level @param levelStep the new level can contains only one step @return the new step
[ "Add", "children", "to", "the", "step", "and", "return", "the", "first", "one", "." ]
train
https://github.com/xwiki/xwiki-commons/blob/5374d8c6d966588c1eac7392c83da610dfb9f129/xwiki-commons-core/xwiki-commons-job/src/main/java/org/xwiki/job/internal/DefaultJobProgressStep.java#L183-L204
pushbit/sprockets
src/main/java/net/sf/sprockets/sql/SQLite.java
SQLite.groupConcat
public static String groupConcat(String column, String separator) { return groupConcat(column, separator, aliased(column)); }
java
public static String groupConcat(String column, String separator) { return groupConcat(column, separator, aliased(column)); }
[ "public", "static", "String", "groupConcat", "(", "String", "column", ",", "String", "separator", ")", "{", "return", "groupConcat", "(", "column", ",", "separator", ",", "aliased", "(", "column", ")", ")", ";", "}" ]
Get an {@link #aliased(String) aliased} group_concat(column) with the separator. @since 2.4.0
[ "Get", "an", "{", "@link", "#aliased", "(", "String", ")", "aliased", "}", "group_concat", "(", "column", ")", "with", "the", "separator", "." ]
train
https://github.com/pushbit/sprockets/blob/5d967317cbb2374c69d33271d3c7b7311e1ea4ac/src/main/java/net/sf/sprockets/sql/SQLite.java#L212-L214
landawn/AbacusUtil
src/com/landawn/abacus/util/Matth.java
Matth.subtractExact
public static int subtractExact(int a, int b) { long result = (long) a - b; checkNoOverflow(result == (int) result); return (int) result; }
java
public static int subtractExact(int a, int b) { long result = (long) a - b; checkNoOverflow(result == (int) result); return (int) result; }
[ "public", "static", "int", "subtractExact", "(", "int", "a", ",", "int", "b", ")", "{", "long", "result", "=", "(", "long", ")", "a", "-", "b", ";", "checkNoOverflow", "(", "result", "==", "(", "int", ")", "result", ")", ";", "return", "(", "int", ...
Returns the difference of {@code a} and {@code b}, provided it does not overflow. @throws ArithmeticException if {@code a - b} overflows in signed {@code int} arithmetic
[ "Returns", "the", "difference", "of", "{", "@code", "a", "}", "and", "{", "@code", "b", "}", "provided", "it", "does", "not", "overflow", "." ]
train
https://github.com/landawn/AbacusUtil/blob/544b7720175d15e9329f83dd22a8cc5fa4515e12/src/com/landawn/abacus/util/Matth.java#L1393-L1397
cdk/cdk
base/standard/src/main/java/org/openscience/cdk/isomorphism/mcss/RGraph.java
RGraph.mustContinue
private boolean mustContinue(BitSet potentialNode) { boolean result = true; boolean cancel = false; BitSet projG1 = projectG1(potentialNode); BitSet projG2 = projectG2(potentialNode); // if we reached the maximum number of // search iterations than do not continue if (maxIteration != -1 && nbIteration >= maxIteration) { return false; } // if constrains may no more be fulfilled then stop. if (!isContainedIn(c1, projG1) || !isContainedIn(c2, projG2)) { return false; } // check if the solution potential is not included in an already // existing solution for (Iterator<BitSet> i = solutionList.iterator(); i.hasNext() && !cancel;) { BitSet sol = i.next(); // if we want every 'mappings' do not stop if (findAllMap && (projG1.equals(projectG1(sol)) || projG2.equals(projectG2(sol)))) { // do nothing } // if it is not possible to do better than an already existing solution than stop. else if (isContainedIn(projG1, projectG1(sol)) || isContainedIn(projG2, projectG2(sol))) { result = false; cancel = true; } } return result; }
java
private boolean mustContinue(BitSet potentialNode) { boolean result = true; boolean cancel = false; BitSet projG1 = projectG1(potentialNode); BitSet projG2 = projectG2(potentialNode); // if we reached the maximum number of // search iterations than do not continue if (maxIteration != -1 && nbIteration >= maxIteration) { return false; } // if constrains may no more be fulfilled then stop. if (!isContainedIn(c1, projG1) || !isContainedIn(c2, projG2)) { return false; } // check if the solution potential is not included in an already // existing solution for (Iterator<BitSet> i = solutionList.iterator(); i.hasNext() && !cancel;) { BitSet sol = i.next(); // if we want every 'mappings' do not stop if (findAllMap && (projG1.equals(projectG1(sol)) || projG2.equals(projectG2(sol)))) { // do nothing } // if it is not possible to do better than an already existing solution than stop. else if (isContainedIn(projG1, projectG1(sol)) || isContainedIn(projG2, projectG2(sol))) { result = false; cancel = true; } } return result; }
[ "private", "boolean", "mustContinue", "(", "BitSet", "potentialNode", ")", "{", "boolean", "result", "=", "true", ";", "boolean", "cancel", "=", "false", ";", "BitSet", "projG1", "=", "projectG1", "(", "potentialNode", ")", ";", "BitSet", "projG2", "=", "pro...
Determine if there are potential solution remaining. @param potentialNode set of remaining potential nodes @return true if it is worse to continue the search
[ "Determine", "if", "there", "are", "potential", "solution", "remaining", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/base/standard/src/main/java/org/openscience/cdk/isomorphism/mcss/RGraph.java#L375-L409
Azure/azure-sdk-for-java
authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/RoleAssignmentsInner.java
RoleAssignmentsInner.createAsync
public Observable<RoleAssignmentInner> createAsync(String scope, String roleAssignmentName, RoleAssignmentCreateParameters parameters) { return createWithServiceResponseAsync(scope, roleAssignmentName, parameters).map(new Func1<ServiceResponse<RoleAssignmentInner>, RoleAssignmentInner>() { @Override public RoleAssignmentInner call(ServiceResponse<RoleAssignmentInner> response) { return response.body(); } }); }
java
public Observable<RoleAssignmentInner> createAsync(String scope, String roleAssignmentName, RoleAssignmentCreateParameters parameters) { return createWithServiceResponseAsync(scope, roleAssignmentName, parameters).map(new Func1<ServiceResponse<RoleAssignmentInner>, RoleAssignmentInner>() { @Override public RoleAssignmentInner call(ServiceResponse<RoleAssignmentInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "RoleAssignmentInner", ">", "createAsync", "(", "String", "scope", ",", "String", "roleAssignmentName", ",", "RoleAssignmentCreateParameters", "parameters", ")", "{", "return", "createWithServiceResponseAsync", "(", "scope", ",", "roleAssignme...
Creates a role assignment. @param scope The scope of the role assignment to create. The scope can be any REST resource instance. For example, use '/subscriptions/{subscription-id}/' for a subscription, '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}' for a resource group, and '/subscriptions/{subscription-id}/resourceGroups/{resource-group-name}/providers/{resource-provider}/{resource-type}/{resource-name}' for a resource. @param roleAssignmentName The name of the role assignment to create. It can be any valid GUID. @param parameters Parameters for the role assignment. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the RoleAssignmentInner object
[ "Creates", "a", "role", "assignment", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/authorization/resource-manager/v2018_09_01_preview/src/main/java/com/microsoft/azure/management/authorization/v2018_09_01_preview/implementation/RoleAssignmentsInner.java#L758-L765
gallandarakhneorg/afc
core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphPath.java
GraphPath.splitAtLast
public GP splitAtLast(ST obj, PT startPoint) { return splitAt(lastIndexOf(obj, startPoint), true); }
java
public GP splitAtLast(ST obj, PT startPoint) { return splitAt(lastIndexOf(obj, startPoint), true); }
[ "public", "GP", "splitAtLast", "(", "ST", "obj", ",", "PT", "startPoint", ")", "{", "return", "splitAt", "(", "lastIndexOf", "(", "obj", ",", "startPoint", ")", ",", "true", ")", ";", "}" ]
Split this path and retains the first part of the part in this object and reply the second part. The last occurence of the specified element will be in the second part. <p>This function removes until the <i>last occurence</i> of the given object. @param obj the reference segment. @param startPoint is the starting point of the searched segment. @return the rest of the path after the last occurence of the given element.
[ "Split", "this", "path", "and", "retains", "the", "first", "part", "of", "the", "part", "in", "this", "object", "and", "reply", "the", "second", "part", ".", "The", "last", "occurence", "of", "the", "specified", "element", "will", "be", "in", "the", "sec...
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphPath.java#L1188-L1190
orbisgis/poly2tri.java
poly2tri-core/src/main/java/org/poly2tri/triangulation/TriangulationPoint.java
TriangulationPoint.mergeInstances
public static void mergeInstances(Map<TriangulationPoint, TriangulationPoint> uniquePts, List<TriangulationPoint> ptList) { for(int idPoint = 0; idPoint < ptList.size(); idPoint++) { TriangulationPoint pt = ptList.get(idPoint); TriangulationPoint uniquePt = uniquePts.get(pt); if(uniquePt == null) { uniquePts.put(pt, pt); } else { // Duplicate point ptList.set(idPoint, uniquePt); } } }
java
public static void mergeInstances(Map<TriangulationPoint, TriangulationPoint> uniquePts, List<TriangulationPoint> ptList) { for(int idPoint = 0; idPoint < ptList.size(); idPoint++) { TriangulationPoint pt = ptList.get(idPoint); TriangulationPoint uniquePt = uniquePts.get(pt); if(uniquePt == null) { uniquePts.put(pt, pt); } else { // Duplicate point ptList.set(idPoint, uniquePt); } } }
[ "public", "static", "void", "mergeInstances", "(", "Map", "<", "TriangulationPoint", ",", "TriangulationPoint", ">", "uniquePts", ",", "List", "<", "TriangulationPoint", ">", "ptList", ")", "{", "for", "(", "int", "idPoint", "=", "0", ";", "idPoint", "<", "p...
Replace points in ptList for all equals object in uniquePts. @param uniquePts Map of triangulation points @param ptList Point list, updated, but always the same size.
[ "Replace", "points", "in", "ptList", "for", "all", "equals", "object", "in", "uniquePts", "." ]
train
https://github.com/orbisgis/poly2tri.java/blob/8b312c8d5fc23c52ffbacb3a7b66afae328fa827/poly2tri-core/src/main/java/org/poly2tri/triangulation/TriangulationPoint.java#L120-L131
Bedework/bw-util
bw-util-config/src/main/java/org/bedework/util/config/ConfigBase.java
ConfigBase.setListProperty
@SuppressWarnings("unchecked") public <L extends List> L setListProperty(final L list, final String name, final String val) { removeProperty(list, name); return addListProperty(list, name, val); }
java
@SuppressWarnings("unchecked") public <L extends List> L setListProperty(final L list, final String name, final String val) { removeProperty(list, name); return addListProperty(list, name, val); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "<", "L", "extends", "List", ">", "L", "setListProperty", "(", "final", "L", "list", ",", "final", "String", "name", ",", "final", "String", "val", ")", "{", "removeProperty", "(", "list", ",", ...
Set a property @param list the list - possibly null @param name of property @param val of property @return possibly newly created list
[ "Set", "a", "property" ]
train
https://github.com/Bedework/bw-util/blob/f51de4af3d7eb88fe63a0e22be8898a16c6cc3ad/bw-util-config/src/main/java/org/bedework/util/config/ConfigBase.java#L246-L252
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java
ArrayUtil.sub
public static Object[] sub(Object array, int start, int end) { return sub(array, start, end, 1); }
java
public static Object[] sub(Object array, int start, int end) { return sub(array, start, end, 1); }
[ "public", "static", "Object", "[", "]", "sub", "(", "Object", "array", ",", "int", "start", ",", "int", "end", ")", "{", "return", "sub", "(", "array", ",", "start", ",", "end", ",", "1", ")", ";", "}" ]
获取子数组 @param array 数组 @param start 开始位置(包括) @param end 结束位置(不包括) @return 新的数组 @since 4.0.6
[ "获取子数组" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/ArrayUtil.java#L2170-L2172
sundrio/sundrio
codegen/src/main/java/io/sundr/codegen/utils/TypeUtils.java
TypeUtils.typeExtends
public static TypeDef typeExtends(TypeDef base, ClassRef superClass) { return new TypeDefBuilder(base) .withExtendsList(superClass) .build(); }
java
public static TypeDef typeExtends(TypeDef base, ClassRef superClass) { return new TypeDefBuilder(base) .withExtendsList(superClass) .build(); }
[ "public", "static", "TypeDef", "typeExtends", "(", "TypeDef", "base", ",", "ClassRef", "superClass", ")", "{", "return", "new", "TypeDefBuilder", "(", "base", ")", ".", "withExtendsList", "(", "superClass", ")", ".", "build", "(", ")", ";", "}" ]
Sets one {@link io.sundr.codegen.model.TypeDef} as a super class of an other. @param base The base type. @param superClass The super type. @return The updated type definition.
[ "Sets", "one", "{", "@link", "io", ".", "sundr", ".", "codegen", ".", "model", ".", "TypeDef", "}", "as", "a", "super", "class", "of", "an", "other", "." ]
train
https://github.com/sundrio/sundrio/blob/4e38368f4db0d950f7c41a8c75e15b0baff1f69a/codegen/src/main/java/io/sundr/codegen/utils/TypeUtils.java#L160-L164
jpush/jmessage-api-java-client
src/main/java/cn/jmessage/api/user/UserClient.java
UserClient.setGroupShield
public ResponseWrapper setGroupShield(GroupShieldPayload payload, String username) throws APIConnectionException, APIRequestException { Preconditions.checkArgument(null != payload, "GroupShieldPayload should not be null"); StringUtils.checkUsername(username); return _httpClient.sendPost(_baseUrl + userPath + "/" + username + "/groupsShield", payload.toString()); }
java
public ResponseWrapper setGroupShield(GroupShieldPayload payload, String username) throws APIConnectionException, APIRequestException { Preconditions.checkArgument(null != payload, "GroupShieldPayload should not be null"); StringUtils.checkUsername(username); return _httpClient.sendPost(_baseUrl + userPath + "/" + username + "/groupsShield", payload.toString()); }
[ "public", "ResponseWrapper", "setGroupShield", "(", "GroupShieldPayload", "payload", ",", "String", "username", ")", "throws", "APIConnectionException", ",", "APIRequestException", "{", "Preconditions", ".", "checkArgument", "(", "null", "!=", "payload", ",", "\"GroupSh...
Set user's group message blocking @param payload GroupShieldPayload @param username Necessary @return No content @throws APIConnectionException connect exception @throws APIRequestException request exception
[ "Set", "user", "s", "group", "message", "blocking" ]
train
https://github.com/jpush/jmessage-api-java-client/blob/767f5fb15e9fe5a546c00f6e68b64f6dd53c617c/src/main/java/cn/jmessage/api/user/UserClient.java#L360-L365
aws/aws-sdk-java
aws-java-sdk-cognitoidentity/src/main/java/com/amazonaws/services/cognitoidentity/model/UpdateIdentityPoolResult.java
UpdateIdentityPoolResult.withIdentityPoolTags
public UpdateIdentityPoolResult withIdentityPoolTags(java.util.Map<String, String> identityPoolTags) { setIdentityPoolTags(identityPoolTags); return this; }
java
public UpdateIdentityPoolResult withIdentityPoolTags(java.util.Map<String, String> identityPoolTags) { setIdentityPoolTags(identityPoolTags); return this; }
[ "public", "UpdateIdentityPoolResult", "withIdentityPoolTags", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "identityPoolTags", ")", "{", "setIdentityPoolTags", "(", "identityPoolTags", ")", ";", "return", "this", ";", "}" ]
<p> The tags that are assigned to the identity pool. A tag is a label that you can apply to identity pools to categorize and manage them in different ways, such as by purpose, owner, environment, or other criteria. </p> @param identityPoolTags The tags that are assigned to the identity pool. A tag is a label that you can apply to identity pools to categorize and manage them in different ways, such as by purpose, owner, environment, or other criteria. @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "The", "tags", "that", "are", "assigned", "to", "the", "identity", "pool", ".", "A", "tag", "is", "a", "label", "that", "you", "can", "apply", "to", "identity", "pools", "to", "categorize", "and", "manage", "them", "in", "different", "ways", ...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-cognitoidentity/src/main/java/com/amazonaws/services/cognitoidentity/model/UpdateIdentityPoolResult.java#L569-L572
Impetus/Kundera
src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/type/AbstractManagedType.java
AbstractManagedType.onCheckCollectionAttribute
private <E> boolean onCheckCollectionAttribute(PluralAttribute<? super X, ?, ?> pluralAttribute, Class<E> paramClass) { if (pluralAttribute != null) { if (isCollectionAttribute(pluralAttribute) && isBindable(pluralAttribute, paramClass)) { return true; } } return false; }
java
private <E> boolean onCheckCollectionAttribute(PluralAttribute<? super X, ?, ?> pluralAttribute, Class<E> paramClass) { if (pluralAttribute != null) { if (isCollectionAttribute(pluralAttribute) && isBindable(pluralAttribute, paramClass)) { return true; } } return false; }
[ "private", "<", "E", ">", "boolean", "onCheckCollectionAttribute", "(", "PluralAttribute", "<", "?", "super", "X", ",", "?", ",", "?", ">", "pluralAttribute", ",", "Class", "<", "E", ">", "paramClass", ")", "{", "if", "(", "pluralAttribute", "!=", "null", ...
On check collection attribute. @param <E> the element type @param pluralAttribute the plural attribute @param paramClass the param class @return true, if successful
[ "On", "check", "collection", "attribute", "." ]
train
https://github.com/Impetus/Kundera/blob/268958ab1ec09d14ec4d9184f0c8ded7a9158908/src/jpa-engine/core/src/main/java/com/impetus/kundera/metadata/model/type/AbstractManagedType.java#L931-L943
grails/grails-core
grails-core/src/main/groovy/grails/util/GrailsClassUtils.java
GrailsClassUtils.isPropertyOfType
public static boolean isPropertyOfType(Class<?> clazz, String propertyName, Class<?> type) { try { Class<?> propType = getPropertyType(clazz, propertyName); return propType != null && propType.equals(type); } catch (Exception e) { return false; } }
java
public static boolean isPropertyOfType(Class<?> clazz, String propertyName, Class<?> type) { try { Class<?> propType = getPropertyType(clazz, propertyName); return propType != null && propType.equals(type); } catch (Exception e) { return false; } }
[ "public", "static", "boolean", "isPropertyOfType", "(", "Class", "<", "?", ">", "clazz", ",", "String", "propertyName", ",", "Class", "<", "?", ">", "type", ")", "{", "try", "{", "Class", "<", "?", ">", "propType", "=", "getPropertyType", "(", "clazz", ...
Returns true if the specified property in the specified class is of the specified type @param clazz The class which contains the property @param propertyName The property name @param type The type to check @return A boolean value
[ "Returns", "true", "if", "the", "specified", "property", "in", "the", "specified", "class", "is", "of", "the", "specified", "type" ]
train
https://github.com/grails/grails-core/blob/c0b08aa995b0297143b75d05642abba8cb7b4122/grails-core/src/main/groovy/grails/util/GrailsClassUtils.java#L201-L209
aehrc/snorocket
snorocket-core/src/main/java/au/csiro/snorocket/core/axioms/GCI.java
GCI.rule6
boolean rule6(final IFactory factory, final Inclusion[] gcis) { boolean result = false; if (rhs instanceof Existential) { Existential existential = (Existential) rhs; final AbstractConcept cHat = existential.getConcept(); if (!(cHat instanceof Concept)) { result = true; Concept a = getA(factory, cHat); gcis[0] = new GCI(lhs, new Existential(existential.getRole(), a)); gcis[1] = new GCI(a, cHat); } } return result; }
java
boolean rule6(final IFactory factory, final Inclusion[] gcis) { boolean result = false; if (rhs instanceof Existential) { Existential existential = (Existential) rhs; final AbstractConcept cHat = existential.getConcept(); if (!(cHat instanceof Concept)) { result = true; Concept a = getA(factory, cHat); gcis[0] = new GCI(lhs, new Existential(existential.getRole(), a)); gcis[1] = new GCI(a, cHat); } } return result; }
[ "boolean", "rule6", "(", "final", "IFactory", "factory", ",", "final", "Inclusion", "[", "]", "gcis", ")", "{", "boolean", "result", "=", "false", ";", "if", "(", "rhs", "instanceof", "Existential", ")", "{", "Existential", "existential", "=", "(", "Existe...
B &#8849; &#8707;r.C' &rarr; {B &#8849; &#8707;r.A, A &#8849; C'} @param gcis @return
[ "B", "&#8849", ";", "&#8707", ";", "r", ".", "C", "&rarr", ";", "{", "B", "&#8849", ";", "&#8707", ";", "r", ".", "A", "A", "&#8849", ";", "C", "}" ]
train
https://github.com/aehrc/snorocket/blob/e33c1e216f8a66d6502e3a14e80876811feedd8b/snorocket-core/src/main/java/au/csiro/snorocket/core/axioms/GCI.java#L247-L263
OpenLiberty/open-liberty
dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStreamManager.java
SourceStreamManager.restoreMessage
public void restoreMessage(SIMPMessage msgItem, boolean commit) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "restoreMessage", new Object[] { msgItem }); int priority = msgItem.getPriority(); Reliability reliability = msgItem.getReliability(); SIBUuid12 streamID = msgItem.getGuaranteedStreamUuid(); StreamSet streamSet = getStreamSet(streamID); SourceStream sourceStream = null; synchronized(streamSet) { sourceStream = (SourceStream) streamSet.getStream(priority, reliability); if(sourceStream == null && reliability.compareTo(Reliability.BEST_EFFORT_NONPERSISTENT) > 0) { sourceStream = createStream(streamSet, priority, reliability, streamSet.getPersistentData(priority, reliability), true ); } } // NOTE: sourceStream should only be null for express qos if(sourceStream != null) { if( !commit ) sourceStream.restoreUncommitted(msgItem); else sourceStream.restoreValue(msgItem); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "restoreMessage"); }
java
public void restoreMessage(SIMPMessage msgItem, boolean commit) throws SIResourceException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "restoreMessage", new Object[] { msgItem }); int priority = msgItem.getPriority(); Reliability reliability = msgItem.getReliability(); SIBUuid12 streamID = msgItem.getGuaranteedStreamUuid(); StreamSet streamSet = getStreamSet(streamID); SourceStream sourceStream = null; synchronized(streamSet) { sourceStream = (SourceStream) streamSet.getStream(priority, reliability); if(sourceStream == null && reliability.compareTo(Reliability.BEST_EFFORT_NONPERSISTENT) > 0) { sourceStream = createStream(streamSet, priority, reliability, streamSet.getPersistentData(priority, reliability), true ); } } // NOTE: sourceStream should only be null for express qos if(sourceStream != null) { if( !commit ) sourceStream.restoreUncommitted(msgItem); else sourceStream.restoreValue(msgItem); } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "restoreMessage"); }
[ "public", "void", "restoreMessage", "(", "SIMPMessage", "msgItem", ",", "boolean", "commit", ")", "throws", "SIResourceException", "{", "if", "(", "TraceComponent", ".", "isAnyTracingEnabled", "(", ")", "&&", "tc", ".", "isEntryEnabled", "(", ")", ")", "SibTr", ...
Put a message back into the appropriate source stream. This will create a stream if one does not exist but will not change any fields in the message @param msgItem The message to be restored @param commit Boolean indicating whether message to be restored is in commit state
[ "Put", "a", "message", "back", "into", "the", "appropriate", "source", "stream", ".", "This", "will", "create", "a", "stream", "if", "one", "does", "not", "exist", "but", "will", "not", "change", "any", "fields", "in", "the", "message" ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.messaging.runtime/src/com/ibm/ws/sib/processor/gd/SourceStreamManager.java#L431-L467
apache/incubator-shardingsphere
sharding-proxy/sharding-proxy-frontend/sharding-proxy-frontend-core/src/main/java/org/apache/shardingsphere/shardingproxy/frontend/executor/CommandExecutorSelector.java
CommandExecutorSelector.getExecutor
public static ExecutorService getExecutor(final boolean isOccupyThreadForPerConnection, final TransactionType transactionType, final ChannelId channelId) { return (isOccupyThreadForPerConnection || TransactionType.XA == transactionType || TransactionType.BASE == transactionType) ? ChannelThreadExecutorGroup.getInstance().get(channelId) : UserExecutorGroup.getInstance().getExecutorService(); }
java
public static ExecutorService getExecutor(final boolean isOccupyThreadForPerConnection, final TransactionType transactionType, final ChannelId channelId) { return (isOccupyThreadForPerConnection || TransactionType.XA == transactionType || TransactionType.BASE == transactionType) ? ChannelThreadExecutorGroup.getInstance().get(channelId) : UserExecutorGroup.getInstance().getExecutorService(); }
[ "public", "static", "ExecutorService", "getExecutor", "(", "final", "boolean", "isOccupyThreadForPerConnection", ",", "final", "TransactionType", "transactionType", ",", "final", "ChannelId", "channelId", ")", "{", "return", "(", "isOccupyThreadForPerConnection", "||", "T...
Get executor service. @param isOccupyThreadForPerConnection is occupy thread for per connection or not @param transactionType transaction type @param channelId channel ID @return executor service
[ "Get", "executor", "service", "." ]
train
https://github.com/apache/incubator-shardingsphere/blob/f88fd29fc345dfb31fdce12e9e96cbfa0fd2402d/sharding-proxy/sharding-proxy-frontend/sharding-proxy-frontend-core/src/main/java/org/apache/shardingsphere/shardingproxy/frontend/executor/CommandExecutorSelector.java#L43-L46
cdk/cdk
legacy/src/main/java/org/openscience/cdk/geometry/GeometryTools.java
GeometryTools.getBestAlignmentForLabel
public static int getBestAlignmentForLabel(IAtomContainer container, IAtom atom) { double overallDiffX = 0; for (IAtom connectedAtom : container.getConnectedAtomsList(atom)) { overallDiffX += connectedAtom.getPoint2d().x - atom.getPoint2d().x; } if (overallDiffX <= 0) { return 1; } else { return -1; } }
java
public static int getBestAlignmentForLabel(IAtomContainer container, IAtom atom) { double overallDiffX = 0; for (IAtom connectedAtom : container.getConnectedAtomsList(atom)) { overallDiffX += connectedAtom.getPoint2d().x - atom.getPoint2d().x; } if (overallDiffX <= 0) { return 1; } else { return -1; } }
[ "public", "static", "int", "getBestAlignmentForLabel", "(", "IAtomContainer", "container", ",", "IAtom", "atom", ")", "{", "double", "overallDiffX", "=", "0", ";", "for", "(", "IAtom", "connectedAtom", ":", "container", ".", "getConnectedAtomsList", "(", "atom", ...
Determines the best alignment for the label of an atom in 2D space. It returns 1 if left aligned, and -1 if right aligned. See comment for center(IAtomContainer atomCon, Dimension areaDim, HashMap renderingCoordinates) for details on coordinate sets @param container Description of the Parameter @param atom Description of the Parameter @return The bestAlignmentForLabel value
[ "Determines", "the", "best", "alignment", "for", "the", "label", "of", "an", "atom", "in", "2D", "space", ".", "It", "returns", "1", "if", "left", "aligned", "and", "-", "1", "if", "right", "aligned", ".", "See", "comment", "for", "center", "(", "IAtom...
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/legacy/src/main/java/org/openscience/cdk/geometry/GeometryTools.java#L1196-L1206