blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
132 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
28 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
352
685e854f0d86ea42fc2f76a98ce7adfb2c8e83f7
0f398b7d729bcb81bea2735c3a4dca8ccf7e16f7
/src/basics/cartest.java
331c872dd6dce25b4826f7a5ff52778de81aac3c
[]
no_license
odinchev/basics
83935842a93b11843f9c188dc554cafcae21d464
73c59ec961060038344c41f81e16402bb3fb60e7
refs/heads/master
2021-01-10T05:47:39.537862
2016-03-11T16:41:25
2016-03-11T16:41:25
53,681,554
0
0
null
null
null
null
UTF-8
Java
false
false
461
java
package basics; public class cartest { public static void main(String[]args) { car car1=new car("ford","gt ","green","opii","2009"); System.out.println(car1); car car2=car1.copy(); System.out.println(car2+" car "); if (car2.equals(car1)) { System.out.println("the cars are the same"); } else { System.out.println("the cars are not the same"); } } }
[ "oleg_dinchev@abv.bg" ]
oleg_dinchev@abv.bg
2902e5f64c671535a3f97026a968f8a4dad301ea
b34ea2bd1ae06f44295e226d828fa18e9825f91b
/src/main/java/com/deu/payday/domain/CardsimpleVO.java
4058134e65ecc30ea95d5f41b3031104d23756e1
[]
no_license
rodvkf72/PayDay
bac53ddef4822e7b5a421b3212ed61ad5425c866
1aa1b4ae2757cafb72b2518c6a82019453b2c900
refs/heads/main
2023-02-21T13:28:26.909396
2021-01-20T08:36:16
2021-01-20T08:36:16
314,501,180
0
0
null
null
null
null
UTF-8
Java
false
false
129
java
package com.deu.payday.domain; import lombok.Data; @Data public class CardsimpleVO { private String spw; private String id; }
[ "72743795+nasisa@users.noreply.github.com" ]
72743795+nasisa@users.noreply.github.com
1bc950cc0c6c0e95aa70ade3b25b1f618cbdb58e
62d3ec55742067cf0d769c69e04a86e25ebef20a
/src/main/java/signingToday/client/api/ServicesApi.java
3e0cbf9fc93cacbd4ef9d228a278e00c5768854d
[ "MIT" ]
permissive
signingtoday/signingtoday-sdk-java
4fa60a3599365f1f75fefbd417ba6dc27c30f183
1a6c6ff16a3483e66b69e78fefdfd5abd4891684
refs/heads/master
2022-05-29T14:14:30.351422
2020-03-24T08:26:37
2020-03-24T08:26:37
232,547,913
0
0
MIT
2022-05-20T21:20:59
2020-01-08T11:26:45
Java
UTF-8
Java
false
false
88,998
java
/* * Signing Today Web * *Signing Today* is the perfect Digital Signature Gateway. Whenever in Your workflow You need to add one or more Digital Signatures to Your document, *Signing Today* is the right choice. You prepare Your documents, *Signing Today* takes care of all the rest: send invitations (`signature tickets`) to signers, collects their signatures, send You back the signed document. Integrating *Signing Today* in Your existing applications is very easy. Just follow these API specifications and get inspired by the many examples presented hereafter. * * The version of the OpenAPI document: 2.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ package signingToday.client.api; import signingToday.client.ApiCallback; import signingToday.client.ApiClient; import signingToday.client.ApiException; import signingToday.client.ApiResponse; import signingToday.client.Configuration; import signingToday.client.Pair; import signingToday.client.ProgressRequestBody; import signingToday.client.ProgressResponseBody; import com.google.gson.reflect.TypeToken; import java.io.IOException; import signingToday.client.model.ErrorResponse; import java.io.File; import signingToday.client.model.InlineObject; import signingToday.client.model.InlineObject4; import signingToday.client.model.InlineResponse200; import signingToday.client.model.ServiceFailureResponse; import java.util.UUID; import signingToday.client.model.User; import signingToday.client.model.UserSyncReport; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class ServicesApi { private ApiClient localVarApiClient; public ServicesApi() { this(Configuration.getDefaultApiClient()); } public ServicesApi(ApiClient apiClient) { this.localVarApiClient = apiClient; } public ApiClient getApiClient() { return localVarApiClient; } public void setApiClient(ApiClient apiClient) { this.localVarApiClient = apiClient; } /** * Build call for authChangePasswordPost * @param passwordToken The password token issued to change password (required) * @param body New password associated to the account (BCrypt) (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 204 </td><td> The request has been satisfyied. No output. </td><td> - </td></tr> <tr><td> 409 </td><td> Cannot satisfy the request because the resource is in an illegal status. </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public okhttp3.Call authChangePasswordPostCall(String passwordToken, String body, final ApiCallback _callback) throws ApiException { Object localVarPostBody = body; // create path and map variables String localVarPath = "/auth/changePassword"; List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); if (passwordToken != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("passwordToken", passwordToken)); } Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "*/*" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { "text/plain" }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); String[] localVarAuthNames = new String[] { }; return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call authChangePasswordPostValidateBeforeCall(String passwordToken, String body, final ApiCallback _callback) throws ApiException { // verify the required parameter 'passwordToken' is set if (passwordToken == null) { throw new ApiException("Missing the required parameter 'passwordToken' when calling authChangePasswordPost(Async)"); } // verify the required parameter 'body' is set if (body == null) { throw new ApiException("Missing the required parameter 'body' when calling authChangePasswordPost(Async)"); } okhttp3.Call localVarCall = authChangePasswordPostCall(passwordToken, body, _callback); return localVarCall; } /** * Consume a token to change the password * This API allows to change the password by consuming a token. * @param passwordToken The password token issued to change password (required) * @param body New password associated to the account (BCrypt) (required) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 204 </td><td> The request has been satisfyied. No output. </td><td> - </td></tr> <tr><td> 409 </td><td> Cannot satisfy the request because the resource is in an illegal status. </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public void authChangePasswordPost(String passwordToken, String body) throws ApiException { authChangePasswordPostWithHttpInfo(passwordToken, body); } /** * Consume a token to change the password * This API allows to change the password by consuming a token. * @param passwordToken The password token issued to change password (required) * @param body New password associated to the account (BCrypt) (required) * @return ApiResponse&lt;Void&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 204 </td><td> The request has been satisfyied. No output. </td><td> - </td></tr> <tr><td> 409 </td><td> Cannot satisfy the request because the resource is in an illegal status. </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public ApiResponse<Void> authChangePasswordPostWithHttpInfo(String passwordToken, String body) throws ApiException { okhttp3.Call localVarCall = authChangePasswordPostValidateBeforeCall(passwordToken, body, null); return localVarApiClient.execute(localVarCall); } /** * Consume a token to change the password (asynchronously) * This API allows to change the password by consuming a token. * @param passwordToken The password token issued to change password (required) * @param body New password associated to the account (BCrypt) (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 204 </td><td> The request has been satisfyied. No output. </td><td> - </td></tr> <tr><td> 409 </td><td> Cannot satisfy the request because the resource is in an illegal status. </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public okhttp3.Call authChangePasswordPostAsync(String passwordToken, String body, final ApiCallback<Void> _callback) throws ApiException { okhttp3.Call localVarCall = authChangePasswordPostValidateBeforeCall(passwordToken, body, _callback); localVarApiClient.executeAsync(localVarCall, _callback); return localVarCall; } /** * Build call for authPasswordLostGet * @param username Username associated to the account (required) * @param domain Domain associated to the account (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 204 </td><td> The request has been satisfyied. No output. </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public okhttp3.Call authPasswordLostGetCall(String username, String domain, final ApiCallback _callback) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/auth/passwordLost"; List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); if (username != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("username", username)); } if (domain != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("domain", domain)); } Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "*/*" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); String[] localVarAuthNames = new String[] { }; return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call authPasswordLostGetValidateBeforeCall(String username, String domain, final ApiCallback _callback) throws ApiException { // verify the required parameter 'username' is set if (username == null) { throw new ApiException("Missing the required parameter 'username' when calling authPasswordLostGet(Async)"); } // verify the required parameter 'domain' is set if (domain == null) { throw new ApiException("Missing the required parameter 'domain' when calling authPasswordLostGet(Async)"); } okhttp3.Call localVarCall = authPasswordLostGetCall(username, domain, _callback); return localVarCall; } /** * Request to recover own password * This API requests to recover the own password. * @param username Username associated to the account (required) * @param domain Domain associated to the account (required) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 204 </td><td> The request has been satisfyied. No output. </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public void authPasswordLostGet(String username, String domain) throws ApiException { authPasswordLostGetWithHttpInfo(username, domain); } /** * Request to recover own password * This API requests to recover the own password. * @param username Username associated to the account (required) * @param domain Domain associated to the account (required) * @return ApiResponse&lt;Void&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 204 </td><td> The request has been satisfyied. No output. </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public ApiResponse<Void> authPasswordLostGetWithHttpInfo(String username, String domain) throws ApiException { okhttp3.Call localVarCall = authPasswordLostGetValidateBeforeCall(username, domain, null); return localVarApiClient.execute(localVarCall); } /** * Request to recover own password (asynchronously) * This API requests to recover the own password. * @param username Username associated to the account (required) * @param domain Domain associated to the account (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 204 </td><td> The request has been satisfyied. No output. </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public okhttp3.Call authPasswordLostGetAsync(String username, String domain, final ApiCallback<Void> _callback) throws ApiException { okhttp3.Call localVarCall = authPasswordLostGetValidateBeforeCall(username, domain, _callback); localVarApiClient.executeAsync(localVarCall, _callback); return localVarCall; } /** * Build call for authPasswordResetGet * @param username Username associated to the account (required) * @param domain Domain associated to the account (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 204 </td><td> The request has been satisfyied. No output. </td><td> - </td></tr> <tr><td> 401 </td><td> User authentication was not effective (e.g. not provided, invalid or expired). </td><td> - </td></tr> <tr><td> 403 </td><td> User is not allowed to perform the request. </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public okhttp3.Call authPasswordResetGetCall(String username, String domain, final ApiCallback _callback) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/auth/passwordReset"; List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); if (username != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("username", username)); } if (domain != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("domain", domain)); } Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "*/*" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); String[] localVarAuthNames = new String[] { "OAuth2" }; return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call authPasswordResetGetValidateBeforeCall(String username, String domain, final ApiCallback _callback) throws ApiException { // verify the required parameter 'username' is set if (username == null) { throw new ApiException("Missing the required parameter 'username' when calling authPasswordResetGet(Async)"); } // verify the required parameter 'domain' is set if (domain == null) { throw new ApiException("Missing the required parameter 'domain' when calling authPasswordResetGet(Async)"); } okhttp3.Call localVarCall = authPasswordResetGetCall(username, domain, _callback); return localVarCall; } /** * Reset a user password with superuser * This API allows to reset the password of a user. This is possible when the request is performed with a superuser. * @param username Username associated to the account (required) * @param domain Domain associated to the account (required) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 204 </td><td> The request has been satisfyied. No output. </td><td> - </td></tr> <tr><td> 401 </td><td> User authentication was not effective (e.g. not provided, invalid or expired). </td><td> - </td></tr> <tr><td> 403 </td><td> User is not allowed to perform the request. </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public void authPasswordResetGet(String username, String domain) throws ApiException { authPasswordResetGetWithHttpInfo(username, domain); } /** * Reset a user password with superuser * This API allows to reset the password of a user. This is possible when the request is performed with a superuser. * @param username Username associated to the account (required) * @param domain Domain associated to the account (required) * @return ApiResponse&lt;Void&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 204 </td><td> The request has been satisfyied. No output. </td><td> - </td></tr> <tr><td> 401 </td><td> User authentication was not effective (e.g. not provided, invalid or expired). </td><td> - </td></tr> <tr><td> 403 </td><td> User is not allowed to perform the request. </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public ApiResponse<Void> authPasswordResetGetWithHttpInfo(String username, String domain) throws ApiException { okhttp3.Call localVarCall = authPasswordResetGetValidateBeforeCall(username, domain, null); return localVarApiClient.execute(localVarCall); } /** * Reset a user password with superuser (asynchronously) * This API allows to reset the password of a user. This is possible when the request is performed with a superuser. * @param username Username associated to the account (required) * @param domain Domain associated to the account (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 204 </td><td> The request has been satisfyied. No output. </td><td> - </td></tr> <tr><td> 401 </td><td> User authentication was not effective (e.g. not provided, invalid or expired). </td><td> - </td></tr> <tr><td> 403 </td><td> User is not allowed to perform the request. </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public okhttp3.Call authPasswordResetGetAsync(String username, String domain, final ApiCallback<Void> _callback) throws ApiException { okhttp3.Call localVarCall = authPasswordResetGetValidateBeforeCall(username, domain, _callback); localVarApiClient.executeAsync(localVarCall, _callback); return localVarCall; } /** * Build call for authPasswordResetPost * @param inlineObject4 (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 204 </td><td> The request has been satisfyied. No output. </td><td> - </td></tr> <tr><td> 401 </td><td> User authentication was not effective (e.g. not provided, invalid or expired). </td><td> - </td></tr> <tr><td> 403 </td><td> User is not allowed to perform the request. </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public okhttp3.Call authPasswordResetPostCall(InlineObject4 inlineObject4, final ApiCallback _callback) throws ApiException { Object localVarPostBody = inlineObject4; // create path and map variables String localVarPath = "/auth/passwordReset"; List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "*/*" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { "application/json" }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); String[] localVarAuthNames = new String[] { "OAuth2" }; return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call authPasswordResetPostValidateBeforeCall(InlineObject4 inlineObject4, final ApiCallback _callback) throws ApiException { // verify the required parameter 'inlineObject4' is set if (inlineObject4 == null) { throw new ApiException("Missing the required parameter 'inlineObject4' when calling authPasswordResetPost(Async)"); } okhttp3.Call localVarCall = authPasswordResetPostCall(inlineObject4, _callback); return localVarCall; } /** * Reset your own password * This API allows to reset your own password knowing the previous one with a logged user. * @param inlineObject4 (required) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 204 </td><td> The request has been satisfyied. No output. </td><td> - </td></tr> <tr><td> 401 </td><td> User authentication was not effective (e.g. not provided, invalid or expired). </td><td> - </td></tr> <tr><td> 403 </td><td> User is not allowed to perform the request. </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public void authPasswordResetPost(InlineObject4 inlineObject4) throws ApiException { authPasswordResetPostWithHttpInfo(inlineObject4); } /** * Reset your own password * This API allows to reset your own password knowing the previous one with a logged user. * @param inlineObject4 (required) * @return ApiResponse&lt;Void&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 204 </td><td> The request has been satisfyied. No output. </td><td> - </td></tr> <tr><td> 401 </td><td> User authentication was not effective (e.g. not provided, invalid or expired). </td><td> - </td></tr> <tr><td> 403 </td><td> User is not allowed to perform the request. </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public ApiResponse<Void> authPasswordResetPostWithHttpInfo(InlineObject4 inlineObject4) throws ApiException { okhttp3.Call localVarCall = authPasswordResetPostValidateBeforeCall(inlineObject4, null); return localVarApiClient.execute(localVarCall); } /** * Reset your own password (asynchronously) * This API allows to reset your own password knowing the previous one with a logged user. * @param inlineObject4 (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 204 </td><td> The request has been satisfyied. No output. </td><td> - </td></tr> <tr><td> 401 </td><td> User authentication was not effective (e.g. not provided, invalid or expired). </td><td> - </td></tr> <tr><td> 403 </td><td> User is not allowed to perform the request. </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public okhttp3.Call authPasswordResetPostAsync(InlineObject4 inlineObject4, final ApiCallback<Void> _callback) throws ApiException { okhttp3.Call localVarCall = authPasswordResetPostValidateBeforeCall(inlineObject4, _callback); localVarApiClient.executeAsync(localVarCall, _callback); return localVarCall; } /** * Build call for authPasswordTokenGet * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A password token associated to the logged user. </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public okhttp3.Call authPasswordTokenGetCall(final ApiCallback _callback) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/auth/passwordToken"; List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json", "*/*" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); String[] localVarAuthNames = new String[] { "OAuth2" }; return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call authPasswordTokenGetValidateBeforeCall(final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = authPasswordTokenGetCall(_callback); return localVarCall; } /** * Get token to change password * This API allows to get a password token to use in order to change a password. * @return List&lt;Object&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A password token associated to the logged user. </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public List<Object> authPasswordTokenGet() throws ApiException { ApiResponse<List<Object>> localVarResp = authPasswordTokenGetWithHttpInfo(); return localVarResp.getData(); } /** * Get token to change password * This API allows to get a password token to use in order to change a password. * @return ApiResponse&lt;List&lt;Object&gt;&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A password token associated to the logged user. </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public ApiResponse<List<Object>> authPasswordTokenGetWithHttpInfo() throws ApiException { okhttp3.Call localVarCall = authPasswordTokenGetValidateBeforeCall(null); Type localVarReturnType = new TypeToken<List<Object>>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * Get token to change password (asynchronously) * This API allows to get a password token to use in order to change a password. * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> A password token associated to the logged user. </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public okhttp3.Call authPasswordTokenGetAsync(final ApiCallback<List<Object>> _callback) throws ApiException { okhttp3.Call localVarCall = authPasswordTokenGetValidateBeforeCall(_callback); Type localVarReturnType = new TypeToken<List<Object>>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for authSamlPost * @param domain SAML domain (required) * @param idToken1 The BASE64-encoded SAML Reply in JSON (required) * @param idToken2 The Hex-encoded HMAC-SHA256 of the decoded IDToken1 (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 303 </td><td> Redirect to frontend page with new auth token (Post/Redirect/Get design pattern). </td><td> - </td></tr> <tr><td> 409 </td><td> Cannot satisfy the request because the resource is in an illegal status. </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public okhttp3.Call authSamlPostCall(String domain, String idToken1, String idToken2, final ApiCallback _callback) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/auth/saml"; List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); if (domain != null) { localVarFormParams.put("domain", domain); } if (idToken1 != null) { localVarFormParams.put("IDToken1", idToken1); } if (idToken2 != null) { localVarFormParams.put("IDToken2", idToken2); } final String[] localVarAccepts = { "*/*" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { "application/x-www-form-urlencoded" }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); String[] localVarAuthNames = new String[] { }; return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call authSamlPostValidateBeforeCall(String domain, String idToken1, String idToken2, final ApiCallback _callback) throws ApiException { // verify the required parameter 'domain' is set if (domain == null) { throw new ApiException("Missing the required parameter 'domain' when calling authSamlPost(Async)"); } // verify the required parameter 'idToken1' is set if (idToken1 == null) { throw new ApiException("Missing the required parameter 'idToken1' when calling authSamlPost(Async)"); } // verify the required parameter 'idToken2' is set if (idToken2 == null) { throw new ApiException("Missing the required parameter 'idToken2' when calling authSamlPost(Async)"); } okhttp3.Call localVarCall = authSamlPostCall(domain, idToken1, idToken2, _callback); return localVarCall; } /** * Register or Update a SAML user * This API allows to register or Update a SAML user. * @param domain SAML domain (required) * @param idToken1 The BASE64-encoded SAML Reply in JSON (required) * @param idToken2 The Hex-encoded HMAC-SHA256 of the decoded IDToken1 (required) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 303 </td><td> Redirect to frontend page with new auth token (Post/Redirect/Get design pattern). </td><td> - </td></tr> <tr><td> 409 </td><td> Cannot satisfy the request because the resource is in an illegal status. </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public void authSamlPost(String domain, String idToken1, String idToken2) throws ApiException { authSamlPostWithHttpInfo(domain, idToken1, idToken2); } /** * Register or Update a SAML user * This API allows to register or Update a SAML user. * @param domain SAML domain (required) * @param idToken1 The BASE64-encoded SAML Reply in JSON (required) * @param idToken2 The Hex-encoded HMAC-SHA256 of the decoded IDToken1 (required) * @return ApiResponse&lt;Void&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 303 </td><td> Redirect to frontend page with new auth token (Post/Redirect/Get design pattern). </td><td> - </td></tr> <tr><td> 409 </td><td> Cannot satisfy the request because the resource is in an illegal status. </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public ApiResponse<Void> authSamlPostWithHttpInfo(String domain, String idToken1, String idToken2) throws ApiException { okhttp3.Call localVarCall = authSamlPostValidateBeforeCall(domain, idToken1, idToken2, null); return localVarApiClient.execute(localVarCall); } /** * Register or Update a SAML user (asynchronously) * This API allows to register or Update a SAML user. * @param domain SAML domain (required) * @param idToken1 The BASE64-encoded SAML Reply in JSON (required) * @param idToken2 The Hex-encoded HMAC-SHA256 of the decoded IDToken1 (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 303 </td><td> Redirect to frontend page with new auth token (Post/Redirect/Get design pattern). </td><td> - </td></tr> <tr><td> 409 </td><td> Cannot satisfy the request because the resource is in an illegal status. </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public okhttp3.Call authSamlPostAsync(String domain, String idToken1, String idToken2, final ApiCallback<Void> _callback) throws ApiException { okhttp3.Call localVarCall = authSamlPostValidateBeforeCall(domain, idToken1, idToken2, _callback); localVarApiClient.executeAsync(localVarCall, _callback); return localVarCall; } /** * Build call for authUser * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> Return current logged in user </td><td> - </td></tr> <tr><td> 401 </td><td> User authentication was not effective (e.g. not provided, invalid or expired). </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public okhttp3.Call authUserCall(final ApiCallback _callback) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/auth/user"; List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json", "*/*" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); String[] localVarAuthNames = new String[] { "OAuth2" }; return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call authUserValidateBeforeCall(final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = authUserCall(_callback); return localVarCall; } /** * Return the current logged in user * This API allows to retrieve the current logged in user. * @return User * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> Return current logged in user </td><td> - </td></tr> <tr><td> 401 </td><td> User authentication was not effective (e.g. not provided, invalid or expired). </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public User authUser() throws ApiException { ApiResponse<User> localVarResp = authUserWithHttpInfo(); return localVarResp.getData(); } /** * Return the current logged in user * This API allows to retrieve the current logged in user. * @return ApiResponse&lt;User&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> Return current logged in user </td><td> - </td></tr> <tr><td> 401 </td><td> User authentication was not effective (e.g. not provided, invalid or expired). </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public ApiResponse<User> authUserWithHttpInfo() throws ApiException { okhttp3.Call localVarCall = authUserValidateBeforeCall(null); Type localVarReturnType = new TypeToken<User>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * Return the current logged in user (asynchronously) * This API allows to retrieve the current logged in user. * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> Return current logged in user </td><td> - </td></tr> <tr><td> 401 </td><td> User authentication was not effective (e.g. not provided, invalid or expired). </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public okhttp3.Call authUserAsync(final ApiCallback<User> _callback) throws ApiException { okhttp3.Call localVarCall = authUserValidateBeforeCall(_callback); Type localVarReturnType = new TypeToken<User>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for configurationGet * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> OK </td><td> - </td></tr> </table> */ public okhttp3.Call configurationGetCall(final ApiCallback _callback) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/service/configuration"; List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); String[] localVarAuthNames = new String[] { }; return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call configurationGetValidateBeforeCall(final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = configurationGetCall(_callback); return localVarCall; } /** * Retrieve the App configuration * This API allows to get the public configuration associated to the application. * @return Map&lt;String, Object&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> OK </td><td> - </td></tr> </table> */ public Map<String, Object> configurationGet() throws ApiException { ApiResponse<Map<String, Object>> localVarResp = configurationGetWithHttpInfo(); return localVarResp.getData(); } /** * Retrieve the App configuration * This API allows to get the public configuration associated to the application. * @return ApiResponse&lt;Map&lt;String, Object&gt;&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> OK </td><td> - </td></tr> </table> */ public ApiResponse<Map<String, Object>> configurationGetWithHttpInfo() throws ApiException { okhttp3.Call localVarCall = configurationGetValidateBeforeCall(null); Type localVarReturnType = new TypeToken<Map<String, Object>>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * Retrieve the App configuration (asynchronously) * This API allows to get the public configuration associated to the application. * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> OK </td><td> - </td></tr> </table> */ public okhttp3.Call configurationGetAsync(final ApiCallback<Map<String, Object>> _callback) throws ApiException { okhttp3.Call localVarCall = configurationGetValidateBeforeCall(_callback); Type localVarReturnType = new TypeToken<Map<String, Object>>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for logoutUser * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 204 </td><td> The request has been satisfyied. No output. </td><td> - </td></tr> <tr><td> 401 </td><td> User authentication was not effective (e.g. not provided, invalid or expired). </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public okhttp3.Call logoutUserCall(final ApiCallback _callback) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/auth/logout"; List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "*/*" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); String[] localVarAuthNames = new String[] { "OAuth2" }; return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call logoutUserValidateBeforeCall(final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = logoutUserCall(_callback); return localVarCall; } /** * Log out current user terminating the session * This API allows to Log out current user. * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 204 </td><td> The request has been satisfyied. No output. </td><td> - </td></tr> <tr><td> 401 </td><td> User authentication was not effective (e.g. not provided, invalid or expired). </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public void logoutUser() throws ApiException { logoutUserWithHttpInfo(); } /** * Log out current user terminating the session * This API allows to Log out current user. * @return ApiResponse&lt;Void&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 204 </td><td> The request has been satisfyied. No output. </td><td> - </td></tr> <tr><td> 401 </td><td> User authentication was not effective (e.g. not provided, invalid or expired). </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public ApiResponse<Void> logoutUserWithHttpInfo() throws ApiException { okhttp3.Call localVarCall = logoutUserValidateBeforeCall(null); return localVarApiClient.execute(localVarCall); } /** * Log out current user terminating the session (asynchronously) * This API allows to Log out current user. * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 204 </td><td> The request has been satisfyied. No output. </td><td> - </td></tr> <tr><td> 401 </td><td> User authentication was not effective (e.g. not provided, invalid or expired). </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public okhttp3.Call logoutUserAsync(final ApiCallback<Void> _callback) throws ApiException { okhttp3.Call localVarCall = logoutUserValidateBeforeCall(_callback); localVarApiClient.executeAsync(localVarCall, _callback); return localVarCall; } /** * Build call for oauthTokenPost * @param username The username in the form _username_@_domain_ where *domain* is the organization the user belongs to (optional) * @param password This is the actual password of the user (optional) * @param grantType A parameter that indicates the type of the grant in order to perform the basic authentication (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> OAuth Access Token </td><td> - </td></tr> </table> */ public okhttp3.Call oauthTokenPostCall(String username, String password, String grantType, final ApiCallback _callback) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/oauth/token"; List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); if (username != null) { localVarFormParams.put("username", username); } if (password != null) { localVarFormParams.put("password", password); } if (grantType != null) { localVarFormParams.put("grant_type", grantType); } final String[] localVarAccepts = { "application/json" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { "multipart/form-data" }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); String[] localVarAuthNames = new String[] { "Basic" }; return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call oauthTokenPostValidateBeforeCall(String username, String password, String grantType, final ApiCallback _callback) throws ApiException { okhttp3.Call localVarCall = oauthTokenPostCall(username, password, grantType, _callback); return localVarCall; } /** * Get the bearer token * This API allows to get the token needed to access other APIs through the OAuth2 authentication. * @param username The username in the form _username_@_domain_ where *domain* is the organization the user belongs to (optional) * @param password This is the actual password of the user (optional) * @param grantType A parameter that indicates the type of the grant in order to perform the basic authentication (optional) * @return InlineResponse200 * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> OAuth Access Token </td><td> - </td></tr> </table> */ public InlineResponse200 oauthTokenPost(String username, String password, String grantType) throws ApiException { ApiResponse<InlineResponse200> localVarResp = oauthTokenPostWithHttpInfo(username, password, grantType); return localVarResp.getData(); } /** * Get the bearer token * This API allows to get the token needed to access other APIs through the OAuth2 authentication. * @param username The username in the form _username_@_domain_ where *domain* is the organization the user belongs to (optional) * @param password This is the actual password of the user (optional) * @param grantType A parameter that indicates the type of the grant in order to perform the basic authentication (optional) * @return ApiResponse&lt;InlineResponse200&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> OAuth Access Token </td><td> - </td></tr> </table> */ public ApiResponse<InlineResponse200> oauthTokenPostWithHttpInfo(String username, String password, String grantType) throws ApiException { okhttp3.Call localVarCall = oauthTokenPostValidateBeforeCall(username, password, grantType, null); Type localVarReturnType = new TypeToken<InlineResponse200>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * Get the bearer token (asynchronously) * This API allows to get the token needed to access other APIs through the OAuth2 authentication. * @param username The username in the form _username_@_domain_ where *domain* is the organization the user belongs to (optional) * @param password This is the actual password of the user (optional) * @param grantType A parameter that indicates the type of the grant in order to perform the basic authentication (optional) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> OAuth Access Token </td><td> - </td></tr> </table> */ public okhttp3.Call oauthTokenPostAsync(String username, String password, String grantType, final ApiCallback<InlineResponse200> _callback) throws ApiException { okhttp3.Call localVarCall = oauthTokenPostValidateBeforeCall(username, password, grantType, _callback); Type localVarReturnType = new TypeToken<InlineResponse200>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for pdfResourceIdThumbsGet * @param id The value of _the unique id_ (required) * @param page The page to retrieve (required) * @param width The output image width (optional) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> The output is a raw string. The thumbnails of the page requested for the PDF resource. </td><td> - </td></tr> <tr><td> 400 </td><td> Result of a client passing incorrect or invalid data. </td><td> - </td></tr> <tr><td> 401 </td><td> User authentication was not effective (e.g. not provided, invalid or expired). </td><td> - </td></tr> <tr><td> 403 </td><td> User is not allowed to perform the request. </td><td> - </td></tr> <tr><td> 404 </td><td> The resource was not found. </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public okhttp3.Call pdfResourceIdThumbsGetCall(UUID id, Integer page, Integer width, final ApiCallback _callback) throws ApiException { Object localVarPostBody = null; // create path and map variables String localVarPath = "/pdfResource/{id}/thumbs" .replaceAll("\\{" + "id" + "\\}", localVarApiClient.escapeString(id.toString())); List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); if (page != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("page", page)); } if (width != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("width", width)); } Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "image/jpeg", "*/*" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); String[] localVarAuthNames = new String[] { "OAuth2" }; return localVarApiClient.buildCall(localVarPath, "GET", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call pdfResourceIdThumbsGetValidateBeforeCall(UUID id, Integer page, Integer width, final ApiCallback _callback) throws ApiException { // verify the required parameter 'id' is set if (id == null) { throw new ApiException("Missing the required parameter 'id' when calling pdfResourceIdThumbsGet(Async)"); } // verify the required parameter 'page' is set if (page == null) { throw new ApiException("Missing the required parameter 'page' when calling pdfResourceIdThumbsGet(Async)"); } okhttp3.Call localVarCall = pdfResourceIdThumbsGetCall(id, page, width, _callback); return localVarCall; } /** * Retrieve a Resource (of service) * This API allows to extract thumbnails from a PDF Resource. * @param id The value of _the unique id_ (required) * @param page The page to retrieve (required) * @param width The output image width (optional) * @return File * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> The output is a raw string. The thumbnails of the page requested for the PDF resource. </td><td> - </td></tr> <tr><td> 400 </td><td> Result of a client passing incorrect or invalid data. </td><td> - </td></tr> <tr><td> 401 </td><td> User authentication was not effective (e.g. not provided, invalid or expired). </td><td> - </td></tr> <tr><td> 403 </td><td> User is not allowed to perform the request. </td><td> - </td></tr> <tr><td> 404 </td><td> The resource was not found. </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public File pdfResourceIdThumbsGet(UUID id, Integer page, Integer width) throws ApiException { ApiResponse<File> localVarResp = pdfResourceIdThumbsGetWithHttpInfo(id, page, width); return localVarResp.getData(); } /** * Retrieve a Resource (of service) * This API allows to extract thumbnails from a PDF Resource. * @param id The value of _the unique id_ (required) * @param page The page to retrieve (required) * @param width The output image width (optional) * @return ApiResponse&lt;File&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> The output is a raw string. The thumbnails of the page requested for the PDF resource. </td><td> - </td></tr> <tr><td> 400 </td><td> Result of a client passing incorrect or invalid data. </td><td> - </td></tr> <tr><td> 401 </td><td> User authentication was not effective (e.g. not provided, invalid or expired). </td><td> - </td></tr> <tr><td> 403 </td><td> User is not allowed to perform the request. </td><td> - </td></tr> <tr><td> 404 </td><td> The resource was not found. </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public ApiResponse<File> pdfResourceIdThumbsGetWithHttpInfo(UUID id, Integer page, Integer width) throws ApiException { okhttp3.Call localVarCall = pdfResourceIdThumbsGetValidateBeforeCall(id, page, width, null); Type localVarReturnType = new TypeToken<File>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * Retrieve a Resource (of service) (asynchronously) * This API allows to extract thumbnails from a PDF Resource. * @param id The value of _the unique id_ (required) * @param page The page to retrieve (required) * @param width The output image width (optional) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> The output is a raw string. The thumbnails of the page requested for the PDF resource. </td><td> - </td></tr> <tr><td> 400 </td><td> Result of a client passing incorrect or invalid data. </td><td> - </td></tr> <tr><td> 401 </td><td> User authentication was not effective (e.g. not provided, invalid or expired). </td><td> - </td></tr> <tr><td> 403 </td><td> User is not allowed to perform the request. </td><td> - </td></tr> <tr><td> 404 </td><td> The resource was not found. </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public okhttp3.Call pdfResourceIdThumbsGetAsync(UUID id, Integer page, Integer width, final ApiCallback<File> _callback) throws ApiException { okhttp3.Call localVarCall = pdfResourceIdThumbsGetValidateBeforeCall(id, page, width, _callback); Type localVarReturnType = new TypeToken<File>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } /** * Build call for serviceChangePasswordPost * @param username Username associated to the account (required) * @param domain Domain associated to the account (required) * @param body New password associated to the account (BCrypt) (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 204 </td><td> The request has been satisfyied. No output. </td><td> - </td></tr> <tr><td> 409 </td><td> Cannot satisfy the request because the resource is in an illegal status. </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public okhttp3.Call serviceChangePasswordPostCall(String username, String domain, String body, final ApiCallback _callback) throws ApiException { Object localVarPostBody = body; // create path and map variables String localVarPath = "/service/changePassword"; List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); if (username != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("username", username)); } if (domain != null) { localVarQueryParams.addAll(localVarApiClient.parameterToPair("domain", domain)); } Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "*/*" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { "text/plain" }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); String[] localVarAuthNames = new String[] { "OAuth2" }; return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call serviceChangePasswordPostValidateBeforeCall(String username, String domain, String body, final ApiCallback _callback) throws ApiException { // verify the required parameter 'username' is set if (username == null) { throw new ApiException("Missing the required parameter 'username' when calling serviceChangePasswordPost(Async)"); } // verify the required parameter 'domain' is set if (domain == null) { throw new ApiException("Missing the required parameter 'domain' when calling serviceChangePasswordPost(Async)"); } // verify the required parameter 'body' is set if (body == null) { throw new ApiException("Missing the required parameter 'body' when calling serviceChangePasswordPost(Async)"); } okhttp3.Call localVarCall = serviceChangePasswordPostCall(username, domain, body, _callback); return localVarCall; } /** * Change the password of a service user * This API allows to change the password of a **service user**. * @param username Username associated to the account (required) * @param domain Domain associated to the account (required) * @param body New password associated to the account (BCrypt) (required) * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 204 </td><td> The request has been satisfyied. No output. </td><td> - </td></tr> <tr><td> 409 </td><td> Cannot satisfy the request because the resource is in an illegal status. </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public void serviceChangePasswordPost(String username, String domain, String body) throws ApiException { serviceChangePasswordPostWithHttpInfo(username, domain, body); } /** * Change the password of a service user * This API allows to change the password of a **service user**. * @param username Username associated to the account (required) * @param domain Domain associated to the account (required) * @param body New password associated to the account (BCrypt) (required) * @return ApiResponse&lt;Void&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 204 </td><td> The request has been satisfyied. No output. </td><td> - </td></tr> <tr><td> 409 </td><td> Cannot satisfy the request because the resource is in an illegal status. </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public ApiResponse<Void> serviceChangePasswordPostWithHttpInfo(String username, String domain, String body) throws ApiException { okhttp3.Call localVarCall = serviceChangePasswordPostValidateBeforeCall(username, domain, body, null); return localVarApiClient.execute(localVarCall); } /** * Change the password of a service user (asynchronously) * This API allows to change the password of a **service user**. * @param username Username associated to the account (required) * @param domain Domain associated to the account (required) * @param body New password associated to the account (BCrypt) (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 204 </td><td> The request has been satisfyied. No output. </td><td> - </td></tr> <tr><td> 409 </td><td> Cannot satisfy the request because the resource is in an illegal status. </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public okhttp3.Call serviceChangePasswordPostAsync(String username, String domain, String body, final ApiCallback<Void> _callback) throws ApiException { okhttp3.Call localVarCall = serviceChangePasswordPostValidateBeforeCall(username, domain, body, _callback); localVarApiClient.executeAsync(localVarCall, _callback); return localVarCall; } /** * Build call for serviceUsersSyncPost * @param inlineObject User Accounts (required) * @param _callback Callback for upload/download progress * @return Call to execute * @throws ApiException If fail to serialize the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> Report of last sync. </td><td> - </td></tr> <tr><td> 400 </td><td> Result of a client passing incorrect or invalid data. </td><td> - </td></tr> <tr><td> 401 </td><td> User authentication was not effective (e.g. not provided, invalid or expired). </td><td> - </td></tr> <tr><td> 403 </td><td> User is not allowed to perform the request. </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public okhttp3.Call serviceUsersSyncPostCall(List<InlineObject> inlineObject, final ApiCallback _callback) throws ApiException { Object localVarPostBody = inlineObject; // create path and map variables String localVarPath = "/service/users/sync"; List<Pair> localVarQueryParams = new ArrayList<Pair>(); List<Pair> localVarCollectionQueryParams = new ArrayList<Pair>(); Map<String, String> localVarHeaderParams = new HashMap<String, String>(); Map<String, String> localVarCookieParams = new HashMap<String, String>(); Map<String, Object> localVarFormParams = new HashMap<String, Object>(); final String[] localVarAccepts = { "application/json", "*/*" }; final String localVarAccept = localVarApiClient.selectHeaderAccept(localVarAccepts); if (localVarAccept != null) { localVarHeaderParams.put("Accept", localVarAccept); } final String[] localVarContentTypes = { "application/json" }; final String localVarContentType = localVarApiClient.selectHeaderContentType(localVarContentTypes); localVarHeaderParams.put("Content-Type", localVarContentType); String[] localVarAuthNames = new String[] { "OAuth2" }; return localVarApiClient.buildCall(localVarPath, "POST", localVarQueryParams, localVarCollectionQueryParams, localVarPostBody, localVarHeaderParams, localVarCookieParams, localVarFormParams, localVarAuthNames, _callback); } @SuppressWarnings("rawtypes") private okhttp3.Call serviceUsersSyncPostValidateBeforeCall(List<InlineObject> inlineObject, final ApiCallback _callback) throws ApiException { // verify the required parameter 'inlineObject' is set if (inlineObject == null) { throw new ApiException("Missing the required parameter 'inlineObject' when calling serviceUsersSyncPost(Async)"); } okhttp3.Call localVarCall = serviceUsersSyncPostCall(inlineObject, _callback); return localVarCall; } /** * Sync user accounts * This API allows to sync user accounts. * @param inlineObject User Accounts (required) * @return UserSyncReport * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> Report of last sync. </td><td> - </td></tr> <tr><td> 400 </td><td> Result of a client passing incorrect or invalid data. </td><td> - </td></tr> <tr><td> 401 </td><td> User authentication was not effective (e.g. not provided, invalid or expired). </td><td> - </td></tr> <tr><td> 403 </td><td> User is not allowed to perform the request. </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public UserSyncReport serviceUsersSyncPost(List<InlineObject> inlineObject) throws ApiException { ApiResponse<UserSyncReport> localVarResp = serviceUsersSyncPostWithHttpInfo(inlineObject); return localVarResp.getData(); } /** * Sync user accounts * This API allows to sync user accounts. * @param inlineObject User Accounts (required) * @return ApiResponse&lt;UserSyncReport&gt; * @throws ApiException If fail to call the API, e.g. server error or cannot deserialize the response body * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> Report of last sync. </td><td> - </td></tr> <tr><td> 400 </td><td> Result of a client passing incorrect or invalid data. </td><td> - </td></tr> <tr><td> 401 </td><td> User authentication was not effective (e.g. not provided, invalid or expired). </td><td> - </td></tr> <tr><td> 403 </td><td> User is not allowed to perform the request. </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public ApiResponse<UserSyncReport> serviceUsersSyncPostWithHttpInfo(List<InlineObject> inlineObject) throws ApiException { okhttp3.Call localVarCall = serviceUsersSyncPostValidateBeforeCall(inlineObject, null); Type localVarReturnType = new TypeToken<UserSyncReport>(){}.getType(); return localVarApiClient.execute(localVarCall, localVarReturnType); } /** * Sync user accounts (asynchronously) * This API allows to sync user accounts. * @param inlineObject User Accounts (required) * @param _callback The callback to be executed when the API call finishes * @return The request call * @throws ApiException If fail to process the API call, e.g. serializing the request body object * @http.response.details <table summary="Response Details" border="1"> <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr> <tr><td> 200 </td><td> Report of last sync. </td><td> - </td></tr> <tr><td> 400 </td><td> Result of a client passing incorrect or invalid data. </td><td> - </td></tr> <tr><td> 401 </td><td> User authentication was not effective (e.g. not provided, invalid or expired). </td><td> - </td></tr> <tr><td> 403 </td><td> User is not allowed to perform the request. </td><td> - </td></tr> <tr><td> 500 </td><td> Internal failure of the service. </td><td> - </td></tr> </table> */ public okhttp3.Call serviceUsersSyncPostAsync(List<InlineObject> inlineObject, final ApiCallback<UserSyncReport> _callback) throws ApiException { okhttp3.Call localVarCall = serviceUsersSyncPostValidateBeforeCall(inlineObject, _callback); Type localVarReturnType = new TypeToken<UserSyncReport>(){}.getType(); localVarApiClient.executeAsync(localVarCall, localVarReturnType, _callback); return localVarCall; } }
[ "smartcloud@bit4id.com" ]
smartcloud@bit4id.com
af7ddc7c7353ab00ef7ed8e108165ef49400e4fb
5df9e2ad67801491a1143c04c2e479df9e23c43f
/src/main/java/com/mtea/yunwu/dao/impl/UserDaoImpl.java
03759112597c392c2101f63483f512bc97a9689c
[]
no_license
macrotea/macrotea-yunwu
592f6a7b178c99363db2bce35e35a140e2b9b50f
17a8e1710cf09830fdf0077dac41dd09083a0121
refs/heads/master
2016-09-06T09:44:51.672199
2012-12-18T03:30:52
2012-12-18T03:30:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,087
java
package com.mtea.yunwu.dao.impl; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Repository; import com.mtea.yunwu.dao.UserDao; import com.mtea.yunwu.dao.sql.WhereBuilder; import com.mtea.yunwu.model.core.User; import com.mtea.yunwu.model.ext.SqlParamBean; import com.mtea.yunwu.utils.Pager; /** * 用户数据访问实现类 * @author macrotea@qq.com * @version v1.0 * @date 2012-3-27 下午5:50:32 * @note */ @Repository public class UserDaoImpl extends BaseDaoImpl<User> implements UserDao { private Logger logger = LoggerFactory.getLogger(getClass()); /* (non-Javadoc) * @see com.mtea.yunwu.dao.UserDao#findPage(int, com.mtea.yunwu.model.core.User) */ @Override public Pager<User> findPage(int page, final User criteriaUser) { return this.findPage(page, Pager.DEFAULT_PAGE_SIZE, criteriaUser); } /* (non-Javadoc) * @see com.mtea.yunwu.dao.UserDao#findPage(int, int, com.mtea.yunwu.model.core.User) */ @Override public Pager<User> findPage(int page, int pageSize, final User criteria) { logger.debug("{}Dao - findPage() - 分页查询条件信息: {} ", getModelClass().getSimpleName(), criteria); return super.findPageTemplate(page, pageSize, new WhereBuilder() { @Override public SqlParamBean buildSqlParamBean() { if (criteria != null) { // 用户名 String username = criteria.getUsername(); if (notBlank(username)) { sqlAndLike("username"); addParamLike(username); } // 邮箱 String email = criteria.getEmail(); if (notBlank(email)) { sqlAndLike("email"); addParamLike(email); } // 是否启用 boolean isEnable = criteria.isEnable(); sqlAndEquals("enable"); addParam(isEnable ? 1 : 0); } return new SqlParamBean(sql(), getParamList()); } }); } /* * 覆盖的方法 *-------------------------------------------*/ @Override public Class<User> getModelClass() { return User.class; } }
[ "macrotea@qq.com" ]
macrotea@qq.com
fe78003f45c85ce9af2d5ab68b136fa5befb2fcd
c2755bfb0f1852c3b6df9ab0bd69654df6ec9051
/app/src/main/java/com/marvik/demo/customnotificationsounds/prefs/AppPrefsManager.java
c86ccb245c68fa69b2016feb9ac4cea7da680664
[]
no_license
victormwenda/custom-android-notification-sounds
c4d4377e7e7a059e81ae1cb8c64ba90bfb917085
97702f687780581da8064d97d15ff24c2bace615
refs/heads/master
2021-01-12T11:08:57.484738
2016-11-04T13:29:45
2016-11-04T13:29:45
72,850,465
1
0
null
null
null
null
UTF-8
Java
false
false
1,840
java
package com.marvik.demo.customnotificationsounds.prefs; import android.content.Context; import android.support.annotation.NonNull; import com.marvik.demo.customnotificationsounds.prefs.notifications.AppNotificationPreferences; import com.marvik.libs.android.preferences.PreferencesManager; /** * Project - custom-android-notification-sounds * Package - com.marvik.demo.customnotificationsounds * <p> * Victor Mwenda * +254(0)718034449 * vmwenda.vm@gmail.com * <p> * Android App Development Laptop * Created by victor on 11/4/2016 at 4:21 PM. */ public class AppPrefsManager extends PreferencesManager implements AppNotificationPreferences { public AppPrefsManager(@NonNull Context context) { super(context); } @Override public boolean shouldSendMomentsNotifications() { return read(MOMENTS_NOTIFICATIONS, Boolean.class, false); } @Override public void sendMomentsNotifications(boolean sendMomentsNotifications) { commit(MOMENTS_NOTIFICATIONS, sendMomentsNotifications); } @Override public void setMomentsNotificationSound(String mediaUri) { commit(MOMENTS_SOUND_URI, mediaUri); } @Override public String getMomentsNotificationSound() { return read(MOMENTS_SOUND_URI, String.class, null); } @Override public boolean shouldSendChatNotifications() { return read(CHAT_NOTIFICATIONS, Boolean.class, false); } @Override public void sendChatNotifications(boolean sendChatNotifications) { commit(CHAT_NOTIFICATIONS, sendChatNotifications); } @Override public void setChatNotificationSound(String mediaUri) { commit(CHAT_SOUND_URI, mediaUri); } @Override public String getChatNotificationSound() { return read(CHAT_SOUND_URI, String.class, null); } }
[ "vmwenda.vm@gmail.com" ]
vmwenda.vm@gmail.com
5d1cf94771f93adc2f4cf772dd21698f83762df9
b0c5c490fd29e0398cbda1efacd10ee129bfa8e8
/app/src/androidTest/java/com/ostopd/rangeseekbar/ApplicationTest.java
b6acf03c31076aeb43934ed1bfb9d0efdff32d80
[]
no_license
sengarmudit/RangeBAr
75337bd2b5d8672481db7c552e86f625f06a8a2c
bbaded87840cdbf0b8cf108fa4bdfa93ea150d57
refs/heads/master
2021-01-20T19:13:28.545446
2016-07-18T13:12:14
2016-07-18T13:12:14
63,604,078
0
0
null
null
null
null
UTF-8
Java
false
false
354
java
package com.ostopd.rangeseekbar; import android.app.Application; import android.test.ApplicationTestCase; /** * <a href="http://d.android.com/tools/testing/testing_android.html">Testing Fundamentals</a> */ public class ApplicationTest extends ApplicationTestCase<Application> { public ApplicationTest() { super(Application.class); } }
[ "muditsengar@shrigroup.net" ]
muditsengar@shrigroup.net
e4ea12fb0df88f8ba3346529584b7ec71ee4d9d2
098aff8e23c5c5a49e94b22163819480588ebd6d
/src/main/java/net/haesleinhuepf/clij2/AbstractCLIJ2Plugin.java
7ed27eb661984a281deaa1a8dd5cada329aab377
[ "BSD-3-Clause" ]
permissive
clij/clij2
d274f272656ba1c9182cf97a2b9296ebcd62b95c
154150e60596e76f2b0773ef84691bebf5809f24
refs/heads/master
2023-04-10T13:38:27.230429
2022-08-06T15:55:46
2022-08-06T15:55:46
190,929,227
39
11
NOASSERTION
2023-03-02T19:15:26
2019-06-08T19:54:46
Java
UTF-8
Java
false
false
872
java
package net.haesleinhuepf.clij2; import net.haesleinhuepf.clij.CLIJ; import net.haesleinhuepf.clij.macro.AbstractCLIJPlugin; public abstract class AbstractCLIJ2Plugin extends AbstractCLIJPlugin { private CLIJ2 clij2; @Override public void setClij(CLIJ clij) { if (clij2 == null || clij2.getCLIJ() != clij) { if (clij == CLIJ.getInstance()) { clij2 = CLIJ2.getInstance(); } else { System.out.println("Warning AbstractCLIJ2Plugin.setCLIJ is deprecated. Use setCLIJ2 instead."); clij2 = new CLIJ2(clij); } } super.setClij(clij); } public void setCLIJ2(CLIJ2 clij2) { this.clij2 = clij2; } public CLIJ2 getCLIJ2() { if (clij2 == null) { clij2 = CLIJ2.getInstance(); } return clij2; } }
[ "rhaase@mpi-cbg.de" ]
rhaase@mpi-cbg.de
d5327a440d7e32c4cbe5baa90b0b9c69beba39df
b6ebf62090ba3592311ca40c656d06422fb6ca19
/BinaryAdder.java
abe01b839232d26190ba187f88aa2f953825588a
[]
no_license
sakshyamdahal/problem-solving
5bb3bd78f3fe40a582c75700a9da1751c4a15bca
4747ab9d1398bdc872e2dd594ad2aadf0d1eaaa7
refs/heads/master
2020-04-07T03:46:04.173584
2017-11-29T06:08:40
2017-11-29T06:08:40
29,506,267
4
0
null
null
null
null
UTF-8
Java
false
false
805
java
/* * Problem from Introduction to Algorithms * Exercise: 2.1-4 * @author: Sakshyam Dahal */ import java.util.Arrays; public class BinaryAdder { static boolean T = true; static boolean F = false; public static int[] binaryAdd(boolean[] a, boolean[] b) { int[] c = new int[a.length + 1]; int carry = 0; for (int i = c.length -1; i >= 0; i--) { if (i == 0) c[i] = carry; else { c[i] = (boolToNum(a[i-1]) + boolToNum(b[i-1]) + carry) % 2; carry = (boolToNum(a[i-1]) + boolToNum(b[i-1]) + carry) / 2; } } return c; } public static int boolToNum(boolean a) { return a ? 0 : 1; } public static void main(String[] args) { boolean[] a = {F,T,F,T,F,T,F,T}; boolean[] b = {F,F,T,T,F,F,T,T}; System.out.println(Arrays.toString(binaryAdd(a,b))); } }
[ "dahalsakshyam@gmail.com" ]
dahalsakshyam@gmail.com
11d11be73ce74c8d6188f14131176b88c45b3cc5
29e780d14afc9cd928077bedc1cfc43f478e7a10
/src/main/java/zuoShen/class07/IPO.java
c09be1500508bc0e7b47e0e5643248916d2127b9
[]
no_license
programmerJasonBrown/JavaAlgorithm
ff060065ecfc3041914b7c1b996dcc7b5d198a0c
400de3b76e5ef6a7f53bbdb6ca13e6e22399a117
refs/heads/master
2020-03-14T23:19:08.589225
2018-08-17T03:45:09
2018-08-17T03:45:09
131,842,233
0
0
null
null
null
null
UTF-8
Java
false
false
1,667
java
package zuoShen.class07; import java.util.Comparator; import java.util.PriorityQueue; public class IPO { public static class Node { int cost; int priority; Node(int cost, int priority) { this.cost = cost; this.priority = priority; } } public static class MinCostCompartor implements Comparator<Node> { @Override public int compare(Node o1, Node o2) { return o1.cost - o2.cost; } } public static class MaxPriorityComparator implements Comparator<Node> { @Override public int compare(Node o1, Node o2) { return o2.priority - o1.priority; } } public static int findMaximizedCaptital(int k, int w, int[] profits, int[] cost) { // k:最多进行的项目数,w初始资金,一次最多执行一个项目 PriorityQueue<Node> minCostHeap = new PriorityQueue<>(new MinCostCompartor()); PriorityQueue<Node> maxPriorityHeap = new PriorityQueue<>(new MaxPriorityComparator()); // 先都加入小根堆(按cost大小排序) for (int i = 0; i < cost.length; i++) { minCostHeap.add(new Node(cost[i], profits[i])); } for (int i = 0; i < k; i++) { while (!minCostHeap.isEmpty()) { if (minCostHeap.peek().cost < w) maxPriorityHeap.add(minCostHeap.poll()); } if (!maxPriorityHeap.isEmpty()) w += maxPriorityHeap.poll().priority; else break; } return w; } public static void main(String[] args) { } }
[ "qianchao7828@126.com" ]
qianchao7828@126.com
2f92959c785debf6cce9a93c139d539fe0d6b018
1d64bf4b7cec44c8a12e4086ad2918e8df6dcc76
/SpringRelatedJars/spring-framework-2.0.5/dist/org/springframework/dao/InvalidDataAccessApiUsageException.java
f388cdf7016ee7f47569c2864f328a9141a7c5d9
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
XerO00/AllJarFiles
03472690fad55b5c2fcae530ac7de6294c54521e
d546337cfa29f4d33c3d3c5a4479a35063771612
refs/heads/master
2020-05-07T15:51:39.184855
2019-04-10T20:08:57
2019-04-10T20:08:57
180,655,268
0
0
null
null
null
null
UTF-8
Java
false
false
1,516
java
/* * Copyright 2002-2006 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.dao; /** * Exception thrown on incorrect usage of the API, such as failing to * "compile" a query object that needed compilation before execution. * * <p>This represents a problem in our Java data access framework, * not the underlying data access infrastructure. * * @author Rod Johnson */ public class InvalidDataAccessApiUsageException extends DataAccessException { /** * Constructor for InvalidDataAccessApiUsageException. * @param msg the detail message */ public InvalidDataAccessApiUsageException(String msg) { super(msg); } /** * Constructor for InvalidDataAccessApiUsageException. * @param msg the detail message * @param cause the root cause from the data access API in use */ public InvalidDataAccessApiUsageException(String msg, Throwable cause) { super(msg, cause); } }
[ "prasannadandhalkar1@gmail.com" ]
prasannadandhalkar1@gmail.com
81eab624752f90b903a10ad329c7b266037bb46f
6b78e4372505d05c121ce8d1081ba3bac912e43c
/src/main/java/timeLapse/controller/actions/tareas/ListaTareasQueSonPadreParaDesvincularTareasAction.java
53264d8ae6a70a62c06ea64d7a205bd50319d6d6
[]
no_license
robertovg/timelapse
9d6f66ddbe1d3ea6c32760473bc2579e4baeb80d
ffc8eb96308274be0360293fd26e2841b12f0675
refs/heads/master
2021-03-12T23:25:01.593934
2013-04-17T14:31:00
2013-04-17T14:31:00
9,452,050
1
0
null
null
null
null
UTF-8
Java
false
false
1,415
java
package timeLapse.controller.actions.tareas; import java.util.ArrayList; import java.util.List; import javax.annotation.Resource; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Service; import timeLapse.business.tareas.ITareaBO; import timeLapse.controller.actions.abs.UserValueAction; import timeLapse.resources.dto.TareaDTO; /** * * Action que se llama cuando se cargan los filtros de las tareas, para mostrarlas en * el select de tareas padre. Solo se utiliza para deseleccionar tareas padres, ya que es cuando * no tiene sentido todas y no asociadas * @author roberto * */ @SuppressWarnings("serial") @Service("listaTareasQueSonPadreParaDesvincularTareasAction") @Scope("request") public class ListaTareasQueSonPadreParaDesvincularTareasAction extends UserValueAction { @Resource ITareaBO neg; private String identifier; private List<TareaDTO> items; public ListaTareasQueSonPadreParaDesvincularTareasAction() { this.items = new ArrayList<TareaDTO>(); } @Override public String execute() throws Exception { identifier = "oid"; items = neg.listaTareasPadre(usuarioRegistrado.getOid(),true); return SUCCESS; } public List<TareaDTO> getItems() { return items; } /** * @return the identifier */ public String getIdentifier() { return identifier; } }
[ "robertovg24@gmail.com" ]
robertovg24@gmail.com
c2c701e4bb03db9150c6528d26c6e96c79525e22
54f352a242a8ad6ff5516703e91da61e08d9a9e6
/Source Codes/AtCoder/arc084/A/2416422.java
f6b1a78e340e02ead02a344b09e3b6515a24e325
[]
no_license
Kawser-nerd/CLCDSA
5cbd8a4c3f65173e4e8e0d7ed845574c4770c3eb
aee32551795763b54acb26856ab239370cac4e75
refs/heads/master
2022-02-09T11:08:56.588303
2022-01-26T18:53:40
2022-01-26T18:53:40
211,783,197
23
9
null
null
null
null
UTF-8
Java
false
false
7,034
java
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.ArrayList; import java.util.Collections; import java.util.List; public class Main { final int _intMax = Integer.MAX_VALUE; // =2147483647>10^9 final int _intMin = Integer.MIN_VALUE; final long _longMax = Long.MAX_VALUE; // =9223372036854775807L>10^18 final long _longMin = Long.MIN_VALUE; void solve() { List<Integer> la = new ArrayList<>(); List<Integer> lb = new ArrayList<>(); List<Integer> lc = new ArrayList<>(); int n = readNum(); int[] ia = readNums(); for (int i = 0; i < ia.length; i++) { la.add(ia[i]); } Collections.sort(la); int[] ib = readNums(); for (int i = 0; i < ib.length; i++) { lb.add(ib[i]); } Collections.sort(lb); int[] ic = readNums(); for (int i = 0; i < ic.length; i++) { lc.add(ic[i]); } Collections.sort(lc); long ans = 0; int pre = -1; long precnt = -1; for (int i = 0; i < lb.size(); i++) { int v = lb.get(i); if (pre >= 0 && pre == v) { ans += precnt; } else { long cnta = smallSearch(la, v); long cntc = bigSearch(lc, v); ans += cnta * cntc; pre = v; precnt = cnta * cntc; } } pln(ans); } int smallSearch(List<Integer> list, int v) { int l = 0; int r = list.size() - 1; while (l <= r) { int m = (l + r) / 2; int vv = list.get(m); if (v <= vv) r = m - 1; else l = m + 1; } if (l >= list.size()) l = list.size() - 1; while (l >= 0 && list.get(l) >= v) l--; return l + 1; } int bigSearch(List<Integer> list, int v) { int l = 0; int r = list.size() - 1; while (l <= r) { int m = (l + r) / 2; int vv = list.get(m); if (vv <= v - 1) l = m + 1; else r = m - 1; } if (r < 0) r = 0; while (r < list.size() && list.get(r) <= v) r++; return list.size() - r; } void solve3() { List<Integer> la = new ArrayList<>(); List<Integer> lb = new ArrayList<>(); List<Integer> lc = new ArrayList<>(); int n = readNum(); int[] ia = readNums(); for (int i = 0; i < ia.length; i++) { la.add(ia[i]); } Collections.sort(la); int[] ib = readNums(); for (int i = 0; i < ib.length; i++) { if (la.get(0) < ib[i]) lb.add(ib[i]); } Collections.sort(lb); int[] ic = readNums(); for (int i = 0; i < ic.length; i++) { if (lb.get(0) < ic[i]) lc.add(ic[i]); } Collections.sort(lc); for (int i = lb.size() - 1; i >= 0; i--) { if (lc.get(lc.size() - 1) <= lb.get(i)) lb.remove(i); else break; } for (int i = la.size() - 1; i >= 0; i--) { if (lb.get(lb.size() - 1) <= la.get(i)) la.remove(i); else break; } long ans = 0; for (int i = 0; i < la.size(); i++) { int p = la.get(i); for (int j = 0; j < lb.size(); j++) { int q = lb.get(j); if (p < q) { for (int k = 0; k < lc.size(); k++) { int r = lc.get(k); if (q < r) { ans += lc.size() - k; break; } } } } } pln(ans); } void solve2() { List<Integer> la = new ArrayList<>(); List<Integer> lb = new ArrayList<>(); List<Integer> lc = new ArrayList<>(); int n = readNum(); int[] ia = readNums(); for (int i = 0; i < ia.length; i++) { la.add(ia[i]); } Collections.sort(la); int[] ib = readNums(); for (int i = 0; i < ib.length; i++) { lb.add(ib[i]); } Collections.sort(lb); int[] ic = readNums(); for (int i = 0; i < ic.length; i++) { lc.add(ic[i]); } Collections.sort(lc); long ans = 0; for (int i = 0; i < la.size(); i++) { int p = la.get(i); for (int j = 0; j < lb.size(); j++) { int q = lb.get(j); if (p < q) { for (int k = 0; k < lc.size(); k++) { int r = lc.get(k); if (q < r) { ans += lc.size() - k; break; } } } } } pln(ans); } void solve1() { List<Integer> la = new ArrayList<>(); List<Integer> lb = new ArrayList<>(); List<Integer> lc = new ArrayList<>(); int n = readNum(); int[] ia = readNums(); for (int i = 0; i < ia.length; i++) { la.add(ia[i]); } Collections.sort(la); int[] ib = readNums(); for (int i = 0; i < ib.length; i++) { lb.add(ib[i]); } Collections.sort(lb); int[] ic = readNums(); for (int i = 0; i < ic.length; i++) { lc.add(ic[i]); } Collections.sort(lc); long ans = 0; for (int i = 0; i < la.size(); i++) { int p = la.get(i); for (int j = 0; j < lb.size(); j++) { int q = lb.get(j); if (p < q) { for (int k = 0; k < lc.size(); k++) { int r = lc.get(k); if (q < r) { ans++; } } } } } pln(ans); } // ----------------------------------------------------- // 2018/04/25 r1 // ----------------------------------------------------- int abs(int a) { return (a >= 0) ? a : -a; } long abs(long a) { return (a >= 0) ? a : -a; } int max(int a, int b) { return (a > b) ? a : b; } long max(long a, long b) { return (a > b) ? a : b; } int min(int a, int b) { return (a < b) ? a : b; } long min(long a, long b) { return (a < b) ? a : b; } int pint(String s) { return Integer.parseInt(s); } long plong(String s) { return Long.parseLong(s); } String readLine() { try { return _in.readLine(); } catch (IOException e) { throw new RuntimeException(e); } } int readNum() { String line = readLine(); return pint(line); } long readLong() { String line = readLine(); return plong(line); } String[] readFlds() { String line = readLine(); return line.split(" "); } int[] readNums() { String[] flds = readFlds(); int[] nums = new int[flds.length]; for (int i = 0; i < flds.length; i++) nums[i] = pint(flds[i]); return nums; } long[] readLongs() { String[] flds = readFlds(); long[] nums = new long[flds.length]; for (int i = 0; i < flds.length; i++) nums[i] = plong(flds[i]); return nums; } void p(char c) { _out.print(c); } void pln(char c) { _out.println(c); } void p(double d) { _out.print(d); } void pln(double d) { _out.println(d); } void p(long l) { _out.print(l); } void pln(long l) { _out.println(l); } void p(String s) { _out.print(s); } void pln(String s) { _out.println(s); } static BufferedReader _in; static PrintWriter _out; static boolean _bElapsed = false; public static void main(String[] args) { long start = System.currentTimeMillis(); _in = new BufferedReader(new InputStreamReader(System.in)); _out = new PrintWriter(System.out); new Main().solve(); _out.flush(); long end = System.currentTimeMillis(); if (_bElapsed) System.err.println((end - start) + "ms"); } }
[ "kwnafi@yahoo.com" ]
kwnafi@yahoo.com
0d584bb105837693c1228c5f0fc5ddbf9fa4fe15
39ecf3e4c1d8db9ba1880df8b3b6d55499d45faf
/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/section/main/view/tab/virtualMachine/SubTabVirtualMachineErrataView.java
984f352837801d54f022400ba99e9e23cd1879da
[ "Apache-2.0" ]
permissive
chenkaibin/ovirt-engine
78ea632bf65522307b5c7c4f1b036a73d464be5b
bb4ffa83e2117f1fb910770757aedb5816670625
refs/heads/master
2020-03-09T09:10:28.771762
2018-03-27T15:10:32
2018-04-08T18:43:34
128,706,434
1
0
Apache-2.0
2018-04-09T02:58:49
2018-04-09T02:58:49
null
UTF-8
Java
false
false
1,041
java
package org.ovirt.engine.ui.webadmin.section.main.view.tab.virtualMachine; import org.ovirt.engine.core.common.businessentities.VM; import org.ovirt.engine.ui.common.uicommon.model.DetailTabModelProvider; import org.ovirt.engine.ui.uicommonweb.models.VmErrataCountModel; import org.ovirt.engine.ui.uicommonweb.models.vms.VmListModel; import org.ovirt.engine.ui.webadmin.section.main.presenter.tab.virtualMachine.SubTabVirtualMachineErrataPresenter; import org.ovirt.engine.ui.webadmin.section.main.view.tab.AbstractSubTabErrataCountView; import com.google.inject.Inject; /** * View for the sub tab that shows errata counts for a VM selected in the main tab. */ public class SubTabVirtualMachineErrataView extends AbstractSubTabErrataCountView<VM, VmListModel<Void>, VmErrataCountModel> implements SubTabVirtualMachineErrataPresenter.ViewDef { @Inject public SubTabVirtualMachineErrataView( DetailTabModelProvider<VmListModel<Void>, VmErrataCountModel> modelProvider) { super(modelProvider); } }
[ "gerrit2@gerrit.ovirt.org" ]
gerrit2@gerrit.ovirt.org
8d5a0eb662a29d51889a4d82818a30782b835b4e
67cbc9c5125df76324d78624e2281cb1fefc8a12
/application/src/main/java/org/mifos/accounts/fees/business/FeeLevelEntity.java
57fd279ffc8ced2c2ddd77207dfd381d13485574
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
mifos/1.5.x
86e785c062cb14be4597b33d15c38670c176120e
5734370912c47973de3889db21debb3ff7f0f6db
refs/heads/master
2023-08-28T09:48:46.266018
2010-07-12T04:43:46
2010-07-12T04:43:46
2,946,757
2
2
null
null
null
null
UTF-8
Java
false
false
2,220
java
/* * Copyright (c) 2005-2010 Grameen Foundation USA * All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or * implied. See the License for the specific language governing * permissions and limitations under the License. * * See also http://www.apache.org/licenses/LICENSE-2.0.html for an * explanation of the license and how it is applied. */ package org.mifos.accounts.fees.business; import java.io.Serializable; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.Table; import org.mifos.accounts.fees.util.helpers.FeeLevel; @Entity @Table(name = "FEELEVEL") public class FeeLevelEntity implements Serializable { private Short feeLevelId; private Short levelId; private FeeBO fee; public FeeLevelEntity(FeeBO fee, FeeLevel feeLevel) { this.fee = fee; levelId = feeLevel.getValue(); } protected FeeLevelEntity() { fee = null; } @Id @GeneratedValue @Column(name = "FEELEVEL_ID", nullable = false) protected Short getFeeLevelId() { return feeLevelId; } @Column(name = "LEVEL_ID") public Short getLevelId() { return levelId; } @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @JoinColumn(name = "FEE_ID") public FeeBO getFee() { return fee; } protected void setFeeLevelId(Short feeLevelId) { this.feeLevelId = feeLevelId; } protected void setLevelId(Short levelId) { this.levelId = levelId; } protected void setFee(FeeBO fee) { this.fee = fee; } }
[ "meonkeys@a8845c50-7012-0410-95d3-8e1449b9b1e4" ]
meonkeys@a8845c50-7012-0410-95d3-8e1449b9b1e4
c71e8702cd0a2fa4910ba2a2403477a9517fa6b0
c0c40d5c5c73e70b08fe26c48a1b6f1731184b63
/android/app/src/debug/java/com/reactnativetags/ReactNativeFlipper.java
67168b2b99b24db374b530955212adc16b64f7d3
[]
no_license
nazarireza/ReactNativeAnimatedTagView
0178cf1239ba1e360ce7279e705193f261821596
fb66270bfce1572d96e06da24f2e56d9f049dd5d
refs/heads/master
2023-01-28T06:05:48.781855
2020-04-07T16:07:02
2020-04-07T16:07:02
253,845,971
0
0
null
2023-01-05T18:43:31
2020-04-07T16:08:55
JavaScript
UTF-8
Java
false
false
3,270
java
/** * Copyright (c) Facebook, Inc. and its affiliates. * * <p>This source code is licensed under the MIT license found in the LICENSE file in the root * directory of this source tree. */ package com.reactnativetags; import android.content.Context; import com.facebook.flipper.android.AndroidFlipperClient; import com.facebook.flipper.android.utils.FlipperUtils; import com.facebook.flipper.core.FlipperClient; import com.facebook.flipper.plugins.crashreporter.CrashReporterPlugin; import com.facebook.flipper.plugins.databases.DatabasesFlipperPlugin; import com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin; import com.facebook.flipper.plugins.inspector.DescriptorMapping; import com.facebook.flipper.plugins.inspector.InspectorFlipperPlugin; import com.facebook.flipper.plugins.network.FlipperOkhttpInterceptor; import com.facebook.flipper.plugins.network.NetworkFlipperPlugin; import com.facebook.flipper.plugins.react.ReactFlipperPlugin; import com.facebook.flipper.plugins.sharedpreferences.SharedPreferencesFlipperPlugin; import com.facebook.react.ReactInstanceManager; import com.facebook.react.bridge.ReactContext; import com.facebook.react.modules.network.NetworkingModule; import okhttp3.OkHttpClient; public class ReactNativeFlipper { public static void initializeFlipper(Context context, ReactInstanceManager reactInstanceManager) { if (FlipperUtils.shouldEnableFlipper(context)) { final FlipperClient client = AndroidFlipperClient.getInstance(context); client.addPlugin(new InspectorFlipperPlugin(context, DescriptorMapping.withDefaults())); client.addPlugin(new ReactFlipperPlugin()); client.addPlugin(new DatabasesFlipperPlugin(context)); client.addPlugin(new SharedPreferencesFlipperPlugin(context)); client.addPlugin(CrashReporterPlugin.getInstance()); NetworkFlipperPlugin networkFlipperPlugin = new NetworkFlipperPlugin(); NetworkingModule.setCustomClientBuilder( new NetworkingModule.CustomClientBuilder() { @Override public void apply(OkHttpClient.Builder builder) { builder.addNetworkInterceptor(new FlipperOkhttpInterceptor(networkFlipperPlugin)); } }); client.addPlugin(networkFlipperPlugin); client.start(); // Fresco Plugin needs to ensure that ImagePipelineFactory is initialized // Hence we run if after all native modules have been initialized ReactContext reactContext = reactInstanceManager.getCurrentReactContext(); if (reactContext == null) { reactInstanceManager.addReactInstanceEventListener( new ReactInstanceManager.ReactInstanceEventListener() { @Override public void onReactContextInitialized(ReactContext reactContext) { reactInstanceManager.removeReactInstanceEventListener(this); reactContext.runOnNativeModulesQueueThread( new Runnable() { @Override public void run() { client.addPlugin(new FrescoFlipperPlugin()); } }); } }); } else { client.addPlugin(new FrescoFlipperPlugin()); } } } }
[ "persian1developers@gmail.com" ]
persian1developers@gmail.com
d2fbd93a8de71d848d404abe347e8b4e7cd1bfb4
22167bc24679184d7341b298bb2cb95d148be091
/dao/src/main/java/com/alexkoveckiy/strategy/server/dao/api/BaseService.java
440e74e4ffd11eba48ba94d2af2b13e88893a14c
[]
no_license
Alexey007gold/websockets
628d0041657c7cc57d57061bf1c4f05399356860
0bd7137b0a8322183f3a78afff6dc1f341fcf7e3
refs/heads/master
2021-01-18T20:03:29.240110
2019-01-07T19:00:54
2019-01-07T19:00:54
86,930,762
0
0
null
null
null
null
UTF-8
Java
false
false
1,193
java
package com.alexkoveckiy.strategy.server.dao.api; import org.springframework.beans.factory.annotation.Autowired; /** * Created by Alexe on 08.04.2017. */ public abstract class BaseService<E extends BaseEntity, R extends BaseRepository<E>> { @Autowired protected R repository; public long count() { return repository.count(); } public E save(E entity) { return repository.save(entity); } public Iterable<E> save(Iterable<E> entities) { return repository.save(entities); } public void delete(String id) { repository.delete(id); } public void delete(E entity) { repository.delete(entity); } public void delete(Iterable<E> entities) { repository.delete(entities); } public void deleteAll() { repository.deleteAll(); } public Iterable<E> findAll() { return repository.findAll(); } public Iterable<E> findAll(Iterable<String> ids) { return repository.findAll(ids); } public E findOne(String id) { return repository.findOne(id); } public boolean exists(String id) { return repository.exists(id); } }
[ "Oleksii_Kovetskyi@epam.com" ]
Oleksii_Kovetskyi@epam.com
2d079431988b5756f799e1280d51198bd3c807dc
40cd1ee585d7110c655ea356c5d3591685f6864c
/app/src/main/java/com/example/parstagram/FeedActivity.java
b74d4648e4e2ca81117a15c12115fd2c49349105
[ "Apache-2.0" ]
permissive
bel11/Parstagram
c04649734f9d3b80f970436180068dd6b44aee0c
c142baf4a1b9e794586b46224364b50d50ba29fa
refs/heads/master
2023-06-14T23:13:26.979872
2021-07-10T03:30:39
2021-07-10T03:30:39
383,613,243
0
0
null
null
null
null
UTF-8
Java
false
false
6,117
java
package com.example.parstagram; import android.icu.text.SimpleDateFormat; import android.os.Bundle; import android.os.PersistableBundle; import android.text.format.DateUtils; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.ImageButton; import android.widget.LinearLayout; import android.widget.TextView; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import com.parse.FindCallback; import com.parse.ParseException; import com.parse.ParseQuery; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Locale; public class FeedActivity extends AppCompatActivity { private RecyclerView rvPosts; private EndlessRecyclerViewScrollListener endlessRecyclerViewScrollListener; protected List<Post> allPosts; protected PostsAdapter adapter; private SwipeRefreshLayout swipeContainer; public static final String TAG = "FeedActivity"; ImageButton btnHome; ImageButton btnNewPost; ImageButton btnProfile; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_feed); // Lookup the swipe container view swipeContainer = (SwipeRefreshLayout) findViewById(R.id.swipeContainer); // Setup refresh listener which triggers new data loading swipeContainer.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { // Your code to refresh the list here. // Make sure you call swipeContainer.setRefreshing(false) // once the network request has completed successfully. fetchTimelineAsync(0); } }); // Configure the refreshing colors swipeContainer.setColorSchemeResources(android.R.color.holo_blue_bright, android.R.color.holo_green_light, android.R.color.holo_orange_light, android.R.color.holo_red_light); btnHome = findViewById(R.id.btnHome); btnNewPost = findViewById(R.id.btnNewPost); btnProfile = findViewById(R.id.btnProfile); rvPosts = findViewById(R.id.rvPosts); allPosts = new ArrayList<>(); adapter = new PostsAdapter(this, allPosts); // set adapter and layout manager for RV rvPosts.setAdapter(adapter); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(this); rvPosts.setLayoutManager(linearLayoutManager); endlessRecyclerViewScrollListener = new EndlessRecyclerViewScrollListener(linearLayoutManager) { @Override public void onLoadMore(int page, int totalItemsCount, RecyclerView view) { Date createdAt = allPosts.get(allPosts.size()-1).getCreatedAt(); loadNextDataFromApi(createdAt); } }; rvPosts.addOnScrollListener(endlessRecyclerViewScrollListener); // query posts from Parstagram queryPosts(0); } private void loadNextDataFromApi(Date createdAt) { ParseQuery<Post> query = ParseQuery.getQuery(Post.class); // skips already loaded posts query.include(Post.KEY_USER); query.addDescendingOrder("createdAt"); query.setLimit(5); query.whereLessThan("createdAt", createdAt); query.findInBackground(new FindCallback<Post>() { @Override public void done(List<Post> posts, ParseException e) { if (e != null) { Log.e(TAG, "issue with getting posts", e); return; } // to debug - print every post description for (Post post : posts) { Log.i(TAG, "Posts: " + post.getDescription() + ", username " + post.getUser()); } // save received posts to allPosts and notify adapter of new data allPosts.addAll(posts); adapter.notifyDataSetChanged(); // endlessRecyclerViewScrollListener.resetState(); } }); } private void fetchTimelineAsync(int page) { // Send the network request to fetch the updated data // `client` here is an instance of Android Async HTTP // getHomeTimeline is an example endpoint. // Remember to CLEAR OUT old items before appending in the new ones adapter.clear(); // adapter.addAll(allPosts); // ...the data has come back, add new items to your adapter... queryPosts(page); // Now we call setRefreshing(false) to signal refresh has finished swipeContainer.setRefreshing(false); } private void queryPosts(int page) { // specify we want to query Post.class ParseQuery<Post> query = ParseQuery.getQuery(Post.class); // include data referred by userkey query.include(Post.KEY_USER); // limit num posts to latest 20 query.setLimit(5); // order by newest first query.addDescendingOrder("createdAt"); // start async call for posts query.findInBackground(new FindCallback<Post>() { @Override public void done(List<Post> posts, ParseException e) { if (e != null) { Log.e(TAG, "issue with getting posts", e); return; } // to debug - print every post description for (Post post : posts) { Log.i(TAG, "Posts: " + post.getDescription() + ", username " + post.getUser()); } // save received posts to allPosts and notify adapter of new data allPosts.addAll(posts); adapter.notifyDataSetChanged(); } }); } }
[ "belindax@fb.com" ]
belindax@fb.com
4ea2ea5bab0feda3aba9f67b35e3b8dfc5cf6fca
83287d689d207062df8824895ea3180ec96f1a8d
/src/CustomerDatabaseJava/CustomerDatabase.java
8b50dd44ec429317ff94c4b04e02ede4df40458c
[ "MIT" ]
permissive
ekharlamov/rest-api-tutorial
2c633727b2d25e3bf7071e7b221afd6fa34a6fec
5b8a732b1c1290af32cb2f0c774af192f7f1e848
refs/heads/master
2020-12-25T21:12:43.596763
2015-10-02T22:10:49
2015-10-02T22:10:49
43,309,709
1
0
null
2015-09-29T16:01:09
2015-09-28T15:34:52
Java
UTF-8
Java
false
false
4,068
java
import java.util.ArrayList; import java.util.List; import com.ibm.broker.plugin.MbElement; import com.ibm.broker.plugin.MbException; import com.ibm.broker.plugin.MbJSON; import com.ibm.broker.plugin.MbMessage; public abstract class CustomerDatabase { private static List<Customer> customers = new ArrayList<>(); static { customers.add(new Customer("Denis", "Darner", "1 The Street, The Town")); customers.add(new Customer("Elana", "Ericson", "2 The Street, The Town")); customers.add(new Customer("Lyle", "Longino", "3 The Street, The Town")); customers.add(new Customer("Gerri", "Gaertner", "4 The Street, The Town")); customers.add(new Customer("Willis", "Wicks", "5 The Street, The Town")); customers.add(new Customer("Jessika", "Jeon", "6 The Street, The Town")); customers.add(new Customer("Neil", "Newton", "7 The Street, The Town")); customers.add(new Customer("Ferne", "Foye", "8 The Street, The Town")); } public static void getAllCustomers(Long max, MbElement[] output) { try { MbElement root = output[0]; long counter = 0; for (Customer customer : customers) { if (max > -1 && counter >= max) { break; } MbElement item = root.createElementAsLastChild(MbJSON.OBJECT, MbJSON.ARRAY_ITEM_NAME, null); item.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "id", customer.getID()); item.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "firstname", customer.getFirstName()); item.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "lastname", customer.getLastName()); item.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "address", customer.getAddress()); counter++; } } catch (MbException e) { throw new RuntimeException(e); } } public static MbElement getCustomer(int id) throws MbException { for (Customer customer : customers) { if (customer.getID() == id) { MbMessage message = new MbMessage(); MbElement result = message.getRootElement().createElementAsLastChild(MbJSON.OBJECT, MbJSON.DATA_ELEMENT_NAME, null); result.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "id", customer.getID()); result.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "firstname", customer.getFirstName()); result.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "lastname", customer.getLastName()); result.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "address", customer.getAddress()); return result; } } return null; } public static boolean deleteCustomer(int id) { for (Customer customer : customers) { if (customer.getID() == id) { customers.remove(customer); return true; } } return false; } public static boolean customerExists(int id) { for (Customer customer : customers) { if (customer.getID() == id) { return true; } } return false; } public static MbElement addCustomer(String firstname, String lastname, String address) throws MbException { Customer customer = new Customer(firstname, lastname, address); customers.add(customer); MbMessage message = new MbMessage(); MbElement result = message.getRootElement().createElementAsLastChild(MbJSON.OBJECT, MbJSON.DATA_ELEMENT_NAME, null); result.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "message", "A new customer with ID '" + customer.getID() + "' was successfully added to the database."); return result; } public static MbElement updateCustomer(int id, String firstname, String lastname, String address) throws MbException { for (Customer customer : customers) { if (customer.getID() == id) { customer.setFirstName(firstname); customer.setLastName(lastname); customer.setAddress(address); MbMessage message = new MbMessage(); MbElement result = message.getRootElement().createElementAsLastChild(MbJSON.OBJECT, MbJSON.DATA_ELEMENT_NAME, null); result.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "message", "An existing customer with ID '" + customer.getID() + "' was successfully updated in the database."); return result; } } return null; } }
[ "kharlamov.eugene@gmail.com" ]
kharlamov.eugene@gmail.com
f259738098fe3ba9a59a223396008bb3f2c013f3
17dbbbdc6bd3fe56a466d97f674b735720da60a5
/chrome/android/features/tab_ui/java/src/org/chromium/chrome/browser/tasks/tab_management/TabGroupUiCoordinator.java
6e6e44d39a151be96211630f44eeb63bb6a6857d
[ "BSD-3-Clause" ]
permissive
aileolin1981/chromium
3df50a9833967cf68e9809017deb9f0c79722687
876a076ba4c2fac9d01814e21e6b5bcb7ec78ad3
refs/heads/master
2022-12-21T09:32:02.120314
2019-03-21T02:41:19
2019-03-21T02:41:19
173,888,576
0
1
null
2019-03-05T06:31:00
2019-03-05T06:31:00
null
UTF-8
Java
false
false
4,179
java
// Copyright 2019 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. package org.chromium.chrome.browser.tasks.tab_management; import android.content.Context; import android.view.ViewGroup; import org.chromium.chrome.browser.ChromeActivity; import org.chromium.chrome.browser.ChromeTabbedActivity; import org.chromium.chrome.browser.ThemeColorProvider; import org.chromium.chrome.browser.compositor.layouts.content.TabContentManager; import org.chromium.chrome.browser.lifecycle.Destroyable; import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tabmodel.TabModelSelector; import org.chromium.chrome.browser.toolbar.bottom.BottomControlsCoordinator; import org.chromium.ui.modelutil.PropertyModel; import java.util.List; /** * A coordinator for TabGroupUi component. Manages the communication with * {@link TabListCoordinator}, {@link TabGridSheetCoordinator}, and * {@link TabStripToolbarCoordinator}, as well as the life-cycle of shared component objects. */ public class TabGroupUiCoordinator implements Destroyable, TabGroupUiMediator.ResetHandler, TabGroupUi { public final static String COMPONENT_NAME = "TabStrip"; private final Context mContext; private final PropertyModel mTabStripToolbarModel; private final ThemeColorProvider mThemeColorProvider; private TabGridSheetCoordinator mTabGridSheetCoordinator; private TabListCoordinator mTabStripCoordinator; private TabGroupUiMediator mMediator; private TabStripToolbarCoordinator mTabStripToolbarCoordinator; /** * Creates a new {@link TabGroupUiCoordinator} */ public TabGroupUiCoordinator(ViewGroup parentView, ThemeColorProvider themeColorProvider) { mContext = parentView.getContext(); mThemeColorProvider = themeColorProvider; mTabStripToolbarModel = new PropertyModel(TabStripToolbarViewProperties.ALL_KEYS); mTabStripToolbarCoordinator = new TabStripToolbarCoordinator(mContext, parentView, mTabStripToolbarModel); } /** * Handle any initialization that occurs once native has been loaded. */ @Override public void initializeWithNative(ChromeActivity activity, BottomControlsCoordinator.BottomControlsVisibilityController visibilityController) { assert activity instanceof ChromeTabbedActivity; TabModelSelector tabModelSelector = activity.getTabModelSelector(); TabContentManager tabContentManager = activity.getTabContentManager(); mTabStripCoordinator = new TabListCoordinator(TabListCoordinator.TabListMode.STRIP, mContext, tabModelSelector, tabContentManager, mTabStripToolbarCoordinator.getTabListContainerView(), true, COMPONENT_NAME); mTabGridSheetCoordinator = new TabGridSheetCoordinator(mContext, activity.getBottomSheetController(), tabModelSelector, tabContentManager, activity, mThemeColorProvider); mMediator = new TabGroupUiMediator(visibilityController, this, mTabStripToolbarModel, tabModelSelector, activity, ((ChromeTabbedActivity) activity).getOverviewModeBehavior(), mThemeColorProvider); } /** * Handles a reset event originated from {@link TabGroupUiMediator} * when the bottom sheet is collapsed. * * @param tabs List of Tabs to reset. */ @Override public void resetStripWithListOfTabs(List<Tab> tabs) { mTabStripCoordinator.resetWithListOfTabs(tabs); } /** * Handles a reset event originated from {@link TabGroupUiMediator} * when the bottom sheet is expanded. * * @param tabs List of Tabs to reset. */ @Override public void resetSheetWithListOfTabs(List<Tab> tabs) { mTabGridSheetCoordinator.resetWithListOfTabs(tabs); } /** * Destroy any members that needs clean up. */ @Override public void destroy() { mTabStripCoordinator.destroy(); mTabGridSheetCoordinator.destroy(); mMediator.destroy(); } }
[ "commit-bot@chromium.org" ]
commit-bot@chromium.org
71137b4d04a14ab6916c5c783bfc5779d0407f3d
d9d3042e1e7fc3f199f9b312b002534cd03f1ec2
/src/main/java/com/coursework/jobseeker/controllers/HomeController.java
cfa835d854e62c04968a045e65f5e8474f97754e
[]
no_license
lyuk777/coursework
2fc3ab08dbee0a86a00a6a75b9138dcb37290b71
eb2a618a6caf75b98d6aa35b0d444d1b209c4f71
refs/heads/main
2023-03-24T12:28:37.343159
2021-03-07T10:49:05
2021-03-07T10:49:05
345,309,804
0
0
null
null
null
null
UTF-8
Java
false
false
762
java
package com.coursework.jobseeker.controllers; import com.coursework.jobseeker.model.User; import org.springframework.security.core.annotation.AuthenticationPrincipal; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.GetMapping; @Controller public class HomeController { @GetMapping("/") public String home(@AuthenticationPrincipal User user, Model model) { if (user != null) { return "redirect:/home"; } return "home"; } // отображение стартовой страницы @GetMapping("/home") public String mainPage(@AuthenticationPrincipal User user, Model model) { return "main"; } }
[ "egor0806@mail.ru" ]
egor0806@mail.ru
61aa6b5c0690b2445d3bea103d95f77bffcc7547
0981839c418f2621f38b5427b4abdf338557e127
/src/main/java/org/reactome/web/test/WidgetTest.java
87ec1d52f948a38c003cff2998b6b8bcddeeddea
[]
no_license
reactome-idg/idg-diagram
ac51b44e566a8b5ffb265302519f3800115d48d2
1e62aba36d5418970da1a6913ff36827a61259af
refs/heads/master
2021-08-16T13:10:58.370372
2021-06-02T16:39:05
2021-06-02T16:39:05
206,657,018
1
0
null
2020-10-13T15:50:45
2019-09-05T21:03:23
JavaScript
UTF-8
Java
false
false
22,468
java
package org.reactome.web.test; import org.reactome.web.analysis.client.filter.ResultFilter; import org.reactome.web.diagram.client.DiagramFactory; import org.reactome.web.diagram.client.DiagramViewer; import org.reactome.web.diagram.events.ContentLoadedEvent; import org.reactome.web.diagram.handlers.ContentLoadedHandler; import org.reactome.web.diagram.util.Console; import org.reactome.web.fi.client.IdgDiagramViewerImpl; import com.google.gwt.core.client.EntryPoint; import com.google.gwt.core.client.Scheduler; import com.google.gwt.dom.client.Document; import com.google.gwt.dom.client.Element; import com.google.gwt.dom.client.Style; import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.event.dom.client.MouseOutEvent; import com.google.gwt.event.dom.client.MouseOutHandler; import com.google.gwt.event.dom.client.MouseOverEvent; import com.google.gwt.event.dom.client.MouseOverHandler; import com.google.gwt.user.client.Timer; import com.google.gwt.user.client.ui.Button; import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.HTMLPanel; import com.google.gwt.user.client.ui.InlineLabel; import com.google.gwt.user.client.ui.Label; import com.google.gwt.user.client.ui.RootLayoutPanel; import com.google.gwt.user.client.ui.SimpleLayoutPanel; import com.google.gwt.user.client.ui.SplitLayoutPanel; import com.google.gwt.user.client.ui.TextBox; import com.google.gwt.user.client.ui.Widget; /** * * @author EBI Group * */ public class WidgetTest implements EntryPoint{ private final DiagramViewer diagram; private static String currentPathway = "R-HSA-400253";//"R-HSA-6798695"; // private static String currentPathway = "R-HSA-5693567"; //Big one with plenty of overlap private static String currentAnalysis = "MjAxNjA5MzAwNTU3MjdfMg%3D%3D"; private TextBox pathwayTB; private TextBox analysisTokenTB; private static ResultFilter filterTotal = new ResultFilter("TOTAL", null, true, null, null, null ); private static ResultFilter filter = new ResultFilter("TOTAL", null, true, 1, 10, null ); public WidgetTest() { // DiagramFactory.SERVER = "fakeserver.com"; DiagramFactory.CONSOLE_VERBOSE = true; DiagramFactory.EVENT_BUS_VERBOSE = true; // DiagramFactory.SHOW_INFO = true; diagram = new IdgDiagramViewerImpl(); } @Override public void onModuleLoad() { Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() { @Override public void execute() { initialise(); // For normal testing // initialiseInScrollablePage(); // For testing in a long page Console.info(""); Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() { @Override public void execute() { diagram.loadDiagram(currentPathway); if (pathwayTB!=null) { pathwayTB.setValue(currentPathway); } } }); diagram.addDiagramLoadedHandler(new ContentLoadedHandler() { @Override public void onContentLoaded(ContentLoadedEvent event) { diagram.selectItem("8951430"); // diagram.flagItems("R-HSA-179837", true); } }); } }); } public void initialise() { SplitLayoutPanel slp = new SplitLayoutPanel(10); slp.addEast(getDemoLeftPanel(), 83); slp.addNorth(getDemoTopPanel(), 25); // slp.addNorth(getDiseasePanel(), 50); slp.add(diagram); RootLayoutPanel.get().add(slp); } private void initialiseInScrollablePage() { SimpleLayoutPanel diagramContainer = new SimpleLayoutPanel(); diagramContainer.getElement().getStyle().setHeight(500, Style.Unit.PX); diagramContainer.getElement().getStyle().setWidth(700, Style.Unit.PX); diagramContainer.getElement().getStyle().setBackgroundColor("white"); diagramContainer.add(diagram); final Element element = Document.get().getElementById("container"); HTMLPanel container = HTMLPanel.wrap(element); container.add(diagramContainer); } Button getSelectionButton(final String stId, String title){ Button button = new Button(stId, new ClickHandler() { @Override public void onClick(ClickEvent event) { diagram.selectItem(stId); } }); button.addMouseOverHandler(new MouseOverHandler() { @Override public void onMouseOver(MouseOverEvent event) { diagram.highlightItem(stId); } }); button.addMouseOutHandler(new MouseOutHandler() { @Override public void onMouseOut(MouseOutEvent event) { diagram.resetHighlight(); } }); button.setTitle(title); return button; } private Widget getDemoLeftPanel(){ FlowPanel fp = new FlowPanel(); fp.add(new Label("R-HSA-1181150")); fp.add(new Label("Reactions")); fp.add(getSelectionButton("R-HSA-75153", "Cleavage of NODAL proprotein")); fp.add(getSelectionButton("R-HSA-5357769", "Phospho R-SMAD(SMAD2/3):CO-SMAD(SMAD4):FOXO3 binds FoxO3a-binding elements")); fp.add(new Label("--")); fp.add(new Label("Sets")); fp.add(getSelectionButton("R-HSA-171172", "SMAD2/3 [cytosol]")); fp.add(getSelectionButton("R-HSA-171182", "p-2S-SMAD2/3 [cytosol]")); fp.add(new Label("--")); fp.add(new Label("Complexes")); fp.add(getSelectionButton("R-HSA-1225883", "NODAL:p-ACVR1B:ACVR2:EGF-CFC [plasma membrane]")); fp.add(getSelectionButton("R-HSA-173511", "p-2S-SMAD2/3:SMAD4 [nucleoplasm]")); fp.add(new Label("--")); fp.add(new Label("Protein")); fp.add(getSelectionButton("R-HSA-1181114", "NODAL(27-347) [extracellular region]")); fp.add(getSelectionButton("R-HSA-1225914", "FOXH1 [nucleoplasm]")); fp.add(getSelectionButton("R-HSA-1181326", "LEFTY1")); fp.add(new Label("--")); fp.add(new Label("Chemical")); fp.add(getSelectionButton("R-ALL-113592", "ATP [cytosol]")); fp.add(getSelectionButton("R-ALL-29370", "ADP [cytosol]")); fp.add(new Label("")); fp.add(new Label("")); fp.add(new Label("--")); fp.add(new Label("ORA")); fp.add(new Button("ORA 1", new ClickHandler() { @Override public void onClick(ClickEvent event) { // No interactors: MjAxNzAxMzEwNTEyMDJfMg== // Interactors: MjAxNzAyMDcwOTMwMDVfMw== diagram.setAnalysisToken("MjAxOTAzMjcxMDMxNTZfOA%253D%253D", filterTotal); } })); fp.add(new Button("ORA 2", new ClickHandler() { @Override public void onClick(ClickEvent event) { // No interactors: MjAxNzAxMzEwNTEyMDJfMg== // Interactors: MjAxNzAyMDcwOTMwMDVfMw== diagram.setAnalysisToken("MjAxOTAzMjcxMDMxNTZfOA%253D%253D", filter); } })); fp.add(new Label("")); fp.add(new Label("")); fp.add(new Label("--")); fp.add(new Label("Expression")); fp.add(new Button("Exp 1", new ClickHandler() { @Override public void onClick(ClickEvent event) { diagram.setAnalysisToken("MjAxOTA0MDExMjUxMzhfMTI%253D", filterTotal); } })); fp.add(new Button("Exp 2", new ClickHandler() { @Override public void onClick(ClickEvent event) { diagram.setAnalysisToken("MjAxOTA0MDExMjUxMzhfMTI%253D", filter); } })); fp.add(getSelectionButton("R-HSA-111465", "")); return fp; } Button getLoadButton(final String stId, String title){ Button button; button = new Button(stId, new ClickHandler() { @Override public void onClick(ClickEvent event) { currentPathway = stId; diagram.loadDiagram(currentPathway); pathwayTB.setValue(currentPathway); } }); button.setTitle(title); return button; } private Widget getDemoTopPanel(){ FlowPanel fp = new FlowPanel(); fp.add(getPathwaySelectionPanel()); fp.add(getAnalysisSelectionPanel()); fp.add(getLoadButton("R-HSA-1181150", "")); fp.add(getLoadButton("R-HSA-2990846", "")); fp.add(getLoadButton("R-HSA-163841", "")); fp.add(getLoadButton("R-HSA-75153", "")); fp.add(getLoadButton("R-HSA-71291", "")); fp.add(new InlineLabel(" ")); fp.add(getLoadButton("R-HSA-162909", "")); fp.add(new InlineLabel(" ")); fp.add(getLoadButton("R-HSA-170834", "")); fp.add(getLoadButton("R-HSA-3642279", "")); fp.add(getLoadButton("R-HSA-3645790", "")); fp.add(new InlineLabel(" ")); fp.add(getLoadButton("R-HSA-109581", "Apoptosis")); fp.add(getLoadButton("R-HSA-109582", "Hemostasis")); fp.add(new InlineLabel(" ")); fp.add(getLoadButton("R-HSA-5637815", "Signaling by Ligand-Responsive EGFR Variants in Cancer")); fp.add(getLoadButton("R-HSA-2219530", "Constitutive Signaling by Aberrant PI3K in Cancer")); // fp.add(getLoadButton("R-HSA-5362768", "")); fp.add(getLoadButton("R-HSA-5579009", "")); fp.add(getLoadButton("R-HSA-975871", "")); fp.add(getLoadButton("R-HSA-5210891", "")); fp.add(getLoadButton("R-HSA-5467345", "")); fp.add(getLoadButton("R-HSA-166658", "")); fp.add(getLoadButton("R-HSA-391160", "")); fp.add(getLoadButton("R-HSA-5693567", "")); fp.add(getLoadButton("R-HSA-5205647", "")); fp.add(getLoadButton("R-PFA-75153", "")); return fp; } private Widget getPathwaySelectionPanel() { FlowPanel fp = new FlowPanel(); pathwayTB = new TextBox(); fp.add(new InlineLabel("Enter a pathway: ")); fp.add(pathwayTB); fp.add(new Button("GO", new ClickHandler() { @Override public void onClick(ClickEvent event) { currentPathway = pathwayTB.getValue(); diagram.loadDiagram(currentPathway); } })); return fp; } private Widget getAnalysisSelectionPanel() { FlowPanel fp = new FlowPanel(); analysisTokenTB = new TextBox(); analysisTokenTB.setValue(currentAnalysis); analysisTokenTB.setWidth("200px"); fp.add(new InlineLabel(" Overlay analysis token: ")); fp.add(analysisTokenTB); fp.add(new Button("GO", new ClickHandler() { @Override public void onClick(ClickEvent event) { currentAnalysis = analysisTokenTB.getValue(); diagram.setAnalysisToken(currentAnalysis, filterTotal); } })); return fp; } private Widget getTestPanel() { FlowPanel fp = new FlowPanel(); fp.add(new Button("R-HSA-1181150", new ClickHandler() { @Override public void onClick(ClickEvent event) { diagram.loadDiagram("R-HSA-1181150"); } })); fp.add(new Button("Apoptosis", new ClickHandler() { @Override public void onClick(ClickEvent event) { diagram.loadDiagram("R-HSA-109581"); } })); fp.add(new Button("R-HSA-71291", new ClickHandler() { @Override public void onClick(ClickEvent event) { diagram.loadDiagram("R-HSA-71291"); } })); fp.add(new Button("Raf/Map", new ClickHandler() { @Override public void onClick(ClickEvent event) { diagram.loadDiagram("R-HSA-5673001"); } })); fp.add(new Button("R-HSA-5637815", new ClickHandler() { @Override public void onClick(ClickEvent event) { diagram.loadDiagram("R-HSA-5637815"); } })); fp.add(new Button("R-HSA-2219530", new ClickHandler() { @Override public void onClick(ClickEvent event) { diagram.loadDiagram("R-HSA-2219530"); } })); fp.add(new Button("R-HSA-1650814", new ClickHandler() { @Override public void onClick(ClickEvent event) { diagram.loadDiagram("R-HSA-1650814"); } })); fp.add(new Button("R-HSA-170834", new ClickHandler() { @Override public void onClick(ClickEvent event) { diagram.loadDiagram("R-HSA-170834"); } })); fp.add(new Button("R-HSA-400253", new ClickHandler() { @Override public void onClick(ClickEvent event) { diagram.loadDiagram("R-HSA-400253"); } })); fp.add(new Button("R-HSA-157579", new ClickHandler() { @Override public void onClick(ClickEvent event) { diagram.loadDiagram("R-HSA-157579"); } })); fp.add(new Button("R-HSA-1474244", new ClickHandler() { @Override public void onClick(ClickEvent event) { diagram.loadDiagram("R-HSA-1474244"); } })); fp.add(new InlineLabel(" ")); fp.add(new Button("R-HSA-162909", new ClickHandler() { @Override public void onClick(ClickEvent event) { diagram.loadDiagram("R-HSA-162909"); } })); fp.add(new Button("R-HSA-5603041", new ClickHandler() { @Override public void onClick(ClickEvent event) { diagram.loadDiagram("R-HSA-5603041"); } })); fp.add(new Button("R-HSA-3642279", new ClickHandler() { @Override public void onClick(ClickEvent event) { diagram.loadDiagram("R-HSA-3642279"); } })); fp.add(new Button("R-HSA-3645790", new ClickHandler() { @Override public void onClick(ClickEvent event) { diagram.loadDiagram("R-HSA-3645790"); } })); fp.add(new Button("R-HSA-73885", new ClickHandler() { @Override public void onClick(ClickEvent event) { diagram.loadDiagram("R-HSA-73885"); } })); fp.add(new Button("R-HSA-1169408", new ClickHandler() { @Override public void onClick(ClickEvent event) { diagram.loadDiagram("R-HSA-1169408"); } })); return fp; } private Widget getDiseasePanel() { FlowPanel fp = new FlowPanel(); fp.add(getLoadButton("R-HSA-2219530", "Constitutive Signaling by Aberrant PI3K in Cancer")); fp.add(getLoadButton("R-HSA-2206296", "")); fp.add(getLoadButton("R-HSA-2206292", "")); fp.add(getLoadButton("R-HSA-2206308", "")); fp.add(getLoadButton("R-HSA-2206302", "")); fp.add(getLoadButton("R-HSA-2206291", "")); fp.add(getLoadButton("R-HSA-2474795", "")); fp.add(getLoadButton("R-HSA-2644602", "")); fp.add(getLoadButton("R-HSA-3311021", "")); fp.add(getLoadButton("R-HSA-3315487", "")); fp.add(getLoadButton("R-HSA-3371599", "")); fp.add(getLoadButton("R-HSA-5362768", "")); fp.add(getLoadButton("R-HSA-5340573", "")); fp.add(getLoadButton("R-HSA-5467340", "")); fp.add(getLoadButton("R-HSA-5545619", "")); fp.add(getLoadButton("R-HSA-3785653", "")); fp.add(getLoadButton("R-HSA-3656237", "")); fp.add(getLoadButton("R-HSA-4724289", "")); fp.add(getLoadButton("R-HSA-4793954", "")); fp.add(getLoadButton("R-HSA-5637815", "Signaling by Ligand-Responsive EGFR Variants in Cancer")); fp.add(getLoadButton("R-HSA-3595177", "")); fp.add(getLoadButton("R-HSA-4551295", "")); fp.add(getLoadButton("R-HSA-5578996", "")); fp.add(getLoadButton("R-HSA-4570571", "")); fp.add(getLoadButton("R-HSA-4687000", "")); fp.add(getLoadButton("R-HSA-5633231", "")); fp.add(getLoadButton("R-HSA-5579009", "")); fp.add(getLoadButton("R-HSA-4793950", "")); fp.add(getLoadButton("R-HSA-4549356", "")); fp.add(getLoadButton("R-HSA-5657560", "")); fp.add(getLoadButton("R-HSA-5655302", "")); fp.add(getLoadButton("R-HSA-5603027", "")); fp.add(getLoadButton("R-HSA-5602498", "")); fp.add(getLoadButton("R-HSA-5603029", "")); fp.add(getLoadButton("R-HSA-5602566", "")); fp.add(getLoadButton("R-HSA-5655253", "")); fp.add(getLoadButton("R-HSA-5602410", "")); fp.add(getLoadButton("R-HSA-162909", "")); fp.add(getLoadButton("R-HSA-977225", "")); return fp; } private Widget getTourPanel(){ FlowPanel fp = new FlowPanel(); fp.add(new Button("R_111057", new ClickHandler() { @Override public void onClick(ClickEvent event) { R_HSA_1181150_tour(); } })); fp.add(new Button("R_13", new ClickHandler() { @Override public void onClick(ClickEvent event) { R_HSA_71921_tour(); } })); fp.add(new Button("A Test 1", new ClickHandler() { @Override public void onClick(ClickEvent event) { diagram.setAnalysisToken("MjAxNTA1MjgwNTQyNTNfODgz", filterTotal); } })); fp.add(new Button("A Test 2", new ClickHandler() { @Override public void onClick(ClickEvent event) { diagram.setAnalysisToken("MjAxNTA1MjgwODM1NTRfOTE3", filterTotal); } })); fp.add(new Button("A Test 3", new ClickHandler() { @Override public void onClick(ClickEvent event) { diagram.setAnalysisToken("MjAxNTA2MDEwOTU4MzdfNTQ0", filterTotal); } })); fp.add(new Button("A Test 4", new ClickHandler() { @Override public void onClick(ClickEvent event) { diagram.setAnalysisToken("MjAxNTA2MDUwMzM5MzhfOA==", filterTotal); } })); fp.add(new Button("A Test 5", new ClickHandler() { @Override public void onClick(ClickEvent event) { diagram.setAnalysisToken("MjAxNTA2MDgxMzUxNTZfMzQ2", filterTotal); } })); fp.add(new Button("A Test 6", new ClickHandler() { @Override public void onClick(ClickEvent event) { diagram.setAnalysisToken("MjAxNTA2MDgxNDA2MjNfMzQ4", filterTotal); } })); fp.add(new Button("A Test 7", new ClickHandler() { @Override public void onClick(ClickEvent event) { diagram.setAnalysisToken("MjAxNTA2MTExMjUyNTBfMTA5OQ==", filterTotal); } })); fp.add(new Button("A Test 8", new ClickHandler() { @Override public void onClick(ClickEvent event) { diagram.setAnalysisToken("MjAxNTA2MTExMzM3MDFfMTEzMw==", filterTotal); } })); fp.add(new Button("A Test 9", new ClickHandler() { @Override public void onClick(ClickEvent event) { diagram.setAnalysisToken("MjAxNTA2MTExNDA2MDVfMTE0Mg==", filterTotal); } })); fp.add(new Button("Exp 1", new ClickHandler() { @Override public void onClick(ClickEvent event) { diagram.setAnalysisToken("MjAxNjAxMDQwOTM5NDBfMg==", filterTotal); } })); fp.add(new Button("Exp 2", new ClickHandler() { @Override public void onClick(ClickEvent event) { diagram.setAnalysisToken("MjAxNTA2MDUwNzI1NTZfMzI=", filterTotal); } })); fp.add(new Button("Exp 3", new ClickHandler() { @Override public void onClick(ClickEvent event) { diagram.setAnalysisToken("MjAxNTA2MTAxNDQ4MTJfNzk4", filterTotal); } })); return fp; } private void R_HSA_1181150_tour(){ diagram.selectItem(1181156L); (new Timer() { @Override public void run() { diagram.selectItem(1181355L); } }).schedule(4000); (new Timer() { @Override public void run() { diagram.selectItem(1225914L); } }).schedule(8000); (new Timer() { @Override public void run() { diagram.selectItem(1181156L); } }).schedule(12000); (new Timer() { @Override public void run() { diagram.selectItem(173511L); } }).schedule(16000); (new Timer() { @Override public void run() { diagram.selectItem(171182L); } }).schedule(20000); } private void R_HSA_71921_tour(){ diagram.selectItem(209772L); (new Timer() { @Override public void run() { diagram.selectItem(174391L); } }).schedule(4000); (new Timer() { @Override public void run() { diagram.selectItem(372480L); } }).schedule(8000); (new Timer() { @Override public void run() { diagram.selectItem(209772L); } }).schedule(12000); (new Timer() { @Override public void run() { diagram.selectItem(353555L); } }).schedule(16000); } }
[ "tjbrunson@gmail.com" ]
tjbrunson@gmail.com
4cf99dc9bb638608cfe72f5654a5d9b23c2e7c43
0a455525ba5d492d5c04c9e171829a10976117f0
/src/com/mybatis/entity/PushExample.java
f0a8fde2188e341ca8cdd3f1df339bc510631709
[]
no_license
xu984386604/hiyouther
bc94a968743ef8c570c59e5dd08d7c03c210bb66
a6241e2f950046a56726b4e3c1097d2c8785898b
refs/heads/master
2020-12-25T08:58:50.799079
2016-06-14T11:34:28
2016-06-14T11:34:28
61,117,711
0
1
null
null
null
null
UTF-8
Java
false
false
17,946
java
package com.mybatis.entity; import java.util.ArrayList; import java.util.Date; import java.util.List; public class PushExample { protected String orderByClause; protected boolean distinct; protected List<Criteria> oredCriteria; public PushExample() { oredCriteria = new ArrayList<Criteria>(); } public void setOrderByClause(String orderByClause) { this.orderByClause = orderByClause; } public String getOrderByClause() { return orderByClause; } public void setDistinct(boolean distinct) { this.distinct = distinct; } public boolean isDistinct() { return distinct; } public List<Criteria> getOredCriteria() { return oredCriteria; } public void or(Criteria criteria) { oredCriteria.add(criteria); } public Criteria or() { Criteria criteria = createCriteriaInternal(); oredCriteria.add(criteria); return criteria; } public Criteria createCriteria() { Criteria criteria = createCriteriaInternal(); if (oredCriteria.size() == 0) { oredCriteria.add(criteria); } return criteria; } protected Criteria createCriteriaInternal() { Criteria criteria = new Criteria(); return criteria; } public void clear() { oredCriteria.clear(); orderByClause = null; distinct = false; } protected abstract static class GeneratedCriteria { protected List<Criterion> criteria; protected GeneratedCriteria() { super(); criteria = new ArrayList<Criterion>(); } public boolean isValid() { return criteria.size() > 0; } public List<Criterion> getAllCriteria() { return criteria; } public List<Criterion> getCriteria() { return criteria; } protected void addCriterion(String condition) { if (condition == null) { throw new RuntimeException("Value for condition cannot be null"); } criteria.add(new Criterion(condition)); } protected void addCriterion(String condition, Object value, String property) { if (value == null) { throw new RuntimeException("Value for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value)); } protected void addCriterion(String condition, Object value1, Object value2, String property) { if (value1 == null || value2 == null) { throw new RuntimeException("Between values for " + property + " cannot be null"); } criteria.add(new Criterion(condition, value1, value2)); } public Criteria andPuidIsNull() { addCriterion("puid is null"); return (Criteria) this; } public Criteria andPuidIsNotNull() { addCriterion("puid is not null"); return (Criteria) this; } public Criteria andPuidEqualTo(Integer value) { addCriterion("puid =", value, "puid"); return (Criteria) this; } public Criteria andPuidNotEqualTo(Integer value) { addCriterion("puid <>", value, "puid"); return (Criteria) this; } public Criteria andPuidGreaterThan(Integer value) { addCriterion("puid >", value, "puid"); return (Criteria) this; } public Criteria andPuidGreaterThanOrEqualTo(Integer value) { addCriterion("puid >=", value, "puid"); return (Criteria) this; } public Criteria andPuidLessThan(Integer value) { addCriterion("puid <", value, "puid"); return (Criteria) this; } public Criteria andPuidLessThanOrEqualTo(Integer value) { addCriterion("puid <=", value, "puid"); return (Criteria) this; } public Criteria andPuidIn(List<Integer> values) { addCriterion("puid in", values, "puid"); return (Criteria) this; } public Criteria andPuidNotIn(List<Integer> values) { addCriterion("puid not in", values, "puid"); return (Criteria) this; } public Criteria andPuidBetween(Integer value1, Integer value2) { addCriterion("puid between", value1, value2, "puid"); return (Criteria) this; } public Criteria andPuidNotBetween(Integer value1, Integer value2) { addCriterion("puid not between", value1, value2, "puid"); return (Criteria) this; } public Criteria andPnameIsNull() { addCriterion("pname is null"); return (Criteria) this; } public Criteria andPnameIsNotNull() { addCriterion("pname is not null"); return (Criteria) this; } public Criteria andPnameEqualTo(String value) { addCriterion("pname =", value, "pname"); return (Criteria) this; } public Criteria andPnameNotEqualTo(String value) { addCriterion("pname <>", value, "pname"); return (Criteria) this; } public Criteria andPnameGreaterThan(String value) { addCriterion("pname >", value, "pname"); return (Criteria) this; } public Criteria andPnameGreaterThanOrEqualTo(String value) { addCriterion("pname >=", value, "pname"); return (Criteria) this; } public Criteria andPnameLessThan(String value) { addCriterion("pname <", value, "pname"); return (Criteria) this; } public Criteria andPnameLessThanOrEqualTo(String value) { addCriterion("pname <=", value, "pname"); return (Criteria) this; } public Criteria andPnameLike(String value) { addCriterion("pname like", value, "pname"); return (Criteria) this; } public Criteria andPnameNotLike(String value) { addCriterion("pname not like", value, "pname"); return (Criteria) this; } public Criteria andPnameIn(List<String> values) { addCriterion("pname in", values, "pname"); return (Criteria) this; } public Criteria andPnameNotIn(List<String> values) { addCriterion("pname not in", values, "pname"); return (Criteria) this; } public Criteria andPnameBetween(String value1, String value2) { addCriterion("pname between", value1, value2, "pname"); return (Criteria) this; } public Criteria andPnameNotBetween(String value1, String value2) { addCriterion("pname not between", value1, value2, "pname"); return (Criteria) this; } public Criteria andIflookIsNull() { addCriterion("iflook is null"); return (Criteria) this; } public Criteria andIflookIsNotNull() { addCriterion("iflook is not null"); return (Criteria) this; } public Criteria andIflookEqualTo(String value) { addCriterion("iflook =", value, "iflook"); return (Criteria) this; } public Criteria andIflookNotEqualTo(String value) { addCriterion("iflook <>", value, "iflook"); return (Criteria) this; } public Criteria andIflookGreaterThan(String value) { addCriterion("iflook >", value, "iflook"); return (Criteria) this; } public Criteria andIflookGreaterThanOrEqualTo(String value) { addCriterion("iflook >=", value, "iflook"); return (Criteria) this; } public Criteria andIflookLessThan(String value) { addCriterion("iflook <", value, "iflook"); return (Criteria) this; } public Criteria andIflookLessThanOrEqualTo(String value) { addCriterion("iflook <=", value, "iflook"); return (Criteria) this; } public Criteria andIflookLike(String value) { addCriterion("iflook like", value, "iflook"); return (Criteria) this; } public Criteria andIflookNotLike(String value) { addCriterion("iflook not like", value, "iflook"); return (Criteria) this; } public Criteria andIflookIn(List<String> values) { addCriterion("iflook in", values, "iflook"); return (Criteria) this; } public Criteria andIflookNotIn(List<String> values) { addCriterion("iflook not in", values, "iflook"); return (Criteria) this; } public Criteria andIflookBetween(String value1, String value2) { addCriterion("iflook between", value1, value2, "iflook"); return (Criteria) this; } public Criteria andIflookNotBetween(String value1, String value2) { addCriterion("iflook not between", value1, value2, "iflook"); return (Criteria) this; } public Criteria andPtimeIsNull() { addCriterion("ptime is null"); return (Criteria) this; } public Criteria andPtimeIsNotNull() { addCriterion("ptime is not null"); return (Criteria) this; } public Criteria andPtimeEqualTo(Date value) { addCriterion("ptime =", value, "ptime"); return (Criteria) this; } public Criteria andPtimeNotEqualTo(Date value) { addCriterion("ptime <>", value, "ptime"); return (Criteria) this; } public Criteria andPtimeGreaterThan(Date value) { addCriterion("ptime >", value, "ptime"); return (Criteria) this; } public Criteria andPtimeGreaterThanOrEqualTo(Date value) { addCriterion("ptime >=", value, "ptime"); return (Criteria) this; } public Criteria andPtimeLessThan(Date value) { addCriterion("ptime <", value, "ptime"); return (Criteria) this; } public Criteria andPtimeLessThanOrEqualTo(Date value) { addCriterion("ptime <=", value, "ptime"); return (Criteria) this; } public Criteria andPtimeIn(List<Date> values) { addCriterion("ptime in", values, "ptime"); return (Criteria) this; } public Criteria andPtimeNotIn(List<Date> values) { addCriterion("ptime not in", values, "ptime"); return (Criteria) this; } public Criteria andPtimeBetween(Date value1, Date value2) { addCriterion("ptime between", value1, value2, "ptime"); return (Criteria) this; } public Criteria andPtimeNotBetween(Date value1, Date value2) { addCriterion("ptime not between", value1, value2, "ptime"); return (Criteria) this; } public Criteria andUidIsNull() { addCriterion("uid is null"); return (Criteria) this; } public Criteria andUidIsNotNull() { addCriterion("uid is not null"); return (Criteria) this; } public Criteria andUidEqualTo(Integer value) { addCriterion("uid =", value, "uid"); return (Criteria) this; } public Criteria andUidNotEqualTo(Integer value) { addCriterion("uid <>", value, "uid"); return (Criteria) this; } public Criteria andUidGreaterThan(Integer value) { addCriterion("uid >", value, "uid"); return (Criteria) this; } public Criteria andUidGreaterThanOrEqualTo(Integer value) { addCriterion("uid >=", value, "uid"); return (Criteria) this; } public Criteria andUidLessThan(Integer value) { addCriterion("uid <", value, "uid"); return (Criteria) this; } public Criteria andUidLessThanOrEqualTo(Integer value) { addCriterion("uid <=", value, "uid"); return (Criteria) this; } public Criteria andUidIn(List<Integer> values) { addCriterion("uid in", values, "uid"); return (Criteria) this; } public Criteria andUidNotIn(List<Integer> values) { addCriterion("uid not in", values, "uid"); return (Criteria) this; } public Criteria andUidBetween(Integer value1, Integer value2) { addCriterion("uid between", value1, value2, "uid"); return (Criteria) this; } public Criteria andUidNotBetween(Integer value1, Integer value2) { addCriterion("uid not between", value1, value2, "uid"); return (Criteria) this; } public Criteria andTypeIsNull() { addCriterion("type is null"); return (Criteria) this; } public Criteria andTypeIsNotNull() { addCriterion("type is not null"); return (Criteria) this; } public Criteria andTypeEqualTo(Integer value) { addCriterion("type =", value, "type"); return (Criteria) this; } public Criteria andTypeNotEqualTo(Integer value) { addCriterion("type <>", value, "type"); return (Criteria) this; } public Criteria andTypeGreaterThan(Integer value) { addCriterion("type >", value, "type"); return (Criteria) this; } public Criteria andTypeGreaterThanOrEqualTo(Integer value) { addCriterion("type >=", value, "type"); return (Criteria) this; } public Criteria andTypeLessThan(Integer value) { addCriterion("type <", value, "type"); return (Criteria) this; } public Criteria andTypeLessThanOrEqualTo(Integer value) { addCriterion("type <=", value, "type"); return (Criteria) this; } public Criteria andTypeIn(List<Integer> values) { addCriterion("type in", values, "type"); return (Criteria) this; } public Criteria andTypeNotIn(List<Integer> values) { addCriterion("type not in", values, "type"); return (Criteria) this; } public Criteria andTypeBetween(Integer value1, Integer value2) { addCriterion("type between", value1, value2, "type"); return (Criteria) this; } public Criteria andTypeNotBetween(Integer value1, Integer value2) { addCriterion("type not between", value1, value2, "type"); return (Criteria) this; } } public static class Criteria extends GeneratedCriteria { protected Criteria() { super(); } } public static class Criterion { private String condition; private Object value; private Object secondValue; private boolean noValue; private boolean singleValue; private boolean betweenValue; private boolean listValue; private String typeHandler; public String getCondition() { return condition; } public Object getValue() { return value; } public Object getSecondValue() { return secondValue; } public boolean isNoValue() { return noValue; } public boolean isSingleValue() { return singleValue; } public boolean isBetweenValue() { return betweenValue; } public boolean isListValue() { return listValue; } public String getTypeHandler() { return typeHandler; } protected Criterion(String condition) { super(); this.condition = condition; this.typeHandler = null; this.noValue = true; } protected Criterion(String condition, Object value, String typeHandler) { super(); this.condition = condition; this.value = value; this.typeHandler = typeHandler; if (value instanceof List<?>) { this.listValue = true; } else { this.singleValue = true; } } protected Criterion(String condition, Object value) { this(condition, value, null); } protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { super(); this.condition = condition; this.value = value; this.secondValue = secondValue; this.typeHandler = typeHandler; this.betweenValue = true; } protected Criterion(String condition, Object value, Object secondValue) { this(condition, value, secondValue, null); } } }
[ "984386604@qq.com" ]
984386604@qq.com
94ae524cf40f878af83f921c4f0e2ce7ab82ad65
484b93ca51e0fc44b2257d04189d01c25c77601c
/app/src/main/java/com/example/carlosmo/fitrewards/ProfileFragment.java
0ddf9a94fd81755cf9099717c04326a431137706
[]
no_license
ibhunter17/FitRewards
7d68f82c406e21f750ceb06a27b0573e58052061
8e8c77de6b9026b9167b9c21d57ac74140135679
refs/heads/master
2020-12-25T21:55:52.276126
2016-06-12T12:23:26
2016-06-12T12:23:26
64,104,464
0
0
null
2016-07-25T04:51:00
2016-07-25T04:50:59
null
UTF-8
Java
false
false
454
java
package com.example.carlosmo.fitrewards; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; public class ProfileFragment extends Fragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { return inflater.inflate(R.layout.profile_fragment, container, false); } }
[ "carlosmo@Carlos-MacBook-Pro.local" ]
carlosmo@Carlos-MacBook-Pro.local
f4429da8e65684f357fadada8339b6951bc957ca
70fa1fd24ac8f18d98ba1981791726d578c7bdb5
/src/main/java/cn/springmvc/model/RefrePrcModel.java
3e52d93f6f27f43f792a80850521bca383f76477
[ "Apache-2.0" ]
permissive
JoshEliYang/PriceTag
9588b24954ab39107578ef65a48e344c9600b2ac
ea82f4f3a1106b8251f4ed5d5cbbb0bdf7cdeb6b
refs/heads/master
2020-04-12T08:58:08.951613
2017-05-03T05:40:35
2017-05-03T05:40:35
48,784,338
0
0
null
null
null
null
UTF-8
Java
false
false
481
java
package cn.springmvc.model; public class RefrePrcModel { String goodsNo; String cargoNum; String CargoId; public String getCargoId() { return CargoId; } public void setCargoId(String cargoId) { CargoId = cargoId; } public String getCargoNum() { return cargoNum; } public void setCargoNum(String cargoNum) { this.cargoNum = cargoNum; } public String getGoodsNo() { return goodsNo; } public void setGoodsNo(String goodsNo) { this.goodsNo = goodsNo; } }
[ "863700588@qq.com" ]
863700588@qq.com
821e4d42a5929b8285d2ba4f25f83201aab03b78
d1c3e9957ec4bfd56e0dfc02eb126d74f6fe428e
/app/src/main/java/com/pin/patterndemo/structural/facade/Memory.java
f885a3230ae336ee7d799b2d45ccd86dec2d6322
[]
no_license
DiskyZhs/DesignPatternExercise
66771321e38e40a1d19d86306dbfa727772a72c7
b20c23f03825898759aa1b31abffd30aacafc41d
refs/heads/master
2020-03-25T20:28:07.912117
2018-08-24T01:38:00
2018-08-24T01:38:00
144,132,329
0
0
null
null
null
null
UTF-8
Java
false
false
285
java
package com.pin.patterndemo.structural.facade; /** * Created by HH on 2018/8/1. */ public class Memory { public void startup(){ System.out.println("memory startup!"); } public void shutdown(){ System.out.println("memory shutdown!"); } }
[ "haosong_zhang@pinssible.com" ]
haosong_zhang@pinssible.com
7ce871cd9a098afb19cf39d164245c264d2398c2
fffec0cdd71cbeef576159d78275e549afa96e93
/app/src/main/java/net/onefree/aiphone/utils/BitmapUtils.java
4af2817d25859a4a7dc1e19dfef47f9352f3efbf
[]
no_license
shenxiaolin/AiPhone
f080b2f56d53e31ff2292134788a8b396c1e9e53
26e80830f8e05f77d0974885262d2f4c75c1855a
refs/heads/master
2021-01-18T05:46:22.499711
2015-03-02T09:52:16
2015-03-02T09:52:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,503
java
package net.onefree.aiphone.utils; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Canvas; import android.graphics.PixelFormat; import android.graphics.drawable.Drawable; import java.io.ByteArrayOutputStream; import java.io.IOException; /** * Created by maoah on 2015/1/12. */ public class BitmapUtils { public static byte[] getBitmapByte(Bitmap bitmap) { ByteArrayOutputStream out = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.JPEG, 100, out); try { out.flush(); out.close(); } catch (IOException e) { e.printStackTrace(); } return out.toByteArray(); } public static Bitmap getBitmapFromByte(byte[] temp) { if (temp != null) { Bitmap bitmap = BitmapFactory.decodeByteArray(temp, 0, temp.length); return bitmap; } else { return null; } } public static Bitmap drawableToBitmap(Drawable drawable) { int width = drawable.getIntrinsicWidth(); int height = drawable.getIntrinsicHeight(); Bitmap bitmap = Bitmap.createBitmap(width, height, drawable.getOpacity() != PixelFormat.OPAQUE ? Bitmap.Config.ARGB_8888 : Bitmap.Config.RGB_565); Canvas canvas = new Canvas(bitmap); drawable.setBounds(0, 0, width, height); drawable.draw(canvas); return bitmap; } }
[ "mahsky@qq.com" ]
mahsky@qq.com
01bdebdf522856576a80a9397c647c65cb1341be
4899ed4b9c2e8abbe82f29d99109e68c5e912a15
/project/api/src/main/java/org/genxdm/io/ConfigurableSerializationParams.java
044cf6a3b5e3cdd24767437742d0fc543b26672d
[]
no_license
TIBCOSoftware/genxdm
d10fca55ba75f2c7c684a072c0c9caba738e07e9
df8819e8876c20e6248e25e89499642f10a70add
refs/heads/master
2023-08-27T03:34:28.600093
2023-08-09T16:34:13
2023-08-09T16:34:13
39,789,872
8
4
null
2018-07-12T17:43:07
2015-07-27T18:05:27
Java
UTF-8
Java
false
false
1,063
java
package org.genxdm.io; import java.util.List; import javax.xml.namespace.NamespaceContext; import javax.xml.namespace.QName; import org.genxdm.io.SerializationParams.Standalone; public interface ConfigurableSerializationParams { void setByteOrderMark(boolean flag); void setCDataSectionElements(List<QName> list); void setDoctypes(String pub, String sys); void setEncoding(String enc); // escapeURIAttributes boolean ; includeContentType boolean void setIndent(boolean ind); void setMediaType(String type); // method QName (really, don't want this to be terribly settable; constructor only) void setNamespaceContextHints(NamespaceContext hints); // void setNormalizationForm(String/enum); void setOmitXMLDeclaration(boolean flag); void setStandalone(Standalone value); // undeclarePrefixes boolean; // useCharacterMaps Map<Character [CodePoint instead?], String> // version String [implementation defined meaning; undefined by us] }
[ "aaletal@gmail.com" ]
aaletal@gmail.com
888fff01046bc483a5d077e683cc884bbe3f0724
eb298ad0d4ab53422e6c95ed7e8f89b3eddaf6d8
/recetas/src/main/java/com/informatorio/recetas/RecetasApplication.java
471f6b7f6a24f51f6564ecd833ed29b71f19fc47
[]
no_license
java-informatorio/spring-tutorials
2d18a2e47e1629e9f642da6a4a40dc61c60a1e0d
d849fefd94423cbdc22f5b34c93c834bfa236a00
refs/heads/master
2021-09-21T23:07:07.971505
2021-09-02T20:54:04
2021-09-02T20:54:04
203,679,605
14
5
null
2019-10-31T07:37:05
2019-08-21T23:36:19
HTML
UTF-8
Java
false
false
331
java
package com.informatorio.recetas; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class RecetasApplication { public static void main(String[] args) { SpringApplication.run(RecetasApplication.class, args); } }
[ "eduortiz.g@gmail.com" ]
eduortiz.g@gmail.com
a1cb6fa2da2bbd01dd4cc6eb09113b0e441fb127
4cf9d623eb038a1273a7c269a9b5adf14134ae46
/src/com/library/uitls/AddImageUitls.java
2de3870ee97c7410fee7bcf307e6436c1fd9992a
[]
no_license
wwwss/YaoHuoLaLibrary
4fecef4ed53267ec244eef34d489aab1aa3171c5
b6ca716777e78e5a66880a90aa9d2ad3543bda0b
refs/heads/master
2021-01-21T12:59:15.637621
2016-05-04T06:26:10
2016-05-04T06:26:10
53,644,359
0
0
null
null
null
null
UTF-8
Java
false
false
2,725
java
package com.library.uitls; import java.io.File; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.Date; import android.app.Activity; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.net.Uri; import android.os.Build; import android.os.Environment; import android.provider.MediaStore; import android.widget.Toast; public class AddImageUitls { private String imagePath; private Context context; private Activity activity; public AddImageUitls(Context context,Activity activity) { this.context = context; this.activity=activity; } public void addImage(final int c, final int p) { CharSequence[] charSequences = { "拍照", "图库" }; new AlertDialog.Builder(context).setItems(charSequences, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { switch (which) { case 0: // 拍照 try { Intent intent = new Intent( MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(getFile())); activity.startActivityForResult(intent, c); } catch (Exception e) { Toast.makeText(context, "请插入sd卡后重试!", Toast.LENGTH_SHORT).show(); } break; case 1: Intent intent; if (Build.VERSION.SDK_INT < 19) { intent = new Intent(Intent.ACTION_GET_CONTENT); intent.setType("image/*"); } else { intent = new Intent( Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); } activity.startActivityForResult(intent, p); break; default: break; } } }).show(); } /** * 获取拍照图片临时文件 * * @return 图片文件 * @throws IOException */ private File getFile() throws IOException { String parentPath = Environment.getExternalStorageDirectory() .getAbsoluteFile() + File.separator + context.getPackageName(); File parent = new File(parentPath); if (!parent.exists()) { parent.mkdirs(); } Date date = new Date(System.currentTimeMillis()); SimpleDateFormat dateFormat = new SimpleDateFormat( "'IMG'_yyyyMMdd_HHmmss"); imagePath = parentPath + File.separator + dateFormat.format(date) + ".jpg"; File mPhotoFile = new File(imagePath); if (!mPhotoFile.exists()) { mPhotoFile.createNewFile(); } return mPhotoFile; } public String getImagePath() { return imagePath; } }
[ "742091701@qq.com" ]
742091701@qq.com
0a7b661c6c120ed09644310e499237d9c0fe8bd3
dd80a584130ef1a0333429ba76c1cee0eb40df73
/frameworks/base/media/java/android/media/MediaScanner.java
de3041ed5208ead3a632a2ade750f080d160953b
[ "MIT", "LicenseRef-scancode-unicode", "Apache-2.0" ]
permissive
karunmatharu/Android-4.4-Pay-by-Data
466f4e169ede13c5835424c78e8c30ce58f885c1
fcb778e92d4aad525ef7a995660580f948d40bc9
refs/heads/master
2021-03-24T13:33:01.721868
2017-02-18T17:48:49
2017-02-18T17:48:49
81,847,777
0
2
MIT
2020-03-09T00:02:12
2017-02-13T16:47:00
null
UTF-8
Java
false
false
74,547
java
/* * Copyright (C) 2007 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package android.media; import org.xml.sax.Attributes; import org.xml.sax.ContentHandler; import org.xml.sax.SAXException; import android.content.ContentUris; import android.content.ContentValues; import android.content.Context; import android.content.IContentProvider; import android.database.Cursor; import android.database.SQLException; import android.drm.DrmManagerClient; import android.graphics.BitmapFactory; import android.mtp.MtpConstants; import android.net.Uri; import android.os.Environment; import android.os.RemoteException; import android.os.SystemProperties; import android.provider.MediaStore; import android.provider.MediaStore.Audio; import android.provider.MediaStore.Audio.Playlists; import android.provider.MediaStore.Files; import android.provider.MediaStore.Files.FileColumns; import android.provider.MediaStore.Images; import android.provider.MediaStore.Video; import android.provider.Settings; import android.sax.Element; import android.sax.ElementListener; import android.sax.RootElement; import android.text.TextUtils; import android.util.Log; import android.util.Xml; import java.io.BufferedReader; import java.io.File; import java.io.FileDescriptor; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; import java.util.Locale; import libcore.io.ErrnoException; import libcore.io.Libcore; /** * Internal service helper that no-one should use directly. * * The way the scan currently works is: * - The Java MediaScannerService creates a MediaScanner (this class), and calls * MediaScanner.scanDirectories on it. * - scanDirectories() calls the native processDirectory() for each of the specified directories. * - the processDirectory() JNI method wraps the provided mediascanner client in a native * 'MyMediaScannerClient' class, then calls processDirectory() on the native MediaScanner * object (which got created when the Java MediaScanner was created). * - native MediaScanner.processDirectory() calls * doProcessDirectory(), which recurses over the folder, and calls * native MyMediaScannerClient.scanFile() for every file whose extension matches. * - native MyMediaScannerClient.scanFile() calls back on Java MediaScannerClient.scanFile, * which calls doScanFile, which after some setup calls back down to native code, calling * MediaScanner.processFile(). * - MediaScanner.processFile() calls one of several methods, depending on the type of the * file: parseMP3, parseMP4, parseMidi, parseOgg or parseWMA. * - each of these methods gets metadata key/value pairs from the file, and repeatedly * calls native MyMediaScannerClient.handleStringTag, which calls back up to its Java * counterparts in this file. * - Java handleStringTag() gathers the key/value pairs that it's interested in. * - once processFile returns and we're back in Java code in doScanFile(), it calls * Java MyMediaScannerClient.endFile(), which takes all the data that's been * gathered and inserts an entry in to the database. * * In summary: * Java MediaScannerService calls * Java MediaScanner scanDirectories, which calls * Java MediaScanner processDirectory (native method), which calls * native MediaScanner processDirectory, which calls * native MyMediaScannerClient scanFile, which calls * Java MyMediaScannerClient scanFile, which calls * Java MediaScannerClient doScanFile, which calls * Java MediaScanner processFile (native method), which calls * native MediaScanner processFile, which calls * native parseMP3, parseMP4, parseMidi, parseOgg or parseWMA, which calls * native MyMediaScanner handleStringTag, which calls * Java MyMediaScanner handleStringTag. * Once MediaScanner processFile returns, an entry is inserted in to the database. * * The MediaScanner class is not thread-safe, so it should only be used in a single threaded manner. * * {@hide} */ public class MediaScanner { static { System.loadLibrary("media_jni"); native_init(); } private final static String TAG = "MediaScanner"; private static final String[] FILES_PRESCAN_PROJECTION = new String[] { Files.FileColumns._ID, // 0 Files.FileColumns.DATA, // 1 Files.FileColumns.FORMAT, // 2 Files.FileColumns.DATE_MODIFIED, // 3 }; private static final String[] ID_PROJECTION = new String[] { Files.FileColumns._ID, }; private static final int FILES_PRESCAN_ID_COLUMN_INDEX = 0; private static final int FILES_PRESCAN_PATH_COLUMN_INDEX = 1; private static final int FILES_PRESCAN_FORMAT_COLUMN_INDEX = 2; private static final int FILES_PRESCAN_DATE_MODIFIED_COLUMN_INDEX = 3; private static final String[] PLAYLIST_MEMBERS_PROJECTION = new String[] { Audio.Playlists.Members.PLAYLIST_ID, // 0 }; private static final int ID_PLAYLISTS_COLUMN_INDEX = 0; private static final int PATH_PLAYLISTS_COLUMN_INDEX = 1; private static final int DATE_MODIFIED_PLAYLISTS_COLUMN_INDEX = 2; private static final String RINGTONES_DIR = "/ringtones/"; private static final String NOTIFICATIONS_DIR = "/notifications/"; private static final String ALARMS_DIR = "/alarms/"; private static final String MUSIC_DIR = "/music/"; private static final String PODCAST_DIR = "/podcasts/"; private static final String[] ID3_GENRES = { // ID3v1 Genres "Blues", "Classic Rock", "Country", "Dance", "Disco", "Funk", "Grunge", "Hip-Hop", "Jazz", "Metal", "New Age", "Oldies", "Other", "Pop", "R&B", "Rap", "Reggae", "Rock", "Techno", "Industrial", "Alternative", "Ska", "Death Metal", "Pranks", "Soundtrack", "Euro-Techno", "Ambient", "Trip-Hop", "Vocal", "Jazz+Funk", "Fusion", "Trance", "Classical", "Instrumental", "Acid", "House", "Game", "Sound Clip", "Gospel", "Noise", "AlternRock", "Bass", "Soul", "Punk", "Space", "Meditative", "Instrumental Pop", "Instrumental Rock", "Ethnic", "Gothic", "Darkwave", "Techno-Industrial", "Electronic", "Pop-Folk", "Eurodance", "Dream", "Southern Rock", "Comedy", "Cult", "Gangsta", "Top 40", "Christian Rap", "Pop/Funk", "Jungle", "Native American", "Cabaret", "New Wave", "Psychadelic", "Rave", "Showtunes", "Trailer", "Lo-Fi", "Tribal", "Acid Punk", "Acid Jazz", "Polka", "Retro", "Musical", "Rock & Roll", "Hard Rock", // The following genres are Winamp extensions "Folk", "Folk-Rock", "National Folk", "Swing", "Fast Fusion", "Bebob", "Latin", "Revival", "Celtic", "Bluegrass", "Avantgarde", "Gothic Rock", "Progressive Rock", "Psychedelic Rock", "Symphonic Rock", "Slow Rock", "Big Band", "Chorus", "Easy Listening", "Acoustic", "Humour", "Speech", "Chanson", "Opera", "Chamber Music", "Sonata", "Symphony", "Booty Bass", "Primus", "Porn Groove", "Satire", "Slow Jam", "Club", "Tango", "Samba", "Folklore", "Ballad", "Power Ballad", "Rhythmic Soul", "Freestyle", "Duet", "Punk Rock", "Drum Solo", "A capella", "Euro-House", "Dance Hall", // The following ones seem to be fairly widely supported as well "Goa", "Drum & Bass", "Club-House", "Hardcore", "Terror", "Indie", "Britpop", null, "Polsk Punk", "Beat", "Christian Gangsta", "Heavy Metal", "Black Metal", "Crossover", "Contemporary Christian", "Christian Rock", "Merengue", "Salsa", "Thrash Metal", "Anime", "JPop", "Synthpop", // 148 and up don't seem to have been defined yet. }; private int mNativeContext; private Context mContext; private String mPackageName; private IContentProvider mMediaProvider; private Uri mAudioUri; private Uri mVideoUri; private Uri mImagesUri; private Uri mThumbsUri; private Uri mPlaylistsUri; private Uri mFilesUri; private Uri mFilesUriNoNotify; private boolean mProcessPlaylists, mProcessGenres; private int mMtpObjectHandle; private final String mExternalStoragePath; private final boolean mExternalIsEmulated; /** whether to use bulk inserts or individual inserts for each item */ private static final boolean ENABLE_BULK_INSERTS = true; // used when scanning the image database so we know whether we have to prune // old thumbnail files private int mOriginalCount; /** Whether the database had any entries in it before the scan started */ private boolean mWasEmptyPriorToScan = false; /** Whether the scanner has set a default sound for the ringer ringtone. */ private boolean mDefaultRingtoneSet; /** Whether the scanner has set a default sound for the notification ringtone. */ private boolean mDefaultNotificationSet; /** Whether the scanner has set a default sound for the alarm ringtone. */ private boolean mDefaultAlarmSet; /** The filename for the default sound for the ringer ringtone. */ private String mDefaultRingtoneFilename; /** The filename for the default sound for the notification ringtone. */ private String mDefaultNotificationFilename; /** The filename for the default sound for the alarm ringtone. */ private String mDefaultAlarmAlertFilename; /** * The prefix for system properties that define the default sound for * ringtones. Concatenate the name of the setting from Settings * to get the full system property. */ private static final String DEFAULT_RINGTONE_PROPERTY_PREFIX = "ro.config."; // set to true if file path comparisons should be case insensitive. // this should be set when scanning files on a case insensitive file system. private boolean mCaseInsensitivePaths; private final BitmapFactory.Options mBitmapOptions = new BitmapFactory.Options(); private static class FileEntry { long mRowId; String mPath; long mLastModified; int mFormat; boolean mLastModifiedChanged; FileEntry(long rowId, String path, long lastModified, int format) { mRowId = rowId; mPath = path; mLastModified = lastModified; mFormat = format; mLastModifiedChanged = false; } @Override public String toString() { return mPath + " mRowId: " + mRowId; } } private static class PlaylistEntry { String path; long bestmatchid; int bestmatchlevel; } private ArrayList<PlaylistEntry> mPlaylistEntries = new ArrayList<PlaylistEntry>(); private MediaInserter mMediaInserter; private ArrayList<FileEntry> mPlayLists; private DrmManagerClient mDrmManagerClient = null; public MediaScanner(Context c) { native_setup(); mContext = c; mPackageName = c.getPackageName(); mBitmapOptions.inSampleSize = 1; mBitmapOptions.inJustDecodeBounds = true; setDefaultRingtoneFileNames(); mExternalStoragePath = Environment.getExternalStorageDirectory().getAbsolutePath(); mExternalIsEmulated = Environment.isExternalStorageEmulated(); //mClient.testGenreNameConverter(); } private void setDefaultRingtoneFileNames() { mDefaultRingtoneFilename = SystemProperties.get(DEFAULT_RINGTONE_PROPERTY_PREFIX + Settings.System.RINGTONE); mDefaultNotificationFilename = SystemProperties.get(DEFAULT_RINGTONE_PROPERTY_PREFIX + Settings.System.NOTIFICATION_SOUND); mDefaultAlarmAlertFilename = SystemProperties.get(DEFAULT_RINGTONE_PROPERTY_PREFIX + Settings.System.ALARM_ALERT); } private final MyMediaScannerClient mClient = new MyMediaScannerClient(); private boolean isDrmEnabled() { String prop = SystemProperties.get("drm.service.enabled"); return prop != null && prop.equals("true"); } private class MyMediaScannerClient implements MediaScannerClient { private String mArtist; private String mAlbumArtist; // use this if mArtist is missing private String mAlbum; private String mTitle; private String mComposer; private String mGenre; private String mMimeType; private int mFileType; private int mTrack; private int mYear; private int mDuration; private String mPath; private long mLastModified; private long mFileSize; private String mWriter; private int mCompilation; private boolean mIsDrm; private boolean mNoMedia; // flag to suppress file from appearing in media tables private int mWidth; private int mHeight; public FileEntry beginFile(String path, String mimeType, long lastModified, long fileSize, boolean isDirectory, boolean noMedia) { mMimeType = mimeType; mFileType = 0; mFileSize = fileSize; mIsDrm = false; if (!isDirectory) { if (!noMedia && isNoMediaFile(path)) { noMedia = true; } mNoMedia = noMedia; // try mimeType first, if it is specified if (mimeType != null) { mFileType = MediaFile.getFileTypeForMimeType(mimeType); } // if mimeType was not specified, compute file type based on file extension. if (mFileType == 0) { MediaFile.MediaFileType mediaFileType = MediaFile.getFileType(path); if (mediaFileType != null) { mFileType = mediaFileType.fileType; if (mMimeType == null) { mMimeType = mediaFileType.mimeType; } } } if (isDrmEnabled() && MediaFile.isDrmFileType(mFileType)) { mFileType = getFileTypeFromDrm(path); } } FileEntry entry = makeEntryFor(path); // add some slack to avoid a rounding error long delta = (entry != null) ? (lastModified - entry.mLastModified) : 0; boolean wasModified = delta > 1 || delta < -1; if (entry == null || wasModified) { if (wasModified) { entry.mLastModified = lastModified; } else { entry = new FileEntry(0, path, lastModified, (isDirectory ? MtpConstants.FORMAT_ASSOCIATION : 0)); } entry.mLastModifiedChanged = true; } if (mProcessPlaylists && MediaFile.isPlayListFileType(mFileType)) { mPlayLists.add(entry); // we don't process playlists in the main scan, so return null return null; } // clear all the metadata mArtist = null; mAlbumArtist = null; mAlbum = null; mTitle = null; mComposer = null; mGenre = null; mTrack = 0; mYear = 0; mDuration = 0; mPath = path; mLastModified = lastModified; mWriter = null; mCompilation = 0; mWidth = 0; mHeight = 0; return entry; } @Override public void scanFile(String path, long lastModified, long fileSize, boolean isDirectory, boolean noMedia) { // This is the callback funtion from native codes. // Log.v(TAG, "scanFile: "+path); doScanFile(path, null, lastModified, fileSize, isDirectory, false, noMedia); } public Uri doScanFile(String path, String mimeType, long lastModified, long fileSize, boolean isDirectory, boolean scanAlways, boolean noMedia) { Uri result = null; // long t1 = System.currentTimeMillis(); try { FileEntry entry = beginFile(path, mimeType, lastModified, fileSize, isDirectory, noMedia); // if this file was just inserted via mtp, set the rowid to zero // (even though it already exists in the database), to trigger // the correct code path for updating its entry if (mMtpObjectHandle != 0) { entry.mRowId = 0; } // rescan for metadata if file was modified since last scan if (entry != null && (entry.mLastModifiedChanged || scanAlways)) { if (noMedia) { result = endFile(entry, false, false, false, false, false); } else { String lowpath = path.toLowerCase(Locale.ROOT); boolean ringtones = (lowpath.indexOf(RINGTONES_DIR) > 0); boolean notifications = (lowpath.indexOf(NOTIFICATIONS_DIR) > 0); boolean alarms = (lowpath.indexOf(ALARMS_DIR) > 0); boolean podcasts = (lowpath.indexOf(PODCAST_DIR) > 0); boolean music = (lowpath.indexOf(MUSIC_DIR) > 0) || (!ringtones && !notifications && !alarms && !podcasts); boolean isaudio = MediaFile.isAudioFileType(mFileType); boolean isvideo = MediaFile.isVideoFileType(mFileType); boolean isimage = MediaFile.isImageFileType(mFileType); if (isaudio || isvideo || isimage) { if (mExternalIsEmulated && path.startsWith(mExternalStoragePath)) { // try to rewrite the path to bypass the sd card fuse layer String directPath = Environment.getMediaStorageDirectory() + path.substring(mExternalStoragePath.length()); File f = new File(directPath); if (f.exists()) { path = directPath; } } } // we only extract metadata for audio and video files if (isaudio || isvideo) { processFile(path, mimeType, this); } if (isimage) { processImageFile(path); } result = endFile(entry, ringtones, notifications, alarms, music, podcasts); } } } catch (RemoteException e) { Log.e(TAG, "RemoteException in MediaScanner.scanFile()", e); } // long t2 = System.currentTimeMillis(); // Log.v(TAG, "scanFile: " + path + " took " + (t2-t1)); return result; } private int parseSubstring(String s, int start, int defaultValue) { int length = s.length(); if (start == length) return defaultValue; char ch = s.charAt(start++); // return defaultValue if we have no integer at all if (ch < '0' || ch > '9') return defaultValue; int result = ch - '0'; while (start < length) { ch = s.charAt(start++); if (ch < '0' || ch > '9') return result; result = result * 10 + (ch - '0'); } return result; } public void handleStringTag(String name, String value) { if (name.equalsIgnoreCase("title") || name.startsWith("title;")) { // Don't trim() here, to preserve the special \001 character // used to force sorting. The media provider will trim() before // inserting the title in to the database. mTitle = value; } else if (name.equalsIgnoreCase("artist") || name.startsWith("artist;")) { mArtist = value.trim(); } else if (name.equalsIgnoreCase("albumartist") || name.startsWith("albumartist;") || name.equalsIgnoreCase("band") || name.startsWith("band;")) { mAlbumArtist = value.trim(); } else if (name.equalsIgnoreCase("album") || name.startsWith("album;")) { mAlbum = value.trim(); } else if (name.equalsIgnoreCase("composer") || name.startsWith("composer;")) { mComposer = value.trim(); } else if (mProcessGenres && (name.equalsIgnoreCase("genre") || name.startsWith("genre;"))) { mGenre = getGenreName(value); } else if (name.equalsIgnoreCase("year") || name.startsWith("year;")) { mYear = parseSubstring(value, 0, 0); } else if (name.equalsIgnoreCase("tracknumber") || name.startsWith("tracknumber;")) { // track number might be of the form "2/12" // we just read the number before the slash int num = parseSubstring(value, 0, 0); mTrack = (mTrack / 1000) * 1000 + num; } else if (name.equalsIgnoreCase("discnumber") || name.equals("set") || name.startsWith("set;")) { // set number might be of the form "1/3" // we just read the number before the slash int num = parseSubstring(value, 0, 0); mTrack = (num * 1000) + (mTrack % 1000); } else if (name.equalsIgnoreCase("duration")) { mDuration = parseSubstring(value, 0, 0); } else if (name.equalsIgnoreCase("writer") || name.startsWith("writer;")) { mWriter = value.trim(); } else if (name.equalsIgnoreCase("compilation")) { mCompilation = parseSubstring(value, 0, 0); } else if (name.equalsIgnoreCase("isdrm")) { mIsDrm = (parseSubstring(value, 0, 0) == 1); } else if (name.equalsIgnoreCase("width")) { mWidth = parseSubstring(value, 0, 0); } else if (name.equalsIgnoreCase("height")) { mHeight = parseSubstring(value, 0, 0); } else { //Log.v(TAG, "unknown tag: " + name + " (" + mProcessGenres + ")"); } } private boolean convertGenreCode(String input, String expected) { String output = getGenreName(input); if (output.equals(expected)) { return true; } else { Log.d(TAG, "'" + input + "' -> '" + output + "', expected '" + expected + "'"); return false; } } private void testGenreNameConverter() { convertGenreCode("2", "Country"); convertGenreCode("(2)", "Country"); convertGenreCode("(2", "(2"); convertGenreCode("2 Foo", "Country"); convertGenreCode("(2) Foo", "Country"); convertGenreCode("(2 Foo", "(2 Foo"); convertGenreCode("2Foo", "2Foo"); convertGenreCode("(2)Foo", "Country"); convertGenreCode("200 Foo", "Foo"); convertGenreCode("(200) Foo", "Foo"); convertGenreCode("200Foo", "200Foo"); convertGenreCode("(200)Foo", "Foo"); convertGenreCode("200)Foo", "200)Foo"); convertGenreCode("200) Foo", "200) Foo"); } public String getGenreName(String genreTagValue) { if (genreTagValue == null) { return null; } final int length = genreTagValue.length(); if (length > 0) { boolean parenthesized = false; StringBuffer number = new StringBuffer(); int i = 0; for (; i < length; ++i) { char c = genreTagValue.charAt(i); if (i == 0 && c == '(') { parenthesized = true; } else if (Character.isDigit(c)) { number.append(c); } else { break; } } char charAfterNumber = i < length ? genreTagValue.charAt(i) : ' '; if ((parenthesized && charAfterNumber == ')') || !parenthesized && Character.isWhitespace(charAfterNumber)) { try { short genreIndex = Short.parseShort(number.toString()); if (genreIndex >= 0) { if (genreIndex < ID3_GENRES.length && ID3_GENRES[genreIndex] != null) { return ID3_GENRES[genreIndex]; } else if (genreIndex == 0xFF) { return null; } else if (genreIndex < 0xFF && (i + 1) < length) { // genre is valid but unknown, // if there is a string after the value we take it if (parenthesized && charAfterNumber == ')') { i++; } String ret = genreTagValue.substring(i).trim(); if (ret.length() != 0) { return ret; } } else { // else return the number, without parentheses return number.toString(); } } } catch (NumberFormatException e) { } } } return genreTagValue; } private void processImageFile(String path) { try { mBitmapOptions.outWidth = 0; mBitmapOptions.outHeight = 0; BitmapFactory.decodeFile(path, mBitmapOptions); mWidth = mBitmapOptions.outWidth; mHeight = mBitmapOptions.outHeight; } catch (Throwable th) { // ignore; } } public void setMimeType(String mimeType) { if ("audio/mp4".equals(mMimeType) && mimeType.startsWith("video")) { // for feature parity with Donut, we force m4a files to keep the // audio/mp4 mimetype, even if they are really "enhanced podcasts" // with a video track return; } mMimeType = mimeType; mFileType = MediaFile.getFileTypeForMimeType(mimeType); } /** * Formats the data into a values array suitable for use with the Media * Content Provider. * * @return a map of values */ private ContentValues toValues() { ContentValues map = new ContentValues(); map.put(MediaStore.MediaColumns.DATA, mPath); map.put(MediaStore.MediaColumns.TITLE, mTitle); map.put(MediaStore.MediaColumns.DATE_MODIFIED, mLastModified); map.put(MediaStore.MediaColumns.SIZE, mFileSize); map.put(MediaStore.MediaColumns.MIME_TYPE, mMimeType); map.put(MediaStore.MediaColumns.IS_DRM, mIsDrm); String resolution = null; if (mWidth > 0 && mHeight > 0) { map.put(MediaStore.MediaColumns.WIDTH, mWidth); map.put(MediaStore.MediaColumns.HEIGHT, mHeight); resolution = mWidth + "x" + mHeight; } if (!mNoMedia) { if (MediaFile.isVideoFileType(mFileType)) { map.put(Video.Media.ARTIST, (mArtist != null && mArtist.length() > 0 ? mArtist : MediaStore.UNKNOWN_STRING)); map.put(Video.Media.ALBUM, (mAlbum != null && mAlbum.length() > 0 ? mAlbum : MediaStore.UNKNOWN_STRING)); map.put(Video.Media.DURATION, mDuration); if (resolution != null) { map.put(Video.Media.RESOLUTION, resolution); } } else if (MediaFile.isImageFileType(mFileType)) { // FIXME - add DESCRIPTION } else if (MediaFile.isAudioFileType(mFileType)) { map.put(Audio.Media.ARTIST, (mArtist != null && mArtist.length() > 0) ? mArtist : MediaStore.UNKNOWN_STRING); map.put(Audio.Media.ALBUM_ARTIST, (mAlbumArtist != null && mAlbumArtist.length() > 0) ? mAlbumArtist : null); map.put(Audio.Media.ALBUM, (mAlbum != null && mAlbum.length() > 0) ? mAlbum : MediaStore.UNKNOWN_STRING); map.put(Audio.Media.COMPOSER, mComposer); map.put(Audio.Media.GENRE, mGenre); if (mYear != 0) { map.put(Audio.Media.YEAR, mYear); } map.put(Audio.Media.TRACK, mTrack); map.put(Audio.Media.DURATION, mDuration); map.put(Audio.Media.COMPILATION, mCompilation); } } return map; } private Uri endFile(FileEntry entry, boolean ringtones, boolean notifications, boolean alarms, boolean music, boolean podcasts) throws RemoteException { // update database // use album artist if artist is missing if (mArtist == null || mArtist.length() == 0) { mArtist = mAlbumArtist; } ContentValues values = toValues(); String title = values.getAsString(MediaStore.MediaColumns.TITLE); if (title == null || TextUtils.isEmpty(title.trim())) { title = MediaFile.getFileTitle(values.getAsString(MediaStore.MediaColumns.DATA)); values.put(MediaStore.MediaColumns.TITLE, title); } String album = values.getAsString(Audio.Media.ALBUM); if (MediaStore.UNKNOWN_STRING.equals(album)) { album = values.getAsString(MediaStore.MediaColumns.DATA); // extract last path segment before file name int lastSlash = album.lastIndexOf('/'); if (lastSlash >= 0) { int previousSlash = 0; while (true) { int idx = album.indexOf('/', previousSlash + 1); if (idx < 0 || idx >= lastSlash) { break; } previousSlash = idx; } if (previousSlash != 0) { album = album.substring(previousSlash + 1, lastSlash); values.put(Audio.Media.ALBUM, album); } } } long rowId = entry.mRowId; if (MediaFile.isAudioFileType(mFileType) && (rowId == 0 || mMtpObjectHandle != 0)) { // Only set these for new entries. For existing entries, they // may have been modified later, and we want to keep the current // values so that custom ringtones still show up in the ringtone // picker. values.put(Audio.Media.IS_RINGTONE, ringtones); values.put(Audio.Media.IS_NOTIFICATION, notifications); values.put(Audio.Media.IS_ALARM, alarms); values.put(Audio.Media.IS_MUSIC, music); values.put(Audio.Media.IS_PODCAST, podcasts); } else if (mFileType == MediaFile.FILE_TYPE_JPEG && !mNoMedia) { ExifInterface exif = null; try { exif = new ExifInterface(entry.mPath); } catch (IOException ex) { // exif is null } if (exif != null) { float[] latlng = new float[2]; if (exif.getLatLong(latlng)) { values.put(Images.Media.LATITUDE, latlng[0]); values.put(Images.Media.LONGITUDE, latlng[1]); } long time = exif.getGpsDateTime(); if (time != -1) { values.put(Images.Media.DATE_TAKEN, time); } else { // If no time zone information is available, we should consider using // EXIF local time as taken time if the difference between file time // and EXIF local time is not less than 1 Day, otherwise MediaProvider // will use file time as taken time. time = exif.getDateTime(); if (time != -1 && Math.abs(mLastModified * 1000 - time) >= 86400000) { values.put(Images.Media.DATE_TAKEN, time); } } int orientation = exif.getAttributeInt( ExifInterface.TAG_ORIENTATION, -1); if (orientation != -1) { // We only recognize a subset of orientation tag values. int degree; switch(orientation) { case ExifInterface.ORIENTATION_ROTATE_90: degree = 90; break; case ExifInterface.ORIENTATION_ROTATE_180: degree = 180; break; case ExifInterface.ORIENTATION_ROTATE_270: degree = 270; break; default: degree = 0; break; } values.put(Images.Media.ORIENTATION, degree); } } } Uri tableUri = mFilesUri; MediaInserter inserter = mMediaInserter; if (!mNoMedia) { if (MediaFile.isVideoFileType(mFileType)) { tableUri = mVideoUri; } else if (MediaFile.isImageFileType(mFileType)) { tableUri = mImagesUri; } else if (MediaFile.isAudioFileType(mFileType)) { tableUri = mAudioUri; } } Uri result = null; boolean needToSetSettings = false; if (rowId == 0) { if (mMtpObjectHandle != 0) { values.put(MediaStore.MediaColumns.MEDIA_SCANNER_NEW_OBJECT_ID, mMtpObjectHandle); } if (tableUri == mFilesUri) { int format = entry.mFormat; if (format == 0) { format = MediaFile.getFormatCode(entry.mPath, mMimeType); } values.put(Files.FileColumns.FORMAT, format); } // Setting a flag in order not to use bulk insert for the file related with // notifications, ringtones, and alarms, because the rowId of the inserted file is // needed. if (mWasEmptyPriorToScan) { if (notifications && !mDefaultNotificationSet) { if (TextUtils.isEmpty(mDefaultNotificationFilename) || doesPathHaveFilename(entry.mPath, mDefaultNotificationFilename)) { needToSetSettings = true; } } else if (ringtones && !mDefaultRingtoneSet) { if (TextUtils.isEmpty(mDefaultRingtoneFilename) || doesPathHaveFilename(entry.mPath, mDefaultRingtoneFilename)) { needToSetSettings = true; } } else if (alarms && !mDefaultAlarmSet) { if (TextUtils.isEmpty(mDefaultAlarmAlertFilename) || doesPathHaveFilename(entry.mPath, mDefaultAlarmAlertFilename)) { needToSetSettings = true; } } } // New file, insert it. // Directories need to be inserted before the files they contain, so they // get priority when bulk inserting. // If the rowId of the inserted file is needed, it gets inserted immediately, // bypassing the bulk inserter. if (inserter == null || needToSetSettings) { if (inserter != null) { inserter.flushAll(); } result = mMediaProvider.insert(mPackageName, tableUri, values); } else if (entry.mFormat == MtpConstants.FORMAT_ASSOCIATION) { inserter.insertwithPriority(tableUri, values); } else { inserter.insert(tableUri, values); } if (result != null) { rowId = ContentUris.parseId(result); entry.mRowId = rowId; } } else { // updated file result = ContentUris.withAppendedId(tableUri, rowId); // path should never change, and we want to avoid replacing mixed cased paths // with squashed lower case paths values.remove(MediaStore.MediaColumns.DATA); int mediaType = 0; if (!MediaScanner.isNoMediaPath(entry.mPath)) { int fileType = MediaFile.getFileTypeForMimeType(mMimeType); if (MediaFile.isAudioFileType(fileType)) { mediaType = FileColumns.MEDIA_TYPE_AUDIO; } else if (MediaFile.isVideoFileType(fileType)) { mediaType = FileColumns.MEDIA_TYPE_VIDEO; } else if (MediaFile.isImageFileType(fileType)) { mediaType = FileColumns.MEDIA_TYPE_IMAGE; } else if (MediaFile.isPlayListFileType(fileType)) { mediaType = FileColumns.MEDIA_TYPE_PLAYLIST; } values.put(FileColumns.MEDIA_TYPE, mediaType); } mMediaProvider.update(mPackageName, result, values, null, null); } if(needToSetSettings) { if (notifications) { setSettingIfNotSet(Settings.System.NOTIFICATION_SOUND, tableUri, rowId); mDefaultNotificationSet = true; } else if (ringtones) { setSettingIfNotSet(Settings.System.RINGTONE, tableUri, rowId); mDefaultRingtoneSet = true; } else if (alarms) { setSettingIfNotSet(Settings.System.ALARM_ALERT, tableUri, rowId); mDefaultAlarmSet = true; } } return result; } private boolean doesPathHaveFilename(String path, String filename) { int pathFilenameStart = path.lastIndexOf(File.separatorChar) + 1; int filenameLength = filename.length(); return path.regionMatches(pathFilenameStart, filename, 0, filenameLength) && pathFilenameStart + filenameLength == path.length(); } private void setSettingIfNotSet(String settingName, Uri uri, long rowId) { String existingSettingValue = Settings.System.getString(mContext.getContentResolver(), settingName); if (TextUtils.isEmpty(existingSettingValue)) { // Set the setting to the given URI Settings.System.putString(mContext.getContentResolver(), settingName, ContentUris.withAppendedId(uri, rowId).toString()); } } private int getFileTypeFromDrm(String path) { if (!isDrmEnabled()) { return 0; } int resultFileType = 0; if (mDrmManagerClient == null) { mDrmManagerClient = new DrmManagerClient(mContext); } if (mDrmManagerClient.canHandle(path, null)) { mIsDrm = true; String drmMimetype = mDrmManagerClient.getOriginalMimeType(path); if (drmMimetype != null) { mMimeType = drmMimetype; resultFileType = MediaFile.getFileTypeForMimeType(drmMimetype); } } return resultFileType; } }; // end of anonymous MediaScannerClient instance private void prescan(String filePath, boolean prescanFiles) throws RemoteException { Cursor c = null; String where = null; String[] selectionArgs = null; if (mPlayLists == null) { mPlayLists = new ArrayList<FileEntry>(); } else { mPlayLists.clear(); } if (filePath != null) { // query for only one file where = MediaStore.Files.FileColumns._ID + ">?" + " AND " + Files.FileColumns.DATA + "=?"; selectionArgs = new String[] { "", filePath }; } else { where = MediaStore.Files.FileColumns._ID + ">?"; selectionArgs = new String[] { "" }; } // Tell the provider to not delete the file. // If the file is truly gone the delete is unnecessary, and we want to avoid // accidentally deleting files that are really there (this may happen if the // filesystem is mounted and unmounted while the scanner is running). Uri.Builder builder = mFilesUri.buildUpon(); builder.appendQueryParameter(MediaStore.PARAM_DELETE_DATA, "false"); MediaBulkDeleter deleter = new MediaBulkDeleter(mMediaProvider, mPackageName, builder.build()); // Build the list of files from the content provider try { if (prescanFiles) { // First read existing files from the files table. // Because we'll be deleting entries for missing files as we go, // we need to query the database in small batches, to avoid problems // with CursorWindow positioning. long lastId = Long.MIN_VALUE; Uri limitUri = mFilesUri.buildUpon().appendQueryParameter("limit", "1000").build(); mWasEmptyPriorToScan = true; while (true) { selectionArgs[0] = "" + lastId; if (c != null) { c.close(); c = null; } c = mMediaProvider.query(mPackageName, limitUri, FILES_PRESCAN_PROJECTION, where, selectionArgs, MediaStore.Files.FileColumns._ID, null); if (c == null) { break; } int num = c.getCount(); if (num == 0) { break; } mWasEmptyPriorToScan = false; while (c.moveToNext()) { long rowId = c.getLong(FILES_PRESCAN_ID_COLUMN_INDEX); String path = c.getString(FILES_PRESCAN_PATH_COLUMN_INDEX); int format = c.getInt(FILES_PRESCAN_FORMAT_COLUMN_INDEX); long lastModified = c.getLong(FILES_PRESCAN_DATE_MODIFIED_COLUMN_INDEX); lastId = rowId; // Only consider entries with absolute path names. // This allows storing URIs in the database without the // media scanner removing them. if (path != null && path.startsWith("/")) { boolean exists = false; try { exists = Libcore.os.access(path, libcore.io.OsConstants.F_OK); } catch (ErrnoException e1) { } if (!exists && !MtpConstants.isAbstractObject(format)) { // do not delete missing playlists, since they may have been // modified by the user. // The user can delete them in the media player instead. // instead, clear the path and lastModified fields in the row MediaFile.MediaFileType mediaFileType = MediaFile.getFileType(path); int fileType = (mediaFileType == null ? 0 : mediaFileType.fileType); if (!MediaFile.isPlayListFileType(fileType)) { deleter.delete(rowId); if (path.toLowerCase(Locale.US).endsWith("/.nomedia")) { deleter.flush(); String parent = new File(path).getParent(); mMediaProvider.call(mPackageName, MediaStore.UNHIDE_CALL, parent, null); } } } } } } } } finally { if (c != null) { c.close(); } deleter.flush(); } // compute original size of images mOriginalCount = 0; c = mMediaProvider.query(mPackageName, mImagesUri, ID_PROJECTION, null, null, null, null); if (c != null) { mOriginalCount = c.getCount(); c.close(); } } private boolean inScanDirectory(String path, String[] directories) { for (int i = 0; i < directories.length; i++) { String directory = directories[i]; if (path.startsWith(directory)) { return true; } } return false; } private void pruneDeadThumbnailFiles() { HashSet<String> existingFiles = new HashSet<String>(); String directory = "/sdcard/DCIM/.thumbnails"; String [] files = (new File(directory)).list(); if (files == null) files = new String[0]; for (int i = 0; i < files.length; i++) { String fullPathString = directory + "/" + files[i]; existingFiles.add(fullPathString); } try { Cursor c = mMediaProvider.query( mPackageName, mThumbsUri, new String [] { "_data" }, null, null, null, null); Log.v(TAG, "pruneDeadThumbnailFiles... " + c); if (c != null && c.moveToFirst()) { do { String fullPathString = c.getString(0); existingFiles.remove(fullPathString); } while (c.moveToNext()); } for (String fileToDelete : existingFiles) { if (false) Log.v(TAG, "fileToDelete is " + fileToDelete); try { (new File(fileToDelete)).delete(); } catch (SecurityException ex) { } } Log.v(TAG, "/pruneDeadThumbnailFiles... " + c); if (c != null) { c.close(); } } catch (RemoteException e) { // We will soon be killed... } } static class MediaBulkDeleter { StringBuilder whereClause = new StringBuilder(); ArrayList<String> whereArgs = new ArrayList<String>(100); final IContentProvider mProvider; final String mPackageName; final Uri mBaseUri; public MediaBulkDeleter(IContentProvider provider, String packageName, Uri baseUri) { mProvider = provider; mPackageName = packageName; mBaseUri = baseUri; } public void delete(long id) throws RemoteException { if (whereClause.length() != 0) { whereClause.append(","); } whereClause.append("?"); whereArgs.add("" + id); if (whereArgs.size() > 100) { flush(); } } public void flush() throws RemoteException { int size = whereArgs.size(); if (size > 0) { String [] foo = new String [size]; foo = whereArgs.toArray(foo); int numrows = mProvider.delete(mPackageName, mBaseUri, MediaStore.MediaColumns._ID + " IN (" + whereClause.toString() + ")", foo); //Log.i("@@@@@@@@@", "rows deleted: " + numrows); whereClause.setLength(0); whereArgs.clear(); } } } private void postscan(String[] directories) throws RemoteException { // handle playlists last, after we know what media files are on the storage. if (mProcessPlaylists) { processPlayLists(); } if (mOriginalCount == 0 && mImagesUri.equals(Images.Media.getContentUri("external"))) pruneDeadThumbnailFiles(); // allow GC to clean up mPlayLists = null; mMediaProvider = null; } private void initialize(String volumeName) { mMediaProvider = mContext.getContentResolver().acquireProvider("media"); mAudioUri = Audio.Media.getContentUri(volumeName); mVideoUri = Video.Media.getContentUri(volumeName); mImagesUri = Images.Media.getContentUri(volumeName); mThumbsUri = Images.Thumbnails.getContentUri(volumeName); mFilesUri = Files.getContentUri(volumeName); mFilesUriNoNotify = mFilesUri.buildUpon().appendQueryParameter("nonotify", "1").build(); if (!volumeName.equals("internal")) { // we only support playlists on external media mProcessPlaylists = true; mProcessGenres = true; mPlaylistsUri = Playlists.getContentUri(volumeName); mCaseInsensitivePaths = true; } } public void scanDirectories(String[] directories, String volumeName) { try { long start = System.currentTimeMillis(); initialize(volumeName); prescan(null, true); long prescan = System.currentTimeMillis(); if (ENABLE_BULK_INSERTS) { // create MediaInserter for bulk inserts mMediaInserter = new MediaInserter(mMediaProvider, mPackageName, 500); } for (int i = 0; i < directories.length; i++) { processDirectory(directories[i], mClient); } if (ENABLE_BULK_INSERTS) { // flush remaining inserts mMediaInserter.flushAll(); mMediaInserter = null; } long scan = System.currentTimeMillis(); postscan(directories); long end = System.currentTimeMillis(); if (false) { Log.d(TAG, " prescan time: " + (prescan - start) + "ms\n"); Log.d(TAG, " scan time: " + (scan - prescan) + "ms\n"); Log.d(TAG, "postscan time: " + (end - scan) + "ms\n"); Log.d(TAG, " total time: " + (end - start) + "ms\n"); } } catch (SQLException e) { // this might happen if the SD card is removed while the media scanner is running Log.e(TAG, "SQLException in MediaScanner.scan()", e); } catch (UnsupportedOperationException e) { // this might happen if the SD card is removed while the media scanner is running Log.e(TAG, "UnsupportedOperationException in MediaScanner.scan()", e); } catch (RemoteException e) { Log.e(TAG, "RemoteException in MediaScanner.scan()", e); } } // this function is used to scan a single file public Uri scanSingleFile(String path, String volumeName, String mimeType) { try { initialize(volumeName); prescan(path, true); File file = new File(path); if (!file.exists()) { return null; } // lastModified is in milliseconds on Files. long lastModifiedSeconds = file.lastModified() / 1000; // always scan the file, so we can return the content://media Uri for existing files return mClient.doScanFile(path, mimeType, lastModifiedSeconds, file.length(), false, true, MediaScanner.isNoMediaPath(path)); } catch (RemoteException e) { Log.e(TAG, "RemoteException in MediaScanner.scanFile()", e); return null; } } private static boolean isNoMediaFile(String path) { File file = new File(path); if (file.isDirectory()) return false; // special case certain file names // I use regionMatches() instead of substring() below // to avoid memory allocation int lastSlash = path.lastIndexOf('/'); if (lastSlash >= 0 && lastSlash + 2 < path.length()) { // ignore those ._* files created by MacOS if (path.regionMatches(lastSlash + 1, "._", 0, 2)) { return true; } // ignore album art files created by Windows Media Player: // Folder.jpg, AlbumArtSmall.jpg, AlbumArt_{...}_Large.jpg // and AlbumArt_{...}_Small.jpg if (path.regionMatches(true, path.length() - 4, ".jpg", 0, 4)) { if (path.regionMatches(true, lastSlash + 1, "AlbumArt_{", 0, 10) || path.regionMatches(true, lastSlash + 1, "AlbumArt.", 0, 9)) { return true; } int length = path.length() - lastSlash - 1; if ((length == 17 && path.regionMatches( true, lastSlash + 1, "AlbumArtSmall", 0, 13)) || (length == 10 && path.regionMatches(true, lastSlash + 1, "Folder", 0, 6))) { return true; } } } return false; } public static boolean isNoMediaPath(String path) { if (path == null) return false; // return true if file or any parent directory has name starting with a dot if (path.indexOf("/.") >= 0) return true; // now check to see if any parent directories have a ".nomedia" file // start from 1 so we don't bother checking in the root directory int offset = 1; while (offset >= 0) { int slashIndex = path.indexOf('/', offset); if (slashIndex > offset) { slashIndex++; // move past slash File file = new File(path.substring(0, slashIndex) + ".nomedia"); if (file.exists()) { // we have a .nomedia in one of the parent directories return true; } } offset = slashIndex; } return isNoMediaFile(path); } public void scanMtpFile(String path, String volumeName, int objectHandle, int format) { initialize(volumeName); MediaFile.MediaFileType mediaFileType = MediaFile.getFileType(path); int fileType = (mediaFileType == null ? 0 : mediaFileType.fileType); File file = new File(path); long lastModifiedSeconds = file.lastModified() / 1000; if (!MediaFile.isAudioFileType(fileType) && !MediaFile.isVideoFileType(fileType) && !MediaFile.isImageFileType(fileType) && !MediaFile.isPlayListFileType(fileType) && !MediaFile.isDrmFileType(fileType)) { // no need to use the media scanner, but we need to update last modified and file size ContentValues values = new ContentValues(); values.put(Files.FileColumns.SIZE, file.length()); values.put(Files.FileColumns.DATE_MODIFIED, lastModifiedSeconds); try { String[] whereArgs = new String[] { Integer.toString(objectHandle) }; mMediaProvider.update(mPackageName, Files.getMtpObjectsUri(volumeName), values, "_id=?", whereArgs); } catch (RemoteException e) { Log.e(TAG, "RemoteException in scanMtpFile", e); } return; } mMtpObjectHandle = objectHandle; Cursor fileList = null; try { if (MediaFile.isPlayListFileType(fileType)) { // build file cache so we can look up tracks in the playlist prescan(null, true); FileEntry entry = makeEntryFor(path); if (entry != null) { fileList = mMediaProvider.query(mPackageName, mFilesUri, FILES_PRESCAN_PROJECTION, null, null, null, null); processPlayList(entry, fileList); } } else { // MTP will create a file entry for us so we don't want to do it in prescan prescan(path, false); // always scan the file, so we can return the content://media Uri for existing files mClient.doScanFile(path, mediaFileType.mimeType, lastModifiedSeconds, file.length(), (format == MtpConstants.FORMAT_ASSOCIATION), true, isNoMediaPath(path)); } } catch (RemoteException e) { Log.e(TAG, "RemoteException in MediaScanner.scanFile()", e); } finally { mMtpObjectHandle = 0; if (fileList != null) { fileList.close(); } } } FileEntry makeEntryFor(String path) { String where; String[] selectionArgs; Cursor c = null; try { where = Files.FileColumns.DATA + "=?"; selectionArgs = new String[] { path }; c = mMediaProvider.query(mPackageName, mFilesUriNoNotify, FILES_PRESCAN_PROJECTION, where, selectionArgs, null, null); if (c.moveToFirst()) { long rowId = c.getLong(FILES_PRESCAN_ID_COLUMN_INDEX); int format = c.getInt(FILES_PRESCAN_FORMAT_COLUMN_INDEX); long lastModified = c.getLong(FILES_PRESCAN_DATE_MODIFIED_COLUMN_INDEX); return new FileEntry(rowId, path, lastModified, format); } } catch (RemoteException e) { } finally { if (c != null) { c.close(); } } return null; } // returns the number of matching file/directory names, starting from the right private int matchPaths(String path1, String path2) { int result = 0; int end1 = path1.length(); int end2 = path2.length(); while (end1 > 0 && end2 > 0) { int slash1 = path1.lastIndexOf('/', end1 - 1); int slash2 = path2.lastIndexOf('/', end2 - 1); int backSlash1 = path1.lastIndexOf('\\', end1 - 1); int backSlash2 = path2.lastIndexOf('\\', end2 - 1); int start1 = (slash1 > backSlash1 ? slash1 : backSlash1); int start2 = (slash2 > backSlash2 ? slash2 : backSlash2); if (start1 < 0) start1 = 0; else start1++; if (start2 < 0) start2 = 0; else start2++; int length = end1 - start1; if (end2 - start2 != length) break; if (path1.regionMatches(true, start1, path2, start2, length)) { result++; end1 = start1 - 1; end2 = start2 - 1; } else break; } return result; } private boolean matchEntries(long rowId, String data) { int len = mPlaylistEntries.size(); boolean done = true; for (int i = 0; i < len; i++) { PlaylistEntry entry = mPlaylistEntries.get(i); if (entry.bestmatchlevel == Integer.MAX_VALUE) { continue; // this entry has been matched already } done = false; if (data.equalsIgnoreCase(entry.path)) { entry.bestmatchid = rowId; entry.bestmatchlevel = Integer.MAX_VALUE; continue; // no need for path matching } int matchLength = matchPaths(data, entry.path); if (matchLength > entry.bestmatchlevel) { entry.bestmatchid = rowId; entry.bestmatchlevel = matchLength; } } return done; } private void cachePlaylistEntry(String line, String playListDirectory) { PlaylistEntry entry = new PlaylistEntry(); // watch for trailing whitespace int entryLength = line.length(); while (entryLength > 0 && Character.isWhitespace(line.charAt(entryLength - 1))) entryLength--; // path should be longer than 3 characters. // avoid index out of bounds errors below by returning here. if (entryLength < 3) return; if (entryLength < line.length()) line = line.substring(0, entryLength); // does entry appear to be an absolute path? // look for Unix or DOS absolute paths char ch1 = line.charAt(0); boolean fullPath = (ch1 == '/' || (Character.isLetter(ch1) && line.charAt(1) == ':' && line.charAt(2) == '\\')); // if we have a relative path, combine entry with playListDirectory if (!fullPath) line = playListDirectory + line; entry.path = line; //FIXME - should we look for "../" within the path? mPlaylistEntries.add(entry); } private void processCachedPlaylist(Cursor fileList, ContentValues values, Uri playlistUri) { fileList.moveToPosition(-1); while (fileList.moveToNext()) { long rowId = fileList.getLong(FILES_PRESCAN_ID_COLUMN_INDEX); String data = fileList.getString(FILES_PRESCAN_PATH_COLUMN_INDEX); if (matchEntries(rowId, data)) { break; } } int len = mPlaylistEntries.size(); int index = 0; for (int i = 0; i < len; i++) { PlaylistEntry entry = mPlaylistEntries.get(i); if (entry.bestmatchlevel > 0) { try { values.clear(); values.put(MediaStore.Audio.Playlists.Members.PLAY_ORDER, Integer.valueOf(index)); values.put(MediaStore.Audio.Playlists.Members.AUDIO_ID, Long.valueOf(entry.bestmatchid)); mMediaProvider.insert(mPackageName, playlistUri, values); index++; } catch (RemoteException e) { Log.e(TAG, "RemoteException in MediaScanner.processCachedPlaylist()", e); return; } } } mPlaylistEntries.clear(); } private void processM3uPlayList(String path, String playListDirectory, Uri uri, ContentValues values, Cursor fileList) { BufferedReader reader = null; try { File f = new File(path); if (f.exists()) { reader = new BufferedReader( new InputStreamReader(new FileInputStream(f)), 8192); String line = reader.readLine(); mPlaylistEntries.clear(); while (line != null) { // ignore comment lines, which begin with '#' if (line.length() > 0 && line.charAt(0) != '#') { cachePlaylistEntry(line, playListDirectory); } line = reader.readLine(); } processCachedPlaylist(fileList, values, uri); } } catch (IOException e) { Log.e(TAG, "IOException in MediaScanner.processM3uPlayList()", e); } finally { try { if (reader != null) reader.close(); } catch (IOException e) { Log.e(TAG, "IOException in MediaScanner.processM3uPlayList()", e); } } } private void processPlsPlayList(String path, String playListDirectory, Uri uri, ContentValues values, Cursor fileList) { BufferedReader reader = null; try { File f = new File(path); if (f.exists()) { reader = new BufferedReader( new InputStreamReader(new FileInputStream(f)), 8192); String line = reader.readLine(); mPlaylistEntries.clear(); while (line != null) { // ignore comment lines, which begin with '#' if (line.startsWith("File")) { int equals = line.indexOf('='); if (equals > 0) { cachePlaylistEntry(line.substring(equals + 1), playListDirectory); } } line = reader.readLine(); } processCachedPlaylist(fileList, values, uri); } } catch (IOException e) { Log.e(TAG, "IOException in MediaScanner.processPlsPlayList()", e); } finally { try { if (reader != null) reader.close(); } catch (IOException e) { Log.e(TAG, "IOException in MediaScanner.processPlsPlayList()", e); } } } class WplHandler implements ElementListener { final ContentHandler handler; String playListDirectory; public WplHandler(String playListDirectory, Uri uri, Cursor fileList) { this.playListDirectory = playListDirectory; RootElement root = new RootElement("smil"); Element body = root.getChild("body"); Element seq = body.getChild("seq"); Element media = seq.getChild("media"); media.setElementListener(this); this.handler = root.getContentHandler(); } @Override public void start(Attributes attributes) { String path = attributes.getValue("", "src"); if (path != null) { cachePlaylistEntry(path, playListDirectory); } } @Override public void end() { } ContentHandler getContentHandler() { return handler; } } private void processWplPlayList(String path, String playListDirectory, Uri uri, ContentValues values, Cursor fileList) { FileInputStream fis = null; try { File f = new File(path); if (f.exists()) { fis = new FileInputStream(f); mPlaylistEntries.clear(); Xml.parse(fis, Xml.findEncodingByName("UTF-8"), new WplHandler(playListDirectory, uri, fileList).getContentHandler()); processCachedPlaylist(fileList, values, uri); } } catch (SAXException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } finally { try { if (fis != null) fis.close(); } catch (IOException e) { Log.e(TAG, "IOException in MediaScanner.processWplPlayList()", e); } } } private void processPlayList(FileEntry entry, Cursor fileList) throws RemoteException { String path = entry.mPath; ContentValues values = new ContentValues(); int lastSlash = path.lastIndexOf('/'); if (lastSlash < 0) throw new IllegalArgumentException("bad path " + path); Uri uri, membersUri; long rowId = entry.mRowId; // make sure we have a name String name = values.getAsString(MediaStore.Audio.Playlists.NAME); if (name == null) { name = values.getAsString(MediaStore.MediaColumns.TITLE); if (name == null) { // extract name from file name int lastDot = path.lastIndexOf('.'); name = (lastDot < 0 ? path.substring(lastSlash + 1) : path.substring(lastSlash + 1, lastDot)); } } values.put(MediaStore.Audio.Playlists.NAME, name); values.put(MediaStore.Audio.Playlists.DATE_MODIFIED, entry.mLastModified); if (rowId == 0) { values.put(MediaStore.Audio.Playlists.DATA, path); uri = mMediaProvider.insert(mPackageName, mPlaylistsUri, values); rowId = ContentUris.parseId(uri); membersUri = Uri.withAppendedPath(uri, Playlists.Members.CONTENT_DIRECTORY); } else { uri = ContentUris.withAppendedId(mPlaylistsUri, rowId); mMediaProvider.update(mPackageName, uri, values, null, null); // delete members of existing playlist membersUri = Uri.withAppendedPath(uri, Playlists.Members.CONTENT_DIRECTORY); mMediaProvider.delete(mPackageName, membersUri, null, null); } String playListDirectory = path.substring(0, lastSlash + 1); MediaFile.MediaFileType mediaFileType = MediaFile.getFileType(path); int fileType = (mediaFileType == null ? 0 : mediaFileType.fileType); if (fileType == MediaFile.FILE_TYPE_M3U) { processM3uPlayList(path, playListDirectory, membersUri, values, fileList); } else if (fileType == MediaFile.FILE_TYPE_PLS) { processPlsPlayList(path, playListDirectory, membersUri, values, fileList); } else if (fileType == MediaFile.FILE_TYPE_WPL) { processWplPlayList(path, playListDirectory, membersUri, values, fileList); } } private void processPlayLists() throws RemoteException { Iterator<FileEntry> iterator = mPlayLists.iterator(); Cursor fileList = null; try { // use the files uri and projection because we need the format column, // but restrict the query to just audio files fileList = mMediaProvider.query(mPackageName, mFilesUri, FILES_PRESCAN_PROJECTION, "media_type=2", null, null, null); while (iterator.hasNext()) { FileEntry entry = iterator.next(); // only process playlist files if they are new or have been modified since the last scan if (entry.mLastModifiedChanged) { processPlayList(entry, fileList); } } } catch (RemoteException e1) { } finally { if (fileList != null) { fileList.close(); } } } private native void processDirectory(String path, MediaScannerClient client); private native void processFile(String path, String mimeType, MediaScannerClient client); public native void setLocale(String locale); public native byte[] extractAlbumArt(FileDescriptor fd); private static native final void native_init(); private native final void native_setup(); private native final void native_finalize(); /** * Releases resources associated with this MediaScanner object. * It is considered good practice to call this method when * one is done using the MediaScanner object. After this method * is called, the MediaScanner object can no longer be used. */ public void release() { native_finalize(); } @Override protected void finalize() { mContext.getContentResolver().releaseProvider(mMediaProvider); native_finalize(); } }
[ "karun.matharu@gmail.com" ]
karun.matharu@gmail.com
b42f831c5350b411bca78d64c526219950b0c6c8
447520f40e82a060368a0802a391697bc00be96f
/apks/comparison_androart/ro.btrl.pay/source/o/GZ.java
b81c57dd4e337b8acf0266c03b0388e7c40bddd3
[ "Apache-2.0" ]
permissive
iantal/AndroidPermissions
7f3343a9c29d82dbcd4ecd98b3a50ddf8d179465
d623b732734243590b5f004d167e542e2e2ae249
refs/heads/master
2023-07-19T01:29:26.689186
2019-09-30T19:01:42
2019-09-30T19:01:42
107,239,248
0
0
Apache-2.0
2023-07-16T07:41:38
2017-10-17T08:22:57
null
UTF-8
Java
false
false
1,777
java
package o; import android.databinding.ViewDataBinding; import android.databinding.ViewDataBinding.If; import android.util.SparseIntArray; import android.view.View; import android.widget.FrameLayout; import android.widget.TextView; public class GZ extends ViewDataBinding { private static final SparseIntArray ˎ = null; private static final ViewDataBinding.If ॱ = null; private String ʼ; public final TextView ˊ; private final FrameLayout ॱॱ; private long ᐝ = -1L; public GZ(ˉ paramˉ, View paramView) { super(paramˉ, paramView, 0); paramˉ = ॱ(paramˉ, paramView, 2, ॱ, ˎ); this.ॱॱ = ((FrameLayout)paramˉ[0]); this.ॱॱ.setTag(null); this.ˊ = ((TextView)paramˉ[1]); this.ˊ.setTag(null); ˋ(paramView); ˏॱ(); } public void ˎ(String paramString) { this.ʼ = paramString; try { this.ᐝ |= 1L; } finally { paramString = finally; throw paramString; } ˊ(120); super.ʽ(); } public void ˏ() { long l; try { l = this.ᐝ; this.ᐝ = 0L; } finally { localObject = finally; throw localObject; } String str = this.ʼ; if ((0x3 & l) != 0L) { ʹ.ˊ(this.ˊ, str); } } public boolean ˏ(int paramInt1, Object paramObject, int paramInt2) { return false; } public void ˏॱ() { try { this.ᐝ = 2L; } finally { localObject = finally; throw localObject; } ʽ(); } public boolean ॱ() { try { long l = this.ᐝ; if (l != 0L) { return true; } } finally { localObject = finally; throw localObject; } return false; } }
[ "antal.micky@yahoo.com" ]
antal.micky@yahoo.com
d15a4e40779c75762c0913779385fda60fa8e086
09ec8f8c229318b0b31725c7a383f0350b6024f0
/app/src/main/java/com/ebcompany/hs4/HSMainService.java
acff7cfd41ea1298c57a2d275356556d8996a42d
[]
no_license
ebinote2/HSMainServer
d23780a4ce005804a40e34d89b3efee3a88e927e
b663f3a00f17cdf75c02602b8a74585e6754a59f
refs/heads/master
2020-04-28T06:42:44.800935
2014-08-06T10:30:08
2014-08-06T10:30:08
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,761
java
package com.ebcompany.hs4; import android.app.Notification; import android.app.NotificationManager; import android.app.Service; import android.content.Context; import android.content.Intent; import android.graphics.drawable.BitmapDrawable; import android.net.Uri; import android.os.IBinder; import android.util.Log; import android.widget.Toast; import org.simpleframework.transport.Server; public class HSMainService extends Service { //region constants public static final int MY_NOTIFICATION_ID = 1; public static final int SERVERPORT = 8080; //endregion //************************ //region instance variables private String TAG; private Uri soundURI = Uri .parse("android.resource://com.ebcompany.hs4/" + R.raw.alarm_rooster); private long[] mVibratePattern = { 0, 200, 200, 300 }; private IS2Container is2Container; private Server server; //private HttpServer server; //endregion //************************ //region constructors public HSMainService() { //TAG = getApplicationContext().getString(R.string.log_message_tag); } //endregion //************************ //region override methods @Override public IBinder onBind(Intent intent) { // TODO: Return the communication channel to the service. throw new UnsupportedOperationException("Not yet implemented"); } // This is the old onStart method that will be called on the pre-2.0 // platform. On 2.0 or later we override onStartCommand() so this // method will not be called. @Override public void onStart(Intent intent, int startId) { //handleCommand(intent); Log.i(TAG, "onStart"); Toast.makeText(getApplicationContext(), "onStart", Toast.LENGTH_LONG).show(); } @Override public int onStartCommand(Intent intent, int flags, int startId) { Log.i(TAG, "onStartCommand"); return START_STICKY; } @Override public void onCreate() { super.onCreate(); Context cntx = getApplicationContext(); TAG = cntx.getString(R.string.log_message_tag); Log.i(TAG, "Service creating"); final Notification.Builder notificationBuilder = new Notification.Builder(getApplicationContext()) .setContentInfo("HS4") .setSmallIcon(R.drawable.icon) .setContentTitle(cntx.getString(R.string.notification_content_title)) .setContentText(cntx.getString(R.string.notification_content_text)) .setTicker(cntx.getString(R.string.notification_tiker_text)) .setSound(soundURI) .setOngoing(true) .setLargeIcon((((BitmapDrawable) this.getResources().getDrawable(R.drawable.fire_eye_alien)).getBitmap())); final NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); notificationBuilder.setWhen(System.currentTimeMillis()); mNotificationManager.notify(MY_NOTIFICATION_ID, notificationBuilder.build()); // try { // server = HttpServer.create(new InetSocketAddress(SERVERPORT), 0); // server.createContext("IS2", new IS2Handler()); // server.createContext("DSP", new DSPHandler()); // server.setExecutor(Executors.newFixedThreadPool(0x5) ); // creates a default executor // server.start(); // } catch (IOException e) { // e.printStackTrace(); // } } @Override public void onDestroy() { super.onDestroy(); Log.i(TAG, "Service destroying"); //server.stop(0x1); } //endregion //************************ }
[ "software.engineer.iust@gmail.com" ]
software.engineer.iust@gmail.com
53098309f83284a205ad407e0353383c7e4468cb
c1f41d6a3f8dd03e59b75c17e1200738827fef4c
/src/main/java/com/heliohdd/webservice/entities/Product.java
b2a4b540f2ba2b6ad325a445a8ff7fb22b7f59c6
[]
no_license
melg88/webservice-springboot2-java11
7ba3ca6b9dfad4ce2c8b3dab0485481a324c4b46
f47fbfdf1937f1720986965880fb3a121c6fec5b
refs/heads/master
2023-03-17T04:48:25.620015
2020-08-24T19:41:15
2020-08-24T19:41:15
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,647
java
package com.heliohdd.webservice.entities; import java.io.Serializable; import java.util.HashSet; import java.util.Set; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.JoinTable; import javax.persistence.ManyToMany; import javax.persistence.OneToMany; import javax.persistence.Table; import com.fasterxml.jackson.annotation.JsonIgnore; @Entity @Table(name = "tb_product") public class Product implements Serializable { private static final long serialVersionUID = 1L; @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String name; private String description; private Double price; private String imgurl; @ManyToMany @JoinTable(name = "tb_product_category", joinColumns = @JoinColumn(name = "product_id"), inverseJoinColumns = @JoinColumn(name = "category_id")) private Set<Category> categories = new HashSet<>(); @OneToMany(mappedBy = "id.product") private Set<OrderItem> items = new HashSet<>(); public Product() { } public Product(Long id, String name, String description, Double price, String imgurl) { this.id = id; this.name = name; this.description = description; this.price = price; this.imgurl = imgurl; } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public Double getPrice() { return price; } public void setPrice(Double price) { this.price = price; } public String getImgurl() { return imgurl; } public void setImgurl(String imgurl) { this.imgurl = imgurl; } public Set<Category> getCategories() { return categories; } @JsonIgnore public Set<Order> getOrders() { Set<Order> set = new HashSet<>(); for (OrderItem x : items) { set.add(x.getOrder()); } return set; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((id == null) ? 0 : id.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Product other = (Product) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; return true; } }
[ "heliohdd@yahoo.com.br" ]
heliohdd@yahoo.com.br
2a2c77d203605d1d3fc76be30d5bb3475b931b65
ddd0099df73fec4f99caa2c5fd55945be889a356
/opencga-storage/opencga-storage-hadoop/opencga-storage-hadoop-core/src/main/java/org/opencb/opencga/storage/hadoop/variant/gaps/FillGapsTask.java
a60a15bc1db76cf947b5af6af94995b8740255af
[ "Apache-2.0" ]
permissive
wbari/opencga
4772399cc6e8cd6f60d3223156e42f75d54bee00
029dccfff178be82b3037a47480d75470e2247f5
refs/heads/develop
2021-01-13T08:02:12.119657
2020-02-20T16:21:12
2020-02-20T16:21:12
72,008,355
0
0
null
2016-10-26T13:55:17
2016-10-26T13:55:17
null
UTF-8
Java
false
false
27,826
java
package org.opencb.opencga.storage.hadoop.variant.gaps; import htsjdk.variant.variantcontext.Allele; import htsjdk.variant.vcf.VCFConstants; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; import org.apache.hadoop.hbase.client.Put; import org.opencb.biodata.models.feature.Genotype; import org.opencb.biodata.models.variant.StudyEntry; import org.opencb.biodata.models.variant.Variant; import org.opencb.biodata.models.variant.VariantBuilder; import org.opencb.biodata.models.variant.avro.AlternateCoordinate; import org.opencb.biodata.models.variant.avro.FileEntry; import org.opencb.biodata.models.variant.avro.VariantType; import org.opencb.biodata.models.variant.protobuf.VariantProto; import org.opencb.biodata.models.variant.protobuf.VcfSliceProtos; import org.opencb.biodata.tools.variant.converters.proto.VcfRecordProtoToVariantConverter; import org.opencb.biodata.tools.variant.merge.VariantMerger; import org.opencb.opencga.storage.core.metadata.VariantStorageMetadataManager; import org.opencb.opencga.storage.core.metadata.models.StudyMetadata; import org.opencb.opencga.storage.core.variant.adaptors.GenotypeClass; import org.opencb.opencga.storage.hadoop.variant.GenomeHelper; import org.opencb.opencga.storage.hadoop.variant.converters.study.StudyEntryToHBaseConverter; import org.opencb.opencga.storage.hadoop.variant.index.sample.SampleIndexSchema; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.*; import java.util.stream.Collectors; import static org.opencb.opencga.storage.hadoop.variant.gaps.VariantOverlappingStatus.*; /** * Created on 15/01/18. * * @author Jacobo Coll &lt;jacobo167@gmail.com&gt; */ public class FillGapsTask { private final StudyEntryToHBaseConverter studyConverter; private final StudyMetadata studyMetadata; private final Map<Integer, LinkedHashMap<String, Integer>> fileToSamplePositions = new HashMap<>(); private Map<String, Integer> sampleIdMap = new HashMap<>(); private final VariantMerger variantMerger; // fill-gaps-when-missing-gt private final boolean skipReferenceVariants; private final boolean simplifiedNewMultiAllelicVariants; private final GenomeHelper helper; private final VariantStorageMetadataManager metadataManager; private Logger logger = LoggerFactory.getLogger(FillGapsTask.class); private boolean quiet = false; public FillGapsTask(StudyMetadata studyMetadata, GenomeHelper helper, boolean skipReferenceVariants, boolean simplifiedNewMultiAllelicVariants, VariantStorageMetadataManager metadataManager) { this.studyMetadata = studyMetadata; this.skipReferenceVariants = skipReferenceVariants; this.helper = helper; this.metadataManager = metadataManager; studyConverter = new StudyEntryToHBaseConverter(GenomeHelper.COLUMN_FAMILY_BYTES, studyMetadata.getId(), metadataManager, true, null, // Do not update release true); // Do not skip any genotype variantMerger = new VariantMerger(false).configure(studyMetadata.getVariantHeader()); this.simplifiedNewMultiAllelicVariants = simplifiedNewMultiAllelicVariants; } public FillGapsTask setQuiet(boolean quiet) { this.quiet = quiet; return this; } public VariantOverlappingStatus fillGaps(Variant variant, Set<Integer> missingSamples, Put put, List<Put> sampleIndexPuts, Integer fileId, VcfSliceProtos.VcfSlice nonRefVcfSlice, VcfSliceProtos.VcfSlice refVcfSlice) { return fillGaps(variant, missingSamples, put, sampleIndexPuts, fileId, nonRefVcfSlice, nonRefVcfSlice.getRecordsList().listIterator(), refVcfSlice, refVcfSlice.getRecordsList().listIterator()); } public VariantOverlappingStatus fillGaps(Variant variant, Set<Integer> missingSamples, Put put, List<Put> sampleIndexPuts, Integer fileId, VcfSliceProtos.VcfSlice nonRefVcfSlice, ListIterator<VcfSliceProtos.VcfRecord> nonRefIterator, VcfSliceProtos.VcfSlice refVcfSlice, ListIterator<VcfSliceProtos.VcfRecord> refIterator) { final VariantOverlappingStatus overlappingStatus; // Three scenarios: // Overlap with NO_VARIATION, // Overlap with another variant // No overlap List<Pair<VcfSliceProtos.VcfSlice, VcfSliceProtos.VcfRecord>> overlappingRecords = new ArrayList<>(1); if (nonRefVcfSlice != null) { boolean isVariantAlreadyLoaded = getOverlappingVariants(variant, fileId, nonRefVcfSlice, nonRefIterator, overlappingRecords); if (isVariantAlreadyLoaded) { return VariantOverlappingStatus.NONE; } } if (refVcfSlice != null) { boolean isVariantAlreadyLoaded = getOverlappingVariants(variant, fileId, refVcfSlice, refIterator, overlappingRecords); if (isVariantAlreadyLoaded) { String msg = "Found that the variant " + variant + " was already loaded in refVcfSlice!"; // throw new IllegalStateException(msg); logger.warn(msg); } } final VcfSliceProtos.VcfRecord vcfRecord; final VcfSliceProtos.VcfSlice vcfSlice; if (overlappingRecords.isEmpty()) { if (skipReferenceVariants) { // We are not reading reference blocks, so there gaps are expected and read as HOM_REF return null; } else { // There was a gap in the gVCF? // logger.debug("Not overlap for fileId " + fileId + " in variant " + variant); if (variant.getType().equals(VariantType.INDEL) && variant.getReference().isEmpty()) { // May happen that the variant to fill is an insertion, and there is no overlapping // Write HOM_REF genotype for this samples return processVariantFileGap(variant, missingSamples, put, fileId, "0/0"); } else { // There was a gap in the original file return processVariantFileGap(variant, missingSamples, put, fileId, GenotypeClass.UNKNOWN_GENOTYPE); } } } else if (overlappingRecords.size() > 1) { // Discard ref_blocks List<Pair<VcfSliceProtos.VcfSlice, VcfSliceProtos.VcfRecord>> realVariants = overlappingRecords .stream() .filter(pair -> pair.getRight().getType() != VariantProto.VariantType.NO_VARIATION) .collect(Collectors.toList()); if (realVariants.size() > 1) { // Check if all the variants are different versions of the same multi-allelic variant Set<String> calls = new HashSet<>(); for (Pair<VcfSliceProtos.VcfSlice, VcfSliceProtos.VcfRecord> pair : realVariants) { String call = pair.getValue().getCall(); if (call.isEmpty()) { calls.add(null); } else { calls.add(call.substring(0, call.lastIndexOf(':'))); } } // All the variants are from the same call. Select any. if (calls.size() == 1 && !calls.contains(null)) { realVariants = Collections.singletonList(realVariants.stream() .min(Comparator.comparing(pair -> pair.getValue().getCall())).get()); } } // If there is only one real variant, use it if (realVariants.size() == 1) { vcfRecord = realVariants.get(0).getRight(); vcfSlice = realVariants.get(0).getLeft(); } else { // String msg = "Found multiple overlaps for variant " + variant + " in file " + fileId; // if (!quiet) { //// throw new IllegalStateException(msg); // logger.warn(msg); // } return processMultipleOverlappings(variant, missingSamples, put, sampleIndexPuts, fileId); } } else { vcfRecord = overlappingRecords.get(0).getRight(); vcfSlice = overlappingRecords.get(0).getLeft(); } Variant archiveVariant = convertToVariant(vcfSlice, vcfRecord, fileId); if (archiveVariant.getType().equals(VariantType.NO_VARIATION)) { overlappingStatus = processReferenceOverlap(missingSamples, put, variant, archiveVariant); } else { overlappingStatus = processVariantOverlap(variant, missingSamples, put, sampleIndexPuts, archiveVariant); } return overlappingStatus; } protected VariantOverlappingStatus processReferenceOverlap(Set<Integer> missingSamples, Put put, Variant variant, Variant archiveVariant) { VariantOverlappingStatus overlappingStatus = REFERENCE; FileEntry fileEntry = archiveVariant.getStudies().get(0).getFiles().get(0); fileEntry.getAttributes().remove(VCFConstants.END_KEY); if (StringUtils.isEmpty(fileEntry.getCall())) { String alternate = archiveVariant.getAlternate(); if (alternate.isEmpty()) { alternate = Allele.NO_CALL_STRING; } fileEntry.setCall(archiveVariant.getStart() + ":" + archiveVariant.getReference() + ":" + alternate + ":0"); } // SYMBOLIC reference overlap -- <*> , <NON_REF> if (VariantType.NO_VARIATION.equals(archiveVariant.getType()) && !archiveVariant.getAlternate().isEmpty() && !archiveVariant.getAlternate().equals(Allele.NO_CALL_STRING)) { // Create template variant Variant mergedVariant = new Variant( variant.getChromosome(), variant.getStart(), variant.getEnd(), variant.getReference(), variant.getAlternate()); StudyEntry studyEntry = new StudyEntry(); studyEntry.setFormat(archiveVariant.getStudies().get(0).getFormat()); studyEntry.setSortedSamplesPosition(new LinkedHashMap<>()); studyEntry.setSamplesData(new ArrayList<>()); mergedVariant.addStudyEntry(studyEntry); mergedVariant.setType(variant.getType()); // Merge NO_VARIATION into the template variant mergedVariant = variantMerger.merge(mergedVariant, archiveVariant); // Convert study information to PUT studyConverter.convert(mergedVariant, put, missingSamples, overlappingStatus); } else { studyConverter.convert(archiveVariant, put, missingSamples, overlappingStatus); } return overlappingStatus; } protected VariantOverlappingStatus processVariantOverlap(Variant variant, Set<Integer> missingSamples, Put put, List<Put> sampleIndexPuts, Variant archiveVariant) { VariantOverlappingStatus overlappingStatus = VARIANT; Variant mergedVariant = new Variant( variant.getChromosome(), variant.getStart(), variant.getEnd(), variant.getReference(), variant.getAlternate()); StudyEntry studyEntry = new StudyEntry(); mergedVariant.addStudyEntry(studyEntry); mergedVariant.setType(variant.getType()); StudyEntry archiveStudyEntry = archiveVariant.getStudies().get(0); if (simplifiedNewMultiAllelicVariants) { if (archiveStudyEntry.getFormat().contains("GT")) { studyEntry.setFormat(Collections.singletonList("GT")); studyEntry.setSortedSamplesPosition(archiveStudyEntry.getSamplesPosition()); ArrayList<List<String>> samplesData = new ArrayList<>(archiveStudyEntry.getSamplesPosition().size()); studyEntry.setSamplesData(samplesData); studyEntry.getSecondaryAlternates().add(new AlternateCoordinate( variant.getChromosome(), variant.getStart(), variant.getEnd(), variant.getReference(), "<*>", VariantType.SYMBOLIC)); FileEntry archiveFileEntry = archiveStudyEntry.getFiles().get(0); String call = archiveFileEntry.getCall(); if (StringUtils.isEmpty(call)) { call = archiveVariant.getStart() + ":" + archiveVariant.getReference() + ":" + archiveVariant.getAlternate(); for (AlternateCoordinate secondaryAlternate : archiveStudyEntry.getSecondaryAlternates()) { call += "," + secondaryAlternate.getAlternate(); } call += ":0"; } HashMap<String, String> attributes = new HashMap<>(); archiveFileEntry.getAttributes().computeIfPresent(StudyEntry.FILTER, attributes::put); archiveFileEntry.getAttributes().computeIfPresent(StudyEntry.QUAL, attributes::put); studyEntry.setFiles(Collections.singletonList(new FileEntry(archiveFileEntry.getFileId(), call, attributes))); for (int idx = 0; idx < archiveStudyEntry.getSamplesPosition().size(); idx++) { String gt = archiveStudyEntry.getSampleData(idx).get(0); switch (gt) { case "0/0": case "0|0": case "0": break; case "1/1": gt = "2/2"; break; case "0/1": gt = "0/2"; break; case "1": gt = "2"; break; default: Genotype genotype = new Genotype(gt); int[] allelesIdx = genotype.getAllelesIdx(); for (int i = 0; i < allelesIdx.length; i++) { if (allelesIdx[i] > 0) { allelesIdx[i] = 2; } } gt = genotype.toString(); break; } samplesData.add(Collections.singletonList(gt)); } } else { studyEntry.setFormat(Collections.emptyList()); } } else { studyEntry.setSortedSamplesPosition(new LinkedHashMap<>()); studyEntry.setSamplesData(new ArrayList<>()); studyEntry.setFormat(archiveStudyEntry.getFormat()); mergedVariant = variantMerger.merge(mergedVariant, archiveVariant); } if (studyEntry.getFormatPositions().containsKey("GT")) { int samplePosition = 0; Integer gtIdx = studyEntry.getFormatPositions().get("GT"); for (String sampleName : studyEntry.getOrderedSamplesName()) { Integer sampleId = getSampleId(sampleName); if (missingSamples.contains(sampleId)) { String gt = studyEntry.getSamplesData().get(samplePosition).get(gtIdx); // Only genotypes without the main alternate (0/2, 2/3, ...) should be written as pending. if (SampleIndexSchema.validGenotype(gt) && !hasMainAlternate(gt)) { Put sampleIndexPut = buildSampleIndexPut(variant, put, sampleId, gt); sampleIndexPuts.add(sampleIndexPut); } } samplePosition++; } } studyConverter.convert(mergedVariant, put, missingSamples, overlappingStatus); return overlappingStatus; } protected VariantOverlappingStatus processVariantFileGap(Variant variant, Set<Integer> missingSamples, Put put, Integer fileId, String gt) { return processVariantFile(variant, missingSamples, put, fileId, GAP, gt); } private VariantOverlappingStatus processVariantFile(Variant variant, Set<Integer> missingSamples, Put put, Integer fileId, VariantOverlappingStatus overlappingStatus, String gt) { LinkedHashMap<String, Integer> samplePosition = getSamplePosition(fileId); List<List<String>> samplesData = new ArrayList<>(samplePosition.size()); for (int i = 0; i < samplePosition.size(); i++) { samplesData.add(Collections.singletonList(gt)); } VariantBuilder builder = Variant.newBuilder( variant.getChromosome(), variant.getStart(), variant.getEnd(), variant.getReference(), variant.getAlternate()) .setStudyId(String.valueOf(studyMetadata.getId())) .setFormat("GT") .setFileId(fileId.toString()) .setSamplesPosition(samplePosition) .setSamplesData(samplesData); studyConverter.convert(builder.build(), put, missingSamples, overlappingStatus); return overlappingStatus; } protected VariantOverlappingStatus processMultipleOverlappings(Variant variant, Set<Integer> missingSamples, Put put, List<Put> sampleIndexPuts, Integer fileId) { VariantOverlappingStatus overlappingStatus = MULTI; String gt = "2/2"; LinkedHashMap<String, Integer> samplePosition = getSamplePosition(fileId); List<List<String>> samplesData = new ArrayList<>(samplePosition.size()); for (int i = 0; i < samplePosition.size(); i++) { samplesData.add(Collections.singletonList(gt)); } for (Integer sampleId : missingSamples) { Put sampleIndexPut = buildSampleIndexPut(variant, put, sampleId, gt); sampleIndexPuts.add(sampleIndexPut); } VariantBuilder builder = Variant.newBuilder( variant.getChromosome(), variant.getStart(), variant.getEnd(), variant.getReference(), variant.getAlternate()) .addAlternate("<*>") .setStudyId(String.valueOf(studyMetadata.getId())) .setFileId(fileId.toString()) // add overlapping variants at attributes .setFormat("GT") .setSamplesPosition(samplePosition) .setSamplesData(samplesData); // processVariantOverlap(variant, missingSamples, put, sampleIndexPuts, builder.build()); studyConverter.convert(builder.build(), put, missingSamples, overlappingStatus); return overlappingStatus; } private Put buildSampleIndexPut(Variant variant, Put put, Integer sampleId, String gt) { Put sampleIndexPut = new Put( SampleIndexSchema.toRowKey(sampleId, variant.getChromosome(), variant.getStart()), put.getTimeStamp()); sampleIndexPut.addColumn(GenomeHelper.COLUMN_FAMILY_BYTES, SampleIndexSchema.toPendingColumn(variant, gt), null); return sampleIndexPut; } protected boolean hasMainAlternate(String gt) { return StringUtils.contains(gt, '1'); } public boolean getOverlappingVariants(Variant variant, int fileId, VcfSliceProtos.VcfSlice vcfSlice, ListIterator<VcfSliceProtos.VcfRecord> iterator, List<Pair<VcfSliceProtos.VcfSlice, VcfSliceProtos.VcfRecord>> overlappingRecords) { String chromosome = vcfSlice.getChromosome(); int position = vcfSlice.getPosition(); Integer resetPosition = null; boolean isAlreadyPresent = false; int firstIndex = iterator.nextIndex(); // Assume sorted VcfRecords while (iterator.hasNext()) { VcfSliceProtos.VcfRecord vcfRecord = iterator.next(); int start = VcfRecordProtoToVariantConverter.getStart(vcfRecord, position); int end = VcfRecordProtoToVariantConverter.getEnd(vcfRecord, position); String reference = vcfRecord.getReference(); String alternate = vcfRecord.getAlternate(); // If the VcfRecord starts after the variant, stop looking for variants if (overlapsWith(variant, chromosome, start, end)) { if (resetPosition == null) { resetPosition = Math.max(iterator.previousIndex() - 1, firstIndex); } // if (skipReferenceVariants && hasAllReferenceGenotype(vcfSlice, vcfRecord)) { // // Skip this variant // continue; // } // If the same variant is present for this file in the VcfSlice, the variant is already loaded if (isVariantAlreadyLoaded(variant, vcfSlice, vcfRecord, chromosome, start, end, reference, alternate)) { // Variant already loaded. Nothing to do! isAlreadyPresent = true; break; } overlappingRecords.add(ImmutablePair.of(vcfSlice, vcfRecord)); } else if (isRegionAfterVariantStart(start, end, variant)) { if (resetPosition == null) { resetPosition = Math.max(iterator.previousIndex() - 1, firstIndex); } // Shouldn't happen that the first VcfRecord from the iterator is beyond the variant to process, // and is not the first VcfRecord from the slice. // If so, there may be a bug, or the variants or the VcfSlice is not sorted if (firstIndex != 0 && firstIndex == iterator.previousIndex()) { // This should never happen throw new IllegalStateException("Variants or VcfSlice not in order!" + " First next VcfRecord from iterator (index : " + firstIndex + ") " + chromosome + ':' + start + '-' + end + ':' + reference + ':' + alternate + " is after the current variant to process for file " + fileId ); // // Something weird happened. Go back to the first position // while (iterator.hasPrevious()) { // iterator.previous(); // } // firstIndex = 0; } else { break; } } } if (resetPosition == null && !iterator.hasNext()) { // If the iterator reaches the end without finding any point, reset the iterator resetPosition = firstIndex; } // Send back the iterator if (resetPosition != null) { // logger.info("Reset from " + iterator.nextIndex() + " to " + resetPosition + ". fileId : " + fileId + " variant " + variant); while (iterator.nextIndex() > resetPosition) { iterator.previous(); } } return isAlreadyPresent; } /** * Check if this VcfRecord is already loaded in the variant that is being processed. * * If so, the variant does not have a gap for this file. Nothing to do! */ private static boolean isVariantAlreadyLoaded(Variant variant, VcfSliceProtos.VcfSlice slice, VcfSliceProtos.VcfRecord vcfRecord, String chromosome, int start, int end, String reference, String alternate) { // The variant is not loaded if is a NO_VARIATION (fast check first) if (vcfRecord.getType() == VariantProto.VariantType.NO_VARIATION) { return false; } // Check if the variant is the same if (!variant.sameGenomicVariant(new Variant(chromosome, start, end, reference, alternate))) { return false; } // If any of the genotypes is HOM_REF, the variant won't be completely loaded, so there may be a gap. return !hasAnyReferenceGenotype(slice, vcfRecord); } protected static boolean hasAnyReferenceGenotype(VcfSliceProtos.VcfSlice vcfSlice, VcfSliceProtos.VcfRecord vcfRecord) { for (VcfSliceProtos.VcfSample vcfSample : vcfRecord.getSamplesList()) { String gt = vcfSlice.getFields().getGts(vcfSample.getGtIndex()); if (isHomRefDiploid(gt)) { return true; } } return false; } public static boolean isHomRefDiploid(String gt) { return gt.equals("0/0") || gt.equals("0|0"); } protected static boolean hasAllReferenceGenotype(VcfSliceProtos.VcfSlice vcfSlice, VcfSliceProtos.VcfRecord vcfRecord) { for (VcfSliceProtos.VcfSample vcfSample : vcfRecord.getSamplesList()) { String gt = vcfSlice.getFields().getGts(vcfSample.getGtIndex()); if (!isHomRefDiploid(gt)) { return false; } } return true; } protected Variant convertToVariant(VcfSliceProtos.VcfSlice vcfSlice, VcfSliceProtos.VcfRecord vcfRecord, Integer fileId) { VcfRecordProtoToVariantConverter converter = new VcfRecordProtoToVariantConverter(vcfSlice.getFields(), getSamplePosition(fileId), fileId.toString(), studyMetadata.getName()); return converter.convert(vcfRecord, vcfSlice.getChromosome(), vcfSlice.getPosition()); } protected Integer getSampleId(String sampleName) { return sampleIdMap.computeIfAbsent(sampleName, s -> metadataManager.getSampleId(studyMetadata.getId(), sampleName)); } protected LinkedHashMap<String, Integer> getSamplePosition(Integer fileId) { return fileToSamplePositions.computeIfAbsent(fileId, missingFileId -> { LinkedHashMap<String, Integer> map = new LinkedHashMap<>(); for (Integer sampleId : metadataManager.getFileMetadata(studyMetadata.getId(), missingFileId).getSamples()) { map.put(metadataManager.getSampleName(studyMetadata.getId(), sampleId), map.size()); } return map; }); } public static boolean isRegionAfterVariantStart(int start, int end, Variant variant) { int pos = Math.min(start, end); int variantPos = Math.min(variant.getStart(), variant.getEnd()); return pos > variantPos; } public static boolean overlapsWith(Variant variant, String chromosome, int start, int end) { // return variant.overlapWith(chromosome, start, end, true); if (!StringUtils.equals(variant.getChromosome(), chromosome)) { return false; // Different Chromosome } else { return variant.getStart() <= end && variant.getEnd() >= start // Insertions in the same position won't match previous statement. || variant.getStart() == start && variant.getEnd() == end; } } }
[ "jacobo167@gmail.com" ]
jacobo167@gmail.com
27affe03c3e07537bd5a67b000c644680ca8db3b
0af8b92686a58eb0b64e319b22411432aca7a8f3
/large-multiproject/project9/src/main/java/org/gradle/test/performance9_1/Production9_54.java
cf3e76efae1f233bda776c5c0e031d683cfc4dee
[]
no_license
gradle/performance-comparisons
b0d38db37c326e0ce271abebdb3c91769b860799
e53dc7182fafcf9fedf07920cbbea8b40ee4eef4
refs/heads/master
2023-08-14T19:24:39.164276
2022-11-24T05:18:33
2022-11-24T05:18:33
80,121,268
17
15
null
2022-09-30T08:04:35
2017-01-26T14:25:33
null
UTF-8
Java
false
false
297
java
package org.gradle.test.performance9_1; public class Production9_54 extends org.gradle.test.performance7_1.Production7_54 { private final String property; public Production9_54() { this.property = "foo"; } public String getProperty() { return property; } }
[ "cedric.champeau@gmail.com" ]
cedric.champeau@gmail.com
ab564713a051aecbb11a4fba7ac883c29e635b3e
911a22ddca499080bb3fa6d4c6595c1d98378bb0
/src/Lab10/Task2/Doc.java
4590ecea727a73a470ddbbbb0ead4d600b650d69
[]
no_license
lazuta/oaip-labs-3-7-12
429584b0ebdf3753555f99a16ab9685bfdbf60da
48e24890ff2639d99cb67245bbc34d981c421296
refs/heads/master
2020-12-08T05:55:08.158968
2020-01-11T12:04:59
2020-01-11T12:04:59
232,906,704
0
0
null
null
null
null
UTF-8
Java
false
false
1,820
java
package Lab10.Task2; public class Doc extends Plant { public int maxShip; public double speedRepair; public Doc() {} public Doc(int countShip, int maxShip, int speedRepair) { this.countShip = countShip; this.maxShip = maxShip; this.speedRepair = speedRepair; } public Doc(int maxPeople, double size, double power, String street, int countShip, int maxShip, double speedRepair) { super(maxPeople, size, power, street, countShip); this.maxShip = maxShip; this.speedRepair = speedRepair; } public int getMaxShip() { return maxShip; } public void setMaxShip(int maxShip) { this.maxShip = maxShip; } public double getSpeedRepair() { return speedRepair; } public void setSpeedRepair(int speedRepair) { this.speedRepair = speedRepair; } @Override public void math2() { super.math2(); } @Override protected void income() { System.out.println((12 / maxPeople) > 1 ? ("Завод (" + street + ") функционирует прекрасно.") : ("Завод (" + street + ") несет финансовые поетри")); } @Override public String done() { return "Продукция готова. Можно отплывать."; } @Override protected double timeDone() { return super.timeDone(); } public double timeRepair() { return (countShip / speedRepair) * (super.power * 0.1); } public void repair() { super.done(); } @Override public String toString() { return "Doc{" + "countShip=" + countShip + ", maxShip=" + maxShip + ", speedRepair=" + speedRepair + '}'; } }
[ "lenya.lazuta@mail.ru" ]
lenya.lazuta@mail.ru
5dc0e8d4889890ade7891e5839f9e47cd9ebea06
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/35/35_dc7edb217183f25cc9d71e1c9d13fd4c82a4159b/LoECraftPack/35_dc7edb217183f25cc9d71e1c9d13fd4c82a4159b_LoECraftPack_t.java
8db311ac0d8112ff0d32e52a1383d8d86e0379c7
[]
no_license
zhongxingyu/Seer
48e7e5197624d7afa94d23f849f8ea2075bcaec0
c11a3109fdfca9be337e509ecb2c085b60076213
refs/heads/master
2023-07-06T12:48:55.516692
2023-06-22T07:55:56
2023-06-22T07:55:56
259,613,157
6
2
null
2023-06-22T07:55:57
2020-04-28T11:07:49
null
UTF-8
Java
false
false
6,107
java
package loecraftpack; import java.util.Iterator; import java.util.List; import loecraftpack.blocks.ColoredBedBlock; import loecraftpack.blocks.ProtectionMonolithBlock; import loecraftpack.blocks.te.ColoredBedTileEntity; import loecraftpack.blocks.te.ProtectionMonolithTileEntity; import loecraftpack.enums.Dye; import loecraftpack.items.Bits; import loecraftpack.items.ColoredBedItem; import loecraftpack.logic.handlers.EventHandler; import loecraftpack.logic.handlers.GuiHandler; import loecraftpack.packethandling.ClientPacketHandler; import loecraftpack.packethandling.ServerPacketHandler; import loecraftpack.proxies.CommonProxy; import net.minecraft.block.Block; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.IRecipe; import net.minecraftforge.common.MinecraftForge; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.Init; import cpw.mods.fml.common.Mod.Instance; import cpw.mods.fml.common.Mod.PostInit; import cpw.mods.fml.common.Mod.PreInit; import cpw.mods.fml.common.SidedProxy; import cpw.mods.fml.common.event.FMLInitializationEvent; import cpw.mods.fml.common.event.FMLPostInitializationEvent; import cpw.mods.fml.common.event.FMLPreInitializationEvent; import cpw.mods.fml.common.network.NetworkMod; import cpw.mods.fml.common.network.NetworkMod.SidedPacketHandler; import cpw.mods.fml.common.network.NetworkRegistry; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.common.registry.LanguageRegistry; @Mod(modid = "loecraftpack", name = "LoECraft Pack", version = "1.0") @NetworkMod(clientSideRequired=true, serverSideRequired=false, clientPacketHandlerSpec = @SidedPacketHandler(channels = {"loecraftpack" }, packetHandler = ClientPacketHandler.class), serverPacketHandlerSpec = @SidedPacketHandler(channels = {"loecraftpack" }, packetHandler = ServerPacketHandler.class)) public class LoECraftPack { /***************************/ /**Variable Initialization**/ /***************************/ //Create a singleton @Instance public static LoECraftPack instance = new LoECraftPack(); //Instantiate bed item variables //Register proxies @SidedProxy(clientSide = "loecraftpack.proxies.ClientProxy", serverSide = "loecraftpack.proxies.CommonProxy") public static CommonProxy proxy; //Create our own creative tab public static CreativeTabs LoECraftTab = new CreativeTabs("LoECraftTab") { //Set the icon - TODO: ADD NEW ITEM WITH CUSTOM ICON FOR USE HERE public ItemStack getIconItemStack() { return new ItemStack(Item.writableBook, 1, 0); } }; //Declare immutable items and blocks - TODO: INITIALIZE THESE IN PREINIT BASED ON CONFIG IDS public static final Bits bits = new Bits(667); public static final ColoredBedItem bedItems = new ColoredBedItem(670); public static final ProtectionMonolithBlock monolith = new ProtectionMonolithBlock(666); public static final ColoredBedBlock bedBlock = new ColoredBedBlock(670); /****************************/ /**Forge Pre-Initialization**/ /****************************/ @PreInit public void preInit(FMLPreInitializationEvent event) { /***************/ /**Load Config**/ /***************/ //TODO: LOAD CONFIG HERE /************************/ /**Initialize Variables**/ /************************/ } /************************/ /**Forge Initialization**/ /************************/ @Init public void load(FMLInitializationEvent e) { /****************************/ /**Register everything else**/ /****************************/ //Creative tab LanguageRegistry.instance().addStringLocalization("itemGroup.LoECraftTab", "LoECraft"); //Items for(int i = 0; i < Bits.names.length; i++ ) LanguageRegistry.instance().addStringLocalization("item.itemBits." + Bits.iconNames[i] + ".name", Bits.names[i]); //Blocks GameRegistry.registerBlock(monolith, "ProtectionMonolithBlock"); LanguageRegistry.addName(monolith, "Protection Monolith"); //Bed items and blocks GameRegistry.registerBlock(bedBlock, "ColoredBed"); for(int i = 0; i < ColoredBedBlock.bedTypes; i++) LanguageRegistry.instance().addStringLocalization("item.coloredBed." + Dye.values()[i] + ".name", "Bed : " + Dye.values()[i]); //Tile Entities GameRegistry.registerTileEntity(ProtectionMonolithTileEntity.class, "ProtectionMonolithTileEntity"); GameRegistry.registerTileEntity(ColoredBedTileEntity.class, "ColoredBedTileEntity"); //Handlers NetworkRegistry.instance().registerGuiHandler(this, new GuiHandler()); MinecraftForge.EVENT_BUS.register(new EventHandler()); /******************/ /**Do Proxy Stuff**/ /******************/ //Schtuff proxy.doProxyStuff(); /******************/ /**Update Recipes**/ /******************/ //get CraftingManager CraftingManager cmi = CraftingManager.getInstance(); //locate and remove old bed recipe List recipes = cmi.getRecipeList(); Iterator r = recipes.iterator(); while (r.hasNext()) { IRecipe ir = (IRecipe)r.next(); //if the recipe outputs a bed, remove it if(ir.getRecipeOutput() != null && ir.getRecipeOutput().itemID == Item.bed.itemID ) { r.remove(); break; //there really should only be one vanilla bed to remove, so stop once we find it } } //add the new bed recipes to replace the old one we just removed for (int i = 0; i < 16; i++) { cmi.addRecipe(new ItemStack(bedItems, 1, i), "###", "XXX", '#', new ItemStack(Block.cloth, 1, i), 'X', Block.planks); } } /*****************************/ /**Forge Post-Initialization**/ /*****************************/ @PostInit public void postLoad(FMLPostInitializationEvent e) { //TODO: POST-LOAD STUFF } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
259a6a4624a9c87a0b4847b747620e4d2005bc9b
06bdc1904ed42e0d6845254dd841f115e336aaeb
/java/com/yangchd/design/structural/adapter/interadapter/SourceSub2.java
e962a55fc4d0b2aba554ee45c4343da48ee2c729
[]
no_license
yangchd/DesignPattern
5b7a1a786589e909cb0dc1365ebdd2e6c992b283
2329645ac7faee8a6f4f9ad6947a15fe9ca3e0e0
refs/heads/master
2021-04-12T02:51:26.667372
2018-06-21T07:55:05
2018-06-21T07:55:05
125,796,191
2
0
null
null
null
null
UTF-8
Java
false
false
262
java
package com.yangchd.design.structural.adapter.interadapter; /** * @author yangchd 2018/3/20. */ public class SourceSub2 extends Wrapper { @Override public void method2(){ System.out.println("the SourceAble interface's second Sub2!"); } }
[ "yangchd@yonyou.com" ]
yangchd@yonyou.com
ddcceb45139df99af6e216a5e49e8015a10fa26a
e574b6fd86a046960b61569bd4b7df76b815f4ed
/blueprint2/blueprint2-swing/src/ananas/lib/blueprint2/swing/JListWrapper.java
497b74c81d0b81c484a2c0e1ef5052bb750b876e
[]
no_license
xukun-glc/blueprint
2bf1777576dd0a2e06ac856cef7434625733720e
afa460607a6a279252595cbb9d18c48dc2838324
refs/heads/master
2021-05-31T03:19:46.780922
2015-12-02T03:10:52
2015-12-02T03:10:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
95
java
package ananas.lib.blueprint2.swing; public class JListWrapper extends JComponentWrapper { }
[ "xukun17@sina.com" ]
xukun17@sina.com
933a020377543fbfcd774283bf2f3e5bbe07f016
eaae18539fef63104faf926e88f4e39721cc313b
/src/Romanenko/PR13.1/src/EdgeWeightedGraph.java
78b6da850094842f2c1baea655ca46e641ea415b
[]
no_license
anneteka/OKAlabs
e83977d9f58f93ce3c985584e45330b7d7d06b2b
44c1215cf90117ea15e8db0035adcab895a0a970
refs/heads/master
2020-04-09T15:10:40.869208
2018-12-20T22:05:53
2018-12-20T22:05:53
160,418,193
2
8
null
null
null
null
UTF-8
Java
false
false
2,988
java
import java.util.Stack; import ua.princeton.lib.In; import ua.princeton.lib.StdRandom; public class EdgeWeightedGraph { private static final String NEWLINE = System.getProperty("line.separator"); private final int V; private int E; private Bag<Edge>[] adj; public EdgeWeightedGraph(int V) { if (V < 0) throw new IllegalArgumentException( "Number of vertices must be nonnegative"); this.V = V; this.E = 0; adj = (Bag<Edge>[]) new Bag[V]; for (int v = 0; v < V; v++) { adj[v] = new Bag<Edge>(); } } public EdgeWeightedGraph(int V, int E) { this(V); if (E < 0) throw new IllegalArgumentException( "Number of edges must be nonnegative"); for (int i = 0; i < E; i++) { int v = StdRandom.uniform(V); int w = StdRandom.uniform(V); double weight = Math.round(100 * StdRandom.uniform()) / 100.0; Edge e = new Edge(v, w, weight); addEdge(e); } } public EdgeWeightedGraph(In in) { this(in.readInt()); int E = in.readInt(); if (E < 0) throw new IllegalArgumentException( "Number of edges must be nonnegative"); for (int i = 0; i < E; i++) { int v = in.readInt() - 1; int w = in.readInt() - 1; double weight = in.readDouble(); Edge e = new Edge(v, w, weight); addEdge(e); } } public EdgeWeightedGraph(int Ed, Point[] m) { this(Ed); for (int i = 0; i < m.length; i++) { for (int j = i + 1; j < m.length; j++) { Edge e = new Edge(i, j, Point.lengthEdge(m[i], m[j])); addEdge(e); } } } public EdgeWeightedGraph(EdgeWeightedGraph G) { this(G.V()); this.E = G.E(); for (int v = 0; v < G.V(); v++) { // reverse so that adjacency list is in same order as original Stack<Edge> reverse = new Stack<Edge>(); for (Edge e : G.adj[v]) { reverse.push(e); } for (Edge e : reverse) { adj[v].add(e); } } } public int V() { return V; } public int E() { return E; } private void validateVertex(int v) { if (v < 0 || v >= V) throw new IndexOutOfBoundsException("vertex " + v + " is not between 0 and " + (V - 1)); } public void addEdge(Edge e) { int v = e.either(); int w = e.other(v); validateVertex(v); validateVertex(w); adj[v].add(e); adj[w].add(e); E++; } public Iterable<Edge> adj(int v) { validateVertex(v); return adj[v]; } public int degree(int v) { validateVertex(v); return adj[v].size(); } public Iterable<Edge> edges() { Bag<Edge> list = new Bag<Edge>(); for (int v = 0; v < V; v++) { int selfLoops = 0; for (Edge e : adj(v)) { if (e.other(v) > v) { list.add(e); } else if (e.other(v) == v) { if (selfLoops % 2 == 0) list.add(e); selfLoops++; } } } return list; } public String toString() { StringBuilder s = new StringBuilder(); s.append(V + " " + E + NEWLINE); for (int v = 0; v < V; v++) { s.append(v + ": "); for (Edge e : adj[v]) { s.append(e + " "); } s.append(NEWLINE); } return s.toString(); } }
[ "a.karlysheva@ukma.edu.ua" ]
a.karlysheva@ukma.edu.ua
76c81a0eef03f88b7032605fbd6727e30ed0daa3
f34de2a487f3a1502e2e416527ee0d353d3c6a09
/SwrveSDKTest/src/test/java/com/swrve/sdk/CampaignDeliveryManagerTest.java
02fd29aae1ef9a434338672c017eaa60d857345c
[ "Apache-2.0", "LicenseRef-scancode-unknown-license-reference" ]
permissive
Swrve/swrve-android-sdk
9b30dbbb30cfc77496ac0e11707cf0a945a19c05
aa75649067d5279eacec58945981c15eb96a7816
refs/heads/release-7_4_0
2023-07-10T16:11:32.904541
2020-12-14T10:52:52
2020-12-14T10:52:52
23,786,714
13
28
NOASSERTION
2021-01-11T16:30:19
2014-09-08T10:24:14
Java
UTF-8
Java
false
false
11,836
java
package com.swrve.sdk; import android.content.Context; import androidx.work.BackoffPolicy; import androidx.work.Data; import androidx.work.ListenableWorker; import androidx.work.NetworkType; import androidx.work.OneTimeWorkRequest; import androidx.work.impl.model.WorkSpec; import com.swrve.sdk.localstorage.SQLiteLocalStorage; import com.swrve.sdk.rest.IRESTClient; import com.swrve.sdk.rest.RESTResponse; import org.junit.Test; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import static com.swrve.sdk.CampaignDeliveryManager.KEY_BODY; import static com.swrve.sdk.CampaignDeliveryManager.KEY_END_POINT; import static com.swrve.sdk.CampaignDeliveryManager.MAX_ATTEMPTS; import static com.swrve.sdk.CampaignDeliveryManager.REST_CLIENT_TIMEOUT_MILLIS; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertTrue; import static org.mockito.Matchers.any; import static org.mockito.Matchers.anyInt; import static org.mockito.Matchers.anyString; import static org.mockito.Mockito.atLeastOnce; import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; public class CampaignDeliveryManagerTest extends SwrveBaseTest { private String testEndpoint = "https://someendpoint.com"; // @formatter:off private String testEvent = "{" + "\"type\":\"generic_campaign_event\"," + "\"time\":123," + "\"seqnum\":1," + "\"actionType\":\"delivered\"," + "\"campaignType\":\"push\"," + "\"id\":\"1\"," + "\"payload\":{" + "\"silent\":\"false\"" + "}" + "}"; private String testBatchEvent = "{" + "\"session_token\":\"some_session_key\"," + "\"version\":\"3\"," + "\"app_version\":\"some_app_version\"," + "\"unique_device_id\":\"some_device_id\"," + "\"data\":" + "[" + testEvent + "]" + "}"; // @formatter:on @Test public void testPostBadData() { CampaignDeliveryManager deliveryManagerSpy = spy(new CampaignDeliveryManager(mActivity)); IRESTClient mockRestClient = mock(IRESTClient.class); doReturn(mockRestClient).when(deliveryManagerSpy).getRestClient(REST_CLIENT_TIMEOUT_MILLIS); Data invalidInputData = new Data.Builder().build(); ListenableWorker.Result result = deliveryManagerSpy.post(invalidInputData, 0); verify(mockRestClient, never()).post(anyString(), anyString(), any(CampaignDeliveryManager.RESTResponseListener.class)); assertEquals(ListenableWorker.Result.failure(), result); // default result is failure } @Test public void testPostMaxedAttempts() { CampaignDeliveryManager deliveryManagerSpy = spy(new CampaignDeliveryManager(mActivity)); IRESTClient mockRestClient = mock(IRESTClient.class); doReturn(mockRestClient).when(deliveryManagerSpy).getRestClient(REST_CLIENT_TIMEOUT_MILLIS); Data invalidInputData = new Data.Builder().build(); ListenableWorker.Result result = deliveryManagerSpy.post(invalidInputData, 3); verify(mockRestClient, never()).post(anyString(), anyString(), any(CampaignDeliveryManager.RESTResponseListener.class)); assertEquals(ListenableWorker.Result.failure(), result); // default result is failure } @Test public void testPost() { int runAttempt = 0; int runNumber = 1; CampaignDeliveryManager deliveryManagerSpy = spy(new CampaignDeliveryManager(mActivity)); IRESTClient mockRestClient = mock(IRESTClient.class); doReturn(mockRestClient).when(deliveryManagerSpy).getRestClient(REST_CLIENT_TIMEOUT_MILLIS); CampaignDeliveryManager.RESTResponseListener restResponseListener = deliveryManagerSpy.new RESTResponseListener(runNumber, testBatchEvent); doReturn(restResponseListener).when(deliveryManagerSpy).getRestResponseListener(runNumber, testBatchEvent); Data inputData = new Data.Builder() .putString(KEY_END_POINT, testEndpoint) .putString(KEY_BODY, testBatchEvent) .build(); ListenableWorker.Result result = deliveryManagerSpy.post(inputData, runAttempt); verify(mockRestClient, atLeastOnce()).post(testEndpoint, testBatchEvent, restResponseListener); assertEquals(ListenableWorker.Result.failure(), result); // default result is failure } @Test public void testPostWithRunNumber() { int runAttempt = 1; int runNumber = 2; CampaignDeliveryManager deliveryManagerSpy = spy(new CampaignDeliveryManager(mActivity)); IRESTClient mockRestClient = mock(IRESTClient.class); doReturn(mockRestClient).when(deliveryManagerSpy).getRestClient(REST_CLIENT_TIMEOUT_MILLIS); CampaignDeliveryManager.RESTResponseListener restResponseListener = deliveryManagerSpy.new RESTResponseListener(runNumber, testBatchEvent); doReturn(restResponseListener).when(deliveryManagerSpy).getRestResponseListener(anyInt(), anyString()); // post with testBatchEvent which does not contain a runNumber. The verify method checks that mockRestClient is called with json that contains runNumber Data inputData = new Data.Builder() .putString(KEY_END_POINT, testEndpoint) .putString(KEY_BODY, testBatchEvent) .build(); ListenableWorker.Result result = deliveryManagerSpy.post(inputData, runAttempt); // Below event is same as testBatchEvent but with runNumber:2 in the payload of the event String expectedBatchEventWithRunNumber = "{\"session_token\":\"some_session_key\",\"version\":\"3\",\"app_version\":\"some_app_version\",\"unique_device_id\":\"some_device_id\",\"data\":[{\"type\":\"generic_campaign_event\",\"time\":123,\"seqnum\":1,\"actionType\":\"delivered\",\"campaignType\":\"push\",\"id\":\"1\",\"payload\":{\"silent\":\"false\",\"runNumber\":2}}]}"; verify(mockRestClient, atLeastOnce()).post(testEndpoint, expectedBatchEventWithRunNumber, restResponseListener); assertEquals(ListenableWorker.Result.failure(), result); // default result is failure } @Test public void testRESTResponseListenerSuccess() { CampaignDeliveryManager deliveryManagerSpy = spy(new CampaignDeliveryManager(mActivity)); CampaignDeliveryManager.RESTResponseListener restResponseListenerSpy = spy(deliveryManagerSpy.new RESTResponseListener(1, testBatchEvent)); RESTResponse successRestResponse = new RESTResponse(200, "", null); restResponseListenerSpy.onResponse(successRestResponse); assertEquals(ListenableWorker.Result.success(), restResponseListenerSpy.result); verify(deliveryManagerSpy, never()).saveEvent(anyString(), anyInt()); verify(deliveryManagerSpy, atLeastOnce()).sendQaEvent(testBatchEvent); } @Test public void testRESTResponseListenerUserError() { CampaignDeliveryManager deliveryManagerSpy = spy(new CampaignDeliveryManager(mActivity)); CampaignDeliveryManager.RESTResponseListener restResponseListenerSpy = spy(deliveryManagerSpy.new RESTResponseListener(1, testBatchEvent)); RESTResponse successRestResponse = new RESTResponse(400, "", null); restResponseListenerSpy.onResponse(successRestResponse); assertEquals(ListenableWorker.Result.failure(), restResponseListenerSpy.result); verify(deliveryManagerSpy, never()).saveEvent(anyString(), anyInt()); } @Test public void testRESTResponseListenerServerError() { CampaignDeliveryManager deliveryManagerSpy = spy(new CampaignDeliveryManager(mActivity)); CampaignDeliveryManager.RESTResponseListener restResponseListenerSpy = spy(deliveryManagerSpy.new RESTResponseListener(1, testBatchEvent)); RESTResponse successRestResponse = new RESTResponse(501, "", null); restResponseListenerSpy.onResponse(successRestResponse); assertEquals(ListenableWorker.Result.retry(), restResponseListenerSpy.result); verify(deliveryManagerSpy, never()).saveEvent(anyString(), anyInt()); } @Test public void testRESTResponseListenerServerErrorMax() { SwrveSDK.createInstance(mActivity.getApplication(), 1, "apiKey"); CampaignDeliveryManager deliveryManagerSpy = spy(new CampaignDeliveryManager(mActivity)); for(int runNumber = 1; runNumber < 4; runNumber ++) { CampaignDeliveryManager.RESTResponseListener restResponseListenerSpy = spy(deliveryManagerSpy.new RESTResponseListener(runNumber, testBatchEvent)); RESTResponse successRestResponse = new RESTResponse(501, "", null); restResponseListenerSpy.onResponse(successRestResponse); if(runNumber == MAX_ATTEMPTS) { assertEquals(ListenableWorker.Result.failure(), restResponseListenerSpy.result); } else { assertEquals(ListenableWorker.Result.retry(), restResponseListenerSpy.result); } } verify(deliveryManagerSpy, atLeastOnce()).saveEvent(testBatchEvent, MAX_ATTEMPTS + 1); SQLiteLocalStorage localStorage = new SQLiteLocalStorage(mActivity, SwrveSDK.getConfig().getDbName(), SwrveSDK.getConfig().getMaxSqliteDbSize()); LinkedHashMap<Long, String> eventsStored = localStorage.getFirstNEvents(50, SwrveSDK.getUserId()); // The runNumber is now 4 when saved to db String testEventWithRunNumber4 = "{\"type\":\"generic_campaign_event\",\"time\":123,\"seqnum\":1,\"actionType\":\"delivered\",\"campaignType\":\"push\",\"id\":\"1\",\"payload\":{\"silent\":\"false\",\"runNumber\":4}}"; assertTrue(eventsStored.containsValue(testEventWithRunNumber4)); } @Test public void testGetRestWorkRequest() { CampaignDeliveryManager deliveryManagerSpy = spy(new CampaignDeliveryManager(mActivity)); OneTimeWorkRequest workRequest = deliveryManagerSpy.getRestWorkRequest(testEndpoint, testBatchEvent); WorkSpec workSpec = workRequest.getWorkSpec(); assertEquals(NetworkType.CONNECTED, workSpec.constraints.getRequiredNetworkType()); assertEquals(testEndpoint, workSpec.input.getString(KEY_END_POINT)); assertEquals(testBatchEvent, workSpec.input.getString(KEY_BODY)); assertEquals(BackoffPolicy.LINEAR, workSpec.backoffPolicy); assertEquals(10000, workSpec.backoffDelayDuration); } @Test public void testSendCampaignDelivery() { CampaignDeliveryManager deliveryManagerSpy = spy(new CampaignDeliveryManager(mActivity)); doNothing().when(deliveryManagerSpy).enqueueWorkRequest(any(Context.class), any(OneTimeWorkRequest.class)); deliveryManagerSpy.sendCampaignDelivery(testEndpoint, testBatchEvent); verify(deliveryManagerSpy, atLeastOnce()).getRestWorkRequest(testEndpoint, testBatchEvent); verify(deliveryManagerSpy, atLeastOnce()).enqueueWorkRequest(any(Context.class), any(OneTimeWorkRequest.class)); } @Test public void testSendQaEvent() throws Exception { QaUser qaUserMock = mock(QaUser.class); QaUser.instance = qaUserMock; CampaignDeliveryManager deliveryManager = new CampaignDeliveryManager(mActivity); deliveryManager.sendQaEvent(testBatchEvent); List expectedEvents = new ArrayList(); expectedEvents.add(testEvent); verify(qaUserMock, atLeastOnce())._wrappedEvents(expectedEvents); } }
[ "dominic.marmion@swrve.com" ]
dominic.marmion@swrve.com
693cb61eb55cd2eff69d6df345913997c569b1e8
d84da35a28d4a573003120df2bfef12941afec37
/Back-end/Cielo_APIs/API's e Documentos Técnicos/Materiais Técnicos/lojaexemplo/web/src/test/java/br/com/cbmp/ecommerce/integrado/PedidoAutorizacaoDiretaIntegrationTest.java
6e8409b141e6dd7fae6cd06e9cd7a92f806edfcd
[]
no_license
AEDB-Solutions/iRU
fa261262b9d5375f56635b271533ba86871d5bfa
ffd6eb86cf6df2367ab20b3d76082a7829fa77b3
refs/heads/master
2021-06-21T18:19:26.984555
2017-07-03T17:17:23
2017-07-03T17:17:23
86,620,919
0
1
null
null
null
null
UTF-8
Java
false
false
1,880
java
package br.com.cbmp.ecommerce.integrado; import java.math.BigDecimal; import br.com.cbmp.ecommerce.BaseTestCase; import br.com.cbmp.ecommerce.pedido.Bandeira; import br.com.cbmp.ecommerce.pedido.Cartao; import br.com.cbmp.ecommerce.pedido.FormaPagamento; import br.com.cbmp.ecommerce.pedido.Modalidade; import br.com.cbmp.ecommerce.pedido.Pedido; import br.com.cbmp.ecommerce.pedido.Produto; import br.com.cbmp.ecommerce.resposta.FalhaComunicaoException; import br.com.cbmp.ecommerce.util.Produtos; public class PedidoAutorizacaoDiretaIntegrationTest extends BaseTestCase { public static void main(String[] args) throws FalhaComunicaoException { final PedidoAutorizacaoDiretaIntegrationTest teste = new PedidoAutorizacaoDiretaIntegrationTest(); int nuThreads = 10; Thread [] threads = new Thread[nuThreads]; for (int i = 0; i < nuThreads; i++) { threads[i] = new Thread(new Runnable() { public void run() { try { teste.testAutorizacaoDireta(); } catch (FalhaComunicaoException e) { } }}); } for (int i = 0; i < nuThreads; i++) { try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println(i + " iniciado"); threads[i].start(); } } public void testAutorizacaoDireta() throws FalhaComunicaoException { FormaPagamento formaPagamento = new FormaPagamento(Modalidade.CREDITO_A_VISTA, 1, Bandeira.ELO); Produto produto = Produtos.todos().iterator().next(); produto = new Produto(11, "produto caro", "10000"); Pedido pedido = new Pedido(produto, formaPagamento); Cartao cartao = new Cartao("6362970000457013", "201501", "123", "123098312837h0982n09sdas09sd809sadasd809"); pedido.setCartao(cartao); pedido.finalizarComAutorizacaoDireta(); //pedido.criarTransacao(); getLogger().info(pedido.getTransacao()); } }
[ "gabrielaraujotigre@hotmail.com" ]
gabrielaraujotigre@hotmail.com
0fa6c7eda296bb8de739f8c2f8bca172f4f5a7f6
c5555faa88fd7966b94aa21ed9eb04546adc2da8
/Abbatia/src/main/java/org/abbatia/bean/Monje.java
1f41fb4694d22bfb7c7cf2e3c440572967f90a19
[]
no_license
MundakaZgz/abbatia
5a8ef7a865b6854208102001f23c94572f5477e1
867987b1af95ca36c9bba4aecdb93d329b644420
refs/heads/master
2023-06-26T02:01:42.129283
2022-06-04T22:39:57
2022-06-04T22:39:57
175,499,064
0
1
null
2023-06-14T20:23:41
2019-03-13T21:06:43
Java
ISO-8859-1
Java
false
false
32,090
java
/*********************************************************************** * Module: Monje.java * Author: Benja & John * Purpose: Defines the Class Monje ***********************************************************************/ package org.abbatia.bean; import java.io.Serializable; import java.util.ArrayList; import java.util.Hashtable; public class Monje extends MonjeBase implements Serializable { private String fechaDeNacimiento; private String fechaDeFallecimiento; private String fechaDeEntradaEnAbadia; private int siguienteID; private int anteriorID; private int estado; // 0 - vivo, 1 - muerto ( velatorio ), 2 - enfermo, 3 - viaje private String jerarquia; private int idDeAbadia_Visita; private int idDeEspecializacion; private short santo; private short nivelAbadia; // Descripcion de abbatia y region solo para enseñarlo desde otra abbatia private String abadia; private String region; // Alimentación del monje private short comeFamiliaID1; private short comeFamiliaID2; private short comeFamiliaID3; private short comeFamiliaID4; private short comeFamiliaID5; private short ha_comidoFamiliaID1; private short ha_comidoFamiliaID2; private short ha_comidoFamiliaID3; private short ha_comidoFamiliaID4; private short ha_comidoFamiliaID5; //Datos de Actividades // Actividades del monje private short actMaitines; private short actLaudes; private short actPrima; private short actTercia; private short actSexta; private short actNona; private short actVispera; private short actAngelus; private short actMaitines_completado; private short actMaitines_bloqueado; private String actMaitines_link; private short actLaudes_completado; private short actLaudes_bloqueado; private String actLaudes_link; private short actPrima_completado; private short actPrima_bloqueado; private String actPrima_link; private short actTercia_completado; private short actTercia_bloqueado; private String actTercia_link; private short actSexta_completado; private short actSexta_bloqueado; private String actSexta_link; private short actNona_completado; private short actNona_bloqueado; private String actNona_link; private short actVispera_completado; private short actVispera_bloqueado; private String actVispera_link; private short actAngelus_completado; private short actAngelus_bloqueado; private String actAngelus_link; private Enfermedad enfermedad; private short proteinas; private short lipidos; private short hidratosCarbono; private short vitaminas; private short ant_proteinas; private short ant_lipidos; private short ant_hidratosCarbono; private short ant_vitaminas; private short salud; private String barra_proteinas; private String barra_lipidos; private String barra_hidratosCarbono; private String barra_vitaminas; private String barra_salud; // Habilidades private String barra_idioma; private String barra_fe; private String barra_fuerza; private String barra_destreza; private String barra_talento; private String barra_sabiduria; private String barra_carisma; private String barra_popularidad; private int fe = 0; private int idioma = 0; private int talento = 0; private int sabiduria = 0; private int fuerza = 0; private int carisma = 0; private int destreza = 0; private int popularidad = 0; // Propiedad id:27 private String fechaDeUltimaComida; private String fechallegada; private String HTMLEnfermedad = ""; private int nivelEnfermedad = 0; private short edad; // Listas private ArrayList<Habilidad> habilidadesDeLosMonjes; private Hashtable habilidadesDeLosMonjesHT; private ArrayList<Propiedad> propiedadesDeLosMonjes; private Hashtable propiedadesDeLosMonjesHT; private ArrayList<TareasDelMonje> tareasDelMonje; private Hashtable tareasDelMonjeHT; private ArrayList mensajesMonje; private Hashtable mensajesMonjeHT; private String imgProteinas_eval; private String imgLipidos_eval; private String imgHidratos_eval; private String imgVitaminas_eval; private String imgSalud_eval; private int puntosMonje; private String nombreCompuesto; public Monje(int p_iIdMonje) { super(p_iIdMonje); } public Monje() { super(); } public short getSanto() { return santo; } public void setSanto(short santo) { this.santo = santo; } public int getNivelEnfermedad() { return nivelEnfermedad; } public void setNivelEnfermedad(int nivelEnfermedad) { this.nivelEnfermedad = nivelEnfermedad; } public Enfermedad getEnfermedad() { return enfermedad; } public void setEnfermedad(Enfermedad enfermedad) { this.enfermedad = enfermedad; } public short getActMaitines_bloqueado() { return actMaitines_bloqueado; } public void setActMaitines_bloqueado(short actMaitines_bloqueado) { this.actMaitines_bloqueado = actMaitines_bloqueado; } public short getActLaudes_bloqueado() { return actLaudes_bloqueado; } public void setActLaudes_bloqueado(short actLaudes_bloqueado) { this.actLaudes_bloqueado = actLaudes_bloqueado; } public short getActPrima_bloqueado() { return actPrima_bloqueado; } public void setActPrima_bloqueado(short actPrima_bloqueado) { this.actPrima_bloqueado = actPrima_bloqueado; } public short getActTercia_bloqueado() { return actTercia_bloqueado; } public void setActTercia_bloqueado(short actTercia_bloqueado) { this.actTercia_bloqueado = actTercia_bloqueado; } public short getActSexta_bloqueado() { return actSexta_bloqueado; } public void setActSexta_bloqueado(short actSexta_bloqueado) { this.actSexta_bloqueado = actSexta_bloqueado; } public short getActNona_bloqueado() { return actNona_bloqueado; } public void setActNona_bloqueado(short actNona_bloqueado) { this.actNona_bloqueado = actNona_bloqueado; } public short getActVispera_bloqueado() { return actVispera_bloqueado; } public void setActVispera_bloqueado(short actVispera_bloqueado) { this.actVispera_bloqueado = actVispera_bloqueado; } public short getActAngelus_bloqueado() { return actAngelus_bloqueado; } public void setActAngelus_bloqueado(short actAngelus_bloqueado) { this.actAngelus_bloqueado = actAngelus_bloqueado; } public String getActMaitines_link() { return actMaitines_link; } public void setActMaitines_link(String actMaitines_link) { this.actMaitines_link = actMaitines_link; } public String getActLaudes_link() { return actLaudes_link; } public void setActLaudes_link(String actLaudes_link) { this.actLaudes_link = actLaudes_link; } public String getActPrima_link() { return actPrima_link; } public void setActPrima_link(String actPrima_link) { this.actPrima_link = actPrima_link; } public String getActTercia_link() { return actTercia_link; } public void setActTercia_link(String actTercia_link) { this.actTercia_link = actTercia_link; } public String getActSexta_link() { return actSexta_link; } public void setActSexta_link(String actSexta_link) { this.actSexta_link = actSexta_link; } public String getActNona_link() { return actNona_link; } public void setActNona_link(String actNona_link) { this.actNona_link = actNona_link; } public String getActVispera_link() { return actVispera_link; } public void setActVispera_link(String actVispera_link) { this.actVispera_link = actVispera_link; } public String getActAngelus_link() { return actAngelus_link; } public void setActAngelus_link(String actAngelus_link) { this.actAngelus_link = actAngelus_link; } // -------------------------------------------------------------------------- // Fecha de Nacimiento // -------------------------------------------------------------------------- public void setFechaDeNacimiento(String newFechaDeNacimiento) { this.fechaDeNacimiento = newFechaDeNacimiento; } public String getFechaDeNacimiento() { return this.fechaDeNacimiento; } // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Fecha de Llegada // -------------------------------------------------------------------------- public String getFechallegada() { return fechallegada; } public void setFechallegada(String fechallegada) { this.fechallegada = fechallegada; } // -------------------------------------------------------------------------- // Fecha de Entrada en Abadía // -------------------------------------------------------------------------- public void setFechaDeEntradaEnAbadia(String newFechaDeEntradaEnAbadia) { this.fechaDeEntradaEnAbadia = newFechaDeEntradaEnAbadia; } public String getFechaDeEntradaEnAbadia() { return this.fechaDeEntradaEnAbadia; } // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Proteínas // -------------------------------------------------------------------------- public void setProteinas(short newProteinas) { if (newProteinas > 60) this.proteinas = 60; else if (newProteinas < 0) this.proteinas = 0; else this.proteinas = newProteinas; } public short getProteinas() { return this.proteinas; } // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Lípidos // -------------------------------------------------------------------------- public void setLipidos(short newLipidos) { if (newLipidos > 60) this.lipidos = 60; else if (newLipidos < 0) this.lipidos = 0; else this.lipidos = newLipidos; } public short getLipidos() { return this.lipidos; } // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Hidratos Carbono // -------------------------------------------------------------------------- public void setHidratosCarbono(short newHidratosCarbono) { if (newHidratosCarbono > 60) this.hidratosCarbono = 60; else if (newHidratosCarbono < 0) this.hidratosCarbono = 0; else this.hidratosCarbono = newHidratosCarbono; } public short getHidratosCarbono() { return this.hidratosCarbono; } // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Vitaminas // -------------------------------------------------------------------------- public void setVitaminas(short newVitaminas) { if (newVitaminas > 60) this.vitaminas = 60; else if (newVitaminas < 0) this.vitaminas = 0; else this.vitaminas = newVitaminas; } public short getVitaminas() { return this.vitaminas; } // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Asociacion A: ID de Especialización // -------------------------------------------------------------------------- public void setIdDeEspecializacion(int newIdDeEspecializacion) { this.idDeEspecializacion = newIdDeEspecializacion; } public int getIdDeEspecializacion() { return this.idDeEspecializacion; } // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Asociacion Link B: Habilidades de los Monjes - Habilidades de los Monjes // -------------------------------------------------------------------------- public ArrayList<Habilidad> getHabilidadesDeLosMonjes() { return habilidadesDeLosMonjes; } public void setHabilidadesDeLosMonjes(ArrayList<Habilidad> habilidadesDeLosMonjes) { this.habilidadesDeLosMonjes = habilidadesDeLosMonjes; } public Hashtable getHabilidadesDeLosMonjesHT() { return habilidadesDeLosMonjesHT; } public void setHabilidadesDeLosMonjesHT(Hashtable habilidadesDeLosMonjesHT) { this.habilidadesDeLosMonjesHT = habilidadesDeLosMonjesHT; } public void addHabilidad(Habilidad habilidad) { if (this.habilidadesDeLosMonjes == null) this.habilidadesDeLosMonjes = new ArrayList<Habilidad>(); this.habilidadesDeLosMonjes.add(habilidad); } public boolean removeHabilidad(Habilidad habilidad) { if (this.habilidadesDeLosMonjes != null) return this.habilidadesDeLosMonjes.remove(habilidad); return false; } // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Asociacion Link B: Propiedades de los Monjes // -------------------------------------------------------------------------- public ArrayList<Propiedad> getPropiedadesDeLosMonjes() { return propiedadesDeLosMonjes; } public void setPropiedadesDeLosMonjes(ArrayList<Propiedad> propiedadesDeLosMonjes) { this.propiedadesDeLosMonjes = propiedadesDeLosMonjes; } public Hashtable getPropiedadesDeLosMonjesHT() { return propiedadesDeLosMonjesHT; } public void setPropiedadesDeLosMonjesHT(Hashtable propiedadesDeLosMonjesHT) { this.propiedadesDeLosMonjesHT = propiedadesDeLosMonjesHT; } public void addPropiedad(Propiedad propiedad) { if (this.propiedadesDeLosMonjes == null) this.propiedadesDeLosMonjes = new ArrayList<Propiedad>(); this.propiedadesDeLosMonjes.add(propiedad); } public boolean removePropiedad(Propiedad propiedad) { return this.propiedadesDeLosMonjes != null && this.propiedadesDeLosMonjes.remove(propiedad); } // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Asociacion Link B: Tareas del Monje // -------------------------------------------------------------------------- public ArrayList<TareasDelMonje> getTareasDelMonje() { return tareasDelMonje; } public void setTareasDelMonje(ArrayList<TareasDelMonje> tareasDelMonje) { this.tareasDelMonje = tareasDelMonje; } public Hashtable getTareasDelMonjeHT() { return tareasDelMonjeHT; } public void setTareasDelMonjeHT(Hashtable tareasDelMonjeHT) { this.tareasDelMonjeHT = tareasDelMonjeHT; } public void addTareasDelMonje(TareasDelMonje tareasDelMonje) { if (this.tareasDelMonje == null) this.tareasDelMonje = new ArrayList<TareasDelMonje>(); this.tareasDelMonje.add(tareasDelMonje); } public boolean removeTareasDelMonje(TareasDelMonje tareasDelMonje) { return this.tareasDelMonje != null && this.tareasDelMonje.remove(tareasDelMonje); } // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Asociacion Link B: Mensajes Monje // -------------------------------------------------------------------------- public ArrayList getMensajesMonje() { return mensajesMonje; } public void setMensajesMonje(ArrayList<Table> mensajesMonje) { this.mensajesMonje = mensajesMonje; } public Hashtable getMensajesMonjeHT() { return mensajesMonjeHT; } public short getComeFamiliaID5() { return comeFamiliaID5; } public short getSalud() { return salud; } public short getComeFamiliaID1() { return comeFamiliaID1; } public short getComeFamiliaID4() { return comeFamiliaID4; } public short getComeFamiliaID3() { return comeFamiliaID3; } public short getComeFamiliaID2() { return comeFamiliaID2; } public String getFechaDeUltimaComida() { return fechaDeUltimaComida; } public void setMensajesMonjeHT(Hashtable mensajesMonjeHT) { this.mensajesMonjeHT = mensajesMonjeHT; } public void setComeFamiliaID5(short comeFamiliaID5) { this.comeFamiliaID5 = comeFamiliaID5; } public void setSalud(short salud) { if (salud > 100) this.salud = 100; else if (salud < 0) this.salud = 0; else this.salud = salud; } public void setComeFamiliaID1(short comeFamiliaID1) { this.comeFamiliaID1 = comeFamiliaID1; } public void setComeFamiliaID4(short comeFamiliaID4) { this.comeFamiliaID4 = comeFamiliaID4; } public void setComeFamiliaID3(short comeFamiliaID3) { this.comeFamiliaID3 = comeFamiliaID3; } public void setComeFamiliaID2(short comeFamiliaID2) { this.comeFamiliaID2 = comeFamiliaID2; } public void setFechaDeUltimaComida(String fechaDeUltimaComida) { this.fechaDeUltimaComida = fechaDeUltimaComida; } public void addMensajes(Mensajes mensajes) { if (this.mensajesMonje == null) this.mensajesMonje = new ArrayList(); this.mensajesMonje.add(mensajes); } public boolean removeMensajes(Mensajes mensajes) { if (this.mensajesMonje != null) return this.mensajesMonje.remove(mensajes); return false; } public void setEdad(short edad) { this.edad = edad; } public void setBarra_proteinas(String barra_proteinas) { this.barra_proteinas = barra_proteinas; } public void setBarra_lipidos(String barra_lipidos) { this.barra_lipidos = barra_lipidos; } public void setBarra_salud(String barra_salud) { this.barra_salud = barra_salud; } public void setBarra_hidratosCarbono(String barra_hidratosCarbono) { this.barra_hidratosCarbono = barra_hidratosCarbono; } public void setBarra_vitaminas(String barra_vitaminas) { this.barra_vitaminas = barra_vitaminas; } public void setFechaDeFallecimiento(String fechaDeFallecimiento) { this.fechaDeFallecimiento = fechaDeFallecimiento; } public void setEstado(int estado) { this.estado = estado; } public short getEdad() { return edad; } public String getBarra_proteinas() { return barra_proteinas; } public String getBarra_lipidos() { return barra_lipidos; } public String getBarra_salud() { return barra_salud; } public String getBarra_hidratosCarbono() { return barra_hidratosCarbono; } public String getBarra_vitaminas() { return barra_vitaminas; } public String getFechaDeFallecimiento() { return fechaDeFallecimiento; } public int getEstado() { return estado; } public void setActPrima(short actPrima) { this.actPrima = actPrima; } public short getActPrima() { return actPrima; } public void setActTercia(short actTercia) { this.actTercia = actTercia; } public short getActTercia() { return actTercia; } public void setActNona(short actNona) { this.actNona = actNona; } public short getActNona() { return actNona; } public void setActVispera(short actVispera) { this.actVispera = actVispera; } public short getActVispera() { return actVispera; } public void setActMaitines(short actMaitines) { this.actMaitines = actMaitines; } public short getActMaitines() { return actMaitines; } public void setActLaudes(short actLaudes) { this.actLaudes = actLaudes; } public short getActLaudes() { return actLaudes; } public void setActSexta(short actSexta) { this.actSexta = actSexta; } public short getActSexta() { return actSexta; } public void setActAngelus(short actAngelus) { this.actAngelus = actAngelus; } public short getActAngelus() { return actAngelus; } public void setSiguienteID(int siguienteID) { this.siguienteID = siguienteID; } public int getSiguienteID() { return siguienteID; } public void setAnteriorID(int anteriorID) { this.anteriorID = anteriorID; } public void setBarra_fe(String barra_fe) { this.barra_fe = barra_fe; } public void setBarra_destreza(String barra_destreza) { this.barra_destreza = barra_destreza; } public void setBarra_talento(String barra_talento) { this.barra_talento = barra_talento; } public void setBarra_sabiduria(String barra_sabiduria) { this.barra_sabiduria = barra_sabiduria; } public void setBarra_idioma(String barra_idioma) { this.barra_idioma = barra_idioma; } public void setBarra_fuerza(String barra_fuerza) { this.barra_fuerza = barra_fuerza; } public int getAnteriorID() { return anteriorID; } public String getBarra_fe() { return barra_fe; } public String getBarra_destreza() { return barra_destreza; } public String getBarra_talento() { return barra_talento; } public String getBarra_sabiduria() { return barra_sabiduria; } public String getBarra_idioma() { return barra_idioma; } public String getBarra_fuerza() { return barra_fuerza; } public void setFe(int fe) { this.fe = fe; } public int getFe() { return fe; } public void setIdioma(int idioma) { this.idioma = idioma; } public int getIdioma() { return idioma; } public void setTalento(int talento) { this.talento = talento; } public int getTalento() { return talento; } public void setSabiduria(int sabiduria) { this.sabiduria = sabiduria; } public int getSabiduria() { return sabiduria; } public void setFuerza(int fuerza) { this.fuerza = fuerza; } public int getFuerza() { return fuerza; } public void setDestreza(int destreza) { this.destreza = destreza; } public void setActNona_completado(short actNona_completado) { this.actNona_completado = actNona_completado; } public void setActAngelus_completado(short actAngelus_completado) { this.actAngelus_completado = actAngelus_completado; } public void setActPrima_completado(short actPrima_completado) { this.actPrima_completado = actPrima_completado; } public void setActMaitines_completado(short actMaitines_completado) { this.actMaitines_completado = actMaitines_completado; } public void setActTercia_completado(short actTercia_completado) { this.actTercia_completado = actTercia_completado; } public void setActLaudes_completado(short actLaudes_completado) { this.actLaudes_completado = actLaudes_completado; } public void setActSexta_completado(short actSexta_completado) { this.actSexta_completado = actSexta_completado; } public void setActVispera_completado(short actVispera_completado) { this.actVispera_completado = actVispera_completado; } public void setBarra_carisma(String barra_carisma) { this.barra_carisma = barra_carisma; } public void setCarisma(int carisma) { this.carisma = carisma; } public void setAnt_hidratosCarbono(short ant_hidratosCarbono) { this.ant_hidratosCarbono = ant_hidratosCarbono; } public void setAnt_lipidos(short ant_lipidos) { this.ant_lipidos = ant_lipidos; } public void setAnt_proteinas(short ant_proteinas) { this.ant_proteinas = ant_proteinas; } public void setAnt_vitaminas(short ant_vitaminas) { this.ant_vitaminas = ant_vitaminas; } public void setHa_comidoFamiliaID3(short ha_comidoFamiliaID3) { this.ha_comidoFamiliaID3 = ha_comidoFamiliaID3; } public void setHa_comidoFamiliaID5(short ha_comidoFamiliaID5) { this.ha_comidoFamiliaID5 = ha_comidoFamiliaID5; } public void setHa_comidoFamiliaID2(short ha_comidoFamiliaID2) { this.ha_comidoFamiliaID2 = ha_comidoFamiliaID2; } public void setHa_comidoFamiliaID4(short ha_comidoFamiliaID4) { this.ha_comidoFamiliaID4 = ha_comidoFamiliaID4; } public void setHa_comidoFamiliaID1(short ha_comidoFamiliaID1) { this.ha_comidoFamiliaID1 = ha_comidoFamiliaID1; } public void setJerarquia(String jerarquia) { this.jerarquia = jerarquia; } public void setRegion(String region) { this.region = region; } public void setAbadia(String abadia) { this.abadia = abadia; } public void setPopularidad(int popularidad) { if (popularidad > 100) this.popularidad = 100; else if (popularidad < 0) this.popularidad = 0; else this.popularidad = popularidad; } public void setBarra_popularidad(String barra_popularidad) { this.barra_popularidad = barra_popularidad; } public int getDestreza() { return destreza; } public short getActNona_completado() { return actNona_completado; } public short getActAngelus_completado() { return actAngelus_completado; } public short getActPrima_completado() { return actPrima_completado; } public short getActMaitines_completado() { return actMaitines_completado; } public short getActTercia_completado() { return actTercia_completado; } public short getActLaudes_completado() { return actLaudes_completado; } public short getActSexta_completado() { return actSexta_completado; } public short getActVispera_completado() { return actVispera_completado; } public String getBarra_carisma() { return barra_carisma; } public int getCarisma() { return carisma; } public short getAnt_hidratosCarbono() { if (ant_hidratosCarbono == 0) return 1; // evitar division por cero else return ant_hidratosCarbono; } public short getAnt_lipidos() { if (ant_lipidos == 0) return 1; // evitar division por cero else return ant_lipidos; } public short getAnt_proteinas() { if (ant_proteinas == 0) return 1; // evitar division por cero else return ant_proteinas; } public short getAnt_vitaminas() { if (ant_vitaminas == 0) return 1; // evitar division por cero else return ant_vitaminas; } public short getHa_comidoFamiliaID3() { return ha_comidoFamiliaID3; } public short getHa_comidoFamiliaID5() { return ha_comidoFamiliaID5; } public short getHa_comidoFamiliaID2() { return ha_comidoFamiliaID2; } public short getHa_comidoFamiliaID4() { return ha_comidoFamiliaID4; } public short getHa_comidoFamiliaID1() { return ha_comidoFamiliaID1; } public String getJerarquia() { return jerarquia; } public String getRegion() { return region; } public String getAbadia() { return abadia; } public int getPopularidad() { return popularidad; } public String getBarra_popularidad() { return barra_popularidad; } public short isActPrima_completado() { return actPrima_completado; } public int getIdDeAbadia_Visita() { return idDeAbadia_Visita; } public void setIdDeAbadia_Visita(int idDeAbadia_Visita) { this.idDeAbadia_Visita = idDeAbadia_Visita; } public String getImgProteinas_eval() { return imgProteinas_eval; } public void setImgProteinas_eval(String imgProteinas_eval) { this.imgProteinas_eval = imgProteinas_eval; } public String getImgLipidos_eval() { return imgLipidos_eval; } public void setImgLipidos_eval(String imgLipidos_eval) { this.imgLipidos_eval = imgLipidos_eval; } public String getImgHidratos_eval() { return imgHidratos_eval; } public void setImgHidratos_eval(String imgHidratos_eval) { this.imgHidratos_eval = imgHidratos_eval; } public String getImgVitaminas_eval() { return imgVitaminas_eval; } public void setImgVitaminas_eval(String imgVitaminas_eval) { this.imgVitaminas_eval = imgVitaminas_eval; } public String getImgSalud_eval() { return imgSalud_eval; } public void setImgSalud_eval(String imgSalud_eval) { this.imgSalud_eval = imgSalud_eval; } public String getHTMLEnfermedad() { return HTMLEnfermedad; } public void setHTMLEnfermedad(String HTMLEnfermedad) { this.HTMLEnfermedad = HTMLEnfermedad; } public int getPuntosMonje() { return puntosMonje; } public void setPuntosMonje(int puntosMonje) { this.puntosMonje = puntosMonje; } public String getNombreCompuesto() { return nombreCompuesto; } public void setNombreCompuesto(String nombreCompuesto) { this.nombreCompuesto = nombreCompuesto; } public short getNivelAbadia() { return nivelAbadia; } public void setNivelAbadia(short nivelAbadia) { this.nivelAbadia = nivelAbadia; } }
[ "benjamin.rodriguez.perez@11362ca2-cd3e-d67a-660a-42b04fd45c2f" ]
benjamin.rodriguez.perez@11362ca2-cd3e-d67a-660a-42b04fd45c2f
b0c8988dd5c70ab652e499ad61ed0246ef5cc317
35ffc86799e2e38ef0493c1a44a1bab3de9d7c93
/Exercise_15/Exercise_15_20/Exercise_15_20.java
e75543f6632e679d53d84c3fdb0685bab5ec3fec
[ "MIT" ]
permissive
yashi-jain02/Intro-to-Java-Programming
858dc5df8384543540ebd904cbee874f147b3249
b0b3c0994e272433e07650289c7b657dc43d96f0
refs/heads/master
2020-07-17T22:55:42.110826
2019-09-03T18:25:56
2019-09-03T18:25:56
206,118,169
1
0
MIT
2019-09-03T16:05:48
2019-09-03T16:05:48
null
UTF-8
Java
false
false
4,156
java
/********************************************************************************* * (Geometry: display angles) Write a program that enables the user to drag the * * vertices of a triangle and displays the angles dynamically as the triangle * * shape changes, as shown in Figure 15.30a. The formula to compute angles is * * given in Listing 4.1. * *********************************************************************************/ import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.shape.Polygon; import javafx.scene.shape.Circle; import javafx.scene.text.Text; import javafx.scene.paint.Color; import javafx.collections.ObservableList; import javafx.scene.layout.Pane; import javafx.stage.Stage; import java.util.ArrayList; public class Exercise_15_20 extends Application { @Override // Override the start method in the Application class public void start(Stage primaryStage) { // Create a pane Pane pane = new Pane(); // Create three points and add them to a list Circle p1 = new Circle(50, 100, 5); Circle p2 = new Circle(100, 25, 5); Circle p3 = new Circle(150, 80, 5); ArrayList<Circle> points = new ArrayList<>(); points.add(p1); points.add(p2); points.add(p3); // Place nodes in the pane drawTriangle(pane, points); pane.getChildren().addAll(p1, p2, p3); placeText(pane, points); // Create and register the handle pane.setOnMouseDragged(e -> { for (int i = 0; i < points.size(); i++) { if (points.get(i).contains(e.getX(), e.getY())) { pane.getChildren().clear(); points.get(i).setCenterX(e.getX()); points.get(i).setCenterY(e.getY()); drawTriangle(pane, points); pane.getChildren().addAll(p1, p2, p3); placeText(pane, points); } } }); // Create a scene and place it in the stage Scene scene = new Scene(pane, 200, 200); primaryStage.setTitle("Exercise_15_20"); // Set the stage title primaryStage.setScene(scene); // Place the scene in the stage primaryStage.show(); // Display the stage } /** Adds three angles to the pane */ private void placeText(Pane pane, ArrayList<Circle> p) { double[] sides = getSides(p); double[] angles = getAngles(sides); pane.getChildren().add(new Text(p.get(0).getCenterX(), p.get(0).getCenterY() - 5, String.format("%.2f", angles[0]))); pane.getChildren().add(new Text(p.get(1).getCenterX(), p.get(1).getCenterY() - 5, String.format("%.2f", angles[1]))); pane.getChildren().add(new Text(p.get(2).getCenterX(), p.get(2).getCenterY() - 5, String.format("%.2f", angles[2]))); } /** Calculates and returns an array of sides in a triangle */ private double[] getSides(ArrayList<Circle> p) { double[] sides = new double[3]; sides[0] = Math.sqrt(Math.pow(p.get(0).getCenterX() - p.get(1).getCenterX(), 2) + Math.pow(p.get(0).getCenterY() - p.get(1).getCenterY(), 2)); sides[1] = Math.sqrt(Math.pow(p.get(1).getCenterX() - p.get(2).getCenterX(), 2) + Math.pow(p.get(1).getCenterY() - p.get(2).getCenterY(), 2)); sides[2] = Math.sqrt(Math.pow(p.get(2).getCenterX() - p.get(0).getCenterX(), 2) + Math.pow(p.get(2).getCenterY() - p.get(0).getCenterY(), 2)); return sides; } /** Calculates and returns an array of angles in a triangle */ private double[] getAngles(double[] s) { double[] angles = new double[3]; angles[0] = Math.toDegrees(Math.acos((s[0] * s[0] - s[1] * s[1] - s[2] * s[2]) / (-2 * s[1] * s[2]))); angles[1] = Math.toDegrees(Math.acos((s[1] * s[1] - s[0] * s[0] - s[2] * s[2]) / (-2 * s[0] * s[2]))); angles[2] = Math.toDegrees(Math.acos((s[2] * s[2] - s[1] * s[1] - s[0] * s[0]) / (-2 * s[0] * s[1]))); return angles; } /** Create a polygon */ private void drawTriangle(Pane pane, ArrayList<Circle> p) { Polygon polygon = new Polygon(); pane.getChildren().add(polygon); ObservableList<Double> points = polygon.getPoints(); for (int i = 0; i < p.size(); i++) { points.add(p.get(i).getCenterX()); points.add(p.get(i).getCenterY()); } polygon.setFill(Color.WHITE); polygon.setStroke(Color.BLACK); } }
[ "jabarimail@gmail.com" ]
jabarimail@gmail.com
3ae36b65c3e61ddf5e375664a653f36551b4f55b
44e7adc9a1c5c0a1116097ac99c2a51692d4c986
/aws-java-sdk-glue/src/main/java/com/amazonaws/services/glue/model/transform/EncryptionAtRestJsonUnmarshaller.java
555bd00f1e3db3b92750a34436a08221742dcf52
[ "Apache-2.0" ]
permissive
QiAnXinCodeSafe/aws-sdk-java
f93bc97c289984e41527ae5bba97bebd6554ddbe
8251e0a3d910da4f63f1b102b171a3abf212099e
refs/heads/master
2023-01-28T14:28:05.239019
2020-12-03T22:09:01
2020-12-03T22:09:01
318,460,751
1
0
Apache-2.0
2020-12-04T10:06:51
2020-12-04T09:05:03
null
UTF-8
Java
false
false
3,019
java
/* * Copyright 2015-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with * the License. A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions * and limitations under the License. */ package com.amazonaws.services.glue.model.transform; import java.math.*; import javax.annotation.Generated; import com.amazonaws.services.glue.model.*; import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*; import com.amazonaws.transform.*; import com.fasterxml.jackson.core.JsonToken; import static com.fasterxml.jackson.core.JsonToken.*; /** * EncryptionAtRest JSON Unmarshaller */ @Generated("com.amazonaws:aws-java-sdk-code-generator") public class EncryptionAtRestJsonUnmarshaller implements Unmarshaller<EncryptionAtRest, JsonUnmarshallerContext> { public EncryptionAtRest unmarshall(JsonUnmarshallerContext context) throws Exception { EncryptionAtRest encryptionAtRest = new EncryptionAtRest(); int originalDepth = context.getCurrentDepth(); String currentParentElement = context.getCurrentParentElement(); int targetDepth = originalDepth + 1; JsonToken token = context.getCurrentToken(); if (token == null) token = context.nextToken(); if (token == VALUE_NULL) { return null; } while (true) { if (token == null) break; if (token == FIELD_NAME || token == START_OBJECT) { if (context.testExpression("CatalogEncryptionMode", targetDepth)) { context.nextToken(); encryptionAtRest.setCatalogEncryptionMode(context.getUnmarshaller(String.class).unmarshall(context)); } if (context.testExpression("SseAwsKmsKeyId", targetDepth)) { context.nextToken(); encryptionAtRest.setSseAwsKmsKeyId(context.getUnmarshaller(String.class).unmarshall(context)); } } else if (token == END_ARRAY || token == END_OBJECT) { if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) { if (context.getCurrentDepth() <= originalDepth) break; } } token = context.nextToken(); } return encryptionAtRest; } private static EncryptionAtRestJsonUnmarshaller instance; public static EncryptionAtRestJsonUnmarshaller getInstance() { if (instance == null) instance = new EncryptionAtRestJsonUnmarshaller(); return instance; } }
[ "" ]
ce653b83cc411118288fd5f69f77150830499e66
beefda3d27df4981026b952899fae37a3f8dbf88
/src/main/java/com/somecompany/chatty/ChattyApplication.java
2ce7e5c29881998cd35c406ce459ab151390a95c
[]
no_license
vviazovykov/spring_boot_chatty
38474c0d8e9aede9962038fceddf23b9d6de8b43
6dd7fdd3922c816faa199c03e807a29f3094fa49
refs/heads/master
2021-04-02T11:08:34.438481
2020-03-18T16:51:18
2020-03-18T16:51:18
248,268,319
0
0
null
null
null
null
UTF-8
Java
false
false
315
java
package com.somecompany.chatty; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class ChattyApplication { public static void main(String[] args) { SpringApplication.run(ChattyApplication.class, args); } }
[ "vasyl.viazovykov@ge.com" ]
vasyl.viazovykov@ge.com
41e58493198fe61c87a01eaa5cbde90a4956ced3
267f3dc1e3f02f897ce3f9862a094b63616206d9
/app/src/main/java/com/jmaplus/pharmawine/activities/CalendarActivity.java
752eb00698828700b19c4b6c80fd4ad0d40d9d90
[ "Apache-2.0" ]
permissive
david95thinkcode/pharmawine-android
74f42b4bde83988446215d156316b4fa7fc3e0fd
d84ac490df1b7cd6d89ac63f61ebee47570d9c8b
refs/heads/master
2021-10-15T23:04:14.526880
2019-02-06T13:07:00
2019-02-06T13:07:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,496
java
package com.jmaplus.pharmawine.activities; import android.support.design.widget.TabLayout; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.MenuItemCompat; import android.support.v4.view.ViewPager; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.SearchView; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuInflater; import android.view.MenuItem; import com.jmaplus.pharmawine.R; import com.jmaplus.pharmawine.fragments.calendar.BirthdaysFragment; import com.jmaplus.pharmawine.fragments.calendar.HolidaysFragment; import com.jmaplus.pharmawine.fragments.calendar.TravelsFragment; import java.util.ArrayList; import java.util.List; public class CalendarActivity extends AppCompatActivity { private Toolbar toolbar; private TabLayout tabLayout; private ViewPager viewPager; public static String BIRTHDAYS = "com.jmaplus.pharmawine.activities.calendar.birthdays"; public static String HOLIDAYS = "com.jmaplus.pharmawine.activities.calendar.holidays"; private String mCurrentFragment; public BirthdaysFragment mBirthdaysFragment = new BirthdaysFragment(); public HolidaysFragment mHolidaysFragment = new HolidaysFragment(); public TravelsFragment mTravelsFragment = new TravelsFragment(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_calendar); toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setDisplayHomeAsUpEnabled(true); mCurrentFragment = mBirthdaysFragment.getClass().getSimpleName(); viewPager = findViewById(R.id.viewpager); setupViewPager(viewPager); tabLayout = findViewById(R.id.tabs); tabLayout.setupWithViewPager(viewPager); } @Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.search_menu, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: finish(); break; case R.id.action_search: SearchView searchView = (SearchView) MenuItemCompat.getActionView(item); searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() { @Override public boolean onQueryTextSubmit(String s) { return false; } @Override public boolean onQueryTextChange(String s) { return false; } }); break; default: return super.onOptionsItemSelected(item); } return super.onOptionsItemSelected(item); } private void setupViewPager(ViewPager viewPager) { ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager()); adapter.addFragment(mBirthdaysFragment, "Anniversaires"); adapter.addFragment(mHolidaysFragment, "Congés"); adapter.addFragment(mTravelsFragment, "Voyages"); viewPager.setAdapter(adapter); } class ViewPagerAdapter extends FragmentPagerAdapter { private final List<Fragment> mFragmentList = new ArrayList<>(); private final List<String> mFragmentTitleList = new ArrayList<>(); public ViewPagerAdapter(FragmentManager manager) { super(manager); } @Override public Fragment getItem(int position) { return mFragmentList.get(position); } @Override public int getCount() { return mFragmentList.size(); } public void addFragment(Fragment fragment, String title) { mFragmentList.add(fragment); mFragmentTitleList.add(title); } public void removeFragment(int index) { mFragmentList.remove(index); mFragmentTitleList.remove(index); } @Override public CharSequence getPageTitle(int position) { return mFragmentTitleList.get(position); } } }
[ "davidhihea@gmail.com" ]
davidhihea@gmail.com
45bec06b7d2211a30080ec1a6c4104aa5cbdebe1
8c433cc46ea8c46ab27307820966e2520e11d321
/src/main/java/com/cloneccsrobjectmapping/domain/model/specification/Covered.java
e164a2b3030b3dd65965e53f10a446599dfd584a
[]
no_license
ymzkjpx/clone-ccsr-object-mapping
4514fe432a993484a3098d05251ecb640213f629
3d90c1c2fe1f885ac45232db713ae362563e7a87
refs/heads/main
2023-08-31T11:32:57.531194
2021-09-18T07:50:59
2021-09-18T07:50:59
403,622,434
0
0
null
2021-09-18T07:51:00
2021-09-06T12:54:52
Java
UTF-8
Java
false
false
400
java
package com.cloneccsrobjectmapping.domain.model.specification; public enum Covered { COVERED("有り"), NON_COVERED("無し"); private String japaneseName; Covered(String japaneseName) { this.japaneseName = japaneseName; } public String japaneseName() { return japaneseName; } public boolean isCovered() { return this.equals(COVERED); } }
[ "ymzkjpx@gmail.com" ]
ymzkjpx@gmail.com
404d9e6f419c27416587bc56b440e489db264b70
27076654648abf4e0e8a3f626968ab2562f92254
/gen/com/wxf/mobilesafe/R.java
8a5755fb8ed9ae7e5c81c534aa63d4d92e225fb9
[]
no_license
Mr-wxf/mobilesafe
8153ffbb9986f6b1c0f4f379fdd14a931c714c4b
f54671e4a31f02883cdd2f9db21e6e3bde5e92e6
refs/heads/master
2021-01-10T18:50:06.447358
2016-12-14T08:26:34
2016-12-14T08:26:34
76,438,216
0
0
null
null
null
null
UTF-8
Java
false
false
20,305
java
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package com.wxf.mobilesafe; public final class R { public static final class anim { public static final int cycle_7=0x7f040000; public static final int next_in_anim=0x7f040001; public static final int next_out_anim=0x7f040002; public static final int pre_in_anim=0x7f040003; public static final int pre_out_anim=0x7f040004; public static final int shake=0x7f040005; } public static final class attr { /** <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int desoff=0x7f010001; /** <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int deson=0x7f010002; /** <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int destitle=0x7f010000; } public static final class color { public static final int atool_item_color=0x7f070000; public static final int atool_item_color_src=0x7f070001; } public static final class dimen { /** Default screen margins, per the Android Design guidelines. Example customization of dimensions originally defined in res/values/dimens.xml (such as screen margins) for screens with more than 820dp of available width. This would include 7" and 10" devices in landscape (~960dp and ~1280dp respectively). */ public static final int activity_horizontal_margin=0x7f080000; public static final int activity_vertical_margin=0x7f080001; } public static final class drawable { public static final int act_scanning_03=0x7f020000; public static final int atool_item_bg=0x7f020001; public static final int bind=0x7f020002; public static final int btn_green_normal=0x7f020003; public static final int btn_green_pressed=0x7f020004; public static final int call_locate_blue=0x7f020005; public static final int call_locate_gray=0x7f020006; public static final int call_locate_green=0x7f020007; public static final int call_locate_orange=0x7f020008; public static final int call_locate_white=0x7f020009; public static final int drag=0x7f02000a; public static final int function_greenbutton_normal=0x7f02000b; public static final int function_greenbutton_pressed=0x7f02000c; public static final int gradient_box=0x7f02000d; public static final int home_apps=0x7f02000e; public static final int home_callmsgsafe=0x7f02000f; public static final int home_netmanager=0x7f020010; public static final int home_safe=0x7f020011; public static final int home_settings=0x7f020012; public static final int home_sysoptimize=0x7f020013; public static final int home_taskmanager=0x7f020014; public static final int home_tools=0x7f020015; public static final int home_trojan=0x7f020016; public static final int ic_launcher=0x7f020017; public static final int ic_scanner_malware=0x7f020018; public static final int img1=0x7f020019; public static final int img2=0x7f02001a; public static final int img3=0x7f02001b; public static final int jiantou1_pressed=0x7f02001c; public static final int launcher_bg=0x7f02001d; public static final int listview_divider=0x7f02001e; public static final int local_popup_bg=0x7f02001f; public static final int lock=0x7f020020; public static final int main_clean_icon=0x7f020021; public static final int main_clean_icon_pressed=0x7f020022; public static final int next=0x7f020023; public static final int next_btn_bg=0x7f020024; public static final int phone=0x7f020025; public static final int previous=0x7f020026; public static final int progress_bg=0x7f020027; public static final int resert_bg=0x7f020028; public static final int security_progress=0x7f020029; public static final int security_progress_bg=0x7f02002a; public static final int select_blacknumber_delete_bg=0x7f02002b; public static final int select_people_number=0x7f02002c; public static final int setup1=0x7f02002d; public static final int tab_left_default=0x7f02002e; public static final int tab_left_pressed=0x7f02002f; public static final int tab_right_default=0x7f020030; public static final int tab_right_pressed=0x7f020031; public static final int unlock=0x7f020032; public static final int widget_bg_portrait=0x7f020033; public static final int widget_bg_portrait_child=0x7f020034; public static final int widget_bg_portrait_child_divider=0x7f020035; } public static final class id { public static final int action_settings=0x7f0c0069; public static final int addressview=0x7f0c002e; public static final int bt_add=0x7f0c0011; public static final int bt_all_select=0x7f0c0024; public static final int bt_bottom=0x7f0c0037; public static final int bt_cache_clear=0x7f0c0013; public static final int bt_cancel=0x7f0c0046; public static final int bt_cencal=0x7f0c004c; public static final int bt_clear=0x7f0c0059; public static final int bt_confirm=0x7f0c0045; public static final int bt_contact=0x7f0c0063; public static final int bt_lock=0x7f0c0006; public static final int bt_query=0x7f0c002b; public static final int bt_remove=0x7f0c0026; public static final int bt_reverse_select=0x7f0c0025; public static final int bt_setting=0x7f0c0027; public static final int bt_submit=0x7f0c001c; public static final int bt_top=0x7f0c0036; public static final int bt_unlock=0x7f0c0005; public static final int cb_box=0x7f0c0060; public static final int cb_check=0x7f0c005d; public static final int cb_lock_screen_clean=0x7f0c0029; public static final int cb_show_system_process=0x7f0c0028; public static final int cb_success=0x7f0c0064; public static final int content=0x7f0c0039; public static final int elv_common_number=0x7f0c0017; public static final int et_confirm_psd=0x7f0c0044; public static final int et_contact_number=0x7f0c0062; public static final int et_input_psd=0x7f0c005e; public static final int et_phone=0x7f0c002a; public static final int et_psd=0x7f0c001b; public static final int gv_home=0x7f0c001d; public static final int handle=0x7f0c0038; public static final int iv=0x7f0c005f; public static final int iv_app_icon=0x7f0c001a; public static final int iv_clear=0x7f0c0053; public static final int iv_con=0x7f0c004e; public static final int iv_del=0x7f0c0041; public static final int iv_drag=0x7f0c0035; public static final int iv_icon=0x7f0c003b; public static final int iv_icon2=0x7f0c005a; public static final int iv_lock_icon=0x7f0c003a; public static final int iv_need_clear_app_icon=0x7f0c0050; public static final int iv_scan_icon=0x7f0c001e; public static final int ll_cache_app=0x7f0c0016; public static final int ll_item=0x7f0c004d; public static final int ll_list=0x7f0c0021; public static final int ll_lock=0x7f0c000a; public static final int ll_root=0x7f0c0057; public static final int ll_unlock=0x7f0c0007; public static final int lv_app_manager=0x7f0c000f; public static final int lv_blacknumber=0x7f0c0012; public static final int lv_contact=0x7f0c0018; public static final int lv_lock=0x7f0c000c; public static final int lv_process=0x7f0c0023; public static final int lv_unlock=0x7f0c0009; public static final int pb=0x7f0c0002; public static final int pb_bar=0x7f0c0020; public static final int pb_cache=0x7f0c0014; public static final int rb_all=0x7f0c004b; public static final int rb_phone=0x7f0c004a; public static final int rb_sms=0x7f0c0049; public static final int rg_group=0x7f0c0048; public static final int rl_root=0x7f0c0033; public static final int scv_location=0x7f0c0030; public static final int settingview=0x7f0c002d; public static final int setup_bount=0x7f0c0061; public static final int siv_app_lock=0x7f0c0032; public static final int sv_blacknumber=0x7f0c0031; public static final int toast_style_view=0x7f0c002f; public static final int tv=0x7f0c0066; public static final int tv_app_lock=0x7f0c0004; public static final int tv_app_name=0x7f0c0019; public static final int tv_appname=0x7f0c003c; public static final int tv_appname2=0x7f0c005b; public static final int tv_cache_size=0x7f0c0052; public static final int tv_child_name=0x7f0c0042; public static final int tv_child_number=0x7f0c0043; public static final int tv_common_number=0x7f0c0003; public static final int tv_des=0x7f0c0010; public static final int tv_item=0x7f0c004f; public static final int tv_lock_app=0x7f0c000b; public static final int tv_memory=0x7f0c000d; public static final int tv_memory2=0x7f0c005c; public static final int tv_mode=0x7f0c0040; public static final int tv_name=0x7f0c0047; public static final int tv_need_clear_app_name=0x7f0c0051; public static final int tv_path=0x7f0c003d; public static final int tv_phone=0x7f0c003f; public static final int tv_phone_address=0x7f0c002c; public static final int tv_process_count=0x7f0c0022; public static final int tv_process_memory=0x7f0c0058; public static final int tv_query_phone_number=0x7f0c0000; public static final int tv_resert=0x7f0c0067; public static final int tv_scan_app_name=0x7f0c001f; public static final int tv_scanning_app=0x7f0c0015; public static final int tv_sd_card=0x7f0c000e; public static final int tv_security_number=0x7f0c0065; public static final int tv_share=0x7f0c0056; public static final int tv_showtoast=0x7f0c0068; public static final int tv_sms_backup=0x7f0c0001; public static final int tv_start=0x7f0c0055; public static final int tv_title=0x7f0c003e; public static final int tv_uninstall=0x7f0c0054; public static final int tv_unlock_app=0x7f0c0008; public static final int tv_version_name=0x7f0c0034; } public static final class layout { public static final int activity_altool=0x7f030000; public static final int activity_app_lock=0x7f030001; public static final int activity_appmanager=0x7f030002; public static final int activity_base_claer_cache=0x7f030003; public static final int activity_blacknumber=0x7f030004; public static final int activity_cache_clear=0x7f030005; public static final int activity_common_number=0x7f030006; public static final int activity_contactlist=0x7f030007; public static final int activity_enter_psd=0x7f030008; public static final int activity_home=0x7f030009; public static final int activity_killvirus=0x7f03000a; public static final int activity_process_manager=0x7f03000b; public static final int activity_process_setting=0x7f03000c; public static final int activity_queryphonenumber=0x7f03000d; public static final int activity_setting=0x7f03000e; public static final int activity_splash=0x7f03000f; public static final int activity_toast_location=0x7f030010; public static final int activity_traffic=0x7f030011; public static final int app_lock_item=0x7f030012; public static final int appinfolist_item=0x7f030013; public static final int appinfolist_item_title=0x7f030014; public static final int blacknumbet_item=0x7f030015; public static final int common_number_child_item=0x7f030016; public static final int confirm_psd_view=0x7f030017; public static final int contact_item=0x7f030018; public static final int dialog_blacknumber=0x7f030019; public static final int gridview_item=0x7f03001a; public static final int lenearlayout_cache_item=0x7f03001b; public static final int popuwindon_layout=0x7f03001c; public static final int process_widget=0x7f03001d; public static final int processinfolist_item=0x7f03001e; public static final int set_psd_view=0x7f03001f; public static final int setting_click_view=0x7f030020; public static final int setting_item_view=0x7f030021; public static final int setup1_activity=0x7f030022; public static final int setup2_activity=0x7f030023; public static final int setup3_activity=0x7f030024; public static final int setup4_activity=0x7f030025; public static final int setup_over=0x7f030026; public static final int showtoast_item=0x7f030027; } public static final class menu { public static final int main=0x7f0b0000; } public static final class raw { public static final int ylzs=0x7f060000; } public static final class string { public static final int action_settings=0x7f090002; public static final int app_name=0x7f090000; public static final int hello_world=0x7f090001; public static final int sample_device_admin=0x7f090003; public static final int sample_device_admin_description=0x7f090004; } public static final class style { /** Base application theme, dependent on API level. This theme is replaced by AppBaseTheme from res/values-vXX/styles.xml on newer devices. Theme customizations available in newer API levels can go in res/values-vXX/styles.xml, while customizations related to backward-compatibility can go here. Base application theme for API 11+. This theme completely replaces AppBaseTheme from res/values/styles.xml on API 11+ devices. API 11 theme customizations can go here. Base application theme for API 14+. This theme completely replaces AppBaseTheme from BOTH res/values/styles.xml and res/values-v11/styles.xml on API 14+ devices. API 14 theme customizations can go here. */ public static final int AppBaseTheme=0x7f0a0000; /** Application theme. All customizations that are NOT specific to a particular API-level can go here. */ public static final int AppTheme=0x7f0a0001; /** <Button android:id="@+id/bt_next" android:layout_alignParentRight="true" android:layout_alignParentBottom="true" android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="下一页" android:drawableRight="@drawable/next" android:background="@drawable/next_btn_bg" /> */ public static final int NextButton=0x7f0a0003; public static final int PreButton=0x7f0a0004; /** android:layout_width="match_parent" android:layout_height="wrap_content" android:text="功能列表" android:textColor="#000" android:background="#0f0" android:textSize="20sp" android:padding="10dp" android:gravity="center" All customizations that are NOT specific to a particular API-level can go here. */ public static final int TitleStyle=0x7f0a0002; } public static final class xml { public static final int device_admin_sample=0x7f050000; public static final int process_widget_provider=0x7f050001; } public static final class styleable { /** Attributes that can be used with a com_wxf_mobilesafe_view_SettingView. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #com_wxf_mobilesafe_view_SettingView_desoff com.wxf.mobilesafe:desoff}</code></td><td></td></tr> <tr><td><code>{@link #com_wxf_mobilesafe_view_SettingView_deson com.wxf.mobilesafe:deson}</code></td><td></td></tr> <tr><td><code>{@link #com_wxf_mobilesafe_view_SettingView_destitle com.wxf.mobilesafe:destitle}</code></td><td></td></tr> </table> @see #com_wxf_mobilesafe_view_SettingView_desoff @see #com_wxf_mobilesafe_view_SettingView_deson @see #com_wxf_mobilesafe_view_SettingView_destitle */ public static final int[] com_wxf_mobilesafe_view_SettingView = { 0x7f010000, 0x7f010001, 0x7f010002 }; /** <p>This symbol is the offset where the {@link com.wxf.mobilesafe.R.attr#desoff} attribute's value can be found in the {@link #com_wxf_mobilesafe_view_SettingView} array. <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name com.wxf.mobilesafe:desoff */ public static final int com_wxf_mobilesafe_view_SettingView_desoff = 1; /** <p>This symbol is the offset where the {@link com.wxf.mobilesafe.R.attr#deson} attribute's value can be found in the {@link #com_wxf_mobilesafe_view_SettingView} array. <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name com.wxf.mobilesafe:deson */ public static final int com_wxf_mobilesafe_view_SettingView_deson = 2; /** <p>This symbol is the offset where the {@link com.wxf.mobilesafe.R.attr#destitle} attribute's value can be found in the {@link #com_wxf_mobilesafe_view_SettingView} array. <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name com.wxf.mobilesafe:destitle */ public static final int com_wxf_mobilesafe_view_SettingView_destitle = 0; }; }
[ "359246382@qq.com" ]
359246382@qq.com
ce1b855859e64e212f83172bf9903d7f206265ff
52856d4c14cb08978dcc33fe7829959a1be7bc60
/core/reqpro/src/main/java/teagle/repository/tssg/client/xstream/RootElementConverter.java
ab50ecdff36e387c2aa025b0fe811e716f07d664
[]
no_license
tubav/teagle_java
924dee0f23973feaca04fdf01338ba6e46ab96db
60aa39c807d53a63195791571af60a20255966a3
refs/heads/master
2021-01-20T02:16:41.468640
2013-03-19T09:53:47
2013-03-19T09:53:47
null
0
0
null
null
null
null
UTF-8
Java
false
false
871
java
package teagle.repository.tssg.client.xstream; import com.thoughtworks.xstream.converters.MarshallingContext; import com.thoughtworks.xstream.converters.reflection.ReflectionConverter; import com.thoughtworks.xstream.converters.reflection.ReflectionProvider; import com.thoughtworks.xstream.io.HierarchicalStreamWriter; import com.thoughtworks.xstream.mapper.Mapper; public class RootElementConverter extends ReflectionConverter { public RootElementConverter(Mapper mapper, ReflectionProvider reflectionProvider) { super(mapper, reflectionProvider); } @Override public boolean canConvert(Class clazz) { return clazz.equals(RootElement.class); } @Override public void marshal(Object value, HierarchicalStreamWriter writer, MarshallingContext context) { super.marshal(((RootElement)value).getElement(), writer, context); } }
[ "alexander.willner@tu-berlin.de" ]
alexander.willner@tu-berlin.de
9bd9d0aa8a6674d67b6d6fae25597d660f7236ce
70631ac57ab74bb242d25f3f84d76f8bc35c55a0
/src/main/java/com/bloomberg/deals/repository/DealCountRepository.java
718d661ca0edad5e2aaf0d160dd7e972a7de5cd0
[]
no_license
johnsoneyo/deals-migration
35dab3aab066b864532026a3bd1be8e1a0c02b41
092c12775474231d4100d90f75d8df40324495fe
refs/heads/master
2021-04-29T12:52:30.594232
2018-02-19T09:50:20
2018-02-19T09:50:20
120,916,793
0
0
null
null
null
null
UTF-8
Java
false
false
858
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.bloomberg.deals.repository; import com.bloomberg.deals.dto.DealCountDTO; import com.bloomberg.deals.dto.entity.DealCount; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Repository; /** * * @author johnson3yo */ @Repository public interface DealCountRepository extends JpaRepository<DealCount, Integer> { @Query(value="select new com.bloomberg.deals.dto.DealCountDTO(d.currencyIsoCode," + "max(d.dealCount)) from DealCount d group by d.currencyIsoCode") List<DealCountDTO>getAccumulatedDealCount(); }
[ "johnsoneyo@gmail.com" ]
johnsoneyo@gmail.com
b23b69f852f1bbd6b6ab464090ad66a0f45ee38c
d128a49673a7c75d6449ed8ddfc668df97143aaf
/super_service/src/main/java/net/togogo/service/IPermissionService.java
873919a9e090e1e533f9cc0728ac97d478398177
[]
no_license
R18ITA/supermarket
037b0b906518970336167b5a44fb70e287e23630
9f042cf508b13afc8c0d2c852206ad6b3b5edf5a
refs/heads/master
2022-06-21T11:25:05.747558
2020-04-12T10:31:36
2020-04-12T10:31:36
253,524,263
0
0
null
2022-06-21T03:11:53
2020-04-06T14:36:25
Java
UTF-8
Java
false
false
375
java
package net.togogo.service; import net.togogo.entity.Permission; import net.togogo.entity.PermissionExample; import java.util.List; public interface IPermissionService { List<Permission> selectByExample(PermissionExample example); int insert(Permission record); int updateByPrimaryKeySelective(Permission record); int deleteByPrimaryKey(Integer id); }
[ "214467227@qq.com" ]
214467227@qq.com
e7d2f5f45e525c9b08e077c1e3a3bc8352d8a4c7
65029a0351197243d2bb704018d76e36d2ef4d6e
/ConsoleProgram/src/main/java/com/example/consoleprogram/characters/Mage.java
4f7735c58949faf21f63f0e6fec38e3cf919d70c
[]
no_license
rgbond13/Department-of-DRAGONS
ef00c6457110daaf4e1fc7d2c16a69e2a88b19ca
2cd042635c1478d4b9a43cdfb088d133a05942d0
refs/heads/master
2022-09-06T18:35:42.651852
2020-06-03T00:15:29
2020-06-03T00:15:29
263,999,169
0
0
null
2020-05-14T18:52:47
2020-05-14T18:52:46
null
UTF-8
Java
false
false
1,094
java
package com.example.consoleprogram.characters; public class Mage extends Player { public Mage(String username) { super(username); } public String getDescription() { return super.getDescription() + "Class: Mage\n"; } @Override public void attack(Character target) { int damageDealt = 10; if (rand.nextInt(10) == 0) { System.out.println(username + " tried to use fireball, but it backfired."); target = this; } if (rand.nextInt(20) == 0) { // 1 in 20 chance of explosion System.out.println(username + "'s fireball exploded, dealing extra damage."); damageDealt = 50; } System.out.println(username + " fireballed " + target.username + " for " + damageDealt + " damage!"); target.damage(damageDealt); if (target != this) { addXp(damageDealt); } else { System.out.println(username + " was not awarded XP for hurting itself"); } } }
[ "codydgraham@gmail.com" ]
codydgraham@gmail.com
c411b0fc8846b06b5c71cafc56b9655eb899906d
defe3ab3eff12f7616139867541120a09e1eeebb
/src/main/java/cn/soa/service/inter/CreateMonitorDataSI.java
2315fc40914372f95ab19763737454dfe5ad38bc
[]
no_license
wwkkww1983/IotStation
2c404fd0f34a8f5157eaf25a7104d6d8608bf462
64853865789e3bfb29161fe20d936b4b1d58f498
refs/heads/master
2022-01-06T15:05:58.994068
2019-05-21T13:30:55
2019-05-21T13:30:55
null
0
0
null
null
null
null
UTF-8
Java
false
false
318
java
package cn.soa.service.inter; import java.util.List; import java.util.Map; import org.springframework.stereotype.Service; @Service public interface CreateMonitorDataSI { Map<String, Object> createMonitorData(List<String> params); Map<String, Object> createTMonitorData(List<String> params); }
[ "632452599@qq.com" ]
632452599@qq.com
8724bd3e61ab44dc34ed870dc1c28a0d253f4baf
add343c3194537db4a3ae3bc478ed4e60f10b925
/src/test/java/ac/td/core/character/CharacterAssemblerTest.java
4ed3ffa50998ae6eb3043c33d56a00a24f8b4282
[]
no_license
alejoceballos/tellersdesk-core
137125bb0c3d2c1a32a62237cee19563d1f7d698
58e1148df6a35237f83aa80e248c59a07e7ae0d0
refs/heads/main
2023-04-25T23:33:54.154243
2021-05-16T21:29:53
2021-05-16T21:29:53
358,774,988
0
0
null
null
null
null
UTF-8
Java
false
false
9,742
java
package ac.td.core.character; import ac.td.core.skill.SkillType; import ac.td.core.skill.SpecialtyType; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; class CharacterAssemblerTest { @Test public void buildBeginner() throws CharacterException { final CharacterAssembler builder = CharacterAssembler.createBeginnerAssembler() .setConcept("Character's concept") .setVirtue(VirtueType.FAITH) .setVice(ViceType.GREED) .setSpecialties( SpecialtyType.HISTORY, SpecialtyType.ENGLISH_LITERATURE, SpecialtyType.LINGUISTICS); Assertions.assertEquals(builder.calculateSpentXp(), 0); BaseCharacter beginner = builder.assemble(); Assertions.assertEquals(beginner.getExperiencePoints(), 34); for (final AttributeType attributeType : AttributeType.values()) { Assertions.assertEquals(1, beginner.getAttribute(attributeType)); } for (final SkillType skillType : SkillType.values()) { Assertions.assertEquals(0, beginner.getSkill(skillType)); } } @Test public void buildExperienced() throws CharacterException { final CharacterAssembler builder = CharacterAssembler.createExperiencedAssembler() .setConcept("Character's concept") .setVirtue(VirtueType.FAITH) .setVice(ViceType.GREED) .setSpecialties(SpecialtyType.NOT_APPLICABLE, SpecialtyType.MOTORCYCLES, SpecialtyType.EVASION); Assertions.assertEquals(builder.calculateSpentXp(), 0); Assertions.assertEquals(builder.assemble().getExperiencePoints(), 69); } @Test public void buildSpecialist() throws CharacterException { final CharacterAssembler builder = CharacterAssembler.createSpecialistAssembler() .setConcept("Character's concept") .setVirtue(VirtueType.FAITH) .setVice(ViceType.GREED) .setSpecialties(SpecialtyType.NOT_APPLICABLE, SpecialtyType.MOTORCYCLES, SpecialtyType.EVASION); Assertions.assertEquals(builder.calculateSpentXp(), 0); Assertions.assertEquals(builder.assemble().getExperiencePoints(), 109); } @Test public void buildHeroic() throws CharacterException { final CharacterAssembler builder = CharacterAssembler.createHeroicAssembler() .setConcept("Character's concept") .setVirtue(VirtueType.FAITH) .setVice(ViceType.GREED) .setSpecialties(SpecialtyType.NOT_APPLICABLE, SpecialtyType.MOTORCYCLES, SpecialtyType.EVASION); Assertions.assertEquals(builder.calculateSpentXp(), 0); Assertions.assertEquals(builder.assemble().getExperiencePoints(), 134); } @Test public void buildCannotBeReused() throws CharacterException { CharacterAssembler assembler = CharacterAssembler.createBeginnerAssembler() .setConcept("Character's concept") .setVirtue(VirtueType.FAITH) .setVice(ViceType.GREED) .setSpecialties(SpecialtyType.NOT_APPLICABLE, SpecialtyType.MOTORCYCLES, SpecialtyType.EVASION); assembler.assemble(); Assertions.assertThrows(CharacterAlreadyBuiltException.class, assembler::assemble); } @Test public void buildBeginnerCharacter_AllTraits() throws CharacterException { final CharacterAssembler assembler = CharacterAssembler.createBeginnerAssembler() // Step One: Character Concept .setConcept("Character's concept") // Step Two: Anchors .setVirtue(VirtueType.HOPE) .setVice(ViceType.PRIDE) // Step Three: Select Attributes // 2.1. Select priorities .setAttributesPriorities(CategoryType.MENTAL, CategoryType.SOCIAL, CategoryType.PHYSICAL) // 2.2. Set attributes .setMentalAttributes(3, 2, 0) .setSocialAttributes(2, 1, 1) .setPhysicalAttributes(0, 2, 1) // Step Four: Select Skills // 3.1. Select priorities .setSkillsPriorities(CategoryType.SOCIAL, CategoryType.MENTAL, CategoryType.PHYSICAL) // 3.2. Set skills .setSocialSkills(0, 5, 1, 0, 1, 2, 0, 1) .setMentalSkills(0, 2, 0, 3, 0, 2, 0, 0) .setPhysicalSkills(0, 0, 2, 0, 0, 2, 0, 0) // Step Five: Pick Skill Specialties .setSpecialties(SpecialtyType.NOT_APPLICABLE, SpecialtyType.MOTORCYCLES, SpecialtyType.EVASION) // Step Six: Merits // Step Seven: Determine Advantages // Finally build the character ; Assertions.assertEquals(34, assembler.calculateSpentXp()); final BaseCharacter character = assembler.assemble(); Assertions.assertEquals(VirtueType.HOPE, character.getVirtue()); Assertions.assertEquals(ViceType.PRIDE, character.getVice()); Assertions.assertEquals(0, character.getExperiencePoints()); Assertions.assertArrayEquals( new int[] { 4, 3, 1 }, new int[]{ character.getAttribute(AttributeType.INTELLIGENCE), character.getAttribute(AttributeType.WITS), character.getAttribute(AttributeType.RESOLVE) }); Assertions.assertArrayEquals( new int[] { 3, 2, 2 }, new int[]{ character.getAttribute(AttributeType.PRESENCE), character.getAttribute(AttributeType.MANIPULATION), character.getAttribute(AttributeType.COMPOSURE) }); Assertions.assertArrayEquals( new int[] { 1, 3, 2 }, new int[]{ character.getAttribute(AttributeType.STRENGTH), character.getAttribute(AttributeType.DEXTERITY), character.getAttribute(AttributeType.STAMINA) }); Assertions.assertArrayEquals( new int[] { 0, 5, 1, 0, 1, 2, 0, 1 }, new int[]{ character.getSkill(SkillType.ANIMAL_KEN), character.getSkill(SkillType.EMPATHY), character.getSkill(SkillType.EXPRESSION), character.getSkill(SkillType.INTIMIDATION), character.getSkill(SkillType.PERSUASION), character.getSkill(SkillType.SOCIALIZE), character.getSkill(SkillType.STREETWISE), character.getSkill(SkillType.SUBTERFUGE) }); Assertions.assertArrayEquals( new int[] { 0, 2, 0, 3, 0, 2, 0, 0 }, new int[]{ character.getSkill(SkillType.ACADEMICS), character.getSkill(SkillType.COMPUTER), character.getSkill(SkillType.CRAFTS), character.getSkill(SkillType.INVESTIGATION), character.getSkill(SkillType.MEDICINE), character.getSkill(SkillType.OCCULT), character.getSkill(SkillType.POLITICS), character.getSkill(SkillType.SCIENCE) }); Assertions.assertArrayEquals( new int[] { 0, 0, 2, 0, 0, 2, 0, 0 }, new int[]{ character.getSkill(SkillType.ATHLETICS), character.getSkill(SkillType.BRAWL), character.getSkill(SkillType.DRIVE), character.getSkill(SkillType.FIREARMS), character.getSkill(SkillType.LARCENY), character.getSkill(SkillType.STEALTH), character.getSkill(SkillType.SURVIVAL), character.getSkill(SkillType.WEAPONRY) }); } @Test public void buildBeginnerCharacter_TooManyPointsPerCategory() throws CharacterException { final CharacterAssembler builder = CharacterAssembler.createBeginnerAssembler() .setAttributesPriorities( CategoryType.MENTAL, CategoryType.SOCIAL, CategoryType.PHYSICAL) .setSkillsPriorities( CategoryType.SOCIAL, CategoryType.MENTAL, CategoryType.PHYSICAL); Assertions.assertThrows( TooManyDotsPerCategoryException.class, () -> builder.setMentalAttributes(3, 2, 1)); Assertions.assertThrows( TooManyDotsPerCategoryException.class, () -> builder.setSocialAttributes(2, 2, 1)); Assertions.assertThrows( TooManyDotsPerCategoryException.class, () -> builder.setPhysicalAttributes(1, 2, 1)); Assertions.assertThrows( TooManyDotsPerCategoryException.class, () -> builder.setSocialSkills(1, 3, 1, 0, 3, 2, 0, 2)); Assertions.assertThrows( TooManyDotsPerCategoryException.class, () -> builder.setMentalSkills(0, 2, 1, 3, 0, 2, 0, 0)); Assertions.assertThrows( TooManyDotsPerCategoryException.class, () -> builder.setPhysicalSkills(0, 0, 2, 0, 1, 2, 0, 0)); } }
[ "alejoceballos75@gmail.com" ]
alejoceballos75@gmail.com
93781f2e9a07aab2df2c18482909b8bd22b94ea7
604260517b2fb54f3cb270a3e9e190e727998101
/src/lession03/UDPClientDemo01.java
9b0a1d636b4dbd149f3f55224ed09d1a23ac93eb
[]
no_license
Weikang01/Java_Basic_tutorial
414b9306608ae535d73bbed77226c0775c5b211f
7b508d499ef58cacb0d66bb95917e018dca883ef
refs/heads/master
2023-06-20T09:20:39.627509
2021-07-17T02:03:04
2021-07-17T02:03:04
383,960,862
0
0
null
null
null
null
UTF-8
Java
false
false
671
java
package lession03; import java.net.DatagramPacket; import java.net.DatagramSocket; import java.net.InetAddress; public class UDPClientDemo01 { public static void main(String[] args) throws Exception { // 1. create a socket DatagramSocket socket = new DatagramSocket(9080); // 2. create a package String msg = "hello"; InetAddress address = InetAddress.getByName("localhost"); int port = 9090; DatagramPacket packet = new DatagramPacket(msg.getBytes(), 0, msg.getBytes().length, address, port); // 3. send package socket.send(packet); // close stream socket.close(); } }
[ "lwkdota@qq.com" ]
lwkdota@qq.com
349c4441f0c033a104ba69c3ed8eee8430acacb5
db03c13ea039a45551e81d20b70e50e38ca681bf
/app/src/main/java/com/mhky/yaolinwang/order/fragment/CustomerOrdersFragment4.java
fe2c2a46340e5c1d1ba0776afab4ef1b99fc42ae
[]
no_license
Ckeack66/DianHuoTongProject
3f6e261c17efffea23f598515ae200d75c938ebe
d44e14e1c32feecff81a40077c43c66d2a0f3ace
refs/heads/master
2020-03-31T16:54:43.230089
2018-10-19T11:00:25
2018-10-19T11:00:25
145,216,509
0
0
null
null
null
null
UTF-8
Java
false
false
11,797
java
package com.mhky.yaolinwang.order.fragment; import android.os.Bundle; import android.support.annotation.NonNull; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import android.widget.Toast; import com.alibaba.fastjson.JSON; import com.chad.library.adapter.base.BaseQuickAdapter; import com.lzy.okgo.model.HttpParams; import com.mhky.dianhuotong.R; import com.mhky.dianhuotong.base.BaseFragment; import com.mhky.dianhuotong.base.BasePresenter; import com.mhky.dianhuotong.base.BaseTool; import com.mhky.dianhuotong.custom.ToastUtil; import com.mhky.yaolinwang.adapter.CustomerOrderAdapter; import com.mhky.yaolinwang.order.bean.CustomerOrder; import com.mhky.yaolinwang.order.bean.CustomerOrderBean; import com.mhky.yaolinwang.order.presenter.CustomerOrdersPresenter; import com.mhky.yaolinwang.order.view.CustomerOrdersView; import com.pgyersdk.crash.PgyCrashManager; import com.scwang.smartrefresh.layout.SmartRefreshLayout; import com.scwang.smartrefresh.layout.api.RefreshLayout; import com.scwang.smartrefresh.layout.constant.SpinnerStyle; import com.scwang.smartrefresh.layout.footer.BallPulseFooter; import com.scwang.smartrefresh.layout.header.BezierRadarHeader; import com.scwang.smartrefresh.layout.listener.OnRefreshLoadMoreListener; import java.util.ArrayList; import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.Unbinder; /** * */ public class CustomerOrdersFragment4 extends BaseFragment implements CustomerOrdersView { // TODO: Rename parameter arguments, choose names that match // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER private static final String ARG_PARAM1 = "param1"; private static final String ARG_PARAM2 = "param2"; @BindView(R.id.rv_customer_order) RecyclerView rvCustomerOrder; @BindView(R.id.srl_customer_order) SmartRefreshLayout srlCustomerOrder; Unbinder unbinder; // TODO: Rename and change types of parameters private String mParam1; private String mParam2; private CustomerOrdersPresenter customerOrdersPresenter; private List<BasePresenter> presenterList = new ArrayList<>(); private List<CustomerOrder> list_customer_order = new ArrayList<>(); private CustomerOrderAdapter customerOrderAdapter; private int page = 0; private boolean isFirst = true; public CustomerOrdersFragment4() { // Required empty public constructor } /** * Use this factory method to create a new instance of * this fragment using the provided parameters. * * @param param1 Parameter 1. * @param param2 Parameter 2. * @return A new instance of fragment CustomerOrdersFragment4. */ // TODO: Rename and change types and number of parameters public static CustomerOrdersFragment4 newInstance(String param1, String param2) { CustomerOrdersFragment4 fragment = new CustomerOrdersFragment4(); Bundle args = new Bundle(); args.putString(ARG_PARAM1, param1); args.putString(ARG_PARAM2, param2); fragment.setArguments(args); return fragment; } @Override public List<BasePresenter> getPresenter() { return presenterList; } @Override public void initPresenter() { customerOrdersPresenter = new CustomerOrdersPresenter(); presenterList.add(customerOrdersPresenter); } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { mParam1 = getArguments().getString(ARG_PARAM1); mParam2 = getArguments().getString(ARG_PARAM2); } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View view = inflater.inflate(R.layout.fragment_customer_orders_fragment4, container, false); unbinder = ButterKnife.bind(this, view); initView(); initListener(); initData(); return view; } private void initView() { LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext()); linearLayoutManager.setOrientation(LinearLayoutManager.VERTICAL); rvCustomerOrder.setLayoutManager(linearLayoutManager); customerOrderAdapter = new CustomerOrderAdapter(list_customer_order,getContext()); customerOrderAdapter.openLoadAnimation(BaseQuickAdapter.SLIDEIN_BOTTOM); customerOrderAdapter.setEmptyView(R.layout.empty_view,rvCustomerOrder); rvCustomerOrder.setAdapter(customerOrderAdapter); srlCustomerOrder.setRefreshHeader(new BezierRadarHeader(getContext()).setEnableHorizontalDrag(true).setPrimaryColor(getResources().getColor(R.color.color04c1ab)).setAccentColor(getResources().getColor(R.color.colorWhite))); srlCustomerOrder.setRefreshFooter(new BallPulseFooter(getContext()).setSpinnerStyle(SpinnerStyle.Scale).setAnimatingColor(getResources().getColor(R.color.color04c1ab)).setNormalColor(getResources().getColor(R.color.color04c1ab))); } private void initListener() { srlCustomerOrder.setOnRefreshLoadMoreListener(new OnRefreshLoadMoreListener() { @Override public void onLoadMore(@NonNull RefreshLayout refreshLayout) { page++; isFirst = false; srlCustomerOrder.setEnableRefresh(false); initData(); } @Override public void onRefresh(@NonNull RefreshLayout refreshLayout) { page = 0; isFirst = false; srlCustomerOrder.setEnableLoadMore(false); initData(); } }); customerOrderAdapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() { @Override public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) { switch (view.getId()){ case R.id.rl_order_top: BaseTool.logPrint("rl_order_top",((CustomerOrder)adapter.getData().get(position)).getCustomerOrderTopInfo().getShopId()); break; case R.id.rl_customer_order_body: BaseTool.logPrint("rl_customer_order_body",((CustomerOrder)adapter.getData().get(position)).getOrderId()); break; case R.id.btn_1: switch (((TextView)view).getText().toString()){ case "去付款": BaseTool.logPrint("btn_1",((TextView)view).getText().toString()); break; case "申请退款": BaseTool.logPrint("btn_1",((TextView)view).getText().toString()); break; case "确认收货": BaseTool.logPrint("btn_1",((TextView)view).getText().toString()); break; case "去评价": BaseTool.logPrint("btn_1",((TextView)view).getText().toString()); break; case "查看进度": BaseTool.logPrint("btn_1",((TextView)view).getText().toString()); break; } break; case R.id.btn_2: switch (((TextView)view).getText().toString()){ case "申请退款": BaseTool.logPrint("btn_2",((TextView)view).getText().toString()); break; case "查看配送": BaseTool.logPrint("btn_2",((TextView)view).getText().toString()); break; } break; case R.id.btn_3: BaseTool.logPrint("btn_3",((TextView)view).getText().toString()); break; } } }); } private void initData() { try { HttpParams httpParams = new HttpParams(); httpParams.put("page",page); httpParams.put("size",10); httpParams.put("status","SHIPPED"); customerOrdersPresenter.getCustomerOrders(httpParams); }catch (Exception e){ PgyCrashManager.reportCaughtException(getContext(),e); } } @Override public void onDetach() { super.onDetach(); } @Override public void getCustomerOrdersSuccess(String data) { CustomerOrderBean customerOrderBean_temp = JSON.parseObject(data,CustomerOrderBean.class); int size = customerOrderBean_temp.getContent().size(); if (customerOrderBean_temp != null){ if (page == 0){ if(size == 0){ srlCustomerOrder.setEnableLoadMore(false); srlCustomerOrder.finishRefresh(); srlCustomerOrder.finishLoadMoreWithNoMoreData(); }else if (size < 10){ srlCustomerOrder.setEnableLoadMore(false); srlCustomerOrder.finishRefresh(); srlCustomerOrder.finishLoadMoreWithNoMoreData(); customerOrderAdapter.setNewData(customerOrdersPresenter.getCustomerOrderList(customerOrderBean_temp)); }else if (size == 10){ srlCustomerOrder.setEnableLoadMore(true); srlCustomerOrder.finishRefresh(); customerOrderAdapter.setNewData(customerOrdersPresenter.getCustomerOrderList(customerOrderBean_temp)); } if(!isFirst){ ToastUtil.makeText(getContext(), "刷新成功", Toast.LENGTH_SHORT).show(); } }else { if(size == 0){ srlCustomerOrder.setEnableRefresh(true); srlCustomerOrder.setEnableLoadMore(false); srlCustomerOrder.finishLoadMoreWithNoMoreData(); ToastUtil.makeText(getContext(), "已加载全部数据", Toast.LENGTH_SHORT).show(); }else if (size < 10){ srlCustomerOrder.setEnableRefresh(true); srlCustomerOrder.setEnableLoadMore(false); srlCustomerOrder.finishLoadMoreWithNoMoreData(); customerOrderAdapter.addData(customerOrdersPresenter.getCustomerOrderList(customerOrderBean_temp)); ToastUtil.makeText(getContext(), "已加载全部数据", Toast.LENGTH_SHORT).show(); }else if (size == 10){ srlCustomerOrder.finishLoadMore(); srlCustomerOrder.setEnableRefresh(true); customerOrderAdapter.addData(customerOrdersPresenter.getCustomerOrderList(customerOrderBean_temp)); ToastUtil.makeText(getContext(), "加载了更多", Toast.LENGTH_SHORT).show(); } } } } @Override public void getCustomerOrdersFailed(String data) { ToastUtil.makeText(getContext(),data,Toast.LENGTH_SHORT).show(); } @Override public void onDestroyView() { super.onDestroyView(); unbinder.unbind(); } }
[ "lizhetongliao@163.com" ]
lizhetongliao@163.com
cd1db3925836f40c0726683479e180480eb6e06d
3e218cd8dcb1ab21fee6e5ebd25f38d15f9109b5
/src/main/java/com/bigbang/old/DivideTwoIntegers.java
f12cd834b22e1670f6ae2e52343e0a1c943728e8
[]
no_license
BangpengGao/LeetCode
46e54a72bc1a6a45f7731a0393ae2818298339db
ad85119e51a7ae41664236b8055ae7b2d0da06fe
refs/heads/master
2022-12-11T02:39:07.255471
2022-12-02T08:17:22
2022-12-02T08:17:40
147,076,939
1
1
null
null
null
null
UTF-8
Java
false
false
941
java
package com.bigbang.old.learn; /* * @ Created with IntelliJ IDEA * @ Author Bangpeng Gao * @ Version 1.0.0 * @ Since 1.0.0 * @ Date 2019/12/24 * @ Time 16:23 */ public class DivideTwoIntegers { public static int divide(int dividend, int divisor) { boolean flag = false; if ((dividend < 0 && divisor > 0) || (dividend > 0 && divisor < 0)) flag = true; dividend = Math.abs(dividend); divisor = Math.abs(divisor); if (dividend == 0 || dividend < divisor) return 0; int w = 0; while (divisor > 1) { divisor = divisor >> 1; w += 1; } if (w == 0) return dividend; int res = 0; while (dividend > 1) { dividend >>= w; res += 1; } return flag ? -res : res; } public static void main(String[] args) { System.out.println(divide(7, -3)); } }
[ "gaobangpeng@haier.com" ]
gaobangpeng@haier.com
92bd6d467e701e851b6a0bed4251402617064c51
e5dbb3f027fe2c289e344f0906f2017f5ed163fd
/src/main/java/org/apache/commons/math4/geometry/euclidean/twod/PolygonsSet.java
7f655c7b10491d8b0ffa9c27ddfcb25195fd3f6d
[]
no_license
kaiyuanw/GZoltar-Bug-Report
98f32384fe094e4d96e9224a3f86f0e2f863658d
38fa2b71e9fc51bb69d05484ff3dd1b8f8cdc19b
refs/heads/master
2020-03-27T02:06:10.481105
2018-08-24T15:48:40
2018-08-24T15:48:40
145,766,500
0
0
null
null
null
null
UTF-8
Java
false
false
45,278
java
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.apache.commons.math4.geometry.euclidean.twod; import java.util.ArrayList; import java.util.Collection; import java.util.List; import org.apache.commons.math4.geometry.Point; import org.apache.commons.math4.geometry.euclidean.oned.Euclidean1D; import org.apache.commons.math4.geometry.euclidean.oned.Interval; import org.apache.commons.math4.geometry.euclidean.oned.IntervalsSet; import org.apache.commons.math4.geometry.euclidean.oned.Vector1D; import org.apache.commons.math4.geometry.partitioning.AbstractRegion; import org.apache.commons.math4.geometry.partitioning.AbstractSubHyperplane; import org.apache.commons.math4.geometry.partitioning.BSPTree; import org.apache.commons.math4.geometry.partitioning.BSPTreeVisitor; import org.apache.commons.math4.geometry.partitioning.BoundaryAttribute; import org.apache.commons.math4.geometry.partitioning.Hyperplane; import org.apache.commons.math4.geometry.partitioning.Side; import org.apache.commons.math4.geometry.partitioning.SubHyperplane; import org.apache.commons.math4.util.FastMath; import org.apache.commons.math4.util.Precision; /** This class represents a 2D region: a set of polygons. * @since 3.0 */ public class PolygonsSet extends AbstractRegion<Euclidean2D, Euclidean1D> { /** Vertices organized as boundary loops. */ private Vector2D[][] vertices; /** Build a polygons set representing the whole plane. * @param tolerance tolerance below which points are considered identical * @since 3.3 */ public PolygonsSet(final double tolerance) { super(tolerance); } /** Build a polygons set from a BSP tree. * <p>The leaf nodes of the BSP tree <em>must</em> have a * {@code Boolean} attribute representing the inside status of * the corresponding cell (true for inside cells, false for outside * cells). In order to avoid building too many small objects, it is * recommended to use the predefined constants * {@code Boolean.TRUE} and {@code Boolean.FALSE}</p> * <p> * This constructor is aimed at expert use, as building the tree may * be a difficult task. It is not intended for general use and for * performances reasons does not check thoroughly its input, as this would * require walking the full tree each time. Failing to provide a tree with * the proper attributes, <em>will</em> therefore generate problems like * {@link NullPointerException} or {@link ClassCastException} only later on. * This limitation is known and explains why this constructor is for expert * use only. The caller does have the responsibility to provided correct arguments. * </p> * @param tree inside/outside BSP tree representing the region * @param tolerance tolerance below which points are considered identical * @since 3.3 */ public PolygonsSet(final BSPTree<Euclidean2D> tree, final double tolerance) { super(tree, tolerance); } /** Build a polygons set from a Boundary REPresentation (B-rep). * <p>The boundary is provided as a collection of {@link * SubHyperplane sub-hyperplanes}. Each sub-hyperplane has the * interior part of the region on its minus side and the exterior on * its plus side.</p> * <p>The boundary elements can be in any order, and can form * several non-connected sets (like for example polygons with holes * or a set of disjoint polygons considered as a whole). In * fact, the elements do not even need to be connected together * (their topological connections are not used here). However, if the * boundary does not really separate an inside open from an outside * open (open having here its topological meaning), then subsequent * calls to the {@link * org.apache.commons.math4.geometry.partitioning.Region#checkPoint(org.apache.commons.math4.geometry.Point) * checkPoint} method will not be meaningful anymore.</p> * <p>If the boundary is empty, the region will represent the whole * space.</p> * @param boundary collection of boundary elements, as a * collection of {@link SubHyperplane SubHyperplane} objects * @param tolerance tolerance below which points are considered identical * @since 3.3 */ public PolygonsSet(final Collection<SubHyperplane<Euclidean2D>> boundary, final double tolerance) { super(boundary, tolerance); } /** Build a parallellepipedic box. * @param xMin low bound along the x direction * @param xMax high bound along the x direction * @param yMin low bound along the y direction * @param yMax high bound along the y direction * @param tolerance tolerance below which points are considered identical * @since 3.3 */ public PolygonsSet(final double xMin, final double xMax, final double yMin, final double yMax, final double tolerance) { super(boxBoundary(xMin, xMax, yMin, yMax, tolerance), tolerance); } /** Build a polygon from a simple list of vertices. * <p>The boundary is provided as a list of points considering to * represent the vertices of a simple loop. The interior part of the * region is on the left side of this path and the exterior is on its * right side.</p> * <p>This constructor does not handle polygons with a boundary * forming several disconnected paths (such as polygons with holes).</p> * <p>For cases where this simple constructor applies, it is expected to * be numerically more robust than the {@link #PolygonsSet(Collection,double) general * constructor} using {@link SubHyperplane subhyperplanes}.</p> * <p>If the list is empty, the region will represent the whole * space.</p> * <p> * Polygons with thin pikes or dents are inherently difficult to handle because * they involve lines with almost opposite directions at some vertices. Polygons * whose vertices come from some physical measurement with noise are also * difficult because an edge that should be straight may be broken in lots of * different pieces with almost equal directions. In both cases, computing the * lines intersections is not numerically robust due to the almost 0 or almost * &pi; angle. Such cases need to carefully adjust the {@code hyperplaneThickness} * parameter. A too small value would often lead to completely wrong polygons * with large area wrongly identified as inside or outside. Large values are * often much safer. As a rule of thumb, a value slightly below the size of the * most accurate detail needed is a good value for the {@code hyperplaneThickness} * parameter. * </p> * @param hyperplaneThickness tolerance below which points are considered to * belong to the hyperplane (which is therefore more a slab) * @param vertices vertices of the simple loop boundary */ public PolygonsSet(final double hyperplaneThickness, final Vector2D ... vertices) { super(verticesToTree(hyperplaneThickness, vertices), hyperplaneThickness); } /** Create a list of hyperplanes representing the boundary of a box. * @param xMin low bound along the x direction * @param xMax high bound along the x direction * @param yMin low bound along the y direction * @param yMax high bound along the y direction * @param tolerance tolerance below which points are considered identical * @return boundary of the box */ private static Line[] boxBoundary(final double xMin, final double xMax, final double yMin, final double yMax, final double tolerance) { if ((xMin >= xMax - tolerance) || (yMin >= yMax - tolerance)) { // too thin box, build an empty polygons set return null; } final Vector2D minMin = new Vector2D(xMin, yMin); final Vector2D minMax = new Vector2D(xMin, yMax); final Vector2D maxMin = new Vector2D(xMax, yMin); final Vector2D maxMax = new Vector2D(xMax, yMax); return new Line[] { new Line(minMin, maxMin, tolerance), new Line(maxMin, maxMax, tolerance), new Line(maxMax, minMax, tolerance), new Line(minMax, minMin, tolerance) }; } /** Build the BSP tree of a polygons set from a simple list of vertices. * <p>The boundary is provided as a list of points considering to * represent the vertices of a simple loop. The interior part of the * region is on the left side of this path and the exterior is on its * right side.</p> * <p>This constructor does not handle polygons with a boundary * forming several disconnected paths (such as polygons with holes).</p> * <p>For cases where this simple constructor applies, it is expected to * be numerically more robust than the {@link #PolygonsSet(Collection,double) general * constructor} using {@link SubHyperplane subhyperplanes}.</p> * @param hyperplaneThickness tolerance below which points are consider to * belong to the hyperplane (which is therefore more a slab) * @param vertices vertices of the simple loop boundary * @return the BSP tree of the input vertices */ private static BSPTree<Euclidean2D> verticesToTree(final double hyperplaneThickness, final Vector2D ... vertices) { final int n = vertices.length; if (n == 0) { // the tree represents the whole space return new BSPTree<Euclidean2D>(Boolean.TRUE); } // build the vertices final Vertex[] vArray = new Vertex[n]; for (int i = 0; i < n; ++i) { vArray[i] = new Vertex(vertices[i]); } // build the edges List<Edge> edges = new ArrayList<Edge>(n); for (int i = 0; i < n; ++i) { // get the endpoints of the edge final Vertex start = vArray[i]; final Vertex end = vArray[(i + 1) % n]; // get the line supporting the edge, taking care not to recreate it // if it was already created earlier due to another edge being aligned // with the current one Line line = start.sharedLineWith(end); if (line == null) { line = new Line(start.getLocation(), end.getLocation(), hyperplaneThickness); } // create the edge and store it edges.add(new Edge(start, end, line)); // check if another vertex also happens to be on this line for (final Vertex vertex : vArray) { if (vertex != start && vertex != end && FastMath.abs(line.getOffset((Point<Euclidean2D>) vertex.getLocation())) <= hyperplaneThickness) { vertex.bindWith(line); } } } // build the tree top-down final BSPTree<Euclidean2D> tree = new BSPTree<Euclidean2D>(); insertEdges(hyperplaneThickness, tree, edges); return tree; } /** Recursively build a tree by inserting cut sub-hyperplanes. * @param hyperplaneThickness tolerance below which points are consider to * belong to the hyperplane (which is therefore more a slab) * @param node current tree node (it is a leaf node at the beginning * of the call) * @param edges list of edges to insert in the cell defined by this node * (excluding edges not belonging to the cell defined by this node) */ private static void insertEdges(final double hyperplaneThickness, final BSPTree<Euclidean2D> node, final List<Edge> edges) { // find an edge with an hyperplane that can be inserted in the node int index = 0; Edge inserted =null; while (inserted == null && index < edges.size()) { inserted = edges.get(index++); if (inserted.getNode() == null) { if (node.insertCut(inserted.getLine())) { inserted.setNode(node); } else { inserted = null; } } else { inserted = null; } } if (inserted == null) { // no suitable edge was found, the node remains a leaf node // we need to set its inside/outside boolean indicator final BSPTree<Euclidean2D> parent = node.getParent(); if (parent == null || node == parent.getMinus()) { node.setAttribute(Boolean.TRUE); } else { node.setAttribute(Boolean.FALSE); } return; } // we have split the node by inserting an edge as a cut sub-hyperplane // distribute the remaining edges in the two sub-trees final List<Edge> plusList = new ArrayList<Edge>(); final List<Edge> minusList = new ArrayList<Edge>(); for (final Edge edge : edges) { if (edge != inserted) { final double startOffset = inserted.getLine().getOffset((Point<Euclidean2D>) edge.getStart().getLocation()); final double endOffset = inserted.getLine().getOffset((Point<Euclidean2D>) edge.getEnd().getLocation()); Side startSide = (FastMath.abs(startOffset) <= hyperplaneThickness) ? Side.HYPER : ((startOffset < 0) ? Side.MINUS : Side.PLUS); Side endSide = (FastMath.abs(endOffset) <= hyperplaneThickness) ? Side.HYPER : ((endOffset < 0) ? Side.MINUS : Side.PLUS); switch (startSide) { case PLUS: if (endSide == Side.MINUS) { // we need to insert a split point on the hyperplane final Vertex splitPoint = edge.split(inserted.getLine()); minusList.add(splitPoint.getOutgoing()); plusList.add(splitPoint.getIncoming()); } else { plusList.add(edge); } break; case MINUS: if (endSide == Side.PLUS) { // we need to insert a split point on the hyperplane final Vertex splitPoint = edge.split(inserted.getLine()); minusList.add(splitPoint.getIncoming()); plusList.add(splitPoint.getOutgoing()); } else { minusList.add(edge); } break; default: if (endSide == Side.PLUS) { plusList.add(edge); } else if (endSide == Side.MINUS) { minusList.add(edge); } break; } } } // recurse through lower levels if (!plusList.isEmpty()) { insertEdges(hyperplaneThickness, node.getPlus(), plusList); } else { node.getPlus().setAttribute(Boolean.FALSE); } if (!minusList.isEmpty()) { insertEdges(hyperplaneThickness, node.getMinus(), minusList); } else { node.getMinus().setAttribute(Boolean.TRUE); } } /** Internal class for holding vertices while they are processed to build a BSP tree. */ private static class Vertex { /** Vertex location. */ private final Vector2D location; /** Incoming edge. */ private Edge incoming; /** Outgoing edge. */ private Edge outgoing; /** Lines bound with this vertex. */ private final List<Line> lines; /** Build a non-processed vertex not owned by any node yet. * @param location vertex location */ public Vertex(final Vector2D location) { this.location = location; this.incoming = null; this.outgoing = null; this.lines = new ArrayList<Line>(); } /** Get Vertex location. * @return vertex location */ public Vector2D getLocation() { return location; } /** Bind a line considered to contain this vertex. * @param line line to bind with this vertex */ public void bindWith(final Line line) { lines.add(line); } /** Get the common line bound with both the instance and another vertex, if any. * <p> * When two vertices are both bound to the same line, this means they are * already handled by node associated with this line, so there is no need * to create a cut hyperplane for them. * </p> * @param vertex other vertex to check instance against * @return line bound with both the instance and another vertex, or null if the * two vertices do not share a line yet */ public Line sharedLineWith(final Vertex vertex) { for (final Line line1 : lines) { for (final Line line2 : vertex.lines) { if (line1 == line2) { return line1; } } } return null; } /** Set incoming edge. * <p> * The line supporting the incoming edge is automatically bound * with the instance. * </p> * @param incoming incoming edge */ public void setIncoming(final Edge incoming) { this.incoming = incoming; bindWith(incoming.getLine()); } /** Get incoming edge. * @return incoming edge */ public Edge getIncoming() { return incoming; } /** Set outgoing edge. * <p> * The line supporting the outgoing edge is automatically bound * with the instance. * </p> * @param outgoing outgoing edge */ public void setOutgoing(final Edge outgoing) { this.outgoing = outgoing; bindWith(outgoing.getLine()); } /** Get outgoing edge. * @return outgoing edge */ public Edge getOutgoing() { return outgoing; } } /** Internal class for holding edges while they are processed to build a BSP tree. */ private static class Edge { /** Start vertex. */ private final Vertex start; /** End vertex. */ private final Vertex end; /** Line supporting the edge. */ private final Line line; /** Node whose cut hyperplane contains this edge. */ private BSPTree<Euclidean2D> node; /** Build an edge not contained in any node yet. * @param start start vertex * @param end end vertex * @param line line supporting the edge */ public Edge(final Vertex start, final Vertex end, final Line line) { this.start = start; this.end = end; this.line = line; this.node = null; // connect the vertices back to the edge start.setOutgoing(this); end.setIncoming(this); } /** Get start vertex. * @return start vertex */ public Vertex getStart() { return start; } /** Get end vertex. * @return end vertex */ public Vertex getEnd() { return end; } /** Get the line supporting this edge. * @return line supporting this edge */ public Line getLine() { return line; } /** Set the node whose cut hyperplane contains this edge. * @param node node whose cut hyperplane contains this edge */ public void setNode(final BSPTree<Euclidean2D> node) { this.node = node; } /** Get the node whose cut hyperplane contains this edge. * @return node whose cut hyperplane contains this edge * (null if edge has not yet been inserted into the BSP tree) */ public BSPTree<Euclidean2D> getNode() { return node; } /** Split the edge. * <p> * Once split, this edge is not referenced anymore by the vertices, * it is replaced by the two half-edges and an intermediate splitting * vertex is introduced to connect these two halves. * </p> * @param splitLine line splitting the edge in two halves * @return split vertex (its incoming and outgoing edges are the two halves) */ public Vertex split(final Line splitLine) { final Vertex splitVertex = new Vertex(line.intersection(splitLine)); splitVertex.bindWith(splitLine); final Edge startHalf = new Edge(start, splitVertex, line); final Edge endHalf = new Edge(splitVertex, end, line); startHalf.node = node; endHalf.node = node; return splitVertex; } } /** {@inheritDoc} */ @Override public PolygonsSet buildNew(final BSPTree<Euclidean2D> tree) { return new PolygonsSet(tree, getTolerance()); } /** {@inheritDoc} */ @Override protected void computeGeometricalProperties() { final Vector2D[][] v = getVertices(); if (v.length == 0) { final BSPTree<Euclidean2D> tree = getTree(false); if (tree.getCut() == null && (Boolean) tree.getAttribute()) { // the instance covers the whole space setSize(Double.POSITIVE_INFINITY); setBarycenter((Point<Euclidean2D>) Vector2D.NaN); } else { setSize(0); setBarycenter((Point<Euclidean2D>) new Vector2D(0, 0)); } } else if (v[0][0] == null) { // there is at least one open-loop: the polygon is infinite setSize(Double.POSITIVE_INFINITY); setBarycenter((Point<Euclidean2D>) Vector2D.NaN); } else { // all loops are closed, we compute some integrals around the shape double sum = 0; double sumX = 0; double sumY = 0; for (Vector2D[] loop : v) { double x1 = loop[loop.length - 1].getX(); double y1 = loop[loop.length - 1].getY(); for (final Vector2D point : loop) { final double x0 = x1; final double y0 = y1; x1 = point.getX(); y1 = point.getY(); final double factor = x0 * y1 - y0 * x1; sum += factor; sumX += factor * (x0 + x1); sumY += factor * (y0 + y1); } } if (sum < 0) { // the polygon as a finite outside surrounded by an infinite inside setSize(Double.POSITIVE_INFINITY); setBarycenter((Point<Euclidean2D>) Vector2D.NaN); } else { setSize(sum / 2); setBarycenter((Point<Euclidean2D>) new Vector2D(sumX / (3 * sum), sumY / (3 * sum))); } } } /** Get the vertices of the polygon. * <p>The polygon boundary can be represented as an array of loops, * each loop being itself an array of vertices.</p> * <p>In order to identify open loops which start and end by * infinite edges, the open loops arrays start with a null point. In * this case, the first non null point and the last point of the * array do not represent real vertices, they are dummy points * intended only to get the direction of the first and last edge. An * open loop consisting of a single infinite line will therefore be * represented by a three elements array with one null point * followed by two dummy points. The open loops are always the first * ones in the loops array.</p> * <p>If the polygon has no boundary at all, a zero length loop * array will be returned.</p> * <p>All line segments in the various loops have the inside of the * region on their left side and the outside on their right side * when moving in the underlying line direction. This means that * closed loops surrounding finite areas obey the direct * trigonometric orientation.</p> * @return vertices of the polygon, organized as oriented boundary * loops with the open loops first (the returned value is guaranteed * to be non-null) */ public Vector2D[][] getVertices() { if (vertices == null) { if (getTree(false).getCut() == null) { vertices = new Vector2D[0][]; } else { // build the unconnected segments final SegmentsBuilder visitor = new SegmentsBuilder(getTolerance()); getTree(true).visit(visitor); final List<ConnectableSegment> segments = visitor.getSegments(); // connect all segments, using topological criteria first // and using Euclidean distance only as a last resort int pending = segments.size(); pending -= naturalFollowerConnections(segments); if (pending > 0) { pending -= splitEdgeConnections(segments); } if (pending > 0) { pending -= closeVerticesConnections(segments); } // create the segment loops final ArrayList<List<Segment>> loops = new ArrayList<List<Segment>>(); for (ConnectableSegment s = getUnprocessed(segments); s != null; s = getUnprocessed(segments)) { final List<Segment> loop = followLoop(s); if (loop != null) { if (loop.get(0).getStart() == null) { // this is an open loop, we put it on the front loops.add(0, loop); } else { // this is a closed loop, we put it on the back loops.add(loop); } } } // transform the loops in an array of arrays of points vertices = new Vector2D[loops.size()][]; int i = 0; for (final List<Segment> loop : loops) { if (loop.size() < 2 || (loop.size() == 2 && loop.get(0).getStart() == null && loop.get(1).getEnd() == null)) { // single infinite line final Line line = loop.get(0).getLine(); vertices[i++] = new Vector2D[] { null, line.toSpace((Point<Euclidean1D>) new Vector1D(-Float.MAX_VALUE)), line.toSpace((Point<Euclidean1D>) new Vector1D(+Float.MAX_VALUE)) }; } else if (loop.get(0).getStart() == null) { // open loop with at least one real point final Vector2D[] array = new Vector2D[loop.size() + 2]; int j = 0; for (Segment segment : loop) { if (j == 0) { // null point and first dummy point double x = segment.getLine().toSubSpace((Point<Euclidean2D>) segment.getEnd()).getX(); x -= FastMath.max(1.0, FastMath.abs(x / 2)); array[j++] = null; array[j++] = segment.getLine().toSpace((Point<Euclidean1D>) new Vector1D(x)); } if (j < (array.length - 1)) { // current point array[j++] = segment.getEnd(); } if (j == (array.length - 1)) { // last dummy point double x = segment.getLine().toSubSpace((Point<Euclidean2D>) segment.getStart()).getX(); x += FastMath.max(1.0, FastMath.abs(x / 2)); array[j++] = segment.getLine().toSpace((Point<Euclidean1D>) new Vector1D(x)); } } vertices[i++] = array; } else { final Vector2D[] array = new Vector2D[loop.size()]; int j = 0; for (Segment segment : loop) { array[j++] = segment.getStart(); } vertices[i++] = array; } } } } return vertices.clone(); } /** Connect the segments using only natural follower information. * @param segments segments complete segments list * @return number of connections performed */ private int naturalFollowerConnections(final List<ConnectableSegment> segments) { int connected = 0; for (final ConnectableSegment segment : segments) { if (segment.getNext() == null) { final BSPTree<Euclidean2D> node = segment.getNode(); final BSPTree<Euclidean2D> end = segment.getEndNode(); for (final ConnectableSegment candidateNext : segments) { if (candidateNext.getPrevious() == null && candidateNext.getNode() == end && candidateNext.getStartNode() == node) { // connect the two segments segment.setNext(candidateNext); candidateNext.setPrevious(segment); ++connected; break; } } } } return connected; } /** Connect the segments resulting from a line splitting a straight edge. * @param segments segments complete segments list * @return number of connections performed */ private int splitEdgeConnections(final List<ConnectableSegment> segments) { int connected = 0; for (final ConnectableSegment segment : segments) { if (segment.getNext() == null) { final Hyperplane<Euclidean2D> hyperplane = segment.getNode().getCut().getHyperplane(); final BSPTree<Euclidean2D> end = segment.getEndNode(); for (final ConnectableSegment candidateNext : segments) { if (candidateNext.getPrevious() == null && candidateNext.getNode().getCut().getHyperplane() == hyperplane && candidateNext.getStartNode() == end) { // connect the two segments segment.setNext(candidateNext); candidateNext.setPrevious(segment); ++connected; break; } } } } return connected; } /** Connect the segments using Euclidean distance. * <p> * This connection heuristic should be used last, as it relies * only on a fuzzy distance criterion. * </p> * @param segments segments complete segments list * @return number of connections performed */ private int closeVerticesConnections(final List<ConnectableSegment> segments) { int connected = 0; for (final ConnectableSegment segment : segments) { if (segment.getNext() == null && segment.getEnd() != null) { final Vector2D end = segment.getEnd(); ConnectableSegment selectedNext = null; double min = Double.POSITIVE_INFINITY; for (final ConnectableSegment candidateNext : segments) { if (candidateNext.getPrevious() == null && candidateNext.getStart() != null) { final double distance = Vector2D.distance(end, candidateNext.getStart()); if (distance < min) { selectedNext = candidateNext; min = distance; } } } if (min <= getTolerance()) { // connect the two segments segment.setNext(selectedNext); selectedNext.setPrevious(segment); ++connected; } } } return connected; } /** Get first unprocessed segment from a list. * @param segments segments list * @return first segment that has not been processed yet * or null if all segments have been processed */ private ConnectableSegment getUnprocessed(final List<ConnectableSegment> segments) { for (final ConnectableSegment segment : segments) { if (!segment.isProcessed()) { return segment; } } return null; } /** Build the loop containing a segment. * <p> * The segment put in the loop will be marked as processed. * </p> * @param defining segment used to define the loop * @return loop containing the segment (may be null if the loop is a * degenerated infinitely thin 2 points loop */ private List<Segment> followLoop(final ConnectableSegment defining) { final List<Segment> loop = new ArrayList<Segment>(); loop.add(defining); defining.setProcessed(true); // add segments in connection order ConnectableSegment next = defining.getNext(); while (next != defining && next != null) { loop.add(next); next.setProcessed(true); next = next.getNext(); } if (next == null) { // the loop is open and we have found its end, // we need to find its start too ConnectableSegment previous = defining.getPrevious(); while (previous != null) { loop.add(0, previous); previous.setProcessed(true); previous = previous.getPrevious(); } } // filter out spurious vertices filterSpuriousVertices(loop); if (loop.size() == 2 && loop.get(0).getStart() != null) { // this is a degenerated infinitely thin closed loop, we simply ignore it return null; } else { return loop; } } /** Filter out spurious vertices on straight lines (at machine precision). * @param loop segments loop to filter (will be modified in-place) */ private void filterSpuriousVertices(final List<Segment> loop) { for (int i = 0; i < loop.size(); ++i) { final Segment previous = loop.get(i); int j = (i + 1) % loop.size(); final Segment next = loop.get(j); if (next != null && Precision.equals(previous.getLine().getAngle(), next.getLine().getAngle(), Precision.EPSILON)) { // the vertex between the two edges is a spurious one // replace the two segments by a single one loop.set(j, new Segment(previous.getStart(), next.getEnd(), previous.getLine())); loop.remove(i--); } } } /** Private extension of Segment allowing connection. */ private static class ConnectableSegment extends Segment { /** Node containing segment. */ private final BSPTree<Euclidean2D> node; /** Node whose intersection with current node defines start point. */ private final BSPTree<Euclidean2D> startNode; /** Node whose intersection with current node defines end point. */ private final BSPTree<Euclidean2D> endNode; /** Previous segment. */ private ConnectableSegment previous; /** Next segment. */ private ConnectableSegment next; /** Indicator for completely processed segments. */ private boolean processed; /** Build a segment. * @param start start point of the segment * @param end end point of the segment * @param line line containing the segment * @param node node containing the segment * @param startNode node whose intersection with current node defines start point * @param endNode node whose intersection with current node defines end point */ public ConnectableSegment(final Vector2D start, final Vector2D end, final Line line, final BSPTree<Euclidean2D> node, final BSPTree<Euclidean2D> startNode, final BSPTree<Euclidean2D> endNode) { super(start, end, line); this.node = node; this.startNode = startNode; this.endNode = endNode; this.previous = null; this.next = null; this.processed = false; } /** Get the node containing segment. * @return node containing segment */ public BSPTree<Euclidean2D> getNode() { return node; } /** Get the node whose intersection with current node defines start point. * @return node whose intersection with current node defines start point */ public BSPTree<Euclidean2D> getStartNode() { return startNode; } /** Get the node whose intersection with current node defines end point. * @return node whose intersection with current node defines end point */ public BSPTree<Euclidean2D> getEndNode() { return endNode; } /** Get the previous segment. * @return previous segment */ public ConnectableSegment getPrevious() { return previous; } /** Set the previous segment. * @param previous previous segment */ public void setPrevious(final ConnectableSegment previous) { this.previous = previous; } /** Get the next segment. * @return next segment */ public ConnectableSegment getNext() { return next; } /** Set the next segment. * @param next previous segment */ public void setNext(final ConnectableSegment next) { this.next = next; } /** Set the processed flag. * @param processed processed flag to set */ public void setProcessed(final boolean processed) { this.processed = processed; } /** Check if the segment has been processed. * @return true if the segment has been processed */ public boolean isProcessed() { return processed; } } /** Visitor building segments. */ private static class SegmentsBuilder implements BSPTreeVisitor<Euclidean2D> { /** Tolerance for close nodes connection. */ private final double tolerance; /** Built segments. */ private final List<ConnectableSegment> segments; /** Simple constructor. * @param tolerance tolerance for close nodes connection */ public SegmentsBuilder(final double tolerance) { this.tolerance = tolerance; this.segments = new ArrayList<ConnectableSegment>(); } /** {@inheritDoc} */ @Override public Order visitOrder(final BSPTree<Euclidean2D> node) { return Order.MINUS_SUB_PLUS; } /** {@inheritDoc} */ @Override public void visitInternalNode(final BSPTree<Euclidean2D> node) { @SuppressWarnings("unchecked") final BoundaryAttribute<Euclidean2D> attribute = (BoundaryAttribute<Euclidean2D>) node.getAttribute(); final Iterable<BSPTree<Euclidean2D>> splitters = attribute.getSplitters(); if (attribute.getPlusOutside() != null) { addContribution(attribute.getPlusOutside(), node, splitters, false); } if (attribute.getPlusInside() != null) { addContribution(attribute.getPlusInside(), node, splitters, true); } } /** {@inheritDoc} */ @Override public void visitLeafNode(final BSPTree<Euclidean2D> node) { } /** Add the contribution of a boundary facet. * @param sub boundary facet * @param node node containing segment * @param splitters splitters for the boundary facet * @param reversed if true, the facet has the inside on its plus side */ private void addContribution(final SubHyperplane<Euclidean2D> sub, final BSPTree<Euclidean2D> node, final Iterable<BSPTree<Euclidean2D>> splitters, final boolean reversed) { @SuppressWarnings("unchecked") final AbstractSubHyperplane<Euclidean2D, Euclidean1D> absSub = (AbstractSubHyperplane<Euclidean2D, Euclidean1D>) sub; final Line line = (Line) sub.getHyperplane(); final List<Interval> intervals = ((IntervalsSet) absSub.getRemainingRegion()).asList(); for (final Interval i : intervals) { // find the 2D points final Vector2D startV = Double.isInfinite(i.getInf()) ? null : (Vector2D) line.toSpace((Point<Euclidean1D>) new Vector1D(i.getInf())); final Vector2D endV = Double.isInfinite(i.getSup()) ? null : (Vector2D) line.toSpace((Point<Euclidean1D>) new Vector1D(i.getSup())); // recover the connectivity information final BSPTree<Euclidean2D> startN = selectClosest(startV, splitters); final BSPTree<Euclidean2D> endN = selectClosest(endV, splitters); if (reversed) { segments.add(new ConnectableSegment(endV, startV, line.getReverse(), node, endN, startN)); } else { segments.add(new ConnectableSegment(startV, endV, line, node, startN, endN)); } } } /** Select the node whose cut sub-hyperplane is closest to specified point. * @param point reference point * @param candidates candidate nodes * @return node closest to point, or null if no node is closer than tolerance */ private BSPTree<Euclidean2D> selectClosest(final Vector2D point, final Iterable<BSPTree<Euclidean2D>> candidates) { BSPTree<Euclidean2D> selected = null; double min = Double.POSITIVE_INFINITY; for (final BSPTree<Euclidean2D> node : candidates) { final double distance = FastMath.abs(node.getCut().getHyperplane().getOffset(point)); if (distance < min) { selected = node; min = distance; } } return min <= tolerance ? selected : null; } /** Get the segments. * @return built segments */ public List<ConnectableSegment> getSegments() { return segments; } } }
[ "ubuntu@ip-172-31-46-181.us-west-2.compute.internal" ]
ubuntu@ip-172-31-46-181.us-west-2.compute.internal
0be3d56e763cdb370b05f609097c372bcf924aeb
7d7c178ea0b0bcb80f368446e58ae303f1b37e4d
/melody.plugin.aws/src/main/java/com/wat/cloud/aws/s3/exception/IllegalStorageModeException.java
abaf0f2c8b588964cc6b73eca6ee177b1e1db167
[]
no_license
wat-org/melody
0818480ccc8a5a3a50069105a4b8fcd31bf07313
e313c433365494b580b97f2b525781a8aee2c484
refs/heads/master
2021-01-23T08:14:58.067831
2015-12-11T16:29:20
2015-12-11T16:29:20
16,883,338
0
1
null
null
null
null
UTF-8
Java
false
false
508
java
package com.wat.cloud.aws.s3.exception; import com.wat.melody.common.ex.MelodyException; /** * * @author Guillaume Cornet * */ public class IllegalStorageModeException extends MelodyException { private static final long serialVersionUID = 3634788709709700351L; public IllegalStorageModeException(String msg) { super(msg); } public IllegalStorageModeException(Throwable cause) { super(cause); } public IllegalStorageModeException(String msg, Throwable cause) { super(msg, cause); } }
[ "cornet.guillaume.pierre@gmail.com" ]
cornet.guillaume.pierre@gmail.com
aa9439e037c149b875262eb7e9ce48a07a64e18a
0efc61fbaa65f8dcd2402b7c4fa56a4b33291518
/dataSourceDemo/src/main/java/cn/com/yhb/ds1/mapper/TestUserMapper.java
60e56884097279886f5ce5175f6613b47656d6ee
[]
no_license
15295767249/demo
6d13c1fdea82fdfbfed0605bc8106eedaef98208
70c7278afe9193c745cfaef71a6ddbef73b12740
refs/heads/master
2023-03-08T10:30:54.511326
2021-02-24T00:48:46
2021-02-24T00:48:46
303,306,998
0
0
null
null
null
null
UTF-8
Java
false
false
355
java
package cn.com.yhb.ds1.mapper; import cn.com.yhb.model.User; import org.apache.ibatis.annotations.Mapper; import org.springframework.stereotype.Component; import java.util.List; /** * mybatis mapper 接口定义(只要定义方法,无需实现) * @author denglx * */ @Component public interface TestUserMapper { List<User> findAll(); }
[ "js389189241@qq.com" ]
js389189241@qq.com
0f4f1b38c277162dd38ec55bf966fee2f6181aa7
9e33fa3d86b1216fea6a8027f548c96925b63812
/flashlight/app/src/test/java/com/chirag/flashlight/ExampleUnitTest.java
0dba0ab0d34ccacd34411eab3983c8fa01ad2fa1
[]
no_license
hrishique/multiple-project-of-android
19bfabe605314cb8905d5a1f85710ecdf1b2d447
bfbaca16d42a9fa751c16a3d9f3b6c395c340e15
refs/heads/master
2022-04-07T01:25:20.980086
2020-02-10T06:05:59
2020-02-10T06:05:59
null
0
0
null
null
null
null
UTF-8
Java
false
false
382
java
package com.chirag.flashlight; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
[ "junejachirg020@gmail.com" ]
junejachirg020@gmail.com
7a5f75247053e83a25e19d40215df8ed8e395e11
b34e145bac0d0a90578e13de0816a2634d8ba720
/FamilyChat/src/main/java/com/alienleeh/familychat/utils/file/FileUtil.java
266397a628f6e87263c66cbfbde6f2efa0908266
[]
no_license
geminisnake/FamilyChat
9610015202357288b3018d4f4fef3b268e8a4304
ee6bc014effb4e0e944cac66a92c67450fb9578c
refs/heads/master
2021-01-19T04:58:07.758965
2016-07-16T01:51:21
2016-07-27T01:51:21
62,178,639
2
0
null
null
null
null
UTF-8
Java
false
false
3,820
java
package com.alienleeh.familychat.utils.file; import android.text.TextUtils; import android.util.Log; import android.webkit.MimeTypeMap; import java.io.File; import java.util.Locale; public class FileUtil { private static final String TAG = "FileUtil"; public static boolean hasExtentsion(String filename) { int dot = filename.lastIndexOf('.'); if ((dot > -1) && (dot < (filename.length() - 1))) { return true; } else { return false; } } // 获取文件扩展名 public static String getExtensionName(String filename) { if ((filename != null) && (filename.length() > 0)) { int dot = filename.lastIndexOf('.'); if ((dot > -1) && (dot < (filename.length() - 1))) { return filename.substring(dot + 1); } } return ""; } // 获取文件名 public static String getFileNameFromPath(String filepath) { if ((filepath != null) && (filepath.length() > 0)) { int sep = filepath.lastIndexOf('/'); if ((sep > -1) && (sep < filepath.length() - 1)) { return filepath.substring(sep + 1); } } return filepath; } // 获取不带扩展名的文件名 public static String getFileNameNoEx(String filename) { if ((filename != null) && (filename.length() > 0)) { int dot = filename.lastIndexOf('.'); if ((dot > -1) && (dot < (filename.length()))) { return filename.substring(0, dot); } } return filename; } public static String getMimeType(String filePath) { if (TextUtils.isEmpty(filePath)) { return ""; } String type = null; String extension = getExtensionName(filePath.toLowerCase()); if (!TextUtils.isEmpty(extension)) { MimeTypeMap mime = MimeTypeMap.getSingleton(); type = mime.getMimeTypeFromExtension(extension); } Log.i(TAG, "url:" + filePath + " " + "type:" + type); // FIXME if (TextUtils.isEmpty(type) && filePath.endsWith("aac")) { type = "audio/aac"; } return type; } public static boolean isFileExist(String pathForSave) { return !TextUtils.isEmpty(pathForSave) && new File(pathForSave).exists(); } public enum SizeUnit { Byte, KB, MB, GB, TB, Auto, } public static String formatFileSize(long size) { return formatFileSize(size, SizeUnit.Auto); } public static String formatFileSize(long size, SizeUnit unit) { if (size < 0) { return "未知大小"; } final double KB = 1024; final double MB = KB * 1024; final double GB = MB * 1024; final double TB = GB * 1024; if (unit == SizeUnit.Auto) { if (size < KB) { unit = SizeUnit.Byte; } else if (size < MB) { unit = SizeUnit.KB; } else if (size < GB) { unit = SizeUnit.MB; } else if (size < TB) { unit = SizeUnit.GB; } else { unit = SizeUnit.TB; } } switch (unit) { case Byte: return size + "B"; case KB: return String.format(Locale.US, "%.2fKB", size / KB); case MB: return String.format(Locale.US, "%.2fMB", size / MB); case GB: return String.format(Locale.US, "%.2fGB", size / GB); case TB: return String.format(Locale.US, "%.2fPB", size / TB); default: return size + "B"; } } }
[ "alienleeh@foxmail.com" ]
alienleeh@foxmail.com
dcd3b4a10a6642c5e8b8f2b65ab41296d6c334b2
f9967c45a828706e74ec7cc8b64d2149439c22ef
/txfs-core/src/main/java/org/ewe/txfs/impl/managed/TxfsManagedConnection.java
53e5c3001260136b8f273c6aaf1595a0bfb6f896
[]
no_license
ewernli/txfs
d5def9755b6c3d819f27e6df164fa659805ce7d3
ae8b528aaf98f0cf3b2b2535c1fc9caa22141a9f
refs/heads/master
2021-01-10T18:50:47.280895
2013-09-20T15:04:34
2013-09-20T15:04:34
12,976,224
0
2
null
null
null
null
UTF-8
Java
false
false
8,022
java
package org.ewe.txfs.impl.managed; import org.ewe.txfs.impl.managed.tx.Delegate; import java.io.File; import org.ewe.txfs.impl.*; import org.ewe.txfs.TxfsConnectionRequestInfo; import org.ewe.txfs.TxfsException; import org.apache.log4j.Logger; import javax.resource.ResourceException; import javax.resource.spi.*; import javax.security.auth.Subject; import javax.transaction.xa.XAResource; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.util.ArrayList; import java.util.List; import org.ewe.txfs.TxfsFileAlreadyExistsException; public class TxfsManagedConnection implements ManagedConnection { private static Logger log = Logger.getLogger(TxfsManagedConnection.class.getName()); private ArrayList<ConnectionEventListener> listeners = new ArrayList<ConnectionEventListener>(); private TxfsConnectionRequestInfo info; private List<TxfsConnectionImpl> handles = new ArrayList<TxfsConnectionImpl>(); private Delegate delegate = null; /** * Creates new WebdavManagedConnection. */ public TxfsManagedConnection(Subject subject, TxfsConnectionRequestInfo connectionInfo) throws ResourceException { info = connectionInfo; verifyRequestInfo(info); delegate = getDelegate(); } public TxfsConnectionRequestInfo getRequestInfo() { return info; } private void verifyRequestInfo(TxfsConnectionRequestInfo info) throws ResourceException { String rootPath = info.getRootPath(); File dir = new File(rootPath); if ((rootPath == null) || (rootPath.length() == 0) || !dir.exists()) { throw new ResourceException( "The root path is either not set" + " or does not exist on file system"); } } public Delegate getDelegate() throws ResourceException { if (delegate == null) { delegate = new Delegate(info); if (log.isDebugEnabled()) { log.debug("Delegate created [managedConn=" + this + "]"); } } return delegate; } public void addConnectionEventListener(ConnectionEventListener connectionEventListener) { if (log.isDebugEnabled()) { log.debug("addConnectionEventListener, listener=" + connectionEventListener); } listeners.add(connectionEventListener); } public void removeConnectionEventListener(ConnectionEventListener connectionEventListener) { if (log.isDebugEnabled()) { log.debug("removeConnectionEventListener, listener=" + connectionEventListener); } listeners.remove(connectionEventListener); } public void associateConnection(Object obj) throws ResourceException { try { if (log.isDebugEnabled()) { log.debug("associateConnection, obj=" + obj); } TxfsConnectionImpl conn = (TxfsConnectionImpl) obj; conn.setManagedConnection(this, info); handles.add(conn); } catch (TxfsException e) { throw new ResourceException("Can't associate connection.", e); } } // Application server calls this method to force any cleanup on the ManagedConnection instance. // Cleans up connection handles so they can't be used again But the physical connection is kept open public void cleanup() throws ResourceException { try { if (log.isDebugEnabled()) { log.debug("cleanup"); } // nothing to clean in delegate // delegate.cleanup (); for (TxfsConnectionImpl conn : handles) { conn.invalidate(); } handles.clear(); } catch (TxfsException e) { throw new ResourceException("Could not cleanup managed connection", e); } } public void destroy() throws ResourceException { if (log.isDebugEnabled()) { log.debug("destroy"); } } public Object getConnection(Subject subject, ConnectionRequestInfo connectionInfo) throws ResourceException { try { if (log.isDebugEnabled()) { log.debug("getConnection, subject=" + subject + ", Info=" + connectionInfo); } // we use the info of the managed connection, not the one in // parameter (should be the same anyway) TxfsConnectionImpl conn = new TxfsConnectionImpl(this, info); handles.add(conn); return conn; } catch (TxfsException e) { log.error("Error getting connection", e); throw new ResourceException("Can't get a connection.", e); } } public LocalTransaction getLocalTransaction() throws ResourceException { if (log.isDebugEnabled()) { log.debug("getLocalTransaction"); } return null; } public ManagedConnectionMetaData getMetaData() throws ResourceException { if (log.isDebugEnabled()) { log.debug("getMetaData"); } return new TxfsManagedConnectionMetaData(); } public XAResource getXAResource() throws ResourceException { if (log.isDebugEnabled()) { log.debug("getXAResource [managedConn=" + this + "]"); } return getDelegate(); } public PrintWriter getLogWriter() throws ResourceException { return null; } public void setLogWriter(PrintWriter out) throws ResourceException { } // Notifies the app. server that a connection handle has been closed public void close(TxfsConnectionImpl conn) { if (log.isDebugEnabled()) { log.debug("Close connection " + this + " handle [handle=" + conn + ", managedConn=" + this + "]"); } ConnectionEvent ce = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED); ce.setConnectionHandle(conn); fireConnectionEvent(ce); handles.remove(conn); } protected void fireConnectionEvent(ConnectionEvent evt) { for (int i = listeners.size() - 1; i >= 0; i--) { ConnectionEventListener listener = listeners.get(i); if (evt.getId() == ConnectionEvent.CONNECTION_CLOSED) { listener.connectionClosed(evt); } else if (evt.getId() == ConnectionEvent.CONNECTION_ERROR_OCCURRED) { listener.connectionErrorOccurred(evt); } } } public void deleteDirectory(String path) throws TxfsException { delegate.deleteDirectory(path); } public long getLastModified(String fileName) throws TxfsException { return delegate.getLastModified(fileName); } public long getSize(String fileName) throws TxfsException { return delegate.getSize(fileName); } public boolean isDirectory(String fileName) throws TxfsException { return delegate.isDirectory(fileName); } public void deleteFile(String fileName) throws TxfsException { delegate.deleteFile(fileName); } public boolean exists(String fileName) throws TxfsException { return delegate.exists(fileName); } public InputStream getInputStream(String fileName) throws TxfsException { return delegate.getInputStream(fileName); } public void createFile(String destFileName, InputStream data) throws TxfsFileAlreadyExistsException, TxfsException { delegate.createFile(destFileName, data); } }
[ "wernli@iam.unibe.ch" ]
wernli@iam.unibe.ch
e35e929910cc2e4afab8fe3af708bf9c8450b993
a98a2978094a39c76f587e8a56011a94847de615
/blog/src/main/java/ru/pravvich/domain/Blog.java
dac04521b86e620529ba63d90b520dd33fee4cea
[]
no_license
PavelRavvich/jhipster-microservices
4ce54a05899c52fda1efb7a7db74c0c07c3137a5
58d6e9004dde94b23a9593511a9b80b2182940fc
refs/heads/master
2021-09-07T19:35:22.560836
2018-02-28T00:42:29
2018-02-28T00:42:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,397
java
package ru.pravvich.domain; import org.springframework.data.annotation.Id; import org.springframework.data.mongodb.core.mapping.Field; import org.springframework.data.mongodb.core.mapping.Document; import javax.validation.constraints.*; import java.io.Serializable; import java.util.Objects; /** * A Blog. */ @Document(collection = "blog") public class Blog implements Serializable { private static final long serialVersionUID = 1L; @Id private String id; @NotNull @Field("title") private String title; @NotNull @Field("author") private String author; @NotNull @Field("post") private String post; // jhipster-needle-entity-add-field - JHipster will add fields here, do not remove public String getId() { return id; } public void setId(String id) { this.id = id; } public String getTitle() { return title; } public Blog title(String title) { this.title = title; return this; } public void setTitle(String title) { this.title = title; } public String getAuthor() { return author; } public Blog author(String author) { this.author = author; return this; } public void setAuthor(String author) { this.author = author; } public String getPost() { return post; } public Blog post(String post) { this.post = post; return this; } public void setPost(String post) { this.post = post; } // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here, do not remove @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } Blog blog = (Blog) o; if (blog.getId() == null || getId() == null) { return false; } return Objects.equals(getId(), blog.getId()); } @Override public int hashCode() { return Objects.hashCode(getId()); } @Override public String toString() { return "Blog{" + "id=" + getId() + ", title='" + getTitle() + "'" + ", author='" + getAuthor() + "'" + ", post='" + getPost() + "'" + "}"; } }
[ "triodjangopiter@yandex.ru" ]
triodjangopiter@yandex.ru
e96e82ed64f30c84572e18c0650b8b1133cc903c
5a088135a99a386e473f94f971c571864373865c
/04.MSH/02.Engineering/03.Code/01.server/trunk/elh/trunk/src/main/java/com/lenovohit/elh/base/model/Patient.java
f3c07c4b0201a1846dcf9e319ab31c5d057c2ad7
[]
no_license
jacky-cyber/work
a7bebd2cc910da1e9e227181def880a78cc1de07
e58558221b2a8f410b087fa2ce88017cea12efa4
refs/heads/master
2022-02-25T09:48:53.940782
2018-05-01T10:04:53
2018-05-01T10:04:53
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,000
java
package com.lenovohit.elh.base.model; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Table; import javax.persistence.Transient; import com.lenovohit.core.model.BaseIdModel; /** * 就诊人 * @author Administrator * */ @Entity @Table(name="ELH_PATIENT") public class Patient extends BaseIdModel { private static final long serialVersionUID = -6270132686252825491L; private String idHlht;//院方数据ID 暂态 private String personId; //人员 private String userType; //用户类型 private String name ; //姓名 private String photo ; //头像 private String idno ; //身份证号码 private String mobile ; //手机 private String email ; //邮箱 private String gender ; //性别 private String address ; //地址 private String status ; //状态 private String birthday; //出生日期 private double height ; //身高 private double weight ; //体重 @Transient public String getIdHlht() { return idHlht; } public void setIdHlht(String idHlht) { this.idHlht = idHlht; } @Column(name = "PERSON_ID") public String getPersonId() { return personId; } public void setPersonId(String personId) { this.personId = personId; } @Column(name = "USER_TYPE") public String getUserType() { return userType; } public void setUserType(String userType) { this.userType = userType; } @Column(name = "NAME") public String getName() { return name; } public void setName(String name) { this.name = name; } @Column(name = "PHOTO") public String getPhoto() { return photo; } public void setPhoto(String photo) { this.photo = photo; } @Column(name = "IDNO") public String getIdno() { return idno; } public void setIdno(String idno) { this.idno = idno; } @Column(name = "MOBILE") public String getMobile() { return mobile; } public void setMobile(String mobile) { this.mobile = mobile; } @Column(name = "EMAIL") public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } @Column(name = "GENDER") public String getGender() { return gender; } public void setGender(String gender) { this.gender = gender; } @Column(name = "ADDRESS") public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } @Column(name = "STATUS") public String getStatus() { return status; } public void setStatus(String status) { this.status = status; } @Column(name = "BIRTHDAY") public String getBirthday() { return birthday; } public void setBirthday(String birthday) { this.birthday = birthday; } @Column(name = "HEIGHT") public double getHeight() { return height; } public void setHeight(double height) { this.height = height; } @Column(name = "WEIGHT") public double getWeight() { return weight; } public void setWeight(double weight) { this.weight = weight; } }
[ "liuximing2016@qq.com" ]
liuximing2016@qq.com
5d08b28bd64d26b03a05e63250e29b8084851367
afe0d7394c2a708eeef43931473e2241aec6787d
/QuanlyThietBiDienTu2/app/src/main/java/com/example/quanlythietbidientu2/Adapter/HonrzontalAapter.java
cd252ecb751d5ee7d34a3b6850d1326d84c250a0
[]
no_license
thanhnhan9023/App-ban-hang-linh-kien-dien-tu
53ed53c0e5eb94845161f1c60ee31c00e64235c1
c7ebe5d0880dee9bb53d5c524a5beb5ccbfce5d0
refs/heads/master
2023-07-06T22:29:14.902540
2020-09-19T07:34:45
2020-09-19T07:34:45
null
0
0
null
null
null
null
UTF-8
Java
false
false
7,086
java
package com.example.quanlythietbidientu2.Adapter; import android.app.AlertDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.support.annotation.NonNull; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.ImageView; import android.widget.TextView; import com.cepheuen.elegantnumberbutton.view.ElegantNumberButton; import com.example.quanlythietbidientu2.Model.LoaiProduct; import com.example.quanlythietbidientu2.Model.SanPham; import com.example.quanlythietbidientu2.R; import com.example.quanlythietbidientu2.Utils.Common; import com.squareup.picasso.Picasso; import java.text.DecimalFormat; import java.util.ArrayList; import java.util.List; import Database.Database.DBHelper; import Database.Model.GioHang; import Fragment.ChitietSanphamActivity; public class HonrzontalAapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { Context context; List<SanPham> sanPhams; RecyclerView recyclerView; long tongtien=0; public HonrzontalAapter(Context context,List<SanPham> sanPhams) { this.context = context; this.sanPhams=sanPhams; } public class VH extends RecyclerView.ViewHolder implements View.OnClickListener { View.OnClickListener onClickListener; TextView NamProduct, Price; ImageView LinkImage1; Button btnAddcart; public VH(@NonNull View itemView) { super(itemView); Price = itemView.findViewById(R.id.txtGiaSanPhamBanChay); // NamProduct = itemView.findViewById(R.id.txtTenSpBanchay); LinkImage1 = itemView.findViewById(R.id.ImageLoaiSpBanchay); itemView.setOnClickListener(this); } @Override public void onClick(View v) { onClickListener.onClick(v); } } @NonNull @Override public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup viewGroup, int i) { View view= LayoutInflater.from(context).inflate(R.layout.loaisanpham_layout_item,null); return new VH(view); } @Override public void onBindViewHolder(@NonNull RecyclerView.ViewHolder viewHolder, int i) { VH vh = (VH)viewHolder; final int postion=i; Picasso.with(context).load((sanPhams).get(i).getDuongdan()).into(vh.LinkImage1); // vh.NamProduct.setText(sanPhams1.get(i).getTenHH()); DecimalFormat decimalFormat = new DecimalFormat("###,###,###"); float giasp=Float.parseFloat((sanPhams.get(i).getGiabanle())); vh.Price.setText(decimalFormat.format(giasp)+" VNĐ"); vh.onClickListener= new View.OnClickListener() { @Override public void onClick(View v) { showAddtoCart(postion); } }; } private void showAddtoCart (int position) { AlertDialog.Builder builder =new AlertDialog.Builder(context); View item=LayoutInflater.from(context).inflate(R.layout.add_tocart_layout,null); ImageView imageView_product_dialog=item.findViewById(R.id.ImageproductCart); ElegantNumberButton soluongconfirm=item.findViewById(R.id.txtSoluongConfirm); TextView txt_product_dialog=item.findViewById(R.id.txtNameProductCart); TextView txtTongtien=item.findViewById(R.id.txtTongtienConfirm); Picasso.with(context).load(sanPhams. get(position).getDuongdan()).into(imageView_product_dialog); txt_product_dialog.setText(sanPhams.get(position).getTenHH()); soluongconfirm.setOnClickListener(new ElegantNumberButton.OnClickListener() { @Override public void onClick(View view) { DecimalFormat decimalFormat = new DecimalFormat("###,###,###"); tongtien= (long) (Integer.parseInt(soluongconfirm.getNumber())*Float.parseFloat(sanPhams.get(position).getGiabanle())); txtTongtien.setText(decimalFormat.format(tongtien) + " VNĐ"); } }); builder.setView(item); builder.setNegativeButton("ADD To Cart", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { DBHelper dbHelper=new DBHelper(context); dbHelper.createTable(); ArrayList<GioHang> gioHangArrayList=new ArrayList<>(); if(Common.getFirebaseAuth().getCurrentUser()==null) { gioHangArrayList.add(new GioHang(0, sanPhams.get(position).getTenHH(), sanPhams.get(position).getMaHH(), sanPhams.get(position).getDuongdan(), Float.parseFloat(sanPhams.get(position).getGiabanle()), tongtien, Integer.parseInt(soluongconfirm.getNumber()), "")); } else { gioHangArrayList.add(new GioHang(0, sanPhams.get(position).getTenHH(), sanPhams.get(position).getMaHH(), sanPhams.get(position).getDuongdan(), Float.parseFloat(sanPhams.get(position).getGiabanle()), tongtien, Integer.parseInt(soluongconfirm.getNumber()),Common.getmail())); } if(Common.getFirebaseAuth().getCurrentUser()!=null) { boolean kq = dbHelper.isItemAvailable(sanPhams.get(position).getMaHH(),Common.getmail()); if (kq == true) { dbHelper.capnhatgiohangtheouser(sanPhams.get(position).getMaHH(), Integer.parseInt(soluongconfirm.getNumber()),Common.getmail()); context.startActivity(new Intent(context, GUI.GioHang.class)); } else if (kq == false) { dbHelper.insertGioHang(gioHangArrayList); context.startActivity(new Intent(context, GUI.GioHang.class)); } } else { boolean kq = dbHelper.isItemAvailable(sanPhams.get(position).getMaHH(),""); if (kq == true) { //boolean kq=dbHelper.kiemtrasanphamgiohang(sanPhams.get(position).getMaHH()); dbHelper.capnhatgiohangtheouser(sanPhams.get(position).getMaHH(), Integer.parseInt(soluongconfirm.getNumber()),""); context.startActivity(new Intent(context, GUI.GioHang.class)); } else if (kq == false) { dbHelper.insertGioHang(gioHangArrayList); context.startActivity(new Intent(context, GUI.GioHang.class)); } } // dialog.dismiss(); } }); builder.setView(item); AlertDialog dialog=builder.create(); dialog.show(); } @Override public int getItemCount() { return sanPhams.size(); } }
[ "nhandycu@gmail.com" ]
nhandycu@gmail.com
0ecac7d72d7d5a00cc72cb680d4101756ac2dfd8
e8ac05f2c70daea855e120cea5609c99a7ab1331
/simple-service-webapp/src/main/java/ck/demo/User.java
9eba47cc2816ac0791b5af7b8705c3f3530b4890
[]
no_license
ck1289553039/test
24a36408c92f0fb23a7f5f3ca7fc2e09dd073e30
fe0a497d13f7692a217f58cc81b990e71a0cae1a
refs/heads/master
2021-01-20T08:20:35.413772
2017-05-03T14:06:01
2017-05-03T14:06:01
89,568,158
0
0
null
null
null
null
UTF-8
Java
false
false
555
java
package ck.demo; /** * Created by soft01 on 2017/5/2. */ public class User { private String name; private String password; public User(){} public User(String name,String password){ this.name = name; this.password = password; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } }
[ "1390669274@qq.com" ]
1390669274@qq.com
8edc82d6357bde5059a63f26ef384eca9a4765ec
e7daeb575ec8674ed94c927613de2e6057e28fd9
/lab6/gRPC/src/sr/grpc/server/grpcServer.java
74aa69af43789da674c031d5ca866736af40c462
[]
no_license
rivit98/distributed-systems
14855ceff0348c4acb0b27b524d48756df69a86f
c4f87a542bbb87d772ff0a1720461d3e620be2b6
refs/heads/master
2023-05-14T14:13:24.867638
2021-06-08T20:05:03
2021-06-08T20:05:03
343,688,265
0
0
null
null
null
null
UTF-8
Java
false
false
2,089
java
package sr.grpc.server; import io.grpc.Server; import io.grpc.ServerBuilder; import java.io.IOException; import java.util.concurrent.Executors; import java.util.logging.Logger; public class grpcServer { private static final Logger logger = Logger.getLogger(grpcServer.class.getName()); private final int port = 50051; private Server server; /** * Main launches the server from the command line. */ public static void main(String[] args) throws IOException, InterruptedException { final grpcServer server = new grpcServer(); server.start(); server.blockUntilShutdown(); } private void start() throws IOException { //You will want to employ flow-control so that the queue doesn't blow up your memory. You can cast StreamObserver to CallStreamObserver to get flow-control API server = ServerBuilder/*NettyServerBuilder*/.forPort(port).executor(Executors.newFixedThreadPool(16)) .addService(new CalculatorImpl()) .addService(new CalculatorImpl()) .addService(new AdvancedCalculatorImpl()) .addService(new StreamTesterImpl()) .build() .start(); logger.info("Server started, listening on " + port); Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { // Use stderr here since the logger may have been reset by its JVM shutdown hook. System.err.println("*** shutting down gRPC server since JVM is shutting down"); grpcServer.this.stop(); System.err.println("*** server shut down"); } }); } private void stop() { if (server != null) { server.shutdown(); } } /** * Await termination on the main thread since the grpc library uses daemon threads. */ private void blockUntilShutdown() throws InterruptedException { if (server != null) { server.awaitTermination(); } } }
[ "albert98g@gmail.com" ]
albert98g@gmail.com
f492a6617d005a7313b5b61801ae038afdd16666
dc456326fa626a6f10dea512e379304804baa84e
/src/main/java/com/apnidukan/service/CartService.java
918f59fff4f72bb263d09b9ae0028e4555ed4408
[]
no_license
kanumalivad/apnidukan-rest-apis
2ee702d96fafc0b7d507a475b032a2b77dd57da6
c137ac1cf19b266292dddc5088403f928111d0c6
refs/heads/master
2023-05-03T07:57:01.908941
2019-06-05T18:00:49
2019-06-05T18:00:49
190,437,070
0
0
null
2023-04-14T17:42:41
2019-06-05T17:15:53
Java
UTF-8
Java
false
false
341
java
package com.apnidukan.service; import java.util.List; import org.springframework.stereotype.Service; import com.apnidukan.entity.Cart; @Service public interface CartService { Cart save(Cart cart); List<Cart> findCartByUserId(Long userid); List<Cart> findCartSizeByUserId(Long userid); void deleteByUserid(long uid); }
[ "kanu.malivad@gmail.com" ]
kanu.malivad@gmail.com
8e31724d6023fae9aacf1b548e123fbac44fb718
5bf21d8ae97ddcef2524b156ef80ef69c3e65bd9
/selendroid-server-common/src/main/java/io/selendroid/server/ServerDetails.java
d7ab709622c5189b1c40283320f9f0badf5d014c
[ "Apache-2.0" ]
permissive
Kangaroo128/selendroid
b5ae59dee0bd49c507569eb4c75bc1cd48da9135
1f73d30f24b905fdc997c324b79d1701f2af5ac6
refs/heads/master
2021-01-16T21:11:17.399615
2013-08-16T15:30:09
2013-08-16T15:30:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
906
java
/* * Copyright 2013 selendroid committers. * * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except * in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software distributed under the License * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the License for the specific language governing permissions and limitations under * the License. */ package io.selendroid.server; import org.json.JSONArray; public interface ServerDetails { public String getServerVersion(); public String getCpuArch(); public String getOsName(); public String getOsVersion(); public JSONArray getSupportedApps(); public JSONArray getSupportedDevices(); }
[ "ddary@acm.org" ]
ddary@acm.org
804064342515bd48a60634b3bf77380e9abb4604
6348efab9bdc602ac8971cd0b5f30ba3dcfa8e2e
/src/FirstTest.java
a39c11642b065693074d57f808c1581df4cda9f1
[]
no_license
marrusina/lesson4-2
f23c851b9dc318faaaf109947eeb9cb86870222b
1870c479d1a137c5cce863516cc77f7ee3d643ba
refs/heads/master
2020-04-03T05:44:13.624989
2018-10-28T09:37:47
2018-10-28T09:37:47
155,055,020
0
0
null
null
null
null
UTF-8
Java
false
false
3,750
java
import io.appium.java_client.AppiumDriver; import io.appium.java_client.TouchAction; import io.appium.java_client.android.AndroidDriver; import org.junit.After; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.openqa.selenium.By; import org.openqa.selenium.Dimension; import org.openqa.selenium.WebElement; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.remote.server.handler.GetPageSource; import org.openqa.selenium.support.ui.ExpectedConditions; import org.openqa.selenium.support.ui.WebDriverWait; import java.net.URL; import java.util.List; import java.util.concurrent.TimeUnit; public class FirstTest { private AppiumDriver driver; @Before public void setUp() throws Exception { DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability("platformName", "Android"); capabilities.setCapability("deviceName", "AndroidTestDevice"); capabilities.setCapability("platformVersion", "7.0"); capabilities.setCapability("automationName", "Appium"); capabilities.setCapability("appPackage", "org.wikipedia"); capabilities.setCapability("appActivity", ".main.MainActivity"); capabilities.setCapability("app", "/Users/rusina/Desktop/automation_lessons/test/apk/org.wikipedia.apk"); driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"), capabilities); //driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); } @After public void tearDown() { driver.quit(); } @Test public void saveFirstArticleToMyList() { waitForElementAndClick( By.xpath("//*[contains(@text,'Search Wikipedia')]"), "Cannot find Search Wikipedia", 30 ); waitForElementAndSendKeys( By.xpath("//*[contains(@text,'Search…')]"), "c++", "Cannot find error message", 30 ); waitForElementAndClick( By.xpath("//*[@resource-id='org.wikipedia:id/page_list_item_container']//*[@text='General purpose high-level programming language']"), "Cannot find title", 30 ); String title = "org.wikipedia:id/view_page_title_text"; assertElementPresent( By.id(title), "The article has no title"); } private WebElement waitForElementPresent(By by, String error_message, long timeoutInSeconds) { WebDriverWait wait = new WebDriverWait(driver, timeoutInSeconds, 2000); wait.withMessage(error_message + "\n"); return wait.until(ExpectedConditions.presenceOfElementLocated(by)); } private WebElement waitForElementPresent(By by, String error_message) { return waitForElementPresent(by, error_message,5); } private WebElement waitForElementAndClick(By by, String error_message, long timeoutInSeconds) { WebElement element = waitForElementPresent(by, error_message, timeoutInSeconds); element.click(); return element; } private WebElement waitForElementAndSendKeys(By by, String value, String error_message, long timeoutInSeconds) { WebElement element = waitForElementPresent(by, error_message, timeoutInSeconds); element.sendKeys(value); return element; } private void assertElementPresent(By by,String error_message) { if (driver.findElements(by).size() == 0) { String default_message = "An element" + by.toString() + "supposed to be not present"; throw new AssertionError(default_message + " " + error_message); } } }
[ "rusina@reksoft.ru" ]
rusina@reksoft.ru
45d9c78ef5a3f1ea0539080900c4585883a2c1a4
d50d92bb76a37b63d57f1d2d495ef2fe16e836f6
/ai/evo/heredity/Asexual.java
e264a5fb444fb95d579e2fe0ef9ef6bd11ff76fa
[]
no_license
alexoooo/reinforcementlearning
bcc7aaa64a6f44ae74b791287c16872cacdd82b7
7dc91901af925cfd9e14997f4b6b3a2cad0c9553
refs/heads/master
2020-04-17T06:46:35.290966
2019-01-18T03:58:28
2019-01-18T03:58:28
166,339,500
0
0
null
null
null
null
UTF-8
Java
false
false
217
java
package ao.ai.evo.heredity; import ao.ai.evo.primordial_soup.PrimordialSoup; /** * */ public interface Asexual<T> { public T microMutate(PrimordialSoup soup); public T macroMutate(PrimordialSoup soup); }
[ "ostrovsky.alex@gmail.com" ]
ostrovsky.alex@gmail.com
7b725058c823a0c04dc0bc7129d13a0326843a05
ec95cb39c030c5869e109ebbbcab54b90528d353
/app/src/main/java/com/architectica/socialcomponents/main/Rewards/RewardsActivity.java
c0fb282cc2bf962c8567e626d39fcd442284d786
[ "Apache-2.0" ]
permissive
AryaAshish/ryft_final
bf94519a039d195b0606ea33205d23ec9e56cf5e
1042a40a5a04595dc94492d38769d69d6d600059
refs/heads/master
2022-10-03T06:20:14.997072
2020-06-05T11:22:31
2020-06-05T11:22:31
269,614,416
1
0
null
null
null
null
UTF-8
Java
false
false
10,992
java
package com.architectica.socialcomponents.main.Rewards; import android.annotation.SuppressLint; import android.app.ActivityOptions; import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.view.View; import android.view.animation.AlphaAnimation; import android.view.animation.Animation; import android.widget.ProgressBar; import android.widget.TextView; import android.widget.Toast; import android.widget.Button; import com.architectica.socialcomponents.R; import com.architectica.socialcomponents.adapters.HashtagPostsAdapter; import com.architectica.socialcomponents.adapters.RewardsPostsAdapter; import com.architectica.socialcomponents.main.base.BaseActivity; import com.architectica.socialcomponents.main.login.LoginActivity; import com.architectica.socialcomponents.main.post.createPost.CreateProjectActivity; import com.architectica.socialcomponents.main.post.createPost.CreateRewardActivity; import com.architectica.socialcomponents.main.postDetails.ProjectDetailsActivity; import com.architectica.socialcomponents.main.postDetails.RewardDetailsActivity; import com.architectica.socialcomponents.main.profile.ProfileActivity; import com.architectica.socialcomponents.model.Post; import com.architectica.socialcomponents.utils.AnimationUtils; import com.google.android.material.floatingactionbutton.FloatingActionButton; import androidx.appcompat.widget.Toolbar; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.SimpleItemAnimator; import androidx.swiperefreshlayout.widget.SwipeRefreshLayout; import com.google.firebase.database.DataSnapshot; import com.google.firebase.database.DatabaseError; import com.google.firebase.database.FirebaseDatabase; import com.google.firebase.auth.FirebaseAuth; import com.google.firebase.database.ValueEventListener; public class RewardsActivity extends BaseActivity<RewardsView,RewardsPresenter> implements RewardsView { private RewardsPostsAdapter postsAdapter; private RecyclerView recyclerView; private FloatingActionButton floatingActionButton; private TextView newPostsCounterTextView; private boolean counterAnimationInProgress = false; private ProgressBar progressBar; private SwipeRefreshLayout swipeContainer; @Override public void onResume() { super.onResume(); //POST_TYPE = "rewards"; presenter.updateNewPostCounter(); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_rewards); //POST_TYPE = "rewards"; Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); } actionBar.setTitle("Redeem Reward Points"); initContentView(); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if (resultCode == RESULT_OK) { switch (requestCode) { case ProfileActivity.CREATE_POST_FROM_PROFILE_REQUEST: refreshPostList(); break; case CreateRewardActivity.CREATE_NEW_REWARD_REQUEST: presenter.onRewardCreated(); break; case RewardDetailsActivity.UPDATE_REWARD_REQUEST: presenter.onRewardUpdated(data); break; } } } @Override public RewardsPresenter createPresenter() { if (presenter == null) { return new RewardsPresenter(getApplicationContext()); } return presenter; } public void refreshPostList() { postsAdapter.loadRewardsFirstPage(); if (postsAdapter.getItemCount() > 0) { recyclerView.scrollToPosition(0); } } @Override public void showCounterView(int count) { AnimationUtils.showViewByScaleAndVisibility(newPostsCounterTextView); String counterFormat = getResources().getQuantityString(R.plurals.new_posts_counter_format, count, count); newPostsCounterTextView.setText(String.format(counterFormat, count)); } private void initContentView() { if (recyclerView == null) { progressBar = findViewById(R.id.progressBar); swipeContainer = findViewById(R.id.swipeContainer); initFloatingActionButton(); initPostListRecyclerView(); initPostCounter(); } } private void initFloatingActionButton() { floatingActionButton = findViewById(R.id.addNewPostFab); /*FirebaseDatabase.getInstance().getReference("profiles").addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot dataSnapshot) { String adminUid = ""; for (DataSnapshot dataSnapshot1 : dataSnapshot.getChildren()){ if ("RiftAdmin".equals(dataSnapshot1.child("username").getValue(String.class))){ adminUid = dataSnapshot1.getKey(); } } String userid = FirebaseAuth.getInstance().getCurrentUser().getUid(); if (userid.equals(adminUid)){ floatingActionButton.setVisibility(View.VISIBLE); } else { floatingActionButton.setVisibility(View.GONE); } } @Override public void onCancelled(DatabaseError databaseError) { } });*/ if (floatingActionButton != null) { floatingActionButton.setOnClickListener(v -> presenter.onCreatePostClickAction(floatingActionButton)); } } private void initPostListRecyclerView() { recyclerView = findViewById(R.id.recycler_view); postsAdapter = new RewardsPostsAdapter(this,swipeContainer); postsAdapter.setCallback(new HashtagPostsAdapter.Callback() { @Override public void onItemClick(Post post, View view) { //openPostDetailsActivity(post, view); presenter.onRewardClicked(post, view); } @Override public void onListLoadingFinished() { progressBar.setVisibility(View.GONE); } @Override public void onAuthorClick(String authorId, View view) { openProfileActivity(authorId, view); } @Override public void onCanceled(String message) { progressBar.setVisibility(View.GONE); showToast(message); } }); recyclerView.setLayoutManager(new LinearLayoutManager(this)); ((SimpleItemAnimator) recyclerView.getItemAnimator()).setSupportsChangeAnimations(false); recyclerView.setAdapter(postsAdapter); postsAdapter.loadRewardsFirstPage(); } private void initPostCounter() { newPostsCounterTextView = findViewById(R.id.newPostsCounterTextView); newPostsCounterTextView.setOnClickListener(v -> refreshPostList()); presenter.initPostCounter(); recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { hideCounterView(); super.onScrolled(recyclerView, dx, dy); } }); } @Override public void hideCounterView() { if (!counterAnimationInProgress && newPostsCounterTextView.getVisibility() == View.VISIBLE) { counterAnimationInProgress = true; AlphaAnimation alphaAnimation = AnimationUtils.hideViewByAlpha(newPostsCounterTextView); alphaAnimation.setAnimationListener(new Animation.AnimationListener() { @Override public void onAnimationStart(Animation animation) { } @Override public void onAnimationEnd(Animation animation) { counterAnimationInProgress = false; newPostsCounterTextView.setVisibility(View.GONE); } @Override public void onAnimationRepeat(Animation animation) { } }); alphaAnimation.start(); } } @SuppressLint("RestrictedApi") @Override public void openPostDetailsActivity(Post post, View v) { Intent intent = new Intent(this, RewardDetailsActivity.class); intent.putExtra(RewardDetailsActivity.REWARD_ID_EXTRA_KEY, post.getId()); if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { View imageView = v.findViewById(R.id.postImageView); View authorImageView = v.findViewById(R.id.authorImageView); if (imageView.getVisibility() != View.GONE){ ActivityOptions options = ActivityOptions. makeSceneTransitionAnimation(this, new android.util.Pair<>(imageView, getString(R.string.post_image_transition_name)), new android.util.Pair<>(authorImageView, getString(R.string.post_author_image_transition_name)) ); startActivityForResult(intent, RewardDetailsActivity.UPDATE_REWARD_REQUEST, options.toBundle()); } else { startActivityForResult(intent, RewardDetailsActivity.UPDATE_REWARD_REQUEST); } } else { startActivityForResult(intent, RewardDetailsActivity.UPDATE_REWARD_REQUEST); } } @Override public void showFloatButtonRelatedSnackBar(int messageId) { showSnackBar(floatingActionButton, messageId); } @SuppressLint("RestrictedApi") @Override public void openProfileActivity(String userId, View view) { if (FirebaseAuth.getInstance().getCurrentUser() != null) { Intent intent = new Intent(this, ProfileActivity.class); intent.putExtra(ProfileActivity.USER_ID_EXTRA_KEY, userId); startActivityForResult(intent, ProfileActivity.CREATE_POST_FROM_PROFILE_REQUEST); }else { Intent intent=new Intent(this,LoginActivity.class); startActivity(intent); } } @Override public void openCreatePostActivity() { Intent intent = new Intent(this, CreateRewardActivity.class); startActivityForResult(intent, CreateRewardActivity.CREATE_NEW_REWARD_REQUEST); //startActivity(intent); //finish(); } }
[ "aryan971998@gmail.com" ]
aryan971998@gmail.com
38f2c5f8396f0223e6e4c20ae1986e50d844bb36
0f6386bf1b8a7ffca9b34c1a7283f1583b87dbac
/src/test/java/seng302/model/AccountContactsTest.java
426ca293a4850ca333b5d2645d41ae5716290ba6
[]
no_license
bennyschmidt1231/test
1bc1f37f17d000c86178594e37cbd1bdeb15b257
595730c1f8bb3fe5cba46d024fc20e7436b704aa
refs/heads/master
2020-03-23T19:11:45.286734
2018-07-26T23:45:03
2018-07-26T23:45:03
141,959,495
0
0
null
null
null
null
UTF-8
Java
false
false
17,776
java
///* ////TODO // //package seng302.model; // //import org.junit.Before; //import org.junit.Ignore; //import org.junit.Test; //import seng302.model.*; // //import java.io.ByteArrayOutputStream; //import java.time.LocalDate; //import java.util.ArrayList; // //import static org.junit.Assert.assertEquals; // // //public class AccountContactsTest { // // private UserAttributeCollection userAttCol; // private DonorOrganInventory donOrgInv; // private ReceiverOrganInventory reqOrgans; // private ContactDetails contacts; // private AccountManager accMan; // private final ByteArrayOutputStream outContent = new ByteArrayOutputStream(); // // @Before // public void setUp() { // // // accMan = new AccountManager(){}; // // LocalDate DOB = LocalDate.of(1990, 12, 31); // LocalDate DOD = LocalDate.of(2016, 12, 31); // // userAttCol = new UserAttributeCollection(2.0, 51.0, "AB-", "1 Fleet Street", // "", "cashmere", "christchurch", 5678, "NZ", false, "130/80", false, 2.0, ""); // // donOrgInv = new DonorOrganInventory(true, false, true, true, // false, false, true, // false, true, false, true, true); // // //TODO // //contacts = new AccountContacts("1 Fleet Street", "Christchurch", "Canterbury", "5678", "0220456543", "5452345", "randomPerson92@gmail.com", // // "31b Taylors Ave", "Christchurch", "Canterbury", "8052", "0213459876", "5458769", "randomHelper93@yahoo.com"); // // // // DonorReceiver donorReceiver1 = new DonorReceiver("Sweeny", "", "Todd", DOB, "ABC1234"); // donorReceiver1.setUserAttributeCollection(userAttCol); // donorReceiver1.setDonorOrganInventory(donOrgInv); // donorReceiver1.setRequiredOrgans(reqOrgans); // donorReceiver1.setContactDetails(contacts); // donorReceiver1.setTitle("MR"); // donorReceiver1.setPreferredName("Pâtissier"); // donorReceiver1.setDateOfDeath(DOD); // donorReceiver1.setGender('M'); // donorReceiver1.setBirthGender('M'); // donorReceiver1.setLivedInUKFlag(false); // DonorReceiver donorReceiver2 = new DonorReceiver("Sweeny", "", "Todd", DOB, "ABC1264"); // donorReceiver2.setUserAttributeCollection(userAttCol); // donorReceiver2.setDonorOrganInventory(donOrgInv); // donorReceiver2.setRequiredOrgans(reqOrgans); // donorReceiver2.setContactDetails(contacts); // donorReceiver1.setTitle("MR"); // donorReceiver2.setPreferredName("Pâtissier"); // donorReceiver2.setDateOfDeath(DOD); // donorReceiver2.setGender('M'); // donorReceiver2.setBirthGender('M'); // donorReceiver2.setLivedInUKFlag(false); // DonorReceiver donorReceiver3 = new DonorReceiver("Sweeny", "", "Todd", DOB, "ABC1274"); // donorReceiver3.setUserAttributeCollection(userAttCol); // donorReceiver3.setDonorOrganInventory(donOrgInv); // donorReceiver3.setRequiredOrgans(reqOrgans); // donorReceiver3.setContactDetails(contacts); // donorReceiver1.setTitle("MR"); // donorReceiver3.setPreferredName("Pâtissier"); // donorReceiver3.setDateOfDeath(DOD); // donorReceiver3.setGender('M'); // donorReceiver3.setBirthGender('M'); // donorReceiver3.setLivedInUKFlag(false); // accMan.getDonorReceivers().add(donorReceiver1); // accMan.getDonorReceivers().add(donorReceiver2); // accMan.getDonorReceivers().add(donorReceiver3); // } // // /** // * Testing whether the updateAddressStreet works with valid input // */ // ///* // // //@Test // public void updateAddressStreet1() { // accMan.issueCommand("update", "ABC1234", "contacts", "addressStreet", "27 Peters Road"); // ArrayList<DonorReceiver> test = accMan.getDonorReceivers(); // DonorReceiver test2 = test.get(0); // ContactDetails test3 = test2.getContactDetails(); // assertEquals(test3.getAddress().getStreetAddressLn1(), "27 Peters Road"); // } // // /** // * Testing whether updateAddressStreet fails with invalid input // // @Test // public void updateAddressStreet2() { // accMan.issueCommand("update", "ABC1234", "contacts", "addressStreet", ""); // ArrayList<DonorReceiver> test = accMan.getDonorReceivers(); // DonorReceiver test2 = test.get(0); // ContactDetails test3 = test2.getContactDetails(); // assertEquals(test3.getAddress().getStreetAddressLn2(), "1 Fleet Street"); // } // // /** // * Testing whether the updateAddressCity works with valid input // // @Test // public void updateAddressCity1() { // accMan.issueCommand("update", "ABC1234", "contacts", "addressCity", "Nelson"); // ArrayList<DonorReceiver> test = accMan.getDonorReceivers(); // DonorReceiver test2 = test.get(0); // ContactDetails test3 = test2.getContactDetails(); // assertEquals(test3.getAddress().getCityName(), "Nelson"); // } // // /** // * Testing whether updateAddressCity fails with invalid input // // @Test // public void updateAddressCity2() { // accMan.issueCommand("update", "ABC1234", "contacts", "addressCity", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); // ArrayList<DonorReceiver> test = accMan.getDonorReceivers(); // DonorReceiver test2 = test.get(0); // AccountContacts test3 = test2.getContactDetails(); // assertEquals(test3.getAddressCity(), "Christchurch"); // } // // /** // * Testing whether the updateAddressRegion works with valid input // // @Test // public void updateAddressRegion1() { // accMan.issueCommand("update", "ABC1234", "contacts", "addressRegion", "Buller"); // ArrayList<DonorReceiver> test = accMan.getDonorReceivers(); // DonorReceiver test2 = test.get(0); // AccountContacts test3 = test2.getContactDetails(); // assertEquals(test3.getAddressRegion(), "Buller"); // } // // /** // * Testing whether updateAddressRegion fails with invalid input // // @Test // public void updateAddressRegion2() { // accMan.issueCommand("update", "ABC1234", "contacts", "addressRegion", "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"); // ArrayList<DonorReceiver> test = accMan.getDonorReceivers(); // DonorReceiver test2 = test.get(0); // AccountContacts test3 = test2.getContactDetails(); // assertEquals(test3.getAddressRegion(), "Canterbury"); // } // // /** // * Testing whether the updateAddressPostcode works with valid input // // @Test // public void updateAddressPostcode1() { // accMan.issueCommand("update", "ABC1234", "contacts", "addressPostcode", "8541"); // ArrayList<DonorReceiver> test = accMan.getDonorReceivers(); // DonorReceiver test2 = test.get(0); // AccountContacts test3 = test2.getContactDetails(); // assertEquals(test3.getAddressPostcode(), "8541"); // } // // /** // * Testing whether updateAddressPostcode fails with invalid input // */ // @Test // public void updateAddressPostCode2() { // accMan.issueCommand("update", "ABC1234", "contacts", "addressPostcode", "27 Peters Road"); // ArrayList<DonorReceiver> test = accMan.getDonorReceivers(); // DonorReceiver test2 = test.get(0); // AccountContacts test3 = test2.getContactDetails(); // assertEquals(test3.getAddressPostcode(), "5678"); // } // // /** // * Testing whether the updateMobileNumber works with valid input // */ // @Test // public void updateMobileNumber1() { // accMan.issueCommand("update", "ABC1234", "contacts", "mobileNumber", "0220867417"); // ArrayList<DonorReceiver> test = accMan.getDonorReceivers(); // DonorReceiver test2 = test.get(0); // AccountContacts test3 = test2.getContactDetails(); // assertEquals(test3.getMobileNumber(), "0220867417"); // } // // /** // * Testing whether updateMobileNumber fails with invalid input // */ // @Test // public void updateMobileNumber2() { // accMan.issueCommand("update", "ABC1234", "contacts", "mobileNumber", "Hello"); // ArrayList<DonorReceiver> test = accMan.getDonorReceivers(); // DonorReceiver test2 = test.get(0); // AccountContacts test3 = test2.getContactDetails(); // assertEquals(test3.getMobileNumber(), "0220456543"); // } // // /** // * Testing whether the updateHomeNumber works with valid input // */ // @Test // public void updateHomeNumber1() { // accMan.issueCommand("update", "ABC1234", "contacts", "homeNumber", "5458978"); // ArrayList<DonorReceiver> test = accMan.getDonorReceivers(); // DonorReceiver test2 = test.get(0); // AccountContacts test3 = test2.getContactDetails(); // assertEquals(test3.getHomeNumber(), "5458978"); // } // // /** // * Testing whether updateHomeNumber fails with invalid input // */ // @Test // public void updateHomeNumber2() { // accMan.issueCommand("update", "ABC1234", "contacts", "homeNumber", "Hello"); // ArrayList<DonorReceiver> test = accMan.getDonorReceivers(); // DonorReceiver test2 = test.get(0); // AccountContacts test3 = test2.getContactDetails(); // assertEquals(test3.getHomeNumber(), "5452345"); // } // // /** // * Testing whether the updateEmail works with valid input // */ // @Test // public void updateEmail1() { // accMan.issueCommand("update", "ABC1234", "contacts", "email", "randomPerson94@gmail.com"); // ArrayList<DonorReceiver> test = accMan.getDonorReceivers(); // DonorReceiver test2 = test.get(0); // AccountContacts test3 = test2.getContactDetails(); // assertEquals(test3.getEmail(), "randomPerson94@gmail.com"); // } // // /** // * Testing whether updateEmail fails with invalid input // */ // @Test // public void updateEmail2() { // accMan.issueCommand("update", "ABC1234", "contacts", "email", "Hello"); // ArrayList<DonorReceiver> test = accMan.getDonorReceivers(); // DonorReceiver test2 = test.get(0); // AccountContacts test3 = test2.getContactDetails(); // assertEquals(test3.getEmail(), "randomPerson92@gmail.com"); // } // // /** // * Testing whether the updateEmergAddressStreet works with valid input // */ // @Test // public void updateEmergAddressStreet1() { // accMan.issueCommand("update", "ABC1234", "contacts", "emergAddressStreet", "27 Peters Road"); // ArrayList<DonorReceiver> test = accMan.getDonorReceivers(); // DonorReceiver test2 = test.get(0); // AccountContacts test3 = test2.getContactDetails(); // assertEquals(test3.getEmergAddressStreet(), "27 Peters Road"); // } // // /** // * Testing whether updateEmergAddressStreet fails with invalid input // */ // @Test // public void updateEmergAddressStreet2() { // accMan.issueCommand("update", "ABC1234", "contacts", "emergAddressStreet", ""); // ArrayList<DonorReceiver> test = accMan.getDonorReceivers(); // DonorReceiver test2 = test.get(0); // AccountContacts test3 = test2.getContactDetails(); // assertEquals(test3.getEmergAddressStreet(), "31b Taylors Ave"); // } // // /** // * Testing whether the updateEmergAddressCity works with valid input // */ // @Test // public void updateEmergAddressCity1() { // accMan.issueCommand("update", "ABC1234", "contacts", "emergAddressCity", "Nelson"); // ArrayList<DonorReceiver> test = accMan.getDonorReceivers(); // DonorReceiver test2 = test.get(0); // AccountContacts test3 = test2.getContactDetails(); // assertEquals(test3.getEmergAddressCity(), "Nelson"); // } // // /** // * Testing whether updateEmergAddressCity fails with invalid input // */ // @Test // public void updateEmergAddressCity2() { // accMan.issueCommand("update", "ABC1234", "contacts", "emergAddressCity", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); // ArrayList<DonorReceiver> test = accMan.getDonorReceivers(); // DonorReceiver test2 = test.get(0); // AccountContacts test3 = test2.getContactDetails(); // assertEquals(test3.getEmergAddressCity(), "Christchurch"); // } // // /** // * Testing whether the updateEmergAddressRegion works with valid input // */ // @Test // public void updateEmergAddressRegion1() { // accMan.issueCommand("update", "ABC1234", "contacts", "emergAddressRegion", "Buller"); // ArrayList<DonorReceiver> test = accMan.getDonorReceivers(); // DonorReceiver test2 = test.get(0); // AccountContacts test3 = test2.getContactDetails(); // assertEquals(test3.getEmergAddressRegion(), "Buller"); // } // // /** // * Testing whether updateEmergAddressRegion fails with invalid input // */ // @Test // public void updateEmergAddressRegion2() { // accMan.issueCommand("update", "ABC1234", "contacts", "emergAddressRegion", "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"); // ArrayList<DonorReceiver> test = accMan.getDonorReceivers(); // DonorReceiver test2 = test.get(0); // AccountContacts test3 = test2.getContactDetails(); // assertEquals(test3.getEmergAddressRegion(), "Canterbury"); // } // // /** // * Testing whether the updateEmergAddressPostcode works with valid input // */ // @Test // public void updateEmergAddressPostcode1() { // accMan.issueCommand("update", "ABC1234", "contacts", "emergAddressPostcode", "8541"); // ArrayList<DonorReceiver> test = accMan.getDonorReceivers(); // DonorReceiver test2 = test.get(0); // AccountContacts test3 = test2.getContactDetails(); // assertEquals(test3.getEmergAddressPostcode(), "8541"); // } // // /** // * Testing whether updateEmergAddressPostcode fails with invalid input // */ // @Test // public void updateEmergAddressPostcode2() { // accMan.issueCommand("update", "ABC1234", "contacts", "emergAddressPostcode", "27 Peters Road"); // ArrayList<DonorReceiver> test = accMan.getDonorReceivers(); // DonorReceiver test2 = test.get(0); // AccountContacts test3 = test2.getContactDetails(); // assertEquals(test3.getEmergAddressPostcode(), "8052"); // } // // /** // * Testing whether the updateEmergMobileNumber works with valid input // */ // @Test // public void updateEmergMobileNumber1() { // accMan.issueCommand("update", "ABC1234", "contacts", "emergMobileNumber", "0220867417"); // ArrayList<DonorReceiver> test = accMan.getDonorReceivers(); // DonorReceiver test2 = test.get(0); // AccountContacts test3 = test2.getContactDetails(); // assertEquals(test3.getEmergMobileNumber(), "0220867417"); // } // // /** // * Testing whether updateEmergMobileNumber fails with invalid input // */ // @Test // public void updateEmergMobileNumber2() { // accMan.issueCommand("update", "ABC1234", "contacts", "emergMobileNumber", "Hello"); // ArrayList<DonorReceiver> test = accMan.getDonorReceivers(); // DonorReceiver test2 = test.get(0); // AccountContacts test3 = test2.getContactDetails(); // assertEquals(test3.getEmergMobileNumber(), "0213459876"); // } // // /** // * Testing whether the updateEmergHomeNumber works with valid input // */ // @Test // public void updateEmergHomeNumber1() { // accMan.issueCommand("update", "ABC1234", "contacts", "emergHomeNumber", "5458978"); // ArrayList<DonorReceiver> test = accMan.getDonorReceivers(); // DonorReceiver test2 = test.get(0); // AccountContacts test3 = test2.getContactDetails(); // assertEquals(test3.getEmergHomeNumber(), "5458978"); // } // // /** // * Testing whether updateEmergHomeNumber fails with invalid input // */ // @Test // public void updateEmergHomeNumber2() { // accMan.issueCommand("update", "ABC1234", "contacts", "emergHomeNumber", "Hello"); // ArrayList<DonorReceiver> test = accMan.getDonorReceivers(); // DonorReceiver test2 = test.get(0); // AccountContacts test3 = test2.getContactDetails(); // assertEquals(test3.getEmergHomeNumber(), "5458769"); // } // // /** // * Testing whether the updateEmergEmail works with valid input // */ // @Test // public void updateEmergEmail1() { // accMan.issueCommand("update", "ABC1234", "contacts", "emergEmail", "randomHelper1@gmail.com"); // ArrayList<DonorReceiver> test = accMan.getDonorReceivers(); // DonorReceiver test2 = test.get(0); // AccountContacts test3 = test2.getContactDetails(); // assertEquals(test3.getEmergEmail(), "randomHelper1@gmail.com"); // } // // /** // * Testing whether updateEmergEmail fails with invalid input // */ // @Test // public void updateEmergEmail2() { // accMan.issueCommand("update", "ABC1234", "contacts", "emergEmail", "Hello"); // ArrayList<DonorReceiver> test = accMan.getDonorReceivers(); // DonorReceiver test2 = test.get(0); // AccountContacts test3 = test2.getContactDetails(); // assertEquals(test3.getEmergEmail(), "randomHelper93@yahoo.com"); // } // // // //} //*/
[ "bsc44@uclive.ac.nz" ]
bsc44@uclive.ac.nz
093c51db92cf21ddf1c75b94382b869dbd2327eb
0facae4bcfd5ffe01e1023dd3b37be1d410fb730
/src/main/java/org/library/review/controller/BookReviewController.java
00eba94c6955ec5612e64ae298b6eff93ae6f6ff
[]
no_license
hhimani/LibraryManager
b6bd3637112c380ad4cf0a99759b6061351d4a02
9cc0ed7e0a8e6c310da7a93eaffb584bbe8a9acd
refs/heads/master
2021-09-09T06:15:02.165936
2018-03-14T04:56:33
2018-03-14T04:56:33
104,828,571
1
0
null
null
null
null
UTF-8
Java
false
false
4,736
java
package org.library.review.controller; import java.util.Calendar; import java.util.Date; import java.util.List; import javax.servlet.http.HttpSession; import org.library.issueAndFine.model.BookIssueFine; import org.library.issueAndFine.service.BookIssueFineService; import org.library.login.model.LibUser; import org.library.manager.model.Book; import org.library.manager.service.BookService; import org.library.review.model.BookReview; import org.library.review.service.BookReviewService; import org.library.upload.service.FileUploadService; import org.library.util.FileIOUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.servlet.ModelAndView; @Controller public class BookReviewController { @Autowired private BookReviewService bookreviewService; public BookReviewService getBookreviewService() { return bookreviewService; } public void setBookreviewService(BookReviewService bookreviewService) { this.bookreviewService = bookreviewService; } @Autowired private BookService bookService; @Autowired private BookIssueFineService bookissuefineService; @Autowired private FileUploadService fileUploadService; // Display Image icon @ModelAttribute("image") public String displayPicIcon(HttpSession session, Model m) { LibUser user = (LibUser) session.getAttribute("user"); if (user == null) return null; String imagePath = fileUploadService.retrieveImagePath(user.getUserName()); String image = FileIOUtil.displayImage(imagePath); return image; } @RequestMapping(value="/reviewPage") public String reviewPage(){ return "review"; } @RequestMapping(value="/reviewTitle", method=RequestMethod.POST ) public String reviewTitle(String title,Model m){ List<BookReview> list=bookreviewService.fetchReviewByTitle(title); if(list==null){ m.addAttribute("msg","No Reviews fetched"); return "review"; } else{ m.addAttribute("list", list); return "review"; } } @RequestMapping(value="/reviewAuthor", method=RequestMethod.POST ) public String reviewAuthor(String author,Model m){ List<BookReview> list=bookreviewService.fetchReviewByAuthor(author); if(list==null){ m.addAttribute("msg","No Reviews fetched for the Entered Author"); return "review"; } else{ m.addAttribute("list", list); return "review"; } } @RequestMapping(value="/reviewUser", method=RequestMethod.GET ) public String reviewAuthor(Model m,HttpSession session ){ LibUser user= (LibUser)session.getAttribute("user"); String userName=user.getUserName(); List<BookReview> list=bookreviewService.fetchReviewByUser(userName); if(list==null){ m.addAttribute("msg","No Reviews fetched for the Entered Title"); return "review"; } else{ m.addAttribute("list", list); return "review"; } } //when a user adds review, reflect the change in RATING of the book in BOOK DB @RequestMapping(value="/addReview",method=RequestMethod.POST) public ModelAndView addUserReview(@RequestParam("review") String review, @RequestParam("rating") int rating ,@RequestParam("userName") String userName,@RequestParam("title") String title,@RequestParam("author") String author){ BookReview br=new BookReview(); br.setTitle(title); br.setUserName(userName); br.setRating(rating); br.setReview(review); br.setAuthor(author); Calendar c=Calendar.getInstance(); Date reviewDate=c.getTime(); br.setReviewDate(reviewDate); bookreviewService.addReview(br); //setting rating for book Book book=bookService.searchByTitle(title); List<BookReview> listre=bookreviewService.fetchReviewByTitle(title); int countReview=listre.size(); int pr=book.getRating(); int i=pr*countReview+rating; int j=(countReview+1); int nr=i/j; book.setRating(nr); bookService.updateBook(book); //**********************// //setting reviewed tag for BookIssueFine BookIssueFine b=bookissuefineService.fetchTitle(userName, title); b.setReviewed(true); b.setUserName(userName); bookissuefineService.updateBookIssueFine(b); //**************************************** ModelAndView mav=new ModelAndView("review"); List<BookReview> list=bookreviewService.fetchReviewByUser(userName); mav.addObject("list",list); return mav; } }
[ "himani@amit.home" ]
himani@amit.home
9ae0c1c08c648ceb7dfe304ba8774eded92b84fe
f4b92b888bfe59911b6818856e595ed503792016
/src/test/java/ie/murph/performance/iterators/package-info.java
1274a357f2659d2a69d8033ea754bf105bd85d40
[]
no_license
Mur3ph/solid-software-quality
23d90df91f2fa4c26d70e6f43c8702dc153a271d
b2a1b1f7b4f645c1c1657c40f3d629ee35279490
refs/heads/master
2020-03-08T03:28:23.827552
2019-11-28T23:14:53
2019-11-28T23:14:53
127,891,987
0
0
null
null
null
null
UTF-8
Java
false
false
86
java
/** * */ /** * @author PC * */ package test.java.ie.murph.performance.iterators;
[ "paulmurphymainstreet@gmail.com" ]
paulmurphymainstreet@gmail.com
2245f713d3e8149117f8b40a675596b42057b466
7fea61da20c9ccaa3d33e261e9319661129ba027
/src/main/java/com/bomb0069/shopping/product/ProductListResponse.java
f886591ee523263a42464b3dde294fbbed043600
[]
no_license
bomb0069/simple-shopping-cart-with-spring
434f9c49838fc1d7bff80a4d4883d679e7c46bf8
0fd0a0f66c08e818cfd201507cc643f61cb53966
refs/heads/main
2023-08-04T01:58:28.368291
2023-07-31T16:38:02
2023-07-31T16:38:02
327,066,089
0
14
null
null
null
null
UTF-8
Java
false
false
492
java
package com.bomb0069.shopping.product; import java.util.ArrayList; import java.util.List; public class ProductListResponse { private List<ProductResponse> products = new ArrayList<>(); public Integer getTotal() { return products.size(); } public void setTotal(Integer total) { } public List<ProductResponse> getProducts() { return products; } public void addProduct(ProductResponse product) { products.add(product); } }
[ "bomb0069@gmail.com" ]
bomb0069@gmail.com
eefd77447331ab97eafc1dcb6f5b55eb8280f176
94d2a9fc32ee02aa79b37e49897e98ffeedd9a4d
/src/main/java/com/github/claassen/jlinq/queries/JLinqBigDecimalCollection.java
eb6dd4ac587b78ea9d54bfa9ee0579202e5e4f88
[ "MIT" ]
permissive
claassen/jlinq
27657107242531d0fbe3457aa8c20ac4f1bd59f8
b998eaee71d7f1d056b7153d29810152e4d1c403
refs/heads/master
2021-01-13T07:29:22.007908
2017-03-21T16:52:44
2017-03-21T16:52:44
71,303,892
0
0
null
null
null
null
UTF-8
Java
false
false
625
java
package com.github.claassen.jlinq.queries; import com.github.claassen.jlinq.queries.base.JLinqBigDecimalBase; import com.github.claassen.jlinq.queries.base.JLinqNumericBase; import java.math.BigDecimal; import java.math.MathContext; import java.util.Iterator; public class JLinqBigDecimalCollection<T extends BigDecimal> extends JLinqBigDecimalBase<T> { public JLinqBigDecimalCollection(Iterable<T> collection, MathContext roundingMode) { super(roundingMode); Iterator<T> iterator = collection.iterator(); setNext(() -> iterator.next()); setHasNext(() -> iterator.hasNext()); } }
[ "mk.clssn@gmail.com" ]
mk.clssn@gmail.com
a61ac66c55072554da66578207f9b8592714ae56
940a0346fbad7681f70566d3e93e2ebd4683a523
/스토어용(관리자, 광고, 로그인 제외)/AndroidProject/app/src/main/java/com/aoslec/androidproject/Adapter/HourlyWeatherAdapter.java
3d48c336e41ff0d6e3500a17dcc40fd52be62192
[]
no_license
IceAmerican0/Android_Project
c8a8990e95409134c0077610122ad9957d935058
cce871f3ad18ca9e8838878ae9ece5bebe65f110
refs/heads/main
2023-07-02T06:33:15.073639
2021-08-05T16:52:52
2021-08-05T16:52:52
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,167
java
package com.aoslec.androidproject.Adapter; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.RawRes; import androidx.recyclerview.widget.RecyclerView; import com.airbnb.lottie.LottieAnimationView; import com.aoslec.androidproject.Bean.HourlyWeatherBean; import com.aoslec.androidproject.R; import org.jetbrains.annotations.NotNull; import java.util.ArrayList; public class HourlyWeatherAdapter extends RecyclerView.Adapter<HourlyWeatherAdapter.ViewHolder> { private Context mcontext=null; private int layout=0; private ArrayList<HourlyWeatherBean> data=null; private LayoutInflater inflater=null; public HourlyWeatherAdapter(Context mcontext, int layout, ArrayList<HourlyWeatherBean> data) { this.mcontext = mcontext; this.layout = layout; this.data = data; this.inflater= (LayoutInflater) mcontext.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } public class ViewHolder extends RecyclerView.ViewHolder{ public TextView hourly_time,hourly_temp,hourly_pop; public LottieAnimationView hourly_LAweather; public int hourly_id; public ViewHolder(View convertView){ super(convertView); hourly_time = convertView.findViewById(R.id.Hourly_time); hourly_temp=convertView.findViewById(R.id.Hourly_temp); hourly_pop=convertView.findViewById(R.id.Hourly_pop); hourly_LAweather=convertView.findViewById(R.id.hourly_LAweather); } } @Override public HourlyWeatherAdapter.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View v=LayoutInflater.from(parent.getContext()).inflate(R.layout.recycler_hourly_weather,parent,false); ViewHolder viewHolder=new ViewHolder(v); return viewHolder; } @Override public void onBindViewHolder(HourlyWeatherAdapter.ViewHolder holder, int position) { holder.hourly_temp.setText(data.get(position).getHourly_temp()+"°"); holder.hourly_pop.setText(mcontext.getString(R.string.pop)+" "+data.get(position).getHourly_pop()+"%"); holder.hourly_time.setText(data.get(position).getHourly_time()); int id=data.get(position).getHourly_id(); if(id>=200&&id<=232) holder.hourly_LAweather.setAnimation(R.raw.thunder_rain); else if(id>=300&&id<=321) holder.hourly_LAweather.setAnimation(R.raw.rainy); else if(id>=500&&id<=531) holder.hourly_LAweather.setAnimation(R.raw.rain); else if(id>=600&&id<=622) holder.hourly_LAweather.setAnimation(R.raw.snow); else if(id==800) holder.hourly_LAweather.setAnimation(R.raw.sunny); else if(id>=800&&id<=802) holder.hourly_LAweather.setAnimation(R.raw.cloudy_sun); else if(id>=803) holder.hourly_LAweather.setAnimation(R.raw.cloudy); else holder.hourly_LAweather.setAnimation(R.raw.cloudy); } @Override public int getItemCount() { return data.size(); } }
[ "starsjun@naver.com" ]
starsjun@naver.com
eb5c0df19b7d67f68d94c2854a4c5b44cf7b737d
d98de110431e5124ec7cc70d15906dac05cfa61a
/public/source/photon/plugins/org.marketcetera.photon.marketdata/src/main/java/org/marketcetera/photon/marketdata/IFeedStatusChangedListener.java
e2f5b0a9d59ff1433ff6a9d8b1fce2e45cc74cc0
[]
no_license
dhliu3/marketcetera
367f6df815b09f366eb308481f4f53f928de4c49
4a81e931a044ba19d8f35bdadd4ab081edd02f5f
refs/heads/master
2020-04-06T04:39:55.389513
2012-01-30T06:49:25
2012-01-30T06:49:25
29,947,427
0
1
null
2015-01-28T02:54:39
2015-01-28T02:54:39
null
UTF-8
Java
false
false
1,450
java
package org.marketcetera.photon.marketdata; import java.util.EventListener; import org.marketcetera.marketdata.FeedStatus; import org.marketcetera.util.misc.ClassVersion; /** * Interface that feed status listeners must implement. * * @author <a href="mailto:will@marketcetera.com">Will Horn</a> * @version $Id: IFeedStatusChangedListener.java 10620 2009-06-22 07:27:44Z tlerios $ * @since 1.0.0 */ @ClassVersion("$Id: IFeedStatusChangedListener.java 10620 2009-06-22 07:27:44Z tlerios $") public interface IFeedStatusChangedListener extends EventListener { /** * Callback for handling feed status changes. * * @param event * event describing feed status change */ void feedStatusChanged(IFeedStatusEvent event); /** * Event object interface for feed status changes. */ @ClassVersion("$Id: IFeedStatusChangedListener.java 10620 2009-06-22 07:27:44Z tlerios $") public interface IFeedStatusEvent { /** * The object on which the event initially occurred. * * @return the object on which the event initially occurred */ public Object getSource(); /** * Returns the old status, before the change that triggered this event. * * @return the old status */ FeedStatus getOldStatus(); /** * Returns the new status, that is the feed's current status. * * @return the new status */ FeedStatus getNewStatus(); } }
[ "stevenshack@stevenshack.com" ]
stevenshack@stevenshack.com
7a33438425edbe9b7a5171854b6389f57e41ddce
0af8b92686a58eb0b64e319b22411432aca7a8f3
/large-multiproject/project68/src/main/java/org/gradle/test/performance68_2/Production68_129.java
5f806d023e0fc3b36ed5ac48c658e387c3d674da
[]
no_license
gradle/performance-comparisons
b0d38db37c326e0ce271abebdb3c91769b860799
e53dc7182fafcf9fedf07920cbbea8b40ee4eef4
refs/heads/master
2023-08-14T19:24:39.164276
2022-11-24T05:18:33
2022-11-24T05:18:33
80,121,268
17
15
null
2022-09-30T08:04:35
2017-01-26T14:25:33
null
UTF-8
Java
false
false
305
java
package org.gradle.test.performance68_2; public class Production68_129 extends org.gradle.test.performance15_2.Production15_129 { private final String property; public Production68_129() { this.property = "foo"; } public String getProperty() { return property; } }
[ "cedric.champeau@gmail.com" ]
cedric.champeau@gmail.com
0fb83e4052d4f9a187426eda9b56d458510a99e0
b2ef27a463c26b673293932421cdf0aed912ce67
/src/main/java/car/hey/platform/service/CSVService.java
0cffbf68563be0a4f66c174b63dd018732aa6003
[]
no_license
shijinraj/platform
3a1196d565570dd46033e9505e9e6204717322fa
3d116c944a151e3fb22dae6d407a3e2acf73e47f
refs/heads/master
2022-12-04T12:00:33.494434
2020-08-16T21:33:33
2020-08-16T21:33:33
288,027,688
0
0
null
null
null
null
UTF-8
Java
false
false
338
java
package car.hey.platform.service; import java.io.IOException; import org.springframework.web.multipart.MultipartFile; public interface CSVService { /** * save MultipartFile csv * * @param dealerId * @param csvFile * @throws IOException */ public void save(Integer dealerId, MultipartFile csvFile) throws IOException; }
[ "shijin.raj@cgm.com" ]
shijin.raj@cgm.com
35fa49f5e2d02b318d8f5ee5d6019abb8101efa2
2ee773cbdc216c9165029632eb36fedd8de36ca5
/app/src/main/java/org/firstinspires/ftc/robotcore/internal/android/dex/Annotation.java
99a0e16df1aded45244a3a1271ae4dc1558df458
[]
no_license
Killian-Townsend/Custom-FTC-Driver-Station-2021
6bee582afdb032ad2921b394280a2321f0f815ec
16e8999d7593ef2c4189902bf2d376db8a3a6b41
refs/heads/master
2023-03-28T04:48:30.704409
2021-03-19T01:09:18
2021-03-19T01:09:18
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,903
java
package org.firstinspires.ftc.robotcore.internal.android.dex; public final class Annotation implements Comparable<Annotation> { private final Dex dex; private final EncodedValue encodedAnnotation; private final byte visibility; public Annotation(Dex paramDex, byte paramByte, EncodedValue paramEncodedValue) { this.dex = paramDex; this.visibility = paramByte; this.encodedAnnotation = paramEncodedValue; } public int compareTo(Annotation paramAnnotation) { return this.encodedAnnotation.compareTo(paramAnnotation.encodedAnnotation); } public EncodedValueReader getReader() { return new EncodedValueReader(this.encodedAnnotation, 29); } public int getTypeIndex() { EncodedValueReader encodedValueReader = getReader(); encodedValueReader.readAnnotation(); return encodedValueReader.getAnnotationType(); } public byte getVisibility() { return this.visibility; } public String toString() { if (this.dex == null) { StringBuilder stringBuilder1 = new StringBuilder(); stringBuilder1.append(this.visibility); stringBuilder1.append(" "); stringBuilder1.append(getTypeIndex()); return stringBuilder1.toString(); } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(this.visibility); stringBuilder.append(" "); stringBuilder.append(this.dex.typeNames().get(getTypeIndex())); return stringBuilder.toString(); } public void writeTo(Dex.Section paramSection) { paramSection.writeByte(this.visibility); this.encodedAnnotation.writeTo(paramSection); } } /* Location: C:\Users\Student\Desktop\APK Decompiling\com.qualcomm.ftcdriverstation_38_apps.evozi.com\classes-dex2jar.jar!\org\firstinspires\ftc\robotcore\internal\android\dex\Annotation.class * Java compiler version: 6 (50.0) * JD-Core Version: 1.1.3 */
[ "admin@thatsfuckingstupid.org" ]
admin@thatsfuckingstupid.org
5bf0c5b6e91a404d3eb8620de02c82b0b0f0d7fb
356b4025b17d6ee8f3516fd16a784710fbfc8e12
/webcontain/src/main/java/com/nrec/webcontain/DownloadRetrofitFactory.java
2caaac473a377c77ab9c0d45cd33c259fcce0343
[]
no_license
JiweiMaster/demo
276baef2d813e993c4d2899cd82cb73e712a8d4c
9e658e0994f344d95d3efbacad7bc442db71c9ac
refs/heads/master
2020-04-16T02:53:58.446787
2019-01-16T01:47:39
2019-01-16T01:47:39
165,212,586
0
0
null
null
null
null
UTF-8
Java
false
false
878
java
package com.nrec.webcontain; import retrofit2.Retrofit; import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory; import retrofit2.converter.gson.GsonConverterFactory; /** * Created by 18099 on 2018/12/26. */ public class DownloadRetrofitFactory extends CommonNetManager { private static DownloadRetrofitFactory factory; public static synchronized DownloadRetrofitFactory getInstance(){ if(factory == null){ factory = new DownloadRetrofitFactory(); } return factory; } public Retrofit initRetrofit(String urlStr) { return retrofit = new Retrofit.Builder() .client(initOkHttpClient()) .baseUrl(urlStr) .addConverterFactory(GsonConverterFactory.create()) .addCallAdapterFactory(RxJava2CallAdapterFactory.create()) .build(); } }
[ "jiwei@nrec.com" ]
jiwei@nrec.com
85840fd5386cc21e3506b0b1e3fa8188dd46673d
89fc9500c4c1979d9f8706ed04ff3cb6f3d40886
/src/hanto/studentpren/alpha/AlphaHantoGame.java
dd619c894f2f7017596308644d8d2be3f01151dc
[]
no_license
feierqi/Hanto
9fb2d1c76bf03e193258427e4b09e1b11537e660
747d9f5a78eb4e9216da28a6631ddf3f3af03e79
refs/heads/master
2021-01-10T18:41:28.218697
2014-11-02T00:25:29
2014-11-02T00:25:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,875
java
/******************************************************************* * Copyright (c) 2013 Peng Ren * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * feierqi *******************************************************************/ package hanto.studentpren.alpha; import hanto.common.HantoException; import hanto.common.HantoGame; import hanto.studentpren.InternalHantoGame; import hanto.studentpren.common.Coordinate; import hanto.studentpren.gamma.GammaHantoPiece; import hanto.util.HantoCoordinate; import hanto.util.HantoPieceType; import hanto.util.HantoPlayerColor; import hanto.util.MoveResult; /** * Description * * @author Peng Ren * @version Jan 19, 2013 */ public class AlphaHantoGame implements HantoGame, InternalHantoGame{ /** * The initial board coordinate for the game. */ private HantoCoordinate initialCoordinate; /** * The current turn number; */ private int turn; /** * The final position of the red butterfly. */ private HantoCoordinate redCoord; /** * Default constructor for the class that is to * set up the initial coordinate to (0, 0) so that * players are ready to play. * */ public AlphaHantoGame(){ turn = 0; initialCoordinate = new Coordinate(0, 0); redCoord = null; } /** * Get the initialCoordiante. * * @return initial Coordinate. */ public HantoCoordinate getInitialCoordinate(){ return initialCoordinate; } /** * Get the red butterfly's coordinate. * * @return red butterfly's coordinate */ public HantoCoordinate getRedCoord(){ return redCoord; } /** * Get the number of turn. * * @return number of turn. */ public int getTurn(){ return turn; } /** * @see hanto.common.HantoGame#initialize(hanto.util.HantoPlayerColor) */ @Override public void initialize(HantoPlayerColor firstPlayer) { turn = 0; redCoord = null; initialCoordinate = new Coordinate(0, 0); } /** * @see hanto.common.HantoGame#makeMove(hanto.util.HantoPieceType, * hanto.util.HantoCoordinate, hanto.util.HantoCoordinate) */ @Override public MoveResult makeMove(HantoPieceType pieceType, HantoCoordinate from, HantoCoordinate to) throws HantoException { MoveResult result; final Coordinate coordTo; coordTo = Coordinate.guarrenteedCoordinate(to); if(turn == 0 && from == null && coordTo.equals(initialCoordinate) && pieceType == HantoPieceType.BUTTERFLY){ result = MoveResult.OK; } else if(turn == 1 && from == null && pieceType == HantoPieceType.BUTTERFLY && (coordTo.equals(new Coordinate(0, 1)) || coordTo.equals(new Coordinate(1, 0)) || coordTo.equals(new Coordinate(1, -1)) || coordTo.equals(new Coordinate(0, -1)) || coordTo.equals(new Coordinate(-1, 0)) || coordTo.equals(new Coordinate(-1, 1)))){ result = MoveResult.DRAW; } else{ throw new HantoException("Error"); } turn++; redCoord = to; return result; } /** * When the method is called during the game, it will print the state * of hex pieces on board and is understandable. * * @return a series of string describing the state of hex pieces */ @Override public String getPrintableBoard() { String board = "No meaningful board."; if(turn == 1){ board = "Blue Butterfly (0, 0)"; } else if(turn == 2){ board = "Blue Butterfly (0, 0)\nRed Butterfly " + "(" + redCoord.getX() + ", " + redCoord.getY() + ")"; } return board; } /** * @see hanto.studentpren.InternalHantoGame#getPieceAt(int, int) */ @Override public GammaHantoPiece getPieceAt(int x, int y) { // TODO Auto-generated method stub return null; } }
[ "geierqi@gmail.com" ]
geierqi@gmail.com
6748d3521daaf62f2533252d29bc6a616bdc7a57
2276a8225d35ba56618c52a9fcfe8f3b2721b131
/DHMC-HealthApp/src/view/PatientDashController.java
f8183be968de48e9a3cf57504269dff685e0a2b4
[]
no_license
mrampiah/CS-3733
8e340bc2d52a9a8e368c6336a6e2b9aa91c6e51e
f05382db6b9178371efb3ab56308f0790ef55210
refs/heads/master
2020-04-04T12:21:30.815365
2018-04-04T04:37:16
2018-04-04T04:37:16
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,303
java
package view; import java.io.IOException; import javafx.fxml.FXML; import javafx.fxml.FXMLLoader; import javafx.scene.Scene; import javafx.scene.control.TabPane; import javafx.scene.layout.AnchorPane; import javafx.scene.layout.BorderPane; import model.MainApp; public class PatientDashController { @SuppressWarnings("unused") private MainApp mainApp; @FXML TabPane tabPane; @FXML BorderPane layout; public PatientDashController() { } @FXML private void initialize() { tabPane.getSelectionModel().selectedIndexProperty() .addListener((observable, oldValue, newValue) -> handleTabSwitch(newValue)); } public void handleTabSwitch(Number newValue) { // if (newValue.intValue() == 1) { // mainApp.setHorizontalDimensions(); // showMySchedule(); // } } public void showMySchedule() { try { // Load root layout from fxml file. FXMLLoader loader = new FXMLLoader(); loader.setLocation(MainApp.class.getResource("view/MySchedule.fxml")); AnchorPane mySchedule = (AnchorPane) loader.load(); tabPane.getTabs().get(1).setContent(mySchedule); } catch (IOException e) { e.printStackTrace(); } } public void showCalendar(Scene calendar) { // primaryStage.setScene(calendar); } public void setMainApp(MainApp mainApp) { this.mainApp = mainApp; } }
[ "srbriggs@wpi.edu" ]
srbriggs@wpi.edu
0371db85735651582de6360ff0f6859df7b85e35
ae70aecd1fbc9376317878ce2583736359d7a6db
/demo/src/main/java/com/example/demo/SecurityConfig.java
7eae4fb9ecaa816029ec367a62559e2892378378
[]
no_license
muoyou/demo
f2b9ebcb469226857ddcb295d40af866667e4061
14ba32e4c736ac535bba069c257fc66396869696
refs/heads/master
2022-06-30T05:11:08.289969
2020-02-22T10:02:46
2020-02-22T10:02:46
242,317,611
0
0
null
2022-06-29T17:58:33
2020-02-22T09:54:45
null
UTF-8
Java
false
false
1,079
java
package com.example.demo; import org.springframework.context.annotation.Configuration; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; @Configuration @EnableWebSecurity public class SecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { //super.configure(http); //配置不需要登陆验证 http.authorizeRequests().anyRequest().permitAll().and().logout().permitAll().and().csrf().disable().headers().frameOptions().disable(); /* http.formLogin() .loginPage("/login.html") .loginProcessingUrl("/") .and() .authorizeRequests() .antMatchers("/login.html", "/", "/error") .permitAll() .anyRequest().authenticated();*/ } }
[ "809523733@qq.com" ]
809523733@qq.com
341293d92b4064bdee8d38a370963f664fd7a235
93fb8940804f5f6172c08e1f1b73e15fc54282db
/src/UserInput.java
e03f147da5ad5d6c037f3f41f3a332ec30dc615e
[]
no_license
oceenachi/Java-algorithms
6e0688f2cceeef109e7cb82d6fba337788277d48
2fca3d47a82cd9334d084de46b62b581d8564be6
refs/heads/master
2020-09-28T18:06:40.462059
2019-12-09T09:17:31
2019-12-09T09:17:31
226,831,136
0
0
null
null
null
null
UTF-8
Java
false
false
764
java
import java.util.Date; import java.util.Scanner; public class UserInput { public static void main(String[] args) { } public static void current() { Scanner scanner = new Scanner(System.in); System.out.println("enter your year of birth"); boolean hasNextInt = scanner.hasNextInt(); if (hasNextInt) { int yrOfBirth = scanner.nextInt(); scanner.nextLine(); System.out.println("enter your name"); String name = scanner.nextLine(); int age = 2019 - yrOfBirth; if (age >0 && age <=100) { System.out.println("your name is " + name + " and you are " + age + " years old"); } } scanner.close(); } }
[ "phillipfrancisca@gmail.com" ]
phillipfrancisca@gmail.com
92e2fdcee7257b3085c3bb55561a142dfe666da2
45b6d8120b6236dcf198b4ed3c570b6128904da8
/tensquare_friend/src/main/java/com/tensquare/friend/service/FriendService.java
fc392711ce6802d7d6e4923a1a7d0ee8a8212587
[]
no_license
xxmiao1006/tensquare
1d36b79461df328d18adff4ca2c2d5e56fff8702
95bde7f2559363631220f1bb177b77c43a066be2
refs/heads/master
2020-12-02T15:55:20.813829
2020-02-03T01:50:52
2020-02-03T01:50:52
231,056,577
0
0
null
null
null
null
UTF-8
Java
false
false
2,355
java
package com.tensquare.friend.service; import com.tensquare.friend.client.UserClient; import com.tensquare.friend.dao.FriendDao; import com.tensquare.friend.dao.NoFriendDao; import com.tensquare.friend.pojo.Friend; import com.tensquare.friend.pojo.NoFriend; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @Service @Transactional public class FriendService { @Autowired private FriendDao friendDao; @Autowired private NoFriendDao noFriendDao; @Autowired private UserClient userClient; public int addFriend(String userid, String friendid) { //判断如果用户已经添加了这个好友,则不进行任何操作,返回0 if (friendDao.selectCount(userid, friendid) > 0) { return 0; } //向喜欢表中添加记录 Friend friend = new Friend(); friend.setUserid(userid); friend.setFriendid(friendid); friend.setIslike("0"); friendDao.save(friend); //判断对方是否喜欢你,如果喜欢,将islike设置为1 if (friendDao.selectCount(friendid, userid) > 0) { friendDao.updateLike(userid, friendid, "1"); friendDao.updateLike(friendid, userid, "1"); } userClient.incFollowcount(userid, 1);//增加自己的关注数 userClient.incFanscount(friendid, 1);//增加对方的粉丝数 return 1; } /** * 向不喜欢列表中添加记录 * * @param userid * @param friendid */ public void addNoFriend(String userid, String friendid) { NoFriend noFriend = new NoFriend(); noFriend.setUserid(userid); noFriend.setFriendid(friendid); noFriendDao.save(noFriend); } /** * 删除好友 * * @param userid * @param friendid */ @Transactional public void deleteFriend(String userid, String friendid) { friendDao.deleteFriend(userid, friendid); friendDao.updateLike(friendid, userid, "0"); addNoFriend(userid, friendid);//向不喜欢表中添加记录 userClient.incFollowcount(userid, -1);//减少自己的关注数 userClient.incFanscount(friendid, -1);//减少对方的粉丝数 } }
[ "1151856023@qq.com" ]
1151856023@qq.com
7da1993d7d9b8ffbe21cd48113d5e6c0606c480a
7278e7e153bb09ed4454a35d7c2b40d797d3385b
/NxLjngMeter/src/main/java/com/zfg/org/myexample/pay/weipay/WechatNotSupportException.java
5f5ecd87c9a08d55fb83b15ca6dadf5416fd11fe
[]
no_license
CapRobin/LjngProject
f530dce3f917222b7c669ff273fd6e7f9c41f859
a63ce5d483ed41be57ac714910b394ba40682a5a
refs/heads/master
2020-03-11T17:07:25.914849
2018-05-08T11:20:17
2018-05-08T11:20:17
130,138,154
1
0
null
null
null
null
UTF-8
Java
false
false
353
java
package com.zfg.org.myexample.pay.weipay; /** * Created by Administrator on 2016-10-19. */ public class WechatNotSupportException extends Exception { private static final long serialVersionUID = 2313964703740528072L; public WechatNotSupportException(){ super("Current wechat APP version too low, not support wechat pay."); } }
[ "CapRobin@yeah.net" ]
CapRobin@yeah.net
30bd0a4b6d7899cc184b4e6e945d333537eb35fe
c4fda83e85115937dcc5459788f3a2bf43f07375
/src/main/java/cn/icom/demo/common/Long/LongEventProducer.java
8498cd08ed4da6c6377b3d0866a9aa73a057e21b
[]
no_license
panenming/disruptor-demo
79bec1c61524e73fa7fd26efca2468ee6bdd84fd
600c5e06c3b6087f88869a7b1f09de366c36abff
refs/heads/master
2021-04-26T22:14:16.373336
2018-03-06T08:50:21
2018-03-06T08:50:21
124,048,480
0
0
null
null
null
null
UTF-8
Java
false
false
650
java
package cn.icom.demo.common.Long; import java.nio.ByteBuffer; import com.lmax.disruptor.RingBuffer; /** * 发布事件 * * @author panenming * @date 2018年3月6日 * @version 1.0 */ public class LongEventProducer { private final RingBuffer<LongEvent> ringBuffer; public LongEventProducer(RingBuffer<LongEvent> ringBuffer) { this.ringBuffer = ringBuffer; } public void onData(ByteBuffer bb) { long seq = ringBuffer.next(); try { LongEvent event = ringBuffer.get(seq); event.setValue(bb.getLong(0)); } finally { ringBuffer.publish(seq); } } }
[ "panenming@enn.cn" ]
panenming@enn.cn
1c230675013ebd3a79fdda508fb58d3848c65dd8
720374183088e925099ef658945ccb14f2501a38
/string_calculator/test/string_calculator/StringCalculatorTest.java
b0e5415a2e7b4674e3110b355272dbca947d263a
[]
no_license
JaeBongLee/WebServer
8b3416090f073b727984014f3c9e5d18214c47b3
7593136ebf30c97cfdfccfa992ea52fb2fe4cdae
refs/heads/master
2021-01-10T16:31:12.239340
2015-10-16T14:22:13
2015-10-16T14:22:13
44,255,291
0
0
null
null
null
null
UTF-8
Java
false
false
1,200
java
package string_calculator; import static org.junit.Assert.*; import org.junit.Before; import org.junit.Test; public class StringCalculatorTest { StringCalculator stringCal; @Before public void setup(){ stringCal = new StringCalculator(); } @Test public void add_emptyString() { int result = stringCal.addNumberInString(""); assertEquals(0,result); } @Test public void add_oneNumString() { int result = stringCal.addNumberInString("1"); assertEquals(1,result); } @Test public void add_twoNumberSumStringByComma() { int result = stringCal.addNumberInString("1,2"); assertEquals(3,result); } @Test public void add_multiNumberSumStringByComma() { int result = stringCal.addNumberInString("1,2,3"); assertEquals(6,result); } @Test public void add_multiNumberSumStringByCommaAndSemi() { int result = stringCal.addNumberInString("1,2;3"); assertEquals(6,result); } @Test public void add_multiNumberSumStringByCustom() { int result = stringCal.divideCustom("//:\n1:2:3"); assertEquals(6,result); } @Test(expected=RuntimeException.class) public void add_minusNumberResult() throws Exception { stringCal.divideCustom("-1,2,3"); } }
[ "GingerAebi@gmail.com" ]
GingerAebi@gmail.com
4522c1b3a24381ec19e69a390bcc243356f0812b
05b56339b3317c1b4dcf6f03723648e3b40fbe78
/engine/pieces/Bishop.java
9cb8ad67498b0dc8d7fde6c826b0aec2e86b6a75
[]
no_license
Tomciii/Chess
8e4e916dbf22bb99ede26ad66a81cf6df1bca92a
17024a6dfa1588159ac463e13624cc96cdabf838
refs/heads/master
2023-02-28T10:24:16.852694
2021-02-08T15:11:05
2021-02-08T15:11:05
337,115,271
0
0
null
null
null
null
UTF-8
Java
false
false
3,166
java
package com.chess.engine.pieces; import com.chess.engine.Alliance; import com.chess.engine.board.Board; import com.chess.engine.board.BoardUtils; import com.chess.engine.board.Move; import com.chess.engine.board.Move.MajorMove; import com.chess.engine.board.Tile; import com.google.common.collect.ImmutableList; import java.util.ArrayList; import java.util.Collection; import java.util.List; import static com.chess.engine.board.Move.*; public class Bishop extends Piece { private final static int[] CANDIDATE_MOVE_VECTOR_COORDINATES = {-9,-7,7,9}; public Bishop(final Alliance pieceAlliance, final int piecePosition) { super(PieceType.BISHOP, piecePosition, pieceAlliance); } @Override public Collection<Move> calculateLegalMoves(final Board board) { final List<Move> legalMoves = new ArrayList<>(); for( final int candidateCoordinateOffset : CANDIDATE_MOVE_VECTOR_COORDINATES){ int candidateDestinationCoordinate = this.piecePosition; while(BoardUtils.isValidTileCoordinate(candidateDestinationCoordinate)){ if(isFirstColumnExclusion(candidateDestinationCoordinate, candidateCoordinateOffset) || isEightColumnExclusion(candidateDestinationCoordinate, candidateCoordinateOffset)){ break; } candidateDestinationCoordinate += candidateCoordinateOffset; if(BoardUtils.isValidTileCoordinate(candidateDestinationCoordinate)){ final Tile candidateDestinationTile = board.getTile(candidateDestinationCoordinate); if(!candidateDestinationTile.isTileOccupied()){ legalMoves.add(new MajorMove(board, this, candidateDestinationCoordinate)); } else { final Piece pieceAtDestination = candidateDestinationTile.getPiece(); final Alliance pieceAlliance = pieceAtDestination.getPieceAlliance(); if(this.pieceAlliance != pieceAlliance){ legalMoves.add(new AttackMove(board, this, candidateDestinationCoordinate, pieceAtDestination)); } } break; } } } return ImmutableList.copyOf(legalMoves); } @Override public Bishop movePiece(final Move move) { return new Bishop(move.getMovedPiece().getPieceAlliance(), move.getDestinationCoordinate()); } @Override public String toString() { return PieceType.BISHOP.toString(); } private static boolean isFirstColumnExclusion(final int currentPosition, final int candidateOffest){ return BoardUtils.FIRST_COLUMN[currentPosition] && (candidateOffest == -9 || candidateOffest == 7); } private static boolean isEightColumnExclusion(final int currentPosition, final int candidateOffest){ return BoardUtils.EIGHTH_COLUMN[currentPosition] && (candidateOffest == -7 || candidateOffest == 9); } }
[ "Thomash1994@gmail.com" ]
Thomash1994@gmail.com
c5629da55e677a61cacaea10421755300cca54c7
17ce6ecfbc81c8f1b0e9ee03b2a70524fabdc943
/cdd-back/src/java/com/cdd/back/client/FrontWebServer.java
ebfd17e22fdaebfb0d3a37c700f73dd272366463
[]
no_license
cailieking/zhaochuanPro
751d19fe6a33cd7b42ee6ff353f2070ba0160670
9880a215be5cb542e20078a20b243d48f043462c
refs/heads/master
2021-01-20T02:54:27.064204
2017-05-15T08:46:40
2017-05-15T08:46:40
89,465,617
3
2
null
null
null
null
UTF-8
Java
false
false
2,865
java
package com.cdd.back.client; import javax.jws.WebMethod; import javax.jws.WebParam; import javax.jws.WebResult; import javax.jws.WebService; import javax.xml.bind.annotation.XmlSeeAlso; import javax.xml.ws.Action; import javax.xml.ws.RequestWrapper; import javax.xml.ws.ResponseWrapper; /** * This class was generated by Apache CXF 3.1.8 * 2016-11-30T13:47:30.739+08:00 * Generated source version: 3.1.8 * */ @WebService(targetNamespace = "http://server.front.cdd.com/", name = "FrontWebServer") @XmlSeeAlso({ObjectFactory.class}) public interface FrontWebServer { @WebResult(name = "return", targetNamespace = "") @Action(input = "http://server.front.cdd.com/FrontWebServer/createNewsDetailsRequest", output = "http://server.front.cdd.com/FrontWebServer/createNewsDetailsResponse") @RequestWrapper(localName = "createNewsDetails", targetNamespace = "http://server.front.cdd.com/", className = "com.cdd.back.client.CreateNewsDetails") @WebMethod @ResponseWrapper(localName = "createNewsDetailsResponse", targetNamespace = "http://server.front.cdd.com/", className = "com.cdd.back.client.CreateNewsDetailsResponse") public boolean createNewsDetails( @WebParam(name = "arg0", targetNamespace = "") com.cdd.back.client.MapConvertor arg0 ); @WebResult(name = "return", targetNamespace = "") @Action(input = "http://server.front.cdd.com/FrontWebServer/createHtmlRequest", output = "http://server.front.cdd.com/FrontWebServer/createHtmlResponse") @RequestWrapper(localName = "createHtml", targetNamespace = "http://server.front.cdd.com/", className = "com.cdd.back.client.CreateHtml") @WebMethod @ResponseWrapper(localName = "createHtmlResponse", targetNamespace = "http://server.front.cdd.com/", className = "com.cdd.back.client.CreateHtmlResponse") public java.lang.String createHtml( @WebParam(name = "arg0", targetNamespace = "") com.cdd.back.client.MapConvertor arg0 ); // @WebResult(name = "return", targetNamespace = "") // @Action(input = "http://server.front.cdd.com/FrontWebServer/__executeRequest", output = "http://server.front.cdd.com/FrontWebServer/__executeResponse") // @RequestWrapper(localName = "__execute", targetNamespace = "http://server.front.cdd.com/", className = "com.cdd.back.client.Execute") // @WebMethod(operationName = "__execute") // @ResponseWrapper(localName = "__executeResponse", targetNamespace = "http://server.front.cdd.com/", className = "com.cdd.back.client.ExecuteResponse") // public java.lang.Object execute( // @WebParam(name = "arg0", targetNamespace = "") // java.util.List<java.lang.Object> arg0, // @WebParam(name = "arg1", targetNamespace = "") // java.lang.Object arg1, // @WebParam(name = "arg2", targetNamespace = "") // java.lang.String arg2 // ); }
[ "cailie@zhao-chuan.com" ]
cailie@zhao-chuan.com
de4bd2531ac635235522daaccf5b6a73a8591b83
907f31e854a01f7ee4aff1a8beb70a5cf4c6ced9
/o2o-smart-study/src/test/java/com/huang/smart/study/test/concurrency/SyncObject.java
35a85997075c4cdf1782e2e73010a2a626ba0acb
[]
no_license
hcghaha/o2o-huang-smart
2047d318a0f7644e19425288e00e004a5acef804
eeb7e246e34d9eb24ed15fae0390f01d5836652d
refs/heads/master
2020-12-03T18:20:29.539716
2019-01-07T13:26:33
2019-01-07T13:26:33
66,339,911
0
0
null
null
null
null
UTF-8
Java
false
false
465
java
package com.huang.smart.study.test.concurrency; /** * Created with IntelliJ IDEA. * User: huangchaoguang * Date: 16-8-16 * Time: 下午2:43 * To change this template use File | Settings | File Templates. */ public class SyncObject { public static void main(String[] args) { final DualSynch ds = new DualSynch(); new Thread(){ public void run(){ ds.f(); } }.start(); ds.g(); } }
[ "huangchaouang@jd.com" ]
huangchaouang@jd.com
75d48c36598eebec706c1c2bdd1ddfe63ddcda13
7ef974f1a8e969eb5c27534c0e9afa88e1f5e80b
/app/src/com/example/cookbookapp/MyActionBar.java
80b1bf73dd5cbc94fd04fe7f6a111e6da8f2733f
[]
no_license
stevejosborne/how-to-feed-yourself
990adcf8bb63f5d50023f7c1e47fa033aa670f00
b28c4acf23169bc8c983c0f7905ff4cf317417ea
refs/heads/master
2020-09-17T04:19:08.286094
2016-08-21T02:24:10
2016-08-21T02:24:10
66,134,271
0
0
null
null
null
null
UTF-8
Java
false
false
5,646
java
package com.example.cookbookapp; import java.util.Map; import android.app.ActionBar; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import android.content.pm.PackageManager.NameNotFoundException; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; public class MyActionBar { public static void showActionBar (MainActivity activity1, DisplayRecipeListActivity activity2, DisplayShoppingListActivity activity3, DisplayMessageActivity activity4) { ActionBar actionBar; LayoutInflater inflator; if (activity1 != null) { actionBar = activity1.getActionBar(); inflator = (LayoutInflater) activity1.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } else if (activity2 != null) { actionBar = activity2.getActionBar(); inflator = (LayoutInflater) activity2.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } else if (activity3 != null) { actionBar = activity3.getActionBar(); inflator = (LayoutInflater) activity3.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } else if (activity4 != null) { actionBar = activity4.getActionBar(); inflator = (LayoutInflater) activity4.getSystemService(Context.LAYOUT_INFLATER_SERVICE); } else { return; } actionBar.setDisplayHomeAsUpEnabled(false); actionBar.setDisplayShowCustomEnabled(true); actionBar.setDisplayShowHomeEnabled(false); actionBar.setDisplayShowTitleEnabled(false); actionBar.setDisplayUseLogoEnabled(false); View view = inflator.inflate(R.layout.action_bar, null); ActionBar.LayoutParams layoutParams = new ActionBar.LayoutParams(ActionBar.LayoutParams.MATCH_PARENT, ActionBar.LayoutParams.WRAP_CONTENT); view.setLayoutParams(layoutParams); actionBar.setCustomView(view); } public static void respondToActionBar (final MainActivity activity1, final DisplayRecipeListActivity activity2, final DisplayShoppingListActivity activity3, final DisplayMessageActivity activity4) { android.support.v7.app.ActionBar actionBar; if (activity1 != null) {actionBar = activity1.getSupportActionBar();} else if (activity2 != null) {actionBar = activity2.getSupportActionBar();} else if (activity3 != null) {actionBar = activity3.getSupportActionBar();} else if (activity4 != null) {actionBar = activity4.getSupportActionBar();} else { return; } actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM); actionBar.setCustomView(R.layout.action_bar); // Create an action bar click listener. View view = actionBar.getCustomView(); final Button button1 = (Button) view.findViewById(R.id.home_screen); final Button button2 = (Button) view.findViewById(R.id.recipe_list); final Button button3 = (Button) view.findViewById(R.id.shopping_list); if (activity1 != null) {button1.setTextColor(activity1.getResources().getColor(R.color.white));} else if (activity2 != null) {button2.setTextColor(activity2.getResources().getColor(R.color.white));} else if (activity3 != null) {button3.setTextColor(activity3.getResources().getColor(R.color.white));} else {button1.setTextColor(activity4.getResources().getColor(R.color.white));} button1.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { if (activity1 != null) {activity1.startActivity(new Intent(activity1, MainActivity.class));} else if (activity2 != null) {activity2.startActivity(new Intent(activity2, MainActivity.class));} else if (activity3 != null) {activity3.startActivity(new Intent(activity3, MainActivity.class));} else {activity4.startActivity(new Intent(activity4, MainActivity.class));} } }); button2.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { if (activity1 != null) {activity1.startActivity(new Intent(activity1, DisplayRecipeListActivity.class));} else if (activity2 != null) {activity2.startActivity(new Intent(activity2, DisplayRecipeListActivity.class));} else if (activity3 != null) {activity3.startActivity(new Intent(activity3, DisplayRecipeListActivity.class));} else {activity4.startActivity(new Intent(activity4, DisplayRecipeListActivity.class));} } }); button3.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { if (activity1 != null) {activity1.startActivity(new Intent(activity1, DisplayShoppingListActivity.class));} else if (activity2 != null) {activity2.startActivity(new Intent(activity2, DisplayShoppingListActivity.class));} else if (activity3 != null) {activity3.startActivity(new Intent(activity3, DisplayShoppingListActivity.class));} else {activity4.startActivity(new Intent(activity4, DisplayShoppingListActivity.class));} } }); } }
[ "steve.j.osborne@gmail.com" ]
steve.j.osborne@gmail.com
a6405b7b987e2abbc584f21db03ad92ea978578c
ec75a63c67c2baf8c01e2c0da2ee0df303c9dfe6
/src/main/java/works/weave/socks/orders/entities/Shipment.java
9acfb7791779a9bf2312a22aba6bdc4fabcb8cdd
[ "Apache-2.0" ]
permissive
acl-sockshop/orders
e63cfd28c1ca91f49fba8f998d440a3c7398b4b8
0f8f2cc1e42b0c18760c6eeb65aa1a8ad0dfc864
refs/heads/master
2021-06-21T11:13:41.461862
2021-03-19T15:23:13
2021-03-19T15:23:13
189,188,732
0
346
Apache-2.0
2019-05-29T08:59:25
2019-05-29T08:59:24
null
UTF-8
Java
false
false
1,221
java
package works.weave.socks.orders.entities; import java.util.UUID; public class Shipment { private String id; private String name; public Shipment() { this(""); } public Shipment(String name) { this(UUID.randomUUID().toString(), name); } public Shipment(String id, String name) { this.id = id; this.name = name; } @Override public String toString() { return "Shipment{" + "id='" + id + '\'' + ", name='" + name + '\'' + '}'; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Shipment shipment = (Shipment) o; return getId() != null ? getId().equals(shipment.getId()) : shipment.getId() == null; } @Override public int hashCode() { return getId() != null ? getId().hashCode() : 0; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } }
[ "phil@winderresearch.com" ]
phil@winderresearch.com
f15d0ff7768fc80133258bf2d34f614dfd563c84
036b39e0f83193bcbedd8188e8922a497e9327bd
/app/src/main/java/com/qiaoxg/servicedemo/activity/BindServiceActivity.java
9b12afa3b7dddbc51c97d60307fd7c7980cad330
[]
no_license
QiaoxgChina/Android_Service
180ca21dea7b6580df35c4d7b2ef1b351293bea3
5561dce407afb7577d6cea6be234eb637015022d
refs/heads/master
2021-01-19T17:09:51.208857
2017-08-23T07:15:39
2017-08-23T07:15:39
101,053,573
2
0
null
null
null
null
UTF-8
Java
false
false
5,270
java
package com.qiaoxg.servicedemo.activity; import android.content.ComponentName; import android.content.Intent; import android.content.ServiceConnection; import android.os.Bundle; import android.os.IBinder; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.View; import android.widget.Button; import com.qiaoxg.servicedemo.R; import com.qiaoxg.servicedemo.adapter.MessageAdapter; import com.qiaoxg.servicedemo.bean.MessageBean; import com.qiaoxg.servicedemo.service.BindTypeService; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; public class BindServiceActivity extends AppCompatActivity implements BindTypeService.MyBindServiceListener { private static final String TAG = "BindServiceActivity"; @BindView(R.id.BindService_btn) Button BindServiceBtn; @BindView(R.id.UnbindService_btn) Button UnbindServiceBtn; @BindView(R.id.startSend_btn) Button startSendBtn; @BindView(R.id.stopSend_btn) Button stopSendBtn; @BindView(R.id.message_rv) RecyclerView messageRv; @BindView(R.id.one_btn) Button oneBtn; @BindView(R.id.five_btn) Button fiveBtn; private MessageAdapter mAdapter; private BindTypeService mService; private boolean isAutoScroll = true; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_bind_service); ButterKnife.bind(this); initView(); initAdapter(); } private void initAdapter() { mAdapter = new MessageAdapter(); messageRv.setAdapter(mAdapter); } private void initView() { messageRv.setLayoutManager(new LinearLayoutManager(this)); messageRv.addOnScrollListener(new RecyclerView.OnScrollListener() { @Override public void onScrollStateChanged(RecyclerView recyclerView, int newState) { super.onScrollStateChanged(recyclerView, newState); } @Override public void onScrolled(RecyclerView recyclerView, int dx, int dy) { isAutoScroll = isSlideToBottom(recyclerView); super.onScrolled(recyclerView, dx, dy); } }); } /** * 判断recycleView是否滑动到底部 * * @param recyclerView * @return */ protected boolean isSlideToBottom(RecyclerView recyclerView) { if (recyclerView == null) return false; if (recyclerView.computeVerticalScrollExtent() + recyclerView.computeVerticalScrollOffset() >= recyclerView.computeVerticalScrollRange()) return true; return false; } @OnClick({R.id.BindService_btn, R.id.UnbindService_btn, R.id.startSend_btn, R.id.stopSend_btn, R.id.one_btn, R.id.five_btn}) public void onViewClicked(View view) { switch (view.getId()) { case R.id.BindService_btn: bindService(); break; case R.id.UnbindService_btn: unBindService(); break; case R.id.startSend_btn: sendMessage(); break; case R.id.stopSend_btn: if (mService != null) { mService.setStopSendMessage(); } break; case R.id.one_btn: if (mService != null) { mService.setSendMessageDelayedTime(1000); } break; case R.id.five_btn: if (mService != null) { mService.setSendMessageDelayedTime(5000); } break; } } private void sendMessage() { if (mService != null) { mService.startSendMessage(); } } private void bindService() { Intent i = new Intent(this, BindTypeService.class); bindService(i, MyServiceConn, BIND_AUTO_CREATE); } private void unBindService() { unbindService(MyServiceConn); } public ServiceConnection MyServiceConn = new ServiceConnection() { @Override public void onServiceConnected(ComponentName name, IBinder service) { BindTypeService.MyBinder binder = (BindTypeService.MyBinder) service; mService = binder.getService(); mService.addListener(BindServiceActivity.this); } @Override public void onServiceDisconnected(ComponentName name) { mService = null; } }; @Override public void receiveMessage(MessageBean bean) { if (mAdapter != null) { mAdapter.addMessage(bean); int position = mAdapter.getItemCount(); if (isAutoScroll) { //让recycleView自动滑动到指定位置 messageRv.smoothScrollToPosition(position); } } } @Override protected void onDestroy() { super.onDestroy(); //当activity销毁之前一定要解绑,否则logcat会报错 unbindService(MyServiceConn); mService = null; } }
[ "qiaoxiaogang@zcgames.cn" ]
qiaoxiaogang@zcgames.cn
614cefd38dd56ff89ff4a72dd8a1ed4af543f876
ba2c4cdac77a358be5ae75e1d9ac203ce727a258
/app/src/main/java/id/sch/smktelkom_mlg/learn/testsigning/MainActivity.java
61bee5582409a942cbd9783a5e44200b99c65ab8
[]
no_license
FitriaMelaAgnes/testSigning
25d855c2f211ef8f96738082c4e504fa24c3aa0a
36efb824379dfc892bb3258398632d297e1b6c58
refs/heads/master
2021-01-19T08:05:20.425767
2017-04-08T02:37:27
2017-04-08T02:37:27
87,599,477
0
0
null
null
null
null
UTF-8
Java
false
false
351
java
package id.sch.smktelkom_mlg.learn.testsigning; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } }
[ "fitria.mela9a17@gmail.com" ]
fitria.mela9a17@gmail.com