repository_name
stringlengths
7
58
func_path_in_repository
stringlengths
11
204
func_name
stringlengths
5
103
whole_func_string
stringlengths
87
3.44k
language
stringclasses
1 value
func_code_string
stringlengths
87
3.44k
func_code_tokens
listlengths
21
714
func_documentation_string
stringlengths
61
1.95k
func_documentation_tokens
listlengths
1
482
split_name
stringclasses
1 value
func_code_url
stringlengths
102
309
UrielCh/ovh-java-sdk
ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java
ApiOvhEmailexchange.organizationName_service_exchangeService_account_POST
public OvhTask organizationName_service_exchangeService_account_POST(String organizationName, String exchangeService, String SAMAccountName, String company, String displayName, String domain, String firstName, Boolean hiddenFromGAL, String initials, String lastName, OvhOvhLicenceEnum license, Boolean litigation, Long litigationPeriod, String login, OvhMailingFilterEnum[] mailingFilter, Boolean outlookLicense, String password, OvhSpamAndVirusConfiguration spamAndVirusConfiguration) throws IOException { String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/account"; StringBuilder sb = path(qPath, organizationName, exchangeService); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "SAMAccountName", SAMAccountName); addBody(o, "company", company); addBody(o, "displayName", displayName); addBody(o, "domain", domain); addBody(o, "firstName", firstName); addBody(o, "hiddenFromGAL", hiddenFromGAL); addBody(o, "initials", initials); addBody(o, "lastName", lastName); addBody(o, "license", license); addBody(o, "litigation", litigation); addBody(o, "litigationPeriod", litigationPeriod); addBody(o, "login", login); addBody(o, "mailingFilter", mailingFilter); addBody(o, "outlookLicense", outlookLicense); addBody(o, "password", password); addBody(o, "spamAndVirusConfiguration", spamAndVirusConfiguration); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
java
public OvhTask organizationName_service_exchangeService_account_POST(String organizationName, String exchangeService, String SAMAccountName, String company, String displayName, String domain, String firstName, Boolean hiddenFromGAL, String initials, String lastName, OvhOvhLicenceEnum license, Boolean litigation, Long litigationPeriod, String login, OvhMailingFilterEnum[] mailingFilter, Boolean outlookLicense, String password, OvhSpamAndVirusConfiguration spamAndVirusConfiguration) throws IOException { String qPath = "/email/exchange/{organizationName}/service/{exchangeService}/account"; StringBuilder sb = path(qPath, organizationName, exchangeService); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "SAMAccountName", SAMAccountName); addBody(o, "company", company); addBody(o, "displayName", displayName); addBody(o, "domain", domain); addBody(o, "firstName", firstName); addBody(o, "hiddenFromGAL", hiddenFromGAL); addBody(o, "initials", initials); addBody(o, "lastName", lastName); addBody(o, "license", license); addBody(o, "litigation", litigation); addBody(o, "litigationPeriod", litigationPeriod); addBody(o, "login", login); addBody(o, "mailingFilter", mailingFilter); addBody(o, "outlookLicense", outlookLicense); addBody(o, "password", password); addBody(o, "spamAndVirusConfiguration", spamAndVirusConfiguration); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhTask.class); }
[ "public", "OvhTask", "organizationName_service_exchangeService_account_POST", "(", "String", "organizationName", ",", "String", "exchangeService", ",", "String", "SAMAccountName", ",", "String", "company", ",", "String", "displayName", ",", "String", "domain", ",", "Strin...
Create new mailbox in exchange server REST: POST /email/exchange/{organizationName}/service/{exchangeService}/account @param outlookLicense [required] Buy outlook license @param displayName [required] Account display name @param license [required] Exchange license @param company [required] Company name @param initials [required] Account initials @param hiddenFromGAL [required] Hide the account in Global Address List @param login [required] Account login @param lastName [required] Account last name @param firstName [required] Account first name @param litigationPeriod [required] Litigation length in days, 0 means unlimited @param SAMAccountName [required] SAM account name (exchange 2010 login) @param litigation [required] Litigation status @param password [required] Account password @param mailingFilter [required] Enable mailing filtrering @param domain [required] Email domain @param spamAndVirusConfiguration [required] Antispam and Antivirus configuration @param organizationName [required] The internal name of your exchange organization @param exchangeService [required] The internal name of your exchange service
[ "Create", "new", "mailbox", "in", "exchange", "server" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-emailexchange/src/main/java/net/minidev/ovh/api/ApiOvhEmailexchange.java#L2186-L2208
Omertron/api-themoviedb
src/main/java/com/omertron/themoviedbapi/methods/TmdbAccount.java
TmdbAccount.getUserLists
public ResultList<UserList> getUserLists(String sessionId, int accountId) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.SESSION_ID, sessionId); parameters.add(Param.ID, accountId); URL url = new ApiUrl(apiKey, MethodBase.ACCOUNT).subMethod(MethodSub.LISTS).buildUrl(parameters); WrapperGenericList<UserList> wrapper = processWrapper(getTypeReference(UserList.class), url, "user list"); return wrapper.getResultsList(); }
java
public ResultList<UserList> getUserLists(String sessionId, int accountId) throws MovieDbException { TmdbParameters parameters = new TmdbParameters(); parameters.add(Param.SESSION_ID, sessionId); parameters.add(Param.ID, accountId); URL url = new ApiUrl(apiKey, MethodBase.ACCOUNT).subMethod(MethodSub.LISTS).buildUrl(parameters); WrapperGenericList<UserList> wrapper = processWrapper(getTypeReference(UserList.class), url, "user list"); return wrapper.getResultsList(); }
[ "public", "ResultList", "<", "UserList", ">", "getUserLists", "(", "String", "sessionId", ",", "int", "accountId", ")", "throws", "MovieDbException", "{", "TmdbParameters", "parameters", "=", "new", "TmdbParameters", "(", ")", ";", "parameters", ".", "add", "(",...
Get all lists of a given user @param sessionId @param accountId @return The lists @throws MovieDbException
[ "Get", "all", "lists", "of", "a", "given", "user" ]
train
https://github.com/Omertron/api-themoviedb/blob/bf132d7c7271734e13b58ba3bc92bba46f220118/src/main/java/com/omertron/themoviedbapi/methods/TmdbAccount.java#L90-L98
onelogin/onelogin-java-sdk
src/main/java/com/onelogin/sdk/conn/Client.java
Client.getUsersBatch
public OneLoginResponse<User> getUsersBatch(HashMap<String, String> queryParameters, int batchSize, String afterCursor) throws OAuthSystemException, OAuthProblemException, URISyntaxException { ExtractionContext context = extractResourceBatch(queryParameters, batchSize, afterCursor, Constants.GET_USERS_URL); List<User> users = new ArrayList<User>(batchSize); afterCursor = getUsersBatch(users, context.url, context.bearerRequest, context.oAuthResponse); return new OneLoginResponse<User>(users, afterCursor); }
java
public OneLoginResponse<User> getUsersBatch(HashMap<String, String> queryParameters, int batchSize, String afterCursor) throws OAuthSystemException, OAuthProblemException, URISyntaxException { ExtractionContext context = extractResourceBatch(queryParameters, batchSize, afterCursor, Constants.GET_USERS_URL); List<User> users = new ArrayList<User>(batchSize); afterCursor = getUsersBatch(users, context.url, context.bearerRequest, context.oAuthResponse); return new OneLoginResponse<User>(users, afterCursor); }
[ "public", "OneLoginResponse", "<", "User", ">", "getUsersBatch", "(", "HashMap", "<", "String", ",", "String", ">", "queryParameters", ",", "int", "batchSize", ",", "String", "afterCursor", ")", "throws", "OAuthSystemException", ",", "OAuthProblemException", ",", ...
Get a batch of Users. @param queryParameters Query parameters of the Resource @param batchSize Size of the Batch @param afterCursor Reference to continue collecting items of next page @return OneLoginResponse of User (Batch) @throws OAuthSystemException - if there is a IOException reading parameters of the httpURLConnection @throws OAuthProblemException - if there are errors validating the OneloginOAuthJSONResourceResponse and throwOAuthProblemException is enabled @throws URISyntaxException - if there is an error when generating the target URL at the getResource call @see com.onelogin.sdk.model.User @see <a target="_blank" href="https://developers.onelogin.com/api-docs/1/users/get-users">Get Users documentation</a>
[ "Get", "a", "batch", "of", "Users", "." ]
train
https://github.com/onelogin/onelogin-java-sdk/blob/1570b78033dcc1c7387099e77fe41b6b0638df8c/src/main/java/com/onelogin/sdk/conn/Client.java#L397-L403
ManfredTremmel/gwt-bean-validators
mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/impl/MustBeSmallerOrEqualValidator.java
MustBeSmallerOrEqualValidator.isValid
@Override public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) { if (pvalue == null) { return true; } try { final Object field1Value = BeanPropertyReaderUtil.getNullSaveProperty(pvalue, field1Name); final Object field2Value = BeanPropertyReaderUtil.getNullSaveProperty(pvalue, field2Name); if (!smaller(field1Value, field2Value)) { switchContext(pcontext); return false; } return true; } catch (final Exception ignore) { switchContext(pcontext); return false; } }
java
@Override public final boolean isValid(final Object pvalue, final ConstraintValidatorContext pcontext) { if (pvalue == null) { return true; } try { final Object field1Value = BeanPropertyReaderUtil.getNullSaveProperty(pvalue, field1Name); final Object field2Value = BeanPropertyReaderUtil.getNullSaveProperty(pvalue, field2Name); if (!smaller(field1Value, field2Value)) { switchContext(pcontext); return false; } return true; } catch (final Exception ignore) { switchContext(pcontext); return false; } }
[ "@", "Override", "public", "final", "boolean", "isValid", "(", "final", "Object", "pvalue", ",", "final", "ConstraintValidatorContext", "pcontext", ")", "{", "if", "(", "pvalue", "==", "null", ")", "{", "return", "true", ";", "}", "try", "{", "final", "Obj...
{@inheritDoc} check if given object is valid. @see javax.validation.ConstraintValidator#isValid(Object, javax.validation.ConstraintValidatorContext)
[ "{", "@inheritDoc", "}", "check", "if", "given", "object", "is", "valid", "." ]
train
https://github.com/ManfredTremmel/gwt-bean-validators/blob/cff7a2c3d68c2d17bf9d3cc57c79cc16fa8b4d5c/mt-bean-validators/src/main/java/de/knightsoftnet/validators/shared/impl/MustBeSmallerOrEqualValidator.java#L76-L93
Karumi/Dexter
dexter/src/main/java/com/karumi/dexter/DexterInstance.java
DexterInstance.checkPermission
void checkPermission(PermissionListener listener, String permission, Thread thread) { checkSinglePermission(listener, permission, thread); }
java
void checkPermission(PermissionListener listener, String permission, Thread thread) { checkSinglePermission(listener, permission, thread); }
[ "void", "checkPermission", "(", "PermissionListener", "listener", ",", "String", "permission", ",", "Thread", "thread", ")", "{", "checkSinglePermission", "(", "listener", ",", "permission", ",", "thread", ")", ";", "}" ]
Checks the state of a specific permission reporting it when ready to the listener. @param listener The class that will be reported when the state of the permission is ready @param permission One of the values found in {@link android.Manifest.permission} @param thread thread the Listener methods will be called on
[ "Checks", "the", "state", "of", "a", "specific", "permission", "reporting", "it", "when", "ready", "to", "the", "listener", "." ]
train
https://github.com/Karumi/Dexter/blob/11cfa35a2eaa51f01f6678adb69bed0382a867e7/dexter/src/main/java/com/karumi/dexter/DexterInstance.java#L85-L87
alkacon/opencms-core
src/org/opencms/jsp/CmsJspTagEditable.java
CmsJspTagEditable.setDirectEditProviderParams
protected static void setDirectEditProviderParams(PageContext context, CmsDirectEditParams params) { // set the direct edit params as attribute to the request context.getRequest().setAttribute(I_CmsDirectEditProvider.ATTRIBUTE_DIRECT_EDIT_PROVIDER_PARAMS, params); }
java
protected static void setDirectEditProviderParams(PageContext context, CmsDirectEditParams params) { // set the direct edit params as attribute to the request context.getRequest().setAttribute(I_CmsDirectEditProvider.ATTRIBUTE_DIRECT_EDIT_PROVIDER_PARAMS, params); }
[ "protected", "static", "void", "setDirectEditProviderParams", "(", "PageContext", "context", ",", "CmsDirectEditParams", "params", ")", "{", "// set the direct edit params as attribute to the request", "context", ".", "getRequest", "(", ")", ".", "setAttribute", "(", "I_Cms...
Sets the current initialized instance of the direct edit provider parameters to the page context.<p> @param context the current JSP page context @param params the current initialized instance of the direct edit provider parameters to set
[ "Sets", "the", "current", "initialized", "instance", "of", "the", "direct", "edit", "provider", "parameters", "to", "the", "page", "context", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/jsp/CmsJspTagEditable.java#L355-L359
netscaler/nitro
src/main/java/com/citrix/netscaler/nitro/resource/base/base_resource.java
base_resource.post_request
private base_response post_request(nitro_service service, options option) throws Exception { String sessionid = service.get_sessionid(); String request = resource_to_string(service, sessionid, option); return post_data(service,request); }
java
private base_response post_request(nitro_service service, options option) throws Exception { String sessionid = service.get_sessionid(); String request = resource_to_string(service, sessionid, option); return post_data(service,request); }
[ "private", "base_response", "post_request", "(", "nitro_service", "service", ",", "options", "option", ")", "throws", "Exception", "{", "String", "sessionid", "=", "service", ".", "get_sessionid", "(", ")", ";", "String", "request", "=", "resource_to_string", "(",...
Use this method to perform a Add operation on netscaler resource. @param service nitro_service object. @param option Options class object. @return status of the operation performed. @throws Exception if invalid input is given.
[ "Use", "this", "method", "to", "perform", "a", "Add", "operation", "on", "netscaler", "resource", "." ]
train
https://github.com/netscaler/nitro/blob/2a98692dcf4e4ec430c7d7baab8382e4ba5a35e4/src/main/java/com/citrix/netscaler/nitro/resource/base/base_resource.java#L124-L129
jMotif/SAX
src/main/java/net/seninp/util/HeatChart.java
HeatChart.saveToFile
public void saveToFile(File outputFile) throws IOException { String filename = outputFile.getName(); int extPoint = filename.lastIndexOf('.'); if (extPoint < 0) { throw new IOException("Illegal filename, no extension used."); } // Determine the extension of the filename. String ext = filename.substring(extPoint + 1); // Handle jpg without transparency. if (ext.toLowerCase().equals("jpg") || ext.toLowerCase().equals("jpeg")) { BufferedImage chart = (BufferedImage) getChartImage(false); // Save our graphic. saveGraphicJpeg(chart, outputFile, 1.0f); } else { BufferedImage chart = (BufferedImage) getChartImage(true); ImageIO.write(chart, ext, outputFile); } }
java
public void saveToFile(File outputFile) throws IOException { String filename = outputFile.getName(); int extPoint = filename.lastIndexOf('.'); if (extPoint < 0) { throw new IOException("Illegal filename, no extension used."); } // Determine the extension of the filename. String ext = filename.substring(extPoint + 1); // Handle jpg without transparency. if (ext.toLowerCase().equals("jpg") || ext.toLowerCase().equals("jpeg")) { BufferedImage chart = (BufferedImage) getChartImage(false); // Save our graphic. saveGraphicJpeg(chart, outputFile, 1.0f); } else { BufferedImage chart = (BufferedImage) getChartImage(true); ImageIO.write(chart, ext, outputFile); } }
[ "public", "void", "saveToFile", "(", "File", "outputFile", ")", "throws", "IOException", "{", "String", "filename", "=", "outputFile", ".", "getName", "(", ")", ";", "int", "extPoint", "=", "filename", ".", "lastIndexOf", "(", "'", "'", ")", ";", "if", "...
Generates a new chart <code>Image</code> based upon the currently held settings and then attempts to save that image to disk, to the location provided as a File parameter. The image type of the saved file will equal the extension of the filename provided, so it is essential that a suitable extension be included on the file name. <p> All supported <code>ImageIO</code> file types are supported, including PNG, JPG and GIF. <p> No chart will be generated until this or the related <code>getChartImage()</code> method are called. All successive calls will result in the generation of a new chart image, no caching is used. @param outputFile the file location that the generated image file should be written to. The File must have a suitable filename, with an extension of a valid image format (as supported by <code>ImageIO</code>). @throws IOException if the output file's filename has no extension or if there the file is unable to written to. Reasons for this include a non-existant file location (check with the File exists() method on the parent directory), or the permissions of the write location may be incorrect.
[ "Generates", "a", "new", "chart", "<code", ">", "Image<", "/", "code", ">", "based", "upon", "the", "currently", "held", "settings", "and", "then", "attempts", "to", "save", "that", "image", "to", "disk", "to", "the", "location", "provided", "as", "a", "...
train
https://github.com/jMotif/SAX/blob/39ee07a69facaa330def5130b8790aeda85f1061/src/main/java/net/seninp/util/HeatChart.java#L1167-L1191
lessthanoptimal/BoofCV
main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java
PerspectiveOps.renderPixel
public static Point2D_F64 renderPixel(CameraPinhole intrinsic , Point3D_F64 X ) { Point2D_F64 norm = new Point2D_F64(X.x/X.z,X.y/X.z); return convertNormToPixel(intrinsic, norm, norm); }
java
public static Point2D_F64 renderPixel(CameraPinhole intrinsic , Point3D_F64 X ) { Point2D_F64 norm = new Point2D_F64(X.x/X.z,X.y/X.z); return convertNormToPixel(intrinsic, norm, norm); }
[ "public", "static", "Point2D_F64", "renderPixel", "(", "CameraPinhole", "intrinsic", ",", "Point3D_F64", "X", ")", "{", "Point2D_F64", "norm", "=", "new", "Point2D_F64", "(", "X", ".", "x", "/", "X", ".", "z", ",", "X", ".", "y", "/", "X", ".", "z", ...
Renders a point in camera coordinates into the image plane in pixels. @param intrinsic Intrinsic camera parameters. @param X 3D Point in world reference frame.. @return 2D Render point on image plane or null if it's behind the camera
[ "Renders", "a", "point", "in", "camera", "coordinates", "into", "the", "image", "plane", "in", "pixels", "." ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-geo/src/main/java/boofcv/alg/geo/PerspectiveOps.java#L538-L541
looly/hutool
hutool-extra/src/main/java/cn/hutool/extra/ssh/JschUtil.java
JschUtil.createSession
public static Session createSession(String sshHost, int sshPort, String sshUser, String sshPass) { if (StrUtil.isEmpty(sshHost) || sshPort < 0 || StrUtil.isEmpty(sshUser) || StrUtil.isEmpty(sshPass)) { return null; } Session session; try { session = new JSch().getSession(sshUser, sshHost, sshPort); session.setPassword(sshPass); // 设置第一次登陆的时候提示,可选值:(ask | yes | no) session.setConfig("StrictHostKeyChecking", "no"); } catch (JSchException e) { throw new JschRuntimeException(e); } return session; }
java
public static Session createSession(String sshHost, int sshPort, String sshUser, String sshPass) { if (StrUtil.isEmpty(sshHost) || sshPort < 0 || StrUtil.isEmpty(sshUser) || StrUtil.isEmpty(sshPass)) { return null; } Session session; try { session = new JSch().getSession(sshUser, sshHost, sshPort); session.setPassword(sshPass); // 设置第一次登陆的时候提示,可选值:(ask | yes | no) session.setConfig("StrictHostKeyChecking", "no"); } catch (JSchException e) { throw new JschRuntimeException(e); } return session; }
[ "public", "static", "Session", "createSession", "(", "String", "sshHost", ",", "int", "sshPort", ",", "String", "sshUser", ",", "String", "sshPass", ")", "{", "if", "(", "StrUtil", ".", "isEmpty", "(", "sshHost", ")", "||", "sshPort", "<", "0", "||", "St...
新建一个新的SSH会话 @param sshHost 主机 @param sshPort 端口 @param sshUser 机用户名 @param sshPass 密码 @return SSH会话 @since 4.5.2
[ "新建一个新的SSH会话" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-extra/src/main/java/cn/hutool/extra/ssh/JschUtil.java#L89-L104
mozilla/rhino
src/org/mozilla/javascript/DToA.java
DToA.d2b
private static BigInteger d2b(double d, int[] e, int[] bits) { byte dbl_bits[]; int i, k, y, z, de; long dBits = Double.doubleToLongBits(d); int d0 = (int)(dBits >>> 32); int d1 = (int)(dBits); z = d0 & Frac_mask; d0 &= 0x7fffffff; /* clear sign bit, which we ignore */ if ((de = (d0 >>> Exp_shift)) != 0) z |= Exp_msk1; if ((y = d1) != 0) { dbl_bits = new byte[8]; k = lo0bits(y); y >>>= k; if (k != 0) { stuffBits(dbl_bits, 4, y | z << (32 - k)); z >>= k; } else stuffBits(dbl_bits, 4, y); stuffBits(dbl_bits, 0, z); i = (z != 0) ? 2 : 1; } else { // JS_ASSERT(z); dbl_bits = new byte[4]; k = lo0bits(z); z >>>= k; stuffBits(dbl_bits, 0, z); k += 32; i = 1; } if (de != 0) { e[0] = de - Bias - (P-1) + k; bits[0] = P - k; } else { e[0] = de - Bias - (P-1) + 1 + k; bits[0] = 32*i - hi0bits(z); } return new BigInteger(dbl_bits); }
java
private static BigInteger d2b(double d, int[] e, int[] bits) { byte dbl_bits[]; int i, k, y, z, de; long dBits = Double.doubleToLongBits(d); int d0 = (int)(dBits >>> 32); int d1 = (int)(dBits); z = d0 & Frac_mask; d0 &= 0x7fffffff; /* clear sign bit, which we ignore */ if ((de = (d0 >>> Exp_shift)) != 0) z |= Exp_msk1; if ((y = d1) != 0) { dbl_bits = new byte[8]; k = lo0bits(y); y >>>= k; if (k != 0) { stuffBits(dbl_bits, 4, y | z << (32 - k)); z >>= k; } else stuffBits(dbl_bits, 4, y); stuffBits(dbl_bits, 0, z); i = (z != 0) ? 2 : 1; } else { // JS_ASSERT(z); dbl_bits = new byte[4]; k = lo0bits(z); z >>>= k; stuffBits(dbl_bits, 0, z); k += 32; i = 1; } if (de != 0) { e[0] = de - Bias - (P-1) + k; bits[0] = P - k; } else { e[0] = de - Bias - (P-1) + 1 + k; bits[0] = 32*i - hi0bits(z); } return new BigInteger(dbl_bits); }
[ "private", "static", "BigInteger", "d2b", "(", "double", "d", ",", "int", "[", "]", "e", ",", "int", "[", "]", "bits", ")", "{", "byte", "dbl_bits", "[", "]", ";", "int", "i", ",", "k", ",", "y", ",", "z", ",", "de", ";", "long", "dBits", "="...
/* Convert d into the form b*2^e, where b is an odd integer. b is the returned Bigint and e is the returned binary exponent. Return the number of significant bits in b in bits. d must be finite and nonzero.
[ "/", "*", "Convert", "d", "into", "the", "form", "b", "*", "2^e", "where", "b", "is", "an", "odd", "integer", ".", "b", "is", "the", "returned", "Bigint", "and", "e", "is", "the", "returned", "binary", "exponent", ".", "Return", "the", "number", "of"...
train
https://github.com/mozilla/rhino/blob/fa8a86df11d37623f5faa8d445a5876612bc47b0/src/org/mozilla/javascript/DToA.java#L159-L204
cojen/Cojen
src/main/java/org/cojen/classfile/MethodInfo.java
MethodInfo.addInnerClass
public ClassFile addInnerClass(String innerClassName, Class superClass) { return addInnerClass(innerClassName, superClass.getName()); }
java
public ClassFile addInnerClass(String innerClassName, Class superClass) { return addInnerClass(innerClassName, superClass.getName()); }
[ "public", "ClassFile", "addInnerClass", "(", "String", "innerClassName", ",", "Class", "superClass", ")", "{", "return", "addInnerClass", "(", "innerClassName", ",", "superClass", ".", "getName", "(", ")", ")", ";", "}" ]
Add an inner class to this method. @param innerClassName Optional short inner class name. @param superClass Super class.
[ "Add", "an", "inner", "class", "to", "this", "method", "." ]
train
https://github.com/cojen/Cojen/blob/ddee9a0fde83870b97e0ed04c58270aa665f3a62/src/main/java/org/cojen/classfile/MethodInfo.java#L331-L333
highsource/hyperjaxb3
ejb/plugin/src/main/java/org/jvnet/hyperjaxb3/xjc/reader/TypeUtil.java
TypeUtil.getCommonBaseType
public static JType getCommonBaseType( JCodeModel codeModel, Collection<? extends JType> types ) { return getCommonBaseType( codeModel, types.toArray(new JType[types.size()]) ); }
java
public static JType getCommonBaseType( JCodeModel codeModel, Collection<? extends JType> types ) { return getCommonBaseType( codeModel, types.toArray(new JType[types.size()]) ); }
[ "public", "static", "JType", "getCommonBaseType", "(", "JCodeModel", "codeModel", ",", "Collection", "<", "?", "extends", "JType", ">", "types", ")", "{", "return", "getCommonBaseType", "(", "codeModel", ",", "types", ".", "toArray", "(", "new", "JType", "[", ...
Computes the common base type of two types. @param types set of {@link JType} objects.
[ "Computes", "the", "common", "base", "type", "of", "two", "types", "." ]
train
https://github.com/highsource/hyperjaxb3/blob/c645d1628b8c26a844858d221fc9affe9c18543e/ejb/plugin/src/main/java/org/jvnet/hyperjaxb3/xjc/reader/TypeUtil.java#L51-L53
janus-project/guava.janusproject.io
guava/src/com/google/common/collect/Iterables.java
Iterables.concat
public static <T> Iterable<T> concat(Iterable<? extends T> a, Iterable<? extends T> b, Iterable<? extends T> c, Iterable<? extends T> d) { return concat(ImmutableList.of(a, b, c, d)); }
java
public static <T> Iterable<T> concat(Iterable<? extends T> a, Iterable<? extends T> b, Iterable<? extends T> c, Iterable<? extends T> d) { return concat(ImmutableList.of(a, b, c, d)); }
[ "public", "static", "<", "T", ">", "Iterable", "<", "T", ">", "concat", "(", "Iterable", "<", "?", "extends", "T", ">", "a", ",", "Iterable", "<", "?", "extends", "T", ">", "b", ",", "Iterable", "<", "?", "extends", "T", ">", "c", ",", "Iterable"...
Combines four iterables into a single iterable. The returned iterable has an iterator that traverses the elements in {@code a}, followed by the elements in {@code b}, followed by the elements in {@code c}, followed by the elements in {@code d}. The source iterators are not polled until necessary. <p>The returned iterable's iterator supports {@code remove()} when the corresponding input iterator supports it.
[ "Combines", "four", "iterables", "into", "a", "single", "iterable", ".", "The", "returned", "iterable", "has", "an", "iterator", "that", "traverses", "the", "elements", "in", "{", "@code", "a", "}", "followed", "by", "the", "elements", "in", "{", "@code", ...
train
https://github.com/janus-project/guava.janusproject.io/blob/1c48fb672c9fdfddf276970570f703fa1115f588/guava/src/com/google/common/collect/Iterables.java#L467-L471
amaembo/streamex
src/main/java/one/util/streamex/StreamEx.java
StreamEx.groupingBy
public <K, D> Map<K, D> groupingBy(Function<? super T, ? extends K> classifier, Collector<? super T, ?, D> downstream) { if (isParallel() && downstream.characteristics().contains(Characteristics.UNORDERED)) return rawCollect(Collectors.groupingByConcurrent(classifier, downstream)); return rawCollect(Collectors.groupingBy(classifier, downstream)); }
java
public <K, D> Map<K, D> groupingBy(Function<? super T, ? extends K> classifier, Collector<? super T, ?, D> downstream) { if (isParallel() && downstream.characteristics().contains(Characteristics.UNORDERED)) return rawCollect(Collectors.groupingByConcurrent(classifier, downstream)); return rawCollect(Collectors.groupingBy(classifier, downstream)); }
[ "public", "<", "K", ",", "D", ">", "Map", "<", "K", ",", "D", ">", "groupingBy", "(", "Function", "<", "?", "super", "T", ",", "?", "extends", "K", ">", "classifier", ",", "Collector", "<", "?", "super", "T", ",", "?", ",", "D", ">", "downstrea...
Returns a {@code Map} whose keys are the values resulting from applying the classification function to the input elements, and whose corresponding values are the result of reduction of the input elements which map to the associated key under the classification function. <p> There are no guarantees on the type, mutability or serializability of the {@code Map} objects returned. <p> This is a <a href="package-summary.html#StreamOps">terminal</a> operation. @param <K> the type of the keys @param <D> the result type of the downstream reduction @param classifier the classifier function mapping input elements to keys @param downstream a {@code Collector} implementing the downstream reduction @return a {@code Map} containing the results of the group-by operation @see #groupingBy(Function) @see Collectors#groupingBy(Function, Collector) @see Collectors#groupingByConcurrent(Function, Collector)
[ "Returns", "a", "{", "@code", "Map", "}", "whose", "keys", "are", "the", "values", "resulting", "from", "applying", "the", "classification", "function", "to", "the", "input", "elements", "and", "whose", "corresponding", "values", "are", "the", "result", "of", ...
train
https://github.com/amaembo/streamex/blob/936bbd1b7dfbcf64a3b990682bfc848213441d14/src/main/java/one/util/streamex/StreamEx.java#L532-L537
OpenLiberty/open-liberty
dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/internal/ConsumerUtil.java
ConsumerUtil.validateSignatureAlgorithmWithKey
void validateSignatureAlgorithmWithKey(JwtConsumerConfig config, Key key) throws InvalidClaimException { String signatureAlgorithm = config.getSignatureAlgorithm(); if (key == null && signatureAlgorithm != null && !signatureAlgorithm.equalsIgnoreCase("none")) { String msg = Tr.formatMessage(tc, "JWT_MISSING_KEY", new Object[] { signatureAlgorithm }); throw new InvalidClaimException(msg); } }
java
void validateSignatureAlgorithmWithKey(JwtConsumerConfig config, Key key) throws InvalidClaimException { String signatureAlgorithm = config.getSignatureAlgorithm(); if (key == null && signatureAlgorithm != null && !signatureAlgorithm.equalsIgnoreCase("none")) { String msg = Tr.formatMessage(tc, "JWT_MISSING_KEY", new Object[] { signatureAlgorithm }); throw new InvalidClaimException(msg); } }
[ "void", "validateSignatureAlgorithmWithKey", "(", "JwtConsumerConfig", "config", ",", "Key", "key", ")", "throws", "InvalidClaimException", "{", "String", "signatureAlgorithm", "=", "config", ".", "getSignatureAlgorithm", "(", ")", ";", "if", "(", "key", "==", "null...
Throws an exception if the provided key is null but the config specifies a signature algorithm other than "none".
[ "Throws", "an", "exception", "if", "the", "provided", "key", "is", "null", "but", "the", "config", "specifies", "a", "signature", "algorithm", "other", "than", "none", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.security.jwt/src/com/ibm/ws/security/jwt/internal/ConsumerUtil.java#L394-L400
googleapis/google-cloud-java
google-cloud-clients/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/DeviceManagerClient.java
DeviceManagerClient.createDeviceRegistry
public final DeviceRegistry createDeviceRegistry(String parent, DeviceRegistry deviceRegistry) { CreateDeviceRegistryRequest request = CreateDeviceRegistryRequest.newBuilder() .setParent(parent) .setDeviceRegistry(deviceRegistry) .build(); return createDeviceRegistry(request); }
java
public final DeviceRegistry createDeviceRegistry(String parent, DeviceRegistry deviceRegistry) { CreateDeviceRegistryRequest request = CreateDeviceRegistryRequest.newBuilder() .setParent(parent) .setDeviceRegistry(deviceRegistry) .build(); return createDeviceRegistry(request); }
[ "public", "final", "DeviceRegistry", "createDeviceRegistry", "(", "String", "parent", ",", "DeviceRegistry", "deviceRegistry", ")", "{", "CreateDeviceRegistryRequest", "request", "=", "CreateDeviceRegistryRequest", ".", "newBuilder", "(", ")", ".", "setParent", "(", "pa...
Creates a device registry that contains devices. <p>Sample code: <pre><code> try (DeviceManagerClient deviceManagerClient = DeviceManagerClient.create()) { LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); DeviceRegistry deviceRegistry = DeviceRegistry.newBuilder().build(); DeviceRegistry response = deviceManagerClient.createDeviceRegistry(parent.toString(), deviceRegistry); } </code></pre> @param parent The project and cloud region where this device registry must be created. For example, `projects/example-project/locations/us-central1`. @param deviceRegistry The device registry. The field `name` must be empty. The server will generate that field from the device registry `id` provided and the `parent` field. @throws com.google.api.gax.rpc.ApiException if the remote call fails
[ "Creates", "a", "device", "registry", "that", "contains", "devices", "." ]
train
https://github.com/googleapis/google-cloud-java/blob/d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a/google-cloud-clients/google-cloud-iot/src/main/java/com/google/cloud/iot/v1/DeviceManagerClient.java#L216-L224
alkacon/opencms-core
src/org/opencms/ugc/CmsUgcSession.java
CmsUgcSession.createUploadResource
public CmsResource createUploadResource(String fieldName, String rawFileName, byte[] content) throws CmsUgcException { CmsResource result = null; CmsUgcSessionSecurityUtil.checkCreateUpload(m_cms, m_configuration, rawFileName, content.length); String baseName = rawFileName; // if the given name is a path, make sure we only get the last segment int lastSlashPos = Math.max(baseName.lastIndexOf('/'), baseName.lastIndexOf('\\')); if (lastSlashPos != -1) { baseName = baseName.substring(1 + lastSlashPos); } // translate it so it doesn't contain illegal characters baseName = OpenCms.getResourceManager().getFileTranslator().translateResource(baseName); // add a macro before the file extension (if there is a file extension, otherwise just append it) int dotPos = baseName.lastIndexOf('.'); if (dotPos == -1) { baseName = baseName + "_%(random)"; } else { baseName = baseName.substring(0, dotPos) + "_%(random)" + baseName.substring(dotPos); } // now prepend the upload folder's path String uploadRootPath = m_configuration.getUploadParentFolder().get().getRootPath(); String sitePath = CmsStringUtil.joinPaths(m_cms.getRequestContext().removeSiteRoot(uploadRootPath), baseName); // ... and replace the macro with random strings until we find a path that isn't already used String realSitePath; do { CmsMacroResolver resolver = new CmsMacroResolver(); resolver.addMacro("random", RandomStringUtils.random(8, "0123456789abcdefghijklmnopqrstuvwxyz")); realSitePath = resolver.resolveMacros(sitePath); } while (m_cms.existsResource(realSitePath)); try { I_CmsResourceType resType = OpenCms.getResourceManager().getDefaultTypeForName(realSitePath); result = m_cms.createResource(realSitePath, resType, content, null); updateUploadResource(fieldName, result); return result; } catch (CmsException e) { LOG.error(e.getLocalizedMessage(), e); throw new CmsUgcException(e, CmsUgcConstants.ErrorCode.errMisc, e.getLocalizedMessage()); } }
java
public CmsResource createUploadResource(String fieldName, String rawFileName, byte[] content) throws CmsUgcException { CmsResource result = null; CmsUgcSessionSecurityUtil.checkCreateUpload(m_cms, m_configuration, rawFileName, content.length); String baseName = rawFileName; // if the given name is a path, make sure we only get the last segment int lastSlashPos = Math.max(baseName.lastIndexOf('/'), baseName.lastIndexOf('\\')); if (lastSlashPos != -1) { baseName = baseName.substring(1 + lastSlashPos); } // translate it so it doesn't contain illegal characters baseName = OpenCms.getResourceManager().getFileTranslator().translateResource(baseName); // add a macro before the file extension (if there is a file extension, otherwise just append it) int dotPos = baseName.lastIndexOf('.'); if (dotPos == -1) { baseName = baseName + "_%(random)"; } else { baseName = baseName.substring(0, dotPos) + "_%(random)" + baseName.substring(dotPos); } // now prepend the upload folder's path String uploadRootPath = m_configuration.getUploadParentFolder().get().getRootPath(); String sitePath = CmsStringUtil.joinPaths(m_cms.getRequestContext().removeSiteRoot(uploadRootPath), baseName); // ... and replace the macro with random strings until we find a path that isn't already used String realSitePath; do { CmsMacroResolver resolver = new CmsMacroResolver(); resolver.addMacro("random", RandomStringUtils.random(8, "0123456789abcdefghijklmnopqrstuvwxyz")); realSitePath = resolver.resolveMacros(sitePath); } while (m_cms.existsResource(realSitePath)); try { I_CmsResourceType resType = OpenCms.getResourceManager().getDefaultTypeForName(realSitePath); result = m_cms.createResource(realSitePath, resType, content, null); updateUploadResource(fieldName, result); return result; } catch (CmsException e) { LOG.error(e.getLocalizedMessage(), e); throw new CmsUgcException(e, CmsUgcConstants.ErrorCode.errMisc, e.getLocalizedMessage()); } }
[ "public", "CmsResource", "createUploadResource", "(", "String", "fieldName", ",", "String", "rawFileName", ",", "byte", "[", "]", "content", ")", "throws", "CmsUgcException", "{", "CmsResource", "result", "=", "null", ";", "CmsUgcSessionSecurityUtil", ".", "checkCre...
Creates a new resource from upload data.<p> @param fieldName the name of the form field for the upload @param rawFileName the file name @param content the file content @return the newly created resource @throws CmsUgcException if creating the resource fails
[ "Creates", "a", "new", "resource", "from", "upload", "data", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/ugc/CmsUgcSession.java#L243-L292
belaban/JGroups
src/org/jgroups/View.java
View.sameMembersOrdered
public static boolean sameMembersOrdered(View v1, View v2) { return Arrays.equals(v1.getMembersRaw(), v2.getMembersRaw()); }
java
public static boolean sameMembersOrdered(View v1, View v2) { return Arrays.equals(v1.getMembersRaw(), v2.getMembersRaw()); }
[ "public", "static", "boolean", "sameMembersOrdered", "(", "View", "v1", ",", "View", "v2", ")", "{", "return", "Arrays", ".", "equals", "(", "v1", ".", "getMembersRaw", "(", ")", ",", "v2", ".", "getMembersRaw", "(", ")", ")", ";", "}" ]
Checks if two views have the same members observing order. E.g. {A,B,C} and {B,A,C} returns false, {A,C,B} and {A,C,B} returns true
[ "Checks", "if", "two", "views", "have", "the", "same", "members", "observing", "order", ".", "E", ".", "g", ".", "{", "A", "B", "C", "}", "and", "{", "B", "A", "C", "}", "returns", "false", "{", "A", "C", "B", "}", "and", "{", "A", "C", "B", ...
train
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/View.java#L311-L313
threerings/narya
core/src/main/java/com/threerings/crowd/server/BodyManager.java
BodyManager.updateOccupantStatus
public void updateOccupantStatus (BodyObject body, final byte status) { // no need to NOOP if (body.status != status) { // update the status in their body object body.setStatus(status); body.getLocal(BodyLocal.class).statusTime = System.currentTimeMillis(); } updateOccupantInfo(body, new OccupantInfo.Updater<OccupantInfo>() { public boolean update (OccupantInfo info) { if (info.status == status) { return false; } info.status = status; return true; } }); }
java
public void updateOccupantStatus (BodyObject body, final byte status) { // no need to NOOP if (body.status != status) { // update the status in their body object body.setStatus(status); body.getLocal(BodyLocal.class).statusTime = System.currentTimeMillis(); } updateOccupantInfo(body, new OccupantInfo.Updater<OccupantInfo>() { public boolean update (OccupantInfo info) { if (info.status == status) { return false; } info.status = status; return true; } }); }
[ "public", "void", "updateOccupantStatus", "(", "BodyObject", "body", ",", "final", "byte", "status", ")", "{", "// no need to NOOP", "if", "(", "body", ".", "status", "!=", "status", ")", "{", "// update the status in their body object", "body", ".", "setStatus", ...
Updates the connection status for the given body object's occupant info in the specified location.
[ "Updates", "the", "connection", "status", "for", "the", "given", "body", "object", "s", "occupant", "info", "in", "the", "specified", "location", "." ]
train
https://github.com/threerings/narya/blob/5b01edc8850ed0c32d004b4049e1ac4a02027ede/core/src/main/java/com/threerings/crowd/server/BodyManager.java#L68-L86
elki-project/elki
elki-core-dbids-int/src/main/java/de/lmu/ifi/dbs/elki/database/ids/integer/DoubleIntegerDBIDArrayList.java
DoubleIntegerDBIDArrayList.addInternal
protected void addInternal(double dist, int id) { if(size == dists.length) { grow(); } dists[size] = dist; ids[size] = id; ++size; }
java
protected void addInternal(double dist, int id) { if(size == dists.length) { grow(); } dists[size] = dist; ids[size] = id; ++size; }
[ "protected", "void", "addInternal", "(", "double", "dist", ",", "int", "id", ")", "{", "if", "(", "size", "==", "dists", ".", "length", ")", "{", "grow", "(", ")", ";", "}", "dists", "[", "size", "]", "=", "dist", ";", "ids", "[", "size", "]", ...
Add an entry, consisting of distance and internal index. @param dist Distance @param id Internal index
[ "Add", "an", "entry", "consisting", "of", "distance", "and", "internal", "index", "." ]
train
https://github.com/elki-project/elki/blob/b54673327e76198ecd4c8a2a901021f1a9174498/elki-core-dbids-int/src/main/java/de/lmu/ifi/dbs/elki/database/ids/integer/DoubleIntegerDBIDArrayList.java#L132-L139
mgm-tp/jfunk
jfunk-core/src/main/java/com/mgmtp/jfunk/core/mail/MailService.java
MailService.findMessages
public List<MailMessage> findMessages(final String accountReservationKey, final Predicate<MailMessage> condition, final long timeoutSeconds) { return findMessages(accountReservationKey, condition, timeoutSeconds, defaultSleepMillis); }
java
public List<MailMessage> findMessages(final String accountReservationKey, final Predicate<MailMessage> condition, final long timeoutSeconds) { return findMessages(accountReservationKey, condition, timeoutSeconds, defaultSleepMillis); }
[ "public", "List", "<", "MailMessage", ">", "findMessages", "(", "final", "String", "accountReservationKey", ",", "final", "Predicate", "<", "MailMessage", ">", "condition", ",", "final", "long", "timeoutSeconds", ")", "{", "return", "findMessages", "(", "accountRe...
Tries to find messages for the mail account reserved under the specified {@code accountReservationKey} applying the specified {@code condition} until it times out using the specified {@code timeout} and {@link EmailConstants#MAIL_SLEEP_MILLIS}. @param accountReservationKey the key under which the account has been reserved @param condition the condition a message must meet @param timeoutSeconds the timeout in seconds @return an immutable list of mail messages
[ "Tries", "to", "find", "messages", "for", "the", "mail", "account", "reserved", "under", "the", "specified", "{", "@code", "accountReservationKey", "}", "applying", "the", "specified", "{", "@code", "condition", "}", "until", "it", "times", "out", "using", "th...
train
https://github.com/mgm-tp/jfunk/blob/5b9fecac5778b988bb458085ded39ea9a4c7c2ae/jfunk-core/src/main/java/com/mgmtp/jfunk/core/mail/MailService.java#L302-L305
phax/ph-commons
ph-commons/src/main/java/com/helger/commons/text/codepoint/CodepointHelper.java
CodepointHelper.wrapBidi
@Nullable public static String wrapBidi (@Nullable final String sStr, final char cChar) { switch (cChar) { case RLE: return _wrap (sStr, RLE, PDF); case RLO: return _wrap (sStr, RLO, PDF); case LRE: return _wrap (sStr, LRE, PDF); case LRO: return _wrap (sStr, LRO, PDF); case RLM: return _wrap (sStr, RLM, RLM); case LRM: return _wrap (sStr, LRM, LRM); default: return sStr; } }
java
@Nullable public static String wrapBidi (@Nullable final String sStr, final char cChar) { switch (cChar) { case RLE: return _wrap (sStr, RLE, PDF); case RLO: return _wrap (sStr, RLO, PDF); case LRE: return _wrap (sStr, LRE, PDF); case LRO: return _wrap (sStr, LRO, PDF); case RLM: return _wrap (sStr, RLM, RLM); case LRM: return _wrap (sStr, LRM, LRM); default: return sStr; } }
[ "@", "Nullable", "public", "static", "String", "wrapBidi", "(", "@", "Nullable", "final", "String", "sStr", ",", "final", "char", "cChar", ")", "{", "switch", "(", "cChar", ")", "{", "case", "RLE", ":", "return", "_wrap", "(", "sStr", ",", "RLE", ",", ...
Wrap the string with the specified bidi control @param sStr source string @param cChar source char @return The wrapped string
[ "Wrap", "the", "string", "with", "the", "specified", "bidi", "control" ]
train
https://github.com/phax/ph-commons/blob/d28c03565f44a0b804d96028d0969f9bb38c4313/ph-commons/src/main/java/com/helger/commons/text/codepoint/CodepointHelper.java#L390-L410
gmessner/gitlab4j-api
src/main/java/org/gitlab4j/api/ProjectApi.java
ProjectApi.deleteSnippet
public void deleteSnippet(Object projectIdOrPath, Integer snippetId) throws GitLabApiException { delete(Response.Status.NO_CONTENT, null, "projects", getProjectIdOrPath(projectIdOrPath), "snippets", snippetId); }
java
public void deleteSnippet(Object projectIdOrPath, Integer snippetId) throws GitLabApiException { delete(Response.Status.NO_CONTENT, null, "projects", getProjectIdOrPath(projectIdOrPath), "snippets", snippetId); }
[ "public", "void", "deleteSnippet", "(", "Object", "projectIdOrPath", ",", "Integer", "snippetId", ")", "throws", "GitLabApiException", "{", "delete", "(", "Response", ".", "Status", ".", "NO_CONTENT", ",", "null", ",", "\"projects\"", ",", "getProjectIdOrPath", "(...
/* Deletes an existing project snippet. This is an idempotent function and deleting a non-existent snippet does not cause an error. <pre><code>DELETE /projects/:id/snippets/:snippet_id</code></pre> @param projectIdOrPath projectIdOrPath the project in the form of an Integer(ID), String(path), or Project instance, required @param snippetId the ID of the project's snippet @throws GitLabApiException if any exception occurs
[ "/", "*", "Deletes", "an", "existing", "project", "snippet", ".", "This", "is", "an", "idempotent", "function", "and", "deleting", "a", "non", "-", "existent", "snippet", "does", "not", "cause", "an", "error", "." ]
train
https://github.com/gmessner/gitlab4j-api/blob/ab045070abac0a8f4ccbf17b5ed9bfdef5723eed/src/main/java/org/gitlab4j/api/ProjectApi.java#L2035-L2037
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/operations/Variable.java
Variable.execute
public XObject execute(XPathContext xctxt, boolean destructiveOK) throws javax.xml.transform.TransformerException { org.apache.xml.utils.PrefixResolver xprefixResolver = xctxt.getNamespaceContext(); XObject result; // Is the variable fetched always the same? // XObject result = xctxt.getVariable(m_qname); if(m_fixUpWasCalled) { if(m_isGlobal) result = xctxt.getVarStack().getGlobalVariable(xctxt, m_index, destructiveOK); else result = xctxt.getVarStack().getLocalVariable(xctxt, m_index, destructiveOK); } else { result = xctxt.getVarStack().getVariableOrParam(xctxt,m_qname); } if (null == result) { // This should now never happen... warn(xctxt, XPATHErrorResources.WG_ILLEGAL_VARIABLE_REFERENCE, new Object[]{ m_qname.getLocalPart() }); //"VariableReference given for variable out "+ // (new RuntimeException()).printStackTrace(); // error(xctxt, XPATHErrorResources.ER_COULDNOT_GET_VAR_NAMED, // new Object[]{ m_qname.getLocalPart() }); //"Could not get variable named "+varName); result = new XNodeSet(xctxt.getDTMManager()); } return result; // } // else // { // // Hack city... big time. This is needed to evaluate xpaths from extensions, // // pending some bright light going off in my head. Some sort of callback? // synchronized(this) // { // org.apache.xalan.templates.ElemVariable vvar= getElemVariable(); // if(null != vvar) // { // m_index = vvar.getIndex(); // m_isGlobal = vvar.getIsTopLevel(); // m_fixUpWasCalled = true; // return execute(xctxt); // } // } // throw new javax.xml.transform.TransformerException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_VAR_NOT_RESOLVABLE, new Object[]{m_qname.toString()})); //"Variable not resolvable: "+m_qname); // } }
java
public XObject execute(XPathContext xctxt, boolean destructiveOK) throws javax.xml.transform.TransformerException { org.apache.xml.utils.PrefixResolver xprefixResolver = xctxt.getNamespaceContext(); XObject result; // Is the variable fetched always the same? // XObject result = xctxt.getVariable(m_qname); if(m_fixUpWasCalled) { if(m_isGlobal) result = xctxt.getVarStack().getGlobalVariable(xctxt, m_index, destructiveOK); else result = xctxt.getVarStack().getLocalVariable(xctxt, m_index, destructiveOK); } else { result = xctxt.getVarStack().getVariableOrParam(xctxt,m_qname); } if (null == result) { // This should now never happen... warn(xctxt, XPATHErrorResources.WG_ILLEGAL_VARIABLE_REFERENCE, new Object[]{ m_qname.getLocalPart() }); //"VariableReference given for variable out "+ // (new RuntimeException()).printStackTrace(); // error(xctxt, XPATHErrorResources.ER_COULDNOT_GET_VAR_NAMED, // new Object[]{ m_qname.getLocalPart() }); //"Could not get variable named "+varName); result = new XNodeSet(xctxt.getDTMManager()); } return result; // } // else // { // // Hack city... big time. This is needed to evaluate xpaths from extensions, // // pending some bright light going off in my head. Some sort of callback? // synchronized(this) // { // org.apache.xalan.templates.ElemVariable vvar= getElemVariable(); // if(null != vvar) // { // m_index = vvar.getIndex(); // m_isGlobal = vvar.getIsTopLevel(); // m_fixUpWasCalled = true; // return execute(xctxt); // } // } // throw new javax.xml.transform.TransformerException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_VAR_NOT_RESOLVABLE, new Object[]{m_qname.toString()})); //"Variable not resolvable: "+m_qname); // } }
[ "public", "XObject", "execute", "(", "XPathContext", "xctxt", ",", "boolean", "destructiveOK", ")", "throws", "javax", ".", "xml", ".", "transform", ".", "TransformerException", "{", "org", ".", "apache", ".", "xml", ".", "utils", ".", "PrefixResolver", "xpref...
Dereference the variable, and return the reference value. Note that lazy evaluation will occur. If a variable within scope is not found, a warning will be sent to the error listener, and an empty nodeset will be returned. @param xctxt The runtime execution context. @return The evaluated variable, or an empty nodeset if not found. @throws javax.xml.transform.TransformerException
[ "Dereference", "the", "variable", "and", "return", "the", "reference", "value", ".", "Note", "that", "lazy", "evaluation", "will", "occur", ".", "If", "a", "variable", "within", "scope", "is", "not", "found", "a", "warning", "will", "be", "sent", "to", "th...
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/operations/Variable.java#L204-L253
cdk/cdk
storage/inchi/src/main/java/org/openscience/cdk/inchi/InChIGeneratorFactory.java
InChIGeneratorFactory.getInChIGenerator
public InChIGenerator getInChIGenerator(IAtomContainer container, List<INCHI_OPTION> options) throws CDKException { if (options == null) throw new IllegalArgumentException("Null options"); return (new InChIGenerator(container, options, ignoreAromaticBonds)); }
java
public InChIGenerator getInChIGenerator(IAtomContainer container, List<INCHI_OPTION> options) throws CDKException { if (options == null) throw new IllegalArgumentException("Null options"); return (new InChIGenerator(container, options, ignoreAromaticBonds)); }
[ "public", "InChIGenerator", "getInChIGenerator", "(", "IAtomContainer", "container", ",", "List", "<", "INCHI_OPTION", ">", "options", ")", "throws", "CDKException", "{", "if", "(", "options", "==", "null", ")", "throw", "new", "IllegalArgumentException", "(", "\"...
Gets InChI generator for CDK IAtomContainer. @param container AtomContainer to generate InChI for. @param options List of options (net.sf.jniinchi.INCHI_OPTION) for InChI generation. @return the InChI generator object @throws CDKException if the generator cannot be instantiated
[ "Gets", "InChI", "generator", "for", "CDK", "IAtomContainer", "." ]
train
https://github.com/cdk/cdk/blob/c3d0f16502bf08df50365fee392e11d7c9856657/storage/inchi/src/main/java/org/openscience/cdk/inchi/InChIGeneratorFactory.java#L170-L173
geomajas/geomajas-project-server
impl/src/main/java/org/geomajas/internal/rendering/writer/svg/geometry/GeometryCollectionWriter.java
GeometryCollectionWriter.writeObject
public void writeObject(Object o, GraphicsDocument document, boolean asChild) throws RenderException { GeometryCollection coll = (GeometryCollection) o; document.writeElement("path", asChild); document.writeAttribute("fill-rule", "evenodd"); document.writeAttributeStart("d"); for (int i = 0; i < coll.getNumGeometries(); i++) { document.writeObject(coll.getGeometryN(i), true); // TODO delegate to appropriate writers, is this correct? } document.writeAttributeEnd(); }
java
public void writeObject(Object o, GraphicsDocument document, boolean asChild) throws RenderException { GeometryCollection coll = (GeometryCollection) o; document.writeElement("path", asChild); document.writeAttribute("fill-rule", "evenodd"); document.writeAttributeStart("d"); for (int i = 0; i < coll.getNumGeometries(); i++) { document.writeObject(coll.getGeometryN(i), true); // TODO delegate to appropriate writers, is this correct? } document.writeAttributeEnd(); }
[ "public", "void", "writeObject", "(", "Object", "o", ",", "GraphicsDocument", "document", ",", "boolean", "asChild", ")", "throws", "RenderException", "{", "GeometryCollection", "coll", "=", "(", "GeometryCollection", ")", "o", ";", "document", ".", "writeElement"...
Writes a <code>GeometryCollection</code> object. @param o The <code>LineString</code> to be encoded.
[ "Writes", "a", "<code", ">", "GeometryCollection<", "/", "code", ">", "object", "." ]
train
https://github.com/geomajas/geomajas-project-server/blob/904b7d7deed1350d28955589098dd1e0a786d76e/impl/src/main/java/org/geomajas/internal/rendering/writer/svg/geometry/GeometryCollectionWriter.java#L34-L43
grpc/grpc-java
core/src/main/java/io/grpc/internal/ConnectivityStateManager.java
ConnectivityStateManager.notifyWhenStateChanged
void notifyWhenStateChanged(Runnable callback, Executor executor, ConnectivityState source) { checkNotNull(callback, "callback"); checkNotNull(executor, "executor"); checkNotNull(source, "source"); Listener stateChangeListener = new Listener(callback, executor); if (state != source) { stateChangeListener.runInExecutor(); } else { listeners.add(stateChangeListener); } }
java
void notifyWhenStateChanged(Runnable callback, Executor executor, ConnectivityState source) { checkNotNull(callback, "callback"); checkNotNull(executor, "executor"); checkNotNull(source, "source"); Listener stateChangeListener = new Listener(callback, executor); if (state != source) { stateChangeListener.runInExecutor(); } else { listeners.add(stateChangeListener); } }
[ "void", "notifyWhenStateChanged", "(", "Runnable", "callback", ",", "Executor", "executor", ",", "ConnectivityState", "source", ")", "{", "checkNotNull", "(", "callback", ",", "\"callback\"", ")", ";", "checkNotNull", "(", "executor", ",", "\"executor\"", ")", ";"...
Adds a listener for state change event. <p>The {@code executor} must be one that can run RPC call listeners.
[ "Adds", "a", "listener", "for", "state", "change", "event", "." ]
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/core/src/main/java/io/grpc/internal/ConnectivityStateManager.java#L45-L56
twotoasters/RecyclerViewLib
library/src/main/java/com/twotoasters/android/support/v7/widget/RecyclerView.java
RecyclerView.viewRangeUpdate
void viewRangeUpdate(int positionStart, int itemCount) { final int childCount = getChildCount(); final int positionEnd = positionStart + itemCount; for (int i = 0; i < childCount; i++) { final ViewHolder holder = getChildViewHolderInt(getChildAt(i)); if (holder == null) { continue; } final int position = holder.getPosition(); if (position >= positionStart && position < positionEnd) { holder.addFlags(ViewHolder.FLAG_UPDATE); // Binding an attached view will request a layout if needed. mAdapter.bindViewHolder(holder, holder.getPosition()); } } mRecycler.viewRangeUpdate(positionStart, itemCount); }
java
void viewRangeUpdate(int positionStart, int itemCount) { final int childCount = getChildCount(); final int positionEnd = positionStart + itemCount; for (int i = 0; i < childCount; i++) { final ViewHolder holder = getChildViewHolderInt(getChildAt(i)); if (holder == null) { continue; } final int position = holder.getPosition(); if (position >= positionStart && position < positionEnd) { holder.addFlags(ViewHolder.FLAG_UPDATE); // Binding an attached view will request a layout if needed. mAdapter.bindViewHolder(holder, holder.getPosition()); } } mRecycler.viewRangeUpdate(positionStart, itemCount); }
[ "void", "viewRangeUpdate", "(", "int", "positionStart", ",", "int", "itemCount", ")", "{", "final", "int", "childCount", "=", "getChildCount", "(", ")", ";", "final", "int", "positionEnd", "=", "positionStart", "+", "itemCount", ";", "for", "(", "int", "i", ...
Rebind existing views for the given range, or create as needed. @param positionStart Adapter position to start at @param itemCount Number of views that must explicitly be rebound
[ "Rebind", "existing", "views", "for", "the", "given", "range", "or", "create", "as", "needed", "." ]
train
https://github.com/twotoasters/RecyclerViewLib/blob/2379fd5bbf57d4dfc8b28046b7ace950905c75f0/library/src/main/java/com/twotoasters/android/support/v7/widget/RecyclerView.java#L1880-L1898
looly/hutool
hutool-core/src/main/java/cn/hutool/core/util/RandomUtil.java
RandomUtil.randomEle
public static <T> T randomEle(List<T> list, int limit) { return list.get(randomInt(limit)); }
java
public static <T> T randomEle(List<T> list, int limit) { return list.get(randomInt(limit)); }
[ "public", "static", "<", "T", ">", "T", "randomEle", "(", "List", "<", "T", ">", "list", ",", "int", "limit", ")", "{", "return", "list", ".", "get", "(", "randomInt", "(", "limit", ")", ")", ";", "}" ]
随机获得列表中的元素 @param <T> 元素类型 @param list 列表 @param limit 限制列表的前N项 @return 随机元素
[ "随机获得列表中的元素" ]
train
https://github.com/looly/hutool/blob/bbd74eda4c7e8a81fe7a991fa6c2276eec062e6a/hutool-core/src/main/java/cn/hutool/core/util/RandomUtil.java#L274-L276
beangle/beangle3
struts/s2/src/main/java/org/beangle/struts2/view/component/UIBean.java
UIBean.processLabel
protected String processLabel(String label, String name) { if (null != label) { if (Strings.isEmpty(label)) return null; else return getText(label); } else return getText(name); }
java
protected String processLabel(String label, String name) { if (null != label) { if (Strings.isEmpty(label)) return null; else return getText(label); } else return getText(name); }
[ "protected", "String", "processLabel", "(", "String", "label", ",", "String", "name", ")", "{", "if", "(", "null", "!=", "label", ")", "{", "if", "(", "Strings", ".", "isEmpty", "(", "label", ")", ")", "return", "null", ";", "else", "return", "getText"...
Process label,convert empty to null @param label @param name @return
[ "Process", "label", "convert", "empty", "to", "null" ]
train
https://github.com/beangle/beangle3/blob/33df2873a5f38e28ac174a1d3b8144eb2f808e64/struts/s2/src/main/java/org/beangle/struts2/view/component/UIBean.java#L191-L196
googleapis/cloud-bigtable-client
bigtable-client-core-parent/bigtable-hbase/src/main/java/com/google/cloud/bigtable/hbase/adapters/read/RowRangeAdapter.java
RowRangeAdapter.rangeSetToByteStringRange
@VisibleForTesting void rangeSetToByteStringRange(RangeSet<RowKeyWrapper> guavaRangeSet, Query query) { for (Range<RowKeyWrapper> guavaRange : guavaRangeSet.asRanges()) { // Is it a point? if (guavaRange.hasLowerBound() && guavaRange.lowerBoundType() == BoundType.CLOSED && guavaRange.hasUpperBound() && guavaRange.upperBoundType() == BoundType.CLOSED && guavaRange.lowerEndpoint().equals(guavaRange.upperEndpoint())) { query.rowKey(guavaRange.lowerEndpoint().getKey()); } else { ByteStringRange byteRange = ByteStringRange.unbounded(); // Handle start key if (guavaRange.hasLowerBound()) { switch (guavaRange.lowerBoundType()) { case CLOSED: byteRange.startClosed(guavaRange.lowerEndpoint().getKey()); break; case OPEN: byteRange.startOpen(guavaRange.lowerEndpoint().getKey()); break; default: throw new IllegalArgumentException("Unexpected lower bound type: " + guavaRange.lowerBoundType()); } } // handle end key if (guavaRange.hasUpperBound()) { switch (guavaRange.upperBoundType()) { case CLOSED: byteRange.endClosed(guavaRange.upperEndpoint().getKey()); break; case OPEN: byteRange.endOpen(guavaRange.upperEndpoint().getKey()); break; default: throw new IllegalArgumentException("Unexpected upper bound type: " + guavaRange.upperBoundType()); } } query.range(byteRange); } } }
java
@VisibleForTesting void rangeSetToByteStringRange(RangeSet<RowKeyWrapper> guavaRangeSet, Query query) { for (Range<RowKeyWrapper> guavaRange : guavaRangeSet.asRanges()) { // Is it a point? if (guavaRange.hasLowerBound() && guavaRange.lowerBoundType() == BoundType.CLOSED && guavaRange.hasUpperBound() && guavaRange.upperBoundType() == BoundType.CLOSED && guavaRange.lowerEndpoint().equals(guavaRange.upperEndpoint())) { query.rowKey(guavaRange.lowerEndpoint().getKey()); } else { ByteStringRange byteRange = ByteStringRange.unbounded(); // Handle start key if (guavaRange.hasLowerBound()) { switch (guavaRange.lowerBoundType()) { case CLOSED: byteRange.startClosed(guavaRange.lowerEndpoint().getKey()); break; case OPEN: byteRange.startOpen(guavaRange.lowerEndpoint().getKey()); break; default: throw new IllegalArgumentException("Unexpected lower bound type: " + guavaRange.lowerBoundType()); } } // handle end key if (guavaRange.hasUpperBound()) { switch (guavaRange.upperBoundType()) { case CLOSED: byteRange.endClosed(guavaRange.upperEndpoint().getKey()); break; case OPEN: byteRange.endOpen(guavaRange.upperEndpoint().getKey()); break; default: throw new IllegalArgumentException("Unexpected upper bound type: " + guavaRange.upperBoundType()); } } query.range(byteRange); } } }
[ "@", "VisibleForTesting", "void", "rangeSetToByteStringRange", "(", "RangeSet", "<", "RowKeyWrapper", ">", "guavaRangeSet", ",", "Query", "query", ")", "{", "for", "(", "Range", "<", "RowKeyWrapper", ">", "guavaRange", ":", "guavaRangeSet", ".", "asRanges", "(", ...
Convert guava's {@link RangeSet} to Bigtable's {@link ByteStringRange}. Please note that this will convert boundless ranges into unset key cases.
[ "Convert", "guava", "s", "{" ]
train
https://github.com/googleapis/cloud-bigtable-client/blob/53543f36e4d6f9ed1963640d91a35be2a2047656/bigtable-client-core-parent/bigtable-hbase/src/main/java/com/google/cloud/bigtable/hbase/adapters/read/RowRangeAdapter.java#L131-L176
lessthanoptimal/BoofCV
main/boofcv-feature/src/main/java/boofcv/alg/flow/HornSchunck.java
HornSchunck.innerAverageFlow
protected static void innerAverageFlow( ImageFlow flow , ImageFlow averageFlow ) { int endX = flow.width-1; int endY = flow.height-1; for( int y = 1; y < endY; y++ ) { int index = flow.width*y + 1; for( int x = 1; x < endX; x++ , index++) { ImageFlow.D average = averageFlow.data[index]; ImageFlow.D f0 = flow.data[index-1]; ImageFlow.D f1 = flow.data[index+1]; ImageFlow.D f2 = flow.data[index-flow.width]; ImageFlow.D f3 = flow.data[index+flow.width]; ImageFlow.D f4 = flow.data[index-1-flow.width]; ImageFlow.D f5 = flow.data[index+1-flow.width]; ImageFlow.D f6 = flow.data[index-1+flow.width]; ImageFlow.D f7 = flow.data[index+1+flow.width]; average.x = 0.1666667f*(f0.x + f1.x + f2.x + f3.x) + 0.08333333f*(f4.x + f5.x + f6.x + f7.x); average.y = 0.1666667f*(f0.y + f1.y + f2.y + f3.y) + 0.08333333f*(f4.y + f5.y + f6.y + f7.y); } } }
java
protected static void innerAverageFlow( ImageFlow flow , ImageFlow averageFlow ) { int endX = flow.width-1; int endY = flow.height-1; for( int y = 1; y < endY; y++ ) { int index = flow.width*y + 1; for( int x = 1; x < endX; x++ , index++) { ImageFlow.D average = averageFlow.data[index]; ImageFlow.D f0 = flow.data[index-1]; ImageFlow.D f1 = flow.data[index+1]; ImageFlow.D f2 = flow.data[index-flow.width]; ImageFlow.D f3 = flow.data[index+flow.width]; ImageFlow.D f4 = flow.data[index-1-flow.width]; ImageFlow.D f5 = flow.data[index+1-flow.width]; ImageFlow.D f6 = flow.data[index-1+flow.width]; ImageFlow.D f7 = flow.data[index+1+flow.width]; average.x = 0.1666667f*(f0.x + f1.x + f2.x + f3.x) + 0.08333333f*(f4.x + f5.x + f6.x + f7.x); average.y = 0.1666667f*(f0.y + f1.y + f2.y + f3.y) + 0.08333333f*(f4.y + f5.y + f6.y + f7.y); } } }
[ "protected", "static", "void", "innerAverageFlow", "(", "ImageFlow", "flow", ",", "ImageFlow", "averageFlow", ")", "{", "int", "endX", "=", "flow", ".", "width", "-", "1", ";", "int", "endY", "=", "flow", ".", "height", "-", "1", ";", "for", "(", "int"...
Computes average flow using an 8-connect neighborhood for the inner image
[ "Computes", "average", "flow", "using", "an", "8", "-", "connect", "neighborhood", "for", "the", "inner", "image" ]
train
https://github.com/lessthanoptimal/BoofCV/blob/f01c0243da0ec086285ee722183804d5923bc3ac/main/boofcv-feature/src/main/java/boofcv/alg/flow/HornSchunck.java#L125-L149
SonarSource/sonarqube
server/sonar-server/src/main/java/org/sonar/server/component/ComponentUpdater.java
ComponentUpdater.createWithoutCommit
public ComponentDto createWithoutCommit(DbSession dbSession, NewComponent newComponent, @Nullable Integer userId) { checkKeyFormat(newComponent.qualifier(), newComponent.key()); ComponentDto componentDto = createRootComponent(dbSession, newComponent); if (isRootProject(componentDto)) { createMainBranch(dbSession, componentDto.uuid()); } removeDuplicatedProjects(dbSession, componentDto.getDbKey()); handlePermissionTemplate(dbSession, componentDto, userId); return componentDto; }
java
public ComponentDto createWithoutCommit(DbSession dbSession, NewComponent newComponent, @Nullable Integer userId) { checkKeyFormat(newComponent.qualifier(), newComponent.key()); ComponentDto componentDto = createRootComponent(dbSession, newComponent); if (isRootProject(componentDto)) { createMainBranch(dbSession, componentDto.uuid()); } removeDuplicatedProjects(dbSession, componentDto.getDbKey()); handlePermissionTemplate(dbSession, componentDto, userId); return componentDto; }
[ "public", "ComponentDto", "createWithoutCommit", "(", "DbSession", "dbSession", ",", "NewComponent", "newComponent", ",", "@", "Nullable", "Integer", "userId", ")", "{", "checkKeyFormat", "(", "newComponent", ".", "qualifier", "(", ")", ",", "newComponent", ".", "...
Create component without committing. Don't forget to call commitAndIndex(...) when ready to commit.
[ "Create", "component", "without", "committing", ".", "Don", "t", "forget", "to", "call", "commitAndIndex", "(", "...", ")", "when", "ready", "to", "commit", "." ]
train
https://github.com/SonarSource/sonarqube/blob/2fffa4c2f79ae3714844d7742796e82822b6a98a/server/sonar-server/src/main/java/org/sonar/server/component/ComponentUpdater.java#L87-L96
nmdp-bioinformatics/ngs
reads/src/main/java/org/nmdp/ngs/reads/paired/PairedEndFastqReader.java
PairedEndFastqReader.readPaired
public static void readPaired(final Readable firstReadable, final Readable secondReadable, final PairedEndListener listener) throws IOException { checkNotNull(firstReadable); checkNotNull(secondReadable); checkNotNull(listener); // read both FASTQ files into RAM (ick) final List<Fastq> reads = Lists.newArrayList(); SangerFastqReader fastqReader = new SangerFastqReader(); fastqReader.stream(firstReadable, new StreamListener() { @Override public void fastq(final Fastq fastq) { reads.add(fastq); } }); fastqReader.stream(secondReadable, new StreamListener() { @Override public void fastq(final Fastq fastq) { reads.add(fastq); } }); // .. and sort by description Collections.sort(reads, new Ordering<Fastq>() { @Override public int compare(final Fastq left, final Fastq right) { return left.getDescription().compareTo(right.getDescription()); } }); for (int i = 0, size = reads.size(); i < size; ) { Fastq left = reads.get(i); if ((i + 1) == size) { listener.unpaired(left); break; } Fastq right = reads.get(i + 1); if (isLeft(left)) { if (isRight(right)) { // todo: assert prefixes match listener.paired(left, right); i += 2; } else { listener.unpaired(right); i++; } } else { listener.unpaired(left); i++; } } }
java
public static void readPaired(final Readable firstReadable, final Readable secondReadable, final PairedEndListener listener) throws IOException { checkNotNull(firstReadable); checkNotNull(secondReadable); checkNotNull(listener); // read both FASTQ files into RAM (ick) final List<Fastq> reads = Lists.newArrayList(); SangerFastqReader fastqReader = new SangerFastqReader(); fastqReader.stream(firstReadable, new StreamListener() { @Override public void fastq(final Fastq fastq) { reads.add(fastq); } }); fastqReader.stream(secondReadable, new StreamListener() { @Override public void fastq(final Fastq fastq) { reads.add(fastq); } }); // .. and sort by description Collections.sort(reads, new Ordering<Fastq>() { @Override public int compare(final Fastq left, final Fastq right) { return left.getDescription().compareTo(right.getDescription()); } }); for (int i = 0, size = reads.size(); i < size; ) { Fastq left = reads.get(i); if ((i + 1) == size) { listener.unpaired(left); break; } Fastq right = reads.get(i + 1); if (isLeft(left)) { if (isRight(right)) { // todo: assert prefixes match listener.paired(left, right); i += 2; } else { listener.unpaired(right); i++; } } else { listener.unpaired(left); i++; } } }
[ "public", "static", "void", "readPaired", "(", "final", "Readable", "firstReadable", ",", "final", "Readable", "secondReadable", ",", "final", "PairedEndListener", "listener", ")", "throws", "IOException", "{", "checkNotNull", "(", "firstReadable", ")", ";", "checkN...
Read the specified paired end reads. The paired end reads are read fully into RAM before processing. @param firstReadable first readable, must not be null @param secondReadable second readable, must not be null @param listener paired end listener, must not be null @throws IOException if an I/O error occurs @deprecated by {@link #streamPaired(Readable,Readable,PairedEndListener)}, will be removed in version 2.0
[ "Read", "the", "specified", "paired", "end", "reads", ".", "The", "paired", "end", "reads", "are", "read", "fully", "into", "RAM", "before", "processing", "." ]
train
https://github.com/nmdp-bioinformatics/ngs/blob/277627e4311313a80f5dc110b3185b0d7af32bd0/reads/src/main/java/org/nmdp/ngs/reads/paired/PairedEndFastqReader.java#L98-L154
Azure/azure-sdk-for-java
kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/DatabasesInner.java
DatabasesInner.addPrincipals
public DatabasePrincipalListResultInner addPrincipals(String resourceGroupName, String clusterName, String databaseName, List<DatabasePrincipalInner> value) { return addPrincipalsWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, value).toBlocking().single().body(); }
java
public DatabasePrincipalListResultInner addPrincipals(String resourceGroupName, String clusterName, String databaseName, List<DatabasePrincipalInner> value) { return addPrincipalsWithServiceResponseAsync(resourceGroupName, clusterName, databaseName, value).toBlocking().single().body(); }
[ "public", "DatabasePrincipalListResultInner", "addPrincipals", "(", "String", "resourceGroupName", ",", "String", "clusterName", ",", "String", "databaseName", ",", "List", "<", "DatabasePrincipalInner", ">", "value", ")", "{", "return", "addPrincipalsWithServiceResponseAsy...
Add Database principals permissions. @param resourceGroupName The name of the resource group containing the Kusto cluster. @param clusterName The name of the Kusto cluster. @param databaseName The name of the database in the Kusto cluster. @param value The list of Kusto database principals. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the DatabasePrincipalListResultInner object if successful.
[ "Add", "Database", "principals", "permissions", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/DatabasesInner.java#L1135-L1137
JavaMoney/jsr354-api
src/main/java/javax/money/Monetary.java
Monetary.getRounding
public static MonetaryRounding getRounding(String roundingName, String... providers) { return Optional.ofNullable(monetaryRoundingsSingletonSpi()).orElseThrow( () -> new MonetaryException("No MonetaryRoundingsSpi loaded, query functionality is not available.")) .getRounding(roundingName, providers); }
java
public static MonetaryRounding getRounding(String roundingName, String... providers) { return Optional.ofNullable(monetaryRoundingsSingletonSpi()).orElseThrow( () -> new MonetaryException("No MonetaryRoundingsSpi loaded, query functionality is not available.")) .getRounding(roundingName, providers); }
[ "public", "static", "MonetaryRounding", "getRounding", "(", "String", "roundingName", ",", "String", "...", "providers", ")", "{", "return", "Optional", ".", "ofNullable", "(", "monetaryRoundingsSingletonSpi", "(", ")", ")", ".", "orElseThrow", "(", "(", ")", "-...
Access an {@link MonetaryOperator} for custom rounding {@link MonetaryAmount} instances. @param roundingName The rounding identifier. @param providers the providers and ordering to be used. By default providers and ordering as defined in #getDefaultProviders is used. @return the corresponding {@link MonetaryOperator} implementing the rounding, never {@code null}. @throws IllegalArgumentException if no such rounding is registered using a {@link javax.money.spi.RoundingProviderSpi} instance.
[ "Access", "an", "{", "@link", "MonetaryOperator", "}", "for", "custom", "rounding", "{", "@link", "MonetaryAmount", "}", "instances", "." ]
train
https://github.com/JavaMoney/jsr354-api/blob/49a7ae436eaf45cac1040879185531ef22de5525/src/main/java/javax/money/Monetary.java#L171-L175
geomajas/geomajas-project-client-gwt2
plugin/wms/server-extension/src/main/java/org/geomajas/gwt2/plugin/wms/client/WmsServerExtension.java
WmsServerExtension.createLayer
public FeatureSearchSupportedWmsServerLayer createLayer(String title, String crs, TileConfiguration tileConfig, WmsLayerConfiguration layerConfig, WmsLayerInfo layerInfo, WfsFeatureTypeDescriptionInfo wfsConfig) { return new FeatureSearchSupportedWmsServerLayer(title, crs, layerConfig, tileConfig, layerInfo, wfsConfig); }
java
public FeatureSearchSupportedWmsServerLayer createLayer(String title, String crs, TileConfiguration tileConfig, WmsLayerConfiguration layerConfig, WmsLayerInfo layerInfo, WfsFeatureTypeDescriptionInfo wfsConfig) { return new FeatureSearchSupportedWmsServerLayer(title, crs, layerConfig, tileConfig, layerInfo, wfsConfig); }
[ "public", "FeatureSearchSupportedWmsServerLayer", "createLayer", "(", "String", "title", ",", "String", "crs", ",", "TileConfiguration", "tileConfig", ",", "WmsLayerConfiguration", "layerConfig", ",", "WmsLayerInfo", "layerInfo", ",", "WfsFeatureTypeDescriptionInfo", "wfsConf...
Create a new WMS layer. This layer extends the default {@link org.geomajas.gwt2.plugin.wms.client.layer.WmsLayer} by supporting GetFeatureInfo calls. @param title The layer title. @param crs The CRS for this layer. @param tileConfig The tile configuration object. @param layerConfig The layer configuration object. @param layerInfo The layer info object. Acquired from a WMS GetCapabilities. This is optional. @param wfsConfig The WFS configuration. @return A new WMS layer.
[ "Create", "a", "new", "WMS", "layer", ".", "This", "layer", "extends", "the", "default", "{", "@link", "org", ".", "geomajas", ".", "gwt2", ".", "plugin", ".", "wms", ".", "client", ".", "layer", ".", "WmsLayer", "}", "by", "supporting", "GetFeatureInfo"...
train
https://github.com/geomajas/geomajas-project-client-gwt2/blob/bd8d7904e861fa80522eed7b83c4ea99844180c7/plugin/wms/server-extension/src/main/java/org/geomajas/gwt2/plugin/wms/client/WmsServerExtension.java#L173-L176
padrig64/ValidationFramework
validationframework-core/src/main/java/com/google/code/validationframework/base/property/AbstractReadableListProperty.java
AbstractReadableListProperty.doNotifyListenersOfChangedValues
protected void doNotifyListenersOfChangedValues(int startIndex, List<R> oldItems, List<R> newItems) { List<ListValueChangeListener<R>> listenersCopy = new ArrayList<ListValueChangeListener<R>>(listeners); List<R> oldUnmodifiable = Collections.unmodifiableList(oldItems); List<R> newUnmodifiable = Collections.unmodifiableList(newItems); for (ListValueChangeListener<R> listener : listenersCopy) { listener.valuesChanged(this, startIndex, oldUnmodifiable, newUnmodifiable); } }
java
protected void doNotifyListenersOfChangedValues(int startIndex, List<R> oldItems, List<R> newItems) { List<ListValueChangeListener<R>> listenersCopy = new ArrayList<ListValueChangeListener<R>>(listeners); List<R> oldUnmodifiable = Collections.unmodifiableList(oldItems); List<R> newUnmodifiable = Collections.unmodifiableList(newItems); for (ListValueChangeListener<R> listener : listenersCopy) { listener.valuesChanged(this, startIndex, oldUnmodifiable, newUnmodifiable); } }
[ "protected", "void", "doNotifyListenersOfChangedValues", "(", "int", "startIndex", ",", "List", "<", "R", ">", "oldItems", ",", "List", "<", "R", ">", "newItems", ")", "{", "List", "<", "ListValueChangeListener", "<", "R", ">>", "listenersCopy", "=", "new", ...
Notifies the change listeners that items have been replaced. <p> Note that the specified lists of items will be wrapped in unmodifiable lists before being passed to the listeners. @param startIndex Index of the first replaced item. @param oldItems Previous items. @param newItems New items.
[ "Notifies", "the", "change", "listeners", "that", "items", "have", "been", "replaced", ".", "<p", ">", "Note", "that", "the", "specified", "lists", "of", "items", "will", "be", "wrapped", "in", "unmodifiable", "lists", "before", "being", "passed", "to", "the...
train
https://github.com/padrig64/ValidationFramework/blob/2dd3c7b3403993db366d24a927645f467ccd1dda/validationframework-core/src/main/java/com/google/code/validationframework/base/property/AbstractReadableListProperty.java#L109-L116
VoltDB/voltdb
src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCClobClient.java
JDBCClobClient.setString
public synchronized int setString(long pos, String str) throws SQLException { return setString(pos, str, 0, str.length()); }
java
public synchronized int setString(long pos, String str) throws SQLException { return setString(pos, str, 0, str.length()); }
[ "public", "synchronized", "int", "setString", "(", "long", "pos", ",", "String", "str", ")", "throws", "SQLException", "{", "return", "setString", "(", "pos", ",", "str", ",", "0", ",", "str", ".", "length", "(", ")", ")", ";", "}" ]
Writes the given Java <code>String</code> to the <code>CLOB</code> value that this <code>Clob</code> object designates at the position <code>pos</code>. @param pos the position at which to start writing to the <code>CLOB</code> value that this <code>Clob</code> object represents @param str the string to be written to the <code>CLOB</code> value that this <code>Clob</code> designates @return the number of characters written @throws SQLException if there is an error accessing the <code>CLOB</code> value
[ "Writes", "the", "given", "Java", "<code", ">", "String<", "/", "code", ">", "to", "the", "<code", ">", "CLOB<", "/", "code", ">", "value", "that", "this", "<code", ">", "Clob<", "/", "code", ">", "object", "designates", "at", "the", "position", "<code...
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/hsqldb19b3/org/hsqldb_voltpatches/jdbc/JDBCClobClient.java#L210-L213
lecho/hellocharts-android
hellocharts-library/src/lecho/lib/hellocharts/renderer/BubbleChartRenderer.java
BubbleChartRenderer.processBubble
private float processBubble(BubbleValue bubbleValue, PointF point) { final float rawX = computator.computeRawX(bubbleValue.getX()); final float rawY = computator.computeRawY(bubbleValue.getY()); float radius = (float) Math.sqrt(Math.abs(bubbleValue.getZ()) / Math.PI); float rawRadius; if (isBubbleScaledByX) { radius *= bubbleScaleX; rawRadius = computator.computeRawDistanceX(radius); } else { radius *= bubbleScaleY; rawRadius = computator.computeRawDistanceY(radius); } if (rawRadius < minRawRadius + touchAdditional) { rawRadius = minRawRadius + touchAdditional; } bubbleCenter.set(rawX, rawY); if (ValueShape.SQUARE.equals(bubbleValue.getShape())) { bubbleRect.set(rawX - rawRadius, rawY - rawRadius, rawX + rawRadius, rawY + rawRadius); } return rawRadius; }
java
private float processBubble(BubbleValue bubbleValue, PointF point) { final float rawX = computator.computeRawX(bubbleValue.getX()); final float rawY = computator.computeRawY(bubbleValue.getY()); float radius = (float) Math.sqrt(Math.abs(bubbleValue.getZ()) / Math.PI); float rawRadius; if (isBubbleScaledByX) { radius *= bubbleScaleX; rawRadius = computator.computeRawDistanceX(radius); } else { radius *= bubbleScaleY; rawRadius = computator.computeRawDistanceY(radius); } if (rawRadius < minRawRadius + touchAdditional) { rawRadius = minRawRadius + touchAdditional; } bubbleCenter.set(rawX, rawY); if (ValueShape.SQUARE.equals(bubbleValue.getShape())) { bubbleRect.set(rawX - rawRadius, rawY - rawRadius, rawX + rawRadius, rawY + rawRadius); } return rawRadius; }
[ "private", "float", "processBubble", "(", "BubbleValue", "bubbleValue", ",", "PointF", "point", ")", "{", "final", "float", "rawX", "=", "computator", ".", "computeRawX", "(", "bubbleValue", ".", "getX", "(", ")", ")", ";", "final", "float", "rawY", "=", "...
Calculate bubble radius and center x and y coordinates. Center x and x will be stored in point parameter, radius will be returned as float value.
[ "Calculate", "bubble", "radius", "and", "center", "x", "and", "y", "coordinates", ".", "Center", "x", "and", "x", "will", "be", "stored", "in", "point", "parameter", "radius", "will", "be", "returned", "as", "float", "value", "." ]
train
https://github.com/lecho/hellocharts-android/blob/c41419c9afa097452dee823c7eba0e5136aa96bd/hellocharts-library/src/lecho/lib/hellocharts/renderer/BubbleChartRenderer.java#L240-L262
tango-controls/JTango
server/src/main/java/org/tango/logging/LoggingManager.java
LoggingManager.addFileAppender
public void addFileAppender(final String fileName, final String deviceName) throws DevFailed { if (rootLoggerBack != null) { logger.debug("add file appender of {} in {}", deviceName, fileName); final String deviceNameLower = deviceName.toLowerCase(Locale.ENGLISH); final File f = new File(fileName); if (!f.exists()) { try { f.createNewFile(); } catch (final IOException e) { throw DevFailedUtils.newDevFailed(ExceptionMessages.CANNOT_OPEN_FILE, "impossible to open file " + fileName); } } if (!f.canWrite()) { throw DevFailedUtils.newDevFailed(ExceptionMessages.CANNOT_OPEN_FILE, "impossible to open file " + fileName); } // debug level by default // setLoggingLevel(deviceName, LoggingLevel.DEBUG.toInt()); System.out.println("create file " + f); final LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory(); final FileAppender rfAppender = new FileAppender(deviceNameLower); fileAppenders.put(deviceNameLower, rfAppender); rfAppender.setName("FILE-" + deviceNameLower); rfAppender.setLevel(rootLoggingLevel); // rfAppender.setContext(appender.getContext()); rfAppender.setFile(fileName); rfAppender.setAppend(true); rfAppender.setContext(loggerContext); final FixedWindowRollingPolicy rollingPolicy = new FixedWindowRollingPolicy(); // rolling policies need to know their parent // it's one of the rare cases, where a sub-component knows about its parent rollingPolicy.setParent(rfAppender); rollingPolicy.setContext(loggerContext); rollingPolicy.setFileNamePattern(fileName + "%i"); rollingPolicy.setMaxIndex(1); rollingPolicy.setMaxIndex(3); rollingPolicy.start(); final SizeBasedTriggeringPolicy<ILoggingEvent> triggeringPolicy = new SizeBasedTriggeringPolicy<ILoggingEvent>(); triggeringPolicy.setMaxFileSize(FileSize.valueOf("5 mb")); triggeringPolicy.setContext(loggerContext); triggeringPolicy.start(); final PatternLayoutEncoder encoder = new PatternLayoutEncoder(); encoder.setContext(loggerContext); encoder.setPattern("%-5level %d %X{deviceName} - %thread | %logger{25}.%M:%L - %msg%n"); encoder.start(); rfAppender.setEncoder(encoder); rfAppender.setRollingPolicy(rollingPolicy); rfAppender.setTriggeringPolicy(triggeringPolicy); rfAppender.start(); rootLoggerBack.addAppender(rfAppender); rfAppender.start(); // OPTIONAL: print logback internal status messages // StatusPrinter.print(loggerContext); } }
java
public void addFileAppender(final String fileName, final String deviceName) throws DevFailed { if (rootLoggerBack != null) { logger.debug("add file appender of {} in {}", deviceName, fileName); final String deviceNameLower = deviceName.toLowerCase(Locale.ENGLISH); final File f = new File(fileName); if (!f.exists()) { try { f.createNewFile(); } catch (final IOException e) { throw DevFailedUtils.newDevFailed(ExceptionMessages.CANNOT_OPEN_FILE, "impossible to open file " + fileName); } } if (!f.canWrite()) { throw DevFailedUtils.newDevFailed(ExceptionMessages.CANNOT_OPEN_FILE, "impossible to open file " + fileName); } // debug level by default // setLoggingLevel(deviceName, LoggingLevel.DEBUG.toInt()); System.out.println("create file " + f); final LoggerContext loggerContext = (LoggerContext) LoggerFactory.getILoggerFactory(); final FileAppender rfAppender = new FileAppender(deviceNameLower); fileAppenders.put(deviceNameLower, rfAppender); rfAppender.setName("FILE-" + deviceNameLower); rfAppender.setLevel(rootLoggingLevel); // rfAppender.setContext(appender.getContext()); rfAppender.setFile(fileName); rfAppender.setAppend(true); rfAppender.setContext(loggerContext); final FixedWindowRollingPolicy rollingPolicy = new FixedWindowRollingPolicy(); // rolling policies need to know their parent // it's one of the rare cases, where a sub-component knows about its parent rollingPolicy.setParent(rfAppender); rollingPolicy.setContext(loggerContext); rollingPolicy.setFileNamePattern(fileName + "%i"); rollingPolicy.setMaxIndex(1); rollingPolicy.setMaxIndex(3); rollingPolicy.start(); final SizeBasedTriggeringPolicy<ILoggingEvent> triggeringPolicy = new SizeBasedTriggeringPolicy<ILoggingEvent>(); triggeringPolicy.setMaxFileSize(FileSize.valueOf("5 mb")); triggeringPolicy.setContext(loggerContext); triggeringPolicy.start(); final PatternLayoutEncoder encoder = new PatternLayoutEncoder(); encoder.setContext(loggerContext); encoder.setPattern("%-5level %d %X{deviceName} - %thread | %logger{25}.%M:%L - %msg%n"); encoder.start(); rfAppender.setEncoder(encoder); rfAppender.setRollingPolicy(rollingPolicy); rfAppender.setTriggeringPolicy(triggeringPolicy); rfAppender.start(); rootLoggerBack.addAppender(rfAppender); rfAppender.start(); // OPTIONAL: print logback internal status messages // StatusPrinter.print(loggerContext); } }
[ "public", "void", "addFileAppender", "(", "final", "String", "fileName", ",", "final", "String", "deviceName", ")", "throws", "DevFailed", "{", "if", "(", "rootLoggerBack", "!=", "null", ")", "{", "logger", ".", "debug", "(", "\"add file appender of {} in {}\"", ...
Add an file appender for a device @param fileName @param deviceName @throws DevFailed
[ "Add", "an", "file", "appender", "for", "a", "device" ]
train
https://github.com/tango-controls/JTango/blob/1ccc9dcb83e6de2359a9f1906d170571cacf1345/server/src/main/java/org/tango/logging/LoggingManager.java#L197-L257
DataSketches/sketches-core
src/main/java/com/yahoo/sketches/hllmap/CouponTraverseMap.java
CouponTraverseMap.findKey
@Override int findKey(final byte[] key) { final long[] hash = MurmurHash3.hash(key, SEED); int entryIndex = getIndex(hash[0], tableEntries_); int firstDeletedIndex = -1; final int loopIndex = entryIndex; do { if (isBitClear(stateArr_, entryIndex)) { return firstDeletedIndex == -1 ? ~entryIndex : ~firstDeletedIndex; // found empty or deleted } if (couponsArr_[entryIndex * maxCouponsPerKey_] == 0) { //found deleted if (firstDeletedIndex == -1) { firstDeletedIndex = entryIndex; } } else if (Map.arraysEqual(keysArr_, entryIndex * keySizeBytes_, key, 0, keySizeBytes_)) { return entryIndex; // found key } entryIndex = (entryIndex + getStride(hash[1], tableEntries_)) % tableEntries_; } while (entryIndex != loopIndex); throw new SketchesArgumentException("Key not found and no empty slots!"); }
java
@Override int findKey(final byte[] key) { final long[] hash = MurmurHash3.hash(key, SEED); int entryIndex = getIndex(hash[0], tableEntries_); int firstDeletedIndex = -1; final int loopIndex = entryIndex; do { if (isBitClear(stateArr_, entryIndex)) { return firstDeletedIndex == -1 ? ~entryIndex : ~firstDeletedIndex; // found empty or deleted } if (couponsArr_[entryIndex * maxCouponsPerKey_] == 0) { //found deleted if (firstDeletedIndex == -1) { firstDeletedIndex = entryIndex; } } else if (Map.arraysEqual(keysArr_, entryIndex * keySizeBytes_, key, 0, keySizeBytes_)) { return entryIndex; // found key } entryIndex = (entryIndex + getStride(hash[1], tableEntries_)) % tableEntries_; } while (entryIndex != loopIndex); throw new SketchesArgumentException("Key not found and no empty slots!"); }
[ "@", "Override", "int", "findKey", "(", "final", "byte", "[", "]", "key", ")", "{", "final", "long", "[", "]", "hash", "=", "MurmurHash3", ".", "hash", "(", "key", ",", "SEED", ")", ";", "int", "entryIndex", "=", "getIndex", "(", "hash", "[", "0", ...
Returns entryIndex if the given key is found. If not found, returns one's complement entryIndex of an empty slot for insertion, which may be over a deleted key. @param key the given key @return the entryIndex
[ "Returns", "entryIndex", "if", "the", "given", "key", "is", "found", ".", "If", "not", "found", "returns", "one", "s", "complement", "entryIndex", "of", "an", "empty", "slot", "for", "insertion", "which", "may", "be", "over", "a", "deleted", "key", "." ]
train
https://github.com/DataSketches/sketches-core/blob/900c8c9668a1e2f1d54d453e956caad54702e540/src/main/java/com/yahoo/sketches/hllmap/CouponTraverseMap.java#L113-L131
VoltDB/voltdb
src/frontend/org/voltcore/agreement/AgreementSeeker.java
AgreementSeeker.amongDeadHsids
public static Predicate<Map.Entry<Long, Boolean>> amongDeadHsids(final Set<Long> hsids) { return new Predicate<Map.Entry<Long,Boolean>>() { @Override public boolean apply(Entry<Long, Boolean> e) { return hsids.contains(e.getKey()) && e.getValue(); } }; }
java
public static Predicate<Map.Entry<Long, Boolean>> amongDeadHsids(final Set<Long> hsids) { return new Predicate<Map.Entry<Long,Boolean>>() { @Override public boolean apply(Entry<Long, Boolean> e) { return hsids.contains(e.getKey()) && e.getValue(); } }; }
[ "public", "static", "Predicate", "<", "Map", ".", "Entry", "<", "Long", ",", "Boolean", ">", ">", "amongDeadHsids", "(", "final", "Set", "<", "Long", ">", "hsids", ")", "{", "return", "new", "Predicate", "<", "Map", ".", "Entry", "<", "Long", ",", "B...
returns a map entry predicate that tests whether or not the given map entry describes a dead site @param hsids pre-failure mesh hsids @return
[ "returns", "a", "map", "entry", "predicate", "that", "tests", "whether", "or", "not", "the", "given", "map", "entry", "describes", "a", "dead", "site" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltcore/agreement/AgreementSeeker.java#L153-L160
xcesco/kripton
kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/ModifyRawHelper.java
ModifyRawHelper.extractWhereConditions
static String extractWhereConditions(boolean updateMode, SQLiteModelMethod method) { final One<String> whereCondition = new One<String>(""); final One<Boolean> found = new One<Boolean>(null); JQLChecker.getInstance().replaceVariableStatements(method, method.jql.value, new JQLReplaceVariableStatementListenerImpl() { @Override public String onWhere(String statement) { if (found.value0 == null) { whereCondition.value0 = statement; found.value0 = true; } return null; } }); return StringUtils.ifNotEmptyAppend(whereCondition.value0, " "); }
java
static String extractWhereConditions(boolean updateMode, SQLiteModelMethod method) { final One<String> whereCondition = new One<String>(""); final One<Boolean> found = new One<Boolean>(null); JQLChecker.getInstance().replaceVariableStatements(method, method.jql.value, new JQLReplaceVariableStatementListenerImpl() { @Override public String onWhere(String statement) { if (found.value0 == null) { whereCondition.value0 = statement; found.value0 = true; } return null; } }); return StringUtils.ifNotEmptyAppend(whereCondition.value0, " "); }
[ "static", "String", "extractWhereConditions", "(", "boolean", "updateMode", ",", "SQLiteModelMethod", "method", ")", "{", "final", "One", "<", "String", ">", "whereCondition", "=", "new", "One", "<", "String", ">", "(", "\"\"", ")", ";", "final", "One", "<",...
Extract where conditions. @param updateMode the update mode @param method the method @return the string
[ "Extract", "where", "conditions", "." ]
train
https://github.com/xcesco/kripton/blob/90de2c0523d39b99e81b8d38aa996898762f594a/kripton-processor/src/main/java/com/abubusoft/kripton/processor/sqlite/ModifyRawHelper.java#L388-L405
UrielCh/ovh-java-sdk
ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java
ApiOvhDbaaslogs.serviceName_output_graylog_stream_streamId_rule_POST
public OvhOperation serviceName_output_graylog_stream_streamId_rule_POST(String serviceName, String streamId, String field, Boolean isInverted, OvhStreamRuleOperatorEnum operator, String value) throws IOException { String qPath = "/dbaas/logs/{serviceName}/output/graylog/stream/{streamId}/rule"; StringBuilder sb = path(qPath, serviceName, streamId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "field", field); addBody(o, "isInverted", isInverted); addBody(o, "operator", operator); addBody(o, "value", value); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOperation.class); }
java
public OvhOperation serviceName_output_graylog_stream_streamId_rule_POST(String serviceName, String streamId, String field, Boolean isInverted, OvhStreamRuleOperatorEnum operator, String value) throws IOException { String qPath = "/dbaas/logs/{serviceName}/output/graylog/stream/{streamId}/rule"; StringBuilder sb = path(qPath, serviceName, streamId); HashMap<String, Object>o = new HashMap<String, Object>(); addBody(o, "field", field); addBody(o, "isInverted", isInverted); addBody(o, "operator", operator); addBody(o, "value", value); String resp = exec(qPath, "POST", sb.toString(), o); return convertTo(resp, OvhOperation.class); }
[ "public", "OvhOperation", "serviceName_output_graylog_stream_streamId_rule_POST", "(", "String", "serviceName", ",", "String", "streamId", ",", "String", "field", ",", "Boolean", "isInverted", ",", "OvhStreamRuleOperatorEnum", "operator", ",", "String", "value", ")", "thr...
Register a new rule on specified graylog stream REST: POST /dbaas/logs/{serviceName}/output/graylog/stream/{streamId}/rule @param serviceName [required] Service name @param streamId [required] Stream ID @param value [required] Field value @param field [required] Field name @param operator [required] Field operator @param isInverted [required] Invert condition
[ "Register", "a", "new", "rule", "on", "specified", "graylog", "stream" ]
train
https://github.com/UrielCh/ovh-java-sdk/blob/6d531a40e56e09701943e334c25f90f640c55701/ovh-java-sdk-dbaaslogs/src/main/java/net/minidev/ovh/api/ApiOvhDbaaslogs.java#L1563-L1573
EdwardRaff/JSAT
JSAT/src/jsat/linear/Matrix.java
Matrix.increment
public void increment(int i, int j, double value) { if(Double.isNaN(value) || Double.isInfinite(value)) throw new ArithmeticException("Can not add a value " + value); set(i, j, get(i, j)+value); }
java
public void increment(int i, int j, double value) { if(Double.isNaN(value) || Double.isInfinite(value)) throw new ArithmeticException("Can not add a value " + value); set(i, j, get(i, j)+value); }
[ "public", "void", "increment", "(", "int", "i", ",", "int", "j", ",", "double", "value", ")", "{", "if", "(", "Double", ".", "isNaN", "(", "value", ")", "||", "Double", ".", "isInfinite", "(", "value", ")", ")", "throw", "new", "ArithmeticException", ...
Alters the current matrix at index <i>(i,j)</i> to be equal to <i>A<sub>i,j</sub> = A<sub>i,j</sub> + value</i> @param i the row, starting from 0 @param j the column, starting from 0 @param value the value to add to the matrix coordinate
[ "Alters", "the", "current", "matrix", "at", "index", "<i", ">", "(", "i", "j", ")", "<", "/", "i", ">", "to", "be", "equal", "to", "<i", ">", "A<sub", ">", "i", "j<", "/", "sub", ">", "=", "A<sub", ">", "i", "j<", "/", "sub", ">", "+", "val...
train
https://github.com/EdwardRaff/JSAT/blob/0ff53b7b39684b2379cc1da522f5b3a954b15cfb/JSAT/src/jsat/linear/Matrix.java#L549-L554
albfernandez/itext2
src/main/java/com/lowagie/text/Image.java
Image.scalePercent
public void scalePercent(float percentX, float percentY) { plainWidth = (getWidth() * percentX) / 100f; plainHeight = (getHeight() * percentY) / 100f; float[] matrix = matrix(); scaledWidth = matrix[DX] - matrix[CX]; scaledHeight = matrix[DY] - matrix[CY]; setWidthPercentage(0); }
java
public void scalePercent(float percentX, float percentY) { plainWidth = (getWidth() * percentX) / 100f; plainHeight = (getHeight() * percentY) / 100f; float[] matrix = matrix(); scaledWidth = matrix[DX] - matrix[CX]; scaledHeight = matrix[DY] - matrix[CY]; setWidthPercentage(0); }
[ "public", "void", "scalePercent", "(", "float", "percentX", ",", "float", "percentY", ")", "{", "plainWidth", "=", "(", "getWidth", "(", ")", "*", "percentX", ")", "/", "100f", ";", "plainHeight", "=", "(", "getHeight", "(", ")", "*", "percentY", ")", ...
Scale the width and height of an image to a certain percentage. @param percentX the scaling percentage of the width @param percentY the scaling percentage of the height
[ "Scale", "the", "width", "and", "height", "of", "an", "image", "to", "a", "certain", "percentage", "." ]
train
https://github.com/albfernandez/itext2/blob/438fc1899367fd13dfdfa8dfdca9a3c1a7783b84/src/main/java/com/lowagie/text/Image.java#L1296-L1303
javagl/Common
src/main/java/de/javagl/common/beans/PropertyChangeListeners.java
PropertyChangeListeners.addDeepLogger
public static void addDeepLogger(Object object, Level level) { addDeepLogger(object, m -> logger.log(level, m)); }
java
public static void addDeepLogger(Object object, Level level) { addDeepLogger(object, m -> logger.log(level, m)); }
[ "public", "static", "void", "addDeepLogger", "(", "Object", "object", ",", "Level", "level", ")", "{", "addDeepLogger", "(", "object", ",", "m", "->", "logger", ".", "log", "(", "level", ",", "m", ")", ")", ";", "}" ]
Attaches a deep property change listener to the given object, that generates logging information about the property change events, and prints them as log messages. @param object The object @param level The log level
[ "Attaches", "a", "deep", "property", "change", "listener", "to", "the", "given", "object", "that", "generates", "logging", "information", "about", "the", "property", "change", "events", "and", "prints", "them", "as", "log", "messages", "." ]
train
https://github.com/javagl/Common/blob/5a4876b48c3a2dc61d21324733cf37512d721c33/src/main/java/de/javagl/common/beans/PropertyChangeListeners.java#L71-L74
ltearno/hexa.tools
hexa.persistence/src/main/java/fr/lteconsulting/hexa/persistence/client/hqlParser.java
hqlParser.inList
public final hqlParser.inList_return inList() throws RecognitionException { hqlParser.inList_return retval = new hqlParser.inList_return(); retval.start = input.LT(1); CommonTree root_0 = null; ParserRuleReturnScope compoundExpr180 =null; RewriteRuleSubtreeStream stream_compoundExpr=new RewriteRuleSubtreeStream(adaptor,"rule compoundExpr"); try { // hql.g:487:2: ( compoundExpr -> ^( IN_LIST[\"inList\"] compoundExpr ) ) // hql.g:487:4: compoundExpr { pushFollow(FOLLOW_compoundExpr_in_inList2244); compoundExpr180=compoundExpr(); state._fsp--; stream_compoundExpr.add(compoundExpr180.getTree()); // AST REWRITE // elements: compoundExpr // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null); root_0 = (CommonTree)adaptor.nil(); // 488:2: -> ^( IN_LIST[\"inList\"] compoundExpr ) { // hql.g:488:5: ^( IN_LIST[\"inList\"] compoundExpr ) { CommonTree root_1 = (CommonTree)adaptor.nil(); root_1 = (CommonTree)adaptor.becomeRoot(adaptor.create(IN_LIST, "inList"), root_1); adaptor.addChild(root_1, stream_compoundExpr.nextTree()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0; } retval.stop = input.LT(-1); retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { // do for sure before leaving } return retval; }
java
public final hqlParser.inList_return inList() throws RecognitionException { hqlParser.inList_return retval = new hqlParser.inList_return(); retval.start = input.LT(1); CommonTree root_0 = null; ParserRuleReturnScope compoundExpr180 =null; RewriteRuleSubtreeStream stream_compoundExpr=new RewriteRuleSubtreeStream(adaptor,"rule compoundExpr"); try { // hql.g:487:2: ( compoundExpr -> ^( IN_LIST[\"inList\"] compoundExpr ) ) // hql.g:487:4: compoundExpr { pushFollow(FOLLOW_compoundExpr_in_inList2244); compoundExpr180=compoundExpr(); state._fsp--; stream_compoundExpr.add(compoundExpr180.getTree()); // AST REWRITE // elements: compoundExpr // token labels: // rule labels: retval // token list labels: // rule list labels: // wildcard labels: retval.tree = root_0; RewriteRuleSubtreeStream stream_retval=new RewriteRuleSubtreeStream(adaptor,"rule retval",retval!=null?retval.getTree():null); root_0 = (CommonTree)adaptor.nil(); // 488:2: -> ^( IN_LIST[\"inList\"] compoundExpr ) { // hql.g:488:5: ^( IN_LIST[\"inList\"] compoundExpr ) { CommonTree root_1 = (CommonTree)adaptor.nil(); root_1 = (CommonTree)adaptor.becomeRoot(adaptor.create(IN_LIST, "inList"), root_1); adaptor.addChild(root_1, stream_compoundExpr.nextTree()); adaptor.addChild(root_0, root_1); } } retval.tree = root_0; } retval.stop = input.LT(-1); retval.tree = (CommonTree)adaptor.rulePostProcessing(root_0); adaptor.setTokenBoundaries(retval.tree, retval.start, retval.stop); } catch (RecognitionException re) { reportError(re); recover(input,re); retval.tree = (CommonTree)adaptor.errorNode(input, retval.start, input.LT(-1), re); } finally { // do for sure before leaving } return retval; }
[ "public", "final", "hqlParser", ".", "inList_return", "inList", "(", ")", "throws", "RecognitionException", "{", "hqlParser", ".", "inList_return", "retval", "=", "new", "hqlParser", ".", "inList_return", "(", ")", ";", "retval", ".", "start", "=", "input", "....
hql.g:486:1: inList : compoundExpr -> ^( IN_LIST[\"inList\"] compoundExpr ) ;
[ "hql", ".", "g", ":", "486", ":", "1", ":", "inList", ":", "compoundExpr", "-", ">", "^", "(", "IN_LIST", "[", "\\", "inList", "\\", "]", "compoundExpr", ")", ";" ]
train
https://github.com/ltearno/hexa.tools/blob/604c804901b1bb13fe10b3823cc4a639f8993363/hexa.persistence/src/main/java/fr/lteconsulting/hexa/persistence/client/hqlParser.java#L5941-L6003
dkmfbk/knowledgestore
ks-core/src/main/java/eu/fbk/knowledgestore/data/Stream.java
Stream.transform
public final <R> Stream<R> transform(final Class<R> type, final boolean lenient, final Object... path) { synchronized (this.state) { checkState(); return concat(new TransformPathStream<T, R>(this, type, lenient, path)); } }
java
public final <R> Stream<R> transform(final Class<R> type, final boolean lenient, final Object... path) { synchronized (this.state) { checkState(); return concat(new TransformPathStream<T, R>(this, type, lenient, path)); } }
[ "public", "final", "<", "R", ">", "Stream", "<", "R", ">", "transform", "(", "final", "Class", "<", "R", ">", "type", ",", "final", "boolean", "lenient", ",", "final", "Object", "...", "path", ")", "{", "synchronized", "(", "this", ".", "state", ")",...
Intermediate operation returning a Stream with the elements obtained by applying an optional <i>navigation path</i> and conversion to a certain type to the elements of this Stream. The path is a sequence of keys ({@code String}s, {@code URI}s, generic objects) that are applied to {@code Record}, {@code BindingSet}, {@code Map} and {@code Multimap} elements to extract child elements in a recursive fashion. Starting from an element returned by this stream, the result of this navigation process is a list of (sub-)child elements that are converted to the requested type (via {@link Data#convert(Object, Class)}) and concatenated in the resulting stream; {@code Iterable}s, {@code Iterator}s and arrays found during the navigation are exploded and their elements individually considered. The {@code lenient} parameters controls whether conversion errors should be ignored or result in an exception being thrown by the returned Stream. @param type the class resulting elements should be converted to @param lenient true if conversion errors should be ignored @param path a vararg array of zero or more keys that recursively select the elements to return @param <R> the type of resulting elements @return a Stream over the elements obtained applying the navigation path and the conversion specified
[ "Intermediate", "operation", "returning", "a", "Stream", "with", "the", "elements", "obtained", "by", "applying", "an", "optional", "<i", ">", "navigation", "path<", "/", "i", ">", "and", "conversion", "to", "a", "certain", "type", "to", "the", "elements", "...
train
https://github.com/dkmfbk/knowledgestore/blob/a548101b1dd67fcf72a1ec6f838ea7539bdbbe7a/ks-core/src/main/java/eu/fbk/knowledgestore/data/Stream.java#L392-L398
alkacon/opencms-core
src/org/opencms/db/CmsDriverManager.java
CmsDriverManager.readHistoricalPrincipal
public CmsHistoryPrincipal readHistoricalPrincipal(CmsDbContext dbc, CmsUUID principalId) throws CmsException { return getHistoryDriver(dbc).readPrincipal(dbc, principalId); }
java
public CmsHistoryPrincipal readHistoricalPrincipal(CmsDbContext dbc, CmsUUID principalId) throws CmsException { return getHistoryDriver(dbc).readPrincipal(dbc, principalId); }
[ "public", "CmsHistoryPrincipal", "readHistoricalPrincipal", "(", "CmsDbContext", "dbc", ",", "CmsUUID", "principalId", ")", "throws", "CmsException", "{", "return", "getHistoryDriver", "(", "dbc", ")", ".", "readPrincipal", "(", "dbc", ",", "principalId", ")", ";", ...
Reads a principal (an user or group) from the historical archive based on its ID.<p> @param dbc the current database context @param principalId the id of the principal to read @return the historical principal entry with the given id @throws CmsException if something goes wrong, ie. {@link CmsDbEntryNotFoundException} @see CmsObject#readUser(CmsUUID) @see CmsObject#readGroup(CmsUUID) @see CmsObject#readHistoryPrincipal(CmsUUID)
[ "Reads", "a", "principal", "(", "an", "user", "or", "group", ")", "from", "the", "historical", "archive", "based", "on", "its", "ID", ".", "<p", ">" ]
train
https://github.com/alkacon/opencms-core/blob/bc104acc75d2277df5864da939a1f2de5fdee504/src/org/opencms/db/CmsDriverManager.java#L6953-L6956
netscaler/sdx_nitro
src/main/java/com/citrix/sdx/nitro/resource/config/mps/network_interface.java
network_interface.get_nitro_bulk_response
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { network_interface_responses result = (network_interface_responses) service.get_payload_formatter().string_to_resource(network_interface_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.network_interface_response_array); } network_interface[] result_network_interface = new network_interface[result.network_interface_response_array.length]; for(int i = 0; i < result.network_interface_response_array.length; i++) { result_network_interface[i] = result.network_interface_response_array[i].network_interface[0]; } return result_network_interface; }
java
protected base_resource[] get_nitro_bulk_response(nitro_service service, String response) throws Exception { network_interface_responses result = (network_interface_responses) service.get_payload_formatter().string_to_resource(network_interface_responses.class, response); if(result.errorcode != 0) { if (result.errorcode == SESSION_NOT_EXISTS) service.clear_session(); throw new nitro_exception(result.message, result.errorcode, (base_response [])result.network_interface_response_array); } network_interface[] result_network_interface = new network_interface[result.network_interface_response_array.length]; for(int i = 0; i < result.network_interface_response_array.length; i++) { result_network_interface[i] = result.network_interface_response_array[i].network_interface[0]; } return result_network_interface; }
[ "protected", "base_resource", "[", "]", "get_nitro_bulk_response", "(", "nitro_service", "service", ",", "String", "response", ")", "throws", "Exception", "{", "network_interface_responses", "result", "=", "(", "network_interface_responses", ")", "service", ".", "get_pa...
<pre> Converts API response of bulk operation into object and returns the object array in case of get request. </pre>
[ "<pre", ">", "Converts", "API", "response", "of", "bulk", "operation", "into", "object", "and", "returns", "the", "object", "array", "in", "case", "of", "get", "request", ".", "<", "/", "pre", ">" ]
train
https://github.com/netscaler/sdx_nitro/blob/c840919f1a8f7c0a5634c0f23d34fa14d1765ff1/src/main/java/com/citrix/sdx/nitro/resource/config/mps/network_interface.java#L542-L559
VoltDB/voltdb
src/frontend/org/voltdb/expressions/ConstantValueExpression.java
ConstantValueExpression.makeExpression
public static ConstantValueExpression makeExpression(VoltType dataType, String value) { ConstantValueExpression constantExpr = new ConstantValueExpression(); constantExpr.setValueType(dataType); constantExpr.setValue(value); return constantExpr; }
java
public static ConstantValueExpression makeExpression(VoltType dataType, String value) { ConstantValueExpression constantExpr = new ConstantValueExpression(); constantExpr.setValueType(dataType); constantExpr.setValue(value); return constantExpr; }
[ "public", "static", "ConstantValueExpression", "makeExpression", "(", "VoltType", "dataType", ",", "String", "value", ")", "{", "ConstantValueExpression", "constantExpr", "=", "new", "ConstantValueExpression", "(", ")", ";", "constantExpr", ".", "setValueType", "(", "...
Create a new CVE for a given type and value @param dataType @param value @return
[ "Create", "a", "new", "CVE", "for", "a", "given", "type", "and", "value" ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltdb/expressions/ConstantValueExpression.java#L493-L498
jcuda/jcuda
JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java
JCudaDriver.cuMemcpyPeer
public static int cuMemcpyPeer(CUdeviceptr dstDevice, CUcontext dstContext, CUdeviceptr srcDevice, CUcontext srcContext, long ByteCount) { return cuMemcpyPeerNative(dstDevice, dstContext, srcDevice, srcContext, ByteCount); }
java
public static int cuMemcpyPeer(CUdeviceptr dstDevice, CUcontext dstContext, CUdeviceptr srcDevice, CUcontext srcContext, long ByteCount) { return cuMemcpyPeerNative(dstDevice, dstContext, srcDevice, srcContext, ByteCount); }
[ "public", "static", "int", "cuMemcpyPeer", "(", "CUdeviceptr", "dstDevice", ",", "CUcontext", "dstContext", ",", "CUdeviceptr", "srcDevice", ",", "CUcontext", "srcContext", ",", "long", "ByteCount", ")", "{", "return", "cuMemcpyPeerNative", "(", "dstDevice", ",", ...
Copies device memory between two contexts. <pre> CUresult cuMemcpyPeer ( CUdeviceptr dstDevice, CUcontext dstContext, CUdeviceptr srcDevice, CUcontext srcContext, size_t ByteCount ) </pre> <div> <p>Copies device memory between two contexts. Copies from device memory in one context to device memory in another context. <tt>dstDevice</tt> is the base device pointer of the destination memory and <tt>dstContext</tt> is the destination context. <tt>srcDevice</tt> is the base device pointer of the source memory and <tt>srcContext</tt> is the source pointer. <tt>ByteCount</tt> specifies the number of bytes to copy. </p> <p>Note that this function is asynchronous with respect to the host, but serialized with respect all pending and future asynchronous work in to the current context, <tt>srcContext</tt>, and <tt>dstContext</tt> (use cuMemcpyPeerAsync to avoid this synchronization). </p> <div> <span>Note:</span> <p>Note that this function may also return error codes from previous, asynchronous launches. </p> </div> </p> </div> @param dstDevice Destination device pointer @param dstContext Destination context @param srcDevice Source device pointer @param srcContext Source context @param ByteCount Size of memory copy in bytes @return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE @see JCudaDriver#cuMemcpyDtoD @see JCudaDriver#cuMemcpy3DPeer @see JCudaDriver#cuMemcpyDtoDAsync @see JCudaDriver#cuMemcpyPeerAsync @see JCudaDriver#cuMemcpy3DPeerAsync
[ "Copies", "device", "memory", "between", "two", "contexts", "." ]
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L3915-L3918
westnordost/osmapi
src/main/java/de/westnordost/osmapi/map/MapDataDao.java
MapDataDao.getWayComplete
public void getWayComplete(long id, MapDataHandler handler) { boolean authenticate = osm.getOAuth() != null; osm.makeRequest(WAY + "/" + id + "/" + FULL, authenticate, new MapDataParser(handler, factory)); }
java
public void getWayComplete(long id, MapDataHandler handler) { boolean authenticate = osm.getOAuth() != null; osm.makeRequest(WAY + "/" + id + "/" + FULL, authenticate, new MapDataParser(handler, factory)); }
[ "public", "void", "getWayComplete", "(", "long", "id", ",", "MapDataHandler", "handler", ")", "{", "boolean", "authenticate", "=", "osm", ".", "getOAuth", "(", ")", "!=", "null", ";", "osm", ".", "makeRequest", "(", "WAY", "+", "\"/\"", "+", "id", "+", ...
Queries the way with the given id plus all nodes that are in referenced by it.<br> If not logged in, the Changeset for each returned element will be null @param id the way's id @param handler map data handler that is fed the map data @throws OsmNotFoundException if the way with the given id does not exist
[ "Queries", "the", "way", "with", "the", "given", "id", "plus", "all", "nodes", "that", "are", "in", "referenced", "by", "it", ".", "<br", ">", "If", "not", "logged", "in", "the", "Changeset", "for", "each", "returned", "element", "will", "be", "null" ]
train
https://github.com/westnordost/osmapi/blob/dda6978fd12e117d0cf17812bc22037f61e22c4b/src/main/java/de/westnordost/osmapi/map/MapDataDao.java#L226-L230
banjocreek/java-builder
src/main/java/com/banjocreek/riverbed/builder/map/AbstractMutableMapBuilder.java
AbstractMutableMapBuilder.doValues
protected final void doValues(final Map<K, ? extends V> entries) { apply(entries.isEmpty() ? Nop.instance() : new Values<>(entries)); }
java
protected final void doValues(final Map<K, ? extends V> entries) { apply(entries.isEmpty() ? Nop.instance() : new Values<>(entries)); }
[ "protected", "final", "void", "doValues", "(", "final", "Map", "<", "K", ",", "?", "extends", "V", ">", "entries", ")", "{", "apply", "(", "entries", ".", "isEmpty", "(", ")", "?", "Nop", ".", "instance", "(", ")", ":", "new", "Values", "<>", "(", ...
Post a delta consisting of map entries. @param entries entries.
[ "Post", "a", "delta", "consisting", "of", "map", "entries", "." ]
train
https://github.com/banjocreek/java-builder/blob/4cc6ce461e58a8a9eac988e8a51073ea6dc1cc81/src/main/java/com/banjocreek/riverbed/builder/map/AbstractMutableMapBuilder.java#L160-L163
jcuda/jcuda
JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java
JCudaDriver.cuMemcpyPeerAsync
public static int cuMemcpyPeerAsync(CUdeviceptr dstDevice, CUcontext dstContext, CUdeviceptr srcDevice, CUcontext srcContext, long ByteCount, CUstream hStream) { return checkResult(cuMemcpyPeerAsyncNative(dstDevice, dstContext, srcDevice, srcContext, ByteCount, hStream)); }
java
public static int cuMemcpyPeerAsync(CUdeviceptr dstDevice, CUcontext dstContext, CUdeviceptr srcDevice, CUcontext srcContext, long ByteCount, CUstream hStream) { return checkResult(cuMemcpyPeerAsyncNative(dstDevice, dstContext, srcDevice, srcContext, ByteCount, hStream)); }
[ "public", "static", "int", "cuMemcpyPeerAsync", "(", "CUdeviceptr", "dstDevice", ",", "CUcontext", "dstContext", ",", "CUdeviceptr", "srcDevice", ",", "CUcontext", "srcContext", ",", "long", "ByteCount", ",", "CUstream", "hStream", ")", "{", "return", "checkResult",...
Copies device memory between two contexts asynchronously. <pre> CUresult cuMemcpyPeerAsync ( CUdeviceptr dstDevice, CUcontext dstContext, CUdeviceptr srcDevice, CUcontext srcContext, size_t ByteCount, CUstream hStream ) </pre> <div> <p>Copies device memory between two contexts asynchronously. Copies from device memory in one context to device memory in another context. <tt>dstDevice</tt> is the base device pointer of the destination memory and <tt>dstContext</tt> is the destination context. <tt>srcDevice</tt> is the base device pointer of the source memory and <tt>srcContext</tt> is the source pointer. <tt>ByteCount</tt> specifies the number of bytes to copy. Note that this function is asynchronous with respect to the host and all work in other streams in other devices. </p> <div> <span>Note:</span> <p>Note that this function may also return error codes from previous, asynchronous launches. </p> </div> </p> </div> @param dstDevice Destination device pointer @param dstContext Destination context @param srcDevice Source device pointer @param srcContext Source context @param ByteCount Size of memory copy in bytes @param hStream Stream identifier @return CUDA_SUCCESS, CUDA_ERROR_DEINITIALIZED, CUDA_ERROR_NOT_INITIALIZED, CUDA_ERROR_INVALID_CONTEXT, CUDA_ERROR_INVALID_VALUE @see JCudaDriver#cuMemcpyDtoD @see JCudaDriver#cuMemcpyPeer @see JCudaDriver#cuMemcpy3DPeer @see JCudaDriver#cuMemcpyDtoDAsync @see JCudaDriver#cuMemcpy3DPeerAsync
[ "Copies", "device", "memory", "between", "two", "contexts", "asynchronously", "." ]
train
https://github.com/jcuda/jcuda/blob/468528b5b9b37dfceb6ed83fcfd889e9b359f984/JCudaJava/src/main/java/jcuda/driver/JCudaDriver.java#L5938-L5941
Azure/azure-sdk-for-java
network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/RouteFilterRulesInner.java
RouteFilterRulesInner.createOrUpdateAsync
public Observable<RouteFilterRuleInner> createOrUpdateAsync(String resourceGroupName, String routeFilterName, String ruleName, RouteFilterRuleInner routeFilterRuleParameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters).map(new Func1<ServiceResponse<RouteFilterRuleInner>, RouteFilterRuleInner>() { @Override public RouteFilterRuleInner call(ServiceResponse<RouteFilterRuleInner> response) { return response.body(); } }); }
java
public Observable<RouteFilterRuleInner> createOrUpdateAsync(String resourceGroupName, String routeFilterName, String ruleName, RouteFilterRuleInner routeFilterRuleParameters) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, routeFilterName, ruleName, routeFilterRuleParameters).map(new Func1<ServiceResponse<RouteFilterRuleInner>, RouteFilterRuleInner>() { @Override public RouteFilterRuleInner call(ServiceResponse<RouteFilterRuleInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "RouteFilterRuleInner", ">", "createOrUpdateAsync", "(", "String", "resourceGroupName", ",", "String", "routeFilterName", ",", "String", "ruleName", ",", "RouteFilterRuleInner", "routeFilterRuleParameters", ")", "{", "return", "createOrUpdateWit...
Creates or updates a route in the specified route filter. @param resourceGroupName The name of the resource group. @param routeFilterName The name of the route filter. @param ruleName The name of the route filter rule. @param routeFilterRuleParameters Parameters supplied to the create or update route filter rule operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Creates", "or", "updates", "a", "route", "in", "the", "specified", "route", "filter", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/network/resource-manager/v2018_07_01/src/main/java/com/microsoft/azure/management/network/v2018_07_01/implementation/RouteFilterRulesInner.java#L401-L408
deeplearning4j/deeplearning4j
nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/convolution/Convolution.java
Convolution.im2col
public static INDArray im2col(INDArray img, int kh, int kw, int sy, int sx, int ph, int pw, boolean isSameMode) { return im2col(img, kh, kw, sy, sx, ph, pw, 1, 1, isSameMode); }
java
public static INDArray im2col(INDArray img, int kh, int kw, int sy, int sx, int ph, int pw, boolean isSameMode) { return im2col(img, kh, kw, sy, sx, ph, pw, 1, 1, isSameMode); }
[ "public", "static", "INDArray", "im2col", "(", "INDArray", "img", ",", "int", "kh", ",", "int", "kw", ",", "int", "sy", ",", "int", "sx", ",", "int", "ph", ",", "int", "pw", ",", "boolean", "isSameMode", ")", "{", "return", "im2col", "(", "img", ",...
Implement column formatted images @param img the image to process @param kh the kernel height @param kw the kernel width @param sy the stride along y @param sx the stride along x @param ph the padding width @param pw the padding height @param isSameMode whether to cover the whole image or not @return the column formatted image
[ "Implement", "column", "formatted", "images" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/nd4j/nd4j-backends/nd4j-api-parent/nd4j-api/src/main/java/org/nd4j/linalg/convolution/Convolution.java#L155-L157
google/closure-compiler
src/com/google/javascript/jscomp/parsing/TypeTransformationParser.java
TypeTransformationParser.validRecordTypeExpression
private boolean validRecordTypeExpression(Node expr) { // The expression must have at least two children. The record keyword and // a record expression if (!checkParameterCount(expr, Keywords.RECORD)) { return false; } // Each child must be a valid record for (int i = 0; i < getCallParamCount(expr); i++) { if (!validRecordParam(getCallArgument(expr, i))) { warnInvalidInside(Keywords.RECORD.name, expr); return false; } } return true; }
java
private boolean validRecordTypeExpression(Node expr) { // The expression must have at least two children. The record keyword and // a record expression if (!checkParameterCount(expr, Keywords.RECORD)) { return false; } // Each child must be a valid record for (int i = 0; i < getCallParamCount(expr); i++) { if (!validRecordParam(getCallArgument(expr, i))) { warnInvalidInside(Keywords.RECORD.name, expr); return false; } } return true; }
[ "private", "boolean", "validRecordTypeExpression", "(", "Node", "expr", ")", "{", "// The expression must have at least two children. The record keyword and", "// a record expression", "if", "(", "!", "checkParameterCount", "(", "expr", ",", "Keywords", ".", "RECORD", ")", ...
A record type expression must be of the form: record(RecordExp, RecordExp, ...)
[ "A", "record", "type", "expression", "must", "be", "of", "the", "form", ":", "record", "(", "RecordExp", "RecordExp", "...", ")" ]
train
https://github.com/google/closure-compiler/blob/d81e36740f6a9e8ac31a825ee8758182e1dc5aae/src/com/google/javascript/jscomp/parsing/TypeTransformationParser.java#L434-L448
nostra13/Android-Universal-Image-Loader
library/src/main/java/com/nostra13/universalimageloader/cache/disc/impl/ext/DiskLruCache.java
DiskLruCache.rebuildJournal
private synchronized void rebuildJournal() throws IOException { if (journalWriter != null) { journalWriter.close(); } Writer writer = new BufferedWriter( new OutputStreamWriter(new FileOutputStream(journalFileTmp), Util.US_ASCII)); try { writer.write(MAGIC); writer.write("\n"); writer.write(VERSION_1); writer.write("\n"); writer.write(Integer.toString(appVersion)); writer.write("\n"); writer.write(Integer.toString(valueCount)); writer.write("\n"); writer.write("\n"); for (Entry entry : lruEntries.values()) { if (entry.currentEditor != null) { writer.write(DIRTY + ' ' + entry.key + '\n'); } else { writer.write(CLEAN + ' ' + entry.key + entry.getLengths() + '\n'); } } } finally { writer.close(); } if (journalFile.exists()) { renameTo(journalFile, journalFileBackup, true); } renameTo(journalFileTmp, journalFile, false); journalFileBackup.delete(); journalWriter = new BufferedWriter( new OutputStreamWriter(new FileOutputStream(journalFile, true), Util.US_ASCII)); }
java
private synchronized void rebuildJournal() throws IOException { if (journalWriter != null) { journalWriter.close(); } Writer writer = new BufferedWriter( new OutputStreamWriter(new FileOutputStream(journalFileTmp), Util.US_ASCII)); try { writer.write(MAGIC); writer.write("\n"); writer.write(VERSION_1); writer.write("\n"); writer.write(Integer.toString(appVersion)); writer.write("\n"); writer.write(Integer.toString(valueCount)); writer.write("\n"); writer.write("\n"); for (Entry entry : lruEntries.values()) { if (entry.currentEditor != null) { writer.write(DIRTY + ' ' + entry.key + '\n'); } else { writer.write(CLEAN + ' ' + entry.key + entry.getLengths() + '\n'); } } } finally { writer.close(); } if (journalFile.exists()) { renameTo(journalFile, journalFileBackup, true); } renameTo(journalFileTmp, journalFile, false); journalFileBackup.delete(); journalWriter = new BufferedWriter( new OutputStreamWriter(new FileOutputStream(journalFile, true), Util.US_ASCII)); }
[ "private", "synchronized", "void", "rebuildJournal", "(", ")", "throws", "IOException", "{", "if", "(", "journalWriter", "!=", "null", ")", "{", "journalWriter", ".", "close", "(", ")", ";", "}", "Writer", "writer", "=", "new", "BufferedWriter", "(", "new", ...
Creates a new journal that omits redundant information. This replaces the current journal if it exists.
[ "Creates", "a", "new", "journal", "that", "omits", "redundant", "information", ".", "This", "replaces", "the", "current", "journal", "if", "it", "exists", "." ]
train
https://github.com/nostra13/Android-Universal-Image-Loader/blob/fc3c5f6779bb4f702e233653b61bd9d559e345cc/library/src/main/java/com/nostra13/universalimageloader/cache/disc/impl/ext/DiskLruCache.java#L353-L390
jmeetsma/Iglu-Util
src/main/java/org/ijsberg/iglu/util/io/FileSupport.java
FileSupport.getFilesAndDirectoriesInDirectoryTree
public static ArrayList<File> getFilesAndDirectoriesInDirectoryTree(String path, String includeMask) { File file = new File(path); return getContentsInDirectoryTree(file, includeMask, true, true); }
java
public static ArrayList<File> getFilesAndDirectoriesInDirectoryTree(String path, String includeMask) { File file = new File(path); return getContentsInDirectoryTree(file, includeMask, true, true); }
[ "public", "static", "ArrayList", "<", "File", ">", "getFilesAndDirectoriesInDirectoryTree", "(", "String", "path", ",", "String", "includeMask", ")", "{", "File", "file", "=", "new", "File", "(", "path", ")", ";", "return", "getContentsInDirectoryTree", "(", "fi...
Retrieves all files from a directory and its subdirectories. @param path path to directory @param includeMask file name to match @return a list containing the found files
[ "Retrieves", "all", "files", "from", "a", "directory", "and", "its", "subdirectories", "." ]
train
https://github.com/jmeetsma/Iglu-Util/blob/971eb022115247b1e34dc26dd02e7e621e29e910/src/main/java/org/ijsberg/iglu/util/io/FileSupport.java#L196-L199
apache/incubator-atlas
client/src/main/java/org/apache/atlas/AtlasClient.java
AtlasClient.getTraitDefinition
public Struct getTraitDefinition(final String guid, final String traitName) throws AtlasServiceException{ JSONObject jsonResponse = callAPIWithBodyAndParams(API.GET_TRAIT_DEFINITION, null, guid, TRAIT_DEFINITIONS, traitName); try { return InstanceSerialization.fromJsonStruct(jsonResponse.getString(AtlasClient.RESULTS), false); }catch (JSONException e){ throw new AtlasServiceException(API.GET_TRAIT_DEFINITION, e); } }
java
public Struct getTraitDefinition(final String guid, final String traitName) throws AtlasServiceException{ JSONObject jsonResponse = callAPIWithBodyAndParams(API.GET_TRAIT_DEFINITION, null, guid, TRAIT_DEFINITIONS, traitName); try { return InstanceSerialization.fromJsonStruct(jsonResponse.getString(AtlasClient.RESULTS), false); }catch (JSONException e){ throw new AtlasServiceException(API.GET_TRAIT_DEFINITION, e); } }
[ "public", "Struct", "getTraitDefinition", "(", "final", "String", "guid", ",", "final", "String", "traitName", ")", "throws", "AtlasServiceException", "{", "JSONObject", "jsonResponse", "=", "callAPIWithBodyAndParams", "(", "API", ".", "GET_TRAIT_DEFINITION", ",", "nu...
Get trait definition for a given entity and traitname @param guid GUID of the entity @param traitName @return trait definition @throws AtlasServiceException
[ "Get", "trait", "definition", "for", "a", "given", "entity", "and", "traitname" ]
train
https://github.com/apache/incubator-atlas/blob/e0d2cdc27c32742ebecd24db4cca62dc04dcdf4b/client/src/main/java/org/apache/atlas/AtlasClient.java#L736-L744
wildfly/wildfly-core
deployment-repository/src/main/java/org/jboss/as/repository/PathUtil.java
PathUtil.deleteRecursively
public static void deleteRecursively(final Path path) throws IOException { DeploymentRepositoryLogger.ROOT_LOGGER.debugf("Deleting %s recursively", path); if (Files.exists(path)) { Files.walkFileTree(path, new FileVisitor<Path>() { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { Files.delete(file); return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException { DeploymentRepositoryLogger.ROOT_LOGGER.cannotDeleteFile(exc, path); throw exc; } @Override public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { Files.delete(dir); return FileVisitResult.CONTINUE; } }); } }
java
public static void deleteRecursively(final Path path) throws IOException { DeploymentRepositoryLogger.ROOT_LOGGER.debugf("Deleting %s recursively", path); if (Files.exists(path)) { Files.walkFileTree(path, new FileVisitor<Path>() { @Override public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException { return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException { Files.delete(file); return FileVisitResult.CONTINUE; } @Override public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOException { DeploymentRepositoryLogger.ROOT_LOGGER.cannotDeleteFile(exc, path); throw exc; } @Override public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException { Files.delete(dir); return FileVisitResult.CONTINUE; } }); } }
[ "public", "static", "void", "deleteRecursively", "(", "final", "Path", "path", ")", "throws", "IOException", "{", "DeploymentRepositoryLogger", ".", "ROOT_LOGGER", ".", "debugf", "(", "\"Deleting %s recursively\"", ",", "path", ")", ";", "if", "(", "Files", ".", ...
Delete a path recursively. @param path a Path pointing to a file or a directory that may not exists anymore. @throws IOException
[ "Delete", "a", "path", "recursively", "." ]
train
https://github.com/wildfly/wildfly-core/blob/cfaf0479dcbb2d320a44c5374b93b944ec39fade/deployment-repository/src/main/java/org/jboss/as/repository/PathUtil.java#L105-L133
deeplearning4j/deeplearning4j
deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/word2vec/wordstore/inmemory/AbstractCache.java
AbstractCache.incrementDocCount
@Override public void incrementDocCount(String word, long howMuch) { T element = extendedVocabulary.get(word); if (element != null) { element.incrementSequencesCount(); } }
java
@Override public void incrementDocCount(String word, long howMuch) { T element = extendedVocabulary.get(word); if (element != null) { element.incrementSequencesCount(); } }
[ "@", "Override", "public", "void", "incrementDocCount", "(", "String", "word", ",", "long", "howMuch", ")", "{", "T", "element", "=", "extendedVocabulary", ".", "get", "(", "word", ")", ";", "if", "(", "element", "!=", "null", ")", "{", "element", ".", ...
Increment number of documents the label was observed in Please note: this method is NOT thread-safe @param word the word to increment by @param howMuch
[ "Increment", "number", "of", "documents", "the", "label", "was", "observed", "in" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/deeplearning4j/deeplearning4j-nlp-parent/deeplearning4j-nlp/src/main/java/org/deeplearning4j/models/word2vec/wordstore/inmemory/AbstractCache.java#L334-L340
openbase/jul
visual/javafx/src/main/java/org/openbase/jul/visual/javafx/geometry/svg/SVGIcon.java
SVGIcon.setForegroundIcon
public void setForegroundIcon(final PROVIDER iconProvider, final Color color) { // copy old images to replace later. final Shape oldForegroundIcon = foregroundIcon; final Shape oldForegroundFadeIcon = foregroundFadeIcon; // create new images. this.foregroundIcon = createIcon(iconProvider, Layer.FOREGROUND); this.foregroundFadeIcon = createColorFadeIcon(iconProvider, Layer.FOREGROUND); // setup icon color if (color != null) { setForegroundIconColor(color); } // replace old icons with new ones. getChildren().replaceAll((node) -> { if (node.equals(oldForegroundIcon)) { return foregroundIcon; } else if (node.equals(oldForegroundFadeIcon)) { return foregroundFadeIcon; } else { return node; } }
java
public void setForegroundIcon(final PROVIDER iconProvider, final Color color) { // copy old images to replace later. final Shape oldForegroundIcon = foregroundIcon; final Shape oldForegroundFadeIcon = foregroundFadeIcon; // create new images. this.foregroundIcon = createIcon(iconProvider, Layer.FOREGROUND); this.foregroundFadeIcon = createColorFadeIcon(iconProvider, Layer.FOREGROUND); // setup icon color if (color != null) { setForegroundIconColor(color); } // replace old icons with new ones. getChildren().replaceAll((node) -> { if (node.equals(oldForegroundIcon)) { return foregroundIcon; } else if (node.equals(oldForegroundFadeIcon)) { return foregroundFadeIcon; } else { return node; } }
[ "public", "void", "setForegroundIcon", "(", "final", "PROVIDER", "iconProvider", ",", "final", "Color", "color", ")", "{", "// copy old images to replace later.", "final", "Shape", "oldForegroundIcon", "=", "foregroundIcon", ";", "final", "Shape", "oldForegroundFadeIcon",...
Changes the foregroundIcon icon. <p> Note: previous color setup and animations are reset as well. @param iconProvider the icon which should be set as the new icon. @param color the color of the new icon.
[ "Changes", "the", "foregroundIcon", "icon", ".", "<p", ">", "Note", ":", "previous", "color", "setup", "and", "animations", "are", "reset", "as", "well", "." ]
train
https://github.com/openbase/jul/blob/662e98c3a853085e475be54c3be3deb72193c72d/visual/javafx/src/main/java/org/openbase/jul/visual/javafx/geometry/svg/SVGIcon.java#L559-L582
QSFT/Doradus
doradus-server/src/main/java/com/dell/doradus/service/spider/SpiderTransaction.java
SpiderTransaction.addAllObjectsColumn
public void addAllObjectsColumn(TableDefinition tableDef, String objID, int shardNo) { String rowKey = ALL_OBJECTS_ROW_KEY; if (shardNo > 0) { rowKey = shardNo + "/" + ALL_OBJECTS_ROW_KEY; } addColumn(SpiderService.termsStoreName(tableDef), rowKey, objID); }
java
public void addAllObjectsColumn(TableDefinition tableDef, String objID, int shardNo) { String rowKey = ALL_OBJECTS_ROW_KEY; if (shardNo > 0) { rowKey = shardNo + "/" + ALL_OBJECTS_ROW_KEY; } addColumn(SpiderService.termsStoreName(tableDef), rowKey, objID); }
[ "public", "void", "addAllObjectsColumn", "(", "TableDefinition", "tableDef", ",", "String", "objID", ",", "int", "shardNo", ")", "{", "String", "rowKey", "=", "ALL_OBJECTS_ROW_KEY", ";", "if", "(", "shardNo", ">", "0", ")", "{", "rowKey", "=", "shardNo", "+"...
Add an "all objects" column for an object in the given table with the given ID. The "all objects" lives in the Terms store and its row key is "_" for objects residing in shard 0, "{shard number}/_" for objects residing in other shards. The column added is named with the object's ID but has no value. @param tableDef {@link TableDefinition} of table that owns object. @param objID ID of object being added. @param shardNo Shard number if owing table is sharded.
[ "Add", "an", "all", "objects", "column", "for", "an", "object", "in", "the", "given", "table", "with", "the", "given", "ID", ".", "The", "all", "objects", "lives", "in", "the", "Terms", "store", "and", "its", "row", "key", "is", "_", "for", "objects", ...
train
https://github.com/QSFT/Doradus/blob/ad64d3c37922eefda68ec8869ef089c1ca604b70/doradus-server/src/main/java/com/dell/doradus/service/spider/SpiderTransaction.java#L207-L213
aws/aws-sdk-java
aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/PutMethodResult.java
PutMethodResult.withRequestModels
public PutMethodResult withRequestModels(java.util.Map<String, String> requestModels) { setRequestModels(requestModels); return this; }
java
public PutMethodResult withRequestModels(java.util.Map<String, String> requestModels) { setRequestModels(requestModels); return this; }
[ "public", "PutMethodResult", "withRequestModels", "(", "java", ".", "util", ".", "Map", "<", "String", ",", "String", ">", "requestModels", ")", "{", "setRequestModels", "(", "requestModels", ")", ";", "return", "this", ";", "}" ]
<p> A key-value map specifying data schemas, represented by <a>Model</a> resources, (as the mapped value) of the request payloads of given content types (as the mapping key). </p> @param requestModels A key-value map specifying data schemas, represented by <a>Model</a> resources, (as the mapped value) of the request payloads of given content types (as the mapping key). @return Returns a reference to this object so that method calls can be chained together.
[ "<p", ">", "A", "key", "-", "value", "map", "specifying", "data", "schemas", "represented", "by", "<a", ">", "Model<", "/", "a", ">", "resources", "(", "as", "the", "mapped", "value", ")", "of", "the", "request", "payloads", "of", "given", "content", "...
train
https://github.com/aws/aws-sdk-java/blob/aa38502458969b2d13a1c3665a56aba600e4dbd0/aws-java-sdk-api-gateway/src/main/java/com/amazonaws/services/apigateway/model/PutMethodResult.java#L614-L617
VoltDB/voltdb
src/frontend/org/voltcore/zk/MapCache.java
MapCache.processChildEvent
private void processChildEvent(WatchedEvent event) throws Exception { HashMap<String, JSONObject> cacheCopy = new HashMap<String, JSONObject>(m_publicCache.get()); ByteArrayCallback cb = new ByteArrayCallback(); m_zk.getData(event.getPath(), m_childWatch, cb, null); try { byte payload[] = cb.get(); JSONObject jsObj = new JSONObject(new String(payload, "UTF-8")); cacheCopy.put(cb.getPath(), jsObj); } catch (KeeperException.NoNodeException e) { cacheCopy.remove(event.getPath()); } m_publicCache.set(ImmutableMap.copyOf(cacheCopy)); if (m_cb != null) { m_cb.run(m_publicCache.get()); } }
java
private void processChildEvent(WatchedEvent event) throws Exception { HashMap<String, JSONObject> cacheCopy = new HashMap<String, JSONObject>(m_publicCache.get()); ByteArrayCallback cb = new ByteArrayCallback(); m_zk.getData(event.getPath(), m_childWatch, cb, null); try { byte payload[] = cb.get(); JSONObject jsObj = new JSONObject(new String(payload, "UTF-8")); cacheCopy.put(cb.getPath(), jsObj); } catch (KeeperException.NoNodeException e) { cacheCopy.remove(event.getPath()); } m_publicCache.set(ImmutableMap.copyOf(cacheCopy)); if (m_cb != null) { m_cb.run(m_publicCache.get()); } }
[ "private", "void", "processChildEvent", "(", "WatchedEvent", "event", ")", "throws", "Exception", "{", "HashMap", "<", "String", ",", "JSONObject", ">", "cacheCopy", "=", "new", "HashMap", "<", "String", ",", "JSONObject", ">", "(", "m_publicCache", ".", "get"...
Update a modified child and republish a new snapshot. This may indicate a deleted child or a child with modified data.
[ "Update", "a", "modified", "child", "and", "republish", "a", "new", "snapshot", ".", "This", "may", "indicate", "a", "deleted", "child", "or", "a", "child", "with", "modified", "data", "." ]
train
https://github.com/VoltDB/voltdb/blob/8afc1031e475835344b5497ea9e7203bc95475ac/src/frontend/org/voltcore/zk/MapCache.java#L277-L292
huahin/huahin-core
src/main/java/org/huahinframework/core/io/Record.java
Record.addSort
public void addSort(WritableComparable<?> writable, int sort, int priority) { key.addHadoopValue(String.format(SORT_LABEL, priority), writable, sort, priority); }
java
public void addSort(WritableComparable<?> writable, int sort, int priority) { key.addHadoopValue(String.format(SORT_LABEL, priority), writable, sort, priority); }
[ "public", "void", "addSort", "(", "WritableComparable", "<", "?", ">", "writable", ",", "int", "sort", ",", "int", "priority", ")", "{", "key", ".", "addHadoopValue", "(", "String", ".", "format", "(", "SORT_LABEL", ",", "priority", ")", ",", "writable", ...
Add sort key @param writable Hadoop sort key @param sort sort type SORT_NON or SORT_LOWER or SORT_UPPER @param priority sort order
[ "Add", "sort", "key" ]
train
https://github.com/huahin/huahin-core/blob/a87921b5a12be92a822f753c075ab2431036e6f5/src/main/java/org/huahinframework/core/io/Record.java#L232-L234
datasalt/pangool
core/src/main/java/com/datasalt/pangool/tuplemr/mapred/lib/input/PangoolMultipleInputs.java
PangoolMultipleInputs.addInputContext
public static void addInputContext(Job job, String inputName, String key, String value, int inputId) { // Check that this named output has been configured before Configuration conf = job.getConfiguration(); // Add specific configuration conf.set(MI_PREFIX + inputName + "." + inputId + CONF + "." + key, value); }
java
public static void addInputContext(Job job, String inputName, String key, String value, int inputId) { // Check that this named output has been configured before Configuration conf = job.getConfiguration(); // Add specific configuration conf.set(MI_PREFIX + inputName + "." + inputId + CONF + "." + key, value); }
[ "public", "static", "void", "addInputContext", "(", "Job", "job", ",", "String", "inputName", ",", "String", "key", ",", "String", "value", ",", "int", "inputId", ")", "{", "// Check that this named output has been configured before", "Configuration", "conf", "=", "...
Specific (key, value) configurations for each Input. Some Input Formats read specific configuration values and act based on them.
[ "Specific", "(", "key", "value", ")", "configurations", "for", "each", "Input", ".", "Some", "Input", "Formats", "read", "specific", "configuration", "values", "and", "act", "based", "on", "them", "." ]
train
https://github.com/datasalt/pangool/blob/bfd312dd78cba03febaf7988ae96a3d4bc585408/core/src/main/java/com/datasalt/pangool/tuplemr/mapred/lib/input/PangoolMultipleInputs.java#L170-L175
BorderTech/wcomponents
wcomponents-core/src/main/java/com/github/bordertech/wcomponents/SimpleTableModel.java
SimpleTableModel.setComparator
public void setComparator(final int col, final Comparator comparator) { synchronized (this) { if (comparators == null) { comparators = new HashMap<>(); } } if (comparator == null) { comparators.remove(col); } else { comparators.put(col, comparator); } }
java
public void setComparator(final int col, final Comparator comparator) { synchronized (this) { if (comparators == null) { comparators = new HashMap<>(); } } if (comparator == null) { comparators.remove(col); } else { comparators.put(col, comparator); } }
[ "public", "void", "setComparator", "(", "final", "int", "col", ",", "final", "Comparator", "comparator", ")", "{", "synchronized", "(", "this", ")", "{", "if", "(", "comparators", "==", "null", ")", "{", "comparators", "=", "new", "HashMap", "<>", "(", "...
Sets the comparator for the given column, to enable sorting. @param col the column to set the comparator on. @param comparator the comparator to set.
[ "Sets", "the", "comparator", "for", "the", "given", "column", "to", "enable", "sorting", "." ]
train
https://github.com/BorderTech/wcomponents/blob/d1a2b2243270067db030feb36ca74255aaa94436/wcomponents-core/src/main/java/com/github/bordertech/wcomponents/SimpleTableModel.java#L86-L98
buschmais/jqa-core-framework
plugin/src/main/java/com/buschmais/jqassistant/core/plugin/impl/AbstractPluginRepository.java
AbstractPluginRepository.createInstance
protected <T> T createInstance(String typeName) throws PluginRepositoryException { Class<T> type = getType(typeName.trim()); try { return type.newInstance(); } catch (InstantiationException e) { throw new PluginRepositoryException("Cannot create instance of class " + type.getName(), e); } catch (IllegalAccessException e) { throw new PluginRepositoryException("Cannot access class " + typeName, e); } catch (LinkageError e) { throw new PluginRepositoryException("Cannot load plugin class " + typeName, e); } }
java
protected <T> T createInstance(String typeName) throws PluginRepositoryException { Class<T> type = getType(typeName.trim()); try { return type.newInstance(); } catch (InstantiationException e) { throw new PluginRepositoryException("Cannot create instance of class " + type.getName(), e); } catch (IllegalAccessException e) { throw new PluginRepositoryException("Cannot access class " + typeName, e); } catch (LinkageError e) { throw new PluginRepositoryException("Cannot load plugin class " + typeName, e); } }
[ "protected", "<", "T", ">", "T", "createInstance", "(", "String", "typeName", ")", "throws", "PluginRepositoryException", "{", "Class", "<", "T", ">", "type", "=", "getType", "(", "typeName", ".", "trim", "(", ")", ")", ";", "try", "{", "return", "type",...
Create an instance of the given scanner plugin class. @param typeName The type name. @param <T> The type. @return The plugin instance. @throws PluginRepositoryException If the requested instance could not be created.
[ "Create", "an", "instance", "of", "the", "given", "scanner", "plugin", "class", "." ]
train
https://github.com/buschmais/jqa-core-framework/blob/0e63ff509cfe52f9063539a23d5f9f183b2ea4a5/plugin/src/main/java/com/buschmais/jqassistant/core/plugin/impl/AbstractPluginRepository.java#L72-L83
hector-client/hector
core/src/main/java/me/prettyprint/hector/api/factory/HFactory.java
HFactory.createCounterColumn
public static HCounterColumn<String> createCounterColumn(String name, long value) { StringSerializer se = StringSerializer.get(); return createCounterColumn(name, value, se); }
java
public static HCounterColumn<String> createCounterColumn(String name, long value) { StringSerializer se = StringSerializer.get(); return createCounterColumn(name, value, se); }
[ "public", "static", "HCounterColumn", "<", "String", ">", "createCounterColumn", "(", "String", "name", ",", "long", "value", ")", "{", "StringSerializer", "se", "=", "StringSerializer", ".", "get", "(", ")", ";", "return", "createCounterColumn", "(", "name", ...
Convenient method for creating a counter column with a String name and long value
[ "Convenient", "method", "for", "creating", "a", "counter", "column", "with", "a", "String", "name", "and", "long", "value" ]
train
https://github.com/hector-client/hector/blob/a302e68ca8d91b45d332e8c9afd7d98030b54de1/core/src/main/java/me/prettyprint/hector/api/factory/HFactory.java#L650-L653
deeplearning4j/deeplearning4j
datavec/datavec-arrow/src/main/java/org/datavec/arrow/ArrowConverter.java
ArrowConverter.writeRecordBatchTo
public static void writeRecordBatchTo(BufferAllocator bufferAllocator ,List<List<Writable>> recordBatch, Schema inputSchema,OutputStream outputStream) { if(!(recordBatch instanceof ArrowWritableRecordBatch)) { val convertedSchema = toArrowSchema(inputSchema); List<FieldVector> columns = toArrowColumns(bufferAllocator,inputSchema,recordBatch); try { VectorSchemaRoot root = new VectorSchemaRoot(convertedSchema,columns,recordBatch.size()); ArrowFileWriter writer = new ArrowFileWriter(root, providerForVectors(columns,convertedSchema.getFields()), newChannel(outputStream)); writer.start(); writer.writeBatch(); writer.end(); } catch (IOException e) { throw new IllegalStateException(e); } } else { val convertedSchema = toArrowSchema(inputSchema); val pair = toArrowColumns(bufferAllocator,inputSchema,recordBatch); try { VectorSchemaRoot root = new VectorSchemaRoot(convertedSchema,pair,recordBatch.size()); ArrowFileWriter writer = new ArrowFileWriter(root, providerForVectors(pair,convertedSchema.getFields()), newChannel(outputStream)); writer.start(); writer.writeBatch(); writer.end(); } catch (IOException e) { throw new IllegalStateException(e); } } }
java
public static void writeRecordBatchTo(BufferAllocator bufferAllocator ,List<List<Writable>> recordBatch, Schema inputSchema,OutputStream outputStream) { if(!(recordBatch instanceof ArrowWritableRecordBatch)) { val convertedSchema = toArrowSchema(inputSchema); List<FieldVector> columns = toArrowColumns(bufferAllocator,inputSchema,recordBatch); try { VectorSchemaRoot root = new VectorSchemaRoot(convertedSchema,columns,recordBatch.size()); ArrowFileWriter writer = new ArrowFileWriter(root, providerForVectors(columns,convertedSchema.getFields()), newChannel(outputStream)); writer.start(); writer.writeBatch(); writer.end(); } catch (IOException e) { throw new IllegalStateException(e); } } else { val convertedSchema = toArrowSchema(inputSchema); val pair = toArrowColumns(bufferAllocator,inputSchema,recordBatch); try { VectorSchemaRoot root = new VectorSchemaRoot(convertedSchema,pair,recordBatch.size()); ArrowFileWriter writer = new ArrowFileWriter(root, providerForVectors(pair,convertedSchema.getFields()), newChannel(outputStream)); writer.start(); writer.writeBatch(); writer.end(); } catch (IOException e) { throw new IllegalStateException(e); } } }
[ "public", "static", "void", "writeRecordBatchTo", "(", "BufferAllocator", "bufferAllocator", ",", "List", "<", "List", "<", "Writable", ">", ">", "recordBatch", ",", "Schema", "inputSchema", ",", "OutputStream", "outputStream", ")", "{", "if", "(", "!", "(", "...
Write the records to the given output stream @param recordBatch the record batch to write @param inputSchema the input schema @param outputStream the output stream to write to
[ "Write", "the", "records", "to", "the", "given", "output", "stream" ]
train
https://github.com/deeplearning4j/deeplearning4j/blob/effce52f2afd7eeb53c5bcca699fcd90bd06822f/datavec/datavec-arrow/src/main/java/org/datavec/arrow/ArrowConverter.java#L276-L313
dwdyer/reportng
reportng/src/java/main/org/uncommons/reportng/HTMLReporter.java
HTMLReporter.createSuiteList
private void createSuiteList(List<ISuite> suites, File outputDirectory, boolean onlyFailures) throws Exception { VelocityContext context = createContext(); context.put(SUITES_KEY, suites); context.put(ONLY_FAILURES_KEY, onlyFailures); generateFile(new File(outputDirectory, SUITES_FILE), SUITES_FILE + TEMPLATE_EXTENSION, context); }
java
private void createSuiteList(List<ISuite> suites, File outputDirectory, boolean onlyFailures) throws Exception { VelocityContext context = createContext(); context.put(SUITES_KEY, suites); context.put(ONLY_FAILURES_KEY, onlyFailures); generateFile(new File(outputDirectory, SUITES_FILE), SUITES_FILE + TEMPLATE_EXTENSION, context); }
[ "private", "void", "createSuiteList", "(", "List", "<", "ISuite", ">", "suites", ",", "File", "outputDirectory", ",", "boolean", "onlyFailures", ")", "throws", "Exception", "{", "VelocityContext", "context", "=", "createContext", "(", ")", ";", "context", ".", ...
Create the navigation frame. @param outputDirectory The target directory for the generated file(s).
[ "Create", "the", "navigation", "frame", "." ]
train
https://github.com/dwdyer/reportng/blob/df11f9cd9ab3fb5847fbba94ed3098ae0448f770/reportng/src/java/main/org/uncommons/reportng/HTMLReporter.java#L153-L163
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/MessageDigest.java
MessageDigest.isEqual
public static boolean isEqual(byte[] digesta, byte[] digestb) { if (digesta == digestb) return true; if (digesta == null || digestb == null) { return false; } if (digesta.length != digestb.length) { return false; } int result = 0; // time-constant comparison for (int i = 0; i < digesta.length; i++) { result |= digesta[i] ^ digestb[i]; } return result == 0; }
java
public static boolean isEqual(byte[] digesta, byte[] digestb) { if (digesta == digestb) return true; if (digesta == null || digestb == null) { return false; } if (digesta.length != digestb.length) { return false; } int result = 0; // time-constant comparison for (int i = 0; i < digesta.length; i++) { result |= digesta[i] ^ digestb[i]; } return result == 0; }
[ "public", "static", "boolean", "isEqual", "(", "byte", "[", "]", "digesta", ",", "byte", "[", "]", "digestb", ")", "{", "if", "(", "digesta", "==", "digestb", ")", "return", "true", ";", "if", "(", "digesta", "==", "null", "||", "digestb", "==", "nul...
Compares two digests for equality. Does a simple byte compare. @param digesta one of the digests to compare. @param digestb the other digest to compare. @return true if the digests are equal, false otherwise.
[ "Compares", "two", "digests", "for", "equality", ".", "Does", "a", "simple", "byte", "compare", "." ]
train
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/MessageDigest.java#L480-L495
mikepenz/Materialize
library/src/main/java/com/mikepenz/materialize/util/UIUtils.java
UIUtils.setBackground
public static void setBackground(View v, @DrawableRes int drawableRes) { ViewCompat.setBackground(v, ContextCompat.getDrawable(v.getContext(), drawableRes)); }
java
public static void setBackground(View v, @DrawableRes int drawableRes) { ViewCompat.setBackground(v, ContextCompat.getDrawable(v.getContext(), drawableRes)); }
[ "public", "static", "void", "setBackground", "(", "View", "v", ",", "@", "DrawableRes", "int", "drawableRes", ")", "{", "ViewCompat", ".", "setBackground", "(", "v", ",", "ContextCompat", ".", "getDrawable", "(", "v", ".", "getContext", "(", ")", ",", "dra...
helper method to set the background depending on the android version @param v @param drawableRes
[ "helper", "method", "to", "set", "the", "background", "depending", "on", "the", "android", "version" ]
train
https://github.com/mikepenz/Materialize/blob/2612c10c7570191a78d57f23620e945d61370e3d/library/src/main/java/com/mikepenz/materialize/util/UIUtils.java#L81-L83
codelibs/fess
src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java
FessMessages.addErrorsInvalidStrIsIncluded
public FessMessages addErrorsInvalidStrIsIncluded(String property, String arg0, String arg1) { assertPropertyNotNull(property); add(property, new UserMessage(ERRORS_invalid_str_is_included, arg0, arg1)); return this; }
java
public FessMessages addErrorsInvalidStrIsIncluded(String property, String arg0, String arg1) { assertPropertyNotNull(property); add(property, new UserMessage(ERRORS_invalid_str_is_included, arg0, arg1)); return this; }
[ "public", "FessMessages", "addErrorsInvalidStrIsIncluded", "(", "String", "property", ",", "String", "arg0", ",", "String", "arg1", ")", "{", "assertPropertyNotNull", "(", "property", ")", ";", "add", "(", "property", ",", "new", "UserMessage", "(", "ERRORS_invali...
Add the created action message for the key 'errors.invalid_str_is_included' with parameters. <pre> message: "{1}" in "{0}" is invalid. </pre> @param property The property name for the message. (NotNull) @param arg0 The parameter arg0 for message. (NotNull) @param arg1 The parameter arg1 for message. (NotNull) @return this. (NotNull)
[ "Add", "the", "created", "action", "message", "for", "the", "key", "errors", ".", "invalid_str_is_included", "with", "parameters", ".", "<pre", ">", "message", ":", "{", "1", "}", "in", "{", "0", "}", "is", "invalid", ".", "<", "/", "pre", ">" ]
train
https://github.com/codelibs/fess/blob/e5e4b722549d32a4958dfd94965b21937bfe64cf/src/main/java/org/codelibs/fess/mylasta/action/FessMessages.java#L1777-L1781
lightblue-platform/lightblue-migrator
migrator/src/main/java/com/redhat/lightblue/migrator/Controller.java
Controller.getMigrationConfiguration
public MigrationConfiguration getMigrationConfiguration(String configurationName) throws IOException, LightblueException { DataFindRequest findRequest = new DataFindRequest("migrationConfiguration", null); findRequest.where(Query.and( Query.withValue("configurationName", Query.eq, configurationName), Query.withValue("consistencyCheckerName", Query.eq, cfg.getName())) ); findRequest.select(Projection.includeFieldRecursively("*")); LOGGER.debug("Loading configuration:{}", findRequest.getBody()); return lightblueClient.data(findRequest, MigrationConfiguration.class); }
java
public MigrationConfiguration getMigrationConfiguration(String configurationName) throws IOException, LightblueException { DataFindRequest findRequest = new DataFindRequest("migrationConfiguration", null); findRequest.where(Query.and( Query.withValue("configurationName", Query.eq, configurationName), Query.withValue("consistencyCheckerName", Query.eq, cfg.getName())) ); findRequest.select(Projection.includeFieldRecursively("*")); LOGGER.debug("Loading configuration:{}", findRequest.getBody()); return lightblueClient.data(findRequest, MigrationConfiguration.class); }
[ "public", "MigrationConfiguration", "getMigrationConfiguration", "(", "String", "configurationName", ")", "throws", "IOException", ",", "LightblueException", "{", "DataFindRequest", "findRequest", "=", "new", "DataFindRequest", "(", "\"migrationConfiguration\"", ",", "null", ...
Read a configuration from the database whose name matches the the given configuration name
[ "Read", "a", "configuration", "from", "the", "database", "whose", "name", "matches", "the", "the", "given", "configuration", "name" ]
train
https://github.com/lightblue-platform/lightblue-migrator/blob/ec20748557b40d1f7851e1816d1b76dae48d2027/migrator/src/main/java/com/redhat/lightblue/migrator/Controller.java#L92-L102
grpc/grpc-java
okhttp/src/main/java/io/grpc/okhttp/AsyncSink.java
AsyncSink.becomeConnected
void becomeConnected(Sink sink, Socket socket) { checkState(this.sink == null, "AsyncSink's becomeConnected should only be called once."); this.sink = checkNotNull(sink, "sink"); this.socket = checkNotNull(socket, "socket"); }
java
void becomeConnected(Sink sink, Socket socket) { checkState(this.sink == null, "AsyncSink's becomeConnected should only be called once."); this.sink = checkNotNull(sink, "sink"); this.socket = checkNotNull(socket, "socket"); }
[ "void", "becomeConnected", "(", "Sink", "sink", ",", "Socket", "socket", ")", "{", "checkState", "(", "this", ".", "sink", "==", "null", ",", "\"AsyncSink's becomeConnected should only be called once.\"", ")", ";", "this", ".", "sink", "=", "checkNotNull", "(", ...
Sets the actual sink. It is allowed to call write / flush operations on the sink iff calling this method is scheduled in the executor. The socket is needed for closing. <p>should only be called once by thread of executor.
[ "Sets", "the", "actual", "sink", ".", "It", "is", "allowed", "to", "call", "write", "/", "flush", "operations", "on", "the", "sink", "iff", "calling", "this", "method", "is", "scheduled", "in", "the", "executor", ".", "The", "socket", "is", "needed", "fo...
train
https://github.com/grpc/grpc-java/blob/973885457f9609de232d2553b82c67f6c3ff57bf/okhttp/src/main/java/io/grpc/okhttp/AsyncSink.java#L69-L73
OpenLiberty/open-liberty
dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/FormatSet.java
FormatSet.customizeDateFormat
public static DateFormat customizeDateFormat(DateFormat formatter, boolean isoDateFormat) { String pattern; int patternLength; int endOfSecsIndex; if (!!!isoDateFormat) { if (formatter instanceof SimpleDateFormat) { // Retrieve the pattern from the formatter, since we will need to modify it. SimpleDateFormat sdFormatter = (SimpleDateFormat) formatter; pattern = sdFormatter.toPattern(); // Append milliseconds and timezone after seconds patternLength = pattern.length(); endOfSecsIndex = pattern.lastIndexOf('s') + 1; String newPattern = pattern.substring(0, endOfSecsIndex) + ":SSS z"; if (endOfSecsIndex < patternLength) newPattern += pattern.substring(endOfSecsIndex, patternLength); // 0-23 hour clock (get rid of any other clock formats and am/pm) newPattern = newPattern.replace('h', 'H'); newPattern = newPattern.replace('K', 'H'); newPattern = newPattern.replace('k', 'H'); newPattern = newPattern.replace('a', ' '); newPattern = newPattern.trim(); sdFormatter.applyPattern(newPattern); formatter = sdFormatter; } else { formatter = new SimpleDateFormat("yy.MM.dd HH:mm:ss:SSS z"); } } else { formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); } // PK13288 Start - if (sysTimeZone != null) { formatter.setTimeZone(sysTimeZone); } // PK13288 End return formatter; }
java
public static DateFormat customizeDateFormat(DateFormat formatter, boolean isoDateFormat) { String pattern; int patternLength; int endOfSecsIndex; if (!!!isoDateFormat) { if (formatter instanceof SimpleDateFormat) { // Retrieve the pattern from the formatter, since we will need to modify it. SimpleDateFormat sdFormatter = (SimpleDateFormat) formatter; pattern = sdFormatter.toPattern(); // Append milliseconds and timezone after seconds patternLength = pattern.length(); endOfSecsIndex = pattern.lastIndexOf('s') + 1; String newPattern = pattern.substring(0, endOfSecsIndex) + ":SSS z"; if (endOfSecsIndex < patternLength) newPattern += pattern.substring(endOfSecsIndex, patternLength); // 0-23 hour clock (get rid of any other clock formats and am/pm) newPattern = newPattern.replace('h', 'H'); newPattern = newPattern.replace('K', 'H'); newPattern = newPattern.replace('k', 'H'); newPattern = newPattern.replace('a', ' '); newPattern = newPattern.trim(); sdFormatter.applyPattern(newPattern); formatter = sdFormatter; } else { formatter = new SimpleDateFormat("yy.MM.dd HH:mm:ss:SSS z"); } } else { formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); } // PK13288 Start - if (sysTimeZone != null) { formatter.setTimeZone(sysTimeZone); } // PK13288 End return formatter; }
[ "public", "static", "DateFormat", "customizeDateFormat", "(", "DateFormat", "formatter", ",", "boolean", "isoDateFormat", ")", "{", "String", "pattern", ";", "int", "patternLength", ";", "int", "endOfSecsIndex", ";", "if", "(", "!", "!", "!", "isoDateFormat", ")...
Modifies an existing DateFormat object so that it can be used to format timestamps in the System.out, System.err and TraceOutput logs using either default date and time format or ISO-8601 date and time format @param formatter DateFormat object to be modified @param flag to use ISO-8601 date format for output. @return DateFormat object with adjusted pattern
[ "Modifies", "an", "existing", "DateFormat", "object", "so", "that", "it", "can", "be", "used", "to", "format", "timestamps", "in", "the", "System", ".", "out", "System", ".", "err", "and", "TraceOutput", "logs", "using", "either", "default", "date", "and", ...
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.logging.hpel/src/com/ibm/ws/logging/hpel/FormatSet.java#L127-L164
Swagger2Markup/swagger2markup
src/main/java/io/github/swagger2markup/internal/document/OverviewDocument.java
OverviewDocument.apply
@Override public MarkupDocBuilder apply(MarkupDocBuilder markupDocBuilder, OverviewDocument.Parameters params) { Swagger swagger = params.swagger; Info info = swagger.getInfo(); buildDocumentTitle(markupDocBuilder, info.getTitle()); applyOverviewDocumentExtension(new Context(Position.DOCUMENT_BEFORE, markupDocBuilder)); buildOverviewTitle(markupDocBuilder, labels.getLabel(Labels.OVERVIEW)); applyOverviewDocumentExtension(new Context(Position.DOCUMENT_BEGIN, markupDocBuilder)); buildDescriptionParagraph(markupDocBuilder, info.getDescription()); buildVersionInfoSection(markupDocBuilder, info); buildContactInfoSection(markupDocBuilder, info.getContact()); buildLicenseInfoSection(markupDocBuilder, info); buildUriSchemeSection(markupDocBuilder, swagger); buildTagsSection(markupDocBuilder, swagger.getTags()); buildConsumesSection(markupDocBuilder, swagger.getConsumes()); buildProducesSection(markupDocBuilder, swagger.getProduces()); buildExternalDocsSection(markupDocBuilder, swagger.getExternalDocs()); applyOverviewDocumentExtension(new Context(Position.DOCUMENT_END, markupDocBuilder)); applyOverviewDocumentExtension(new Context(Position.DOCUMENT_AFTER, markupDocBuilder)); return markupDocBuilder; }
java
@Override public MarkupDocBuilder apply(MarkupDocBuilder markupDocBuilder, OverviewDocument.Parameters params) { Swagger swagger = params.swagger; Info info = swagger.getInfo(); buildDocumentTitle(markupDocBuilder, info.getTitle()); applyOverviewDocumentExtension(new Context(Position.DOCUMENT_BEFORE, markupDocBuilder)); buildOverviewTitle(markupDocBuilder, labels.getLabel(Labels.OVERVIEW)); applyOverviewDocumentExtension(new Context(Position.DOCUMENT_BEGIN, markupDocBuilder)); buildDescriptionParagraph(markupDocBuilder, info.getDescription()); buildVersionInfoSection(markupDocBuilder, info); buildContactInfoSection(markupDocBuilder, info.getContact()); buildLicenseInfoSection(markupDocBuilder, info); buildUriSchemeSection(markupDocBuilder, swagger); buildTagsSection(markupDocBuilder, swagger.getTags()); buildConsumesSection(markupDocBuilder, swagger.getConsumes()); buildProducesSection(markupDocBuilder, swagger.getProduces()); buildExternalDocsSection(markupDocBuilder, swagger.getExternalDocs()); applyOverviewDocumentExtension(new Context(Position.DOCUMENT_END, markupDocBuilder)); applyOverviewDocumentExtension(new Context(Position.DOCUMENT_AFTER, markupDocBuilder)); return markupDocBuilder; }
[ "@", "Override", "public", "MarkupDocBuilder", "apply", "(", "MarkupDocBuilder", "markupDocBuilder", ",", "OverviewDocument", ".", "Parameters", "params", ")", "{", "Swagger", "swagger", "=", "params", ".", "swagger", ";", "Info", "info", "=", "swagger", ".", "g...
Builds the overview MarkupDocument. @return the overview MarkupDocument
[ "Builds", "the", "overview", "MarkupDocument", "." ]
train
https://github.com/Swagger2Markup/swagger2markup/blob/da83465f19a2f8a0f1fba873b5762bca8587896b/src/main/java/io/github/swagger2markup/internal/document/OverviewDocument.java#L68-L88
pravega/pravega
controller/src/main/java/io/pravega/controller/server/rpc/auth/PravegaAuthManager.java
PravegaAuthManager.authenticateAndAuthorize
public boolean authenticateAndAuthorize(String resource, String credentials, AuthHandler.Permissions level) throws AuthenticationException { Preconditions.checkNotNull(credentials, "credentials"); boolean retVal = false; try { String[] parts = extractMethodAndToken(credentials); String method = parts[0]; String token = parts[1]; AuthHandler handler = getHandler(method); Preconditions.checkNotNull( handler, "Can not find handler."); Principal principal; if ((principal = handler.authenticate(token)) == null) { throw new AuthenticationException("Authentication failure"); } retVal = handler.authorize(resource, principal).ordinal() >= level.ordinal(); } catch (AuthException e) { throw new AuthenticationException("Authentication failure"); } return retVal; }
java
public boolean authenticateAndAuthorize(String resource, String credentials, AuthHandler.Permissions level) throws AuthenticationException { Preconditions.checkNotNull(credentials, "credentials"); boolean retVal = false; try { String[] parts = extractMethodAndToken(credentials); String method = parts[0]; String token = parts[1]; AuthHandler handler = getHandler(method); Preconditions.checkNotNull( handler, "Can not find handler."); Principal principal; if ((principal = handler.authenticate(token)) == null) { throw new AuthenticationException("Authentication failure"); } retVal = handler.authorize(resource, principal).ordinal() >= level.ordinal(); } catch (AuthException e) { throw new AuthenticationException("Authentication failure"); } return retVal; }
[ "public", "boolean", "authenticateAndAuthorize", "(", "String", "resource", ",", "String", "credentials", ",", "AuthHandler", ".", "Permissions", "level", ")", "throws", "AuthenticationException", "{", "Preconditions", ".", "checkNotNull", "(", "credentials", ",", "\"...
API to authenticate and authorize access to a given resource. @param resource The resource identifier for which the access needs to be controlled. @param credentials Credentials used for authentication. @param level Expected level of access. @return Returns true if the entity represented by the custom auth headers had given level of access to the resource. Returns false if the entity does not have access. @throws AuthenticationException if an authentication failure occurred.
[ "API", "to", "authenticate", "and", "authorize", "access", "to", "a", "given", "resource", "." ]
train
https://github.com/pravega/pravega/blob/6e24df7470669b3956a07018f52b2c6b3c2a3503/controller/src/main/java/io/pravega/controller/server/rpc/auth/PravegaAuthManager.java#L65-L83
Azure/azure-sdk-for-java
logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowTriggersInner.java
WorkflowTriggersInner.setState
public void setState(String resourceGroupName, String workflowName, String triggerName, WorkflowTriggerInner source) { setStateWithServiceResponseAsync(resourceGroupName, workflowName, triggerName, source).toBlocking().single().body(); }
java
public void setState(String resourceGroupName, String workflowName, String triggerName, WorkflowTriggerInner source) { setStateWithServiceResponseAsync(resourceGroupName, workflowName, triggerName, source).toBlocking().single().body(); }
[ "public", "void", "setState", "(", "String", "resourceGroupName", ",", "String", "workflowName", ",", "String", "triggerName", ",", "WorkflowTriggerInner", "source", ")", "{", "setStateWithServiceResponseAsync", "(", "resourceGroupName", ",", "workflowName", ",", "trigg...
Sets the state of a workflow trigger. @param resourceGroupName The resource group name. @param workflowName The workflow name. @param triggerName The workflow trigger name. @param source the WorkflowTriggerInner value @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Sets", "the", "state", "of", "a", "workflow", "trigger", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowTriggersInner.java#L731-L733
undertow-io/undertow
core/src/main/java/io/undertow/websockets/core/WebSockets.java
WebSockets.sendTextBlocking
public static void sendTextBlocking(final String message, final WebSocketChannel wsChannel) throws IOException { final ByteBuffer data = ByteBuffer.wrap(message.getBytes(StandardCharsets.UTF_8)); sendBlockingInternal(data, WebSocketFrameType.TEXT, wsChannel); }
java
public static void sendTextBlocking(final String message, final WebSocketChannel wsChannel) throws IOException { final ByteBuffer data = ByteBuffer.wrap(message.getBytes(StandardCharsets.UTF_8)); sendBlockingInternal(data, WebSocketFrameType.TEXT, wsChannel); }
[ "public", "static", "void", "sendTextBlocking", "(", "final", "String", "message", ",", "final", "WebSocketChannel", "wsChannel", ")", "throws", "IOException", "{", "final", "ByteBuffer", "data", "=", "ByteBuffer", ".", "wrap", "(", "message", ".", "getBytes", "...
Sends a complete text message, invoking the callback when complete @param message The text to send @param wsChannel The web socket channel
[ "Sends", "a", "complete", "text", "message", "invoking", "the", "callback", "when", "complete" ]
train
https://github.com/undertow-io/undertow/blob/87de0b856a7a4ba8faf5b659537b9af07b763263/core/src/main/java/io/undertow/websockets/core/WebSockets.java#L198-L201
belaban/JGroups
src/org/jgroups/blocks/MessageDispatcher.java
MessageDispatcher.castMessageWithFuture
public <T> CompletableFuture<RspList<T>> castMessageWithFuture(final Collection<Address> dests, Buffer data, RequestOptions opts) throws Exception { return cast(dests,data,opts,false); }
java
public <T> CompletableFuture<RspList<T>> castMessageWithFuture(final Collection<Address> dests, Buffer data, RequestOptions opts) throws Exception { return cast(dests,data,opts,false); }
[ "public", "<", "T", ">", "CompletableFuture", "<", "RspList", "<", "T", ">", ">", "castMessageWithFuture", "(", "final", "Collection", "<", "Address", ">", "dests", ",", "Buffer", "data", ",", "RequestOptions", "opts", ")", "throws", "Exception", "{", "retur...
Sends a message to all members and expects responses from members in dests (if non-null). @param dests A list of group members from which to expect responses (if the call is blocking). @param data The message to be sent @param opts A set of options that govern the call. See {@link org.jgroups.blocks.RequestOptions} for details @return CompletableFuture<T> A future from which the results (RspList) can be retrieved, or null if the request was sent asynchronously @throws Exception If the request cannot be sent
[ "Sends", "a", "message", "to", "all", "members", "and", "expects", "responses", "from", "members", "in", "dests", "(", "if", "non", "-", "null", ")", "." ]
train
https://github.com/belaban/JGroups/blob/bd3ca786aa57fed41dfbc10a94b1281e388be03b/src/org/jgroups/blocks/MessageDispatcher.java#L265-L268
hankcs/HanLP
src/main/java/com/hankcs/hanlp/summary/TextRankSentence.java
TextRankSentence.getSummary
public static String getSummary(String document, int max_length, String sentence_separator) { List<String> sentenceList = splitSentence(document, sentence_separator); int sentence_count = sentenceList.size(); int document_length = document.length(); int sentence_length_avg = document_length / sentence_count; int size = max_length / sentence_length_avg + 1; List<List<String>> docs = convertSentenceListToDocument(sentenceList); TextRankSentence textRank = new TextRankSentence(docs); int[] topSentence = textRank.getTopSentence(size); List<String> resultList = new LinkedList<String>(); for (int i : topSentence) { resultList.add(sentenceList.get(i)); } resultList = permutation(resultList, sentenceList); resultList = pick_sentences(resultList, max_length); return TextUtility.join("。", resultList); }
java
public static String getSummary(String document, int max_length, String sentence_separator) { List<String> sentenceList = splitSentence(document, sentence_separator); int sentence_count = sentenceList.size(); int document_length = document.length(); int sentence_length_avg = document_length / sentence_count; int size = max_length / sentence_length_avg + 1; List<List<String>> docs = convertSentenceListToDocument(sentenceList); TextRankSentence textRank = new TextRankSentence(docs); int[] topSentence = textRank.getTopSentence(size); List<String> resultList = new LinkedList<String>(); for (int i : topSentence) { resultList.add(sentenceList.get(i)); } resultList = permutation(resultList, sentenceList); resultList = pick_sentences(resultList, max_length); return TextUtility.join("。", resultList); }
[ "public", "static", "String", "getSummary", "(", "String", "document", ",", "int", "max_length", ",", "String", "sentence_separator", ")", "{", "List", "<", "String", ">", "sentenceList", "=", "splitSentence", "(", "document", ",", "sentence_separator", ")", ";"...
一句话调用接口 @param document 目标文档 @param max_length 需要摘要的长度 @param sentence_separator 句子分隔符,正则格式, 如:[。??!!;;] @return 摘要文本
[ "一句话调用接口" ]
train
https://github.com/hankcs/HanLP/blob/a538d0722ab2e4980a9dcd9ea40324fc3ddba7ce/src/main/java/com/hankcs/hanlp/summary/TextRankSentence.java#L274-L294
attribyte/wpdb
src/main/java/org/attribyte/wp/db/DB.java
DB.createTerm
public Term createTerm(final String name, final String slug) throws SQLException { Connection conn = null; PreparedStatement stmt = null; ResultSet rs = null; Timer.Context ctx = metrics.createTermTimer.time(); try { conn = connectionSupplier.getConnection(); stmt = conn.prepareStatement(insertTermSQL, Statement.RETURN_GENERATED_KEYS); stmt.setString(1, name); stmt.setString(2, slug); stmt.executeUpdate(); rs = stmt.getGeneratedKeys(); if(rs.next()) { return new Term(rs.getLong(1), name, slug); } else { throw new SQLException("Problem creating term (no generated id)"); } } finally { ctx.stop(); closeQuietly(conn, stmt, rs); } }
java
public Term createTerm(final String name, final String slug) throws SQLException { Connection conn = null; PreparedStatement stmt = null; ResultSet rs = null; Timer.Context ctx = metrics.createTermTimer.time(); try { conn = connectionSupplier.getConnection(); stmt = conn.prepareStatement(insertTermSQL, Statement.RETURN_GENERATED_KEYS); stmt.setString(1, name); stmt.setString(2, slug); stmt.executeUpdate(); rs = stmt.getGeneratedKeys(); if(rs.next()) { return new Term(rs.getLong(1), name, slug); } else { throw new SQLException("Problem creating term (no generated id)"); } } finally { ctx.stop(); closeQuietly(conn, stmt, rs); } }
[ "public", "Term", "createTerm", "(", "final", "String", "name", ",", "final", "String", "slug", ")", "throws", "SQLException", "{", "Connection", "conn", "=", "null", ";", "PreparedStatement", "stmt", "=", "null", ";", "ResultSet", "rs", "=", "null", ";", ...
Creates a term. @param name The term name. @param slug The term slug. @return The created term. @throws SQLException on database error.
[ "Creates", "a", "term", "." ]
train
https://github.com/attribyte/wpdb/blob/b9adf6131dfb67899ebff770c9bfeb001cc42f30/src/main/java/org/attribyte/wp/db/DB.java#L2147-L2169
OpenLiberty/open-liberty
dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java
CacheOnDisk.readHashcodeByRange
public Result readHashcodeByRange(int index, int length, boolean debug, boolean useValue) { // LI4337-17 Result result = this.htod.readHashcodeByRange(index, length, debug, useValue); if (result.returnCode == HTODDynacache.DISK_EXCEPTION) { stopOnError(result.diskException); } return result; }
java
public Result readHashcodeByRange(int index, int length, boolean debug, boolean useValue) { // LI4337-17 Result result = this.htod.readHashcodeByRange(index, length, debug, useValue); if (result.returnCode == HTODDynacache.DISK_EXCEPTION) { stopOnError(result.diskException); } return result; }
[ "public", "Result", "readHashcodeByRange", "(", "int", "index", ",", "int", "length", ",", "boolean", "debug", ",", "boolean", "useValue", ")", "{", "// LI4337-17", "Result", "result", "=", "this", ".", "htod", ".", "readHashcodeByRange", "(", "index", ",", ...
This method find the hashcode based on index and length. @param index If index = 0, it starts the beginning. If index = 1, it means "next". If Index = -1, it means "previous". @param length The max number of cache ids to be read. If length = -1, it reads all cache ids until the end. @param debug true to output id and its hashcode to systemout.log @param useValue true to calculate hashcode including value
[ "This", "method", "find", "the", "hashcode", "based", "on", "index", "and", "length", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.dynacache/src/com/ibm/ws/cache/CacheOnDisk.java#L1731-L1737
OpenLiberty/open-liberty
dev/com.ibm.ws.org.apache.cxf.cxf.core.3.2/src/org/apache/cxf/staxutils/StaxUtils.java
StaxUtils.getUniquePrefix
public static String getUniquePrefix(XMLStreamWriter writer, String namespaceURI, boolean declare) throws XMLStreamException { String prefix = writer.getPrefix(namespaceURI); if (prefix == null) { prefix = getUniquePrefix(writer); if (declare) { writer.setPrefix(prefix, namespaceURI); writer.writeNamespace(prefix, namespaceURI); } } return prefix; }
java
public static String getUniquePrefix(XMLStreamWriter writer, String namespaceURI, boolean declare) throws XMLStreamException { String prefix = writer.getPrefix(namespaceURI); if (prefix == null) { prefix = getUniquePrefix(writer); if (declare) { writer.setPrefix(prefix, namespaceURI); writer.writeNamespace(prefix, namespaceURI); } } return prefix; }
[ "public", "static", "String", "getUniquePrefix", "(", "XMLStreamWriter", "writer", ",", "String", "namespaceURI", ",", "boolean", "declare", ")", "throws", "XMLStreamException", "{", "String", "prefix", "=", "writer", ".", "getPrefix", "(", "namespaceURI", ")", ";...
Create a unique namespace uri/prefix combination. @return The namespace with the specified URI. If one doesn't exist, one is created. @throws XMLStreamException
[ "Create", "a", "unique", "namespace", "uri", "/", "prefix", "combination", "." ]
train
https://github.com/OpenLiberty/open-liberty/blob/ca725d9903e63645018f9fa8cbda25f60af83a5d/dev/com.ibm.ws.org.apache.cxf.cxf.core.3.2/src/org/apache/cxf/staxutils/StaxUtils.java#L1886-L1898
walkmod/walkmod-core
src/main/java/org/walkmod/WalkModFacade.java
WalkModFacade.getConfiguration
public Configuration getConfiguration() throws Exception { Configuration result = null; if (cfg.exists()) { userDir = new File(System.getProperty("user.dir")).getAbsolutePath(); System.setProperty("user.dir", options.getExecutionDirectory().getAbsolutePath()); try { ConfigurationManager manager = new ConfigurationManager(cfg, false); manager.executeConfigurationProviders(); result = manager.getConfiguration(); } finally { System.setProperty("user.dir", userDir); } } return result; }
java
public Configuration getConfiguration() throws Exception { Configuration result = null; if (cfg.exists()) { userDir = new File(System.getProperty("user.dir")).getAbsolutePath(); System.setProperty("user.dir", options.getExecutionDirectory().getAbsolutePath()); try { ConfigurationManager manager = new ConfigurationManager(cfg, false); manager.executeConfigurationProviders(); result = manager.getConfiguration(); } finally { System.setProperty("user.dir", userDir); } } return result; }
[ "public", "Configuration", "getConfiguration", "(", ")", "throws", "Exception", "{", "Configuration", "result", "=", "null", ";", "if", "(", "cfg", ".", "exists", "(", ")", ")", "{", "userDir", "=", "new", "File", "(", "System", ".", "getProperty", "(", ...
Returns the equivalent configuration representation of the Walkmod config file. @return Configuration object representation of the config file. @throws Exception If the walkmod configuration file can't be read.
[ "Returns", "the", "equivalent", "configuration", "representation", "of", "the", "Walkmod", "config", "file", "." ]
train
https://github.com/walkmod/walkmod-core/blob/fa79b836894fa00ca4b3e2bd26326a44b778f46f/src/main/java/org/walkmod/WalkModFacade.java#L929-L944
ngageoint/geopackage-android-map
geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleUtils.java
StyleUtils.createPolylineOptions
public static PolylineOptions createPolylineOptions(StyleRow style, float density) { PolylineOptions polylineOptions = new PolylineOptions(); setStyle(polylineOptions, style, density); return polylineOptions; }
java
public static PolylineOptions createPolylineOptions(StyleRow style, float density) { PolylineOptions polylineOptions = new PolylineOptions(); setStyle(polylineOptions, style, density); return polylineOptions; }
[ "public", "static", "PolylineOptions", "createPolylineOptions", "(", "StyleRow", "style", ",", "float", "density", ")", "{", "PolylineOptions", "polylineOptions", "=", "new", "PolylineOptions", "(", ")", ";", "setStyle", "(", "polylineOptions", ",", "style", ",", ...
Create new polyline options populated with the style @param style style row @param density display density: {@link android.util.DisplayMetrics#density} @return polyline options populated with the style
[ "Create", "new", "polyline", "options", "populated", "with", "the", "style" ]
train
https://github.com/ngageoint/geopackage-android-map/blob/634d78468a5c52d2bc98791cc7ff03981ebf573b/geopackage-map/src/main/java/mil/nga/geopackage/map/features/StyleUtils.java#L449-L455
line/centraldogma
common/src/main/java/com/linecorp/centraldogma/common/Entry.java
Entry.ofJson
public static Entry<JsonNode> ofJson(Revision revision, String path, String content) throws JsonParseException { return ofJson(revision, path, Jackson.readTree(content)); }
java
public static Entry<JsonNode> ofJson(Revision revision, String path, String content) throws JsonParseException { return ofJson(revision, path, Jackson.readTree(content)); }
[ "public", "static", "Entry", "<", "JsonNode", ">", "ofJson", "(", "Revision", "revision", ",", "String", "path", ",", "String", "content", ")", "throws", "JsonParseException", "{", "return", "ofJson", "(", "revision", ",", "path", ",", "Jackson", ".", "readT...
Returns a newly-created {@link Entry} of a JSON file. @param revision the revision of the JSON file @param path the path of the JSON file @param content the content of the JSON file @throws JsonParseException if the {@code content} is not a valid JSON
[ "Returns", "a", "newly", "-", "created", "{", "@link", "Entry", "}", "of", "a", "JSON", "file", "." ]
train
https://github.com/line/centraldogma/blob/b9e46c67fbc26628c2186ce2f46e7fb303c831e9/common/src/main/java/com/linecorp/centraldogma/common/Entry.java#L70-L73
m-m-m/util
sandbox/src/main/java/net/sf/mmm/util/xml/NamespaceContextImpl.java
NamespaceContextImpl.setNamespace
public void setNamespace(String prefix, String uri) { this.prefix2namespace.put(prefix, uri); this.namespace2prefix.put(uri, prefix); }
java
public void setNamespace(String prefix, String uri) { this.prefix2namespace.put(prefix, uri); this.namespace2prefix.put(uri, prefix); }
[ "public", "void", "setNamespace", "(", "String", "prefix", ",", "String", "uri", ")", "{", "this", ".", "prefix2namespace", ".", "put", "(", "prefix", ",", "uri", ")", ";", "this", ".", "namespace2prefix", ".", "put", "(", "uri", ",", "prefix", ")", ";...
This method is used to declare a namespace in this context. @param prefix is the prefix for the namespace. @param uri is the URI of the namespace.
[ "This", "method", "is", "used", "to", "declare", "a", "namespace", "in", "this", "context", "." ]
train
https://github.com/m-m-m/util/blob/f0e4e084448f8dfc83ca682a9e1618034a094ce6/sandbox/src/main/java/net/sf/mmm/util/xml/NamespaceContextImpl.java#L89-L93
liuyukuai/commons
commons-core/src/main/java/com/itxiaoer/commons/core/util/NumUtils.java
NumUtils.longVal
public static long longVal(String val, long defaultValue) { try { return NumberUtils.createNumber(val).longValue(); } catch (Exception e) { log.warn("longVal(String, int) throw {}, return defaultValue = {}", e, defaultValue); return defaultValue; } }
java
public static long longVal(String val, long defaultValue) { try { return NumberUtils.createNumber(val).longValue(); } catch (Exception e) { log.warn("longVal(String, int) throw {}, return defaultValue = {}", e, defaultValue); return defaultValue; } }
[ "public", "static", "long", "longVal", "(", "String", "val", ",", "long", "defaultValue", ")", "{", "try", "{", "return", "NumberUtils", ".", "createNumber", "(", "val", ")", ".", "longValue", "(", ")", ";", "}", "catch", "(", "Exception", "e", ")", "{...
转换为long类型数据 @param val 需要转换的值 @param defaultValue 默认值 @return long
[ "转换为long类型数据" ]
train
https://github.com/liuyukuai/commons/blob/ba67eddb542446b12f419f1866dbaa82e47fbf35/commons-core/src/main/java/com/itxiaoer/commons/core/util/NumUtils.java#L66-L73
Coveros/selenified
src/main/java/com/coveros/selenified/element/check/wait/WaitForEquals.java
WaitForEquals.selectedValue
public void selectedValue(String expectedValue, double seconds) { double end = System.currentTimeMillis() + (seconds * 1000); try { elementPresent(seconds); if (!element.is().select()) { throw new TimeoutException(ELEMENT_NOT_SELECT); } while (!element.get().selectedValue().equals(expectedValue) && System.currentTimeMillis() < end) ; double timeTook = Math.min((seconds * 1000) - (end - System.currentTimeMillis()), seconds * 1000) / 1000; checkSelectedValue(expectedValue, seconds, timeTook); } catch (TimeoutException e) { checkSelectedValue(expectedValue, seconds, seconds); } }
java
public void selectedValue(String expectedValue, double seconds) { double end = System.currentTimeMillis() + (seconds * 1000); try { elementPresent(seconds); if (!element.is().select()) { throw new TimeoutException(ELEMENT_NOT_SELECT); } while (!element.get().selectedValue().equals(expectedValue) && System.currentTimeMillis() < end) ; double timeTook = Math.min((seconds * 1000) - (end - System.currentTimeMillis()), seconds * 1000) / 1000; checkSelectedValue(expectedValue, seconds, timeTook); } catch (TimeoutException e) { checkSelectedValue(expectedValue, seconds, seconds); } }
[ "public", "void", "selectedValue", "(", "String", "expectedValue", ",", "double", "seconds", ")", "{", "double", "end", "=", "System", ".", "currentTimeMillis", "(", ")", "+", "(", "seconds", "*", "1000", ")", ";", "try", "{", "elementPresent", "(", "secon...
Waits for the element's selected value equals the provided expected value. If the element isn't present or a select, this will constitute a failure, same as a mismatch. The provided wait time will be used and if the element doesn't have the desired match count at that time, it will fail, and log the issue with a screenshot for traceability and added debugging support. @param expectedValue - the expected input value of the element @param seconds - how many seconds to wait for
[ "Waits", "for", "the", "element", "s", "selected", "value", "equals", "the", "provided", "expected", "value", ".", "If", "the", "element", "isn", "t", "present", "or", "a", "select", "this", "will", "constitute", "a", "failure", "same", "as", "a", "mismatc...
train
https://github.com/Coveros/selenified/blob/396cc1f010dd69eed33cc5061c41253de246a4cd/src/main/java/com/coveros/selenified/element/check/wait/WaitForEquals.java#L460-L473
Azure/azure-sdk-for-java
mediaservices/resource-manager/v2018_03_30_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_03_30_preview/implementation/LiveOutputsInner.java
LiveOutputsInner.createAsync
public Observable<LiveOutputInner> createAsync(String resourceGroupName, String accountName, String liveEventName, String liveOutputName, LiveOutputInner parameters) { return createWithServiceResponseAsync(resourceGroupName, accountName, liveEventName, liveOutputName, parameters).map(new Func1<ServiceResponse<LiveOutputInner>, LiveOutputInner>() { @Override public LiveOutputInner call(ServiceResponse<LiveOutputInner> response) { return response.body(); } }); }
java
public Observable<LiveOutputInner> createAsync(String resourceGroupName, String accountName, String liveEventName, String liveOutputName, LiveOutputInner parameters) { return createWithServiceResponseAsync(resourceGroupName, accountName, liveEventName, liveOutputName, parameters).map(new Func1<ServiceResponse<LiveOutputInner>, LiveOutputInner>() { @Override public LiveOutputInner call(ServiceResponse<LiveOutputInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "LiveOutputInner", ">", "createAsync", "(", "String", "resourceGroupName", ",", "String", "accountName", ",", "String", "liveEventName", ",", "String", "liveOutputName", ",", "LiveOutputInner", "parameters", ")", "{", "return", "createWith...
Create Live Output. Creates a Live Output. @param resourceGroupName The name of the resource group within the Azure subscription. @param accountName The Media Services account name. @param liveEventName The name of the Live Event. @param liveOutputName The name of the Live Output. @param parameters Live Output properties needed for creation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable for the request
[ "Create", "Live", "Output", ".", "Creates", "a", "Live", "Output", "." ]
train
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/resource-manager/v2018_03_30_preview/src/main/java/com/microsoft/azure/management/mediaservices/v2018_03_30_preview/implementation/LiveOutputsInner.java#L382-L389
gallandarakhneorg/afc
core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java
XMLUtil.readXMLFragment
public static DocumentFragment readXMLFragment(InputStream stream) throws IOException, SAXException, ParserConfigurationException { return readXMLFragment(stream, false); }
java
public static DocumentFragment readXMLFragment(InputStream stream) throws IOException, SAXException, ParserConfigurationException { return readXMLFragment(stream, false); }
[ "public", "static", "DocumentFragment", "readXMLFragment", "(", "InputStream", "stream", ")", "throws", "IOException", ",", "SAXException", ",", "ParserConfigurationException", "{", "return", "readXMLFragment", "(", "stream", ",", "false", ")", ";", "}" ]
Read an XML fragment from an XML file. The XML file is well-formed. It means that the fragment will contains a single element: the root element within the input stream. @param stream is the stream to read @return the fragment from the {@code stream}. @throws IOException if the stream cannot be read. @throws SAXException if the stream does not contains valid XML data. @throws ParserConfigurationException if the parser cannot be configured.
[ "Read", "an", "XML", "fragment", "from", "an", "XML", "file", ".", "The", "XML", "file", "is", "well", "-", "formed", ".", "It", "means", "that", "the", "fragment", "will", "contains", "a", "single", "element", ":", "the", "root", "element", "within", ...
train
https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/xml/XMLUtil.java#L1980-L1983