blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 7 332 | content_id stringlengths 40 40 | detected_licenses listlengths 0 50 | license_type stringclasses 2 values | repo_name stringlengths 7 115 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 557 values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 5.85k 684M ⌀ | star_events_count int64 0 77.7k | fork_events_count int64 0 48k | gha_license_id stringclasses 17 values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 82 values | src_encoding stringclasses 28 values | language stringclasses 1 value | is_vendor bool 1 class | is_generated bool 2 classes | length_bytes int64 7 5.41M | extension stringclasses 11 values | content stringlengths 7 5.41M | authors listlengths 1 1 | author stringlengths 0 161 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
7a4c0fe856494339941cc71731c3bae3ed660b2e | 751974f467edd15a620637fe50a3bc83b94d5559 | /Ristorante - Server/src/Tablet.java | 3b4c14ec89e465b11f487bb7b42adc5a346c8a7d | [] | no_license | M0nk3yH4cks/Java | 4f1e0cc9be48ee14738eb154c922ee2478530420 | 1366b478242d5d89564bd918ac21cd171e576503 | refs/heads/master | 2021-05-12T10:47:44.193332 | 2018-02-07T11:00:07 | 2018-02-07T11:00:07 | 117,361,018 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 5,817 | java | import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.Socket;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
public class Tablet extends Thread{
@Override
public void run() {
while (true) {
// Dichiarazione variabili e connessione.
Socket skt = null;
try {
skt = new Socket("localhost", 1234);
} catch (IOException e) {
e.printStackTrace();
}
System.out.println("\t\t\t----------Client Started----------");
try {
BufferedReader inFromUser = new BufferedReader(new InputStreamReader(System.in));
DataOutputStream outToServer = new DataOutputStream(skt.getOutputStream());
BufferedReader inFromServer = new BufferedReader(new InputStreamReader(skt.getInputStream()));
String outputString;
String inputString;
Scanner scanf = new Scanner(System.in); // Instanziamo un'ogetto per l'input da linea di comando
// Richiedo la lista dei prodotti
System.out.println("----> Richiedo la lista dei prodotti");
outputString = "Tablet,productsList,1,null";
outToServer.writeBytes(outputString + '\n');
System.out.println("----> Stringa inviata");
inputString = inFromServer.readLine();
System.out.println("FROM SERVER: " + inputString);
inputString = inputString.substring(1, inputString.length() - 1).trim();
String[] stringList = inputString.split(", ");
List<String> tempProductsList = new ArrayList<String>();
Collections.addAll(tempProductsList, stringList);
String _order = "-1";
// Verifichiamo che vi siano effettivamente prodotti in magazzino
if (tempProductsList.size() == 0) {
outputString = "getAppro";
outToServer.writeBytes(outputString + '\n');
inputString = inFromServer.readLine();
System.out.println("FROM SERVER: " + inputString);
inputString = inputString.substring(1, inputString.length() - 1).trim();
stringList = inputString.split(", ");
Collections.addAll(tempProductsList, stringList);
}
// Stampiamo la lista delle pietanze disponibili
System.out.println("Inserire:");
for (int i = 0; i < tempProductsList.size(); i++) {
System.out.println(i + " - " + tempProductsList.get(i));
}
// Prendiamo l'input con un controllo sullo stesso
do {
System.out.print("Inserire il numero corrispondente alla pietanza da lei desiderata\n>>>");
try {
_order = scanf.nextLine();
Integer.parseInt(_order);
} catch (NumberFormatException e) {
System.err.println("Inserire carattere valido");
_order = "-1";
}
}while (Integer.parseInt(_order) > tempProductsList.size() || Integer.parseInt(_order) < 0 || Integer.parseInt(_order) == -1);
// Individuiamo l'indice iniziale delle bevande
int drinkIndex = 0;
for (int i = 0; i < tempProductsList.size(); i++) {
if (tempProductsList.get(i).equals("Acqua") || tempProductsList.get(i).equals("Birra") || tempProductsList.get(i).equals("CocaCola") || tempProductsList.get(i).equals("Aranciata") || tempProductsList.get(i).equals("Succo")) {
drinkIndex = i;
break;
}
}
//outToServer.flush();
// Dividiamo gli ordini in base all'ordine che dobbiamo fare
if(drinkIndex != 0 && Integer.parseInt(_order) >= drinkIndex){
skt.close();
skt = new Socket("localhost", 4040);
outToServer = new DataOutputStream(skt.getOutputStream());
inFromServer = new BufferedReader(new InputStreamReader(skt.getInputStream()));
//outputString = _order + "," + tempProductsList.toString().substring(1, inputString.length() - 1);
outToServer.writeBytes( _order + "," + tempProductsList.get(Integer.parseInt(_order)) + "\n");
System.out.println(inFromServer.readLine());
skt.close();
}else {
skt.close();
skt = new Socket("localhost", 4321);
outToServer = new DataOutputStream(skt.getOutputStream());
inFromServer = new BufferedReader(new InputStreamReader(skt.getInputStream()));
//outputString = _order + "," + tempProductsList.toString().substring(1, inputString.length() - 1);
outToServer.writeBytes( _order + "," + tempProductsList.get(Integer.parseInt(_order)) + "\n");
System.out.println(inFromServer.readLine());
}
outToServer.flush();
} catch (Exception e) {
try {
skt.close();
} catch (IOException e1) {
e1.printStackTrace();
}
System.out.print("Whoops! It didn't work!\n");
e.printStackTrace();
}
}
}
}
| [
"una-ciola@hotmail.it"
] | una-ciola@hotmail.it |
e29abdc82afb68680eb31a9dd1563baead8bd3bc | d63e044613c3de6d734c21659dc3170243a2d90e | /core/src/com/libgdx/battlearena/GUI/ControllerActor.java | cced049b96c0c95a2977dfe3334431663b0f363b | [] | no_license | ionutdejeu/libgdx-mobile-battlearena | 5112c16fa53172b1e65ce28d1842b4655b040665 | 07fe83989ac52301b4038a467d006e93150d900a | refs/heads/main | 2023-08-10T16:31:34.293861 | 2021-09-20T15:08:13 | 2021-09-20T15:08:13 | 399,917,954 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,522 | java | package com.libgdx.battlearena.GUI;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.Batch;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.InputListener;
import com.badlogic.gdx.scenes.scene2d.Touchable;
public class ControllerActor extends Actor {
private ShapeRenderer shapeRenderer;
static private boolean projectionMatrixSet;
public ControllerActor(final String actorName) {
shapeRenderer = new ShapeRenderer();
projectionMatrixSet = false;
setTouchable(Touchable.enabled);
addListener(new InputListener() {
@Override
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
Gdx.app.log("Touch down asset with name ", actorName);
return true;
}
});
}
@Override
public void act(float delta) {
super.act(delta);
}
@Override
public void draw(Batch batch, float parentAlpha) {
if(!projectionMatrixSet){
shapeRenderer.setProjectionMatrix(batch.getProjectionMatrix());
}
shapeRenderer.begin(ShapeRenderer.ShapeType.Filled);
shapeRenderer.setColor(Color.BLUE);
shapeRenderer.rect(0, 0, 50, 50);
shapeRenderer.end();
}
} | [
"ionut.dejeu@gamail.com"
] | ionut.dejeu@gamail.com |
79ee3bca4636f400fa8df68269ed411705e0c101 | 2dc92f282e20ace3594825b7dcf53d5fc90fec70 | /E-Commerce/src/java/model/ShoppingItem.java | 40c270801784a5e8b7c9ab2416c8ab256e38c07c | [] | no_license | onsefaitchier/ECommerce | 889e2646aaf735496141db8aab363bc5709110b9 | 55dd51d99dad2d929343f576e458b0b3f853f581 | refs/heads/master | 2021-01-10T06:03:49.415958 | 2016-04-07T23:03:53 | 2016-04-07T23:03:53 | 55,356,862 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 430 | 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 model;
//package com.brainysoftware.burnaby;
/**
*
* @author julien
*/
public class ShoppingItem
{
public int productId;
public String name;
public String description;
public double price;
public int quantity;
}
| [
"julien.gaspar00@gmail.com"
] | julien.gaspar00@gmail.com |
ff9f0158f4197df938c31f42802927b13b945958 | eb2fdf6d62a963c8f63d673b12569bfc443575e4 | /pratiseFile/JavaTemplate.java | e1b89816eb15c93815a761cbaeed11cd6597d570 | [] | no_license | yanzhang-sheridan/java_files_of_my_study | e8a8c06c94541153bbb01dc8248c197d0f2deb5f | a55d2a83b24d35a9b1a1162f4a8e60192af17bc0 | refs/heads/master | 2021-10-24T01:32:02.476040 | 2019-03-21T11:51:36 | 2019-03-21T11:51:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 154 | java | /**
*this is a template of java code
* */
public class Template{
public Template(){
}
public static void main(String[] args){
}
}
| [
"kejin@s.upc.edu.cn"
] | kejin@s.upc.edu.cn |
ff6e405aff5c9cccffecd6cd016ced535af00099 | 61080de7afc59db71e9a3d11fa20fe2c0a74bf40 | /src/main/java/com/cnblogs/hoojo/sensitivewords/filter/AbstractSensitiveWordsFilterSupport.java | fa63296b6e8dcfe19bee00e860383b0b65b63b34 | [] | no_license | hooj0/sensitive-words-filter | 082500635f560d431e1e59f726201e0bf93680ca | 2f6d1ac525d3e0a5be371db65738dec9000ab73f | refs/heads/master | 2023-03-09T07:52:20.954766 | 2022-01-22T07:06:39 | 2022-01-22T07:06:39 | 126,786,818 | 170 | 48 | null | 2023-02-22T07:12:59 | 2018-03-26T06:57:43 | Java | UTF-8 | Java | false | false | 3,027 | java | package com.cnblogs.hoojo.sensitivewords.filter;
import java.util.Iterator;
import java.util.Set;
import com.google.common.base.Strings;
import com.google.common.collect.Sets;
/**
* 各算法支持类抽象接口
*
* @author hoojo
* @createDate 2018年2月7日 下午6:35:02
* @file AbstractSensitiveWordsFilterSupport.java
* @package com.cnblogs.hoojo.sensitivewords.filter
* @project fengkong-service-provider
* @blog http://hoojo.cnblogs.com
* @email hoojo_@126.com
* @version 1.0
*/
public abstract class AbstractSensitiveWordsFilterSupport extends AbstractSensitiveWordsFilter {
private static final String HTML_HIGHLIGHT = "<font color='red'>%s</font>";
/**
* 匹配到敏感词的回调接口
* @author hoojo
* @createDate 2018年3月21日 上午11:46:15
* @param 敏感词对象类型
*/
protected interface Callback {
/**
* 匹配掉敏感词回调
* @author hoojo
* @createDate 2018年3月21日 上午11:48:11
* @param word 敏感词
* @return true 立即停止后续任务并返回,false 继续执行
*/
boolean call(String word);
}
/**
* 判断一段文字包含敏感词语,支持敏感词结果回调
* @author hoojo
* @createDate 2018年2月9日 下午2:54:59
* @param partMatch 是否支持匹配词语的一部分
* @param content 被匹配内容
* @param callback 回调接口
* @return 是否匹配到的词语
*/
protected abstract boolean processor(boolean partMatch, String content, Callback callback) throws RuntimeException;
@Override
public boolean contains(boolean partMatch, String content) throws RuntimeException {
return processor(partMatch, content, new Callback() {
@Override
public boolean call(String word) {
return true; // 有敏感词立即返回
}
});
}
@Override
public Set<String> getWords(boolean partMatch, String content) throws RuntimeException {
final Set<String> words = Sets.newHashSet();
processor(partMatch, content, new Callback() {
@Override
public boolean call(String word) {
words.add(word);
return false; // 继续匹配后面的敏感词
}
});
return words;
}
@Override
public String highlight(boolean partMatch, String content) throws RuntimeException {
Set<String> words = this.getWords(partMatch, content);
Iterator<String> iter = words.iterator();
while (iter.hasNext()) {
String word = iter.next();
content = content.replaceAll(word, String.format(HTML_HIGHLIGHT, word));
}
return content;
}
@Override
public String filter(boolean partMatch, String content, char replaceChar) throws RuntimeException {
Set<String> words = this.getWords(partMatch, content);
Iterator<String> iter = words.iterator();
while (iter.hasNext()) {
String word = iter.next();
content = content.replaceAll(word, Strings.repeat(String.valueOf(replaceChar), word.length()));
}
return content;
}
}
| [
"hoojo@qq.com"
] | hoojo@qq.com |
d2e1dda730c85ab714842d8e6341258539d488e5 | e7a30923ffe9adef21affa0e48d3682151280c4e | /src/main/java/com/portfolio/sso/controllers/BlogController.java | f2f5102b05c1323f8b3eb14b586326788363e437 | [] | no_license | ninja020250/Authorization-Server-Springboot | 627b1be696009f380e2d6d448cf23478403f8857 | fd18bb7f01ee2f9f1344f2e565c78cc23439b63c | refs/heads/master | 2023-01-24T17:22:32.499194 | 2020-11-10T09:56:29 | 2020-11-10T09:56:29 | 311,067,919 | 0 | 0 | null | 2020-11-10T09:56:31 | 2020-11-08T13:23:16 | Java | UTF-8 | Java | false | false | 1,501 | java | package com.portfolio.sso.controllers;
import com.portfolio.sso.payload.request.BlogRequest;
import com.portfolio.sso.payload.request.PageableRequest;
import com.portfolio.sso.payload.response.BlogResponse;
import com.portfolio.sso.services.BlogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
@RestController
@RequestMapping("/api/blog")
@CrossOrigin(origins = "*", maxAge = 3600)
public class BlogController {
@Autowired
private BlogService blogService;
@PostMapping("")
@PreAuthorize("hasRole('MODERATOR') or hasRole('ADMIN')")
public BlogResponse createBlog(@Valid @RequestBody BlogRequest req) {
return blogService.createBlog(req);
}
@GetMapping("")
public Page<BlogResponse> getAllBlog(
PageableRequest params
) {
Sort sortable = Sort.by(params.getSortField()).ascending();
if (params.getSort().equals("DESC")) {
sortable = Sort.by(params.getSortField()).descending();
}
Pageable pageable = PageRequest.of(params.getPage(), params.getSize(), sortable);
return blogService.getAllBlog(pageable, params.getSearch());
}
}
| [
"nhatcuonghuynh@gmail.com"
] | nhatcuonghuynh@gmail.com |
5da030743f4bebe29b1ae5bcb11d390f499bde32 | 234a38d72c1de75e80cf868a89ed9f72a29ada20 | /src/main/java/com/rakuten/productmanagement/config/Router.java | d1c203433e7209452aeef2d8d6972b47a5047130 | [] | no_license | bhraojava/productmanagement | 82925fa63d54f39e41d7288ad8a8853acd7c7a3b | 93253d1a1b03f8f0c8c81ab9b90154fcc5d5676e | refs/heads/master | 2023-03-10T01:16:44.785123 | 2021-02-19T16:44:23 | 2021-02-19T16:44:23 | 329,041,587 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 998 | java | package com.rakuten.productmanagement.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.MediaType;
import org.springframework.web.reactive.function.server.RequestPredicate;
import org.springframework.web.reactive.function.server.RequestPredicates;
import org.springframework.web.reactive.function.server.RouterFunction;
import org.springframework.web.reactive.function.server.RouterFunctions;
import org.springframework.web.reactive.function.server.ServerRequest;
import org.springframework.web.reactive.function.server.ServerResponse;
import com.rakuten.productmanagement.utils.ValidateHandler;
@Configuration
public class Router {
private final MediaType json = MediaType.APPLICATION_JSON;
@Bean
public RouterFunction<ServerResponse> validateEndpoint(ValidateHandler handler) {
return RouterFunctions.route(RequestPredicates.POST("/product/delete"), handler::validate);
}
}
| [
"heramba_2006@yahoo.com"
] | heramba_2006@yahoo.com |
03dde72aa73aa8c754bb2866652b4f9070dcbd51 | 133ce1df4373b9afda9a6951ed882bd8c86d3e3d | /src/main/java/Main.java | 696143b648584ffb32d859f4ae92457c4e4a3b85 | [] | no_license | jah701/thread-test | 9a0f96c27f434f9767bf7211fd4b65dc945052ef | cffcde5a640236463078182d7c8dca2ff3bd166c | refs/heads/main | 2023-01-10T16:10:57.062189 | 2020-11-17T11:37:00 | 2020-11-17T11:37:00 | 310,263,132 | 0 | 0 | null | 2020-11-17T11:37:01 | 2020-11-05T10:24:05 | null | UTF-8 | Java | false | false | 365 | java | public class Main {
public static void main(String[] args) throws InterruptedException {
Counter counter = new Counter();
Thread extendsThread = new ExtendsThread(counter);
Runnable implRunnable = new ImplRunnable(counter);
Thread thread = new Thread(implRunnable);
extendsThread.start();
thread.start();
}
}
| [
"moskovienkor@gmail.com"
] | moskovienkor@gmail.com |
62ec90ae71c6ac905ef9d2ead88fa5c2547c29db | e2dc403a5ec9da94bafecb7a5dcadbc93e3e3aeb | /src/main/java/cn/kgc/mybatis/bean/TwoTest.java | 0295a53e035f6befc32495b37d0109f80ad49c6d | [] | no_license | hushuangjia/jgs | 647f8539cbe79cc7ba4b858b7658406dcbfbc456 | 0067be9f563175edaf58ed1f0be05a41b19ee0c8 | refs/heads/master | 2022-07-09T12:19:22.315362 | 2019-09-12T07:29:59 | 2019-09-12T07:29:59 | 207,985,703 | 0 | 0 | null | 2022-06-21T01:51:42 | 2019-09-12T07:00:19 | Java | UTF-8 | Java | false | false | 55 | java | package cn.kgc.mybatis.bean;
public class TwoTest {
}
| [
"1805462823@qq.com"
] | 1805462823@qq.com |
539d42b739e070e94beea73f4486a07759562e94 | f001bf66741ba59e3c7504e258f12d10e92eb179 | /src/main/java/com/datadog/api/client/v1/api/ServiceChecksApi.java | d2ec642169a4620ecc5e05513aeaba0e38152d78 | [
"Apache-2.0",
"BSD-3-Clause",
"EPL-1.0",
"EPL-2.0",
"MPL-2.0"
] | permissive | DataDog/datadog-api-client-java | 367f6d7ebe1d123d15b7ba73c5568c89996c0485 | 5db90676fd1b5b138eb809171580ac2cda6b5572 | refs/heads/master | 2023-08-18T07:46:43.521340 | 2023-08-17T20:12:41 | 2023-08-17T20:12:41 | 193,793,890 | 43 | 31 | Apache-2.0 | 2023-09-14T20:25:20 | 2019-06-25T22:54:41 | Java | UTF-8 | Java | false | false | 6,088 | java | package com.datadog.api.client.v1.api;
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.ApiResponse;
import com.datadog.api.client.Pair;
import com.datadog.api.client.v1.model.IntakePayloadAccepted;
import com.datadog.api.client.v1.model.ServiceCheck;
import jakarta.ws.rs.client.Invocation;
import jakarta.ws.rs.core.GenericType;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
@jakarta.annotation.Generated(
value = "https://github.com/DataDog/datadog-api-client-java/blob/master/.generator")
public class ServiceChecksApi {
private ApiClient apiClient;
public ServiceChecksApi() {
this(ApiClient.getDefaultApiClient());
}
public ServiceChecksApi(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Get the API client.
*
* @return API client
*/
public ApiClient getApiClient() {
return apiClient;
}
/**
* Set the API client.
*
* @param apiClient an instance of API client
*/
public void setApiClient(ApiClient apiClient) {
this.apiClient = apiClient;
}
/**
* Submit a Service Check.
*
* <p>See {@link #submitServiceCheckWithHttpInfo}.
*
* @param body Service Check request body. (required)
* @return IntakePayloadAccepted
* @throws ApiException if fails to make API call
*/
public IntakePayloadAccepted submitServiceCheck(List<ServiceCheck> body) throws ApiException {
return submitServiceCheckWithHttpInfo(body).getData();
}
/**
* Submit a Service Check.
*
* <p>See {@link #submitServiceCheckWithHttpInfoAsync}.
*
* @param body Service Check request body. (required)
* @return CompletableFuture<IntakePayloadAccepted>
*/
public CompletableFuture<IntakePayloadAccepted> submitServiceCheckAsync(List<ServiceCheck> body) {
return submitServiceCheckWithHttpInfoAsync(body)
.thenApply(
response -> {
return response.getData();
});
}
/**
* Submit a list of Service Checks.
*
* <p><strong>Notes</strong>: - A valid API key is required. - Service checks can be submitted up
* to 10 minutes in the past.
*
* @param body Service Check request body. (required)
* @return ApiResponse<IntakePayloadAccepted>
* @throws ApiException if fails to make API call
* @http.response.details
* <table border="1">
* <caption>Response details</caption>
* <tr><td> Status Code </td><td> Description </td><td> Response Headers </td></tr>
* <tr><td> 202 </td><td> Payload accepted </td><td> - </td></tr>
* <tr><td> 400 </td><td> Bad Request </td><td> - </td></tr>
* <tr><td> 403 </td><td> Authentication Error </td><td> - </td></tr>
* <tr><td> 408 </td><td> Request timeout </td><td> - </td></tr>
* <tr><td> 413 </td><td> Payload too large </td><td> - </td></tr>
* <tr><td> 429 </td><td> Too many requests </td><td> - </td></tr>
* </table>
*/
public ApiResponse<IntakePayloadAccepted> submitServiceCheckWithHttpInfo(List<ServiceCheck> body)
throws ApiException {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
throw new ApiException(
400, "Missing the required parameter 'body' when calling submitServiceCheck");
}
// create path and map variables
String localVarPath = "/api/v1/check_run";
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Invocation.Builder builder =
apiClient.createBuilder(
"v1.ServiceChecksApi.submitServiceCheck",
localVarPath,
new ArrayList<Pair>(),
localVarHeaderParams,
new HashMap<String, String>(),
new String[] {"text/json", "application/json"},
new String[] {"apiKeyAuth"});
return apiClient.invokeAPI(
"POST",
builder,
localVarHeaderParams,
new String[] {"application/json"},
localVarPostBody,
new HashMap<String, Object>(),
false,
new GenericType<IntakePayloadAccepted>() {});
}
/**
* Submit a Service Check.
*
* <p>See {@link #submitServiceCheckWithHttpInfo}.
*
* @param body Service Check request body. (required)
* @return CompletableFuture<ApiResponse<IntakePayloadAccepted>>
*/
public CompletableFuture<ApiResponse<IntakePayloadAccepted>> submitServiceCheckWithHttpInfoAsync(
List<ServiceCheck> body) {
Object localVarPostBody = body;
// verify the required parameter 'body' is set
if (body == null) {
CompletableFuture<ApiResponse<IntakePayloadAccepted>> result = new CompletableFuture<>();
result.completeExceptionally(
new ApiException(
400, "Missing the required parameter 'body' when calling submitServiceCheck"));
return result;
}
// create path and map variables
String localVarPath = "/api/v1/check_run";
Map<String, String> localVarHeaderParams = new HashMap<String, String>();
Invocation.Builder builder;
try {
builder =
apiClient.createBuilder(
"v1.ServiceChecksApi.submitServiceCheck",
localVarPath,
new ArrayList<Pair>(),
localVarHeaderParams,
new HashMap<String, String>(),
new String[] {"text/json", "application/json"},
new String[] {"apiKeyAuth"});
} catch (ApiException ex) {
CompletableFuture<ApiResponse<IntakePayloadAccepted>> result = new CompletableFuture<>();
result.completeExceptionally(ex);
return result;
}
return apiClient.invokeAPIAsync(
"POST",
builder,
localVarHeaderParams,
new String[] {"application/json"},
localVarPostBody,
new HashMap<String, Object>(),
false,
new GenericType<IntakePayloadAccepted>() {});
}
}
| [
"noreply@github.com"
] | noreply@github.com |
4ea876bf0a939210d8c3aacd8aaa2bbfc4d09eaf | 0bb6d10fe993d7b499e0dd30538ec2d686daad6a | /SemesterSystem/test/Test.java | 1fb94aeca9a89c216e6283b0ec2068130e60b37e | [] | no_license | MichaelFriis-Github/temp | d6238cd084d36cecd96fa7e7e16418506ce84445 | a5b3e7a7921f32b87893340a55d6279ea2727c7a | refs/heads/master | 2021-01-01T20:35:32.873073 | 2014-09-10T18:42:34 | 2014-09-10T18:42:34 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 838 | java |
import Client.ChatClient;
import Server.MainServer;
import java.io.IOException;
import org.junit.AfterClass;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.BeforeClass;
public class Test {
public Test() {
}
@BeforeClass
public static void setUpClass() {
new Thread(new Runnable() {
@Override
public void run() {
MainServer.main(null);
}
}).start();
}
@AfterClass
public static void tearDownClass() {
MainServer.stopServer();
}
@Before
public void setUp() {
}
public void send() throws IOException {
ChatClient client = new ChatClient();
client.connect("localhost", 9090);
client.send("Hello");
assertEquals("HELLO", client.receive());
}
}
| [
"Frederik.o@mailme.dk"
] | Frederik.o@mailme.dk |
3f1b3fd881f674e254fb68c7801e930d5801f210 | b5023e21d9519b83ff329fb3f562a12db685e019 | /src/controller/followup/load/LoadLymphomaFollowupServlet.java | 979ab467d89c0698469dcf9699b39117703f19f8 | [] | no_license | JasielEspinosa/WebBasedBiobank-UST-BCI | f7e3c03481349e0078b5297494feca939376f8ba | b923b8459cdd678d819bfefb48817c2314a74a5c | refs/heads/master | 2020-03-25T17:21:30.185703 | 2018-07-19T03:38:04 | 2018-07-19T03:38:04 | 143,974,402 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 7,747 | java | package controller.followup.load;
import java.io.IOException;
import java.sql.Connection;
import java.sql.ResultSet;
import java.util.LinkedHashMap;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.google.gson.Gson;
import model.AuditBean;
import utility.database.SQLOperations;
import utility.database.SQLOperationsBaseline;
import utility.database.SQLOperationsFollowUp;
@WebServlet("/LoadLymphomaFollowUpServlet")
public class LoadLymphomaFollowupServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private Connection connection;
public void init() throws ServletException {
connection = SQLOperationsBaseline.getConnection();
if (connection != null) {
getServletContext().setAttribute("dbConnection", connection);
System.out.println("connection is READY.");
} else {
System.err.println("connection is NULL.");
}
}
public LoadLymphomaFollowupServlet() {
super();
}
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request, response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
response.setCharacterEncoding("UTF-8");
response.setContentType("application/json");
Map<String, String> followupData = new LinkedHashMap<>();
int followupID = Integer.parseInt(request.getParameter("followupID"));
followupData.put("followupID", Integer.toString(followupID));
try {
if (connection != null) {
//get followup table
ResultSet followup = SQLOperationsFollowUp.getFollowup(followupID, connection);
followup.first();
followupData.put("dateOfEntry", followup.getString("DateOfEntryDec"));
followupData.put("dateOfVisit", followup.getString("DateOfVisitDec"));
followupData.put("notes", followup.getString("notes"));
//int patientId = followup.getInt("PatientID");
//medical events
int medicalEventsid = followup.getInt("MedicalEventsID");
ResultSet medicalEvents = SQLOperationsFollowUp.getMedicalEvents(medicalEventsid, connection);
medicalEvents.first();
followupData.put("specifyHematologicMalignancy", medicalEvents.getString("hematologicMalignancy"));
followupData.put("specifyOtherDiseaseMedication", medicalEvents.getString("otherDiseaseMedication"));
followupData.put("specifyProcedure", medicalEvents.getString("procedureIntervention"));
followupData.put("specifyChemotherapy", medicalEvents.getString("Chemotherapy"));
//clinical data
int clinicalDataId = followup.getInt("ClinicalDataID");
ResultSet clinicalData = SQLOperationsFollowUp.getClinicalData(clinicalDataId, connection);
clinicalData.first();
int physicalExamId = clinicalData.getInt("PhysicalExamID");
followupData.put("currentSymptoms", clinicalData.getString("currentSymptoms"));
//physical exam
ResultSet physicalExam = SQLOperationsFollowUp.getPhysicalExam(physicalExamId, connection);
physicalExam.first();
followupData.put("weight", physicalExam.getString("weight"));
followupData.put("ecog", physicalExam.getString("ecog"));
followupData.put("pertinentFindings", physicalExam.getString("pertinentFindings"));
//laboratory profile
int laboratoryId = followup.getInt("LaboratoryID");
ResultSet laboratoryProfile = SQLOperationsFollowUp.getLaboratoryProfile(laboratoryId, connection);
laboratoryProfile.first();
followupData.put("dateOfBloodCollection", laboratoryProfile.getString("dateOfBloodCollection"));
int hematologyId = laboratoryProfile.getInt("HematologyID");
int bloodChemistryId = laboratoryProfile.getInt("BloodChemistryID");
int imagingStudiesId = laboratoryProfile.getInt("ImagingStudiesID");
//hematology
ResultSet hematology = SQLOperationsFollowUp.getHematology(hematologyId, connection);
hematology.first();
followupData.put("hemoglobin", hematology.getString("hemoglobin"));
followupData.put("hematocrit", hematology.getString("hematocrit"));
followupData.put("whiteBloodCells", hematology.getString("whiteBloodCells"));
followupData.put("neutrophils", hematology.getString("neutrophils"));
followupData.put("lymphocytes", hematology.getString("lymphocytes"));
followupData.put("monocytes", hematology.getString("monocytes"));
followupData.put("eosinophils", hematology.getString("eosinophils"));
followupData.put("basophils", hematology.getString("basophils"));
followupData.put("myelocytes", hematology.getString("myelocytes"));
followupData.put("metamyelocytes", hematology.getString("metamyelocytes"));
followupData.put("blasts", hematology.getString("blasts"));
followupData.put("plateletCount", hematology.getString("plateletCount"));
ResultSet bloodChemistry = SQLOperationsFollowUp.getBloodChemistry(bloodChemistryId, connection);
bloodChemistry.first();
followupData.put("ldh", bloodChemistry.getString("LDH"));
followupData.put("esr", bloodChemistry.getString("ESR"));
ResultSet imagingStudies = SQLOperationsFollowUp.getImagingStudies(imagingStudiesId, connection);
imagingStudies.first();
followupData.put("imagingStudiesResult", imagingStudies.getString("Result"));
int diseaseStatusId = followup.getInt("DiseaseStatusID");
ResultSet diseaseStatusRS = SQLOperationsFollowUp.getDiseaseStatus(diseaseStatusId, connection);
diseaseStatusRS.first();
String diseaseStatus = diseaseStatusRS.getString("DiseaseStatus");
String diseaseStatusOthers = diseaseStatusRS.getString("OtherDisease");
if (diseaseStatus.contains("(") || diseaseStatus.contains(")")) {
diseaseStatus = diseaseStatus.replaceAll("(", "(");
diseaseStatus = diseaseStatus.replaceAll(")", ")");
}
if (diseaseStatusOthers.contains("(") || diseaseStatusOthers.contains(")")) {
diseaseStatusOthers = diseaseStatusOthers.replaceAll("(", "(");
diseaseStatusOthers = diseaseStatusOthers.replaceAll(")", ")");
}
followupData.put("diseaseStatus", diseaseStatus);
followupData.put("diseaseStatusOthers", diseaseStatusOthers);
int patientID = Integer.parseInt(request.getParameter("patientID"));
ResultSet patientInfoRS = SQLOperationsBaseline.getPatient(patientID, connection);
patientInfoRS.first();
int generalDataID = patientInfoRS.getInt("GeneralDataID");
ResultSet generalDataRS = SQLOperationsBaseline.getGeneralData(generalDataID, connection);
generalDataRS.first();
HttpSession session = request.getSession(true);
AuditBean auditBean = new AuditBean("Load patient in Lymphoma Follow Up",
(String) session.getAttribute("patientLastName") + ", " + session.getAttribute("patientFirstName") + " " + session
.getAttribute("patientMiddleName"),
(String) session.getAttribute("name"), Integer.parseInt((String) session.getAttribute("accountID")));
SQLOperations.addAudit(auditBean, connection);
//return data to js
String json = new Gson().toJson(followupData);
response.getWriter().write(json);
} else {
System.out.println("Invalid Connection resource");
}
} catch (NullPointerException npe) {
System.err.println("Invalid Connection resource - " + npe.getMessage());
} catch (Exception e) {
System.err.println("Exception - " + e.getMessage());
}
}
}
| [
"jaszespi@gmail.com"
] | jaszespi@gmail.com |
9cac4a0cba386f796272d14b55ac571f3041b689 | eef4ae53bb5c4787725770cb9bf1f88ddc46e158 | /favorite-impl/src/main/java/sample/chirper/favorite/impl/FavoriteEvent.java | 16bc3a7cf22a27ab5f549ea8ad7723e5ebb00b9f | [
"Apache-2.0"
] | permissive | negokaz/lagom-hands-on-development | 6d897ca36e9bd4277c7d4882ca50a1b1556ccdee | 94259f44283bd37653e67b44d2dbe21b410e38af | refs/heads/master | 2020-04-06T06:54:08.756754 | 2016-07-22T04:21:54 | 2016-07-22T04:21:54 | 61,933,139 | 4 | 4 | null | 2016-09-02T05:15:27 | 2016-06-25T07:58:37 | Java | UTF-8 | Java | false | false | 1,600 | java | package sample.chirper.favorite.impl;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.lightbend.lagom.javadsl.immutable.ImmutableStyle;
import com.lightbend.lagom.javadsl.persistence.AggregateEvent;
import com.lightbend.lagom.javadsl.persistence.AggregateEventTag;
import com.lightbend.lagom.serialization.Jsonable;
import org.immutables.value.Value;
import java.time.Instant;
/**
* {@link FavoriteEntity} で起きるイベント
*/
public interface FavoriteEvent extends Jsonable, AggregateEvent<FavoriteEvent> {
@Override
default AggregateEventTag<FavoriteEvent> aggregateTag() {
return FavoriteEventTag.INSTANCE;
}
/**
* 「お気に入りが追加された」というイベント
*/
@Value.Immutable
@ImmutableStyle
@JsonDeserialize(as = FavoriteAdded.class)
interface AbstractFavoriteAdded extends FavoriteEvent {
@Value.Parameter
String getUserId();
@Value.Parameter
String getFavoriteId();
@Value.Default
default Instant getTimestamp() {
return Instant.now();
}
}
/**
* 「お気に入りが削除された」というイベント
*/
@Value.Immutable
@ImmutableStyle
@JsonDeserialize(as = FavoriteDeleted.class)
interface AbstractFavoriteDeleted extends FavoriteEvent {
@Value.Parameter
String getUserId();
@Value.Parameter
String getFavoriteId();
@Value.Default
default Instant getTimestamp() {
return Instant.now();
}
}
}
| [
"negokaz@gmail.com"
] | negokaz@gmail.com |
e1bfa4dfd4dde94efd2825d52e9d1ac5584c94fb | 96b5cee171b2dd68e4d2545aae476fc2f4b862ea | /FranciscoCorrea/topic0/Exercise4/Connection.java | 962041d960f7606094ee5287ff0b167eacb45f55 | [
"Apache-2.0"
] | permissive | justomiguel/java-bootcamp-2016 | 140fda11839441ffa553747b6ae01e2c9e7b707a | e84269b40bb46e8d10149256ec0ead2e9a933a93 | refs/heads/master | 2021-01-24T04:29:23.202383 | 2016-03-10T14:42:27 | 2016-03-10T14:42:27 | 52,279,894 | 1 | 3 | Apache-2.0 | 2020-05-27T22:26:58 | 2016-02-22T14:41:29 | Java | UTF-8 | Java | false | false | 1,217 | java | package topic0.Exercise4;
public class Connection {
private final String driver;
private final int ip;
private final String database;
private final String dbname;
private final String password;
public String getDriver() { return this.driver; }
public int getIp() { return this.ip; }
public String getDatabase() {return this.database; }
public String getDbName() { return this.dbname; }
public String getPassword() { return this.password; }
private Connection(ConnectionBuilder builder) {
this.driver = builder.driver;
this.ip = builder.ip;
this.database = builder.database;
this.dbname = builder.dbname;
this.password = builder.password;
}
public static class ConnectionBuilder {
private final String driver;
private final int ip;
private final String database;
private final String dbname;
private String password;
public ConnectionBuilder(String d, int ip, String db, String dbname) {
this.driver = d;
this.ip = ip;
this.database = db;
this.dbname = dbname;
}
public ConnectionBuilder password(String password) {
this.password = password;
return this;
}
public Connection buildConnection() {
return new Connection(this);
}
}
}
| [
"correa.francisco.21@gmail.com"
] | correa.francisco.21@gmail.com |
47b602a1725ae50e5bb80383800c5aea79025a94 | 26f522cf638887c35dd0de87bddf443d63640402 | /src/main/java/com/cczu/model/dao/impl/EadYjjcAccidentErmResInstrumentDaoImpl.java | c59d3b3f6810e9e3e0c398e5b960b52dbe458913 | [] | no_license | wuyufei2019/JSLYG | 4861ae1b78c1a5d311f45e3ee708e52a0b955838 | 93c4f8da81cecb7b71c2d47951a829dbf37c9bcc | refs/heads/master | 2022-12-25T06:01:07.872153 | 2019-11-20T03:10:18 | 2019-11-20T03:10:18 | 222,839,794 | 0 | 0 | null | 2022-12-16T05:03:09 | 2019-11-20T03:08:29 | JavaScript | UTF-8 | Java | false | false | 1,055 | java | package com.cczu.model.dao.impl;
import java.util.List;
import org.springframework.stereotype.Repository;
import com.cczu.model.entity.EAD_AccidentEntity;
import com.cczu.model.entity.EAD_Accident_ERM_ResInstrument;
import com.cczu.model.dao.IEadYjjcAccidentErmResInstrumentDao;
import com.cczu.util.dao.BaseDao;
@Repository("IEadYjjcAccidentErmResInstrumentDao")
public class EadYjjcAccidentErmResInstrumentDaoImpl extends BaseDao<EAD_Accident_ERM_ResInstrument, Long> implements IEadYjjcAccidentErmResInstrumentDao {
@Override
public void saveAccidentErmResInstrument( EAD_Accident_ERM_ResInstrument erm_ResInstrument) {
save(erm_ResInstrument);
}
@Override
public List<EAD_Accident_ERM_ResInstrument> getEADAccidentERMResInstrumentListByAccidentID(Long AccidentID) {
return findBy("accident", new EAD_AccidentEntity(AccidentID));
}
@Override
public void deleteERMResInstrumentListByAccidentID(Long accidentId) {
String sql="delete from ead_accident_erm_resinstrument where accident_id="+accidentId;
updateBySql(sql);
}
}
| [
"wuyufei2019@sina.com"
] | wuyufei2019@sina.com |
f07172c6c95ff551ff31bc24a17c9e4376e71b57 | 39a485c5e60cbf88600770b40996736d2bf2c19c | /SnakesAndLadderV6/SnakeLadderGameServerV6/src/com/razu/server/TestClass.java | 938fd6c4953c72e801fc3b58c6fe76a326e7a361 | [] | no_license | razu0031/SnakesAndLaddersMultiPlayer | e03b659d0e6b19c3e56aada582d27644bc7b3227 | b1ae9bead9825418048d565f470f9af0c5799fbe | refs/heads/master | 2021-01-01T20:38:19.462604 | 2017-07-31T16:53:48 | 2017-07-31T16:53:48 | 98,902,466 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 861 | java |
package com.razu.server;
import com.razu.game.Game;
import java.util.ArrayList;
import java.util.List;
public class TestClass {
public static void main(String[] arg){
List<String> listHere = new ArrayList();
for(int i=1; i<=4; i++){
listHere.add("e"+i);
}
Game game = new Game(listHere);
game.updateGame("e1", 5);
System.out.println("p1: e1="+game.getScore()+" np="+game.getNextPlayer());
game.updateGame("e2", 3);
System.out.println("p2: e2="+game.getScore()+" np="+game.getNextPlayer());
game.updateGame("e1", 4);
System.out.println("p3: e1="+game.getScore()+" np="+game.getNextPlayer());
game.updateGame("e2", 2);
System.out.println("p4: e2="+game.getScore()+" np="+game.getNextPlayer());
}
}
| [
"abdurrazzak0031@gmail.com"
] | abdurrazzak0031@gmail.com |
12b5f78b196290453bd926d4e960df76cb4a8a17 | ff029482e6208921459a36e9f0889bae031dcc7e | /src/aplehanova/Les3/task_C1.java | 15639f6ef37e9400ca233db8a565b9556f65d398 | [] | no_license | Trafimovich15/CS2019-04 | 8f27aba7781628b3bbf23b21e316edd7698355f2 | 64d310412014b9da06a08a2e06cedaf193854fed | refs/heads/master | 2020-05-05T11:31:12.127634 | 2019-04-16T15:23:26 | 2019-04-16T15:23:26 | 179,992,856 | 0 | 0 | null | 2019-04-07T16:31:32 | 2019-04-07T16:31:32 | null | UTF-8 | Java | false | false | 346 | java | package aplehanova.Les3;
import java.util.Scanner;
public class task_C1 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println(convertoFharenhet(sc.nextInt()));
}
public static double convertoFharenhet(int TC) {
double TF=(TC*9/5)+32;
return TF;
}
}
| [
"Littledrop777@gmail.com"
] | Littledrop777@gmail.com |
2cb29a0ae5195996ef93261e3a70259a2ef5294a | 67ce15b68b3036c9782a98e2088e150a591f79c2 | /SATD-Association/data/sql12/plugins/sqlval/src/com/mimer/ws/validateSQL/ValidatorResult.java | 66670b51f0177e1c83e924ad0d87e0f8868a0db4 | [] | no_license | brunoslima/SATDPriorityParse | 9b9a05706576c1b49967e7d02409083c951c279b | d14fe0aeebab6de46889d64923a833ac49ec59e9 | refs/heads/main | 2023-08-19T00:06:38.916854 | 2021-10-13T16:28:51 | 2021-10-13T16:28:51 | 416,808,293 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,284 | java | /*
* ValidatorResult.java
*
* Created on July 9, 2002, 10:44 PM
*/
package com.mimer.ws.validateSQL;
/**
*
* @author olle
*/
public class ValidatorResult {
/** Holds value of property text. */
private String data;
/** Holds value of property standard. */
private int standard;
/** Creates a new instance of ValidatorResult */
public ValidatorResult() {
}
/** Getter for property text.
* @return Value of property text.
*/
public String getData() {
return this.data;
}
/** Setter for property text.
* @param text New value of property text.
*/
public void setData(String data) {
this.data = data;
}
/** Getter for property standard.
* @return Value of property standard.
*/
public int getStandard() {
return this.standard;
}
/** Setter for property standard.
* @param standard New value of property standard.
*/
public void setStandard(int standard) {
this.standard = standard;
}
public String toString() {
return "standard = " + this.standard +
" (0 = not standard, 1 = Core, 2 = Core plus extensions)\n" +
"\ndata = " + this.data;
}
} | [
"brunoslima4@gmail.com"
] | brunoslima4@gmail.com |
28805bc7a362e119d986d8cdb19f358361473e2a | 9aca950475568296704a1282759bc080d45129f1 | /src/net/minecraft/DispenseBehaviorFlintAndSteel.java | 61f48be6c5c2d37eff906767752197dfdc282d82 | [] | no_license | jiangzhonghui/MinecraftServerDec | 1ef67dc5a4f34abffeaf6a6253ef8a2fb6449957 | ca2f62642a5629ebc3fa7ce356142e767be85e10 | refs/heads/master | 2021-01-22T16:13:27.101670 | 2014-11-09T10:15:49 | 2014-11-09T10:15:49 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 906 | java | package net.minecraft;
final class DispenseBehaviorFlintAndSteel extends DispenseBehaviorItem {
private boolean b = true;
protected ItemStack b(ISourceBlock var1, ItemStack var2) {
World var3 = var1.getWorld();
Position var4 = var1.getPosition().getRelative(BlockDispenser.b(var1.getData()));
if (var3.isEmpty(var4)) {
var3.a(var4, Blocks.FIRE.getBlockState());
if (var2.a(1, var3.random)) {
var2.amount = 0;
}
} else if (var3.getBlockState(var4).getBlock() == Blocks.TNT) {
Blocks.TNT.d(var3, var4, Blocks.TNT.getBlockState().a(BlockTNT.a, Boolean.valueOf(true)));
var3.setAir(var4);
} else {
this.b = false;
}
return var2;
}
protected void a(ISourceBlock var1) {
if (this.b) {
var1.getWorld().triggerEffect(1000, var1.getPosition(), 0);
} else {
var1.getWorld().triggerEffect(1001, var1.getPosition(), 0);
}
}
}
| [
"Shev4ik.den@gmail.com"
] | Shev4ik.den@gmail.com |
47f55ed1069f16c0f1b736bb5f9e789c413f5ccb | aabf912a743bb2d5b25d6c3ee632ac08538c0a1b | /android/app/src/main/java/com/privatechatapp/MainActivity.java | 765b2ee56b0de23955901ffabeff49f187f902be | [] | no_license | a7me63azzab/privateChatApp | 74ad6e236e66c8f8e276d358a2a303b2c7d6b15d | dae0a115c6f8eef929e70756188e2c3ee49d350a | refs/heads/master | 2020-03-13T23:42:03.416397 | 2018-04-27T20:18:33 | 2018-04-27T20:18:33 | 131,340,763 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 373 | java | package com.privatechatapp;
import com.facebook.react.ReactActivity;
public class MainActivity extends ReactActivity {
/**
* Returns the name of the main component registered from JavaScript.
* This is used to schedule rendering of the component.
*/
@Override
protected String getMainComponentName() {
return "privateChatApp";
}
}
| [
"devahmedazzab2014@gmail.com"
] | devahmedazzab2014@gmail.com |
2c5da498a56ce813809b7c99a05a14a6ee8fbbe7 | 83a72cd20f6209bfc913efd73c900700e0cd59dc | /Week_01/PlusOne.java | 3c2b15c2065e1640519acbeefe6d041699eb33d7 | [] | no_license | Delldeldel/algorithm024 | a2ca6d06c2b907bc899986437549e70ce5a2fcc8 | d1cfb7d9386654889352999408abfc8de17e2a30 | refs/heads/main | 2023-04-08T20:53:06.256756 | 2021-04-18T03:00:10 | 2021-04-18T03:00:10 | 331,659,202 | 0 | 0 | null | 2021-01-21T14:50:47 | 2021-01-21T14:50:46 | null | UTF-8 | Java | false | false | 1,515 | java | package com.wkx.demo;
public class PlusOne {
public static void main(String[] args) {
}
public int[] plusOne(int[] digits) {
int increase = 1;
for (int i = digits.length - 1; i >= 0; i--) {
if ((digits[i] + increase) / 10 > 0) {
digits[i] = (digits[i] + 1) % 10;
increase = 1;
} else {
digits[i] = digits[i] + increase;
increase = 0;
}
}
if (increase > 0) {
int[] newDigits = new int[digits.length + 1];
newDigits[0] = increase;
for (int i = 1; i < newDigits.length; i++) {
newDigits[i] = digits[i - 1];
}
return newDigits;
}
return digits;
}
/* 作者:yhhzw
链接:https://leetcode-cn.com/problems/plus-one/solution/java-shu-xue-jie-ti-by-yhhzw/
来源:力扣(LeetCode)
著作权归作者所有。商业转载请联系作者获得授权,非商业转载请注明出处。*/
public int[] plusOneCnLeetCode(int[] digits) {
for (int i = digits.length - 1; i >= 0; i--) {
digits[i]++;
digits[i] = digits[i] % 10;
if (digits[i] != 0) return digits;
}
digits = new int[digits.length + 1];
digits[0] = 1;
return digits;
}
public int[] plusOneLeetCode(int[] digits) {
int n = digits.length;
for (int i = n - 1; i >= 0; i--) {
if (digits[i] < 9) {
digits[i]++;
return digits;
}
digits[i] = 0;
}
int[] newNumber = new int[n + 1];
newNumber[0] = 1;
return newNumber;
}
}
| [
"wangkaixuan@algorithm024"
] | wangkaixuan@algorithm024 |
50e1fb7f7f380d988868bf88079deb558106d0fb | 825a2df3a2eb33b49f7125abad5bfcea736685cd | /algo/src/jungol/done/Main_1336_소수와함께하는여행.java | 40b41e1432392b851846d961286a880ecc4a2776 | [] | no_license | ruby11s/BOJ | 15156be48205a40755ae71995024e9ba6b0447b3 | 08fc4d9a25ef79c116b3c65cba0f60936aca9970 | refs/heads/master | 2021-07-17T09:57:40.564312 | 2017-10-24T01:26:13 | 2017-10-24T01:26:13 | 108,050,512 | 1 | 0 | null | null | null | null | UHC | Java | false | false | 2,690 | java | package jungol.done;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.Queue;
import java.util.StringTokenizer;
public class Main_1336_소수와함께하는여행 {
static String start, end;
static HashMap<Integer, Boolean> info = new HashMap<>();
static Queue<Ele> q = new LinkedList<>();
static boolean[] visited;
public static void main(String[] args) throws NumberFormatException, IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine().trim());
start = st.nextToken();
end = st.nextToken();
String num;
StringBuilder temp;
q.offer(new Ele(start, 0));
while(!q.isEmpty()){
Ele ele = q.poll();
num = ele.num;
for(int i = 0 ; i < 4 ; i++){
temp = new StringBuilder(num.toString());
for(int j = (i==1||i==2)? 0:1 ; j <= 9 ; j= (i==3)? (j+2):(j+1)){
temp = temp.replace(i, i+1, j+"");
if(end.equals(temp.toString())) {
System.out.println(ele.cnt+1);
return;
}
if(info.get(Integer.parseInt(temp.toString())) != null
&&info.get(Integer.parseInt(temp.toString()))) continue;
if(isPrime(Integer.parseInt(temp.toString()))){
q.offer(new Ele(temp.toString(), ele.cnt+1));
}
}
}
}
}//end main
static boolean isPrime(int target){
if(info.get(target) != null && info.get(target)) return true;
if(target%2 == 0) return false;
for(int i = 3 ; i <= Math.pow(target, 0.5); i=i+2){
if(target%i == 0){
return false;
}
}
info.put(target, true);
return true;
}
static class Ele{
String num;
int cnt;
public Ele(String num, int cnt) {
this.num = num;
this.cnt = cnt;
}
@Override
public String toString() {
StringBuilder builder = new StringBuilder();
builder.append("Q [num=");
builder.append(num);
builder.append(", cnt=");
builder.append(cnt);
builder.append("]");
return builder.toString();
}
}
}// end class | [
"hwisu.ryu@gmail.com"
] | hwisu.ryu@gmail.com |
fec93e4969b063bdbc822a24d6e4cf88352a1e1d | cff0ab2857a3058f524da7716e87063864829f53 | /src/test/java/projektzes/cardscraft/CardscraftApplicationTests.java | f663cd7101f2119ab7407d23e4b6ca14bab840a3 | [] | no_license | sebastianpiascik/cardscraft-back | 1c430d6f360fdf0264ece91eca7169f58050d0ac | 287d2e83205f0b85554fe1376e47fc729cda5847 | refs/heads/master | 2020-09-24T22:45:10.728898 | 2019-12-04T12:18:02 | 2019-12-04T12:18:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 217 | java | package projektzes.cardscraft;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class CardscraftApplicationTests {
@Test
void contextLoads() {
}
}
| [
"jpapis1@gmail.com"
] | jpapis1@gmail.com |
de22ada296d4b5c77e1688a3d6c597b5b06f3e5c | a567b8516ca89e9ca009738db6b6ab1d76cca504 | /src/DS EX/src/Sort_String.java | e409c54a1992909ab56ebd7c135e545da65102a0 | [] | no_license | SOUROVSARKERTEC12/Data-SSSSS | 861dd822d6db23a746c00282d23c2c68cbf30753 | 561e2d37e2f7b1a77977c204d019f958596254d8 | refs/heads/master | 2020-06-21T11:34:31.594597 | 2019-07-17T12:17:10 | 2019-07-17T12:17:10 | 197,437,921 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,523 | java | import java.util.Arrays;
import java.util.Comparator;
import java.util.Scanner;
public class Sort_String {
public static String sortString(String inputString)
{
// convert input string to Character array
Character tempArray[] = new Character[inputString.length()];
for (int i = 0; i < inputString.length(); i++) {
tempArray[i] = inputString.charAt(i);
}
// Sort, ignoring case during sorting
Arrays.sort(tempArray, new Comparator<Character>(){
@Override
public int compare(Character c1, Character c2)
{
// ignoring case
return Character.compare(Character.toLowerCase(c1),
Character.toLowerCase(c2));
}
});
// using StringBuilder to convert Character array to String
StringBuilder sb = new StringBuilder(tempArray.length);
for (Character c : tempArray) {
sb.append(c.charValue());
}
return sb.toString();
}
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
System.out.println("Enter a string:");
String inputString = input.nextLine();
String outputString = sortString(inputString);
System.out.println("Input String : " + inputString);
char arr[] = outputString.toCharArray();
for (int i = 0; i <arr.length ; i = i+1) {
System.out.println(arr[i]);
}
}
}
| [
"sourov@gmail.com"
] | sourov@gmail.com |
7c409af421fcf935f0a6cf5f6138c6d54e72ef5b | 32d702e7e7d33c9ab1e147b70b3048bdfe05d647 | /app/src/main/java/com/example/Kalyani_bankapp/Transaction_Itemmodel.java | 5f0ac5812516c677df87528f6439134b2dfb9fa9 | [] | no_license | Kalyani-krt/KRT_BankApp | c39918217fa3a4e8b8fab389eab152b65912b4d5 | 9c35a628dff4714bbd4551e824e7b142b3962e6b | refs/heads/master | 2023-03-14T22:40:21.735499 | 2021-03-21T05:00:09 | 2021-03-21T05:00:09 | 349,787,161 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 734 | java | package com.example.Kalyani_bankapp;
public class Transaction_Itemmodel {
String sender,receiver,amount;
public String getSender() {
return sender;
}
public void setSender(String sender) {
this.sender = sender;
}
public String getReceiver() {
return receiver;
}
public void setReceiver(String receiver) {
this.receiver = receiver;
}
public String getAmount() {
return amount;
}
public void setAmount(String amount) {
this.amount = amount;
}
public Transaction_Itemmodel(String sender,String amount,String receiver) {
this.sender = sender;
this.amount = amount;
this.receiver = receiver;
}
}
| [
"kr.tarke@gmail.com"
] | kr.tarke@gmail.com |
4e98d364f2961f19b8a62021710d4fde4f86c613 | 822b41be35a6e64c4b7ced7879eff1fd3c2016ea | /chapter_001/src/main/java/ru/job4j/Main.java | 03336ed138040562fec3041329a9688a56a97138 | [] | no_license | I-AM-VLAD/job4j | 09b0c6ab3a25359b030bdfea87104a032e471623 | 952ef378bda48db6dfed50d7e480ac4be413e524 | refs/heads/master | 2022-09-14T21:37:12.165806 | 2022-01-11T14:57:11 | 2022-01-11T14:57:11 | 227,498,683 | 0 | 0 | null | 2022-09-08T01:14:32 | 2019-12-12T01:59:01 | Java | UTF-8 | Java | false | false | 137 | java | package ru.job4j;
public class Main
{
public static void main(String[] args) {
System.out.println("Hello, job4j!");
}
} | [
"vlad1slaw19982@gmail.com"
] | vlad1slaw19982@gmail.com |
358de19d6f29d530009766713acf5fdcf9bd67a8 | eec94894458f8cc385b1aa5bd5b247378d1efb77 | /wms-generator/src/main/java/com/one/service/SysGeneratorService.java | cc85b6c37a09a86e0b3d3f20bc5d1a6a3a0acc5c | [] | no_license | 342523895/my-wms | 8d4f58afc6654274395cd55150857fd9ce8e0f68 | d58d2ac2897d9a103916c3117786654b1576da44 | refs/heads/master | 2022-08-01T09:58:31.795393 | 2019-07-25T01:23:19 | 2019-07-25T01:23:19 | 198,732,462 | 1 | 0 | null | 2022-07-06T20:39:45 | 2019-07-25T01:15:39 | JavaScript | UTF-8 | Java | false | false | 1,659 | java |
package com.one.service;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.one.dao.GeneratorDao;
import com.one.utils.GenUtils;
import com.one.utils.PageUtils;
import com.one.utils.Query;
import org.apache.commons.io.IOUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.io.ByteArrayOutputStream;
import java.util.List;
import java.util.Map;
import java.util.zip.ZipOutputStream;
/**
* 代码生成器
*
* @author WanDa
*/
@Service
public class SysGeneratorService {
@Autowired
private GeneratorDao generatorDao;
public PageUtils queryList(Query query) {
Page<?> page = PageHelper.startPage(query.getPage(), query.getLimit());
List<Map<String, Object>> list = generatorDao.queryList(query);
return new PageUtils(list, (int)page.getTotal(), query.getLimit(), query.getPage());
}
public Map<String, String> queryTable(String tableName) {
return generatorDao.queryTable(tableName);
}
public List<Map<String, String>> queryColumns(String tableName) {
return generatorDao.queryColumns(tableName);
}
public byte[] generatorCode(String[] tableNames) {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
ZipOutputStream zip = new ZipOutputStream(outputStream);
for(String tableName : tableNames){
//查询表信息
Map<String, String> table = queryTable(tableName);
//查询列信息
List<Map<String, String>> columns = queryColumns(tableName);
//生成代码
GenUtils.generatorCode(table, columns, zip);
}
IOUtils.closeQuietly(zip);
return outputStream.toByteArray();
}
}
| [
"wanda"
] | wanda |
e0ef21c633d034c7c495984f36ac23dc13d34f83 | f23e21c91cd659e8b1abd258d8cc88578358fe71 | /APCSA-Dylan Chan/src/starfighter/PowerUp.java | 978a6ff86aede231b0041a04db4e6ec1e9897ae7 | [] | no_license | chand0048/AP-Computer-Science-A | 3ea7d5d42ce4398c8985499b1b9eb16bd98f9671 | 30143f9391970d321ea5aebbeada0f31f60fed50 | refs/heads/master | 2021-05-08T13:47:24.115188 | 2018-05-14T21:49:47 | 2018-05-14T21:49:47 | 120,034,957 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 991 | java | package starfighter;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Image;
import java.io.File;
import javax.imageio.ImageIO;
public class PowerUp implements Locatable
{
private boolean visible;
private int xPos, yPos;
private Image image;
public PowerUp(int x, int y, boolean v)
{
setPos(x, y);
setVisible(v);
try
{
image = ImageIO.read(new File("src\\starfighter\\pu.jpg"));
}catch (Exception e)
{
System.out.println(e);
}
}
public void setPos(int x, int y)
{
setX(x);
setY(y);
}
public void setX(int x)
{
xPos = x;
}
public void setY(int y)
{
yPos = y;
}
public void setVisible(boolean v)
{
visible = v;
}
public int getX()
{
return xPos;
}
public int getY()
{
return yPos;
}
public boolean getVisible()
{
return visible;
}
public void draw(Graphics window)
{
window.drawImage(image, getX(), getY(), 50, 50, null);
}
}
| [
"chand0048@CA-SU-F106-06.sduhsd.lan"
] | chand0048@CA-SU-F106-06.sduhsd.lan |
f0a4f6542d9e0d5556208fb69ecc92d111d3dbba | e090fb0f6f9f4476d9d17e03bff968cf4ab099af | /WLCPGameServerAPI/src/main/java/wlcp/gameserver/api/exception/WLCPGameInstanceOrUsernameDoesNotExistException.java | 9806180deba01ea39d4f2aa6d8ca4cccdb7725cc | [] | no_license | wearable-learning/wearable-learning-cloud-platform | 19450f5469a1fc66ad47f4f38e27cf7e00e152fb | 14474bb67bf883f59b941e3fb59e554ff0a88ff3 | refs/heads/master | 2022-12-26T19:16:03.049462 | 2020-02-12T02:48:42 | 2020-02-12T02:48:42 | 166,293,040 | 0 | 6 | null | 2022-12-16T13:42:57 | 2019-01-17T20:36:01 | JavaScript | UTF-8 | Java | false | false | 298 | java | package wlcp.gameserver.api.exception;
public class WLCPGameInstanceOrUsernameDoesNotExistException extends Exception {
/**
*
*/
private static final long serialVersionUID = 1L;
public WLCPGameInstanceOrUsernameDoesNotExistException(String message) {
super(message);
}
}
| [
"mmicciolo@wpi.edu"
] | mmicciolo@wpi.edu |
368e412b7885355f1767e182c2a4ee5dfcf0996a | 6bdd5e28ce1384da878bb9dae09c75fc67fe75f9 | /src/utilitaire_java/Utilitaire_java.java | b7c7a42126c1d3c60edb2af0737a6b38abdc00ef | [] | no_license | theaud/utilitaire_java | f5c6c08cde571ba7c3a4e5b356a8dfdbbd4c0d6d | d049d5135e483df96265fd58053e54bd3b06311f | refs/heads/master | 2021-01-10T02:28:30.086513 | 2016-02-20T14:39:33 | 2016-02-20T14:39:33 | 50,529,096 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 592 | 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 utilitaire_java;
import graphique.Fenetre;
import java.util.*;
/**
*
* @author mathieu
*/
public class Utilitaire_java {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
System.out.println("utilitaire_jggava.Uiiiitilitaire_java.main()");
Fenetre d=new Fenetre();
}
}
| [
"brionmathieu@gmail.com"
] | brionmathieu@gmail.com |
987ef05e154e5339e379cc37144b2a657d64d395 | c08b6eec3017e38290e14d113526c1121578cb40 | /app/src/main/java/com/example/henrikhoang/projectmoviestage1/adapter/ReviewAdapter.java | 97260ad1d726f2909f134a4dcb4f0a4dde907f38 | [] | no_license | henrikhoang/FavoriteMovieStage2 | cb59a6231d56c7dfd8fde74e3ce8e8447e4660bf | 4a3cd4f6b497393b9afda5373677edef7f50e347 | refs/heads/master | 2020-12-02T06:41:08.946033 | 2017-08-06T08:39:02 | 2017-08-06T08:39:02 | 96,877,911 | 0 | 0 | null | 2017-08-06T08:36:50 | 2017-07-11T09:49:09 | Java | UTF-8 | Java | false | false | 2,428 | java | package com.example.henrikhoang.projectmoviestage1.adapter;
import android.content.Context;
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.TextView;
import com.example.henrikhoang.projectmoviestage1.Film;
import com.example.henrikhoang.projectmoviestage1.R;
/**
* Created by henrikhoang on 7/23/17.
*/
public class ReviewAdapter extends
RecyclerView.Adapter<ReviewAdapter.ReviewAdapterViewHolder> {
private final Context mContext;
private Film mFilm;
public interface ReviewAdapterOnClickHandler {
}
public ReviewAdapter(@NonNull Context context) {
mContext = context;
}
@Override
public ReviewAdapter.ReviewAdapterViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
Context context = viewGroup.getContext();
int layoutIdForListReviews = R.layout.reviews_items;
LayoutInflater inflater = LayoutInflater.from(context);
boolean shouldAttachToParentImmediately = false;
View view = inflater.inflate(layoutIdForListReviews, viewGroup, shouldAttachToParentImmediately);
return new ReviewAdapterViewHolder(view);
}
@Override
public void onBindViewHolder(ReviewAdapter.ReviewAdapterViewHolder holder, int position) {
String author = mFilm.getAuthor()[position];
holder.mAuthorTextView.setText(author);
String comment = mFilm.getComment()[position];
holder.mCommentTextView.setText(comment);
}
public void setReviewData(Film film) {
mFilm = film;
notifyDataSetChanged();
}
class ReviewAdapterViewHolder extends RecyclerView.ViewHolder {
final TextView mAuthorTextView;
final TextView mCommentTextView;
ReviewAdapterViewHolder(View view) {
super(view);
mAuthorTextView = (TextView) view.findViewById(R.id.tv_review_author);
mCommentTextView = (TextView) view.findViewById(R.id.tv_review_comment);
}
}
@Override
public int getItemCount() {
try {
if (0 == mFilm.getAuthor().length) return 0;
return mFilm.getAuthor().length;
} catch (NullPointerException e) {
e.printStackTrace();
}
return 0;
}
}
| [
"henrikhoang17@gmail.com"
] | henrikhoang17@gmail.com |
21d8eb10333f4fa15c1d7cc5a34174a9f6cfc002 | e587c46b88f34b037ed53307aaaf1e6283713093 | /plugins/au.gov.ga.earthsci.common.tests/src/au/gov/ga/earthsci/common/color/io/CompactStringColorMapReaderTest.java | d7c87bddb4c9b1074e321599d7c4c06748f2ee1e | [
"Apache-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | GeoscienceAustralia/earthsci | 1fe97deeae176eca836499b4854589a474dd5e89 | d44f448f992536c971ac4721ee550021dcea4543 | refs/heads/master | 2022-09-04T13:40:51.102793 | 2022-08-03T07:10:45 | 2022-08-03T07:10:45 | 6,183,254 | 51 | 30 | null | 2022-06-21T03:30:15 | 2012-10-12T00:46:12 | Java | UTF-8 | Java | false | false | 3,082 | java | package au.gov.ga.earthsci.common.color.io;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import org.junit.Test;
import au.gov.ga.earthsci.common.color.ColorMap;
import au.gov.ga.earthsci.common.color.ColorMap.InterpolationMode;
/**
* Unit tests for the {@link CompactStringColorMapReader} class
*
* @author James Navin (james.navin@ga.gov.au)
*/
public class CompactStringColorMapReaderTest
{
private static final String VALID_MIN = "name|||||0.0,-16777216";
private static final String VALID_FULL = "name|description|NEAREST_MATCH|0|-1000|0.0,-16777216,1.0,-1";
private final CompactStringColorMapReader classUnderTest = new CompactStringColorMapReader();
@Test
public void testSupportsWithNull()
{
assertFalse(classUnderTest.supports(null));
}
@Test
public void testSupportsWithEmptyString()
{
assertFalse(classUnderTest.supports(""));
}
@Test
public void testSupportsWithValidFullyConfigured()
{
assertTrue(classUnderTest.supports(VALID_FULL));
}
@Test
public void testSupportsWithValidMinimalConfigured()
{
assertTrue(classUnderTest.supports(VALID_MIN));
}
@Test
public void testSupportsWithInvalidMissingName()
{
assertFalse(classUnderTest.supports(VALID_FULL.replace("name", "")));
}
@Test
public void testSupportsWithInvalidOddNumberKeyValuePairs()
{
assertFalse(classUnderTest.supports(VALID_FULL.replace("0.0,", "")));
}
@Test
public void testSupportsWithInvalidBadColorValue()
{
assertFalse(classUnderTest.supports(VALID_FULL.replace("-1", "-1.0")));
}
@Test(expected = IllegalArgumentException.class)
public void testReadWithNull() throws Exception
{
classUnderTest.read(null);
}
@Test(expected = IllegalArgumentException.class)
public void testReadWithEmpty() throws Exception
{
classUnderTest.read("");
}
@Test
public void testReadWithValidFullyConfigured() throws Exception
{
ColorMap result = classUnderTest.read(VALID_FULL);
assertNotNull(result);
assertEquals("name", result.getName());
assertEquals("description", result.getDescription());
assertEquals(InterpolationMode.NEAREST_MATCH, result.getMode());
assertFalse(result.isPercentageBased());
assertEquals(-1000, result.getNodataColour().getRGB());
assertEquals(2, result.getEntries().size());
assertEquals(-16777216, result.getColor(0.0).getRGB());
assertEquals(-1, result.getColor(1.0).getRGB());
}
@Test
public void testReadWithValidMinimalConfigured() throws Exception
{
ColorMap result = classUnderTest.read(VALID_MIN);
assertNotNull(result);
assertEquals("name", result.getName());
assertEquals(null, result.getDescription());
assertEquals(InterpolationMode.INTERPOLATE_RGB, result.getMode());
assertTrue(result.isPercentageBased());
assertEquals(null, result.getNodataColour());
assertEquals(1, result.getEntries().size());
assertEquals(-16777216, result.getColor(0.0).getRGB());
assertEquals(-16777216, result.getColor(1.0).getRGB());
}
}
| [
"james.navin@ga.gov.au"
] | james.navin@ga.gov.au |
772804326065e0415f59b5e82ec8ca99854150d9 | 9ff4484e5d4852fc55e362e8a4cd240c8bfa6144 | /src/pl/sda/zdjavapol75/obiektowosc/dzien1/Main.java | d3de49aef8794ffa26b80d7a20091b1586223b45 | [] | no_license | Grzebere/kurs-java-zdjava75 | 8a18f91fbe2ffe4a0cbaeb5d83498d2c89337b61 | a383a29a8bd10271e3c1fcac3c28170bf5ba3336 | refs/heads/master | 2023-03-04T02:49:01.629672 | 2021-02-16T20:20:11 | 2021-02-16T20:20:11 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 571 | java | package pl.sda.zdjavapol75.obiektowosc.dzien1;
public class Main {
public static void main(String[] args) {
Pies burek = new Pies();
burek.umaszczenie = "Brązowe";
burek.imie = "Burek";
burek.wiek = 12;
burek.aportuj("Dlugi");
burek.przedstawSie();
System.out.println("Od teraz przemawia koljeny pies, Azor");
Pies azor = new Pies();
azor.umaszczenie = "Czarny";
azor.imie = "Azor";
azor.wiek = 5;
azor.aportuj("Krotki");
azor.przedstawSie();
}
}
| [
"chodekm@gmail.com"
] | chodekm@gmail.com |
9b00962fcb3c3d263d568ad2bf38f132c505782f | 4aec036be22d9dfcde0f80fd135c74221595e69e | /Hestia/src/maps/main/java/com/lynden/gmapsfx/javascript/IJavascriptRuntime.java | 88349d0c950bc7e45cc95b7f1f80d036d891e62d | [] | no_license | isaakbormental/hestia | 06eeb10829a5b331919cd08bb1af20857cdda198 | 4154a616d07ea64db97a32258a4dab37c89ee597 | refs/heads/master | 2018-06-30T12:19:55.312118 | 2018-05-31T14:19:21 | 2018-05-31T14:19:21 | 72,195,986 | 0 | 2 | null | null | null | null | UTF-8 | Java | false | false | 3,485 | java | /*
* Copyright 2014 Lynden, Inc.
*
* 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 maps.main.java.com.lynden.gmapsfx.javascript;
import netscape.javascript.JSObject;
/**
* An interface for interacting with a JavaScript environment which includes
* methods for building strings that represent functions and constructors as
* well as providing a means to execute commands.
*
* @author Rob Terpilowski
*/
public interface IJavascriptRuntime {
/**
* Execute the specified command returning a value (if any)
*
* @param command The JavaScript command to execute
* @return The underlying JavaScript object that was returned by the script.
*/
JSObject execute(String command);
/**
* Gets a constructor as a string which then can be passed to the execute().
*
* @param javascriptObjectType The type of JavaScript object to create
* @param args The args of the constructor
* @return A string which can be passed to the JavaScript environment to
* create a new object.
*/
String getConstructor(String javascriptObjectType, Object... args);
/**
* Gets an array parameter constructor as a String, which then can be
* passed to the execute() method. Note, this is where the parameter to the
* constructor is an array, rather than the varargs which are broken down
* into separate parameters.
*
* @param javascriptObjectType type The type of JavaScript object array to create
* @param ary The array elements
* @return A string which can be passed to the JavaScript environment to
* create a new array.
*/
String getArrayConstructor(String javascriptObjectType, Object[] ary);
/**
* Gets a function as a String, which then can be passed to the
* execute() method.
*
* @param variable The variable to invoke the function on.
* @param function The function to invoke
* @param args Arguments the function requires
* @return A string which can be passed to the JavaScript environment to
* invoke the function
*/
String getFunction(String variable, String function, Object... args);
/**
* Gets a function as a String, which then can be passed to the
* execute() method.
*
* @param function The function to invoke
* @param args Arguments the function requires
* @return A string which can be passed to the JavaScript environment to
* invoke the function
*/
String getFunction(String function, Object... args);
/**
* Gets an array function as a String, which then can be passed to the
* execute() method.
*
* @param function The function to invoke
* @param ary The array of arguments to pass to the function.
* @return A string which can be passed to the JavaScript environment to
* invoke the function
*/
String getArrayFunction(String function, Object[] ary);
}
| [
"vladostan94@gmail.com"
] | vladostan94@gmail.com |
671f765879e539c364846cdbde0fe6c6c7767678 | dfffc7015e2be69b6183c5b424c1de16957d1bb6 | /app/src/main/java/gabytech/promeet/MainActivity.java | 2bda71685f0650306a5ea18315dcf374ccb15367 | [] | no_license | Hilyas68/ProMeet | a3d3440c2955c29b5e284b0a27e4afdab18d0add | 7eeae82eb36bc5abe12672e744d388fde99075d0 | refs/heads/master | 2020-08-05T02:12:42.815562 | 2018-10-19T00:06:37 | 2018-10-19T00:06:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,586 | java | package gabytech.promeet;
import android.content.Intent;
import android.graphics.Color;
import android.support.design.widget.TabLayout;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import com.google.firebase.auth.FirebaseAuth;
import com.google.firebase.auth.FirebaseUser;
public class MainActivity extends AppCompatActivity {
private FirebaseAuth mAuth;
private Toolbar mToolbar;
private ViewPager mViewPager;
private SectionsPagerAdapter mSectionsPagerAdapter;
private TabLayout mTabLayout;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mAuth = FirebaseAuth.getInstance();
mToolbar = findViewById(R.id.main_page_toolbar);
setSupportActionBar(mToolbar);
getSupportActionBar().setTitle("ProMeet");
//Tabs
mViewPager = findViewById(R.id.main_tabPager);
mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
mViewPager.setAdapter(mSectionsPagerAdapter);
mTabLayout = findViewById(R.id.main_tabs);
mTabLayout.setupWithViewPager(mViewPager);
mTabLayout.setTabTextColors(Color.WHITE, Color.WHITE);
}
@Override
public void onStart() {
super.onStart();
// Check if user is signed in (non-null) and update UI accordingly.
FirebaseUser currentUser = mAuth.getCurrentUser();
if (currentUser == null){
sendToStart();
}
}
private void sendToStart() {
Intent startIntent = new Intent(MainActivity.this, StartActivity.class);
startActivity(startIntent);
finish();
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
super.onCreateOptionsMenu(menu);
getMenuInflater().inflate(R.menu.main_menu, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
super.onOptionsItemSelected(item);
if (item.getItemId() == R.id.main_logout_btn){
FirebaseAuth.getInstance().signOut();
sendToStart();
}
if (item.getItemId() == R.id.main_settings_button){
Intent settingsIntent = new Intent(MainActivity.this, SettingsActivity.class);
startActivity(settingsIntent);
}
return true;
}
}
| [
"gabyslaw@gmail.com"
] | gabyslaw@gmail.com |
c99ed3818083a15ac19cbca128662c4abaa6828d | 1eb4d69cbdc97a500b8f493b30337b6fb40006b7 | /src/hr/fer/zemris/java/tecaj/hw1/NumberDecomposition.java | da264689117c994fcb85aae2537398638ea6464c | [] | no_license | amkarlo/cupicJava | 154b2865326d7078f28835552812678a01265942 | e0e65c78e6c53b31e3af7a14548c25686046fccb | refs/heads/master | 2021-01-21T14:04:40.093152 | 2017-02-15T09:39:10 | 2017-02-15T09:39:10 | 81,097,600 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 463 | java | package hr.fer.zemris.java.tecaj.hw1;
/**
* Created by akarlovic on 16.1.2017..
*/
public class NumberDecomposition {
public static void main(String[] args) {
int num = Integer.parseInt(args[0]);
int prost = 2;
while(num > 1){
while (num%prost == 0) {
num = num / prost;
System.out.println(prost);
}
prost = PrimeNumbers.nadjiProst(prost + 1);
}
}
}
| [
"akarlovic@intranet.combis.hr"
] | akarlovic@intranet.combis.hr |
b6b72a186d76b7641ab6636bf14c3fe2b18d587e | d57777f9324258a940c8cb6c99017adc7431ebe9 | /Sort.java | f8e44f1c430bc188ba8db4d84f910ee683d7de48 | [] | no_license | kritika1922/m2 | 8800487aa1e360cdd0584e6dfcfd05cc1480371a | 98881aa2ea9df8f6097a800a6fc80063b5a9bf5d | refs/heads/master | 2023-08-22T17:34:45.530099 | 2021-10-06T13:26:02 | 2021-10-06T13:26:02 | 413,770,915 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 973 | java | package MyProject;
import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class Sort {
public void sort() {
try {
BufferedReader reader = new BufferedReader(new FileReader("url.txt"));
List<String> str = new ArrayList<>();
String line = "";
while ((line = reader.readLine()) != null) {
str.add(line);
}
reader.close();
//Collections.sort(str);
Collections.reverse(str);
FileWriter writer = new FileWriter("url.txt");
for (String s : str) {
writer.write(s);
writer.write("\r\n");
}
writer.close();
System.out.println("Successfully");
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
| [
"kritika.gupta@hotwaxsystems.com"
] | kritika.gupta@hotwaxsystems.com |
aa640646337e3c78fa457cdd3bab2e420699958c | 145993c6190554c00c014e47338c891199a3e467 | /eastFund/app/src/main/java/com/test/bank/bean/SevenDayYieldBean.java | e0e9bcefb340191464245b532cb90906f044e695 | [] | no_license | cuipengpeng/codeUtil | d45d4f239de40fe2806011b5b7fd6238b23e940c | ae0bdbcf6237fa3cfb6fac724e487627ee06d1c3 | refs/heads/master | 2023-02-25T14:57:56.259687 | 2023-01-04T13:09:19 | 2023-02-10T16:14:10 | 126,859,505 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 147 | java | package com.test.bank.bean;
/*
* 描 述:<br>
* 作 者:崔朋朋<br>
* 时 间:2018/1/8<br>
*/
public class SevenDayYieldBean {
}
| [
"c123@163.com"
] | c123@163.com |
a77838476256a7f41767262035b464dccc886c10 | b3959fad0dffde4fafd57179d270fd8bcff8570f | /src/main/java/ua/tania/ann/controller/command/admin/DeleteCategoryCommand.java | 749adf032b1062189259925b2bec326d85724059 | [] | no_license | Taniann/PeriodicalEditions | cbfa144cddd10bd42fdacc4ea281f284f81feeec | 6358c0ea6aa16c6ad6aa3ae50051bc812e64afdd | refs/heads/master | 2020-03-26T14:12:29.132067 | 2018-09-24T20:25:11 | 2018-09-24T20:25:11 | 144,977,252 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,181 | java | package ua.tania.ann.controller.command.admin;
import ua.tania.ann.controller.command.Command;
import ua.tania.ann.controller.command.ResultPage;
import ua.tania.ann.service.CategoryService;
import ua.tania.ann.utils.JspPath;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import static ua.tania.ann.controller.command.ResultPage.RoutingType.REDIRECT;
/**
* Created by Таня on 26.08.2018.
*/
public class DeleteCategoryCommand implements Command {
private static final String ID = "id";
private CategoryService categoryService;
public DeleteCategoryCommand() {
categoryService = CategoryService.getInstance();
}
@Override
public ResultPage execute(HttpServletRequest request, HttpServletResponse response) throws Exception {
ResultPage resultPage = new ResultPage(REDIRECT);
int categoryId = Integer.parseInt(request.getParameter(ID));
if (categoryService.delete(categoryId)) {
resultPage.setPage(JspPath.CATEGORY_PAGE_COMMAND);
}
else {
resultPage.setPage(JspPath.ERROR_PAGE);
}
return resultPage;
}
}
| [
"nebesnatania@outlook.com"
] | nebesnatania@outlook.com |
68fdc2756f20244f440d5e6ac7c3a02714e85ec0 | 1acb75c08803e85f7aa6c28f290c1e849698008c | /src/servlet/Loggin.java | 4506b0919dd8abdc724be1a9ec453aa5d74f56f6 | [] | no_license | alvfacu/TP-JAVA-CAMIONES | e500de85d34f17fdcbcd293ae65ed0e8aa613dc5 | 45b92b4929434a3bbd2ce9d219296758d470fbb4 | refs/heads/master | 2021-01-21T04:38:25.116746 | 2018-02-07T22:54:35 | 2018-02-07T22:54:35 | 55,277,240 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,608 | java | package servlet;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import capaEntidades.Personal;
import capaNegocio.Controlador;
/**
* Servlet implementation class Loggin
*/
@WebServlet("/Loggin")
public class Loggin extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* Default constructor.
*/
public Loggin() {
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request,response);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
HttpSession sesion = request.getSession();
String usuario = request.getParameter("user");
String password = request.getParameter("pass");
Personal pe = new Personal();
Controlador c = new Controlador();
pe = c.validarUsuario(usuario,password);
if(pe.getDni()==null) {
request.getRequestDispatcher("error.html").forward(request,response);}
else {
sesion.setAttribute("Usuario", pe);
request.getRequestDispatcher("index.jsp").forward(request,response);};
}
}
| [
"guereta.martin@gmail.com"
] | guereta.martin@gmail.com |
8915dbbaff38c9d1ed56061d0dcf51b0a48232dc | 54772e8abe7247c3e0bf725357cd627d672dd767 | /src/net/shopxx/entity/DeliveryCenter.java | 7f6879a2b6720edff2de2d8965357c5f3276996a | [] | no_license | tomdev2008/newcode | a0be11f290009c089a6e874b19aa6585c1606f7c | 2e78acdd97886f9464df09d2172d21bc78f9bd74 | refs/heads/master | 2021-01-16T19:21:42.323854 | 2013-06-15T03:05:18 | 2013-06-15T03:05:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,780 | java | package net.shopxx.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;
import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotEmpty;
@Entity
@Table(name = "xx_delivery_center")
public class DeliveryCenter extends BaseEntity {
private static final long serialVersionUID = 3328996121729039075L;
private String name;
private String contact;
private String areaName;
private String address;
private String zipCode;
private String phone;
private String mobile;
private String memo;
private Boolean isDefault;
private Area area;
@NotEmpty
@Length(max = 200)
@Column(nullable = false)
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
@NotEmpty
@Length(max = 200)
@Column(nullable = false)
public String getContact() {
return this.contact;
}
public void setContact(String contact) {
this.contact = contact;
}
@Column(nullable = false)
public String getAreaName() {
return this.areaName;
}
public void setAreaName(String areaName) {
this.areaName = areaName;
}
@NotEmpty
@Length(max = 200)
@Column(nullable = false)
public String getAddress() {
return this.address;
}
public void setAddress(String address) {
this.address = address;
}
@Length(max = 200)
public String getZipCode() {
return this.zipCode;
}
public void setZipCode(String zipCode) {
this.zipCode = zipCode;
}
@Length(max = 200)
public String getPhone() {
return this.phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
@Length(max = 200)
public String getMobile() {
return this.mobile;
}
public void setMobile(String mobile) {
this.mobile = mobile;
}
@Length(max = 200)
public String getMemo() {
return this.memo;
}
public void setMemo(String memo) {
this.memo = memo;
}
@NotNull
@Column(nullable = false)
public Boolean getIsDefault() {
return this.isDefault;
}
public void setIsDefault(Boolean isDefault) {
this.isDefault = isDefault;
}
@NotNull
@ManyToOne(fetch = FetchType.LAZY)
public Area getArea() {
return this.area;
}
public void setArea(Area area) {
this.area = area;
}
@PrePersist
public void prePersist() {
if (getArea() != null)
setAreaName(getArea().getFullName());
}
@PreUpdate
public void preUpdate() {
if (getArea() != null)
setAreaName(getArea().getFullName());
}
}
| [
"xiaoshi332@163.com"
] | xiaoshi332@163.com |
0d443f04973bf0c5a9fa08437e78f7b1c4f824ec | 423054d791b9281b763c39dd4c5bb5a1ebbe9813 | /src/main/java/com/scout/pois/dao/Poi17yearMapper.java | d7c7bdd4e2af15fc4028b83816c02b88a6029d9c | [] | no_license | Scoutyzb/swtx | 01abcf737787224e237557bab86f9564954b33d6 | f66e23ff85839af8301519449053e2e594ded056 | refs/heads/master | 2023-02-24T12:54:08.815616 | 2021-01-30T09:54:37 | 2021-01-30T09:54:37 | 334,379,426 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,669 | java | package com.scout.pois.dao;
import com.scout.pois.entity.Poi17year;
import com.scout.pois.entity.Poi17yearExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface Poi17yearMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table poi17year
*
* @mbg.generated
*/
long countByExample(Poi17yearExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table poi17year
*
* @mbg.generated
*/
int deleteByExample(Poi17yearExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table poi17year
*
* @mbg.generated
*/
int deleteByPrimaryKey(String pid);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table poi17year
*
* @mbg.generated
*/
int insert(Poi17year record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table poi17year
*
* @mbg.generated
*/
int insertSelective(Poi17year record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table poi17year
*
* @mbg.generated
*/
List<Poi17year> selectByExample(Poi17yearExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table poi17year
*
* @mbg.generated
*/
Poi17year selectByPrimaryKey(String pid);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table poi17year
*
* @mbg.generated
*/
int updateByExampleSelective(@Param("record") Poi17year record, @Param("example") Poi17yearExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table poi17year
*
* @mbg.generated
*/
int updateByExample(@Param("record") Poi17year record, @Param("example") Poi17yearExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table poi17year
*
* @mbg.generated
*/
int updateByPrimaryKeySelective(Poi17year record);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table poi17year
*
* @mbg.generated
*/
int updateByPrimaryKey(Poi17year record);
} | [
"scoutyzb@yeah.net"
] | scoutyzb@yeah.net |
f897d00027ae65a68921c17930c5003a94e3b5aa | 58d0ee27578c6b8fd06b80b19c6f032a6da0f557 | /cim_for_netty/cim-android-sdk/src/com/farsunset/cim/sdk/android/CIMEventBroadcastReceiver.java | 9b49855d6acfe8d179a43cc750737859562007ba | [
"Apache-2.0"
] | permissive | cenbow/cim | 3de2fc613c316707ed68c25389835f887e043970 | 9be3cf9ecccba4c7246f2f476e89f3b4d341769f | refs/heads/master | 2020-05-15T01:07:50.123032 | 2019-04-17T09:46:23 | 2019-04-17T09:46:23 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 6,790 | java | /**
* Copyright 2013-2019 Xia Jun(3979434@qq.com).
*
* 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.
*
***************************************************************************************
* *
* Website : http://www.farsunset.com *
* *
***************************************************************************************
*/
package com.farsunset.cim.sdk.android;
import com.farsunset.cim.sdk.android.constant.CIMConstant;
import com.farsunset.cim.sdk.android.exception.SessionClosedException;
import com.farsunset.cim.sdk.android.model.Message;
import com.farsunset.cim.sdk.android.model.ReplyBody;
import com.farsunset.cim.sdk.android.model.SentBody;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
/**
* 消息入口,所有消息都会经过这里
*/
public abstract class CIMEventBroadcastReceiver extends BroadcastReceiver {
protected Context context;
@Override
public void onReceive(Context ctx, Intent intent) {
context = ctx;
/*
* 操作事件广播,用于提高service存活率
*/
if (intent.getAction().equals(Intent.ACTION_USER_PRESENT)
|| intent.getAction().equals(Intent.ACTION_POWER_CONNECTED)
|| intent.getAction().equals(Intent.ACTION_POWER_DISCONNECTED)) {
startPushService();
}
/*
* 设备网络状态变化事件
*/
if (intent.getAction().equals(CIMConstant.IntentAction.ACTION_NETWORK_CHANGED)) {
ConnectivityManager connectivityManager = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
onDevicesNetworkChanged(connectivityManager.getActiveNetworkInfo());
}
/*
* cim断开服务器事件
*/
if (intent.getAction().equals(CIMConstant.IntentAction.ACTION_CONNECTION_CLOSED)) {
onInnerConnectionClosed();
}
/*
* cim连接服务器失败事件
*/
if (intent.getAction().equals(CIMConstant.IntentAction.ACTION_CONNECTION_FAILED)) {
long interval = intent.getLongExtra("interval", CIMConstant.RECONN_INTERVAL_TIME);
String exceptionName = intent.getStringExtra(Exception.class.getName());
onConnectionFailed(exceptionName, interval);
}
/*
* cim连接服务器成功事件
*/
if (intent.getAction().equals(CIMConstant.IntentAction.ACTION_CONNECTION_SUCCESSED)) {
onInnerConnectionSuccessed();
}
/*
* 收到推送消息事件
*/
if (intent.getAction().equals(CIMConstant.IntentAction.ACTION_MESSAGE_RECEIVED)) {
onInnerMessageReceived((Message) intent.getSerializableExtra(Message.class.getName()), intent);
}
/*
* 获取收到replybody成功事件
*/
if (intent.getAction().equals(CIMConstant.IntentAction.ACTION_REPLY_RECEIVED)) {
onReplyReceived((ReplyBody) intent.getSerializableExtra(ReplyBody.class.getName()));
}
/*
* 获取sendbody发送失败事件
*/
if (intent.getAction().equals(CIMConstant.IntentAction.ACTION_SENT_FAILED)) {
String exceptionName = intent.getStringExtra(Exception.class.getName());
SentBody sentBody = (SentBody) intent.getSerializableExtra(SentBody.class.getName());
onSentFailed(exceptionName, sentBody);
}
/*
* 获取sendbody发送成功事件
*/
if (intent.getAction().equals(CIMConstant.IntentAction.ACTION_SENT_SUCCESSED)) {
onSentSucceed((SentBody) intent.getSerializableExtra(SentBody.class.getName()));
}
/*
* 重新连接,如果断开的话
*/
if (intent.getAction().equals(CIMConstant.IntentAction.ACTION_CONNECTION_RECOVERY)) {
CIMPushManager.connect(context, 0);
}
}
private void startPushService() {
Intent intent = new Intent(context, CIMPushService.class);
intent.setAction(CIMPushManager.ACTION_ACTIVATE_PUSH_SERVICE);
context.startService(intent);
}
private void onInnerConnectionClosed() {
CIMCacheManager.putBoolean(context, CIMCacheManager.KEY_CIM_CONNECTION_STATE, false);
if (CIMConnectorManager.isNetworkConnected(context)) {
CIMPushManager.connect(context, 0);
}
onConnectionClosed();
}
private void onConnectionFailed(String exceptionName, long reinterval) {
if (CIMConnectorManager.isNetworkConnected(context)) {
onConnectionFailed();
CIMPushManager.connect(context, reinterval);
}
}
private void onInnerConnectionSuccessed() {
CIMCacheManager.putBoolean(context, CIMCacheManager.KEY_CIM_CONNECTION_STATE, true);
boolean autoBind = CIMPushManager.autoBindAccount(context);
onConnectionSuccessed(autoBind);
}
private void onDevicesNetworkChanged(NetworkInfo info) {
if (info != null) {
CIMPushManager.connect(context, 0);
}
onNetworkChanged(info);
}
private void onInnerMessageReceived(com.farsunset.cim.sdk.android.model.Message message, Intent intent) {
if (isForceOfflineMessage(message.getAction())) {
CIMPushManager.stop(context);
}
onMessageReceived(message, intent);
}
private boolean isForceOfflineMessage(String action) {
return CIMConstant.MessageAction.ACTION_999.equals(action);
}
private void onSentFailed(String exceptionName, SentBody body) {
// 与服务端端开链接,重新连接
if (SessionClosedException.class.getSimpleName().equals(exceptionName)) {
CIMPushManager.connect(context, 0);
} else {
// 发送失败 重新发送
CIMPushManager.sendRequest(context, body);
}
}
public abstract void onMessageReceived(com.farsunset.cim.sdk.android.model.Message message, Intent intent);
public void onNetworkChanged(NetworkInfo info) {
CIMListenerManager.notifyOnNetworkChanged(info);
}
public void onConnectionSuccessed(boolean hasAutoBind) {
CIMListenerManager.notifyOnConnectionSuccessed(hasAutoBind);
}
public void onConnectionClosed() {
CIMListenerManager.notifyOnConnectionClosed();
}
public void onConnectionFailed() {
CIMListenerManager.notifyOnConnectionFailed();
}
public void onReplyReceived(ReplyBody body) {
CIMListenerManager.notifyOnReplyReceived(body);
}
public void onSentSucceed(SentBody body) {
CIMListenerManager.notifyOnSentSucceed(body);
}
}
| [
"3979434@qq.com"
] | 3979434@qq.com |
7ab7f4c9e2254290c73b00b507bda446b0893319 | b609b63d1e0c65104eeaabba75d752229b602346 | /cloud-suntak/cloud-suntak-ehr/src/main/java/com/suntak/cloud/ehr/service/impl/LossRateServiceImpl.java | 9b93cea35f078ea72c9ca680154b7d6c71bc2f4b | [] | no_license | szmengran/cloud | d695e6ff1a3484879891d3da3995c006d7960221 | 5d24c2956850247a43e796d18cd3b4077aef0ca3 | refs/heads/master | 2022-12-08T00:04:11.230643 | 2020-01-21T08:58:40 | 2020-01-21T08:58:40 | 124,967,495 | 1 | 1 | null | 2022-11-16T11:35:46 | 2018-03-13T00:12:26 | Java | UTF-8 | Java | false | false | 2,022 | java | package com.suntak.cloud.ehr.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import com.suntak.cloud.ehr.entity.LossRate;
import com.suntak.cloud.ehr.service.LossRateService;
import com.szmengran.common.orm.dao.AbstractDao;
/**
* @Package com.suntak.cloud.ehr.service.impl
* @Description: 员工离职情况查询服务
* @date 2018年7月16日 上午10:48:03
* @author <a href="mailto:android_li@sina.cn">Joe</a>
*/
@Service("lossRateService")
public class LossRateServiceImpl implements LossRateService{
@Autowired
@Qualifier("oracleDao")
AbstractDao abstractDao;
@Override
public List<LossRate> findByConditions(String queryDate, String companycode) throws Exception{
String startmonth = queryDate.substring(0, 8)+"01";
Object[] params = new Object[4];
params[0] = queryDate;
params[1] = queryDate;
params[2] = companycode;
params[3] = queryDate;
StringBuffer strSql = new StringBuffer();
strSql.append("SELECT a.DEPTNAME,a.KENAME,")
.append(" count(1) startmonth,")
.append(" sum(case when a.EXITDATE is null then 1")
.append(" when a.EXITDATE >= ")
.append(" ? then 1")
.append(" else 0 end")
.append(" ) afterdaymonth,")
.append(" sum(case when a.EXITDATE BETWEEN ")
.append("'").append(startmonth).append("'")
.append(" and ? then 1")
.append(" else 0 end")
.append(" ) betweendaymonth")
.append(" FROM tb_v_rpt_emp_info a where")
.append(" (a.EXITDATE is null or a.EXITDATE >= ")
.append("'").append(startmonth).append("')")
.append(" and a.companycode=?")
.append(" and a.LABORDATE<=to_date(?,'yyyy-MM-dd')")
.append(" GROUP BY a.DEPTNAME,a.KENAME")
.append(" order BY a.DEPTNAME,a.KENAME");
return abstractDao.findBySql(LossRate.class, strSql.toString(), params);
}
}
| [
"android_li@sina.cn"
] | android_li@sina.cn |
55338f7b953ed88197c626aa8a52b349322407e1 | 8fd72c21369ee6c51ef36d6d681fd4e7b568cace | /AjaxJson2/src/main/java/com/xie/domain/Administrator.java | 408d1fcdae34189c23a85396cb32e33725e29671 | [] | no_license | zhangyong9704/NewsManagement | c86266f36fc475435670ec12c4df090571442112 | 4b8cc6a2f0dcf60aa22e281c0f1749123e3b48e7 | refs/heads/master | 2021-05-17T15:36:21.666677 | 2020-03-12T02:27:12 | 2020-03-12T02:27:12 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 985 | java | package com.xie.domain;
import java.io.Serializable;
public class Administrator implements Serializable {
private Integer admin_id;
private String admin_name;
private String admin_password;
public Integer getAdmin_id() {
return admin_id;
}
public void setAdmin_id(Integer admin_id) {
this.admin_id = admin_id;
}
public String getAdmin_name() {
return admin_name;
}
public void setAdmin_name(String admin_name) {
this.admin_name = admin_name;
}
public String getAdmin_password() {
return admin_password;
}
public void setAdmin_password(String admin_password) {
this.admin_password = admin_password;
}
@Override
public String toString() {
return "Administrator{" +
"admin_id=" + admin_id +
", admin_name='" + admin_name + '\'' +
", admin_password='" + admin_password + '\'' +
'}';
}
}
| [
"1442355198@qq.com"
] | 1442355198@qq.com |
babe677572e330285d557cf7d2bfba520daa6416 | da7a7cd80cdb91cf683c95ff94c2745d821b45d0 | /src/test/java/com/ubiquisoft/evaluation/diagnosticdata/missingpart/CommonMissingPartDataTestMembers.java | 9d4d7b4aa540c6ded04439d40e0eb811e238a2a2 | [] | no_license | lderienzo/CarRepairDiagnostics | 59551ba057d6599e58da505657be8e153e54fd8d | 8f26e9b631e184cdd41b92bc52be1db52f457195 | refs/heads/master | 2020-08-17T00:15:48.179308 | 2019-10-25T16:01:28 | 2019-10-25T16:01:28 | 215,577,225 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 202 | java | package com.ubiquisoft.evaluation.diagnosticdata.missingpart;
class CommonMissingPartDataTestMembers {
public static final MissingPartDataExtractor EXTRACTOR = new MissingPartDataExtractor();
}
| [
"javasoftwarearchitect@gmail.com"
] | javasoftwarearchitect@gmail.com |
e936c9b93c6bd498bafbc85e64647bb1c6c81491 | 8efe9205b6d75499f2d00c23943501ba5ba7c2c9 | /src/main/java/com/bhs/springboot/dto/AreaStats.java | ec8f21d9649b9320a8a88a1e6cf95922559e383f | [] | no_license | morba9850/springBootPrj | 96fc866ecbb5e891689b39622d7eaa8189c48192 | 67509602b4b1b6bd38a14a0674ce03ed80636c0e | refs/heads/master | 2021-01-02T16:14:56.522740 | 2020-06-25T01:03:28 | 2020-06-25T01:03:28 | 239,698,154 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 239 | java | package com.bhs.springboot.dto;
import lombok.Builder;
import lombok.Getter;
import lombok.ToString;
@ToString
@Builder
@Getter
public class AreaStats {
private String area;
private String weather;
private String img;
}
| [
"morba9850@naver.com"
] | morba9850@naver.com |
636cfc63422706aee3495c51c4a8f8973eccb895 | d880de435f1b654c52bbc916f93f794426c052a7 | /src/main/java/org/yawlfoundation/yawl/resourcing/jsf/SessionTimeoutFilter.java | c0da5e492348b224aa70652cebdb665c313904b9 | [] | no_license | itiu/yawl-editor-zmq | f76b865c4b545990eb1ed62cd6323234fb2f2d4c | bc459a34108f33df121d205e358a1a25dc5ac405 | refs/heads/master | 2020-05-29T09:55:15.670624 | 2011-09-26T14:40:15 | 2011-09-26T14:40:15 | 2,443,701 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,147 | java | /*
* Copyright (c) 2004-2011 The YAWL Foundation. All rights reserved.
* The YAWL Foundation is a collaboration of individuals and
* organisations who are committed to improving workflow technology.
*
* This file is part of YAWL. YAWL is free software: you can
* redistribute it and/or modify it under the terms of the GNU Lesser
* General Public License as published by the Free Software Foundation.
*
* YAWL is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
* Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with YAWL. If not, see <http://www.gnu.org/licenses/>.
*/
package org.yawlfoundation.yawl.resourcing.jsf;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
* Redirects a user action to the login page after a session timeout
*
* Author: Michael Adams
* Date: 14/03/2008
*
* Based on code sourced from:
* http://techieexchange.blogspot.com/2008/02/jsf-session-expiry-timeout-solution.html
*/
public class SessionTimeoutFilter implements Filter {
private String _timeoutPage = "/sessiontimeout.html";
private Logger _log = Logger.getLogger(SessionTimeoutFilter.class);
// Implemented interface methods //
public void init(FilterConfig filterConfig) throws ServletException { }
public void destroy() { }
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain filterChain) throws IOException, ServletException {
if ((request instanceof HttpServletRequest) &&
(response instanceof HttpServletResponse)) {
HttpServletRequest httpRequest = (HttpServletRequest) request;
HttpServletResponse httpResponse = (HttpServletResponse) response;
// avoid infinite loop from login page back to timeout page
if (! isLoginPageRequest(httpRequest)) {
if (isInvalidSession(httpRequest) && (! isRSSFormRequest(httpRequest))) {
_log.warn("User session has expired");
String url = httpRequest.getContextPath() + _timeoutPage;
httpResponse.sendRedirect(url);
return;
}
}
}
filterChain.doFilter(request, response);
}
private boolean isLoginPageRequest(HttpServletRequest request) {
return StringUtils.contains(request.getRequestURI(), "Login");
}
private boolean isRSSFormRequest(HttpServletRequest request) {
return StringUtils.contains(request.getRequestURI(), "rssFormViewer");
}
private boolean isInvalidSession(HttpServletRequest httpServletRequest) {
return (httpServletRequest.getRequestedSessionId() != null) &&
!httpServletRequest.isRequestedSessionIdValid();
}
}
| [
"ValeriyBushenev@gmail.com"
] | ValeriyBushenev@gmail.com |
abf03013b5880684fc952941edc5606b1c15d589 | 3955f3bc4b1e9c41ffabb34fcdbfbfb3a8b2f77c | /bizcore/WEB-INF/youbenben_core_src/com/youbenben/youbenben/leavetype/LeaveTypeManager.java | fcdd1bb98e9bf76824988b90132c7d8e05191509 | [] | no_license | 1342190832/youbenben | c9ba34117b30988419d4d053a35960f35cd2c3f0 | f68fb29f17ff4f74b0de071fe11bc9fb10fd8744 | refs/heads/master | 2022-04-25T10:17:48.674515 | 2020-04-25T14:22:40 | 2020-04-25T14:22:40 | 258,133,780 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,773 | java |
package com.youbenben.youbenben.leavetype;
import java.math.BigDecimal;
import java.util.Date;
import java.util.Map;
import com.terapico.caf.DateTime;
import com.terapico.caf.Images;
import com.youbenben.youbenben.YoubenbenUserContext;
import com.youbenben.youbenben.BaseEntity;
import com.youbenben.youbenben.BaseManager;
import com.youbenben.youbenben.SmartList;
public interface LeaveTypeManager extends BaseManager{
public LeaveType createLeaveType(YoubenbenUserContext userContext, String code,String companyId,String description,String detailDescription) throws Exception;
public LeaveType updateLeaveType(YoubenbenUserContext userContext,String leaveTypeId, int leaveTypeVersion, String property, String newValueExpr,String [] tokensExpr) throws Exception;
public LeaveType loadLeaveType(YoubenbenUserContext userContext, String leaveTypeId, String [] tokensExpr) throws Exception;
public LeaveType internalSaveLeaveType(YoubenbenUserContext userContext, LeaveType leaveType) throws Exception;
public LeaveType internalSaveLeaveType(YoubenbenUserContext userContext, LeaveType leaveType,Map<String,Object>option) throws Exception;
public LeaveType transferToAnotherCompany(YoubenbenUserContext userContext, String leaveTypeId, String anotherCompanyId) throws Exception;
public void delete(YoubenbenUserContext userContext, String leaveTypeId, int version) throws Exception;
public int deleteAll(YoubenbenUserContext userContext, String secureCode ) throws Exception;
public void onNewInstanceCreated(YoubenbenUserContext userContext, LeaveType newCreated)throws Exception;
/*======================================================DATA MAINTENANCE===========================================================*/
//public EmployeeLeaveManager getEmployeeLeaveManager(YoubenbenUserContext userContext, String leaveTypeId, String whoId, int leaveDurationHour, String remark ,String [] tokensExpr) throws Exception;
public LeaveType addEmployeeLeave(YoubenbenUserContext userContext, String leaveTypeId, String whoId, int leaveDurationHour, String remark , String [] tokensExpr) throws Exception;
public LeaveType removeEmployeeLeave(YoubenbenUserContext userContext, String leaveTypeId, String employeeLeaveId, int employeeLeaveVersion,String [] tokensExpr) throws Exception;
public LeaveType updateEmployeeLeave(YoubenbenUserContext userContext, String leaveTypeId, String employeeLeaveId, int employeeLeaveVersion, String property, String newValueExpr,String [] tokensExpr) throws Exception;
/*
*/
public Object listByCompany(YoubenbenUserContext userContext,String companyId) throws Exception;
public Object listPageByCompany(YoubenbenUserContext userContext,String companyId, int start, int count) throws Exception;
}
| [
"1342190832@qq.com"
] | 1342190832@qq.com |
c7ea5e7b30c70bc68fbecdbab3abff3ad45c966a | 1cb750c87efcab7c749b2da57e8df884c6206291 | /src/main/java/master/spring/mvc/controller/TwitterController.java | 69423fccebeab4ccd8bb727e457b75f2c32af3da | [] | no_license | UmarHussain/master-spring-mvc | cdcfcc268e36d64f131e7ad95b6cd624205396d7 | 37f53a54c0140ec0a64dc65e823941dd2b696b9c | refs/heads/master | 2020-09-14T19:02:37.822510 | 2016-09-06T11:58:23 | 2016-09-06T11:58:23 | 67,420,470 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 961 | java | package master.spring.mvc.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.social.twitter.api.SearchResults;
import org.springframework.social.twitter.api.Twitter;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
* Created by bv on 9/6/2016.
*/
@Controller
public class TwitterController {
@Autowired
private Twitter twitter;
@RequestMapping("/twitter")
public String helloTwitter(@RequestParam(defaultValue =
"masterSpringMVC4") String search, Model model){
SearchResults searchResults = twitter.searchOperations().
search(search);
String text = searchResults.getTweets().get(0).getText();
model.addAttribute("message", text);
return "resultPage";
}
}
| [
"umar.hussain@binaryvibes.com"
] | umar.hussain@binaryvibes.com |
67ca29256aab0d69a6e023e56dc71693a82e7a2a | 3e2d46639d2b6242ee6f95c8f594c8c33867afa6 | /src/com/korestudios/royalrenegades/states/StateManager.java | a2782c535bf2194fb4a247687b10a6a3f4c1b0f5 | [] | no_license | joeb15/RoyalRenegades | 565f32b41f107ca9f63dcad313b849b48baf0263 | 2b1e09570a152918f694da735dd11812c5264651 | refs/heads/master | 2021-01-15T22:39:21.518119 | 2017-08-10T22:25:23 | 2017-08-10T22:25:23 | 99,906,283 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 831 | java | package com.korestudios.royalrenegades.states;
import com.korestudios.royalrenegades.guis.GuiManager;
import com.korestudios.royalrenegades.input.Input;
import com.korestudios.royalrenegades.shaders.Shader;
import com.korestudios.royalrenegades.sound.SoundManager;
import com.korestudios.royalrenegades.utils.time.TimerUtils;
public class StateManager {
public static State gameState = new GameState();
public static State introState = new SplashState();
public static State CURRENT_STATE = introState;
public static void switchState(State state){
CURRENT_STATE.destroy();
GuiManager.clearGuis();
TimerUtils.clearTimers();
Input.clearListeners();
SoundManager.clearSources();
CURRENT_STATE=state;
CURRENT_STATE.init();
Shader.loadAll();
}
}
| [
"joebanko15@gmail.com"
] | joebanko15@gmail.com |
5add928693be375da9387d0d47a55db22d930d0e | 2657b26505c3e1848ce83b6cefa9b01967148842 | /programmers/level1/group1/study30.java | ae34c794f6ac0f536cee6a2b223a1ac38589e277 | [] | no_license | yelime/argo_study | 9ccda04d0230762179804af715ea6eecf0d8c308 | 7c352c5011230172700fc688de8e480ac6ea1b6f | refs/heads/main | 2023-07-10T04:05:02.473963 | 2021-08-06T12:48:53 | 2021-08-06T12:48:53 | 357,586,146 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,759 | java | /** programmers 문제풀이
*
* ==========================================
* 서울에서 김서방 찾기
*
* 문제 설명
* String형 배열 seoul의 element중 "Kim"의 위치 x를 찾아, "김서방은 x에 있다"는
* String을 반환하는 함수, solution을 완성하세요. seoul에 "Kim"은 오직 한 번만 나
* 타나며 잘못된 값이 입력되는 경우는 없습니다.
*
* 제한 사항
* seoul은 길이 1 이상, 1000 이하인 배열입니다.
* seoul의 원소는 길이 1 이상, 20 이하인 문자열입니다.
* "Kim"은 반드시 seoul 안에 포함되어 있습니다.
*
* 입출력 예
* seoul return
* ["Jane", "Kim"] "김서방은 1에 있다"
* ===================================
* 이 문제는 "Kim" 문자를 찾는 것이다.
*
*/
public class study30 {
public String solution(String[] seoul) {
int idx = -1;
for(String tmp : seoul){
idx++;
if(tmp.equals("Kim")){
return "김서방은 idx에 있다".replaceAll("idx",String.valueOf(idx));
}
}
return "";
}
}
/**
* 실행 결과
* 테스트 1 〉 통과 (0.31ms, 52.4MB)
* 테스트 2 〉 통과 (0.32ms, 52.4MB)
* 테스트 3 〉 통과 (0.31ms, 52.5MB)
* 테스트 4 〉 통과 (0.31ms, 52.3MB)
* 테스트 5 〉 통과 (0.28ms, 52.5MB)
* 테스트 6 〉 통과 (0.28ms, 52MB)
* 테스트 7 〉 통과 (0.28ms, 52.3MB)
* 테스트 8 〉 통과 (0.26ms, 51.9MB)
* 테스트 9 〉 통과 (0.27ms, 52.9MB)
* 테스트 10 〉 통과 (0.27ms, 52.4MB)
* 테스트 11 〉 통과 (0.24ms, 52.9MB)
* 테스트 12 〉 통과 (0.31ms, 53.4MB)
* 테스트 13 〉 통과 (0.34ms, 52.5MB)
* 테스트 14 〉 통과 (0.31ms, 53.3MB)
*/
| [
"yelime1226@naver.com"
] | yelime1226@naver.com |
736905cf5fcfa39f1c24a5ef7f89191b42ef4cdc | a753a36b871a476759cebc41ff0d73eb4b71737d | /CSCE 156H/OneBasketFinance/src/unl/cse/Portfolio.java | ccd9f0ba74b8d008a82a000547e6de10e99b715c | [] | no_license | jared-ott/OneBasketFinance | cae2ef24d7d2c4ff00713c4c4b7b2c2f4bf5b039 | 122b45a97cd431eb28966b59230d1fc4695be0c5 | refs/heads/master | 2021-01-19T14:50:20.190556 | 2017-04-28T05:09:43 | 2017-04-28T05:09:43 | 86,640,043 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 3,887 | java | package unl.cse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
public class Portfolio {
private String portfolioCode;
private Person owner;
private Person manager;
private Person beneficiary;
private Map<Asset, Double> assetMap;
private double fees;
private double commissions;
private double aggregateRisk;
private double expectedReturn;
private double totalValue;
//Constructor that calculates the basic info
public Portfolio(String portfolioCode, Person owner, Person manager, Person beneficiary, Map<Asset, Double> assetMap) {
super();
this.portfolioCode = portfolioCode;
this.owner = owner;
this.manager = manager;
this.beneficiary = beneficiary;
this.assetMap = assetMap;
if (!(assetMap == null)){
calculateAssetInfo(assetMap);
}
this.commissions = ((Broker)manager).calculateCommission(((Broker)manager).getType(), this.expectedReturn);
try{
this.fees = ((Broker)manager).calculateFees(((Broker)manager).getType(), this.assetMap.size());
} catch (Exception e) {
this.fees = 0;
}
}
//Calculates basic info for the portfolio
private void calculateAssetInfo(Map<Asset, Double> assetMap){
this.aggregateRisk = 0;
this.expectedReturn = 0;
this.totalValue = 0;
for (Asset a : assetMap.keySet()){
this.expectedReturn += a.getExpectedReturn(assetMap.get(a));
this.totalValue += a.getTotalValue(assetMap.get(a));
}
this.aggregateRisk = calculateRisk();
}
//Calculates the aggregate risk of the entire portfolio
private double calculateRisk() {
double totalRisk = 0.0;
double risk = 0.0;
double totalValues = 0.0;
Map<Double, Double> values = new HashMap<Double, Double>();
for(Asset a : assetMap.keySet()) {
double value = a.getTotalValue(assetMap.get(a));
risk = a.getRiskType(value);
values.put(value , risk);
totalValues += value;
}
for(Double v : values.keySet()) {
double r = values.get(v);
totalRisk += r*v/totalValues;
}
return totalRisk;
}
//Returns the basicInfo of each portfolio
public ArrayList<Object> getBasicInfo(){
ArrayList<Object> list = new ArrayList<Object>();
list.add(this.portfolioCode);
list.add(this.owner);
list.add(this.manager);
list.add(this.fees);
list.add(this.commissions);
list.add(this.aggregateRisk);
list.add(this.expectedReturn);
list.add(this.totalValue);
return list;
}
public Person getOwner() {
return owner;
}
//Returns a String with the info from each portfolio
public String printPortfolio(){
StringBuilder sb = new StringBuilder();
sb.append("\nPortfolio " + this.portfolioCode + "\n")
.append("------------------------------------------\n")
.append("Owner: " + this.owner.getNameStringLF() + "\n")
.append("Manager: " + this.manager.getNameStringLF() + "\n");
if(this.beneficiary != null) {
sb.append("Beneficiary: " + this.beneficiary.getNameStringLF() + "\n");
}
sb.append("Assets\n");
sb.append("Code Asset Return Rate Risk Annual Return Value\n");
if (assetMap != null){
for(Asset a : assetMap.keySet()){
double value = a.getTotalValue(assetMap.get(a));
double risk = a.getRiskType(value);
double retRate = a.calculateROR(assetMap.get(a));
double annReturn = a.getExpectedReturn(assetMap.get(a));
sb.append((String.format("%-10s %-31s %10.2f%% %13.4f $%12.2f $%12.2f\n",
a.code, a.label, retRate, risk, annReturn, value)));
}
}
sb.append(" --------------------------------------------\n")
.append(" Totals ")
.append(String.format("%13.4f $%12.2f $%12.2f\n",
this.aggregateRisk, this.expectedReturn, this.totalValue));
return sb.toString();
}
}
| [
"bob123jared@gmail.com"
] | bob123jared@gmail.com |
5280fb795486e3ff2aba20c8712ce46b62e13b66 | 32f38cd53372ba374c6dab6cc27af78f0a1b0190 | /app/src/main/java/com/alipay/mobile/common/logging/b.java | 648056a198bf268807282f815442e77ac92dca30 | [] | no_license | shuixi2013/AmapCode | 9ea7aefb42e0413f348f238f0721c93245f4eac6 | 1a3a8d4dddfcc5439df8df570000cca12b15186a | refs/heads/master | 2023-06-06T23:08:57.391040 | 2019-08-29T04:36:02 | 2019-08-29T04:36:02 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 337 | java | package com.alipay.mobile.common.logging;
/* compiled from: LogContextImpl */
final class b implements Runnable {
final /* synthetic */ LogContextImpl a;
b(LogContextImpl this$0) {
this.a = this$0;
}
public final void run() {
this.a.p.a("applog", true);
this.a.p.a("trafficLog", true);
}
}
| [
"hubert.yang@nf-3.com"
] | hubert.yang@nf-3.com |
556827c9f43dfc0556fa20f65776537e53a34aac | 7b6b3f16259e45b7669c578b23959be821f13d78 | /src/main/java/com/sylla/peedika/peedikasms/model/Users.java | 1eefb3a8bee881937bd6a77ee6177dae71338ec5 | [] | no_license | arjunsivasankaran/peedikasms | 0721a3f610cacf0000439487420b02b53de57f7a | bd10d936d75959e5eea893aee484c32a924eb817 | refs/heads/master | 2023-05-27T04:35:08.663944 | 2021-06-15T06:37:13 | 2021-06-15T06:37:13 | 376,782,876 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 577 | java | package com.sylla.peedika.peedikasms.model;
import com.fasterxml.jackson.annotation.JsonProperty;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity(name = "USERS")
@Table(name = "USERS")
public class Users {
@Id
@Column(name = "PHONENUMBER")
@JsonProperty("phonenumber")
private String phoneNumber;
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
}
| [
"informarjunspillai@gmail.com"
] | informarjunspillai@gmail.com |
f70a1cb3a5f03ba9ef12a625694a540d1311e27c | 43185bdc9fe990ac65d9a23d1c5b0c4da578bbb9 | /src/main/java/src/redtalent/converters/StringToProjectConverter.java | 9543a8bec2ecc2484e1f935b581002bdeb8ead33 | [] | no_license | nataliamf96/RedTalent | 66b7a9609d35d1975865d351211f2c41f16ccdf2 | 108f5ee75ced306730e5da1055b42859482157fd | refs/heads/master | 2020-03-30T01:46:10.212239 | 2018-12-02T20:17:16 | 2018-12-02T20:17:16 | 150,593,952 | 0 | 0 | null | 2018-10-14T18:38:42 | 2018-09-27T13:47:12 | JavaScript | UTF-8 | Java | false | false | 1,077 | java | package src.redtalent.converters;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.core.convert.converter.Converter;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import src.redtalent.domain.Project;
import src.redtalent.repositories.ProjectRepository;
import java.util.Optional;
@Component
@Transactional
@Configuration
public class StringToProjectConverter implements Converter<String, Project>{
@Autowired
ProjectRepository projectRepository;
public Project convert(String text) {
Optional<Project> result = null;
try {
if (StringUtils.isEmpty(text)) {
result = null;
} else {
result = projectRepository.findById(text);
}
} catch (Exception oops) {
throw new IllegalArgumentException(oops);
}
return result.get();
}
}
| [
"pireonico4@gmail.com"
] | pireonico4@gmail.com |
1f57170f4f7252c2cd8f51b8cf01680b4324d763 | a944ae490d6f5256a95d4b90f715d5bbee5096d7 | /DP-LSS-LCS-CC/src/assign5/LrgSubM.java | 773fad505fa373383c9f5c71e51741f45b4ba58e | [] | no_license | renanGit/DP-LSS-LCS-CC | 2e446241978f737ff1dd8c095e488c0139e48fd8 | 88d158b9ec10d0e0bf68d3cde71ac6e3de6b041e | refs/heads/master | 2016-09-05T10:35:02.717380 | 2014-12-21T20:55:18 | 2014-12-21T20:55:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,961 | java |
package assign5;
import java.io.BufferedReader;
import java.util.ArrayList;
/**
* @author Renan Santana
*/
public class LrgSubM {
private BufferedReader br;
LrgSubM(BufferedReader br){
this.br = br;
}
class Value{
private boolean v;
private int c;
Value(boolean v){ this.v = v; c = 0; }
public boolean getV(){ return v; }
public void setC(int c){ this.c = c; }
public int getC(){ return c; }
}
public void largestSubMatrix(){
String line;
int size;
int n1 ,n2 ,n3 , max = 0, max_j = 0, max_i = 0;
ArrayList<Value> r, prev_r;
ArrayList<ArrayList<Value>> table = new ArrayList();
try{
line = br.readLine();
size = line.length();
// Reading the File
do{
r = new ArrayList(size);
// loop the cols
for (int i = 0; i < size; i++) {
r.add(new Value(line.charAt(i) == '1'));
// getV is boolean if 1 or 0
// if true set the count to 1
if(r.get(i).getV()){ r.get(i).setC(1); }
}
table.add(r);
}while( (line = br.readLine()) != null );
}catch(Exception e){ System.out.println("Input error."); return; }
// right now the table is full of 1's if the value is 1
// get the first row
r = table.get(0);
for (int i = 1; i < table.size(); i++) {
// we hold on to the prev row and the current row
prev_r = r;
r = table.get(i);
for (int j = 1; j < size; j++) {
// if the table is 1 1 we enter here
// 1 (1)
if(prev_r.get(j-1).getV() && prev_r.get(j).getV() &&
r.get(j-1).getV() && r.get(j).getV()){
// get the top left , top , left count
// we need to compare to get the min of these
n1 = prev_r.get(j-1).getC();
n2 = prev_r.get(j).getC();
n3 = r.get(j-1).getC();
if(n1 <= n2 && n1 <= n3){ r.get(j).setC(n1 + 1); }
else if(n2 <= n1 && n2 <= n3){ r.get(j).setC(n2 + 1); }
else{ r.get(j).setC(n3 + 1); }
// keep track of the max
if(r.get(j).getC() > max){
max = r.get(j).getC();
max_j = j;
max_i = i;
}
}
}
}
System.out.println("Starting index: (" + (max_i+1-max) + ", " + (max_j+1-max)+")");
System.out.println("Ending index: (" + (max_i+1) + ", " + (max_j+1)+")");
System.out.println("Size of sub-square: " + max + "x" + max);
}
}
| [
"phy.renan@gmail.com"
] | phy.renan@gmail.com |
71434d9c1ec44a5f6a0ce6ffea8b90d53b8d751b | 7a4900dbff05e6afcb4ba7fe71de4c4aaee6dffd | /src/main/java/com/example/abw/exception/ControllerAdvice.java | 6335796ebb31f9d8e275998bd63df57a6a58abcf | [] | no_license | Eugene-Korenevsky/abw | e13926c3b6e86908e73a61af509acd138c024ee0 | 1a36699bd3daa9507add994c1d8faae2a0686e39 | refs/heads/main | 2023-08-23T01:11:26.037287 | 2021-11-01T21:47:08 | 2021-11-01T21:47:08 | 347,715,238 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,057 | java | package com.example.abw.exception;
import com.example.abw.exception.security.PrivacyViolationException;
import com.example.abw.exception.user.EmailIsAlreadyExistException;
import com.example.abw.exception.user.UserOrPasswordException;
import com.example.abw.exception.entities.ResourceNotFoundException;
import com.example.abw.exception.validation.ValidationException;
import org.springframework.data.mapping.PropertyReferenceException;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.ExceptionHandler;
@org.springframework.web.bind.annotation.ControllerAdvice
public class ControllerAdvice {
@ExceptionHandler(PropertyReferenceException.class)
public ResponseEntity<?> pageableParamsHandler(PropertyReferenceException e) {
return new ResponseEntity<>(e.getMessage(), HttpStatus.BAD_REQUEST);
}
@ExceptionHandler(ResourceNotFoundException.class)
public ResponseEntity<?> resourceNotFoundHandler(ResourceNotFoundException e) {
return new ResponseEntity<>(e.getMessage(), HttpStatus.NOT_FOUND);
}
@ExceptionHandler(ValidationException.class)
public ResponseEntity<?> validationErrorHandler(ValidationException e) {
return new ResponseEntity<>(e.getFullMessage(), HttpStatus.BAD_REQUEST);
}
@ExceptionHandler(EmailIsAlreadyExistException.class)
public ResponseEntity<?> emailExistHandler(EmailIsAlreadyExistException e) {
return new ResponseEntity<>(e.getMessage(), HttpStatus.BAD_REQUEST);
}
@ExceptionHandler(UserOrPasswordException.class)
public ResponseEntity<?> wrongUserOrPasswordHandler(UserOrPasswordException e) {
return new ResponseEntity<>(e.getMessage(), HttpStatus.BAD_REQUEST);
}
@ExceptionHandler(PrivacyViolationException.class)
public ResponseEntity<?> privacyViolationHandler(PrivacyViolationException e) {
return new ResponseEntity<>(e.getMessage(), HttpStatus.BAD_REQUEST);
}
}
| [
"kara-91@tut.by"
] | kara-91@tut.by |
733da1bd4573ecc24007cddc424fa3665f28066d | 74d590a44cd6273ed8f50b015aa644364936b74b | /Wellness_Backend/src/main/java/com/alpha/Wellness_Backend/model/UserFriend.java | f276f201e794651f04098e9ede2564df1b907ceb | [] | no_license | kanikaniyan/PROJ2 | 934d4079f1b193d63044b194acfd33784a488f26 | 9ba9188af0610277612735163f815e7746572ae6 | refs/heads/main | 2023-03-20T22:31:38.549363 | 2021-03-15T19:27:47 | 2021-03-15T19:27:47 | 324,744,906 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 72 | java | package com.alpha.Wellness_Backend.model;
public class UserFriend {
}
| [
"kkaniyan96@gmail.com"
] | kkaniyan96@gmail.com |
cd8e5d99d36e799357e8d42e5e664643775eba0e | 63058540a287539ff2663e8a7d2dc83acf3262e8 | /app/src/main/java/monsterstack/io/partner/menu/control/ProfileControl.java | e8708c3830f6b7ab2aa134c8e2e5e65c68508ef8 | [] | no_license | monsterstack/partnerapp | 6146bb56d1f8ca9369e27e379a46160a33b11c30 | 1da6131992c961d596531021222e5beae95aa873 | refs/heads/master | 2020-03-17T17:38:20.111390 | 2018-07-31T12:32:02 | 2018-07-31T12:32:02 | 133,796,084 | 0 | 0 | null | 2018-05-20T21:03:02 | 2018-05-17T10:13:32 | Java | UTF-8 | Java | false | false | 147 | java | package monsterstack.io.partner.menu.control;
import monsterstack.io.partner.common.Control;
public interface ProfileControl extends Control {
}
| [
"zacharyrote@Zacharys-MacBook-Pro.local"
] | zacharyrote@Zacharys-MacBook-Pro.local |
04767e3d48613aaea19fd546efaddc56a304bed9 | 3bab81792c722411c542596fedc8e4b1d086c1a9 | /src/main/java/com/gome/maven/refactoring/rename/BindablePsiReference.java | ab22da956097cf16c855a2d4f578a8dfc7c03b7a | [] | no_license | nicholas879110/maven-code-check-plugin | 80d6810cc3c12a3b6c22e3eada331136e3d9a03e | 8162834e19ed0a06ae5240b5e11a365c0f80d0a0 | refs/heads/master | 2021-04-30T07:09:42.455482 | 2018-03-01T03:21:21 | 2018-03-01T03:21:21 | 121,457,530 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 925 | java | /*
* Copyright 2000-2009 JetBrains s.r.o.
*
* 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 com.gome.maven.refactoring.rename;
import com.gome.maven.psi.PsiReference;
/**
* Hacky marker interface to fix refactoring.
* Means that bindToElement() works properly.
* In fact, all references should be bindable.
*
* @author Dmitry Avdeev
*/
public interface BindablePsiReference extends PsiReference {
}
| [
"zhangliewei@gome.com.cn"
] | zhangliewei@gome.com.cn |
98e61e14c653b7136c905852c64a89e23df808a1 | 3f50982ca12e467b6a48ab2735bd889b5a2eb530 | /dianyu-web/src/main/java/com/haier/openplatform/ueditor/define/ActionMap.java | e909a1242834db21c4bd0e3f7df0a4be5be0ad5b | [] | no_license | 527088995/dianyu | 3c1229ca3bddc70ea20cfa733f5d25ee023a3131 | ff9de3c731b65ba5ef230c3e3137f24042bbe822 | refs/heads/master | 2021-01-20T16:48:13.932544 | 2019-01-31T08:19:58 | 2019-01-31T08:19:58 | 90,849,027 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,157 | java | package com.haier.openplatform.ueditor.define;
import java.util.HashMap;
import java.util.Map;
/**
* 定义请求action类型
*
* @author hancong03@baidu.com
*
*/
@SuppressWarnings("serial")
public final class ActionMap {
// 获取配置请求
public static final int CONFIG = 0;
public static final int UPLOAD_IMAGE = 1;
public static final int UPLOAD_SCRAWL = 2;
public static final int UPLOAD_VIDEO = 3;
public static final int UPLOAD_FILE = 4;
public static final int CATCH_IMAGE = 5;
public static final int LIST_FILE = 6;
public static final int LIST_IMAGE = 7;
public static final Map<String, Integer> mapping = new HashMap<String, Integer>() {{
put("config", ActionMap.CONFIG);
put("uploadimage", ActionMap.UPLOAD_IMAGE);
put("uploadscrawl", ActionMap.UPLOAD_SCRAWL);
put("uploadvideo", ActionMap.UPLOAD_VIDEO);
put("uploadfile", ActionMap.UPLOAD_FILE);
put("catchimage", ActionMap.CATCH_IMAGE);
put("listfile", ActionMap.LIST_FILE);
put("listimage", ActionMap.LIST_IMAGE);
}
};
public static int getType(String key) {
return ActionMap.mapping.get(key);
}
}
| [
"527088995@qq.com"
] | 527088995@qq.com |
b4c4ae50887c5572f2f909a1743dda0244893ad4 | 93258d798a10019571df2a88c9361f2db6b55854 | /src/main/java/com/util/EncodingFiter.java | 30a7ba4d4c2fcd11f7f2a0b1daced7b162167fbf | [] | no_license | HeMin-hub/pro_225 | ce0c48e3a6db6dc9588f5253fa7d10929a66dce0 | 68a4987b2072864d7672417bde13c786dc66b4cd | refs/heads/master | 2022-12-26T03:05:24.932230 | 2019-11-01T01:44:11 | 2019-11-01T01:44:11 | 218,892,063 | 0 | 0 | null | 2022-12-16T04:25:34 | 2019-11-01T01:42:27 | Java | UTF-8 | Java | false | false | 1,547 | java | package com.util;
import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.Map;
/**
* 中文乱码处理
*
*/
public class EncodingFiter implements Filter {
private String encoding = "UTF-8";// 默认字符集
public EncodingFiter() {
super();
}
public void destroy() {
}
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain)
throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) servletRequest;
HttpServletResponse response = (HttpServletResponse) servletResponse;
String method = request.getMethod();
if (method.equalsIgnoreCase("get")) {
Map<String, String[]> map = (Map<String, String[]>) request.getParameterMap();// 保存所有参数名=参数值(数组)的Map集合
for (String[] values : map.values()) {
for (int i = 0; i < values.length; i++) {
values[i] = new String(values[i].getBytes("ISO-8859-1"), this.encoding);
}
}
} else if (method.equalsIgnoreCase("post")) {
request.setCharacterEncoding(this.encoding);
}
response.setContentType("text/html;charset=" + this.encoding);
chain.doFilter(servletRequest, servletResponse);
}
public void init(FilterConfig filterConfig) throws ServletException {
String s = filterConfig.getInitParameter("encoding");// 读取web.xml文件中配置的字符集
if (null != s && !s.trim().equals("")) {
this.encoding = s.trim();
}
}
}
| [
"412495998@qq.com"
] | 412495998@qq.com |
2fef4c51998a3a543d7f37b48a81fca78f29fa66 | f1985b995c1146e674f8efcead2be08eb45dd47e | /src/main/java/com/mbyte/easy/admin/entity/TBloggerArticleOldRecords.java | edcfce1633527aadfce76db69f55b6483cade969 | [] | no_license | AI-LE/byte-easy | af3a3831b18d2ac4bda5ecd173f99206ead7dd05 | 1b6272b8f8080fb579b121e743ef6c9e66b5d817 | refs/heads/master | 2022-12-05T20:51:25.097965 | 2019-12-11T11:33:25 | 2019-12-11T11:33:25 | 227,349,167 | 0 | 0 | null | 2022-11-16T11:57:31 | 2019-12-11T11:24:40 | JavaScript | UTF-8 | Java | false | false | 666 | java | package com.mbyte.easy.admin.entity;
import com.mbyte.easy.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.time.LocalDateTime;
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
public class TBloggerArticleOldRecords extends BaseEntity {
private static final long serialVersionUID = 1L;
/**
* 文章关键字id
*/
private long kid;
/**
* 关键字
*/
private String keywords;
/**
* 创建时间
*/
private LocalDateTime createtime;
/**
* 区分文件时间戳
*/
private Long timejudge;
}
| [
"1503670796@qq.com"
] | 1503670796@qq.com |
7d6dc8e7f7f21a75ba487ce8fa5dfca68ec0c644 | 96d2b3c8dedd903228f2c6735cdc966dd88531d3 | /src/main/java/com/jperezmota/wsellfiliates/services/WordpressService.java | 9ede5381ae39d2897b2916e4128296fffe4fae63 | [] | no_license | jthedevio/WSellFiliates | 3ef077870f1560afedce67e742adcd773afeb227 | af6178ef71425d57e199728797fa59cea8e37e9e | refs/heads/master | 2023-04-14T04:56:14.468665 | 2019-01-15T05:26:58 | 2019-01-15T05:26:58 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 398 | java | package com.jperezmota.wsellfiliates.services;
import java.time.LocalDate;
import java.util.List;
import com.jperezmota.wsellfiliates.entity.wordpress.CouponSale;
public interface WordpressService {
public List<CouponSale> getSalesByCoupon(String coupon, LocalDate initialDate, LocalDate finalDate);
public void validateFilterData(String coupon, LocalDate initialDate, LocalDate finalDate);
}
| [
"jonathanperezmota@gmail.com"
] | jonathanperezmota@gmail.com |
57c38e4aa95f2c114934df0ee438199abc5f3678 | 4dbc3ee0d6664ab4e40294c0d885fb1a21170a8d | /app/src/main/java/com/example/yzbkaka/kakaAndroid/application/AppContext.java | 34f082affa61ee43fa71747310d0c11f8ce456f8 | [
"Apache-2.0"
] | permissive | yzbkaka/kakaAndroid | 750e834b55c44a314f1fda4aa26d167fcc2b4587 | b40dda6b0da75ba688e07c477d1ca62a2673884b | refs/heads/master | 2020-12-01T12:19:02.241105 | 2020-01-31T09:35:26 | 2020-01-31T09:35:26 | 230,622,395 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 835 | java | package com.example.yzbkaka.kakaAndroid.application;
import android.content.Context;
/**
* Created by yzbkaka on 19-12-29.
*/
/**
* 上下文context
*/
public class AppContext {
private static Context mContext;
private static AppContext mInstance;
private AppContext(Context mCon) {
mContext = mCon;
}
public static Context getContext() {
return mContext;
}
public static AppContext getInstance() {
return mInstance;
}
static void initialize(Context context) {
if (mInstance == null) {
synchronized (AppContext.class) {
if (mInstance == null) {
mInstance = new AppContext(context.getApplicationContext());
AppConfig.init(mContext);
}
}
}
}
}
| [
"yzbkaka@qq.com"
] | yzbkaka@qq.com |
87d6fd4e3b3914e1bc9183b2d8ebd25fed11ae9d | 721ab62cf0854c4abb28086ed258d4ab4ea3749d | /inflearn7_05/src/Main.java | 7e8e65881ce33d6e256f30af4f98c487c164ddb3 | [] | no_license | junisYun/inflearn_java_Algorithm | 0691f7b7297cf9b6162985693f93283a996e2387 | aeaab61c95ef5f51c76fd0c9b664ead3421f6c0d | refs/heads/main | 2023-05-11T11:43:52.071502 | 2021-06-01T04:27:23 | 2021-06-01T04:27:23 | 365,938,480 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 814 | java | import java.util.Scanner;
public class Main {
static int[][] graph;
static boolean[] visited;
static int N;
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
N = sc.nextInt();
graph = new int[N + 1][N + 1];
visited = new boolean[N + 1];
int M = sc.nextInt();
for(int i = 0; i < M; i++) {
int x = sc.nextInt();
int y = sc.nextInt();
graph[x][y] = graph[y][x] = 1;
}
DFS(1);
}
public static void DFS(int x) {
System.out.print(x + " ");
visited[x] = true;
for(int i = 1; i < N + 1; i++) {
if(graph[x][i] == 1) {
if(!visited[i]) {
DFS(i);
}
}
}
}
}
| [
"junis.yun94@gmail.com"
] | junis.yun94@gmail.com |
d974fd7c8e955e128e75d00e9ccc6d35d7e0cfa1 | ae7cdd899e8957f712158cbbb97db55a575a78a0 | /src/main/java/com/mangosteen/controller/MangosteenProjectController.java | a52c325ec689fc4d69f4849aab9c6587adb1fea1 | [] | no_license | JustRain/mangosteen | 542312ac559ff957e6e5cafee0e99c53b278966a | 190b28390dcde018a1f286ac893f7dfb1a802b69 | refs/heads/master | 2020-05-07T13:46:00.982839 | 2019-04-10T10:55:01 | 2019-04-10T10:55:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 10,193 | java | package com.mangosteen.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.mangosteen.model.ExecuteRecords;
import com.mangosteen.model.Project;
import com.mangosteen.model.ProjectConfig;
import com.mangosteen.service.JacocoService;
import com.mangosteen.service.ProjectService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.Date;
import java.util.List;
@Controller
@RequestMapping("/project")
public class MangosteenProjectController {
private static final Logger logger = LoggerFactory.getLogger(MangosteenProjectController.class);
@Autowired
private ProjectService projectService;
@Autowired
private JacocoService jacocoService;
@RequestMapping("/showProject")
public String createProject(HttpServletRequest httpServletRequest, ModelMap modelMap) {
List<Project> projectList = projectService.queryAllProject();
modelMap.addAttribute("templatename", "projectList");
modelMap.addAttribute("projectList", projectList);
return "index";
}
@RequestMapping("/delelteProject")
public String delelteProject(HttpServletRequest httpServletRequest, ModelMap modelMap) {
String projectName = httpServletRequest.getParameter("projectName");
projectService.deleteByProjectName(projectName);
List<Project> projectList = projectService.queryAllProject();
modelMap.addAttribute("templatename", "projectList");
modelMap.addAttribute("projectList", projectList);
return "index";
}
/**
* 跳转到添加项目页面
*
* @param httpServletRequest
* @param modelMap
* @return
*/
@RequestMapping("/toAddProject")
public String toAddProject(HttpServletRequest httpServletRequest, ModelMap modelMap) {
modelMap.addAttribute("templatename", "addProject");
return "index";
}
@RequestMapping("/login")
public String toLogin(HttpServletRequest httpServletRequest, ModelMap modelMap) {
return "login";
}
@RequestMapping("/logout")
public String logout(HttpServletRequest httpServletRequest) {
httpServletRequest.getSession().removeAttribute("user");
return "login";
}
@RequestMapping("/isLogin")
@ResponseBody
public String login(HttpServletRequest httpServletRequest){
String userName=httpServletRequest.getParameter("userName");
String passwd=httpServletRequest.getParameter("password");
boolean isLogin = jacocoService.isLogin(userName, passwd);
if(isLogin){
httpServletRequest.getSession().setAttribute("user",jacocoService.queryUserRole(userName));
return "SUCCESS";
}
return "FAIL";
}
/**
* 跳转到项目执行页面
*
* @param httpServletRequest
* @param modelMap
* @return
*/
@RequestMapping("/toExecuteProject")
public String toExecuteProject(HttpServletRequest httpServletRequest, Model modelMap) {
String projectName = httpServletRequest.getParameter("projectName");
Project project = projectService.queryProjectByName(projectName);
List<ProjectConfig> projectConfigs=JSON.parseArray(project.getProjectConfig(), ProjectConfig.class);
modelMap.addAttribute("project",project);
modelMap.addAttribute("projectConfig",projectConfigs);
modelMap.addAttribute("templatename", "executeProject");
return "index";
}
/**
* 跳转到构建历史记录
*
* @param httpServletRequest
* @param modelMap
* @return
*/
@RequestMapping("/tobuildHistory")
public String tobuildHistory(HttpServletRequest httpServletRequest, Model modelMap) {
String projectName = httpServletRequest.getParameter("projectName");
modelMap.addAttribute("templatename", "buildHistory");
List<ExecuteRecords> executeRecords=projectService.queryExecuteRecordByProjectName(projectName);
modelMap.addAttribute("executeRecords",executeRecords);
return "index";
}
@RequestMapping("/saveProject")
@ResponseBody
public String addProject(@RequestBody String request) {
JSONObject requestData = JSON.parseObject(request);
Project project=new Project();
project.setProjectName(requestData.getString("projectName"));
project.setCodeBranch(requestData.getString("codeBranch"));
project.setProjectConfig(requestData.getJSONArray("projectConfig").toString());
projectService.saveProject(project);
return "SUCCESS";
}
@RequestMapping("/updateProject")
@ResponseBody
public String updateProject(@RequestBody String request) {
JSONObject requestData = JSON.parseObject(request);
Project project=new Project();
project.setProjectName(requestData.getString("projectName"));
project.setCodeBranch(requestData.getString("codeBranch"));
project.setId(requestData.getInteger("projectId"));
project.setProjectConfig(requestData.getJSONArray("projectConfig").toString());
projectService.updateProjectById(project);
return "SUCCESS";
}
@RequestMapping(value = "/reportDetail")
public String toReport(HttpServletRequest httpServletRequest, Model modelMap) {
modelMap.addAttribute("templatename", "jacocoReportDetail");
modelMap.addAttribute("reportPath", httpServletRequest.getParameter("reportPath"));
modelMap.addAttribute("projectName",httpServletRequest.getParameter("projectName"));
modelMap.addAttribute("codeBranch",httpServletRequest.getParameter("codeBranch"));
modelMap.addAttribute("serverIp",httpServletRequest.getParameter("serverIp"));
return "index";
}
@RequestMapping("/buildReport")
public String buildReport(HttpServletRequest request,Model modelMap){
JSONObject requestData = JSON.parseObject(request.getParameter("buildReportForm"));
ExecuteRecords executeRecords=new ExecuteRecords();
executeRecords.setProjectName(requestData.getString("hf-projectName"));
Project project = projectService.queryProjectByName(executeRecords.getProjectName());
String codeBranch=requestData.getString("hf-devBranch");
if(StringUtils.isBlank(codeBranch)){
codeBranch=project.getCodeBranch();
}else if (codeBranch.endsWith("/")){
codeBranch=StringUtils.substringBeforeLast(codeBranch,"/");
}
if(project.getCodeBranch().endsWith(".git")){
executeRecords.setGit(true);
}
executeRecords.setCodeBranch(codeBranch);
executeRecords.setServerIp(requestData.getString("hf-ip").replace("[","").replace("]","").replace("\"",""));
executeRecords.setExecuteTime(new Date());
if(StringUtils.isNotBlank(request.getParameter("Increment"))){
executeRecords.setDiffUrl(project.getCodeBranch());
executeRecords.setIncrement(true);
}
String reportPath = null;
try {
reportPath = jacocoService.buildReport(executeRecords);
} catch (IOException e) {
logger.error("覆盖率报告生成失败:{}",e.getMessage());
reportPath ="/error.html";
}
if (StringUtils.isNotBlank(reportPath)){
executeRecords.setReportPath(reportPath);
projectService.saveProjectExecuteRecords(executeRecords);
}else {
reportPath ="/error.html";
}
modelMap.addAttribute("templatename", "jacocoReportDetail");
modelMap.addAttribute("reportPath", reportPath);
modelMap.addAttribute("projectName",executeRecords.getProjectName());
modelMap.addAttribute("codeBranch",executeRecords.getCodeBranch());
modelMap.addAttribute("serverIp",executeRecords.getServerIp());
return "index";
}
@RequestMapping("/toConfigProject")
public String toConfigProject(HttpServletRequest request,ModelMap modelMap){
String projectName = request.getParameter("projectName");
Project project = projectService.queryProjectByName(projectName);
List<ProjectConfig> projectConfigs=JSON.parseArray(project.getProjectConfig(), ProjectConfig.class);
modelMap.addAttribute("project", project);
modelMap.addAttribute("projectConfigs", projectConfigs);
modelMap.addAttribute("templatename", "updateProject");
return "index";
}
@RequestMapping("/toResetCoverage")
public String toResetCoverage(HttpServletRequest request,ModelMap modelMap){
List<Project> projectList = projectService.queryAllProject();
modelMap.addAttribute("templatename", "resetCoverage");
modelMap.addAttribute("projectList", projectList);
return "index";
}
@RequestMapping("/resetCoverage")
@ResponseBody
public String resetCoverage(HttpServletRequest request){
String ip=request.getParameter("ip");
boolean resetDump = jacocoService.resetDump(StringUtils.substringBefore(ip,":"), StringUtils.substringAfter(ip,":"));
if(resetDump){
return "SUCCESS";
}
return "FAIL";
}
@RequestMapping("/queryServerIP")
@ResponseBody
public List<ProjectConfig> queryServerIP(HttpServletRequest request){
String projectName = request.getParameter("projectName");
Project project = projectService.queryProjectByName(projectName);
List<ProjectConfig> projectConfigs=JSON.parseArray(project.getProjectConfig(), ProjectConfig.class);
return projectConfigs;
}
}
| [
"guochang.xie@cardinfo.com.cn"
] | guochang.xie@cardinfo.com.cn |
98a7b599badcd956592b8ef6edd6d26c3348fa9f | eaf7babd88da7bb9e6675d055fca25266228bc8a | /uiautomator/src/main/java/com/jsdroid/uiautomator/QueryController.java | 66374b6d5cdd87362bedc764536b0f67431a3ee5 | [] | no_license | whatyun/JsDroidShell | 04496fc9a66b1624b4d877f2918b7f97be483d01 | 1ddb4a5b9897ce8c9d830641266a8bb9daadb506 | refs/heads/master | 2020-09-10T06:59:02.622864 | 2018-09-29T17:57:55 | 2018-09-29T17:57:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 22,007 | java | /*
* Copyright (C) 2012 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 com.jsdroid.uiautomator;
import android.app.UiAutomation.OnAccessibilityEventListener;
import android.os.SystemClock;
import android.util.Log;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityNodeInfo;
/**
* The QueryController main purpose is to translate a {@link UiSelector} selectors to
* {@link AccessibilityNodeInfo}. This is all this controller does.
*/
class QueryController {
private static final String LOG_TAG = QueryController.class.getSimpleName();
private static final boolean DEBUG = Log.isLoggable(LOG_TAG, Log.DEBUG);
private static final boolean VERBOSE = Log.isLoggable(LOG_TAG, Log.VERBOSE);
private final UiAutomatorBridge mUiAutomatorBridge;
private final Object mLock = new Object();
private String mLastActivityName = null;
// During a pattern selector search, the recursive pattern search
// methods will track their counts and indexes here.
private int mPatternCounter = 0;
private int mPatternIndexer = 0;
// These help show each selector's search context as it relates to the previous sub selector
// matched. When a compound selector fails, it is hard to tell which part of it is failing.
// Seeing how a selector is being parsed and which sub selector failed within a long list
// of compound selectors is very helpful.
private int mLogIndent = 0;
private int mLogParentIndent = 0;
private String mLastTraversedText = "";
public QueryController(UiAutomatorBridge bridge) {
mUiAutomatorBridge = bridge;
bridge.setOnAccessibilityEventListener(new OnAccessibilityEventListener() {
@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
synchronized (mLock) {
switch(event.getEventType()) {
case AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED:
// don't trust event.getText(), check for nulls
if (event.getText() != null && event.getText().size() > 0) {
if(event.getText().get(0) != null)
mLastActivityName = event.getText().get(0).toString();
}
break;
case AccessibilityEvent.TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY:
// don't trust event.getText(), check for nulls
if (event.getText() != null && event.getText().size() > 0)
if(event.getText().get(0) != null)
mLastTraversedText = event.getText().get(0).toString();
if (DEBUG)
Log.d(LOG_TAG, "Last text selection reported: " +
mLastTraversedText);
break;
}
mLock.notifyAll();
}
}
});
}
/**
* Returns the last text selection reported by accessibility
* event TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY. One way to cause
* this event is using a DPad arrows to focus on UI elements.
*/
public String getLastTraversedText() {
mUiAutomatorBridge.waitForIdle();
synchronized (mLock) {
if (mLastTraversedText.length() > 0) {
return mLastTraversedText;
}
}
return null;
}
/**
* Clears the last text selection value saved from the TYPE_VIEW_TEXT_SELECTION_CHANGED
* event
*/
public void clearLastTraversedText() {
mUiAutomatorBridge.waitForIdle();
synchronized (mLock) {
mLastTraversedText = "";
}
}
private void initializeNewSearch() {
mPatternCounter = 0;
mPatternIndexer = 0;
mLogIndent = 0;
mLogParentIndent = 0;
}
/**
* Counts the instances of the selector group. The selector must be in the following
* format: [container_selector, PATTERN=[INSTANCE=x, PATTERN=[the_pattern]]
* where the container_selector is used to find the containment region to search for patterns
* and the INSTANCE=x is the instance of the_pattern to return.
* @param selector
* @return number of pattern matches. Returns 0 for all other cases.
*/
public int getPatternCount(UiSelector selector) {
findAccessibilityNodeInfo(selector, true /*counting*/);
return mPatternCounter;
}
/**
* Main search method for translating By selectors to AccessibilityInfoNodes
* @param selector
* @return AccessibilityNodeInfo
*/
public AccessibilityNodeInfo findAccessibilityNodeInfo(UiSelector selector) {
return findAccessibilityNodeInfo(selector, false);
}
protected AccessibilityNodeInfo findAccessibilityNodeInfo(UiSelector selector,
boolean isCounting) {
mUiAutomatorBridge.waitForIdle();
initializeNewSearch();
if (DEBUG)
Log.d(LOG_TAG, "Searching: " + selector);
AccessibilityNodeInfo rootNode = getRootNode();
if (rootNode == null) {
Log.e(LOG_TAG, "Cannot proceed when root node is null. Aborted search");
return null;
}
// Copy so that we don't modify the original's sub selectors
UiSelector uiSelector = new UiSelector(selector);
return translateCompoundSelector(uiSelector, rootNode, isCounting);
}
/**
* Gets the root node from accessibility and if it fails to get one it will
* retry every 250ms for up to 1000ms.
* @return null if no root node is obtained
*/
AccessibilityNodeInfo getRootNode() {
final int maxRetry = 6;
long waitInterval = 250;
AccessibilityNodeInfo rootNode = null;
for (int x = 0; x < maxRetry; x++) {
rootNode = mUiAutomatorBridge.getRootInActiveWindow();
if (rootNode != null) {
return rootNode;
}
if (x < maxRetry - 1) {
Log.e(LOG_TAG, "Got null root node from accessibility - Retrying...");
SystemClock.sleep(waitInterval);
waitInterval *= 2;
}
}
return rootNode;
}
/**
* A compoundSelector encapsulate both Regular and Pattern selectors. The formats follows:
* <p/>
* regular_selector = By[attributes... CHILD=By[attributes... CHILD=By[....]]]
* <br/>
* pattern_selector = ...CONTAINER=By[..] PATTERN=By[instance=x PATTERN=[regular_selector]
* <br/>
* compound_selector = [regular_selector [pattern_selector]]
* <p/>
* regular_selectors are the most common form of selectors and the search for them
* is straightforward. On the other hand pattern_selectors requires search to be
* performed as in regular_selector but where regular_selector search returns immediately
* upon a successful match, the search for pattern_selector continues until the
* requested matched _instance_ of that pattern is matched.
* <p/>
* Counting UI objects requires using pattern_selectors. The counting search is the same
* as a pattern_search however we're not looking to match an instance of the pattern but
* rather continuously walking the accessibility node hierarchy while counting matched
* patterns, until the end of the tree.
* <p/>
* If both present, order of parsing begins with CONTAINER followed by PATTERN then the
* top most selector is processed as regular_selector within the context of the previous
* CONTAINER and its PATTERN information. If neither is present then the top selector is
* directly treated as regular_selector. So the presence of a CONTAINER and PATTERN within
* a selector simply dictates that the selector matching will be constraint to the sub tree
* node where the CONTAINER and its child PATTERN have identified.
* @param selector
* @param fromNode
* @param isCounting
* @return AccessibilityNodeInfo
*/
private AccessibilityNodeInfo translateCompoundSelector(UiSelector selector,
AccessibilityNodeInfo fromNode, boolean isCounting) {
// Start translating compound selectors by translating the regular_selector first
// The regular_selector is then used as a container for any optional pattern_selectors
// that may or may not be specified.
if(selector.hasContainerSelector())
// nested pattern selectors
if(selector.getContainerSelector().hasContainerSelector()) {
fromNode = translateCompoundSelector(
selector.getContainerSelector(), fromNode, false);
initializeNewSearch();
} else
fromNode = translateReqularSelector(selector.getContainerSelector(), fromNode);
else
fromNode = translateReqularSelector(selector, fromNode);
if(fromNode == null) {
if (DEBUG)
Log.d(LOG_TAG, "Container selector not found: " + selector.dumpToString(false));
return null;
}
if(selector.hasPatternSelector()) {
fromNode = translatePatternSelector(selector.getPatternSelector(),
fromNode, isCounting);
if (isCounting) {
Log.i(LOG_TAG, String.format(
"Counted %d instances of: %s", mPatternCounter, selector));
return null;
} else {
if(fromNode == null) {
if (DEBUG)
Log.d(LOG_TAG, "Pattern selector not found: " +
selector.dumpToString(false));
return null;
}
}
}
// translate any additions to the selector that may have been added by tests
// with getChild(By selector) after a container and pattern selectors
if(selector.hasContainerSelector() || selector.hasPatternSelector()) {
if(selector.hasChildSelector() || selector.hasParentSelector())
fromNode = translateReqularSelector(selector, fromNode);
}
if(fromNode == null) {
if (DEBUG)
Log.d(LOG_TAG, "Object Not Found for selector " + selector);
return null;
}
Log.i(LOG_TAG, String.format("Matched selector: %s <<==>> [%s]", selector, fromNode));
return fromNode;
}
/**
* Used by the {@link #translateCompoundSelector(UiSelector, AccessibilityNodeInfo, boolean)}
* to translate the regular_selector portion. It has the following format:
* <p/>
* regular_selector = By[attributes... CHILD=By[attributes... CHILD=By[....]]]<br/>
* <p/>
* regular_selectors are the most common form of selectors and the search for them
* is straightforward. This method will only look for CHILD or PARENT sub selectors.
* <p/>
* @param selector
* @param fromNode
* @return AccessibilityNodeInfo if found else null
*/
private AccessibilityNodeInfo translateReqularSelector(UiSelector selector,
AccessibilityNodeInfo fromNode) {
return findNodeRegularRecursive(selector, fromNode, 0);
}
private AccessibilityNodeInfo findNodeRegularRecursive(UiSelector subSelector,
AccessibilityNodeInfo fromNode, int index) {
if (subSelector.isMatchFor(fromNode, index)) {
if (DEBUG) {
Log.d(LOG_TAG, formatLog(String.format("%s",
subSelector.dumpToString(false))));
}
if(subSelector.isLeaf()) {
return fromNode;
}
if(subSelector.hasChildSelector()) {
mLogIndent++; // next selector
subSelector = subSelector.getChildSelector();
if(subSelector == null) {
Log.e(LOG_TAG, "Error: A child selector without content");
return null; // there is an implementation fault
}
} else if(subSelector.hasParentSelector()) {
mLogIndent++; // next selector
subSelector = subSelector.getParentSelector();
if(subSelector == null) {
Log.e(LOG_TAG, "Error: A parent selector without content");
return null; // there is an implementation fault
}
// the selector requested we start at this level from
// the parent node from the one we just matched
fromNode = fromNode.getParent();
if(fromNode == null)
return null;
}
}
int childCount = fromNode.getChildCount();
boolean hasNullChild = false;
for (int i = 0; i < childCount; i++) {
AccessibilityNodeInfo childNode = fromNode.getChild(i);
if (childNode == null) {
Log.w(LOG_TAG, String.format(
"AccessibilityNodeInfo returned a null child (%d of %d)", i, childCount));
if (!hasNullChild) {
Log.w(LOG_TAG, String.format("parent = %s", fromNode.toString()));
}
hasNullChild = true;
continue;
}
if (!childNode.isVisibleToUser()) {
if (VERBOSE)
Log.v(LOG_TAG,
String.format("Skipping invisible child: %s", childNode.toString()));
continue;
}
AccessibilityNodeInfo retNode = findNodeRegularRecursive(subSelector, childNode, i);
if (retNode != null) {
return retNode;
}
}
return null;
}
/**
* Used by the {@link #translateCompoundSelector(UiSelector, AccessibilityNodeInfo, boolean)}
* to translate the pattern_selector portion. It has the following format:
* <p/>
* pattern_selector = ... PATTERN=By[instance=x PATTERN=[regular_selector]]<br/>
* <p/>
* pattern_selectors requires search to be performed as regular_selector but where
* regular_selector search returns immediately upon a successful match, the search for
* pattern_selector continues until the requested matched instance of that pattern is
* encountered.
* <p/>
* Counting UI objects requires using pattern_selectors. The counting search is the same
* as a pattern_search however we're not looking to match an instance of the pattern but
* rather continuously walking the accessibility node hierarchy while counting patterns
* until the end of the tree.
* @param subSelector
* @param fromNode
* @param isCounting
* @return null of node is not found or if counting mode is true.
* See {@link #translateCompoundSelector(UiSelector, AccessibilityNodeInfo, boolean)}
*/
private AccessibilityNodeInfo translatePatternSelector(UiSelector subSelector,
AccessibilityNodeInfo fromNode, boolean isCounting) {
if(subSelector.hasPatternSelector()) {
// Since pattern_selectors are also the type of selectors used when counting,
// we check if this is a counting run or an indexing run
if(isCounting)
//since we're counting, we reset the indexer so to terminates the search when
// the end of tree is reached. The count will be in mPatternCount
mPatternIndexer = -1;
else
// terminates the search once we match the pattern's instance
mPatternIndexer = subSelector.getInstance();
// A pattern is wrapped in a PATTERN[instance=x PATTERN[the_pattern]]
subSelector = subSelector.getPatternSelector();
if(subSelector == null) {
Log.e(LOG_TAG, "Pattern portion of the selector is null or not defined");
return null; // there is an implementation fault
}
// save the current indent level as parent indent before pattern searches
// begin under the current tree position.
mLogParentIndent = ++mLogIndent;
return findNodePatternRecursive(subSelector, fromNode, 0, subSelector);
}
Log.e(LOG_TAG, "Selector must have a pattern selector defined"); // implementation fault?
return null;
}
private AccessibilityNodeInfo findNodePatternRecursive(
UiSelector subSelector, AccessibilityNodeInfo fromNode, int index,
UiSelector originalPattern) {
if (subSelector.isMatchFor(fromNode, index)) {
if(subSelector.isLeaf()) {
if(mPatternIndexer == 0) {
if (DEBUG)
Log.d(LOG_TAG, formatLog(
String.format("%s", subSelector.dumpToString(false))));
return fromNode;
} else {
if (DEBUG)
Log.d(LOG_TAG, formatLog(
String.format("%s", subSelector.dumpToString(false))));
mPatternCounter++; //count the pattern matched
mPatternIndexer--; //decrement until zero for the instance requested
// At a leaf selector within a group and still not instance matched
// then reset the selector to continue search from current position
// in the accessibility tree for the next pattern match up until the
// pattern index hits 0.
subSelector = originalPattern;
// starting over with next pattern search so reset to parent level
mLogIndent = mLogParentIndent;
}
} else {
if (DEBUG)
Log.d(LOG_TAG, formatLog(
String.format("%s", subSelector.dumpToString(false))));
if(subSelector.hasChildSelector()) {
mLogIndent++; // next selector
subSelector = subSelector.getChildSelector();
if(subSelector == null) {
Log.e(LOG_TAG, "Error: A child selector without content");
return null;
}
} else if(subSelector.hasParentSelector()) {
mLogIndent++; // next selector
subSelector = subSelector.getParentSelector();
if(subSelector == null) {
Log.e(LOG_TAG, "Error: A parent selector without content");
return null;
}
fromNode = fromNode.getParent();
if(fromNode == null)
return null;
}
}
}
int childCount = fromNode.getChildCount();
boolean hasNullChild = false;
for (int i = 0; i < childCount; i++) {
AccessibilityNodeInfo childNode = fromNode.getChild(i);
if (childNode == null) {
Log.w(LOG_TAG, String.format(
"AccessibilityNodeInfo returned a null child (%d of %d)", i, childCount));
if (!hasNullChild) {
Log.w(LOG_TAG, String.format("parent = %s", fromNode.toString()));
}
hasNullChild = true;
continue;
}
if (!childNode.isVisibleToUser()) {
if (DEBUG)
Log.d(LOG_TAG,
String.format("Skipping invisible child: %s", childNode.toString()));
continue;
}
AccessibilityNodeInfo retNode = findNodePatternRecursive(
subSelector, childNode, i, originalPattern);
if (retNode != null) {
return retNode;
}
}
return null;
}
/**
* Last activity to report accessibility events.
* @deprecated The results returned should be considered unreliable
* @return String name of activity
*/
@Deprecated
public String getCurrentActivityName() {
mUiAutomatorBridge.waitForIdle();
synchronized (mLock) {
return mLastActivityName;
}
}
/**
* Last package to report accessibility events
* @return String name of package
*/
public String getCurrentPackageName() {
mUiAutomatorBridge.waitForIdle();
AccessibilityNodeInfo rootNode = getRootNode();
if (rootNode == null)
return null;
return rootNode.getPackageName() != null ? rootNode.getPackageName().toString() : null;
}
private String formatLog(String str) {
StringBuilder l = new StringBuilder();
for(int space = 0; space < mLogIndent; space++)
l.append(". . ");
if(mLogIndent > 0)
l.append(String.format(". . [%d]: %s", mPatternCounter, str));
else
l.append(String.format(". . [%d]: %s", mPatternCounter, str));
return l.toString();
}
}
| [
"980008027@qq.com"
] | 980008027@qq.com |
e2635d496d81d29b095a11544bd81d84bdac8422 | 9d69fc19e4e3685081c02e0007279a8c6d59fdb9 | /rcp3/rcp3.study/src/rcp3/study/Application.java | 4b063573e460ee24e96f47246bd48ed882e8b01d | [] | no_license | tadckle/rcp | e334fd366b416de37ba5ff1dc9250c7657fc48ac | a2ca9ab59177c4a4f6768751dcee74b287a47495 | refs/heads/master | 2021-08-22T03:26:44.559553 | 2019-08-12T15:28:53 | 2019-08-12T15:28:53 | 124,751,945 | 1 | 2 | null | 2021-03-31T19:48:20 | 2018-03-11T11:59:39 | Java | UTF-8 | Java | false | false | 1,366 | java | package rcp3.study;
import org.eclipse.equinox.app.IApplication;
import org.eclipse.equinox.app.IApplicationContext;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
/**
* This class controls all aspects of the application's execution
*/
public class Application implements IApplication {
/*
* (non-Javadoc)
*
* @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.
* IApplicationContext)
*/
@Override
public Object start(IApplicationContext context) {
Display display = PlatformUI.createDisplay();
try {
int returnCode = PlatformUI.createAndRunWorkbench(display, new ApplicationWorkbenchAdvisor());
if (returnCode == PlatformUI.RETURN_RESTART) {
return IApplication.EXIT_RESTART;
}
return IApplication.EXIT_OK;
} finally {
display.dispose();
}
}
/*
* (non-Javadoc)
*
* @see org.eclipse.equinox.app.IApplication#stop()
*/
@Override
public void stop() {
if (!PlatformUI.isWorkbenchRunning())
return;
final IWorkbench workbench = PlatformUI.getWorkbench();
final Display display = workbench.getDisplay();
display.syncExec(new Runnable() {
@Override
public void run() {
if (!display.isDisposed())
workbench.close();
}
});
}
}
| [
"tadckle@126.com"
] | tadckle@126.com |
04603f8c1095869a5907e16108cff36fe97a7b81 | dd17a5e8e115a0f0d03e027e20ac99471105ea74 | /Dynamic Programming/Knapsack/Knapsack-Bottom-UpApproach.java | fb7871483cf926fb1033eb459fad8b5b00eddee7 | [] | no_license | DeepShikha0210/CodingProblems | df46aed91d13beb24745a40e1d78bebe4ab31ede | 11300e2570e059309756e853a975262d3ca6d067 | refs/heads/main | 2023-06-19T12:41:00.875918 | 2021-07-03T08:42:13 | 2021-07-03T08:42:13 | 377,801,703 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,311 | java | /*BOTTOM-UP APPROACH
1) The base condition changes into initialisation step
2) Replace n and W i.e. the varying ones in the recursive step to i and j respectively.
For example:
//max((val[n - 1] + knapSackRec(W - wt[n - 1], wt, val, n - 1, dp)), knapSackRec(W, wt, val, n - 1, dp));
//max(val[i - 1] + K[i - 1][j - wt[i - 1]], K[i - 1][j]);
*/
// A Dynamic Programming based solution
// for 0-1 Knapsack problem
class Solution{
// A utility function that returns
// maximum of two integers
// Returns the value of maximum profit
static int knapSackRec(int W, int wt[], int val[], int n, int [][]dp)
{
// Base condition
if (n == 0 || W == 0)
return 0;
if (dp[n][W] != -1)
return dp[n][W];
if (wt[n - 1] > W)
// Store the value of function call
// stack in table before return
return dp[n][W] = knapSackRec(W, wt, val, n - 1, dp);
else
// Return value of table after storing
return dp[n][W] = Math.max((val[n - 1] + knapSackRec(W - wt[n - 1], wt, val, n , dp)),
knapSackRec(W, wt, val, n - 1, dp));
}
static int knapSack(int W, int wt[], int val[], int N)
{
// Declare the table dynamically
int dp[][] = new int[N+1][W+1];
// Loop to initially filled the
// table with -1
for(int i = 0; i < N + 1; i++)
for(int j = 0; j < W + 1; j++)
dp[i][j] = -1;
//Printing the dp[][]
/* for(int i = 0; i < N + 1; i++) {
for (int j = 0; j < W + 1; j++)
System.out.print(dp[i][j] + " ");
System.out.println();
}*/
return knapSackRec(W, wt, val, N, dp);
}
// Driver Code
public static void main(String [] args)
{
int val[] = { 10,40, 50,70 };
int wt[] = { 1, 3, 4, 5 };
int W = 8;
int N = val.length;
System.out.println(knapSack(W, wt, val, N));
}
}
/*Complexity Analysis:
Time Complexity: O(N*W).
where ‘N’ is the number of weight element and ‘W’ is capacity. As for every weight element we traverse through all weight capacities 1<=w<=W.
Auxiliary Space: O(N*W).
The use of 2-D array of size ‘N*W’.*/ | [
"butola.deep02@gmail.com"
] | butola.deep02@gmail.com |
6595a5730fa91b59a1747590a0359b896676be0e | e50c3f2f068e3a29036aeb5b57365e27479dc763 | /src/Links/LinksTesting3.java | 068d0914f5347e6fde3ae490230eaf22c0d9a719 | [] | no_license | psnaresh06/myfirstrepository | dd3f8d0d320336fc76fab2767c4bb8758c9be223 | 52be27ad649aef40a2b77f428912f1c4640d208d | refs/heads/master | 2021-01-10T04:40:37.662421 | 2015-11-21T14:31:46 | 2015-11-21T14:31:46 | 46,615,212 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 788 | java | package Links;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.firefox.FirefoxProfile;
import org.openqa.selenium.firefox.internal.ProfilesIni;
public class LinksTesting3 {
public static void main(String[] args) {
ProfilesIni pr= new ProfilesIni();
FirefoxProfile fp = new FirefoxProfile();
fp=pr.getProfile("myprofile");
FirefoxDriver driver = new FirefoxDriver(fp);
driver.get("http://bing.com");
WebElement header=driver.findElement(By.id("sc_hdu"));
List<WebElement> links=header.findElements(By.tagName("a"));
System.out.println(links.size());
for(int i=0;i<links.size();i++){
System.out.println(links.get(i).getText());
}
}
}
| [
"psnaresh06@gmail.com"
] | psnaresh06@gmail.com |
85db404c47aa665b0f9badd4f5535987c412aae5 | a74b95b59233922286405f114ae8dd1fd2d8270d | /Splitwise/src/main/java/model/transaction/Transaction.java | 8392802d8897a6a907083d527248879095b2c7b8 | [] | no_license | krishnadwypayan/MachineCoding | fe08fbb95a75f3934a866efa51a77849afc8b604 | e0baaaa8c8bf673417dc7fc23408515e5d8de7cc | refs/heads/main | 2023-07-11T23:44:03.339551 | 2021-07-30T07:13:49 | 2021-07-30T07:13:49 | 390,968,255 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,049 | java | package model.transaction;
/**
* Created by Krishna Kota on 29/05/21
*/
public abstract class Transaction {
private final int transactionId;
private final String userId;
private final String ledgerId;
private final double amount;
protected Transaction(int transactionId, String userId, String ledgerId, double amount) {
this.transactionId = transactionId;
this.userId = userId;
this.ledgerId = ledgerId;
this.amount = amount;
}
public int getTransactionId() {
return transactionId;
}
public String getUserId() {
return userId;
}
public String getLedgerId() {
return ledgerId;
}
public double getAmount() {
return amount;
}
@Override
public String toString() {
return "Transaction{" +
", transactionId=" + transactionId +
", userId='" + userId + '\'' +
", ledgerId='" + ledgerId + '\'' +
", amount=" + amount +
'}';
}
}
| [
"krishna.kota@appdynamics.com"
] | krishna.kota@appdynamics.com |
4a4a58c13b60753ac7e9705028b5fd6f04d4d1af | bc59559f596d4b791a1dfb2a767c46f87d89a8e0 | /springboot-data/src/main/java/cn/footman/springbootdata/SpringbootDataApplication.java | 9729233d5cedf3f351d4807dac30c7c00b7e3576 | [] | no_license | kokioyao/springboot-test | b87df72baba1d7db1e74add399a4eafcd15d77fd | 7d0858a4a9daa89702d5251ece19b7e2daa62d9e | refs/heads/master | 2020-04-01T17:37:45.318052 | 2018-10-17T10:45:01 | 2018-10-17T10:45:01 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 345 | java | package cn.footman.springbootdata;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringbootDataApplication {
public static void main(String[] args) {
SpringApplication.run(SpringbootDataApplication.class, args);
}
}
| [
"ykkwpp@mail.com"
] | ykkwpp@mail.com |
714c94c0814f582ac7a0632461c7c9cd5fce9ebc | c21d4dcd447ea892a907b0221b7a113585ce16bd | /src/main/java/com/flyAway/Dao/FlightsDaoImpl.java | d3377a7b0bd468f2f2f974a78405951f4239570a | [] | no_license | leojmid2/Phase2_Project2_JDimazana | 5ba44065b78675a814c6231d0fd8c4f623d004ec | 86e1a75475906e1566f1859fa7abebda1f4f8ed2 | refs/heads/master | 2023-04-07T22:21:09.085443 | 2021-04-18T21:10:33 | 2021-04-18T21:10:33 | 356,434,625 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,868 | java | package com.flyAway.Dao;
import java.util.List;
import org.hibernate.Query;
import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import com.flyAway.model.Flight;
@Repository
public class FlightsDaoImpl implements FlightsDao {
@Autowired
private SessionFactory sessionFactory;
@SuppressWarnings("unchecked")
@Override
public List<Flight> getFlights() {
//the from Flight is the java class Flight not the table
return sessionFactory.getCurrentSession().createQuery("from Flight").list();
}
@Override
public Flight getFlight(int sourceid, int destinationid, int airlineid) {
// TODO Auto-generated method stub
Query q = sessionFactory.getCurrentSession().createQuery("from Flight WHERE sourceid = :sourceid "
+ "AND destinationId = :destinationid AND airlineId = :airlineid");
q.setInteger("sourceid", sourceid);
q.setInteger("destinationid", destinationid);
q.setInteger("airlineid", airlineid);
q.setMaxResults(1);
return (Flight) q.uniqueResult();
}
@SuppressWarnings("unchecked")
@Override
public List<Flight> getFlights(int sourceid, int destinationid) {
// TODO Auto-generated method stub
Query q = sessionFactory.getCurrentSession().createQuery("from Flight WHERE sourceid = :sourceid "
+ "AND destinationId = :destinationid");
q.setInteger("sourceid", sourceid);
q.setInteger("destinationid", destinationid);
return q.list();
//return sessionFactory.getCurrentSession().createQuery("from Flight WHERE sourceid = 10001").list();
}
@Override
public Flight getFlight(long flightId) {
return (Flight)sessionFactory.getCurrentSession().get(Flight.class, flightId);
}
@Override
public void addFlight(Flight flight) {
sessionFactory.getCurrentSession().saveOrUpdate(flight);
}
}
| [
"leojmid@gmail.com"
] | leojmid@gmail.com |
1fcb8b768a33419a8fdc845d117415cd453ee344 | 25eb35d5e54f554d9ce906b8ab4b3d97cd09ad69 | /src/main/java/com/hand/springMVCExam/bean/Address.java | e67819ccb46ea2f041a84d4d0b353da50226600c | [] | no_license | meimei2016/springMVCExam | 4e8ce7cbd188f1158260787089d040051d29739c | 35f2714fb9518c0474a5a859c4f1e14bc14333d9 | refs/heads/master | 2020-07-03T19:40:54.108089 | 2016-08-22T04:13:46 | 2016-08-22T04:13:46 | 66,189,953 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,222 | java | package com.hand.springMVCExam.bean;
import java.util.Date;
public class Address {
private int address_id;
private String address;
private String address2;
private String district;
private int ciry_id;
private String postal_code;
private String phone;
private Date last_update;
public int getAddress_id() {
return address_id;
}
public void setAddress_id(int address_id) {
this.address_id = address_id;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getAddress2() {
return address2;
}
public void setAddress2(String address2) {
this.address2 = address2;
}
public String getDistrict() {
return district;
}
public void setDistrict(String district) {
this.district = district;
}
public int getCiry_id() {
return ciry_id;
}
public void setCiry_id(int ciry_id) {
this.ciry_id = ciry_id;
}
public String getPostal_code() {
return postal_code;
}
public void setPostal_code(String postal_code) {
this.postal_code = postal_code;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public Date getLast_update() {
return last_update;
}
public void setLast_update(Date last_update) {
this.last_update = last_update;
}
public Address(){
super();
}
public Address(String address, String address2, String district,
int ciry_id, String postal_code, String phone, Date last_update) {
super();
this.address = address;
this.address2 = address2;
this.district = district;
this.ciry_id = ciry_id;
this.postal_code = postal_code;
this.phone = phone;
this.last_update = last_update;
}
public Address(int address_id, String address, String address2,
String district, int ciry_id, String postal_code, String phone,
Date last_update) {
super();
this.address_id = address_id;
this.address = address;
this.address2 = address2;
this.district = district;
this.ciry_id = ciry_id;
this.postal_code = postal_code;
this.phone = phone;
this.last_update = last_update;
}
public Address(int address_id, String address) {
super();
this.address_id = address_id;
this.address = address;
}
}
| [
"longmei.ran@hand-china.com"
] | longmei.ran@hand-china.com |
7726bae5c97797b957520a557b6b50ec91b7b54f | 1d2ceb9aea3f8674ac662600f1296c6eb2cc4bbc | /src/main/java/com/cdkj/coin/wallet/dao/IJourHistoryDAO.java | 2b702756d042c5fa3bb99b44ed771c159fc8b7e2 | [] | no_license | 13110992819/cs-wellet | 4eed68622480c7e7ea5974578edc2c03d90e4f40 | abf8134e3813ef6880dbf52764048ce2e64cc337 | refs/heads/master | 2020-04-09T18:19:26.452780 | 2018-02-10T03:55:45 | 2018-02-10T03:55:45 | 124,237,903 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 516 | java | package com.cdkj.coin.wallet.dao;
import com.cdkj.coin.wallet.dao.base.IBaseDAO;
import com.cdkj.coin.wallet.domain.Jour;
/**
* @author: xieyj
* @since: 2016年12月23日 上午11:25:21
* @history:
*/
public interface IJourHistoryDAO extends IBaseDAO<Jour> {
String NAMESPACE = IJourHistoryDAO.class.getName().concat(".");
// 对账结果录入
public int checkJour(Jour data);
// 调账后状态更新
public int adjustJour(Jour data);
public long selectTotalAmount(Jour data);
}
| [
"leo.zheng@hichengdai.com"
] | leo.zheng@hichengdai.com |
6f9c325cc8d4225fd602ebb169b281a00a46056d | fa91450deb625cda070e82d5c31770be5ca1dec6 | /Diff-Raw-Data/35/35_69f83d68c0844e31104c92e923512b03cc189321/NetworkManagerRef/35_69f83d68c0844e31104c92e923512b03cc189321_NetworkManagerRef_t.java | 832d67295c8c53a56a556b70f15e0cfdf31f6eac | [] | 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 | 797 | java | package com.bergerkiller.bukkit.common.reflection.classes;
import java.util.List;
import com.bergerkiller.bukkit.common.reflection.ClassTemplate;
import com.bergerkiller.bukkit.common.reflection.FieldAccessor;
import com.bergerkiller.bukkit.common.reflection.NMSClassTemplate;
public class NetworkManagerRef {
public static final ClassTemplate<?> TEMPLATE = NMSClassTemplate.create("NetworkManager");
public static final FieldAccessor<Integer> queueSize = TEMPLATE.getField("z");
public static final FieldAccessor<Object> lockObject = TEMPLATE.getField("h");
public static final FieldAccessor<List<Object>> lowPriorityQueue = TEMPLATE.getField("lowPriorityQueue");
public static final FieldAccessor<List<Object>> highPriorityQueue = TEMPLATE.getField("highPriorityQueue");
}
| [
"yuzhongxing88@gmail.com"
] | yuzhongxing88@gmail.com |
cd6f354ebdd0c2ace92b0ee1929f4bd9554e24f3 | 51543bfbdaf702daae314b32f2616e70ee25784a | /src/main/java/me/satoshiyamamoto/ProductServiceImpl.java | bc854e91d637bc1e07872bb5af5a8b5dec367ff7 | [] | no_license | satoshiyamamoto/spring-cache | 7f8a7e30a5388b69231990a65b2430ae1e55566a | c078af805178ad909a5c15168d4cc27f3cc45a15 | refs/heads/master | 2021-01-01T18:20:54.948638 | 2017-07-25T14:33:58 | 2017-07-25T14:33:58 | 98,315,968 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 765 | java | package me.satoshiyamamoto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StopWatch;
/**
* Created by satoshi on 2017/07/24.
*/
@Service
public class ProductServiceImpl implements ProductService {
@Autowired
private ProductDao productDao;
@Override
public Product findProduct(String name) {
StopWatch sw = new StopWatch();
sw.start();
Product product = productDao.findProduct(name);
sw.stop();
System.out.printf("%d ms, %s%n", sw.getLastTaskTimeMillis(), product);
return product;
}
@Override
public void addProduct(Product product) {
productDao.addProduct(product);
}
}
| [
"satoshiyamamoto@me.com"
] | satoshiyamamoto@me.com |
af1917b53554e5a4b8e47d19b63f17f117a8df5f | 094e6b8a0c1c0fd1951511ecf8f5f7e2716b8b56 | /spring.cloud/person/src/main/java/org/person/PersonApplication.java | 57c11dd10550a2186ba808ddaf70197cb8ac37f8 | [
"Apache-2.0"
] | permissive | zjqbobo/master2 | 8ce672a395d610bd9043e6a88baf293c53d1ddaa | 35de74961844d5d874f565fa3202d74692d6439f | refs/heads/master | 2021-01-01T19:50:15.705188 | 2017-09-10T02:39:13 | 2017-09-10T02:39:13 | 98,704,324 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 432 | java | package org.person;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
/**
* person服务
*
*/
@SpringBootApplication
@EnableEurekaClient
public class PersonApplication
{
public static void main( String[] args )
{
SpringApplication.run(PersonApplication.class, args);
}
}
| [
"zjqlwq317@163.com"
] | zjqlwq317@163.com |
6f9a669a95f8868c64e1181d28047f8f670003fe | 91eb2c51f6f2561a39fd8b411285c43c8e21b642 | /cayenne-crypto/src/test/java/org/apache/cayenne/crypto/Runtime_AES128_GZIP_Test.java | e67e8026e5a9b25c4f2da684d4d652bac986dcdc | [
"Apache-2.0"
] | permissive | sunnyfnc/cayenne | e24b5d742e9cc6fb89a05ad9560f40acd75b4c52 | 94256019da84b8a3fd22bd4c7d049a968a566d05 | refs/heads/master | 2021-01-15T11:19:47.655223 | 2016-07-22T13:59:53 | 2016-07-22T13:59:53 | 29,287,379 | 1 | 2 | null | 2016-11-15T15:30:06 | 2015-01-15T08:13:55 | Java | UTF-8 | Java | false | false | 5,933 | 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.cayenne.crypto;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.cayenne.ObjectContext;
import org.apache.cayenne.crypto.db.Table2;
import org.apache.cayenne.crypto.transformer.bytes.Header;
import org.apache.cayenne.crypto.unit.CryptoUnitUtils;
import org.apache.cayenne.query.SelectQuery;
import org.junit.Before;
import org.junit.Test;
public class Runtime_AES128_GZIP_Test extends Runtime_AES128_Base {
private static final int GZIP_THRESHOLD = 150;
@Before
public void setUp() throws Exception {
super.setUp(true);
}
@Test
public void testInsert() throws SQLException {
ObjectContext context = runtime.newContext();
// make sure compression is on...
byte[] cryptoBytes = CryptoUnitUtils.bytesOfSize(GZIP_THRESHOLD + 100);
Table2 t1 = context.newObject(Table2.class);
t1.setPlainBytes("plain_1".getBytes());
t1.setCryptoBytes(cryptoBytes);
context.commitChanges();
Object[] data = table2.select();
assertArrayEquals("plain_1".getBytes(), (byte[]) data[1]);
Header h = Header.create((byte[]) data[2], 0);
assertTrue(h.isCompressed());
assertArrayEquals(cryptoBytes,
CryptoUnitUtils.gunzip(CryptoUnitUtils.decrypt_AES_CBC((byte[]) data[2], runtime)));
}
@Test
public void testInsert_Small() throws SQLException {
ObjectContext context = runtime.newContext();
// make sure compression is on...
byte[] cryptoBytes = CryptoUnitUtils.bytesOfSize(GZIP_THRESHOLD - 20);
Table2 t1 = context.newObject(Table2.class);
t1.setPlainBytes("plain_1".getBytes());
t1.setCryptoBytes(cryptoBytes);
context.commitChanges();
Object[] data = table2.select();
assertArrayEquals("plain_1".getBytes(), (byte[]) data[1]);
Header h = Header.create((byte[]) data[2], 0);
assertFalse(h.isCompressed());
assertArrayEquals(cryptoBytes, CryptoUnitUtils.decrypt_AES_CBC((byte[]) data[2], runtime));
}
@Test
public void testInsert_MultipleObjects() throws SQLException {
ObjectContext context = runtime.newContext();
// make sure compression is on...
byte[] cryptoBytes1 = CryptoUnitUtils.bytesOfSize(GZIP_THRESHOLD + 101);
byte[] cryptoBytes2 = CryptoUnitUtils.bytesOfSize(GZIP_THRESHOLD + 102);
Table2 t1 = context.newObject(Table2.class);
t1.setPlainBytes("a".getBytes());
t1.setCryptoBytes(cryptoBytes1);
Table2 t2 = context.newObject(Table2.class);
t2.setPlainBytes("b".getBytes());
t2.setCryptoBytes(cryptoBytes2);
Table2 t3 = context.newObject(Table2.class);
t3.setPlainBytes("c".getBytes());
t3.setCryptoBytes(null);
context.commitChanges();
List<Object[]> data = table2.selectAll();
assertEquals(3, data.size());
Map<String, byte[]> cipherByPlain = new HashMap<String, byte[]>();
for (Object[] r : data) {
cipherByPlain.put(new String((byte[]) r[1]), (byte[]) r[2]);
}
assertArrayEquals(cryptoBytes1,
CryptoUnitUtils.gunzip(CryptoUnitUtils.decrypt_AES_CBC(cipherByPlain.get("a"), runtime)));
assertArrayEquals(cryptoBytes2,
CryptoUnitUtils.gunzip(CryptoUnitUtils.decrypt_AES_CBC(cipherByPlain.get("b"), runtime)));
assertNull(cipherByPlain.get("c"));
}
@Test
public void test_SelectQuery() throws SQLException {
// make sure compression is on...
byte[] cryptoBytes1 = CryptoUnitUtils.bytesOfSize(GZIP_THRESHOLD + 101);
byte[] cryptoBytes2 = CryptoUnitUtils.bytesOfSize(GZIP_THRESHOLD + 102);
ObjectContext context = runtime.newContext();
Table2 t1 = context.newObject(Table2.class);
t1.setPlainBytes("a".getBytes());
t1.setCryptoBytes(cryptoBytes1);
Table2 t2 = context.newObject(Table2.class);
t2.setPlainBytes("b".getBytes());
t2.setCryptoBytes(cryptoBytes2);
Table2 t3 = context.newObject(Table2.class);
t3.setPlainBytes("c".getBytes());
t3.setCryptoBytes(null);
context.commitChanges();
SelectQuery<Table2> select = SelectQuery.query(Table2.class);
select.addOrdering(Table2.PLAIN_BYTES.asc());
List<Table2> result = runtime.newContext().select(select);
assertEquals(3, result.size());
assertArrayEquals(cryptoBytes1, result.get(0).getCryptoBytes());
assertArrayEquals(cryptoBytes2, result.get(1).getCryptoBytes());
assertArrayEquals(null, result.get(2).getCryptoBytes());
}
}
| [
"aadamchik@apache.org"
] | aadamchik@apache.org |
c67bf910e130b699dc105779c42c209220fe5dff | d8615587fee79c1a052be0081d819fdec9742439 | /src/Boulder/Modele/Cases/Diamonds.java | e68dc7d05ec498576d30bb506ef3b0c463ccfe51 | [] | no_license | bouldersj/dz.BoulderDash.demo | e3055c7444f73a3799530b53786cedddf19c883a | 2dc273818e0ddd653407818ccb80eb9d55e5a71d | refs/heads/master | 2020-05-30T18:21:19.956541 | 2019-06-03T01:03:10 | 2019-06-03T01:03:10 | 189,894,844 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,065 | java | /**
*
*/
package Boulder.Modele.Cases;
import Boulder.Modele.GameState;
import Boulder.Modele.Animation.Animation;
import Boulder.Modele.Animation.AnimationManager;
/***
*
* @author liabe
*
*/
public class Diamonds extends MovableItems {
/**
* @param pos_x
* @param pos_y
*/
public Diamonds(int pos_x, int pos_y) {
super(pos_x, pos_y);
}
@Override
public String ID() {
return "D";
}
/**
* fonction d'interaction personnage, lorsque le personnage arrive on
* échange les cases, on insère du vide, on incrémente le score de 25 et on
* décrémente le nombre de diamants à trouver
*/
@Override
public boolean IsPlayerWalking(GameState N) {
N.echangeCases(N.getPerso().getX(), N.getPerso().getY(), getX(), getY());
N.insereVide(getX(), getY());
N.remplirUpTable(N.getPerso().getX(), N.getPerso().getY());
N.AddDscore();
N.addToScore(25);
N.remUptable(this);
return true;
}
/**
* renvoie le sprite de diamant
*/
@Override
public Animation getAnimation() {
return AnimationManager.getDiamant();
}
}
| [
"noreply@github.com"
] | noreply@github.com |
912c6e8580ec275889ec1081ec922f72570280c9 | 48ed49dddf7f63227b30df44e43954dd31df85f8 | /corejava/experiments/src/com/cg/basics/genericdemo/Store.java | d97ab85452d6a4631df2f0980862c6170cfe28c0 | [] | no_license | vineetsemwal/cgcloudimmersive21 | 6fbd5593196fafadd6ffc5239e27c2f7b39aabc2 | 9569317a17d75560a1b04365969d767e38e22204 | refs/heads/master | 2023-06-09T12:29:55.332926 | 2021-06-28T10:45:56 | 2021-06-28T10:45:56 | 366,244,105 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 225 | java | package com.cg.basics.genericdemo;
public class Store <T>{
private T element;
public void setElement(T element) {
this.element = element;
}
public T getElement() {
return element;
}
}
| [
"vineetsemwal82@gmail.com"
] | vineetsemwal82@gmail.com |
94130b0d628d9e07bf7eebc9d417f7e4553948cc | af58eabf5360cb82082e1b0590696b627118d5a3 | /app-main/src/main/java/com/zhongmei/bty/snack/base/AbstractMVPBaseDialogFragment.java | c29088b02bc2516dbf407f5e9ab1c3753c2e03c7 | [] | no_license | sengeiou/marketing-app | f4b670f3996ba190decd2f1b8e4a276eb53b8b2a | 278f3da95584e2ab7d97dff1a067db848e70a9f3 | refs/heads/master | 2020-06-07T01:51:25.743676 | 2019-06-20T08:58:28 | 2019-06-20T08:58:28 | 192,895,799 | 0 | 1 | null | 2019-06-20T09:59:09 | 2019-06-20T09:59:08 | null | UTF-8 | Java | false | false | 1,214 | java | package com.zhongmei.bty.snack.base;
import android.content.Context;
import android.os.Bundle;
import com.zhongmei.yunfu.util.Checks;
import com.zhongmei.yunfu.ui.base.BasicDialogFragment;
/**
* Created by demo on 2018/12/15
*/
public abstract class AbstractMVPBaseDialogFragment<V extends IBaseView, P extends IBasePresenter<V>> extends BasicDialogFragment implements IBaseView {
private static final String TAG = AbstractMVPBaseDialogFragment.class.getSimpleName();
private P mPresenter;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mPresenter = createPresenter();
Checks.verifyNotNull(mPresenter, "mPresenter");
mPresenter.attachView((V) this);
}
@Override
public void onDestroy() {
super.onDestroy();
if (mPresenter != null) {
mPresenter.detachView();
mPresenter = null;
}
}
@Override
public Context getViewContext() {
return getContext();
}
@Override
public void showToast(String content) {
}
protected abstract P createPresenter();
public P getPresenter() {
return mPresenter;
}
}
| [
"yangyuanping_cd@shishike.com"
] | yangyuanping_cd@shishike.com |
a3b428ab1cdf0f479991ad1cbe402cd6c7b51920 | f71e5c012965177b53a8411192b5bddc8a30546b | /hbase-rest/src/main/java/org/bigtech/hbase/dao/util/Constants.java | f7b26f16cf31596218d854d0c27070582898020f | [] | no_license | trguduru/hbase | ea32c36e6ecc0721140fc8e33e25744092c4e1fa | a5fb77ba551ff4f517c44e60d0b1ed38545a37d3 | refs/heads/master | 2020-04-19T01:34:24.611182 | 2016-04-22T00:59:33 | 2016-04-22T00:59:33 | 167,875,567 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 346 | java | package org.bigtech.hbase.dao.util;
/**
* Constants for HBase client API
*
* @author Thirupathi Reddy Guduru
* @date May 20, 2015
*/
public interface Constants {
public final String table = "user";
public final String columnFamily = "data";
public final String columnQualifier = "name";
public final String partialRowKey = "/user/";
}
| [
"guduru.thirupathireddy@gmail.com"
] | guduru.thirupathireddy@gmail.com |
0c3cfcc190150a73054885f3128c1640b3d6123b | 433ec77fb528b6e02af1b76456def06d64f8ae0c | /src/com/softeem/pp/servlet/ShowUserServlet.java | bf84afc40f479d01c43a4f4c53cbb0498b0bbc9b | [] | no_license | CoderZQY/AlbumManage | a97ce7e9b5ca47c6a533c683bba7585991e34802 | 19e23bb1981644339cab2637dabd9e13a8f16993 | refs/heads/main | 2023-03-01T18:04:17.980246 | 2021-02-11T07:52:01 | 2021-02-11T07:52:01 | 337,955,286 | 1 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,281 | java | package com.softeem.pp.servlet;
import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import com.softeem.dao.UserDAO;
import com.softeem.dao.impl.UserDAOImpl;
import com.softeem.pp.dto.User;
public class ShowUserServlet extends HttpServlet {
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
doPost(request,response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
String cp = request.getParameter("currentPage");
int currentPage = Integer.parseInt(cp);
if(currentPage<1){
currentPage = 1;
}
UserDAO udao = new UserDAOImpl();
int totalPage = udao.getTotalPage(10);
if(currentPage>totalPage){
currentPage = totalPage;
}
List<User> list = udao.findAllUser(10, currentPage);
request.setAttribute("currentPage", currentPage);
request.setAttribute("totalPage", totalPage);
request.setAttribute("list", list);
request.getRequestDispatcher("showAllUser.jsp").forward(request, response);
}
}
| [
"1277565476@qq.com"
] | 1277565476@qq.com |
5ca874d8b74965569eea9ee6c19e56027e4e3bcf | 5849f5ee83beb2a294d58797c6865e92a063aa38 | /src/main/java/com/car/castel/Insurersservice/LicenceNoService.java | 4d559592a8d0c7ea3a91aa7b2e8f501969fa6e75 | [] | no_license | sahanscarrental/Car-Rental-Insurance-Service | ea9d6005bd63e6a9f623fd57c6ba405112e824b7 | 3dbfb0184217b2493ec185192e776779b5e906dc | refs/heads/master | 2023-08-26T20:39:59.423216 | 2021-11-02T02:55:18 | 2021-11-02T02:55:18 | 423,687,625 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,672 | java | package com.car.castel.Insurersservice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponentsBuilder;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
@Service
@EnableScheduling
public class LicenceNoService {
@Autowired
private RestTemplate restTemplate;
@Autowired
private LicenceNoRepository licenceNoRepository;
public static final String BOOKING_HOST = "http://BOOKIING-SERVICE/booking-service/api";
@Scheduled(fixedRate = 300000)
public void updateBooking() {
String fooResourceUrl = BOOKING_HOST +"/fake-claim";
URI uri = UriComponentsBuilder.fromUriString(fooResourceUrl)
.build()
.toUri();
List<String> collect = licenceNoRepository.findAll().stream().distinct().map(licenceNo -> licenceNo.getLicenceNo()).collect(Collectors.toList());
ResponseEntity<Object> response = restTemplate.postForEntity(uri ,collect, Object.class);
}
/**
* creating sample data to initialize the database for fraud insurance claims
*/
public void createSampleData() {
LicenceNo licenceNo1 = new LicenceNo();
LicenceNo licenceNo2 = new LicenceNo();
LicenceNo licenceNo3 = new LicenceNo();
LicenceNo licenceNo4 = new LicenceNo();
LicenceNo licenceNo5 = new LicenceNo();
LicenceNo licenceNo6 = new LicenceNo();
LicenceNo licenceNo7 = new LicenceNo();
LicenceNo licenceNo8 = new LicenceNo();
licenceNo1.setLicenceNo("B826456");
licenceNo2.setLicenceNo("B523346");
licenceNo3.setLicenceNo("B131450");
licenceNo4.setLicenceNo("B567856");
licenceNo5.setLicenceNo("B689880");
licenceNo6.setLicenceNo("B567789");
licenceNo7.setLicenceNo("B345678");
licenceNo8.setLicenceNo("B131399");
List<LicenceNo> licenceNoList = new ArrayList<>();
licenceNoList.add(licenceNo1);
licenceNoList.add(licenceNo2);
licenceNoList.add(licenceNo3);
licenceNoList.add(licenceNo4);
licenceNoList.add(licenceNo5);
licenceNoList.add(licenceNo6);
licenceNoList.add(licenceNo7);
licenceNoList.add(licenceNo8);
List<LicenceNo> result = this.licenceNoRepository.saveAll(licenceNoList);
}
}
| [
"iamsahan.banger@gmail.com"
] | iamsahan.banger@gmail.com |
014459ebe428d8bae7cda3a5aba8a7119fd72a4b | 5e10fd34a5832b99238e468cdbec6148ad9bcf1d | /src/main/java/forum/control/RegJdbcControl.java | 6069489e727c634becc34b7c988e593a740440f8 | [] | no_license | vsolomatov/job4j_forum | ea9cbd3983499ef9d610d659d86c108d7dbcf6da | 2f1c21e05b13886f148c032e370378f14a78c4d0 | refs/heads/master | 2023-08-14T13:17:03.222322 | 2021-10-13T17:14:26 | 2021-10-13T17:14:26 | 416,590,840 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,856 | java | package forum.control;
import forum.model.User;
import forum.repository.AuthorityRepository;
import forum.repository.UserRepository;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
@Controller
public class RegJdbcControl {
private final PasswordEncoder encoder;
private final UserRepository userRepository;
private final AuthorityRepository authorityRepository;
public RegJdbcControl(PasswordEncoder encoder, UserRepository userRepository, AuthorityRepository authorityRepository) {
this.encoder = encoder;
this.userRepository = userRepository;
this.authorityRepository = authorityRepository;
}
@PostMapping("/reg")
public String save(@ModelAttribute User user) {
if (userRepository.findByName(user.getUsername()).isPresent()) {
return "redirect:/reg?error=true";
}
user.setEnabled(true);
user.setPassword(encoder.encode(user.getPassword()));
user.setAuthority(authorityRepository.findByAuthority("ROLE_USER"));
userRepository.save(user);
return "redirect:/login";
}
@GetMapping("/reg")
public String reg(@RequestParam(value = "error", required = false) String error, Model model) {
String errorMessage = null;
if (error != null) {
errorMessage = "Пользователь с таким именем уже зарегистрирован!";
}
model.addAttribute("errorMessage", errorMessage);
return "reg";
}
}
| [
"solomatoff.studio@gmail.com"
] | solomatoff.studio@gmail.com |
fc6034d06d47d5a93045f903eff65f0f6c7049d3 | 0932e72402eae3a9ad7c3edbe62363dca2c7999a | /src/test/java/com/miliatin/tictactoe/TicTacToeApplicationTests.java | 3f6099034b7aa13d68e791af979c71e25cc28bd7 | [] | no_license | sashamiliatin/springRepository | ccd5686443acc6ad88e9a111d2ad69b48d8e3c7d | 3664dccad28962bd31413e8ec5de7dede544cf3a | refs/heads/master | 2022-02-22T21:53:33.845155 | 2019-10-20T14:02:43 | 2019-10-20T14:02:43 | 216,370,627 | 0 | 0 | null | 2022-02-10T01:29:43 | 2019-10-20T13:59:42 | Java | UTF-8 | Java | false | false | 342 | java | package com.miliatin.tictactoe;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
@RunWith(SpringRunner.class)
@SpringBootTest
public class TicTacToeApplicationTests {
@Test
public void contextLoads() {
}
}
| [
"34767366+sashamiliatin@users.noreply.github.com"
] | 34767366+sashamiliatin@users.noreply.github.com |
c94684d560a85c95f436c4e06be5fc5359a2c785 | b229e2a4a1cf794ae8e8c07fbc39a85b5142e88e | /src/packages/services/ProduitCRUD.java | 342bbf3d610332a84dfa593807ead86557d32514 | [] | no_license | samir-kch/Gestion-salle-de-sport | 1d3226b619eec0f70046a5d42f3837ebbc5820c2 | 13ad72b50010b643f10e388db17c6af7b1bf5327 | refs/heads/main | 2023-04-26T20:33:23.455514 | 2021-04-11T00:19:15 | 2021-04-11T00:19:15 | null | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 4,512 | 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 packages.services;
import java.sql.SQLException;
import java.util.List;
import packages.entities.Produit;
import packages.interfaces.IProduit;
import packages.tools.MyConnection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import packages.gui.AjouterProduitController;
public class ProduitCRUD implements IProduit{
@Override
public void ajouterProduit(Produit t) {
try{
String req = "INSERT INTO produit (nom_produit,marque_produit,quantite,prix,image_path)"
+ "VALUES (?,?,?,?,?)";
PreparedStatement pst = MyConnection.getInstance().getCnx().prepareStatement(req);
pst.setString(1, t.getNom_produit());
pst.setString(2,t.getMarque_produit());
pst.setInt(3,t.getQuantite());
pst.setDouble(4,t.getPrix());
pst.setString(5,t.getImage_path());
pst.executeUpdate();
System.out.println("Produit ajouté");
} catch (SQLException ex){
System.out.println(ex.getMessage());
}
}
@Override
public void modifierProduit(Produit t, int id) {
try {
String req = "UPDATE produit SET nom_produit=?,marque_produit=?,quantite=?,prix=?,image_path=?"
+ " WHERE id_produit=?";
PreparedStatement pst = MyConnection.getInstance().getCnx()
.prepareStatement(req);
pst.setString(1, t.getNom_produit());
pst.setString(2,t.getMarque_produit());
pst.setInt(3,t.getQuantite());
pst.setDouble(4,t.getPrix());
pst.setString(5,t.getImage_path());
pst.setInt(6,id);
pst.executeUpdate();
System.out.println("Produit modifié!");
} catch (SQLException ex) {
System.out.println(ex.getMessage());
}
}
@Override
public void supprimerProduit(int id) {
try {
String req = "DELETE FROM produit where id_produit=?";
PreparedStatement pst = MyConnection.getInstance().getCnx().prepareStatement(req);
pst.setInt(1,id);
int res = pst.executeUpdate();
if (res==0) {
System.out.println("produit introuvable!");
}else{
System.out.println("Produit supprimé");
}
} catch (SQLException ex) {
System.out.println(ex.getMessage());
}
}
@Override
public List<Produit> afficherProduits() {
List<Produit> produitsList = new ArrayList<>();
try {
String req = "SELECT * FROM produit";
Statement st = MyConnection.getInstance().getCnx().createStatement();
ResultSet rs = st.executeQuery(req);
while(rs.next()){
Produit p = new Produit();
p.setId_produit(rs.getInt("id_produit"));
p.setNom_produit(rs.getString("nom_produit"));
p.setMarque_produit(rs.getString("marque_produit"));
p.setQuantite(rs.getInt("quantite"));
p.setPrix(rs.getDouble("prix"));
p.setImage_path(rs.getString("image_path"));
produitsList.add(p);
}
} catch (SQLException ex) {
System.out.println(ex.getMessage());
}
return produitsList;
}
/*@Override
public void modifierProduit(Produit t) {
try {
String req = "UPDATE produit SET nom_produit=?,marque_produit=?,quantite=?,prix=?,image_path=?"
+ " WHERE id_produit=?";
PreparedStatement pst = MyConnection.getInstance().getCnx()
.prepareStatement(req);
pst.setString(1, t.getNom_produit());
pst.setString(2,t.getMarque_produit());
pst.setInt(3,t.getQuantite());
pst.setInt(4,t.getPrix());
pst.setString(5,t.getImage_path());
pst.setInt(6,t.getId_produit());
pst.executeUpdate();
System.out.println("Produit modifié!");
} catch (SQLException ex) {
System.out.println(ex.getMessage());
}
}*/
}
| [
"79525860+moussabader@users.noreply.github.com"
] | 79525860+moussabader@users.noreply.github.com |
157bf691de698577217e71fdf4bbc1e3c1faa1c3 | bfec10fd1d4148aa49b11a94575be9bb03992e3d | /app/src/main/java/vasyl/v/stoliarchuk/addresstracker/data/datasource/remote/retrofit/RestApi.java | cbbfb390dc560cb2c7175028243568b149a220b2 | [] | no_license | freaksgit/test-task-location | c7e9a341b5defecc60f82d198b1db682325e09cb | 1c1e594faff535ef144d3a709cf57702ed326336 | refs/heads/master | 2020-03-26T12:58:40.020850 | 2018-08-16T00:43:31 | 2018-08-16T00:43:31 | 144,916,501 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 663 | java | package vasyl.v.stoliarchuk.addresstracker.data.datasource.remote.retrofit;
import io.reactivex.Maybe;
import retrofit2.http.GET;
import retrofit2.http.Query;
import vasyl.v.stoliarchuk.addresstracker.data.datasource.remote.retrofit.entity.RetrofitPlace;
import static vasyl.v.stoliarchuk.addresstracker.data.datasource.remote.retrofit.RestApi.RestConfig.GET_PLACE;
public interface RestApi {
@GET(GET_PLACE)
Maybe<RetrofitPlace> getPlace(@Query(value = "lat") double lat, @Query(value = "lon") double lon);
interface RestConfig {
String BASE_URL = "https://nominatim.openstreetmap.org";
String GET_PLACE = "/reverse.php";
}
}
| [
"stoliarchuk.v.vasyl@gmail.com"
] | stoliarchuk.v.vasyl@gmail.com |
97feb926c0f0a9af8f016cbb21fb29649da708b8 | dcbb8db0dc316a3ca3c1e6fddc23124b6cede5b4 | /GratificacaoGerente.java | 8ac661853b4cbbca91fb0a74037f3232b5bb8583 | [] | no_license | CinthiaIrineu/map | d6c0c89b8d752cc4bdd687ecc452de17a9c3eef3 | 9f81c2169562a5e389504f1e1e24ee97a2f04504 | refs/heads/master | 2021-01-20T10:06:02.219624 | 2017-06-02T05:52:29 | 2017-06-02T05:52:29 | 90,321,781 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 610 | java |
public class GratificacaoGerente implements Gratificacao {
public double calcularGratificacao(Funcionario umFuncionario) {
try{
if (umFuncionario.getNivel() == 1) {
return umFuncionario.getSalarioBase() * 1.3;
}else if (umFuncionario.getNivel() == 2) {
return umFuncionario.getSalarioBase() * 1.45;
}
}catch (Exception e) {
e.printStackTrace();
}
return umFuncionario.getSalarioBase();
}
}
| [
"aluno@cesed.local"
] | aluno@cesed.local |
f0773874d600ca65cf6d52e7a8617d2ee5675865 | e8b63154a6cf7357e8331378410b29d2b13c2772 | /plus/build/generated/source/r/debug/com/google/android/gms/games/R.java | 529da104dbdb6ca521bf6e0c6f48f0d04f3a7117 | [] | no_license | rsv355/ShaketoShareLatest | 09e4f90cebaa20541f0c98bd5c8ef72177ce54e0 | c1a9b791b8f3d8b95d3de7139cbcddb6d72bd726 | refs/heads/master | 2016-09-06T02:00:34.811508 | 2015-04-15T11:26:43 | 2015-04-15T11:26:43 | 33,850,878 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 15,075 | 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.google.android.gms.games;
public final class R {
public static final class attr {
public static final int adSize = 0x7f010000;
public static final int adSizes = 0x7f010001;
public static final int adUnitId = 0x7f010002;
public static final int appTheme = 0x7f010017;
public static final int buyButtonAppearance = 0x7f01001e;
public static final int buyButtonHeight = 0x7f01001b;
public static final int buyButtonText = 0x7f01001d;
public static final int buyButtonWidth = 0x7f01001c;
public static final int cameraBearing = 0x7f010008;
public static final int cameraTargetLat = 0x7f010009;
public static final int cameraTargetLng = 0x7f01000a;
public static final int cameraTilt = 0x7f01000b;
public static final int cameraZoom = 0x7f01000c;
public static final int circleCrop = 0x7f010006;
public static final int environment = 0x7f010018;
public static final int fragmentMode = 0x7f01001a;
public static final int fragmentStyle = 0x7f010019;
public static final int imageAspectRatio = 0x7f010005;
public static final int imageAspectRatioAdjust = 0x7f010004;
public static final int liteMode = 0x7f01000d;
public static final int mapType = 0x7f010007;
public static final int maskedWalletDetailsBackground = 0x7f010021;
public static final int maskedWalletDetailsButtonBackground = 0x7f010023;
public static final int maskedWalletDetailsButtonTextAppearance = 0x7f010022;
public static final int maskedWalletDetailsHeaderTextAppearance = 0x7f010020;
public static final int maskedWalletDetailsLogoImageType = 0x7f010025;
public static final int maskedWalletDetailsLogoTextColor = 0x7f010024;
public static final int maskedWalletDetailsTextAppearance = 0x7f01001f;
public static final int uiCompass = 0x7f01000e;
public static final int uiMapToolbar = 0x7f010016;
public static final int uiRotateGestures = 0x7f01000f;
public static final int uiScrollGestures = 0x7f010010;
public static final int uiTiltGestures = 0x7f010011;
public static final int uiZoomControls = 0x7f010012;
public static final int uiZoomGestures = 0x7f010013;
public static final int useViewLifecycle = 0x7f010014;
public static final int windowTransitionStyle = 0x7f010003;
public static final int zOrderOnTop = 0x7f010015;
}
public static final class color {
public static final int common_action_bar_splitter = 0x7f050000;
public static final int common_signin_btn_dark_text_default = 0x7f050001;
public static final int common_signin_btn_dark_text_disabled = 0x7f050002;
public static final int common_signin_btn_dark_text_focused = 0x7f050003;
public static final int common_signin_btn_dark_text_pressed = 0x7f050004;
public static final int common_signin_btn_default_background = 0x7f050005;
public static final int common_signin_btn_light_text_default = 0x7f050006;
public static final int common_signin_btn_light_text_disabled = 0x7f050007;
public static final int common_signin_btn_light_text_focused = 0x7f050008;
public static final int common_signin_btn_light_text_pressed = 0x7f050009;
public static final int common_signin_btn_text_dark = 0x7f050017;
public static final int common_signin_btn_text_light = 0x7f050018;
public static final int wallet_bright_foreground_disabled_holo_light = 0x7f05000a;
public static final int wallet_bright_foreground_holo_dark = 0x7f05000b;
public static final int wallet_bright_foreground_holo_light = 0x7f05000c;
public static final int wallet_dim_foreground_disabled_holo_dark = 0x7f05000d;
public static final int wallet_dim_foreground_holo_dark = 0x7f05000e;
public static final int wallet_dim_foreground_inverse_disabled_holo_dark = 0x7f05000f;
public static final int wallet_dim_foreground_inverse_holo_dark = 0x7f050010;
public static final int wallet_highlighted_text_holo_dark = 0x7f050011;
public static final int wallet_highlighted_text_holo_light = 0x7f050012;
public static final int wallet_hint_foreground_holo_dark = 0x7f050013;
public static final int wallet_hint_foreground_holo_light = 0x7f050014;
public static final int wallet_holo_blue_light = 0x7f050015;
public static final int wallet_link_text_light = 0x7f050016;
public static final int wallet_primary_text_holo_light = 0x7f050019;
public static final int wallet_secondary_text_holo_dark = 0x7f05001a;
}
public static final class drawable {
public static final int common_full_open_on_phone = 0x7f020000;
public static final int common_ic_googleplayservices = 0x7f020001;
public static final int common_signin_btn_icon_dark = 0x7f020002;
public static final int common_signin_btn_icon_disabled_dark = 0x7f020003;
public static final int common_signin_btn_icon_disabled_focus_dark = 0x7f020004;
public static final int common_signin_btn_icon_disabled_focus_light = 0x7f020005;
public static final int common_signin_btn_icon_disabled_light = 0x7f020006;
public static final int common_signin_btn_icon_focus_dark = 0x7f020007;
public static final int common_signin_btn_icon_focus_light = 0x7f020008;
public static final int common_signin_btn_icon_light = 0x7f020009;
public static final int common_signin_btn_icon_normal_dark = 0x7f02000a;
public static final int common_signin_btn_icon_normal_light = 0x7f02000b;
public static final int common_signin_btn_icon_pressed_dark = 0x7f02000c;
public static final int common_signin_btn_icon_pressed_light = 0x7f02000d;
public static final int common_signin_btn_text_dark = 0x7f02000e;
public static final int common_signin_btn_text_disabled_dark = 0x7f02000f;
public static final int common_signin_btn_text_disabled_focus_dark = 0x7f020010;
public static final int common_signin_btn_text_disabled_focus_light = 0x7f020011;
public static final int common_signin_btn_text_disabled_light = 0x7f020012;
public static final int common_signin_btn_text_focus_dark = 0x7f020013;
public static final int common_signin_btn_text_focus_light = 0x7f020014;
public static final int common_signin_btn_text_light = 0x7f020015;
public static final int common_signin_btn_text_normal_dark = 0x7f020016;
public static final int common_signin_btn_text_normal_light = 0x7f020017;
public static final int common_signin_btn_text_pressed_dark = 0x7f020018;
public static final int common_signin_btn_text_pressed_light = 0x7f020019;
public static final int ic_plusone_medium_off_client = 0x7f02001b;
public static final int ic_plusone_small_off_client = 0x7f02001c;
public static final int ic_plusone_standard_off_client = 0x7f02001d;
public static final int ic_plusone_tall_off_client = 0x7f02001e;
public static final int powered_by_google_dark = 0x7f02001f;
public static final int powered_by_google_light = 0x7f020020;
}
public static final class id {
public static final int adjust_height = 0x7f060003;
public static final int adjust_width = 0x7f060002;
public static final int book_now = 0x7f060013;
public static final int buyButton = 0x7f06000d;
public static final int buy_now = 0x7f060012;
public static final int buy_with_google = 0x7f060011;
public static final int classic = 0x7f060015;
public static final int donate_with_google = 0x7f060014;
public static final int grayscale = 0x7f060016;
public static final int holo_dark = 0x7f060008;
public static final int holo_light = 0x7f060009;
public static final int hybrid = 0x7f060007;
public static final int match_parent = 0x7f06000f;
public static final int monochrome = 0x7f060017;
public static final int none = 0x7f060001;
public static final int normal = 0x7f060004;
public static final int production = 0x7f06000a;
public static final int sandbox = 0x7f06000b;
public static final int satellite = 0x7f060005;
public static final int selectionDetails = 0x7f06000e;
public static final int slide = 0x7f060000;
public static final int strict_sandbox = 0x7f06000c;
public static final int terrain = 0x7f060006;
public static final int wrap_content = 0x7f060010;
}
public static final class integer {
public static final int google_play_services_version = 0x7f070000;
}
public static final class raw {
public static final int gtm_analytics = 0x7f040000;
}
public static final class string {
public static final int accept = 0x7f080000;
public static final int common_android_wear_notification_needs_update_text = 0x7f080003;
public static final int common_android_wear_update_text = 0x7f080004;
public static final int common_android_wear_update_title = 0x7f080005;
public static final int common_google_play_services_enable_button = 0x7f080006;
public static final int common_google_play_services_enable_text = 0x7f080007;
public static final int common_google_play_services_enable_title = 0x7f080008;
public static final int common_google_play_services_error_notification_requested_by_msg = 0x7f080009;
public static final int common_google_play_services_install_button = 0x7f08000a;
public static final int common_google_play_services_install_text_phone = 0x7f08000b;
public static final int common_google_play_services_install_text_tablet = 0x7f08000c;
public static final int common_google_play_services_install_title = 0x7f08000d;
public static final int common_google_play_services_invalid_account_text = 0x7f08000e;
public static final int common_google_play_services_invalid_account_title = 0x7f08000f;
public static final int common_google_play_services_needs_enabling_title = 0x7f080010;
public static final int common_google_play_services_network_error_text = 0x7f080011;
public static final int common_google_play_services_network_error_title = 0x7f080012;
public static final int common_google_play_services_notification_needs_installation_title = 0x7f080013;
public static final int common_google_play_services_notification_needs_update_title = 0x7f080014;
public static final int common_google_play_services_notification_ticker = 0x7f080015;
public static final int common_google_play_services_sign_in_failed_text = 0x7f080016;
public static final int common_google_play_services_sign_in_failed_title = 0x7f080017;
public static final int common_google_play_services_unknown_issue = 0x7f080018;
public static final int common_google_play_services_unsupported_text = 0x7f080019;
public static final int common_google_play_services_unsupported_title = 0x7f08001a;
public static final int common_google_play_services_update_button = 0x7f08001b;
public static final int common_google_play_services_update_text = 0x7f08001c;
public static final int common_google_play_services_update_title = 0x7f08001d;
public static final int common_open_on_phone = 0x7f08001e;
public static final int common_signin_button_text = 0x7f08001f;
public static final int common_signin_button_text_long = 0x7f080020;
public static final int commono_google_play_services_api_unavailable_text = 0x7f080021;
public static final int create_calendar_message = 0x7f080022;
public static final int create_calendar_title = 0x7f080023;
public static final int decline = 0x7f080024;
public static final int store_picture_message = 0x7f080049;
public static final int store_picture_title = 0x7f08004a;
public static final int wallet_buy_button_place_holder = 0x7f08004c;
}
public static final class style {
public static final int Theme_IAPTheme = 0x7f090000;
public static final int WalletFragmentDefaultButtonTextAppearance = 0x7f090001;
public static final int WalletFragmentDefaultDetailsHeaderTextAppearance = 0x7f090002;
public static final int WalletFragmentDefaultDetailsTextAppearance = 0x7f090003;
public static final int WalletFragmentDefaultStyle = 0x7f090004;
}
public static final class styleable {
public static final int[] AdsAttrs = { 0x7f010000, 0x7f010001, 0x7f010002 };
public static final int AdsAttrs_adSize = 0;
public static final int AdsAttrs_adSizes = 1;
public static final int AdsAttrs_adUnitId = 2;
public static final int[] CustomWalletTheme = { 0x7f010003 };
public static final int CustomWalletTheme_windowTransitionStyle = 0;
public static final int[] LoadingImageView = { 0x7f010004, 0x7f010005, 0x7f010006 };
public static final int LoadingImageView_circleCrop = 2;
public static final int LoadingImageView_imageAspectRatio = 1;
public static final int LoadingImageView_imageAspectRatioAdjust = 0;
public static final int[] MapAttrs = { 0x7f010007, 0x7f010008, 0x7f010009, 0x7f01000a, 0x7f01000b, 0x7f01000c, 0x7f01000d, 0x7f01000e, 0x7f01000f, 0x7f010010, 0x7f010011, 0x7f010012, 0x7f010013, 0x7f010014, 0x7f010015, 0x7f010016 };
public static final int MapAttrs_cameraBearing = 1;
public static final int MapAttrs_cameraTargetLat = 2;
public static final int MapAttrs_cameraTargetLng = 3;
public static final int MapAttrs_cameraTilt = 4;
public static final int MapAttrs_cameraZoom = 5;
public static final int MapAttrs_liteMode = 6;
public static final int MapAttrs_mapType = 0;
public static final int MapAttrs_uiCompass = 7;
public static final int MapAttrs_uiMapToolbar = 15;
public static final int MapAttrs_uiRotateGestures = 8;
public static final int MapAttrs_uiScrollGestures = 9;
public static final int MapAttrs_uiTiltGestures = 10;
public static final int MapAttrs_uiZoomControls = 11;
public static final int MapAttrs_uiZoomGestures = 12;
public static final int MapAttrs_useViewLifecycle = 13;
public static final int MapAttrs_zOrderOnTop = 14;
public static final int[] WalletFragmentOptions = { 0x7f010017, 0x7f010018, 0x7f010019, 0x7f01001a };
public static final int WalletFragmentOptions_appTheme = 0;
public static final int WalletFragmentOptions_environment = 1;
public static final int WalletFragmentOptions_fragmentMode = 3;
public static final int WalletFragmentOptions_fragmentStyle = 2;
public static final int[] WalletFragmentStyle = { 0x7f01001b, 0x7f01001c, 0x7f01001d, 0x7f01001e, 0x7f01001f, 0x7f010020, 0x7f010021, 0x7f010022, 0x7f010023, 0x7f010024, 0x7f010025 };
public static final int WalletFragmentStyle_buyButtonAppearance = 3;
public static final int WalletFragmentStyle_buyButtonHeight = 0;
public static final int WalletFragmentStyle_buyButtonText = 2;
public static final int WalletFragmentStyle_buyButtonWidth = 1;
public static final int WalletFragmentStyle_maskedWalletDetailsBackground = 6;
public static final int WalletFragmentStyle_maskedWalletDetailsButtonBackground = 8;
public static final int WalletFragmentStyle_maskedWalletDetailsButtonTextAppearance = 7;
public static final int WalletFragmentStyle_maskedWalletDetailsHeaderTextAppearance = 5;
public static final int WalletFragmentStyle_maskedWalletDetailsLogoImageType = 10;
public static final int WalletFragmentStyle_maskedWalletDetailsLogoTextColor = 9;
public static final int WalletFragmentStyle_maskedWalletDetailsTextAppearance = 4;
}
}
| [
"softeng.krishna@gmail.com"
] | softeng.krishna@gmail.com |
8051255051850af045bec35cc9bb3708974b07e0 | 28918d3ca4b636ecfb0054bf98efcf0ed379de3c | /src/main/java/controller/GroupsController.java | 07ac29c4a4a39fc67612dbe71e6723aa2a3024ae | [] | no_license | lmmendonca/agenda-db | 16ef7e91f033a39ea9d62885ff0f502772f2a617 | 46b002ba3dbf5b052590ab8c42e6a6cd8b54f6a6 | refs/heads/master | 2022-01-11T09:47:21.683895 | 2019-09-24T14:02:51 | 2019-09-24T14:02:51 | 209,401,746 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 2,967 | java | package controller;
import model.Group;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
public class GroupsController {
private Connection connection;
public GroupsController(Connection connection) {
this.connection = connection;
}
public Group create(Group g) {
String sql = "INSERT INTO groups(description) VALUES(?);";
try {
PreparedStatement pstmt = connection.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
pstmt.setString(1, g.getDescription());
pstmt.executeUpdate();
g.setGroupId(pstmt.getGeneratedKeys().getInt(1));
return g;
} catch (SQLException e) {
System.out.println(e.getMessage());
}
return null;
}
public List<Group> create(List<Group> g) {
if (g.size() > 0) {
g.forEach(
group -> {
if (group.getGroupId() == null) {
create(group);
}
});
return g;
}
return null;
}
public List<Group> getGroupsByContactId(Integer id) {
String sql =
"SELECT g.group_id, g.description FROM groups g, contacts_groups cg "
+ "where g.group_id = cg.group_id "
+ "and cg.contact_id = ?;";
List<Group> groups = new ArrayList<>();
try {
PreparedStatement pstmt = connection.prepareStatement(sql);
pstmt.setInt(1, id);
ResultSet rs = pstmt.executeQuery();
while (rs.next()) {
groups.add(new Group(rs.getInt(1), rs.getString(2)));
}
} catch (SQLException e) {
System.out.println(e.getMessage());
}
return groups;
}
public Group getGroupByDescription(String description) {
String sql = "SELECT * FROM groups WHERE description = ?;";
try {
PreparedStatement pstmt = connection.prepareStatement(sql);
pstmt.setString(1, description);
ResultSet rs = pstmt.executeQuery();
return new Group(rs.getInt(1), rs.getString(2));
} catch (SQLException ignored) {
}
return null;
}
public Group delete(Group g) {
String sql = "DELETE FROM groups where group_id = ?;";
try {
PreparedStatement pstmt = connection.prepareStatement(sql);
pstmt.setInt(1, g.getGroupId());
pstmt.executeUpdate();
return g;
} catch (SQLException e) {
System.out.println(e.getMessage());
}
return null;
}
public Group update(Group g) {
String sql = "UPDATE groups SET description = ? WHERE group_id = ?;";
try {
PreparedStatement pstmt = connection.prepareStatement(sql);
pstmt.setString(1, g.getDescription());
pstmt.setInt(2, g.getGroupId());
pstmt.executeUpdate();
return g;
} catch (SQLException e) {
System.out.println(e.getMessage());
}
return null;
}
}
| [
"lmaximino.mendonca@gmail.com"
] | lmaximino.mendonca@gmail.com |
3f59909cd74cc14a3c696e88ed91218f5d07049e | a3e64bf267e320d38d54de270f763cb1c6c8f3c4 | /home_work_24042019/src/main/java/Marathon/barrier/Water.java | c894fe9a82d5637ef794a1a65e5e9a52ffa68bfe | [] | no_license | Kimoman/lessons_java_core | 0e34ac0c2a92d0df4a8dd4da13d5709c65f8541f | b4a8ffbf72bccb77c1ffd47640374a564f2783be | refs/heads/master | 2020-05-17T18:43:36.723950 | 2019-05-08T15:59:09 | 2019-05-08T15:59:09 | 183,893,304 | 0 | 0 | null | 2019-05-08T15:59:10 | 2019-04-28T10:26:32 | Java | UTF-8 | Java | false | false | 331 | java | package Marathon.barrier;
import Marathon.barrier.abstr.Obstacle;
import Marathon.runner.impl.Competitor;
public class Water extends Obstacle {
int length;
public Water(int length) {
this.length = length;
}
@Override
public void doIt(Competitor competitor) {
competitor.swim(length);
}
} | [
"noreply@github.com"
] | noreply@github.com |
bfe58228a5ce85a2fb73d95eaef84e886ef06989 | 5b925d0e0a11e873dbec1d2a7f5ee1a106823bd5 | /CoreJava/src/com/testyantra/javaapp/functions/factorial.java | d563d33ea380c8e9dba30c4bf3ad6740cd180ccf | [] | no_license | MohibHello/ELF-06June19-Testyantra-Mohib.k | a3a07048df9c45ccd2b7936326842851654ef968 | b7a7594e7431987254aa08287269cf115a26ca11 | refs/heads/master | 2022-12-29T12:05:44.336518 | 2019-09-13T16:52:08 | 2019-09-13T16:52:08 | 192,527,313 | 0 | 0 | null | 2020-10-13T15:17:14 | 2019-06-18T11:32:01 | Rich Text Format | UTF-8 | Java | false | false | 345 | java | package com.testyantra.javaapp.functions;
import lombok.extern.java.Log;
@Log
public class Factorial {
public static int fact(int a) {
int f = 1;
for (int i = 1; i <= a; i++) {
f = f * i;
}
return f;
}
public static void main(String[] args) {
int fac = fact(5);
log.info("the factorial of entered number is " + fac);
}
}
| [
"www.muhibkhan@gmail.com"
] | www.muhibkhan@gmail.com |
12f20ac783e823424bc3d792a71150d2951fe4e0 | fda51ab564a3fae01fc8ec0ade4ade3f4e3fa560 | /src/main/java/com/design/patterns/designpatterns/decorator/example2/DecoratorTest.java | a75679319199878d0a60e194bfe842d013227b4f | [] | no_license | liu911025/design-patterns | e1453f48e49af3eb3cf092d61ce30a8658340faf | 3f65c8f260ea13a936b96a9a5d9b395dd2c7b2d4 | refs/heads/master | 2023-04-08T11:39:19.449088 | 2019-06-27T04:23:12 | 2019-06-27T04:23:12 | 188,761,516 | 0 | 0 | null | 2023-03-27T22:26:59 | 2019-05-27T02:59:32 | Java | UTF-8 | Java | false | false | 469 | java | package com.design.patterns.designpatterns.decorator.example2;
/**
* 装饰者模式测试
*/
public class DecoratorTest {
public static void main(String[] args) {
CommonHerbalJelly common = new CommonHerbalJelly();
HoneyHerbalJelly honey = new HoneyHerbalJelly(common);
honey.process();
System.out.println("------------------------");
MilkHerbalJelly milk = new MilkHerbalJelly(honey);
milk.process();
}
}
| [
"liujiatai2016@163.com"
] | liujiatai2016@163.com |
b5c405b313b4ddaf5d8d59b3a593fa19e5c81eb6 | deac36a2f8e8d4597e2e1934ab8a7dd666621b2b | /java源码的副本/src-2/org/omg/PortableServer/POAPackage/ServantNotActiveHelper.java | 0184ec2e61c0fafbc4776aa1b86a091cdaeaf457 | [] | no_license | ZytheMoon/First | ff317a11f12c4ec7714367994924ee9fb4649611 | 9078fb8be8537a98483c50928cb92cf9835aed1c | refs/heads/master | 2021-04-27T00:09:31.507273 | 2018-03-06T12:25:56 | 2018-03-06T12:25:56 | 123,758,924 | 0 | 1 | null | null | null | null | UTF-8 | Java | false | false | 2,375 | java | package org.omg.PortableServer.POAPackage;
/**
* org/omg/PortableServer/POAPackage/ServantNotActiveHelper.java .
* Generated by the IDL-to-Java compiler (portable), version "3.2"
* from ../../../../src/share/classes/org/omg/PortableServer/poa.idl
* Friday, February 3, 2012 8:32:07 PM PST
*/
abstract public class ServantNotActiveHelper
{
private static String _id = "IDL:omg.org/PortableServer/POA/ServantNotActive:1.0";
public static void insert (org.omg.CORBA.Any a, org.omg.PortableServer.POAPackage.ServantNotActive that)
{
org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();
a.type (type ());
write (out, that);
a.read_value (out.create_input_stream (), type ());
}
public static org.omg.PortableServer.POAPackage.ServantNotActive extract (org.omg.CORBA.Any a)
{
return read (a.create_input_stream ());
}
private static org.omg.CORBA.TypeCode __typeCode = null;
private static boolean __active = false;
synchronized public static org.omg.CORBA.TypeCode type ()
{
if (__typeCode == null)
{
synchronized (org.omg.CORBA.TypeCode.class)
{
if (__typeCode == null)
{
if (__active)
{
return org.omg.CORBA.ORB.init().create_recursive_tc ( _id );
}
__active = true;
org.omg.CORBA.StructMember[] _members0 = new org.omg.CORBA.StructMember [0];
org.omg.CORBA.TypeCode _tcOf_members0 = null;
__typeCode = org.omg.CORBA.ORB.init ().create_exception_tc (org.omg.PortableServer.POAPackage.ServantNotActiveHelper.id (), "ServantNotActive", _members0);
__active = false;
}
}
}
return __typeCode;
}
public static String id ()
{
return _id;
}
public static org.omg.PortableServer.POAPackage.ServantNotActive read (org.omg.CORBA.portable.InputStream istream)
{
org.omg.PortableServer.POAPackage.ServantNotActive value = new org.omg.PortableServer.POAPackage.ServantNotActive ();
// read and discard the repository ID
istream.read_string ();
return value;
}
public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.PortableServer.POAPackage.ServantNotActive value)
{
// write the repository ID
ostream.write_string (id ());
}
}
| [
"2353653849@qq.com"
] | 2353653849@qq.com |
119af8bb1a2648c81803b2584f384eea544791a7 | f4d4ab2f263516dcf6267480f6ebc20c19e59dd3 | /e-paper-client-web/src/main/java/fr/romainmoreau/epaper/client/web/WebEPaperClient.java | c5e8d9f014c70e2d06e88bbb98d5f41fc646b494 | [
"Apache-2.0"
] | permissive | vad-babushkin/e-paper | 7f2c1efb1e31cb216f321cdf7a079107305aef98 | 225bd6acceaf7d60f3865026c87a95c2cfbdbc8b | refs/heads/master | 2020-09-10T17:32:53.816955 | 2019-11-07T11:23:00 | 2019-11-07T11:23:00 | 221,780,379 | 0 | 0 | Apache-2.0 | 2019-11-14T20:23:50 | 2019-11-14T20:23:49 | null | UTF-8 | Java | false | false | 5,520 | java | package fr.romainmoreau.epaper.client.web;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Arrays;
import org.springframework.web.client.RestTemplate;
import fr.romainmoreau.epaper.client.api.DisplayDirection;
import fr.romainmoreau.epaper.client.api.DrawingColors;
import fr.romainmoreau.epaper.client.api.EPaperException;
import fr.romainmoreau.epaper.client.api.FontSize;
import fr.romainmoreau.epaper.client.common.AbstractEPaperClient;
import fr.romainmoreau.epaper.client.common.Colors;
import fr.romainmoreau.epaper.client.common.Coordinates;
import fr.romainmoreau.epaper.client.common.Lines;
import fr.romainmoreau.epaper.jaxb.api.Clear;
import fr.romainmoreau.epaper.jaxb.api.Command;
import fr.romainmoreau.epaper.jaxb.api.Commands;
import fr.romainmoreau.epaper.jaxb.api.DisplayText;
import fr.romainmoreau.epaper.jaxb.api.DrawLine;
import fr.romainmoreau.epaper.jaxb.api.DrawPoint;
import fr.romainmoreau.epaper.jaxb.api.DrawRectangle;
import fr.romainmoreau.epaper.jaxb.api.FillRectangle;
import fr.romainmoreau.epaper.jaxb.api.RefreshAndUpdate;
import fr.romainmoreau.epaper.jaxb.api.SetDisplayDirection;
import fr.romainmoreau.epaper.jaxb.api.SetDrawingColors;
import fr.romainmoreau.epaper.jaxb.api.SetFontSize;
public class WebEPaperClient extends AbstractEPaperClient {
private final RestTemplate restTemplate;
private final URI uri;
public WebEPaperClient(String protocol, String host, int port) throws MalformedURLException, URISyntaxException {
restTemplate = new RestTemplate();
uri = new URL(protocol, host, port, "/").toURI();
}
@Override
public synchronized void clear() throws IOException, EPaperException {
sendCommand(new Clear());
}
@Override
public synchronized void close() throws IOException {
}
@Override
public synchronized void refreshAndUpdate() throws IOException, EPaperException {
sendCommand(new RefreshAndUpdate());
}
@Override
public synchronized void drawPoint(int x, int y) throws IOException, EPaperException {
Coordinates.validateCoordinates(x, y);
DrawPoint drawPoint = new DrawPoint();
drawPoint.setX(x);
drawPoint.setY(y);
sendCommand(drawPoint);
}
@Override
public synchronized void drawLine(int x0, int y0, int x1, int y1) throws IOException, EPaperException {
Coordinates.validateCoordinates(x0, y0);
Coordinates.validateCoordinates(x1, y1);
DrawLine drawLine = new DrawLine();
drawLine.setX0(x0);
drawLine.setX1(x1);
drawLine.setY0(y0);
drawLine.setY1(y1);
sendCommand(drawLine);
}
@Override
public synchronized void drawRectangle(int x0, int y0, int x1, int y1) throws IOException, EPaperException {
Coordinates.validateCoordinates(x0, y0);
Coordinates.validateCoordinates(x1, y1);
DrawRectangle drawRectangle = new DrawRectangle();
drawRectangle.setX0(x0);
drawRectangle.setX1(x1);
drawRectangle.setY0(y0);
drawRectangle.setY1(y1);
sendCommand(drawRectangle);
}
@Override
public synchronized void fillRectangle(int x0, int y0, int x1, int y1) throws IOException, EPaperException {
Coordinates.validateCoordinates(x0, y0);
Coordinates.validateCoordinates(x1, y1);
FillRectangle fillRectangle = new FillRectangle();
fillRectangle.setX0(x0);
fillRectangle.setX1(x1);
fillRectangle.setY0(y0);
fillRectangle.setY1(y1);
sendCommand(fillRectangle);
}
@Override
public synchronized void displayText(int x, int y, String text) throws IOException, EPaperException {
Coordinates.validateCoordinates(x, y);
Lines.validateText(text);
DisplayText displayText = new DisplayText();
displayText.setX(x);
displayText.setY(y);
displayText.setText(text);
sendCommand(displayText);
}
@Override
public synchronized DrawingColors getDrawingColors() throws IOException, EPaperException {
throw new IllegalStateException("Not supported");
}
@Override
public synchronized void setDrawingColors(DrawingColors drawingColors) throws IOException, EPaperException {
Colors.validateDrawingColors(drawingColors);
SetDrawingColors setDrawingColors = new SetDrawingColors();
setDrawingColors.setBackground(drawingColors.getBackground());
setDrawingColors.setForeground(drawingColors.getForeground());
sendCommand(setDrawingColors);
}
@Override
public synchronized FontSize getFontSize() throws IOException, EPaperException {
throw new IllegalStateException("Not supported");
}
@Override
public synchronized void setFontSize(FontSize fontSize) throws IOException, EPaperException {
Lines.validateFontSize(fontSize);
SetFontSize setFontSize = new SetFontSize();
setFontSize.setFontSize(fontSize);
sendCommand(setFontSize);
}
@Override
public synchronized void setDisplayDirection(DisplayDirection displayDirection)
throws IOException, EPaperException {
Coordinates.validateDisplayDirection(displayDirection);
SetDisplayDirection setDisplayDirection = new SetDisplayDirection();
setDisplayDirection.setDisplayDirection(displayDirection);
sendCommand(setDisplayDirection);
}
@Override
public synchronized DisplayDirection getDisplayDirection() throws IOException, EPaperException {
throw new IllegalStateException("Not supported");
}
private void sendCommand(Command command) {
Commands commands = new Commands();
commands.setCommands(Arrays.asList(command));
sendCommands(commands);
}
private void sendCommands(Commands commands) {
restTemplate.postForObject(uri, commands, String.class);
}
}
| [
"romainmoreau@gmail.com"
] | romainmoreau@gmail.com |
d7b2c1f9f092b8d4e2cc4014cdd95a912befc57b | 710e680905c59d2e64e064e9a7d0bb5ea7aba969 | /flyingcorespringboot/src/main/java/com/mixislink/Interceptor/impl/BooleanParameterSwitchInterceptor.java | b52eb6e03073b4c582aaa18e76b087086c0e2fde | [] | no_license | zhengdifei/SpringBootTest | 53f7a587d7697b2aa57ebdc45e07d44d1bcae7c5 | aceff6294187e10d9fd28a5109bcc9136f7e8383 | refs/heads/master | 2021-09-09T05:54:14.490948 | 2018-03-14T03:19:10 | 2018-03-14T03:19:10 | 100,247,858 | 0 | 0 | null | null | null | null | UTF-8 | Java | false | false | 1,802 | java | package com.mixislink.Interceptor.impl;
import com.mixislink.Interceptor.AbstractInterceptor;
import com.mixislink.service.EngineParameter;
import java.util.Iterator;
import java.util.Set;
/**
*
* <B>描述:</B>boolean参数处理类<br/>
* <B>版本:</B>v2.0<br/>
* <B>创建时间:</B>2012-10-10<br/>
* <B>版权:</B>flying团队<br/>
*
* @author zdf
*
*/
public class BooleanParameterSwitchInterceptor extends AbstractInterceptor {
@Override
public void before(EngineParameter ep) throws Exception {
Set paramSet = ep.getParamMap().keySet();//获取key集合
Iterator paramIter = paramSet.iterator();
while(paramIter.hasNext()){//遍历集合
String paramKey = (String) paramIter.next();//key名称
if(ep.getParam(paramKey) instanceof String){//如果是值是字符类型
String paramValue = (String)ep.getParam(paramKey);
if("true".equals(paramValue)){
ep.putParam(paramKey, 1);
log.debug(paramKey+" 是布尔类型,值=true,已经转换成mysql的数据格式!");
}else if("false".equals(paramValue)){
ep.putParam(paramKey, 0);
log.debug(paramKey+" 是布尔类型,值=false,已经转换成mysql的数据格式!");
}
}
if(ep.getParam(paramKey) instanceof Boolean){//如果是值是布尔类型
Boolean paramValue = (Boolean)ep.getParam(paramKey);
if(paramValue){
ep.putParam(paramKey, 1);
log.debug(paramKey+" 是布尔类型,值=true,已经转换成mysql的数据格式!");
}else{
ep.putParam(paramKey, 0);
log.debug(paramKey+" 是布尔类型,值=false,已经转换成mysql的数据格式!");
}
}
}
}
@Override
public void after(EngineParameter ep) throws Exception {
}
}
| [
"zhengdifei@visenergy.cc"
] | zhengdifei@visenergy.cc |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.