blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
7
410
content_id
stringlengths
40
40
detected_licenses
listlengths
0
51
license_type
stringclasses
2 values
repo_name
stringlengths
5
132
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
80
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
5.85k
684M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
132 values
src_encoding
stringclasses
34 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
3
9.45M
extension
stringclasses
28 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
352
9fabd0e5281cb4eb8b4d4979b54c243f04db55b0
ddeefd25bc80b16b129f85dd499a7fdf51f45cad
/src/main/java/com/yunengzhe/PVMTS/controller/page/InverterPageController.java
8cf0f40ad52e68d0014681cbebfac7cf399cce00
[]
no_license
it2cgy/it2gradle
10a64e93f642777fbc8e7719a40a2be6485962ee
70f2b698c3cf80d8deac69ece6154ef688c054a1
refs/heads/master
2021-08-30T16:12:59.647600
2017-12-18T15:31:29
2017-12-18T15:31:29
114,657,009
0
0
null
null
null
null
UTF-8
Java
false
false
3,512
java
package com.yunengzhe.PVMTS.controller.page; import java.util.HashMap; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; 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.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import com.yunengzhe.PVMTS.controller.InverterController; import com.yunengzhe.PVMTS.controller.PowerStationController; import com.yunengzhe.PVMTS.domain.response.RestResponseVO; import com.yunengzhe.PVMTS.domain.response.page.Paginator; import com.yunengzhe.PVMTS.domain.vo.InverterDetailsVO; import com.yunengzhe.PVMTS.domain.vo.PowerStationDetailsVO; import com.yunengzhe.PVMTS.domain.vo.UserVO; import com.yunengzhe.PVMTS.util.userInfo.TokenUtil; import com.yunengzhe.commons.util.JsonUtil; @Controller @RequestMapping("/inverterPage") public class InverterPageController { @Autowired private InverterController inverterController; @Autowired private PowerStationController powerStationController; private static final Logger logger = LoggerFactory.getLogger(InverterPageController.class); @RequestMapping(value="/inverterList") public String inverterList(Model model,HttpServletRequest request,HttpServletResponse response,Integer id,Integer page,Integer pagesize){ UserVO user = TokenUtil.getLoginUser(); if(user == null){ return "redirect:/user/login"; } if(page==null){ page = 1; } if(pagesize==null){ pagesize = 5; } model.addAttribute("page",page); model.addAttribute("pagesize",pagesize); model.addAttribute("inverterId",id); if(user.getRoleList().get(0).getRoleId()!=4){ logger.info("---------------逆变器列表页面"); return "/inverter/inverterList"; }else{ return "/inverter/thirdInverterList"; } } @RequestMapping(value="/inverterDetail/{inverterId}") public String inverterDetail(Model model,HttpServletRequest request,HttpServletResponse response,@PathVariable Integer inverterId,Integer page,Integer pagesize,Integer oldId){ UserVO user = TokenUtil.getLoginUser(); if(user == null){ return "redirect:/user/login"; } if(page==null){ page = 1; } if(pagesize==null){ pagesize = Paginator.DEFAULT_PAGESIZE; } RestResponseVO res = inverterController.getInverteInfo(request,inverterId+"",response); try { logger.info(JsonUtil.beanToJson(res)); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } InverterDetailsVO inverterDetailsVO = (InverterDetailsVO) res.getData(); Map<String,String> inverterInfo = new HashMap<String,String>(); inverterInfo.put("inverterId", inverterId+""); inverterInfo.put("powerStationId", inverterDetailsVO.getPowerStationId()+""); model.addAttribute("InverterInfo",inverterInfo); model.addAttribute("name", inverterDetailsVO.getName()); model.addAttribute("serialNumber", inverterDetailsVO.getSerialNumber()); model.addAttribute("oldpage",page); model.addAttribute("oldpagesize",pagesize); model.addAttribute("oldInverterId",inverterId); if(oldId==null){ model.addAttribute("oldId",-1); }else{ model.addAttribute("oldId",oldId); } logger.info("--------------->逆变器页面"); return "/inverter/inverterDetail"; } }
[ "it2cgy@163.com" ]
it2cgy@163.com
fbc227f9d1c9e2d413bee225eb200cb6247d4df4
b60da22bc192211b3978764e63af23e2e24081f5
/cdc/src/share/personal/classes/common/sun/net/TelnetOutputStream.java
f761b17258f96332b90e5f36cc5aa271f0444e2d
[]
no_license
clamp03/JavaAOTC
44d566927c057c013538ab51e086c42c6348554e
0ade633837ed9698cd74a3f6928ebde3d96bd3e3
refs/heads/master
2021-01-01T19:33:51.612033
2014-12-02T14:29:58
2014-12-02T14:29:58
27,435,591
5
4
null
null
null
null
UTF-8
Java
false
false
4,522
java
/* * @(#)TelnetOutputStream.java 1.25 06/10/10 * * Copyright 1990-2006 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License version * 2 only, as published by the Free Software Foundation. * * This program 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 * General Public License version 2 for more details (a copy is * included at /legal/license.txt). * * You should have received a copy of the GNU General Public License * version 2 along with this work; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA * * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa * Clara, CA 95054 or visit www.sun.com if you need additional * information or have any questions. * */ package sun.net; import java.io.*; /** * This class provides input and output streams for telnet clients. * This class overrides write to do CRLF processing as specified in * RFC 854. The class assumes it is running on a system where lines * are terminated with a single newline <LF> character. * * This is the relevant section of RFC 824 regarding CRLF processing: * * <pre> * The sequence "CR LF", as defined, will cause the NVT to be * positioned at the left margin of the next print line (as would, * for example, the sequence "LF CR"). However, many systems and * terminals do not treat CR and LF independently, and will have to * go to some effort to simulate their effect. (For example, some * terminals do not have a CR independent of the LF, but on such * terminals it may be possible to simulate a CR by backspacing.) * Therefore, the sequence "CR LF" must be treated as a single "new * line" character and used whenever their combined action is * intended; the sequence "CR NUL" must be used where a carriage * return alone is actually desired; and the CR character must be * avoided in other contexts. This rule gives assurance to systems * which must decide whether to perform a "new line" function or a * multiple-backspace that the TELNET stream contains a character * following a CR that will allow a rational decision. * * Note that "CR LF" or "CR NUL" is required in both directions * (in the default ASCII mode), to preserve the symmetry of the * NVT model. Even though it may be known in some situations * (e.g., with remote echo and suppress go ahead options in * effect) that characters are not being sent to an actual * printer, nonetheless, for the sake of consistency, the protocol * requires that a NUL be inserted following a CR not followed by * a LF in the data stream. The converse of this is that a NUL * received in the data stream after a CR (in the absence of * options negotiations which explicitly specify otherwise) should * be stripped out prior to applying the NVT to local character * set mapping. * </pre> * * @version 1.21, 08/19/02 * @author Jonathan Payne */ public class TelnetOutputStream extends BufferedOutputStream { boolean stickyCRLF = false; boolean seenCR = false; public boolean binaryMode = false; public TelnetOutputStream(OutputStream fd, boolean binary) { super(fd); binaryMode = binary; } /** * Writes the int to the stream and does CR LF processing if necessary. */ public void write(int c) throws IOException { if (binaryMode) super.write(c); else { if (seenCR) { if (c != '\n') super.write(0); } else if (c == '\r') { if (stickyCRLF) seenCR = true; else { super.write('\r'); c = 0; } } super.write(c); } } /** * Write the bytes at offset <i>off</i> in buffer <i>bytes</i> for * <i>length</i> bytes. */ public void write(byte bytes[], int off, int length) throws IOException { if (binaryMode) { super.write(bytes, off, length); return; } while (--length >= 0) { write(bytes[off++]); } } }
[ "clamp03@gmail.com" ]
clamp03@gmail.com
6a0b6f9edea7fa39caf89cd91ae03eb314f34592
8cd256ee1bb6cbab636ffb4a535de4f630259567
/java/src/InterviewBit/TreeDataStructure/ConstructBalancedBinarySearchTree.java
eb60134c75784db5307f8440a591b0a1746ebbc5
[]
no_license
MehakDogra7/CrackingTheCodingInterview
9dec10d5a2d5aac83d3a30ae76fdf6b259c0b6d2
1e0e2815aa8c451ac3b4a6ed2cf1bbe3983fa726
refs/heads/master
2023-02-23T21:32:26.147358
2021-01-29T16:04:27
2021-01-29T16:04:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,120
java
package InterviewBit.TreeDataStructure; import java.util.ArrayList; public class ConstructBalancedBinarySearchTree { public static void main(String[] args) { int[] A = {21, 26, 30, 9, 4, 14, 28, 18, 15, 10, 2, 3, 7}; TreeNode root = new ConstructBalancedBinarySearchTree().solve(A); new PreOrderTraversal().solve(root).forEach(i -> System.out.print(i + " ")); } private TreeNode solve(int[] A) { TreeNode root = null; for (int i = 0; i < A.length; i++) { root = insertIntoTree(root, A[i], new ArrayList<>()); } return root; } private TreeNode insertIntoTree(TreeNode root, Integer value, ArrayList<Character> list) { if (root == null) return new TreeNode(value); if (value < root.val) { root.left = insertIntoTree(root.left, value, list); list.add('L'); } else if (value > root.val) { root.right = insertIntoTree(root.right, value, list); list.add('R'); } boolean isImbalance = findBalanceStatus(root); if (isImbalance) { String imbalance = String.valueOf(list.get(list.size() - 1)) + String.valueOf(list.get(list.size() - 2)); if (imbalance.equals("RL")) return handleRLImBalancing(root); else if (imbalance.equals("RR")) return handleRRImBalancing(root); else if (imbalance.equals("LR")) return handleLRImBalancing(root); else if (imbalance.equals("LL")) return handleLLImBalancing(root); } return root; } private TreeNode handleLLImBalancing(TreeNode root) { TreeNode left1 = root.left; TreeNode temp = left1.right; left1.right = root; root.left = temp; return left1; } private TreeNode handleLRImBalancing(TreeNode root) { TreeNode left = root.left; TreeNode right = left.right; TreeNode temp = right.left; TreeNode temp1 = right.right; right.right = root; right.left = left; root.left = temp1; left.right = temp; return right; } private TreeNode handleRRImBalancing(TreeNode root) { TreeNode right1 = root.right; TreeNode temp = right1.left; right1.left = root; root.right = temp; return right1; } private TreeNode handleRLImBalancing(TreeNode root) { TreeNode right = root.right; TreeNode left = right.left; TreeNode temp = left.left; TreeNode temp2 = left.right; left.left = root; left.right = right; root.right = temp; right.left = temp2; return left; } private boolean findBalanceStatus(TreeNode root) { int leftHeight = height(root.left); int rightHeight = height(root.right); return (Math.abs(leftHeight - rightHeight) > 1); } private int height(TreeNode node) { if (node == null) return 0; if (node.left == null && node.right == null) return 1; return Integer.max(height(node.left), height(node.right)) + 1; } }
[ "vinayak.chaturvedi96@gmail.com" ]
vinayak.chaturvedi96@gmail.com
ea5d5e230e8b7d66ffaca539de3f0f342f8a1ddf
961aa843808cf66ea9fac3b34bb3319fc090a5ef
/Java/Methods/MethodWithIfElse.java
8922744a0cd1c348b543c429b541a9c36cfc3d22
[]
no_license
NaveendraKularatne/hello-world
9d74b3e7ff91d648f293547be03833fd2cb66ff8
61fd2d1618f733405a03fc3bc5c94aa4db15789b
refs/heads/master
2022-10-06T15:30:50.571147
2022-09-25T20:06:25
2022-09-25T20:06:25
207,668,523
0
0
null
2022-09-07T22:11:48
2019-09-10T21:43:33
Java
UTF-8
Java
false
false
454
java
import java.util.Scanner; class MethodWithIfElse{ private final static Scanner sc = new Scanner(System.in); static int Age = 0; static void checkAge(int age){ if(age<=18){ System.out.println("You are under-age, hence not eligible."); }else{ System.out.println("You have access."); } } public static void main(String[] args){ while(true){ System.out.print("Enter your age : "); Age = sc.nextInt(); checkAge(Age); } } }
[ "naveendrarashmika@gmail.com" ]
naveendrarashmika@gmail.com
18f7b4410fd69d4324fd52ade5b1f9faa36aeed8
2fca3a57e30f4f2c348a562dc0313b5fa551d86b
/后端源码/houseproject/src/main/java/com/beixin/service/ICustomerService.java
42780a65c6ac0c94a032e548755889b3809a40ad
[]
no_license
gehao856/gehao
dbacc5fb70d715d6886da05da5750e79190fc42b
c09e97dd64eaeea0d640c87a7c23392dd6f91403
refs/heads/main
2023-06-21T18:14:36.548615
2021-07-22T07:52:23
2021-07-22T07:52:23
388,345,584
0
0
null
null
null
null
UTF-8
Java
false
false
1,367
java
package com.beixin.service; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.IService; import com.beixin.model.Customer; import com.beixin.model.User; import com.github.pagehelper.PageInfo; /** * <p> * 租户信息表 服务类 * </p> * * @author gehao * @since 2021-04-01 */ public interface ICustomerService extends IService<Customer> { /** * 高级查询支持分页 * */ PageInfo<Customer> queryAll(int page,int limit,Customer customer); /** * 查询租户信息表分页数据 * * @param page 页码 * @param pageCount 每页条数 * @return IPage<Customer> */ IPage<Customer> findListByPage(Integer page, Integer pageCount); /** * 添加租户信息表 * * @param customer 租户信息表 * @return int */ int add(Customer customer); /** * 删除租户信息表 * * @param id 主键 * @return int */ int delete(Long id); /** * 修改租户信息表 * * @param customer 租户信息表 * @return int */ int updateData(Customer customer); /** * id查询数据 * * @param id id * @return Customer */ Customer findById(Long id); Customer queryUserByNameAndPwd(String username, String pwd); }
[ "1318329100@qq.com" ]
1318329100@qq.com
35aba80e98d707ff67a7c855f2aab146956b70eb
5991c9ebff75c0919da9bcb195cf3bafcba544ff
/src/test/java/restAssured/tests/Create_Product.java
ce75acfb759e1407e4b578c30d8a40bee16f3f1b
[]
no_license
Nadia-Adel/FaceBookDeveloper_bestBuy
dd54a9b5ca75697046ed7820dc2e958318404d0b
6981dd4374093fcdebabd6c43134a38f2491c871
refs/heads/master
2023-08-18T10:58:08.017448
2021-09-21T03:32:55
2021-09-21T03:32:55
408,661,081
0
0
null
null
null
null
UTF-8
Java
false
false
4,711
java
package restAssured.tests; import static io.restassured.RestAssured.given; import static org.testng.Assert.assertEquals; import java.io.IOException; import org.json.simple.parser.ParseException; import org.testng.annotations.Test; import io.restassured.RestAssured; import io.restassured.http.ContentType; import io.restassured.path.json.JsonPath; import io.restassured.response.Response; import restAssured.data.APIs_Body; public class Create_Product { public static String baseURL = "http://localhost:3030" ; static String response; APIs_Body body = new APIs_Body(); @Test public static JsonPath Create_Product_201() { RestAssured.baseURI = baseURL ; Response res = given(). headers("Content-Type", "application/json"). body(APIs_Body.returnCreateProductBody_200()). when(). post("/products"). then(). assertThat().statusCode(201).log().all().contentType(ContentType.JSON).extract().response(); String response = res.asString(); JsonPath jsResponse = new JsonPath(response); return jsResponse ; } @Test public static JsonPath Create_Product_404() { RestAssured.baseURI = baseURL ; Response res = given(). headers("Content-Type", "application/json"). body(APIs_Body.returnCreateProductBody_200()). when(). post("/productsInvalidResource"). then(). assertThat().statusCode(404).log().all().contentType(ContentType.JSON).extract().response(); String response = res.asString(); JsonPath jsResponse = new JsonPath(response); assertEquals(jsResponse.get("message"), "Page not found"); int codeValue = 404 ; assertEquals(jsResponse.get("code"), codeValue); return jsResponse ; } @Test public static JsonPath Create_Product_missingHeader_400() { RestAssured.baseURI = baseURL ; Response res = given(). body(APIs_Body.returnCreateProductBody_200()). when(). post("/products"). then(). assertThat().statusCode(400).log().all().contentType(ContentType.JSON).extract().response(); String response = res.asString(); JsonPath jsResponse = new JsonPath(response); assertEquals(jsResponse.get("message"), "Invalid Parameters"); int codeValue = 400 ; assertEquals(jsResponse.get("code"), codeValue); return jsResponse ; } @Test public static JsonPath Create_Product_missingNameBody_400() { RestAssured.baseURI = baseURL ; Response res = given(). headers("Content-Type", "application/json"). body(APIs_Body.returnCreateProductBody_missingName_400()). when(). post("/products"). then(). assertThat().statusCode(400).log().all().contentType(ContentType.JSON).extract().response(); String response = res.asString(); JsonPath jsResponse = new JsonPath(response); assertEquals(jsResponse.get("message"), "Invalid Parameters"); int codeValue = 400 ; assertEquals(jsResponse.get("code"), codeValue); return jsResponse ; } @Test public static JsonPath Create_Product_emptyNameBody_400() { RestAssured.baseURI = baseURL ; Response res = given(). headers("Content-Type", "application/json"). body(APIs_Body.returnCreateProductBody_emptyName_400()). when(). post("/products"). then(). assertThat().statusCode(400).log().all().contentType(ContentType.JSON).extract().response(); String response = res.asString(); JsonPath jsResponse = new JsonPath(response); assertEquals(jsResponse.get("message"), "Invalid Parameters"); assertEquals(jsResponse.get("errors[0]"), "'name' should NOT be shorter than 1 characters"); int codeValue = 400 ; assertEquals(jsResponse.get("code"), codeValue); return jsResponse ; } @Test public static JsonPath Create_Product__missingOptionalPrice_200() { RestAssured.baseURI = baseURL ; Response res = given(). headers("Content-Type", "application/json"). body(APIs_Body.returnCreateProductBody_missingOptionalPrice_200()). when(). post("/products"). then(). assertThat().statusCode(201).log().all().contentType(ContentType.JSON).extract().response(); String response = res.asString(); JsonPath jsResponse = new JsonPath(response); return jsResponse ; } @Test public void test_Create_Product() throws IOException, ParseException { System.out.println(Create_Product_201()); System.out.println(Create_Product_404()); System.out.println(Create_Product_missingHeader_400()); System.out.println(Create_Product_missingNameBody_400()); System.out.println(Create_Product_emptyNameBody_400()); System.out.println(Create_Product__missingOptionalPrice_200()); } }
[ "nadia.adel@vodafone.com" ]
nadia.adel@vodafone.com
97da90bfd2205d801654d3a9f3964ed761609754
955ebbecacef6d37d249f6755fc77ef5bf103c2c
/kalah-dao/src/main/java/com/ttstudios/kalah/persistence/model/KalahGame.java
56be68ce41a870e65dd415f6341afe1e3652209a
[ "MIT" ]
permissive
tvcstseng/kalah
85780b6e6c01b5008d7de9ab3994a5f2103ef8aa
b671d68a098f8728bae874e0ced052b8d1c59b4b
refs/heads/master
2021-01-02T22:49:01.362457
2017-08-06T13:22:34
2017-08-06T13:22:34
99,400,716
2
0
null
2017-08-06T13:22:35
2017-08-05T05:09:12
Java
UTF-8
Java
false
false
1,522
java
package com.ttstudios.kalah.persistence.model; import com.querydsl.core.annotations.QueryEntity; import org.springframework.data.annotation.Id; import org.springframework.data.mongodb.core.mapping.Document; import javax.validation.constraints.NotNull; import java.io.Serializable; @QueryEntity @Document public class KalahGame implements Serializable{ private static final long serialVersionUID = -3900142948363649504L; @Id private String id; @NotNull private String title; private String player1; private String player2; public KalahGame() { super(); } public KalahGame( String title, String player1, String player2 ) { super(); this.title = title; this.player1 = player1; this.player2 = player2; } public String getId() { return id; } public void setId( String id ) { this.id = id; } public String getTitle() { return title; } public void setTitle( String title ) { this.title = title; } public String getPlayer1() { return player1; } public void setPlayer1( String player1 ) { this.player1 = player1; } public String getPlayer2() { return player2; } public void setPlayer2( String player2 ) { this.player2 = player2; } @Override public String toString() { return "KalahGame [id=" + id + ", title=" + title + ", player1=" + player1 + ", player2=" + player2 + "]"; } }
[ "tvcstseng@gmail.com" ]
tvcstseng@gmail.com
20ce64d8901445aed12807cc84424a9b570a49c0
b7462192853d88bc4607c11b7dbea194a705a2ea
/springcloud-generic/springcloud-common/src/main/java/com/project/spring/cloud/common/annotation/AopLog.java
a93256c8ed45b255b90834cb930260580b9b9a2f
[]
no_license
jackfromcn/project-spring-cloud
d3e9e839b7186ee4dbacfa798fdd82143ba9872c
3f98e2ffeb8ed0a8f71563f6eba4137019238253
refs/heads/master
2020-04-05T20:25:07.532541
2018-11-30T04:18:03
2018-11-30T04:18:03
157,179,027
0
0
null
null
null
null
UTF-8
Java
false
false
657
java
package com.project.spring.cloud.common.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * @ClassName: AopLog * @Description: 日志注解 * @author: wencheng * @date: 2017-08-13 下午10:56 * @version: V1.0 */ @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD, ElementType.TYPE}) public @interface AopLog { /** * 日志描述 * * @return */ String value() default ""; /** * 是否打印日志内容 * * @return */ boolean isPrint() default true; }
[ "wencheng.xu@mljr.com" ]
wencheng.xu@mljr.com
bc945abe75b411a9308b865b33c40556241d4ebc
714c267c54194ff1364da8d660bdd419d7a149e0
/EventBus/src/Airport/Field/CheckPoint.java
b40a3235773184cb0cf3e47523c3d8f7faaf308a
[]
no_license
Mohammad10991/SOA
86dedb9a08b80c16c9f812ed031e7e76383b5433
4fca4905e127f17e24e89dc0cc87518e58205d9d
refs/heads/master
2020-04-24T06:25:21.875456
2019-02-20T23:20:03
2019-02-20T23:20:03
171,764,289
0
0
null
null
null
null
UTF-8
Java
false
false
950
java
package Airport.Field; import Aircraft.Aircraft; import Airport.ControlArea; import Airport.Place; public class CheckPoint implements IAircraftPosition { public final int idAuto = 0; public Aircraft current; private int id; private Place name; private ControlArea controlArea; public CheckPoint(Place name, ControlArea controlArea) { this.name = name; this.controlArea = controlArea; this.id = idAuto; } public int getId() { return id; } public Place getNames() { return name; } public ControlArea getControlArea() { return controlArea; } @Override public void setAircraft(Aircraft aircraft) { aircraft = aircraft; } @Override public Aircraft removeAircraft() { Aircraft a = current; current = null; return a; } @Override public String getName() { return name.toString(); } }
[ "35705274+Mohammad10991@users.noreply.github.com" ]
35705274+Mohammad10991@users.noreply.github.com
1b99af502ea0799b4aa9468a398380de90b45a5d
901b445c376efeef19a11a08ef5b3e56261b0ba2
/jeeek-dp/src/com/ek/bo/commons/CryptUtil.java
faafbd4872258ac78ec06d1b6ab9ee7c6f0b62f5
[]
no_license
edikai/jeeek-ek
4876d3b539379ae76e8c8ea82ce5875081e0a2e5
47caf2487233d5bda4042b66683fbf8ff671db63
refs/heads/master
2020-03-31T16:25:58.264408
2018-10-25T01:07:58
2018-10-25T01:07:58
152,375,501
0
0
null
null
null
null
UTF-8
Java
false
false
5,199
java
package com.ek.bo.commons; import java.security.Key; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import javax.crypto.Cipher; import javax.crypto.KeyGenerator; import org.apache.log4j.Logger; import sun.misc.BASE64Decoder; import sun.misc.BASE64Encoder; /** * @包名 com.ek.bo.commons * @文件名 CryptUtil.java * @作者 qin_hqing * @创建日期 2015-1-13 * @版本 V 1.0 */ public class CryptUtil { /** * 1、 * 使用DES加密与解密,可对byte[],String类型进行加密与解密 * 密文可使用String,byte[]存储. * 方法: * void getKey(String strKey)从strKey的字条生成一个Key * String getEncString(String strMing)对strMing进行加密,返回String密文 * String getDesString(String strMi)对strMin进行解密,返回String明文 * byte[] getEncCode(byte[] byteS)byte[]型的加密 * byte[] getDesCode(byte[] byteD)byte[]型的解密 * * 2、MD5加密 不可解密 */ Logger logger = Logger.getLogger(this.getClass()); /** * MD5加密 生成32位md5码 * @param str * TODO */ public void setStr2MD5(String str){ str2MD5(str); } /** * @param str * TODO */ private void str2MD5(String str) { MessageDigest md5 = null; byte[] md5Bytes = null; StringBuffer hexValue = null; char[] charArray = str.toCharArray(); byte[] byteArray = new byte[charArray.length]; try { md5 = MessageDigest.getInstance("MD5"); for (int i = 0; i < charArray.length; i++) { byteArray[i] = (byte) charArray[i]; } md5Bytes = md5.digest(byteArray); hexValue = new StringBuffer(); for (int i = 0; i < md5Bytes.length; i++) { int val = ((int)md5Bytes[i]) & 0xff; if (val < 16) { hexValue.append("0"); } hexValue.append(Integer.toHexString(val)); } this._MD5Str = hexValue.toString().toUpperCase(); } catch (Exception e) { logger.error(e); e.printStackTrace(); }finally{ charArray = null; byteArray = null; md5 = null; md5Bytes = null; hexValue = null; } } /** * 根据初始化密钥生成KEY * @author qin_hqing * @param strKey * TODO */ public void setKey(String strKey){ try { KeyGenerator _generator = KeyGenerator.getInstance("DES"); _generator.init(new SecureRandom(strKey.getBytes())); this.key = _generator.generateKey(); _generator = null; //释放资源 } catch (NoSuchAlgorithmException e) { logger.error(e); e.printStackTrace(); } } /** * 加密 String明文输入,String密文输出 * @author qin_hqing * @param strMing * TODO */ public void setEncString(String strMing){ BASE64Encoder base64Enc = new BASE64Encoder(); try { this.byteMing = strMing.getBytes("UTF-8"); this.byteMi = this.getEncCode(this.byteMing); this.strMi = base64Enc.encode(this.byteMi); } catch (Exception e) { logger.error(e); e.printStackTrace(); }finally{ this.byteMi = null; this.byteMing = null; } } /** * 加密 以byte[]明文输入,byte[]密文输出 * @author qin_hqing * @param byteMing2 * @return * TODO */ private byte[] getEncCode(byte[] byteS) { byte[] byteFina = null; Cipher cipher = null; try { cipher = Cipher.getInstance("DES"); cipher.init(Cipher.ENCRYPT_MODE, this.key); byteFina = cipher.doFinal(byteS); } catch (Exception e) { logger.error(e); e.printStackTrace(); }finally{ cipher = null; } return byteFina; } /** * 解密:以String密文输入,String明文输出 * @author qin_hqing * @param strMi * TODO */ public void setDesString(String strMi){ BASE64Decoder base64Dnc = new BASE64Decoder(); try { this.byteMi = base64Dnc.decodeBuffer(strMi); this.byteMing = this.getDecCode(this.byteMi); this.strMing = new String(this.byteMing); } catch (Exception e) { logger.error(e); e.printStackTrace(); }finally{ this.byteMi = null; this.byteMing = null; } } /** * 解密以byte[]密文输入,以byte[]明文输出 * @author qin_hqing * @param byteMi2 * @return * TODO */ private byte[] getDecCode(byte[] byteD) { Cipher cipher = null; byte[] byteFina = null; try { cipher = Cipher.getInstance("DES"); cipher.init(Cipher.DECRYPT_MODE, this.key); byteFina = cipher.doFinal(byteD); } catch (Exception e) { logger.error(e); e.printStackTrace(); }finally{ cipher = null; } return byteFina; } private Key key ; private byte[] byteMi = null; private byte[] byteMing = null; private String strMi = ""; private String strMing = ""; private String _MD5Str = ""; /** * 返回加密后的byte[] * @return the byteMi */ public byte[] getByteMi() { return byteMi; } /** * 返回加密后的字符串 * @return the strMi */ public String getStrMi() { return strMi; } /** * 返回解密后的byte[] * @return the byteMing */ public byte[] getByteMing() { return byteMing; } /** * 返回解密后的字符串 * @return the strMing */ public String getStrMing() { return strMing; } /** * @return the _MD5Str */ public String get_MD5Str() { return _MD5Str; } }
[ "edi_kai@163.com" ]
edi_kai@163.com
51f25f6167297a23a2c1cb4055ae740b6db85c9e
f009d8c5972f042e0574526f057692d535c87730
/src/linkedlist/Problem725.java
6531adc4d4289861231e1998c33190bc15128b15
[]
no_license
KOOWINN/Leetcode
8d0204660d014aa9db232f31873443be13f7bf8f
24c3d553462f01cf07a4f9d6288fccbb7a3277b8
refs/heads/main
2023-05-16T11:18:20.364781
2021-06-07T14:22:30
2021-06-07T14:22:56
357,949,245
0
0
null
null
null
null
UTF-8
Java
false
false
2,658
java
package linkedlist; /** * 725. 分隔链表 * 给定一个头结点为 root 的链表, 编写一个函数以将链表分隔为 k 个连续的部分。 * * 每部分的长度应该尽可能的相等: 任意两部分的长度差距不能超过 1,也就是说可能有些部分为 null。 * * 这k个部分应该按照在链表中出现的顺序进行输出,并且排在前面的部分的长度应该大于或等于后面的长度。 * * 返回一个符合上述规则的链表的列表。 * * 举例: 1->2->3->4, k = 5 // 5 结果 [ [1], [2], [3], [4], null ] * * 示例 1: * 输入: * root = [1, 2, 3], k = 5 * 输出: [[1],[2],[3],[],[]] * 解释: * 输入输出各部分都应该是链表,而不是数组。 * 例如, 输入的结点 root 的 val= 1, root.next.val = 2, \root.next.next.val = 3, 且 root.next.next.next = null。 * 第一个输出 output[0] 是 output[0].val = 1, output[0].next = null。 * 最后一个元素 output[4] 为 null, 它代表了最后一个部分为空链表。 * * 示例 2: * 输入: * root = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], k = 3 * 输出: [[1, 2, 3, 4], [5, 6, 7], [8, 9, 10]] * 解释: * 输入被分成了几个连续的部分,并且每部分的长度相差不超过1.前面部分的长度大于等于后面部分的长度。 * * * 提示: * * root 的长度范围: [0, 1000]. * 输入的每个节点的大小范围:[0, 999]. * k 的取值范围: [1, 50]. */ public class Problem725 { public ListNode[] splitListToParts(ListNode root, int k) { // ①得到链表的长度 ListNode current = root; int N = 0; while (current != null) { N++; current = current.next; } // ②得到链表被分割后每个部分的节点数为N/k,且前N%k部分均有一个额外的节点 int partSize = N / k, extra = N % k; ListNode[] ans = new ListNode[k]; current = root; // ③循环k次,依次得到k个子链表 for (int i = 0; i < k; ++i) { // 记录每一部分的头节点 ListNode head = current; for (int j = 0; j < partSize + (i < extra ? 1 : 0) - 1; ++j) { if (current!=null) current = current.next; } // 将每一部分的尾节点与下个部分的头节点断开连接 if (current != null) { ListNode next = current.next; current.next = null; current = next; } // 将最终的这部分链表放入结果数组中 ans[i] = head; } return ans; } }
[ "gooyunn@gmail.com" ]
gooyunn@gmail.com
ab0080ad74a16af739c48180d6c6bc8472eb490d
02be330b35e0c1ea887d0c631780fb55d2911851
/src/main/java/tech/sosa/ingweb/domain/movie/MovieDoesNotExistException.java
b592f144c52b802be0b4915a37a8ab9fa55376dc
[ "MIT" ]
permissive
mglezsosa/jersey-filmaffinity
ca38128c4c0523e272965c3f4825c0a3fc778fdd
20d2ea55e1e2a434510d15d0857d73955b632141
refs/heads/master
2020-04-12T00:09:12.808205
2018-12-24T10:02:01
2018-12-24T10:02:01
162,190,322
0
0
null
null
null
null
UTF-8
Java
false
false
828
java
package tech.sosa.ingweb.domain.movie; import tech.sosa.ingweb.domain.shared.ResourceDoesNotExistException; public class MovieDoesNotExistException extends ResourceDoesNotExistException { /** * */ private static final long serialVersionUID = 1L; public MovieDoesNotExistException() { } public MovieDoesNotExistException(String message) { super(message); } public MovieDoesNotExistException(Throwable cause) { super(cause); } public MovieDoesNotExistException(String message, Throwable cause) { super(message, cause); } public MovieDoesNotExistException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { super(message, cause, enableSuppression, writableStackTrace); } @Override public String defaultMessage() { return "Movie was not found."; } }
[ "sosa@uma.es" ]
sosa@uma.es
3d1b290e79dc7e4b05647a4ceb8b845538e1af3a
20ddd1be89770ffbb10ee413cba7adf1cc837520
/org.xtext.example.mydsl3/src-gen/org/xtext/example/mydsl3/parser/antlr/MyDslParser.java
23400b80fc98961bb1ba3b7ad3edfdd2d0a0c881
[]
no_license
susieagerholm/XTEXT_EXAMPLE
e63ec1e0159db41af59bb5da47134e1d9a0cd310
5865cbe5f17b01f79b7e8a356e4152f3502c8f21
refs/heads/master
2021-01-20T05:25:45.951571
2017-05-29T21:05:15
2017-05-29T21:05:15
89,778,199
0
0
null
null
null
null
UTF-8
Java
false
false
1,106
java
/* * generated by Xtext 2.10.0 */ package org.xtext.example.mydsl3.parser.antlr; import com.google.inject.Inject; import org.eclipse.xtext.parser.antlr.AbstractAntlrParser; import org.eclipse.xtext.parser.antlr.XtextTokenStream; import org.xtext.example.mydsl3.parser.antlr.internal.InternalMyDslParser; import org.xtext.example.mydsl3.services.MyDslGrammarAccess; public class MyDslParser extends AbstractAntlrParser { @Inject private MyDslGrammarAccess grammarAccess; @Override protected void setInitialHiddenTokens(XtextTokenStream tokenStream) { tokenStream.setInitialHiddenTokens("RULE_WS", "RULE_ML_COMMENT", "RULE_SL_COMMENT"); } @Override protected InternalMyDslParser createParser(XtextTokenStream stream) { return new InternalMyDslParser(stream, getGrammarAccess()); } @Override protected String getDefaultRuleName() { return "Model"; } public MyDslGrammarAccess getGrammarAccess() { return this.grammarAccess; } public void setGrammarAccess(MyDslGrammarAccess grammarAccess) { this.grammarAccess = grammarAccess; } }
[ "susie.agerholm@gmail.com" ]
susie.agerholm@gmail.com
aabdcc1ce7c9c3f81b80692b3aa235731f3a51fa
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/9/9_c6924fdcf0b8676ab1be0240fb572d5d212e2386/RuleFlowImportsDialog/9_c6924fdcf0b8676ab1be0240fb572d5d212e2386_RuleFlowImportsDialog_t.java
1a99db416518889f0b9c7c91b4ecd8b6df607bbc
[]
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
7,092
java
/* * Copyright 2005 JBoss 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 org.drools.eclipse.flow.ruleflow.view.property.constraint; import java.util.ArrayList; import java.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.drools.eclipse.editors.DRLSourceViewerConfig; import org.drools.eclipse.editors.scanners.DRLPartionScanner; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.text.Document; import org.eclipse.jface.text.IDocument; import org.eclipse.jface.text.IDocumentPartitioner; import org.eclipse.jface.text.contentassist.ContentAssistant; import org.eclipse.jface.text.contentassist.IContentAssistProcessor; import org.eclipse.jface.text.contentassist.IContentAssistant; import org.eclipse.jface.text.reconciler.IReconciler; import org.eclipse.jface.text.rules.FastPartitioner; import org.eclipse.jface.text.source.ISourceViewer; import org.eclipse.jface.text.source.SourceViewer; import org.eclipse.swt.SWT; import org.eclipse.swt.events.KeyEvent; import org.eclipse.swt.events.KeyListener; import org.eclipse.swt.graphics.Point; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.TabFolder; import org.eclipse.swt.widgets.TabItem; import org.jbpm.process.core.Process; import org.jbpm.workflow.core.WorkflowProcess; /** * Dialog for editing imports. */ public class RuleFlowImportsDialog extends Dialog { private static final Pattern IMPORT_PATTERN = Pattern.compile( "\\n\\s*import\\s+([^\\s;#]+);?", Pattern.DOTALL); private static final Pattern FUNCTION_IMPORT_PATTERN = Pattern.compile( "\\n\\s*import\\s+function\\s+([^\\s;#]+);?", Pattern.DOTALL); private WorkflowProcess process; private boolean success; private TabFolder tabFolder; private SourceViewer importsViewer; private List<String> imports; private List<String> functionImports; public RuleFlowImportsDialog(Shell parentShell, WorkflowProcess process) { super(parentShell); this.process = process; setShellStyle(getShellStyle() | SWT.RESIZE); } protected void configureShell(Shell newShell) { super.configureShell(newShell); newShell.setText("Imports editor"); } protected Point getInitialSize() { return new Point(600, 450); } private Control createTextualEditor(Composite parent) { importsViewer = new SourceViewer(parent, null, SWT.BORDER); importsViewer.configure(new DRLSourceViewerConfig(null) { public IReconciler getReconciler(ISourceViewer sourceViewer) { return null; } public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) { ContentAssistant assistant = new ContentAssistant(); IContentAssistProcessor completionProcessor = new ImportCompletionProcessor(); assistant.setContentAssistProcessor( completionProcessor, IDocument.DEFAULT_CONTENT_TYPE); assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY); return assistant; } }); IDocument document = new Document(getProcessImports()); importsViewer.setDocument(document); IDocumentPartitioner partitioner = new FastPartitioner( new DRLPartionScanner(), DRLPartionScanner.LEGAL_CONTENT_TYPES); partitioner.connect(document); document.setDocumentPartitioner(partitioner); importsViewer.getControl().addKeyListener(new KeyListener() { public void keyPressed(KeyEvent e) { if (e.character == ' ' && e.stateMask == SWT.CTRL) { importsViewer.doOperation(ISourceViewer.CONTENTASSIST_PROPOSALS); } } public void keyReleased(KeyEvent e) { } }); return importsViewer.getControl(); } private String getProcessImports() { String result = "// define your imports here: e.g. import com.sample.MyClass\n"; List<String> imports = ((Process) process).getImports(); if (imports != null) { for (String importString: imports) { result += "import " + importString + "\n"; } } imports = process.getFunctionImports(); if (imports != null) { for (String importString: imports) { result += "import function " + importString + "\n"; } } return result; } public Control createDialogArea(Composite parent) { GridLayout layout = new GridLayout(); parent.setLayout(layout); layout.numColumns = 1; tabFolder = new TabFolder(parent, SWT.NONE); GridData gd = new GridData(); gd.grabExcessHorizontalSpace = true; gd.grabExcessVerticalSpace = true; gd.verticalAlignment = GridData.FILL; gd.horizontalAlignment = GridData.FILL; tabFolder.setLayoutData(gd); TabItem textEditorTab = new TabItem(tabFolder, SWT.NONE); textEditorTab.setText("Imports"); textEditorTab.setControl(createTextualEditor(tabFolder)); return tabFolder; } protected void okPressed() { success = true; updateImports(); super.okPressed(); } public boolean isSuccess() { return success; } public List<String> getImports() { return imports; } public List<String> getFunctionImports() { return functionImports; } private void updateImports() { this.imports = new ArrayList<String>(); Matcher matcher = IMPORT_PATTERN.matcher(importsViewer.getDocument().get()); while (matcher.find()) { String importString = matcher.group(1); if (!"function".equals(importString)) { this.imports.add(importString); } } this.functionImports = new ArrayList<String>(); matcher = FUNCTION_IMPORT_PATTERN.matcher(importsViewer.getDocument().get()); while (matcher.find()) { this.functionImports.add(matcher.group(1)); } } }
[ "yuzhongxing88@gmail.com" ]
yuzhongxing88@gmail.com
5940cf8b237896e7a24ba6df324659dab22ce6e0
a216410846ccfa38ae6c8416cf14276484f10b42
/recyclerview-renderers-lib/src/main/java/me/alexrs/recyclerviewrenderers/interfaces/Builder.java
65b0e92fbdd204cced09d67dd20fd7c72316e0c6
[ "Apache-2.0" ]
permissive
alexrs/Cervantes
9b6b8170268e5c3c6f87fbb9aa9ef65e6faa86c0
16eb4e0626b6506921fb1968f252483736af6b4e
refs/heads/master
2021-05-28T17:42:47.606212
2015-01-28T23:37:27
2015-01-28T23:37:27
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,103
java
/* * Copyright (C) 2014 Alejandro Rodriguez Salamanca. * * 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 me.alexrs.recyclerviewrenderers.interfaces; import android.support.annotation.LayoutRes; import me.alexrs.recyclerviewrenderers.renderer.Renderer; /** * @author Alejandro Rodriguez <https://github.com/Alexrs95> */ public interface Builder { /** * @param id the ID of the layout * @return an instance of the builder */ Builder instantiate(@LayoutRes int id); /** * @return the Renderer assigned to the layout */ Renderer create(); }
[ "alexrs95@gmail.com" ]
alexrs95@gmail.com
8c0742fb8a94ab7f60a2aa98ad229eae95b557a9
4c6adf0ce6ef3f02dcef9c345e0e5e4ff139d886
/Common/FO/fo-jar/fo-bank-corporate-api/src/main/java/com/pay/fo/bankcorp/common/BankCorpTransCode.java
97554cdebfdc6da57e20f0aaec2a5fe43c8ee40d
[]
no_license
happyjianguo/pay-1
8631906be62707316f0ed3eb6b2337c90d213bc0
40ae79738cfe4e5d199ca66468f3a33e9d8f2007
refs/heads/master
2020-07-27T19:51:54.958859
2016-12-19T07:34:24
2016-12-19T07:34:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
721
java
/** * */ package com.pay.fo.bankcorp.common; /** * @author new * */ public enum BankCorpTransCode { ERROR("9999","异常"), PAYMENT_ORDER("0001","支付订单"), QUERY_TRADE_STATUS("0002","查询交易状态"), QUERY_BANK_ACC_BALANCE("0003","查询银行账号余额"); private String value; private String desc; private BankCorpTransCode(String val,String desc){ this.value = val; this.desc = desc; } public String getValue() { return value; } public String getDesc() { return desc; } public BankCorpTransCode get(String val){ for (BankCorpTransCode element : BankCorpTransCode.values()) { if(element.getValue().equals(val)){ return element; } } return null; } }
[ "stanley.zou@hrocloud.com" ]
stanley.zou@hrocloud.com
e54f4841883ca8e9995bca24dba542c81b186dee
1408c5809314c8f53ee1cbea5e00cd5a10e6cc31
/src/main/java/com/casinoGame/casinoGame/Game/Logic/BombGameLogic.java
862f4bbb83923ec2892261f02186018a49d091e5
[]
no_license
BartoszZalewski/casinoGame
c1f9b5a1e4ae5043641cced43f444e516fecbda9
48cfe49ea294e277ac4dc732822748c76496d033
refs/heads/master
2021-06-17T17:28:36.598221
2017-06-13T22:43:29
2017-06-13T22:43:29
93,340,476
0
0
null
null
null
null
UTF-8
Java
false
false
1,740
java
package com.casinoGame.casinoGame.Game.Logic; import com.casinoGame.casinoGame.Base.BoardDefinition; import com.casinoGame.casinoGame.Base.Event; import com.casinoGame.casinoGame.Line.Line; import com.casinoGame.casinoGame.SpecialSymbol.SpecialSymbol; import com.casinoGame.casinoGame.Validations.Validation; import java.util.ArrayList; public class BombGameLogic extends Logic { public BombGameLogic(BoardDefinition boardDefinition) { super(boardDefinition); } @Override protected boolean valid(int[][] board) { for (Validation validation : boardDefinition.getValidations()) { if (!validation.valid(board, last, boardDefinition.getSpecialSymbols())) { return false; } } return true; } @Override public int value(int[][] board) { events = getLinesValueEvents(board); for(SpecialSymbol specialSymbol : boardDefinition.getSpecialSymbols()) { specialSymbol.call(board, this); } return getEventsValue(); } @Override protected int loseValue(int bet) { if(last != null) { for (Event event : last.getEvents()) { if (event.msg.contains("FreeSpin")) { String[] values = event.msg.split(":"); int freeSpins = Integer.parseInt(values[1]) - 1; if (freeSpins > 0) { Event nextFreeSpin = new Event(event.name, 0, new ArrayList<>(), new Line(0, new ArrayList<>()), values[0] + ":" + freeSpins); events.add(nextFreeSpin); } return 0; } } } return bet; } }
[ "bmhzalewski@gmail.com" ]
bmhzalewski@gmail.com
79005d21fbe306efe4a046858b7fce30860fcbb2
71d6431731006f2106b9781d10293f68ec6cd61e
/src/NodeTree.java
48967d2f6fb56be8f4a22b38d01205a6137cde65
[]
no_license
VladRynchenko/Data-Structures
01f5ab5bf055631ae868f855c7c0901d10cfbb06
2a4706c38ecfcf443e1f79af6527cbc9e2c1853b
refs/heads/main
2023-08-11T18:39:13.444964
2021-09-22T12:59:56
2021-09-22T12:59:56
361,797,237
0
0
null
null
null
null
UTF-8
Java
false
false
190
java
class NodeTree { public String data; public NodeTree leftChild; public NodeTree rightChild; public void displayNode() { System.out.print("{" + data + "}"); } }
[ "41292054+VladRynchenko@users.noreply.github.com" ]
41292054+VladRynchenko@users.noreply.github.com
9b8974718d1f04fae6002e66cdaf7d9a6e85ec8e
5e5ab4546bee7cf35eabe98c67eabbaa9a89794b
/project1/src/main/java/org/kie/example/project1/Guests.java
d1fccc4aa00c09f66a1382fa976c8f202f7342c1
[]
no_license
j1cken/brms-demo-repository
52901f6cfe46dca21fede7eb6863f39ae56c0466
45a3428dbc7a5ba1c0bc85d5ad18e7a1e10760fc
refs/heads/master
2021-05-07T05:57:31.671109
2017-11-22T12:20:43
2017-11-22T12:20:43
111,680,371
0
0
null
null
null
null
UTF-8
Java
false
false
1,089
java
package org.kie.example.project1; /** * This class was automatically generated by the data modeler tool. */ public class Guests implements java.io.Serializable { static final long serialVersionUID = 1L; @org.kie.api.definition.type.Label("How many max number of guests?") private int max_num; @org.kie.api.definition.type.Label("How many min number of guests") private int min_num; private Integer number; public Guests() { } public int getMax_num() { return this.max_num; } public void setMax_num(int max_num) { this.max_num = max_num; } public int getMin_num() { return this.min_num; } public void setMin_num(int min_num) { this.min_num = min_num; } public java.lang.Integer getNumber() { return this.number; } public void setNumber(java.lang.Integer number) { this.number = number; } public Guests(int max_num, int min_num, java.lang.Integer number) { this.max_num = max_num; this.min_num = min_num; this.number = number; } }
[ "torben@jit-central.com" ]
torben@jit-central.com
466bf0e783807ef219c51a06ad193a1c092fe21b
3b4a6ac92181ccbc705e3b8a1ba00ee120744485
/src/main/java/com/whiteslave/whiteslaveApp/reportSync/ReportSyncService.java
60de900af10418f076ae626e8c2e9d3e7d9c1c36
[]
no_license
Matiej/whiteSlaveApp
7e5ff2364f3c142f02de4070ac4b9bcd8faa0fa3
dbd09b2b39ef8e422ec141119b8e3e7329344543
refs/heads/master
2021-06-22T05:27:27.613858
2021-01-06T15:37:56
2021-01-06T15:37:56
227,216,838
1
0
null
2021-03-31T21:51:58
2019-12-10T21:13:54
Java
UTF-8
Java
false
false
6,303
java
package com.whiteslave.whiteslaveApp.reportSync; import com.whiteslave.whiteslaveApp.archiveReport.ArchReportService; import com.whiteslave.whiteslaveApp.govRequestReport.checkReport.domain.dto.CheckReportDto; import com.whiteslave.whiteslaveApp.govRequestReport.searchReport.domain.dto.SearchReportDto; import com.whiteslave.whiteslaveApp.reportSync.domain.GovResponse; import com.whiteslave.whiteslaveApp.reportSync.domain.ReportSyncRequest; import com.whiteslave.whiteslaveApp.reportSync.domain.SearchGovResponse; import com.whiteslave.whiteslaveApp.reportSync.domain.SubjectResponse; import com.whiteslave.whiteslaveApp.reportSync.domain.enums.SearchResult; import lombok.RequiredArgsConstructor; import org.hibernate.HibernateException; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.io.File; import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; @Service @RequiredArgsConstructor class ReportSyncService { private static final String REGON = "REGON"; private static final String NIP = "NIP"; private static final String BANK_ACCOUNT = "bankAccount"; private final GovReportDto2ReportSyncRequestConverter govReportDto2ReportSyncRequestConverter; private final ArchReportService archReportService; public void syncToPDFAndSaveCheckReport(CheckReportDto checkReportDto, String... requestParams) { ReportSyncRequest reportSyncRequest = govReportDto2ReportSyncRequestConverter.checkReportDtoConvertToReportSyncConverter(checkReportDto, requestParams); File file = archReportService.generateAndSaveReportPdf(reportSyncRequest); reportSyncRequest.setPdfFileName(file.getAbsolutePath()); archReportService.saveReport(reportSyncRequest); } @Transactional public void syncToPDFAndSaveSearchReport(SearchReportDto searchReportDto, String... requestParams) throws HibernateException { //todo puscic na oddzelnym watku ReportSyncRequest reportSyncRequest = govReportDto2ReportSyncRequestConverter.searchReportDtoConvertToReportSyncConverter(searchReportDto, requestParams); File file = archReportService.generateAndSaveReportPdf(reportSyncRequest); reportSyncRequest.setPdfFileName(file.getAbsolutePath()); getNegativeRequest(reportSyncRequest).forEach(archReportService::saveReport); archReportService.saveReport(reportSyncRequest); } //znalazienie w grupowym zapytaniu search (wiele nipow lub wiele regonow) zapytan negatywnych. // W response z rzadowego serwera po prostu puste parametry przychodza. Chce je zapisc do bazy jako sync odrebny. // Dla zapytan pojedynczych nie ma problemu. //todo moze jakis refaktor przeniesc do convertera aby robil pozytwyne i negatywne private List<ReportSyncRequest> getNegativeRequest(final ReportSyncRequest reportSyncRequest) { List<ReportSyncRequest> negativeList = new ArrayList<>(); SearchGovResponse govResponseReportSync = (SearchGovResponse) reportSyncRequest.getGovResponse(); List<SubjectResponse> subjectResponseList = govResponseReportSync.getSubjectResponseList(); if (null != subjectResponseList && subjectResponseList.size() > 1) { if (null != reportSyncRequest.getRequestNip()) { String requestedParams = reportSyncRequest.getRequestNip(); Arrays.stream(requestedParams.split(",")).forEach(param -> { if (!subjectResponseList.stream().map(SubjectResponse::getNip).collect(Collectors.joining(",")).contains(param)) { negativeList.add(generateReportSync(NIP, param, reportSyncRequest)); } }); } if (null != reportSyncRequest.getRequestRegon()) { Arrays.stream(reportSyncRequest.getRequestRegon().split(",")).forEach(param -> { if (!subjectResponseList.stream().map(SubjectResponse::getRegon).collect(Collectors.joining(",")).contains(param)) { negativeList.add(generateReportSync(REGON, param, reportSyncRequest)); } }); } if (null != reportSyncRequest.getRequestBankAccount()) { Arrays.stream(reportSyncRequest.getRequestBankAccount().split(",")).forEach(param -> { if (!subjectResponseList.stream() .map(SubjectResponse::getAccountNumbersList) .map(s -> String.join(",", s)) .collect(Collectors.joining(",")).contains(param)) { negativeList.add(generateReportSync(BANK_ACCOUNT, param, reportSyncRequest)); } }); } } return negativeList; } private ReportSyncRequest generateReportSync(final String paramType, final String params, final ReportSyncRequest reportToupdate) { SearchGovResponse govResponseReportSync = (SearchGovResponse) reportToupdate.getGovResponse(); GovResponse negativGovResponseReportySync = new SearchGovResponse( govResponseReportSync.getRequestId(), new ArrayList<>()); ReportSyncRequest rsr =ReportSyncRequest.builder() .reportDate(reportToupdate.getReportDate()) .reportType(reportToupdate.getReportType()) .requestBankAccount(reportToupdate.getRequestBankAccount()) .requestDate(reportToupdate.getRequestDate()) .requestNip(reportToupdate.getRequestNip()) .requestRegon(reportToupdate.getRequestRegon()) .searchResult(SearchResult.NEGATIVE) .govResponse(negativGovResponseReportySync) .build(); switch (paramType) { case REGON: rsr.setRequestRegon(params); break; case NIP: rsr.setRequestNip(params); break; case BANK_ACCOUNT: rsr.setRequestBankAccount(params); } return rsr; } }
[ "maciek@testaarosa.pl" ]
maciek@testaarosa.pl
a1ab0f3667288a2824191e667f611b22eb593de3
b2b768a4f655e4ff6ef77ff862172b03b42464b4
/app/src/main/java/com/seatstir/andy/seat95/VolleySingleton.java
0fc4d293a67eb5473655e1c2741c6bba4d298b5e
[]
no_license
cjbyrne772/Seat95x
1157c2ef1a2352f921133916ce4f87f989a7807b
1e378d8738ebfd6e9208f83b078ec9253dc0d35c
refs/heads/master
2021-01-11T01:58:18.663577
2016-10-13T17:23:15
2016-10-13T17:23:15
70,830,703
0
0
null
null
null
null
UTF-8
Java
false
false
1,558
java
package com.seatstir.andy.seat95; import com.android.volley.Request; import android.app.Application; import android.content.Context; import android.text.TextUtils; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.toolbox.Volley; public class VolleySingleton { public static final String TAG = VolleySingleton.class.getSimpleName(); private RequestQueue mRequestQueue; private static Context mCtx; private static VolleySingleton mInstance; private VolleySingleton(Context context) { mCtx = context; mRequestQueue = getRequestQueue(); } public static synchronized VolleySingleton getInstance(Context context) { if (mInstance == null) { mInstance = new VolleySingleton(context); } return mInstance; } public RequestQueue getRequestQueue() { if (mRequestQueue == null) { mRequestQueue = Volley.newRequestQueue(mCtx); } return mRequestQueue; } public <T> void addToRequestQueue(Request<T> req, String tag) { // set the default tag if tag is empty req.setTag(TextUtils.isEmpty(tag) ? TAG : tag); getRequestQueue().add(req); } public <T> void addToRequestQueue(Request<T> req) { req.setTag(TAG); getRequestQueue().add(req); } public void cancelPendingRequests(Object tag) { if (mRequestQueue != null) { mRequestQueue.cancelAll(tag); } } }
[ "e51doesit@gmail.com" ]
e51doesit@gmail.com
cf3d345a0033e03ca88117ac8faee3e0f5117b8c
363f97debd5cb7a2972bf0bf6a3c840d0d96b9b1
/01_JavaSource/taskMgmt/src/main/java/com/mindtree/task/constants/RolePermission.java
d0d6dbae2ceed69580c083700fbd4b4362b1744c
[]
no_license
dusthra1/taskManagement
a6e814003c8a4b764aa80b6cf0473bc0e18638e1
f29a058f07866388aa5da338e2fd3ac74a229afb
refs/heads/master
2018-10-30T01:37:55.335024
2018-10-16T10:21:45
2018-10-16T10:21:45
96,600,656
0
0
null
null
null
null
UTF-8
Java
false
false
598
java
package com.mindtree.task.constants; public enum RolePermission { PERM_ACCESS_ADMIN_AREA(10), PERM_ACCESS_VIEW_TASKS(11); private final int value; RolePermission(int permissionId){ this.value = permissionId; } public int getValue() { return value; } public static RolePermission fromCode(int value){ for(RolePermission rolePermission:RolePermission.values()){ if(rolePermission.getValue() == value){ return rolePermission; } } throw new UnsupportedOperationException( "The code " + value + " is not supported for any RolePermission!"); } }
[ "ramanand.dusthakar@adc.mindtree.com" ]
ramanand.dusthakar@adc.mindtree.com
d0ecc20421d543f42caca8dd42c94b081896b88d
b73630ac3cbf25b64054a59c0ecd4383e16ee006
/src/Test.java
4495220fc237cdad556d7d4858470ecc5544b843
[]
no_license
simsyj/URL_Shortener
af6cd41261964e41fd9d7f752963edd0ccc21c62
68428ce3e54dcb93262d1625b02aac5135e4be74
refs/heads/master
2023-04-29T10:42:32.894778
2021-04-29T18:16:50
2021-04-29T18:16:50
362,908,261
0
0
null
null
null
null
UTF-8
Java
false
false
250
java
public class Test { public static void main(String[] args){ Shortener shortener = new Shortener(); System.out.println(shortener.shortenURL("Facebook.com")); System.out.println(shortener.shortenURL("bbc.co.uk")); } }
[ "40174176@ads.qub.ac.uk" ]
40174176@ads.qub.ac.uk
428b24668e5bb285c9a47cba0b796acc1860fda4
8553367f97586cfb9e878fcaffe7a11b912dbc96
/jdk-source/jdk1.8/src/main/java/org/omg/PortableInterceptor/USER_EXCEPTION.java
90e6180d7b300e67462c7bc915ee313f127c89c1
[]
no_license
GoldWater16/GoldWater
92abb6b4f2e448469408771d8aad96a9b412aa0a
8180d5689c8059c0fe9fbbe2770e8f6947d35c73
refs/heads/master
2023-07-20T12:30:06.481550
2022-05-21T15:27:09
2022-05-21T15:27:09
174,562,633
2
3
null
2023-07-13T17:02:44
2019-03-08T15:36:04
Java
UTF-8
Java
false
false
689
java
package org.omg.PortableInterceptor; /** * org/omg/PortableInterceptor/USER_EXCEPTION.java . * Generated by the IDL-to-Java compiler (portable), version "3.2" * from c:/re/workspace/8-2-build-windows-amd64-cygwin/jdk8u60/4407/corba/src/share/classes/org/omg/PortableInterceptor/Interceptors.idl * Tuesday, August 4, 2015 11:07:53 AM PDT */ public interface USER_EXCEPTION { /** * Indicates a UserException reply status. One possible value for * <code>RequestInfo.reply_status</code>. * @see RequestInfo#reply_status * @see SUCCESSFUL * @see SYSTEM_EXCEPTION * @see LOCATION_FORWARD * @see TRANSPORT_RETRY */ public static final short value = (short)(2); }
[ "huzewu@lecloudpay.com" ]
huzewu@lecloudpay.com
b85888426a222c6dcb5e05e9d30a5aeb99f0cb1a
fd4d9bfbc972a23ad17f014ebc6488bd7a6e08ae
/src/test/java/com/mohannad/countrycode/controller/CountryControllerTest.java
409ef9fbe9f1e48af4c86a5006cc949a7c28b669
[]
no_license
mohanadElmaghrby1/Country-Info
4edee0bad6c6d074ad48803c703210fc1abe4984
33675f8d6cd75c7e2dde4dad4e83d5ced7bf0d38
refs/heads/master
2020-08-28T10:44:19.773151
2019-12-06T11:04:00
2019-12-06T11:04:00
217,676,713
0
0
null
null
null
null
UTF-8
Java
false
false
1,800
java
package com.mohannad.countrycode.controller; import com.mohannad.countrycode.model.CountryEntity; import com.mohannad.countrycode.model.CountryInfo; import com.mohannad.countrycode.service.CountryLanguageService; import com.mohannad.countrycode.service.CountryService; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.function.Executable; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import javax.persistence.EntityNotFoundException; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.when; public class CountryControllerTest { CountryController countryController; @Mock CountryLanguageService countryLanguageService; @Mock CountryService countryService; @BeforeEach void setUp() { MockitoAnnotations.initMocks(this); countryController =new CountryController(countryService,countryLanguageService); } @Test void testCountryInfo() { CountryEntity countryEntity =new CountryEntity(); countryEntity.setCode("ABC"); countryEntity.setName("ABCcountry"); when(countryService.getCountry(any())).thenReturn(countryEntity); CountryInfo afgCountry = countryController.getCountryInfo("AFG"); //check not null assertNotNull(afgCountry); //check the returned name assertEquals("ABCcountry" ,afgCountry.getName() ); } @Test void tesNotExistentCountryInfo() { when(countryService.getCountry(any())).thenThrow(new EntityNotFoundException()); Executable executable = () -> countryController.getCountryInfo("adadaf"); assertThrows(EntityNotFoundException.class , executable); } }
[ "mohanad2021996@gmail.com" ]
mohanad2021996@gmail.com
810e3db76ae8dac26238ebc001164258ea6290ad
0794b9f357708184f1352206e1766f3dccc1aad8
/app/src/test/java/com/riyanmeidyprayoga/utskuis/ExampleUnitTest.java
90730724be6c243ef6248bd589b02cdaec230c2e
[]
no_license
riyanmeidyprayoga/Android-KuisUTS
3aac6cfb959f00c45f4223ac642b545e52377ba1
058e9312ddb846e1c07720b82f29f843f90fe50d
refs/heads/master
2020-05-19T01:27:16.482758
2019-05-03T13:43:33
2019-05-03T13:43:33
184,757,154
0
0
null
null
null
null
UTF-8
Java
false
false
390
java
package com.riyanmeidyprayoga.utskuis; import org.junit.Test; import static org.junit.Assert.*; /** * Example local unit test, which will execute on the development machine (host). * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ public class ExampleUnitTest { @Test public void addition_isCorrect() { assertEquals(4, 2 + 2); } }
[ "riyanmeidyprayoga@gmail.com" ]
riyanmeidyprayoga@gmail.com
5214fe9afc8374ef00b2e8f0b397755da7676e52
edf2dbb00b898d36476c39a2abf9b6f0ef7eef85
/Euler/src/euler/problems/Problem008.java
b48eb504b8713478b533efae2df05448afe5fb1b
[]
no_license
julemand101/Euler
7a4c2ab5cd4d9900980ebe0a85d039678883d926
27120d1480254c726fb21ec1c7229e844e11236e
refs/heads/master
2020-05-20T16:59:11.767774
2012-11-17T17:43:58
2012-11-17T17:43:58
6,705,995
1
0
null
null
null
null
UTF-8
Java
false
false
1,696
java
package euler.problems; import euler.Problem; public class Problem008 extends Problem { public int getID() { return 8; } public double getAnswer() { return 40824; } public double test(boolean verbose) { int maxProduct = 0; String digits = "73167176531330624919225119674426574742355349194934" + "96983520312774506326239578318016984801869478851843" + "85861560789112949495459501737958331952853208805511" + "12540698747158523863050715693290963295227443043557" + "66896648950445244523161731856403098711121722383113" + "62229893423380308135336276614282806444486645238749" + "30358907296290491560440772390713810515859307960866" + "70172427121883998797908792274921901699720888093776" + "65727333001053367881220235421809751254540594752243" + "52584907711670556013604839586446706324415722155397" + "53697817977846174064955149290862569321978468622482" + "83972241375657056057490261407972968652414535100474" + "82166370484403199890008895243450658541227588666881" + "16427171479924442928230863465674813919123162824586" + "17866458359124566529476545682848912883142607690042" + "24219022671055626321111109370544217506941658960408" + "07198403850962455444362981230987879927244284909188" + "84580156166097919133875499200524063689912560717606" + "05886116467109405077541002256983155200055935729725" + "71636269561882670428252483600823257530420752963450"; for (int i = 0; i < digits.length()-4; i += 1) { int product = 1; for (int j = 0; j < 5; j++) { product *= Integer.parseInt(digits.substring(i+j, i+j+1)); } if (product > maxProduct) { maxProduct = product; } } return maxProduct; } }
[ "julemand101@gmail.com" ]
julemand101@gmail.com
48a14e9899434a125e1294e8b5164904b27aa3b3
7b5d93a417d98fc3467720204ef0fb1703812a01
/hibernatetutorial/src/main/java/com/tutorial/demo/entity/Student.java
75d77a9797c35a48d219a843f1abc125b7bd01c8
[]
no_license
Tomino98sv/hibernate
c85be47d5890a6d7111e43506f0c1d96962c67c9
67d15a347eb64f0c7f2fdf46ca0d3f8f891066e1
refs/heads/master
2022-11-28T01:46:41.983988
2020-02-24T13:28:33
2020-02-24T13:28:33
233,566,336
0
0
null
2022-11-24T04:25:13
2020-01-13T10:09:35
Java
UTF-8
Java
false
false
1,450
java
package com.tutorial.demo.entity; import javax.persistence.*; @Entity @Table(name="student") public class Student { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name="id") private int id; @Column(name="first_name") private String firstName; @Column(name="last_name") private String lastName; @Column(name="email") private String email; public Student() { } public Student(String firstName, String lastName, String email) { this.firstName = firstName; this.lastName = lastName; this.email = email; } public int getId() { return id; } public void setId(int id) { this.id = id; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } @Override public String toString() { return "Student{" + "id=" + id + ", firstName='" + firstName + '\'' + ", lastName='" + lastName + '\'' + ", email='" + email + '\'' + '}'; } }
[ "tomaes89sv@gmail.com" ]
tomaes89sv@gmail.com
f49d6710f3b95e062ba1413fe901de35936bd2f9
516a09f9ae73c8fa74e6bc7c4e29afa69a198b9c
/src/main/java/org/smartvalidator/ConflictHandler.java
d947db3663b9a48d59ab92a24be8ee1bb4c31555
[ "MIT" ]
permissive
SmartValidator/ConflictHandler
532965ce3de6e6fc42963787da8c62cbc98f891f
d59d76d9025dfc4edf2c22a4b47f5ea94dccb33b
refs/heads/master
2021-09-02T17:01:25.632035
2017-12-28T23:13:06
2017-12-28T23:13:06
114,100,880
0
0
null
null
null
null
UTF-8
Java
false
false
5,585
java
package org.smartvalidator; import java.sql.Timestamp; import java.util.ArrayList; import java.util.List; public class ConflictHandler { protected List<VerifiedAnnouncement> announcements; protected List<Roa> roas; protected List<Conflict> conflicts; public class Conflict { private VerifiedAnnouncement announcement; private List<RoaEntry> roas; public Conflict(VerifiedAnnouncement announcement, List<RoaEntry> roas){ this.announcement = announcement; this.roas = roas; } public Conflict(VerifiedAnnouncement announcement, RoaEntry roaEntry){ this.announcement = announcement; this.roas = new ArrayList<>(); this.roas.add(roaEntry); } public VerifiedAnnouncement getAnnouncement(){ return this.announcement; } public void addRoa(RoaEntry roaEntry){ this.roas.add(roaEntry); } public List<RoaEntry> getRoas(){ return this.roas; } public int[] getRoaIds(){ int[] roaIds = new int[roas.size()]; for(int i = 0; i < roas.size(); i++){ roaIds[i] = roas.get(i).getRoaId(); } return roaIds; } } public class RoaEntry { private Roa roa; private int route_validity; private Timestamp created_at; private Timestamp updated_at; public RoaEntry(Roa roa, int route_validity, Timestamp created_at, Timestamp updated_at){ this.roa = roa; this.route_validity = route_validity; this.created_at = created_at; this.updated_at = updated_at; } public RoaEntry(int id, int asn, String prefix, int max_length, Boolean filtered, Boolean whitelisted, int trust_anchor_id, Timestamp roa_created_at, Timestamp roa_updated_at, int route_validity, Timestamp created_at, Timestamp updated_at){ this.roa = new Roa(id, asn, prefix, max_length, filtered, whitelisted, trust_anchor_id, roa_created_at, roa_updated_at); this.route_validity = route_validity; this.created_at = created_at; this.updated_at = updated_at; } // public Roa getRoa(){ // return this.roa; // } public int getRoaId(){ return roa.getId(); } public int getValidity(){ return this.route_validity; } } public class Roa { private int id; private long asn; private String prefix; private int max_length; private Boolean filtered; private Boolean whitelisted; private int trust_anchor_id; private Timestamp created_at; private Timestamp updated_at; public Roa(int id, long asn, String prefix, int max_length, Boolean filtered, Boolean whitelisted, int trust_anchor_id, Timestamp created_at, Timestamp updated_at){ this.id = id; this.asn = asn; this.prefix = prefix; this.max_length = max_length; this.filtered = filtered; this.whitelisted = whitelisted; this.trust_anchor_id = trust_anchor_id; this.created_at = created_at; this.updated_at = updated_at; } @Override public String toString(){ return this.id + "\t" + this.asn + "\t" + this.prefix + "\t" + this.max_length + "\t" + this.filtered + "\t" + this.whitelisted + "\t" + this.trust_anchor_id + "\t" + this.created_at + "\t" + this.updated_at; } public int getId(){ return id; } public void setFiltered(Boolean filtered){ this.filtered = filtered; } public Boolean getWhitelisted(){ return this.whitelisted; } public void setFilteredWhitelistFalse(){ this.filtered = false; this.whitelisted = false; } } public class VerifiedAnnouncement { private int id; private Announcement announcement; private Timestamp created_at; private Timestamp updated_at; public VerifiedAnnouncement(int id, Announcement announcement, Timestamp created_at, Timestamp updated_at){ this.id = id; this.announcement = announcement; this.created_at = created_at; this.updated_at = updated_at; } @Override public String toString(){ return this.id + "\t" + this.announcement.toString() + "\t" + this.created_at + "\t" + this.updated_at; } public int getId(){ return this.id; } public long getAsn(){ return this.announcement.getAsn(); } public String getPrefix(){ return this.announcement.getPrefix(); } public Timestamp getCreated_at(){ return announcement.getCreated_at(); } } public class Announcement { private int id; private long asn; private String prefix; private Timestamp created_at; private Timestamp updated_at; public Announcement(int id, long asn, String prefix, Timestamp created_at, Timestamp updated_at){ this.id = id; this.asn = asn; this.prefix = prefix; this.created_at = created_at; this.updated_at = updated_at; } @Override public String toString(){ return this.id + "\t" + this.asn + "\t" + this.prefix + "\t" + this.created_at + "\t" + this.updated_at; } public int getId(){ return this.id; } public long getAsn(){ return this.asn; } public String getPrefix(){ return this.prefix; } public Timestamp getCreated_at(){ return created_at; } } }
[ "fabian.z.sauer@gmail.com" ]
fabian.z.sauer@gmail.com
792deb5044cd5a96be584591f776a5a3aca4f95f
35c23bb3de1345b8c12c13af38d33e427e7a839e
/JavaBasic/src/day0119/Ex01variable.java
a2e929150bdae972cdfe9b8e15a59ccc9477b2d0
[]
no_license
DongGeun2/bitcamp_java_basic
32acf6abe3f612642f930193d25ef60d2d6ba752
bf5160a2be1727b5ac0e4191b53a666efa380b87
refs/heads/master
2023-03-28T04:26:19.118164
2021-03-29T01:22:20
2021-03-29T01:22:20
329,153,226
2
0
null
null
null
null
UTF-8
Java
false
false
1,964
java
package day0119; // 변수 (variable) // 변수란 우리가 stack 메모리 영영에 등록하는 하나의 공간으로써 // 우리가 해당 변수를 선언할 때 지정한 데이터타입과 맞는 값이면 // 언제든 그 공간의 내용을 바꿔줄 수 있다. // 즉 내용이 변할수 있기 때문에 변수이다. // 변수를 우리가 사용하기 위해서는 // '선언' 과 '초기화'의 단계를 거쳐야 사용가능하다. // 선언 : 해당 변수의 데이터 타입과 이름을 지정 // 초기화 : 변수는 우리가 사용하기 위해서는 무조건 한번은 값을 할당해주어야 한다. // 변수의 선언방법 // 데이터타입 이름; // 변수의 초기화 방법 // 이름 = 값; public class Ex01variable { public static void main(String[] args) { // int 변수 number 를 선언해보자 int number; number = 20; System.out.println("number의 현재값: " + number); number = 45; System.out.println("number의 현재값: " + number); // 만약 우리가 지정한 변수의 데이터타입과 다른 값을 넣어주면 // 에러가 발생한다. number = 'A'; System.out.println("number의 현재값: " + number); // 실수형 변수를 만들어보자 double d = 3.141592; System.out.println("d의 현재값: " + d); // 정수형 공간에 실수값을 넣을 수는 없지만 // 실수형 공간에는 정수값을 넣을 수 있다. d = 3; System.out.println("d의 현재값: " + d); // 문자형 변수를 만들어보자 char c = 'b'; System.out.println("c의 현재값: " + c); // 논리형 변수를 만들어보자 boolean b = true; System.out.println("b의 현재값: " + b); } }
[ "mhy01@DESKTOP-PKJA8JO" ]
mhy01@DESKTOP-PKJA8JO
db2801fc6fcff3d990452c1714c2a695c2243680
163abf914ea29a733eba0a716f1264213d2d5430
/Client/src/controllers/GroupViewControlAutoUpdate.java
93aa53df91c5c88cc34b366dac811e33ef454d2d
[]
no_license
Spirit-ofJoy/Ampify
21b3324028612226f29f414a784957c69a1cfca5
b6d93e9dbdecf3648f53e364cffc7b0d42410425
refs/heads/master
2023-03-22T11:34:20.233991
2021-03-17T18:01:02
2021-03-17T18:01:02
301,436,651
5
1
null
null
null
null
UTF-8
Java
false
false
437
java
package controllers; public class GroupViewControlAutoUpdate implements Runnable{ GroupViewControl grpView; GroupViewControlAutoUpdate(GroupViewControl View) { grpView = View; } @Override public void run() { try { while(true){ Thread.sleep(5000); grpView.getMessages(); } } catch (Exception e) { e.printStackTrace(); } } }
[ "yashendu.pandey02@gmail.com" ]
yashendu.pandey02@gmail.com
a3888c850bd3e0fd8f4c78fa436f7e92caf5023f
889f5efa97330f39b95a628df24f1abcefa201fe
/src/main/java/com/nautestech/security/model/User.java
710fc192a39263b56451cc7244c0cd938f6b9bae
[]
no_license
limseungtaek/VERDE
d6e78a2e8179feec9e2c878065cd089481e9f3b4
201bcb897fbe81c3fa83d9b8d51c578a3aea62dd
refs/heads/master
2021-01-23T08:24:25.894857
2015-09-11T08:53:59
2015-09-11T08:53:59
42,298,231
0
0
null
null
null
null
UHC
Java
false
false
2,578
java
package com.nautestech.security.model; import java.util.Collection; import java.util.List; import org.springframework.security.core.GrantedAuthority; import org.springframework.security.core.userdetails.UserDetails; public class User implements UserDetails { private static final long serialVersionUID = 1L; private String username; private String password; // 추가적인 회원정보 항목을 추가한다. email 이나 연락처 등등... private List<Role> authorities; private boolean accountNonExpired = true; private boolean accountNonLocked = true; private boolean credentialsNonExpired = true; private boolean enabled = true; @Override public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } @Override public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } @Override public Collection<? extends GrantedAuthority> getAuthorities() { return this.authorities; } public void setAuthorities(List<Role> authorities) { this.authorities = authorities; } @Override public boolean isAccountNonExpired() { return this.accountNonExpired; } public void setAccountNonExpired(boolean accountNonExpired) { this.accountNonExpired = accountNonExpired; } @Override public boolean isAccountNonLocked() { return this.accountNonLocked; } public void setAccountNonLocked(boolean accountNonLocked) { this.accountNonLocked = accountNonLocked; } @Override public boolean isCredentialsNonExpired() { return this.credentialsNonExpired; } public void setCredentialsNonExpired(boolean credentialsNonExpired) { this.credentialsNonExpired = credentialsNonExpired; } @Override public boolean isEnabled() { return this.enabled; } public void setEnabled(boolean enabled) { this.enabled = enabled; } @Override public String toString() { return "User [username=" + username + ", password=" + password + ", authorities=" + authorities + ", accountNonExpired=" + accountNonExpired + ", accountNonLocked=" + accountNonLocked + ", credentialsNonExpired=" + credentialsNonExpired + ", enabled=" + enabled + ", hashCode()=" + hashCode() + "]"; } }
[ "LST-C@LST-C-PC" ]
LST-C@LST-C-PC
fe073ef777fcbf5359938184ff89d0299907a148
0744e913ec8e5d453fac3ec29abf087fa9d9d804
/src/test/java/com/runescape/runescape/repository/CategoryRepositoryTest.java
f2b33d775d6a8538940ea8875de0e837a0ab25f9
[]
no_license
Jefferson-Euclides/runescape-api
85d564dc0d1adecaa950fc3a60401953da7574fa
1b37380a452b899265a4c729c965103197e310a0
refs/heads/master
2020-08-05T17:09:17.751406
2019-10-21T13:16:42
2019-10-21T13:16:42
212,628,025
0
0
null
null
null
null
UTF-8
Java
false
false
1,917
java
package com.runescape.runescape.repository; import static org.assertj.core.api.Assertions.assertThat; import java.util.ArrayList; import java.util.List; import java.util.Optional; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; import org.springframework.boot.test.autoconfigure.orm.jpa.TestEntityManager; import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.junit4.SpringRunner; import com.runescape.runescape.model.Category; @ActiveProfiles("test") @RunWith(SpringRunner.class) @DataJpaTest public class CategoryRepositoryTest { @Autowired private TestEntityManager entityManager; @Autowired private CategoryRepository categoryRepository; @Test public void findByIdShouldReturnValidCategory() { Category category = new Category(); category.setName("Test"); entityManager.persist(category); entityManager.flush(); Optional<Category> testCategory = categoryRepository.findById(category.getId()); assertThat(testCategory.get().getName()).isEqualTo(testCategory.get().getName()); } @Test public void findAllShouldReturnAllCategories() { Category firstCategory = new Category(); firstCategory.setName("Yerevan"); entityManager.persist(firstCategory); entityManager.flush(); Category secondCategory = new Category(); secondCategory.setName("Israel"); entityManager.persist(secondCategory); entityManager.flush(); Iterable<Category> arrivals = categoryRepository.findAll(); List<Category> test = new ArrayList<>(); arrivals.forEach(test::add); assertThat(test.size()).isEqualTo(8); assertThat(test.get(6)).isEqualTo(firstCategory); assertThat(test.get(7)).isEqualTo(secondCategory); } }
[ "jeffersoneuclides84@gmail.com" ]
jeffersoneuclides84@gmail.com
51ff4cfa25bb83d700c86aa72c53e58debaa25d0
ce3f9f9688d68477d87d18b1a7bd7b2d51a255ac
/src/main/java/de/codecentric/batch/listener/LoggingAfterJobListener.java
7ee0a14d824317c441b995727dc1854b976b0673
[ "Apache-2.0" ]
permissive
wanghy6503/spring-boot-starter-batch-web
4945df9a6fccf4892eb36fd4a05911d240a9cef4
9201974e06b1b5b0f411b2de90eefa0448209022
refs/heads/master
2022-12-02T23:09:15.725319
2014-08-17T09:41:32
2014-08-17T09:41:32
23,138,068
0
0
Apache-2.0
2022-11-25T16:23:59
2014-08-20T06:13:25
null
UTF-8
Java
false
false
2,148
java
/* * Copyright 2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.codecentric.batch.listener; import org.slf4j.MDC; import org.springframework.batch.core.JobExecution; import org.springframework.batch.core.JobExecutionListener; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.Ordered; import de.codecentric.batch.logging.DefaultJobLogFileNameCreator; import de.codecentric.batch.logging.JobLogFileNameCreator; /** * This extra listener is needed, because the {@link LoggingListener} removes the variable from the MDC * in its afterStep method. We re-set it here at the beginning of the execution of all afterJob methods * of JobExecutionListeners. * @see LoggingListener * * @author Tobias Flohre * */ public class LoggingAfterJobListener implements JobExecutionListener, Ordered { private JobLogFileNameCreator jobLogFileNameCreator = new DefaultJobLogFileNameCreator(); @Override public void beforeJob(JobExecution jobExecution) { } private void insertValuesIntoMDC(JobExecution jobExecution) { MDC.put(LoggingListener.JOBLOG_FILENAME, jobLogFileNameCreator.createJobLogFileName(jobExecution)); } @Override public void afterJob(JobExecution jobExecution) { insertValuesIntoMDC(jobExecution); } @Override public int getOrder() { return Ordered.LOWEST_PRECEDENCE; } @Autowired(required=false) public void setJobLogFileNameCreator(JobLogFileNameCreator jobLogFileNameCreator) { this.jobLogFileNameCreator = jobLogFileNameCreator; } }
[ "tobias.flohre@codecentric.de" ]
tobias.flohre@codecentric.de
2c73c0dd64495d668fbcb728d9e3ca02cf22aa74
5959fc5580e65f0934ee5232acbd290012fbc96e
/src/main/java/day20201108/logoNBC/TextNbc.java
868717b5c7a79db7661b1827687b379b0f8c06b2
[]
no_license
RafalSokolowski/for_students
a658a47fd681f8c4fa098a4593dc23abf41c27d4
4d3f5eeaee41853d306e53324f0be6fd2f6f39e5
refs/heads/main
2023-02-14T17:28:51.328744
2021-01-06T23:08:31
2021-01-06T23:08:31
308,920,291
0
0
null
null
null
null
UTF-8
Java
false
false
751
java
package day20201108.logoNBC; import javafx.scene.paint.Color; import javafx.scene.text.Font; import javafx.scene.text.Text; import lombok.AllArgsConstructor; import java.io.InputStream; @AllArgsConstructor public class TextNbc { private final double positionX; private final double positionY; private final String toWrite; private final int fontSize; public Text create() { Text text = new Text(positionX, positionY, toWrite); String path = "Font/FontNBC.ttf"; InputStream fontStream = TextNbc.class.getClassLoader().getResourceAsStream(path); Font fontNBC = Font.loadFont(fontStream, fontSize); text.setFont(fontNBC); text.setFill(Color.BLACK); return text; } }
[ "rafal.miroslaw.sokolowski@gmail.com" ]
rafal.miroslaw.sokolowski@gmail.com
002049729c7bcd78a5a68b5513c4959f2d59ceef
b6ba4d666b07580325ed9b6fdac97918b475097b
/src/test/java/com/github/vincentrussell/query/mongodb/sql/converter/QueryConverterIT.java
7904923199a7061805e5f48a193371308b4999e8
[ "Apache-2.0" ]
permissive
anujwalia/sql-to-mongo-db-query-converter
86bd032700c35abba5aa5471d9fd68a105539a1e
48037ca2415a5cbd5cf8e48de16c3fca719486dd
refs/heads/master
2020-04-07T11:28:58.886448
2018-11-20T02:49:20
2018-11-20T02:49:20
158,328,075
0
0
Apache-2.0
2018-11-20T17:10:29
2018-11-20T03:53:37
Java
UTF-8
Java
false
false
17,688
java
package com.github.vincentrussell.query.mongodb.sql.converter; import com.google.common.base.Function; import com.google.common.base.Joiner; import com.google.common.base.Predicate; import com.google.common.collect.Collections2; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import com.mongodb.MongoClient; import com.mongodb.client.MongoCollection; import com.mongodb.client.MongoDatabase; import com.mongodb.client.model.InsertOneModel; import com.mongodb.client.model.WriteModel; import de.flapdoodle.embed.mongo.MongodExecutable; import de.flapdoodle.embed.mongo.MongodProcess; import de.flapdoodle.embed.mongo.MongodStarter; import de.flapdoodle.embed.mongo.config.IMongodConfig; import de.flapdoodle.embed.mongo.config.MongodConfigBuilder; import de.flapdoodle.embed.mongo.config.Net; import de.flapdoodle.embed.mongo.distribution.Version; import org.apache.commons.io.IOUtils; import org.bson.BsonDocument; import org.bson.BsonString; import org.bson.Document; import org.bson.json.JsonMode; import org.bson.json.JsonWriterSettings; import org.bson.types.ObjectId; import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; import java.io.*; import java.net.ServerSocket; import java.util.*; import static org.junit.Assert.assertEquals; public class QueryConverterIT { private static final int TOTAL_TEST_RECORDS = 25359; private static MongodStarter starter = MongodStarter.getDefaultInstance(); private static MongodProcess mongodProcess; private static MongodExecutable mongodExecutable; private static int port = getRandomFreePort(); private static MongoClient mongoClient; private static final String DATABASE = "local"; private static final String COLLECTION = "my_collection"; private static MongoDatabase mongoDatabase; private static MongoCollection mongoCollection; private static JsonWriterSettings jsonWriterSettings = new JsonWriterSettings(JsonMode.STRICT, "\t", "\n"); @BeforeClass public static void beforeClass() throws IOException { IMongodConfig mongodConfig = new MongodConfigBuilder() .version(Version.Main.PRODUCTION) .net(new Net("localhost",port, false)) .build(); mongodExecutable = starter.prepare(mongodConfig); mongodProcess = mongodExecutable.start(); mongoClient = new MongoClient("localhost",port); mongoDatabase = mongoClient.getDatabase(DATABASE); mongoCollection = mongoDatabase.getCollection(COLLECTION); List<Document> documents = new ArrayList<>(TOTAL_TEST_RECORDS); try(InputStream inputStream = QueryConverterIT.class.getResourceAsStream("/primer-dataset.json"); BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream))) { String line; while ((line = bufferedReader.readLine())!=null) { documents.add(Document.parse(line)); } } for (Iterator<List<WriteModel>> iterator = Iterables.partition(Lists.transform(documents, new Function<Document, WriteModel>() { @Override public WriteModel apply(Document document) { return new InsertOneModel(document); } }),10000).iterator(); iterator.hasNext();) { mongoCollection.bulkWrite(iterator.next()); } assertEquals(TOTAL_TEST_RECORDS,mongoCollection.count()); } @AfterClass public static void afterClass() { mongoClient.close(); mongodProcess.stop(); mongodExecutable.stop(); } @Test public void likeQuery() throws ParseException { QueryConverter queryConverter = new QueryConverter("select * from "+COLLECTION+" where address.street LIKE '%Street'"); QueryResultIterator<Document> findIterable = queryConverter.run(mongoDatabase); List<Document> documents = Lists.newArrayList(findIterable); assertEquals(7499, documents.size()); Document firstDocument = documents.get(0); firstDocument.remove("_id"); assertEquals("{\n" + "\t\"address\" : {\n" + "\t\t\"building\" : \"351\",\n" + "\t\t\"coord\" : [-73.98513559999999, 40.7676919],\n" + "\t\t\"street\" : \"West 57 Street\",\n" + "\t\t\"zipcode\" : \"10019\"\n" + "\t},\n" + "\t\"borough\" : \"Manhattan\",\n" + "\t\"cuisine\" : \"Irish\",\n" + "\t\"grades\" : [{\n" + "\t\t\t\"date\" : {\n" + "\t\t\t\t\"$date\" : 1409961600000\n" + "\t\t\t},\n" + "\t\t\t\"grade\" : \"A\",\n" + "\t\t\t\"score\" : 2\n" + "\t\t}, {\n" + "\t\t\t\"date\" : {\n" + "\t\t\t\t\"$date\" : 1374451200000\n" + "\t\t\t},\n" + "\t\t\t\"grade\" : \"A\",\n" + "\t\t\t\"score\" : 11\n" + "\t\t}, {\n" + "\t\t\t\"date\" : {\n" + "\t\t\t\t\"$date\" : 1343692800000\n" + "\t\t\t},\n" + "\t\t\t\"grade\" : \"A\",\n" + "\t\t\t\"score\" : 12\n" + "\t\t}, {\n" + "\t\t\t\"date\" : {\n" + "\t\t\t\t\"$date\" : 1325116800000\n" + "\t\t\t},\n" + "\t\t\t\"grade\" : \"A\",\n" + "\t\t\t\"score\" : 12\n" + "\t\t}],\n" + "\t\"name\" : \"Dj Reynolds Pub And Restaurant\",\n" + "\t\"restaurant_id\" : \"30191841\"\n" + "}", firstDocument.toJson(jsonWriterSettings)); } @Test public void objectIdQuery() throws ParseException { mongoCollection.insertOne(new Document("_id", new ObjectId("54651022bffebc03098b4567")).append("key", "value1")); mongoCollection.insertOne(new Document("_id", new ObjectId("54651022bffebc03098b4568")).append("key", "value2")); try { QueryConverter queryConverter = new QueryConverter("select _id from " + COLLECTION + " where ObjectId('_id') = '54651022bffebc03098b4567'"); QueryResultIterator<Document> findIterable = queryConverter.run(mongoDatabase); List<Document> documents = Lists.newArrayList(findIterable); assertEquals(1, documents.size()); assertEquals("{\n" + "\t\"_id\" : {\n" + "\t\t\"$oid\" : \"54651022bffebc03098b4567\"\n" + "\t}\n" + "}", documents.get(0).toJson(jsonWriterSettings)); } finally { mongoCollection.deleteOne(new Document("_id", new ObjectId("54651022bffebc03098b4567"))); mongoCollection.deleteOne(new Document("_id", new ObjectId("54651022bffebc03098b4568"))); } } @Test public void objectIdInQuery() throws ParseException { mongoCollection.insertOne(new Document("_id", new ObjectId("54651022bffebc03098b4567")).append("key", "value1")); mongoCollection.insertOne(new Document("_id", new ObjectId("54651022bffebc03098b4568")).append("key", "value2")); try { QueryConverter queryConverter = new QueryConverter("select _id from " + COLLECTION + " where ObjectId('_id') IN ('54651022bffebc03098b4567','54651022bffebc03098b4568')"); QueryResultIterator<Document> findIterable = queryConverter.run(mongoDatabase); List<Document> documents = Lists.newArrayList(findIterable); assertEquals(2, documents.size()); assertEquals("{\n" + "\t\"_id\" : {\n" + "\t\t\"$oid\" : \"54651022bffebc03098b4567\"\n" + "\t}\n" + "}", documents.get(0).toJson(jsonWriterSettings)); assertEquals("{\n" + "\t\"_id\" : {\n" + "\t\t\"$oid\" : \"54651022bffebc03098b4568\"\n" + "\t}\n" + "}", documents.get(1).toJson(jsonWriterSettings)); } finally { mongoCollection.deleteOne(new Document("_id", new ObjectId("54651022bffebc03098b4567"))); mongoCollection.deleteOne(new Document("_id", new ObjectId("54651022bffebc03098b4568"))); } } @Test public void likeQueryWithProjection() throws ParseException { QueryConverter queryConverter = new QueryConverter("select address.building, address.coord from "+COLLECTION+" where address.street LIKE '%Street'"); QueryResultIterator<Document> findIterable = queryConverter.run(mongoDatabase); List<Document> documents = Lists.newArrayList(findIterable); assertEquals(7499, documents.size()); assertEquals("{\n" + "\t\"address\" : {\n" + "\t\t\"building\" : \"351\",\n" + "\t\t\"coord\" : [-73.98513559999999, 40.7676919]\n" + "\t}\n" + "}",documents.get(0).toJson(jsonWriterSettings)); } @Test public void distinctQuery() throws ParseException { QueryConverter queryConverter = new QueryConverter("select distinct borough from "+COLLECTION+" where address.street LIKE '%Street'"); QueryResultIterator<String> distinctIterable = queryConverter.run(mongoDatabase); List<String> results = Lists.newArrayList(distinctIterable); assertEquals(5, results.size()); assertEquals(Arrays.asList("Manhattan", "Queens", "Brooklyn", "Bronx", "Staten Island"),results); } @Test public void countGroupByQuery() throws ParseException, IOException { QueryConverter queryConverter = new QueryConverter("select borough, count(borough) from "+COLLECTION+" GROUP BY borough"); QueryResultIterator<Document> distinctIterable = queryConverter.run(mongoDatabase); List<Document> results = Lists.newArrayList(distinctIterable); assertEquals(6, results.size()); assertEquals("[{\n" + "\t\"_id\" : \"Missing\",\n" + "\t\"count\" : 51\n" + "},{\n" + "\t\"_id\" : \"Staten Island\",\n" + "\t\"count\" : 969\n" + "},{\n" + "\t\"_id\" : \"Manhattan\",\n" + "\t\"count\" : 10259\n" + "},{\n" + "\t\"_id\" : \"Bronx\",\n" + "\t\"count\" : 2338\n" + "},{\n" + "\t\"_id\" : \"Queens\",\n" + "\t\"count\" : 5656\n" + "},{\n" + "\t\"_id\" : \"Brooklyn\",\n" + "\t\"count\" : 6086\n" + "}]",toJson(results)); } @Test public void countGroupByQuerySortByCount() throws ParseException, IOException { QueryConverter queryConverter = new QueryConverter("select borough, count(borough) from "+COLLECTION+" GROUP BY borough\n" + "ORDER BY count(borough) DESC;"); QueryResultIterator<Document> distinctIterable = queryConverter.run(mongoDatabase); List<Document> results = Lists.newArrayList(distinctIterable); assertEquals(6, results.size()); assertEquals("[{\n" + "\t\"_id\" : \"Manhattan\",\n" + "\t\"count\" : 10259\n" + "},{\n" + "\t\"_id\" : \"Brooklyn\",\n" + "\t\"count\" : 6086\n" + "},{\n" + "\t\"_id\" : \"Queens\",\n" + "\t\"count\" : 5656\n" + "},{\n" + "\t\"_id\" : \"Bronx\",\n" + "\t\"count\" : 2338\n" + "},{\n" + "\t\"_id\" : \"Staten Island\",\n" + "\t\"count\" : 969\n" + "},{\n" + "\t\"_id\" : \"Missing\",\n" + "\t\"count\" : 51\n" + "}]",toJson(results)); } @Test public void countGroupByQueryLimit() throws ParseException { QueryConverter queryConverter = new QueryConverter("select borough, count(borough) from "+COLLECTION+" GROUP BY borough LIMIT 2"); QueryResultIterator<Document> distinctIterable = queryConverter.run(mongoDatabase); List<Document> results = Lists.newArrayList(distinctIterable); assertEquals(2, results.size()); assertEquals(Arrays.asList(new Document("_id","Missing").append("count",51), new Document("_id","Staten Island").append("count",969) ),results); } @Test public void countGroupByQueryMultipleColumns() throws ParseException, IOException { QueryConverter queryConverter = new QueryConverter("select borough, cuisine, count(*) from "+COLLECTION+" GROUP BY borough, cuisine"); QueryResultIterator<Document> distinctIterable = queryConverter.run(mongoDatabase); List<Document> results = Lists.newArrayList(distinctIterable); assertEquals(365, results.size()); List<Document> filteredResults = Lists.newArrayList(Collections2.filter(results, new Predicate<Document>() { @Override public boolean apply(Document document) { return document.getInteger("count") > 500; } })); assertEquals("[{\n" + "\t\"_id\" : {\n" + "\t\t\"borough\" : \"Manhattan\",\n" + "\t\t\"cuisine\" : \"Chinese\"\n" + "\t},\n" + "\t\"count\" : 510\n" + "},{\n" + "\t\"_id\" : {\n" + "\t\t\"borough\" : \"Queens\",\n" + "\t\t\"cuisine\" : \"American \"\n" + "\t},\n" + "\t\"count\" : 1040\n" + "},{\n" + "\t\"_id\" : {\n" + "\t\t\"borough\" : \"Manhattan\",\n" + "\t\t\"cuisine\" : \"Café/Coffee/Tea\"\n" + "\t},\n" + "\t\"count\" : 680\n" + "},{\n" + "\t\"_id\" : {\n" + "\t\t\"borough\" : \"Manhattan\",\n" + "\t\t\"cuisine\" : \"Italian\"\n" + "\t},\n" + "\t\"count\" : 621\n" + "},{\n" + "\t\"_id\" : {\n" + "\t\t\"borough\" : \"Brooklyn\",\n" + "\t\t\"cuisine\" : \"American \"\n" + "\t},\n" + "\t\"count\" : 1273\n" + "},{\n" + "\t\"_id\" : {\n" + "\t\t\"borough\" : \"Manhattan\",\n" + "\t\t\"cuisine\" : \"American \"\n" + "\t},\n" + "\t\"count\" : 3205\n" + "},{\n" + "\t\"_id\" : {\n" + "\t\t\"borough\" : \"Queens\",\n" + "\t\t\"cuisine\" : \"Chinese\"\n" + "\t},\n" + "\t\"count\" : 728\n" + "},{\n" + "\t\"_id\" : {\n" + "\t\t\"borough\" : \"Brooklyn\",\n" + "\t\t\"cuisine\" : \"Chinese\"\n" + "\t},\n" + "\t\"count\" : 763\n" + "}]",toJson(filteredResults)); } @Test public void countQuery() throws ParseException { QueryConverter queryConverter = new QueryConverter("select count(*) from "+COLLECTION+" where address.street LIKE '%Street'"); long count = queryConverter.run(mongoDatabase); assertEquals(7499, count); } @Test public void deleteQuery() throws ParseException { String collection = "new_collection"; MongoCollection newCollection = mongoDatabase.getCollection(collection); try { newCollection.insertOne(new Document("_id", "1").append("key", "value")); newCollection.insertOne(new Document("_id", "2").append("key", "value")); newCollection.insertOne(new Document("_id", "3").append("key", "value")); newCollection.insertOne(new Document("_id", "4").append("key2", "value2")); assertEquals(3, newCollection.count(new BsonDocument("key", new BsonString("value")))); QueryConverter queryConverter = new QueryConverter("delete from " + collection + " where key = 'value'"); long deleteCount = queryConverter.run(mongoDatabase); assertEquals(3, deleteCount); assertEquals(1, newCollection.count()); } finally { newCollection.drop(); } } private static int getRandomFreePort() { Random r = new Random(); int count = 0; while (count < 13) { int port = r.nextInt((1 << 16) - 1024) + 1024; ServerSocket so = null; try { so = new ServerSocket(port); so.setReuseAddress(true); return port; } catch (IOException ioe) { } finally { if (so != null) try { so.close(); } catch (IOException e) {} } } throw new RuntimeException("Unable to find port"); } private static String toJson(List<Document> documents) throws IOException { StringWriter stringWriter = new StringWriter(); IOUtils.write("[", stringWriter); IOUtils.write(Joiner.on(",").join(Lists.transform(documents, new com.google.common.base.Function<Document, String>() { @Override public String apply(Document document) { return document.toJson(jsonWriterSettings); } })),stringWriter); IOUtils.write("]", stringWriter); return stringWriter.toString(); } }
[ "vincent.russell@gmail.com" ]
vincent.russell@gmail.com
6d8dd728a419c36c29b9c10c74c9692646cdc1d8
9cd4cd4bec3341281b6b132a293b76da6ac7f16c
/src/View/VImportando.java
8c688584ef05a3fd91972ceb68e0043010de94ed
[]
no_license
Julianocarvalho/SleepTreeDesktop
97e5b8fadddf4d7b6081ae33575a6abe8eb9fe43
9cbade53a4abc04568109589139eb9bffacc2e40
refs/heads/master
2021-01-25T11:14:09.334339
2017-05-25T20:48:04
2017-05-25T20:48:04
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,986
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 View; import javax.swing.JProgressBar; /** * * @author joao */ public class VImportando extends javax.swing.JFrame { /** * Creates new form Importando */ public VImportando() { initComponents(); } public void atualizandoBar(int i){ // jProgressBar.setValue(i); System.out.println("vamosss la"); } public void tamanhoBar(int x){ // jProgressBar.setMinimum(0); // jProgressBar.setMaximum(x); } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel1 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); setTitle("Importando"); setResizable(false); jLabel1.setText("Importando dados .... Isso pode levar alguns minutos"); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel1) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(19, Short.MAX_VALUE)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) ); pack(); setLocationRelativeTo(null); }// </editor-fold>//GEN-END:initComponents /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(VImportando.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(VImportando.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(VImportando.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(VImportando.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new VImportando().setVisible(true); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel jLabel1; private javax.swing.JPanel jPanel1; // End of variables declaration//GEN-END:variables }
[ "sleeptreeweb@gmail.com" ]
sleeptreeweb@gmail.com
f116b38962fa8e7b29db601ba11b944d73dabb58
92dd6bc0a9435c359593a1f9b309bb58d3e3f103
/src/May2021GoogLeetcode/_0094BinaryTreeInorderTraversal.java
7458a5b27ae409702100946bce92929cc7c01ccc
[ "MIT" ]
permissive
darshanhs90/Java-Coding
bfb2eb84153a8a8a9429efc2833c47f6680f03f4
da76ccd7851f102712f7d8dfa4659901c5de7a76
refs/heads/master
2023-05-27T03:17:45.055811
2021-06-16T06:18:08
2021-06-16T06:18:08
36,981,580
3
3
null
null
null
null
UTF-8
Java
false
false
935
java
package May2021GoogLeetcode; import java.util.ArrayList; import java.util.List; public class _0094BinaryTreeInorderTraversal { static public class TreeNode { int val; TreeNode left; TreeNode right; TreeNode() { } TreeNode(int val) { this.val = val; } TreeNode(int val, TreeNode left, TreeNode right) { this.val = val; this.left = left; this.right = right; } } public static void main(String[] args) { TreeNode tn = new TreeNode(1); tn.right = new TreeNode(2); tn.right.left = new TreeNode(3); System.out.println(inorderTraversal(tn)); } public static List<Integer> inorderTraversal(TreeNode root) { List<Integer> output = new ArrayList<Integer>(); inorder(root, output); return output; } public static void inorder(TreeNode root, List<Integer> output) { if (root == null) return; inorder(root.left, output); output.add(root.val); inorder(root.right, output); } }
[ "hsdars@gmail.com" ]
hsdars@gmail.com
fb7d885faa22f2a15a56c5f598e294f461258439
edbcf51d2d3db83de7f227f8b9c6314542c69825
/src/main/java/sl/entities/IdentityBlend.java
8d0c1398b8be5a942260a469117ff0176cbf1bbc
[]
no_license
LK30/SL_YunETL
aaae4380eda5b3cd9896275e27a1fa061e4a9a64
2237ec8b4d28e7f0be852008325ef0d9eddb5b16
refs/heads/master
2020-04-02T16:01:31.288423
2018-11-21T06:42:10
2018-11-21T06:42:10
154,593,929
0
0
null
null
null
null
UTF-8
Java
false
false
842
java
package sl.entities; import org.springframework.data.annotation.Id; import org.springframework.data.mongodb.core.mapping.Document; import org.springframework.data.mongodb.core.mapping.Field; import java.lang.annotation.Documented; @Document(collection = "z_identity_blend") public class IdentityBlend { @Id private String _id; @Field("id") String id; @Field("name") String name; @Field("remark") String remark; public String getId() { return id; } public void setId(String id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } }
[ "1551758437@qq.com" ]
1551758437@qq.com
d6fa92429e06afbf9148aabb70b1d8423d0df8f9
424e86dde3f1a5e6774f4993e93f8924e7ee1866
/chapter_007/src/test/java/ru/job4j/testtask/model/storage/dao/implementations/MusicStyleDataBaseTest.java
acec3e2017c80ba3e9c6423468d8dc8b858aa3ed
[ "Apache-2.0" ]
permissive
TimKap/tkapkaev
f35d523fee240c8b406d6ba58600a5f7557a8435
6b25c4c41c10da3e46ebae9dd4e144a103e50c34
refs/heads/master
2021-01-17T23:39:36.657622
2018-03-18T07:10:04
2018-03-18T07:10:04
84,232,710
0
0
null
null
null
null
UTF-8
Java
false
false
3,627
java
package ru.job4j.testtask.model.storage.dao.implementations; import org.apache.commons.dbcp.BasicDataSource; import org.junit.Test; import static org.junit.Assert.assertThat; import static org.hamcrest.core.Is.is; import ru.job4j.testtask.model.entities.MusicStyle; import java.io.IOException; import java.util.ArrayList; import java.util.List; /** * Class MusicStyleDateBaseTest содержит тесты для MusicStyleDataBase. * @author Timur Kapkaev (timur.kap@yandex.ru) * @version $ID$ * @since 22.12.2017 * */ public class MusicStyleDataBaseTest { /** database connection pool. */ private final BasicDataSource connectionPool; { BasicDataSource pool = null; try { pool = new TestDataBasePoolConnection().connectionPool(); } catch (IOException e) { e.printStackTrace(); } connectionPool = pool; } /** * Test for add and get methods. * @throws Exception - * */ @Test public void whenAddMusicStyleThenGetSameMusicType() throws Exception { /* prepare database */ MusicStyleDataBase musicStyles = new MusicStyleDataBase(connectionPool); musicStyles.removeAll(); MusicStyle musicStyle = new MusicStyle("ROCK"); /* execute test*/ musicStyles.add(musicStyle); /*check test*/ MusicStyle result = musicStyles.get(String.valueOf(musicStyle.getId())); assertThat(result, is(musicStyle)); assertThat(result.getStyle(), is(musicStyle.getStyle())); } /** * Test for update methods. * @throws Exception - * */ @Test public void whenUpdateMusicStyleThenGetUpdatedStyle() throws Exception { /* prepare database */ MusicStyleDataBase musicStyles = new MusicStyleDataBase(connectionPool); musicStyles.removeAll(); MusicStyle musicStyle = new MusicStyle("ROCK"); musicStyles.add(musicStyle); /*execute test*/ musicStyle.setStyle("CLASSIC"); musicStyles.update(musicStyle); /*check test*/ MusicStyle result = musicStyles.get(String.valueOf(musicStyle.getId())); assertThat(result, is(musicStyle)); assertThat(result.getStyle(), is(musicStyle.getStyle())); } /** * Test for remove method. * @throws Exception - * */ @Test public void whenRemoveMusicStyleThenGetEmptyDatabase() throws Exception { /* prepare database*/ MusicStyleDataBase musicTypes = new MusicStyleDataBase(connectionPool); musicTypes.removeAll(); MusicStyle musicStyle = new MusicStyle("ROCK"); musicTypes.add(musicStyle); /* execute test */ musicTypes.remove(musicStyle); /* check result */ MusicStyle result = musicTypes.get(String.valueOf(musicStyle.getId())); assertThat(result == null, is(true)); } /** * Test for getAllElements. * @throws Exception - * */ @Test public void whenGetAllElementsThenGetListOfMusicStyles() throws Exception { /* prepare database*/ MusicStyleDataBase musicStyles = new MusicStyleDataBase(connectionPool); musicStyles.removeAll(); List<MusicStyle> expected = new ArrayList<>(); expected.add(new MusicStyle("ROCK")); expected.add(new MusicStyle("CLASSIC")); musicStyles.add(expected.get(0)); musicStyles.add(expected.get(1)); /* execute test*/ List<MusicStyle> result = musicStyles.getAllElements(); assertThat(result.containsAll(expected), is(true)); } }
[ "timur.kap@yandex.ru" ]
timur.kap@yandex.ru
2045c684791481b79b03151d5c7d2ad110ab9d4d
38ae33ee28f3836f6d77b46917825c9f9a07729e
/test_examples/src/com/test/example/LongestCommonSubstring.java
70f713fd36a1d242a17d5596c6965f10f3aa5fe9
[]
no_license
chinmaysept/java_general
c4f771cd30cffdcd24870f93ea699ac4703e838c
cb391b0dd1a3908814f6f3d1c26251576afa9c74
refs/heads/master
2022-12-22T20:25:16.680389
2019-11-14T08:44:53
2019-11-14T08:44:53
221,638,495
0
0
null
2022-12-16T03:32:16
2019-11-14T07:36:18
Java
UTF-8
Java
false
false
1,942
java
package com.test.example; import java.util.HashSet; import java.util.Set; public class LongestCommonSubstring { public static int find(char[] A, char[] B) { int[][] LCS = new int[A.length + 1][B.length + 1]; // if A is null then LCS of A, B =0 for (int i = 0; i <= B.length; i++) { LCS[0][i] = 0; } // if B is null then LCS of A, B =0 for (int i = 0; i <= A.length; i++) { LCS[i][0] = 0; } // fill the rest of the matrix for (int i = 1; i <= A.length; i++) { for (int j = 1; j <= B.length; j++) { if (A[i - 1] == B[j - 1]) { LCS[i][j] = LCS[i - 1][j - 1] + 1; } else { LCS[i][j] = 0; } } } int result = -1; for (int i = 0; i <= A.length; i++) { for (int j = 0; j <= B.length; j++) { if (result < LCS[i][j]) { result = LCS[i][j]; } } } return result; } public static Set<String> longestCommonSubstrings(String s, String t) { int[][] table = new int[s.length()][t.length()]; int longest = 0; Set<String> result = new HashSet<>(); for (int i = 0; i < s.length(); i++) { for (int j = 0; j < t.length(); j++) { if (s.charAt(i) != t.charAt(j)) { continue; } table[i][j] = (i == 0 || j == 0) ? 1 : 1 + table[i - 1][j - 1]; if (table[i][j] > longest) { longest = table[i][j]; result.clear(); } if (table[i][j] == longest) { result.add(s.substring(i - longest + 1, i + 1)); } } } return result; } public static void main(String[] args) { String A = "Hello"; String B = "Mello"; /*System.out.println("LCS length : " + find(A.toCharArray(), B.toCharArray()));*/ System.out.println(longestCommonSubstrings(A,B)); } }
[ "chinmaya.sept@rediffmail.com" ]
chinmaya.sept@rediffmail.com
081ebc1cd74d2938789b1fd56d43f348cfd28439
016f38da79bd88d2fb37ea4068bced417ea176d4
/src/web/dao/IHfwRealtyConsultantDao.java
0922c8e49d74001df6810b783cd3328e4cf8aeaf
[]
no_license
whli745/hfangw
546fe914e7c3e63f3328b1a8667a453257c292da
76f99593c0461e68bb996361efd4e3f3e91dc1aa
refs/heads/master
2021-06-27T02:14:04.866069
2017-09-16T08:09:12
2017-09-16T08:09:12
103,731,547
0
0
null
null
null
null
UTF-8
Java
false
false
470
java
package web.dao; import util.ResultPage; import web.pojo.HfwRealtyConsultant; public interface IHfwRealtyConsultantDao { ResultPage queryHfwRealtyConsultantList(HfwRealtyConsultant q,int page,int pageRows) throws Exception; void delHfwRealtyConsultant(String oid) throws Exception; HfwRealtyConsultant gethfwRealtyConsultantByOid(String oid) throws Exception; void saveOrUpdateHfwRealtyConsultant(HfwRealtyConsultant hfwRealtyConsultant) throws Exception; }
[ "whli745@users.noreply.github.com" ]
whli745@users.noreply.github.com
66df7fc964016637a37e6202da959e5181386f94
689daf506ed2d648c97cbea03e0b9aee14e555da
/src/test/java/com/pmangplus/examples/repository/PersonRepositoryTest.java
54a70257c68eed1f149227dd8a88059c4b9d6879
[]
no_license
daclouds/Spring-Examples
46e9baacfa59fd1b9f1af82a381cd0359fe3adce
b80efa5c1b2407daf2fe2db0172014aadf4e8841
refs/heads/master
2016-09-05T10:13:54.456333
2013-01-23T22:10:21
2013-01-23T22:10:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,265
java
package com.pmangplus.examples.repository; import static org.junit.Assert.assertNotNull; import java.util.List; import javax.inject.Inject; import org.junit.Ignore; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import com.pmangplus.examples.domain.Person; import com.pmangplus.examples.service.PersonService; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations="classpath:/spring/root-context.xml") public class PersonRepositoryTest { @Inject PersonRepository repository; @Inject PersonService service; @Ignore @Test public void testInjection() { assertNotNull(repository); } @Test public void testSave() throws Exception { Person nolleh = new Person(); nolleh.setName("김경미"); nolleh.setEmail("nolleh@neowiz.com"); repository.save(nolleh); Person omnimook = new Person(); omnimook.setName("최윤묵"); omnimook.setEmail("omnimook@neowiz.com"); repository.save(omnimook); } @Test public void testFind() throws Exception { List<Person> persons = service.findAll("김"); for (Person person : persons) { System.out.println(person); } } }
[ "daclouds@gmail.com" ]
daclouds@gmail.com
70606330d55bc042e72c043240cb1673310ae68d
bf3ffe0076c1caa567ea5ccb7b56b3d894e94c21
/hr/src/main/java/org/hr/controller/UnitController.java
61061fd7b2a56c49c95c0bbff373261ee6f76a0e
[]
no_license
SCU602/hr_backEnd
993acfe5e063f0a1fa5ec1fd90f5279877bb5cf7
84edd870fb00ac485c5c764ac99207af9281f183
refs/heads/main
2023-06-11T03:13:44.920241
2021-06-27T00:35:14
2021-06-27T00:35:14
377,672,554
1
1
null
null
null
null
UTF-8
Java
false
false
3,827
java
package org.hr.controller; import org.hr.model.OrgUnit; import org.hr.model.User; import org.hr.model.UserInfo; import org.hr.modelOv.UnitOV; import org.hr.service.OrgUnitService; import org.hr.service.UserInfoService; import org.hr.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.util.HashMap; import java.util.List; import java.util.Map; @RestController public class UnitController { @Autowired OrgUnitService orgUnitService; @Autowired UserService userService; //新建机构 @PostMapping("/admin/create_unit") public Object addOrgUnit(@RequestBody OrgUnit orgUnit){ Map<String,Object> map=new HashMap<>(); //先查询机构是否已存在 OrgUnit unit=orgUnitService.getUnitByName(orgUnit.getName()); if(unit!=null){ //机构已存在 map.put("state",202); map.put("msg","机构已存在"); }else{ //机构未存在,新建该机构 //先判断主管用户名是否存在 User user=userService.findUserByUsername(orgUnit.getManager()); if(user!=null) { int result = orgUnitService.addOrgUnit(orgUnit); if (result == 1) { map.put("state", 200); map.put("msg", "新建机构成功"); } else { map.put("state", 500); map.put("msg", "新建机构失败"); } }else{ map.put("state", 202); map.put("msg", "主管用户名不存在"); } } return map; } //修改机构 @PutMapping("/admin/modify_unit") public Object modifyOrgUnit(@RequestBody OrgUnit orgUnit){ Map<String,Object> map=new HashMap<>(); //先判断主管用户名是否存在 User user=userService.findUserByUsername(orgUnit.getManager()); if(user!=null) { Integer result = orgUnitService.modifyOrgUnit(orgUnit); if (result == 1) { map.put("state", 200); map.put("msg", "修改机构成功"); } else { map.put("state", 500); map.put("msg", "修改机构失败"); } }else{ map.put("state", 202); map.put("msg", "主管用户名不存在"); } return map; } //删除机构 @DeleteMapping("/admin/deleteunit") public Object deleteUnit(String id){ Map<String,Object> map=new HashMap<>(); int result=orgUnitService.deleteOrgUnit(id); if(result==1){ map.put("state",200); map.put("msg","删除机构成功"); }else{ map.put("state",202); map.put("msg","删除机构失败"); } return map; } //通过机构名称查询机构信息 @GetMapping("/user/getunitbyname") public Object getUnitByName(String name,Integer current_index,Integer page_size){ Map<String,Object> map = new HashMap<>(); UnitOV unitOV=new UnitOV(); unitOV.setName(name); unitOV.setCurrent_index(current_index); unitOV.setPage_size(page_size); List<OrgUnit> units=orgUnitService.getUnitsByName(unitOV); map.put("state",200); map.put("msg","查询机构成功"); map.put("data",units); Integer result_num=orgUnitService.getUnitsNumByName(unitOV); map.put("current_index",current_index); map.put("page_size",page_size); map.put("allnum",result_num); return map; } }
[ "mr.somebody@mrsomebodydeMacBook-Air.local" ]
mr.somebody@mrsomebodydeMacBook-Air.local
dfe37dc614ff1b7f84527c513651ec7cb7ad6b3c
ad4c6a825fef2c1a53129762f54efe208042677c
/Learning/Thinking_in_Java_4th_Edition/Chapter_20/test/TestRemover.java
1a418eddba5b3f3beb5ebede73a01058962a9aff
[ "MIT" ]
permissive
banbao990/Java
8a1c7d10ed71764aec813aab87fffd6480d71378
e2bb57951f1f00c95b91d1ad8910e83434e42e01
refs/heads/master
2021-07-18T09:23:20.359176
2021-01-19T02:32:12
2021-01-19T02:32:12
234,886,586
1
0
null
null
null
null
UTF-8
Java
false
false
419
java
/** * @author banbao * @comment 修改自示例代码 */ package test; import net.mindview.atunit.*; import java.io.*; public class TestRemover { @TestProperty static PrintWriter output; @TestProperty static int counter; @TestProperty static void test1() { output = new PrintWriter(System.out); output.println("just test!"); } @Test boolean test2() { return true; } }
[ "2369896555@qq.com" ]
2369896555@qq.com
bdd7d4900aa85834c7817a8f46531f3dda32bb42
44d4b3783ff964ecc387a4ea637a98fb4e5dc293
/mypages-gateway/src/main/java/cn/m1yellow/mypages/gateway/config/ResourceServerConfig.java
60d70fa56ade7da78dad17075a6bcf49af4ad5ff
[ "Apache-2.0" ]
permissive
zjdyzww/mypages-cloud
15436d11b1ef1b1846722403a5edb6d598f89acf
5c2994abf6d47321ec55207d0e86e5444f117a05
refs/heads/master
2023-07-31T19:02:28.740219
2021-09-08T14:02:37
2021-09-08T14:02:37
524,547,458
1
0
Apache-2.0
2022-08-14T01:39:04
2022-08-14T01:39:03
null
UTF-8
Java
false
false
5,408
java
package cn.m1yellow.mypages.gateway.config; import cn.hutool.core.util.ArrayUtil; import cn.m1yellow.mypages.common.constant.AuthConstant; import cn.m1yellow.mypages.gateway.authorization.AuthorizationManager; import cn.m1yellow.mypages.gateway.component.RestAuthenticationEntryPoint; import cn.m1yellow.mypages.gateway.component.RestfulAccessDeniedHandler; import cn.m1yellow.mypages.gateway.filter.CacheBodyFilter; import cn.m1yellow.mypages.gateway.filter.IgnoreUrlsRemoveJwtFilter; import lombok.AllArgsConstructor; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.convert.converter.Converter; import org.springframework.security.authentication.AbstractAuthenticationToken; import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity; import org.springframework.security.config.web.server.SecurityWebFiltersOrder; import org.springframework.security.config.web.server.ServerHttpSecurity; import org.springframework.security.oauth2.jwt.Jwt; import org.springframework.security.oauth2.server.resource.authentication.JwtAuthenticationConverter; import org.springframework.security.oauth2.server.resource.authentication.JwtGrantedAuthoritiesConverter; import org.springframework.security.oauth2.server.resource.authentication.ReactiveJwtAuthenticationConverterAdapter; import org.springframework.security.web.server.SecurityWebFilterChain; import reactor.core.publisher.Mono; /** * 资源服务器配置 */ @AllArgsConstructor @Configuration @EnableWebFluxSecurity // 注解需要使用@EnableWebFluxSecurity而非@EnableWebSecurity,因为SpringCloud Gateway基于WebFlux public class ResourceServerConfig { private final AuthorizationManager authorizationManager; private final IgnoreUrlsConfig ignoreUrlsConfig; private final RestfulAccessDeniedHandler restfulAccessDeniedHandler; private final RestAuthenticationEntryPoint restAuthenticationEntryPoint; private final IgnoreUrlsRemoveJwtFilter ignoreUrlsRemoveJwtFilter; private final CacheBodyFilter cacheBodyFilter; @Bean public SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) { http.oauth2ResourceServer().jwt() // 设置自定义 jwt 转换器 .jwtAuthenticationConverter(jwtAuthenticationConverter()); // 自定义 jwt 认证管理器 //.authenticationManager(newJwtAuthenticationManager()); // 自定义处理JWT请求头过期或签名错误的结果 http.oauth2ResourceServer().authenticationEntryPoint(restAuthenticationEntryPoint); // 对白名单路径,直接移除JWT请求头 http.addFilterBefore(ignoreUrlsRemoveJwtFilter, SecurityWebFiltersOrder.AUTHENTICATION); // 重写 getBody 方法 http.addFilterBefore(cacheBodyFilter, SecurityWebFiltersOrder.AUTHENTICATION); http.authorizeExchange() .pathMatchers(ArrayUtil.toArray(ignoreUrlsConfig.getUrls(), String.class)).permitAll() // 白名单配置 .anyExchange().access(authorizationManager) // 鉴权管理器配置 .and().exceptionHandling() .accessDeniedHandler(restfulAccessDeniedHandler) // 处理未授权 .authenticationEntryPoint(restAuthenticationEntryPoint) // 处理未认证 .and().csrf().disable(); return http.build(); } @Bean public Converter<Jwt, ? extends Mono<? extends AbstractAuthenticationToken>> jwtAuthenticationConverter() { JwtGrantedAuthoritiesConverter jwtGrantedAuthoritiesConverter = new JwtGrantedAuthoritiesConverter(); jwtGrantedAuthoritiesConverter.setAuthorityPrefix(AuthConstant.AUTHORITY_PREFIX); jwtGrantedAuthoritiesConverter.setAuthoritiesClaimName(AuthConstant.AUTHORITY_CLAIM_NAME); JwtAuthenticationConverter jwtAuthenticationConverter = new JwtAuthenticationConverter(); jwtAuthenticationConverter.setJwtGrantedAuthoritiesConverter(jwtGrantedAuthoritiesConverter); return new ReactiveJwtAuthenticationConverterAdapter(jwtAuthenticationConverter); } /* @Bean public ReactiveAuthenticationManager newJwtAuthenticationManager() { NimbusReactiveJwtDecoder nimbusReactiveJwtDecoder = new NimbusReactiveJwtDecoder(properties.getJwt().getJwkSetUri()); JwtReactiveAuthenticationManager jwtReactiveAuthenticationManager = new JwtReactiveAuthenticationManager(nimbusReactiveJwtDecoder); JwtGrantedAuthoritiesConverter jwtGrantedAuthoritiesConverter = new JwtGrantedAuthoritiesConverter(); jwtGrantedAuthoritiesConverter.setAuthorityPrefix(AuthConstant.AUTHORITY_PREFIX); jwtGrantedAuthoritiesConverter.setAuthoritiesClaimName(AuthConstant.AUTHORITY_CLAIM_NAME); JwtAuthenticationConverter jwtAuthenticationConverter = new JwtAuthenticationConverter(); jwtAuthenticationConverter.setJwtGrantedAuthoritiesConverter(jwtGrantedAuthoritiesConverter); ReactiveJwtAuthenticationConverterAdapter reactiveJwtAuthenticationConverterAdapter = new ReactiveJwtAuthenticationConverterAdapter(jwtAuthenticationConverter); jwtReactiveAuthenticationManager.setJwtAuthenticationConverter(reactiveJwtAuthenticationConverterAdapter); return jwtReactiveAuthenticationManager; } */ }
[ "m1yellow@163.com" ]
m1yellow@163.com
03c988950be11fefa9a775b1ca1d1f82041ec35e
09feac7578002c1cb732b808946d911a17c2d61f
/gosu-xml/src/main/java/gw/internal/schema/gw/xsd/w3c/xmlschema/types/complex/NumFacet.java
a43a5614faf1836be8dd7f7dea79d579cafa410a
[]
no_license
gosu-lang/gosu-pl
56cbb1592f6fc149e5de9905c0747eb4f227a471
5db623100b6c8ea6877bdc9f13a4a5e111a58812
refs/heads/master
2021-01-13T09:45:21.796743
2016-12-13T23:11:22
2016-12-13T23:11:22
69,290,008
2
3
null
null
null
null
UTF-8
Java
false
false
3,866
java
package gw.internal.schema.gw.xsd.w3c.xmlschema.types.complex; /***************************************************************************/ /* THIS IS AUTOGENERATED CODE - DO NOT MODIFY OR YOUR CHANGES WILL BE LOST */ /* THIS CODE CAN BE REGENERATED USING 'xsd-codegen' */ /***************************************************************************/ public class NumFacet extends gw.internal.schema.gw.xsd.w3c.xmlschema.types.complex.Facet implements gw.internal.xml.IXmlGeneratedClass { public static final javax.xml.namespace.QName $ATTRIBUTE_QNAME_Fixed = new javax.xml.namespace.QName( "", "fixed", "" ); public static final javax.xml.namespace.QName $ATTRIBUTE_QNAME_Id = new javax.xml.namespace.QName( "", "id", "" ); public static final javax.xml.namespace.QName $ATTRIBUTE_QNAME_Value = new javax.xml.namespace.QName( "", "value", "" ); public static final javax.xml.namespace.QName $ELEMENT_QNAME_Annotation = new javax.xml.namespace.QName( "http://www.w3.org/2001/XMLSchema", "annotation", "xs" ); public static final javax.xml.namespace.QName $QNAME = new javax.xml.namespace.QName( "http://www.w3.org/2001/XMLSchema", "numFacet", "xs" ); public static final gw.util.concurrent.LockingLazyVar<gw.lang.reflect.IType> TYPE = new gw.util.concurrent.LockingLazyVar<gw.lang.reflect.IType>( gw.lang.reflect.TypeSystem.getGlobalLock() ) { @Override protected gw.lang.reflect.IType init() { return gw.lang.reflect.TypeSystem.getByFullName( "gw.xsd.w3c.xmlschema.types.complex.NumFacet" ); } }; private static final gw.util.concurrent.LockingLazyVar<java.lang.Object> SCHEMAINFO = new gw.util.concurrent.LockingLazyVar<java.lang.Object>( gw.lang.reflect.TypeSystem.getGlobalLock() ) { @Override protected java.lang.Object init() { gw.lang.reflect.IType type = TYPE.get(); return getSchemaInfoByType( type ); } }; public NumFacet() { super( TYPE.get(), SCHEMAINFO.get() ); } protected NumFacet( gw.lang.reflect.IType type, java.lang.Object schemaInfo ) { super( type, schemaInfo ); } public gw.internal.schema.gw.xsd.w3c.xmlschema.Annotation Annotation() { return (gw.internal.schema.gw.xsd.w3c.xmlschema.Annotation) TYPE.get().getTypeInfo().getProperty( "Annotation" ).getAccessor().getValue( this ); } public void setAnnotation$( gw.internal.schema.gw.xsd.w3c.xmlschema.Annotation param ) { TYPE.get().getTypeInfo().getProperty( "Annotation" ).getAccessor().setValue( this, param ); } public java.lang.Boolean Fixed() { return (java.lang.Boolean) TYPE.get().getTypeInfo().getProperty( "Fixed" ).getAccessor().getValue( this ); } public void setFixed$( java.lang.Boolean param ) { TYPE.get().getTypeInfo().getProperty( "Fixed" ).getAccessor().setValue( this, param ); } public java.lang.String Id() { return (java.lang.String) TYPE.get().getTypeInfo().getProperty( "Id" ).getAccessor().getValue( this ); } public void setId$( java.lang.String param ) { TYPE.get().getTypeInfo().getProperty( "Id" ).getAccessor().setValue( this, param ); } @Deprecated public java.lang.String Value() { return super.Value(); } @Deprecated public void setValue$( java.lang.String param ) { super.setValue$( param ); } public java.math.BigInteger Value$$gw_xsd_w3c_xmlschema_types_complex_NumFacet() { return (java.math.BigInteger) TYPE.get().getTypeInfo().getProperty( "Value" ).getAccessor().getValue( this ); } public void setValue$$gw_xsd_w3c_xmlschema_types_complex_NumFacet$( java.math.BigInteger param ) { TYPE.get().getTypeInfo().getProperty( "Value" ).getAccessor().setValue( this, param ); } @SuppressWarnings( {"UnusedDeclaration"} ) private static final long FINGERPRINT = 2110283714877373226L; }
[ "rsmckinney@hotmail.com" ]
rsmckinney@hotmail.com
2a17c128d559510d47e6711ee404beb0aa2ac973
e269c865ee1d9cecd543e08a08f665667076507e
/src/main/java/com/hrtxn/flchappinessmall/service/MenuService.java
b39db7100d8cd336860f6f52f15de53da0137803
[]
no_license
GSIL-Monitor/flc
39434612d1f8d52da99c38724113c533df95cc3b
d508c206a9247a4d3ff1e79e7798947d88e37316
refs/heads/master
2020-04-22T09:10:23.678778
2019-02-11T18:02:58
2019-02-11T18:02:58
null
0
0
null
null
null
null
UTF-8
Java
false
false
353
java
package com.hrtxn.flchappinessmall.service; import com.hrtxn.flchappinessmall.pojo.pojoVo.MenuVo; import java.util.List; /** * Author:封润 * Date:2018-11-04 下午 4:35 * Description:<描述> */ public interface MenuService { /** * 获取全部菜单url 根据等级封装完成 * @return */ List<MenuVo> getMenuAll(); }
[ "=" ]
=
0eda7f3699f9dfabbf2151e1b2ec846b0e006bba
30f9ddfd7a71c281053276a69ac38d17df2d1e3e
/SailorsMonkeysCoconuts/src/test/java/com/pizzaisdavid/SailorsMonkeysCoconuts/SailorTest.java
13c0251b1231cabe0fe16a210e6dad9f13139328
[]
no_license
pizzaisdavid/daily-java
deadbcc06c70ef075e0a24fb33250fb6c5696de7
f5f41ae40efc48680f8d899264d63a02d7f1b08f
refs/heads/master
2020-04-06T07:02:45.825224
2016-08-14T17:55:26
2016-08-14T17:55:26
58,137,125
0
0
null
null
null
null
UTF-8
Java
false
false
505
java
package com.pizzaisdavid.SailorsMonkeysCoconuts; import static org.junit.Assert.*; import org.junit.Test; public class SailorTest { @Test public void takeFairShare() { CoconutPile coconutPile = new CoconutPile(4); // TODO mock or stub this? Sailor sailor = new Sailor(2); sailor.takeFairShare(coconutPile); assertEquals(2.0, coconutPile.getAmount(), .001); } @Test public void getCount() { Sailor sailor = new Sailor(2); assertEquals(2, sailor.getCount()); } }
[ "davidispizza@gmail.com" ]
davidispizza@gmail.com
870d474283c937d33c94b95b67727a9c0be8457d
0bb8373bb2f9b2aa7743314c29b1acecb9480385
/distributed-order-core/core/src/main/java/cloud/tianai/order/core/pay/util/OrderDataConverter.java
9d7c236ebab00d70c864aebf16d82f68b1ca73e3
[]
no_license
tianaiyouqing/distributed-order
7bca579dab0f9933f13a0b7b3b58038cb54ca29c
e12a6e79dbe531419a403477110811c4f6bd5b43
refs/heads/master
2023-04-08T16:07:34.684766
2019-12-21T14:49:55
2019-12-21T14:49:55
359,286,708
1
1
null
null
null
null
UTF-8
Java
false
false
2,115
java
package cloud.tianai.order.core.pay.util; import cloud.tianai.order.core.basic.form.OrderSaveForm; import cloud.tianai.order.core.api.pay.dto.OrderCreateParam; import cloud.tianai.order.core.api.pay.dto.OrderCreateResult; import cloud.tianai.order.core.sdk.dto.*; import cloud.tianai.order.core.api.pay.dto.SimpleOrderProductDTO; import cloud.tianai.order.core.common.dataobject.OrderDetailDO; import cloud.tianai.order.core.common.info.OrderAddressInfo; import cloud.tianai.order.core.common.wrapper.OrderWrapper; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; public class OrderDataConverter { public static OrderCreateResult orderWrapper2OrderCreateResult(OrderWrapper orderWrapper) { OrderCreateResult orderCreateResult = new OrderCreateResult(); orderCreateResult.setOid(orderWrapper.getOrderMaster().getOid()); orderCreateResult.setUid(orderWrapper.getOrderMaster().getUid()); orderCreateResult.setBid(orderWrapper.getOrderMaster().getBid()); orderCreateResult.setCreateTime(orderWrapper.getOrderMaster().getCreateTime()); orderCreateResult.setOrderAmount(orderWrapper.getOrderMaster().getOrderAmount()); orderCreateResult.setCouponPrice(orderWrapper.getOrderMaster().getDiscountFee()); Collection<OrderDetailDO> orderDetail = orderWrapper.getOrderDetail(); Collection<SimpleOrderProductDTO> productDTOS = new ArrayList<>(orderDetail.size()); for (OrderDetailDO orderDetailDO : orderDetail) { SimpleOrderProductDTO simpleOrderProductDTO = new SimpleOrderProductDTO(); simpleOrderProductDTO.setNum(orderDetailDO.getProductQuantity()); simpleOrderProductDTO.setSkuId(orderDetailDO.getSkuId()); simpleOrderProductDTO.setSku(orderDetailDO.getSku()); simpleOrderProductDTO.setSpuId(orderDetailDO.getSpuId()); productDTOS.add(simpleOrderProductDTO); } orderCreateResult.setProductDTOS(productDTOS); return orderCreateResult; } }
[ "1282012654@qq.com" ]
1282012654@qq.com
f77462d70185bcbcb3c3bd5b736581847dbf8505
4ca747379b4158f0cf9cbb2d582c29800e99b11d
/extensions/allure-rest-assured/src/main/java/com/github/lexpalych/extensions/allure/rest/assured/ApiExtractingSteps.java
9a143998df34f2038ae7cecd1f8f11296a0c07a5
[]
no_license
LexShcherbinin/Framework
5bad174aca125565462464170e8e776c8302b5d4
dfbfc7612f2c2b19b40004bd36f5b72e58771a12
refs/heads/master
2022-04-06T03:52:54.744595
2020-01-13T08:03:32
2020-01-13T08:03:32
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,158
java
package com.github.lexpalych.extensions.allure.rest.assured; import static java.util.stream.Collectors.toMap; import com.github.lexpalych.extensions.junit5.allure.steps.StepWrapperSteps; import io.qameta.allure.Step; import io.restassured.response.Response; import java.util.Map; public final class ApiExtractingSteps extends StepWrapperSteps<ApiExtractingSteps> { private final Response response; ApiExtractingSteps(Response response) { this.response = response; } @Step("Сохранение {jsonPath} как {key}") public <T> ApiExtractingSteps saveBodyJsonPath(String jsonPath, String key, Map<String, T> map) { T value = response.getBody().jsonPath().get(jsonPath); map.put(key, value); return this; } @Step("Сохранение полей с соответствующими ключами {pathsAndKeys}") public <T> ApiExtractingSteps saveBodyJsonPath(Map<String, String> pathsAndKeys, Map<String, T> map) { Map<String, T> values = pathsAndKeys.entrySet().stream() .collect( toMap( Map.Entry::getValue, entry -> { String expression = entry.getKey(); return response.getBody().jsonPath().get(expression); })); map.putAll(values); return this; } @Step("Сохранение заголовка {header} как {key}") public <T> ApiExtractingSteps saveHeader(String header, String key, Map<String, String> map) { String value = response.getHeader(header); map.put(key, value); return this; } @Step("Сохранение заголовков как соответствующие им ключи {pathsAndKeys}") public <T> ApiExtractingSteps saveHeader(Map<String, String> headersAndKeys, Map<String, String> map) { Map<String, String> values = headersAndKeys .entrySet() .stream() .collect(toMap(Map.Entry::getValue, entry -> response.getHeader(entry.getKey()))); map.putAll(values); return this; } public ApiRequestSteps next() { return ApiRequestSteps.apiRequest(); } }
[ "lexshcherbinin@gmail.com" ]
lexshcherbinin@gmail.com
9e52cded10cdf5c112677a3e34899dfeca3bc26a
fa36c734ff6864b8274154db9416c95e2fd3de1e
/ISEP/Year1/2Semestre/LAPR2/LAPR2/lapr2-2015-2016-g47-master/src/test/java/lapr/project/controller/AssignApplicationControllerTest.java
2ffa43892af261d8ea75d5f6e136f1ae04791761
[]
no_license
joaoflores99/AcademicProjects-ISEP-
119ab7f625913dbff812ea39c0946eb2296135c0
2588640dae346a8c915050ac658a81eb952d4011
refs/heads/master
2022-12-30T00:58:04.929559
2020-10-19T13:34:24
2020-10-19T13:34:24
305,356,949
0
0
null
null
null
null
UTF-8
Java
false
false
2,562
java
/** * Package location for Application Controllers tests. */ package lapr.project.controller; import java.util.List; import lapr.project.model.Exhibition; import lapr.project.model.ExhibitionCenter; import lapr.project.model.Organizer; import lapr.project.model.StaffAttributionsList; import lapr.project.model.Submittable; import lapr.project.model.exhibition.ExhibitionChangedConflictsState; import lapr.project.utils.DefaultInstantiator; import static org.junit.Assert.assertEquals; import org.junit.Before; import org.junit.Test; /** * Tests a assigned application controller class. * * @author Daniel Gonçalves 1151452 * @author Eric Amaral 1141570 * @author Ivo Ferro 1151159 * @author Renato Oliveira 1140822 * @author Ricardo Correia 1151231 */ public class AssignApplicationControllerTest { AssignApplicationController controller; Organizer organizer; ExhibitionCenter exhibitionCenter; Exhibition eInNotCorrectState; Exhibition eInCorrectState; StaffAttributionsList staffAttributionList; @Before public void setUp() { exhibitionCenter = DefaultInstantiator.createExhibitionCenter(); eInNotCorrectState = exhibitionCenter.getExhibitionsRegister().getExhibitionsList().get(0); eInCorrectState = exhibitionCenter.getExhibitionsRegister().getExhibitionsList().get(0); eInCorrectState.setState(new ExhibitionChangedConflictsState(exhibitionCenter.getExhibitionsRegister().getExhibitionsList().get(0))); organizer = exhibitionCenter.getExhibitionsRegister().getExhibitionsList().get(0).getOrganizersList().getOrganizersList().get(0); controller = new AssignApplicationController(exhibitionCenter, organizer); } /** * Test of getSubmittablesInChangedConflictsByOrganizer method, of class * AssignApplicationController. */ @Test public void getSubmittablesInChangedConflictsByOrganizer() { System.out.println("getSubmittablesInChangedConflictsByOrganizer"); AssignApplicationController instance = controller; int expectedResult = 0; List<Submittable> resultList = instance.getSubmittablesInChangedConflictsByOrganizer(this.organizer); int result = 0; for (Submittable submitable: resultList) { Exhibition exhibition = (Exhibition)submitable; if (!exhibition.hasOrganizer(organizer) || !exhibition.getState().isChangedConflitcts()) { result++; } } assertEquals(expectedResult, result); } }
[ "1171409@isep.ipp.pt" ]
1171409@isep.ipp.pt
ebaf2618d7505c2e4de379c6afedda8603080456
901cf8424dd08da7f293cc42667412a843f2a1a0
/GSB-RV-DR/src/fr/gsb/rv/dr/technique/ConnexionException.java
1d08f285dd180d3a37c5edd06e8dce6456e305ab
[]
no_license
P-DAO/GSB-SP2-AppliRV-DR
ad84db2d7a2194facc50e40729f6a13f0847f910
233ef7436252b11202c7eb8fd49d6892172122ff
refs/heads/master
2023-04-28T19:49:04.445228
2021-05-25T08:24:16
2021-05-25T08:24:16
319,278,710
1
0
null
null
null
null
UTF-8
Java
false
false
188
java
package fr.gsb.rv.dr.technique; public class ConnexionException extends Exception { @Override public String getMessage(){ return "[Nok] Connexion BD" ; } }
[ "perrine.dao.sio@gmail.com" ]
perrine.dao.sio@gmail.com
fb7cbda87ad9ce4e3dca17a46e309021be2aadfc
ed360ce3340db10cec822daa0bb6781e1ad281a1
/app/src/main/java/mx/edu/tesoem/isc/karm/pfkarm/CommandInjection.java
0dfdf417dcbf3eebd4f823b74b3d1503568feb5d
[]
no_license
volpix/PFKARM2
42a9f5a0279d80d4c32be7109754675d2e10a9e8
22b09f4b10c8631efac364b227a6b09a529e2247
refs/heads/master
2020-08-07T04:39:20.379652
2019-10-07T05:03:28
2019-10-07T05:03:28
213,298,984
0
0
null
null
null
null
UTF-8
Java
false
false
556
java
package mx.edu.tesoem.isc.karm.pfkarm; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; public class CommandInjection extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_command_injection); } public void pantalla3(View v){ Intent atras=new Intent(this,MenuP.class); startActivity(atras); finish(); } }
[ "56046361+volpix@users.noreply.github.com" ]
56046361+volpix@users.noreply.github.com
c9c5f37b9b206b70117fc32866d382e0e77f4686
8ec981e516cd7254d53bdb225d53aad2c06ee7a2
/src/main/java/com/t248/lmf/crm/repository/ActivityRepostitor.java
a1cbf2df121369ff4f82deb05c5049dc31f705c7
[]
no_license
2767274907/crm
5d728c4ace6e31d46a62cab5342e4ab04f5505e1
c5446e76c5d86df6d788ad7987e1cf0db53e76c6
refs/heads/master
2023-05-12T20:12:46.996859
2020-02-29T03:05:16
2020-02-29T03:05:16
243,885,521
3
0
null
2023-05-08T04:15:02
2020-02-29T01:36:54
HTML
UTF-8
Java
false
false
501
java
package com.t248.lmf.crm.repository; import com.t248.lmf.crm.entity.Activity; import com.t248.lmf.crm.entity.Customer; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import java.util.List; public interface ActivityRepostitor extends JpaRepository<Activity,Long> , JpaSpecificationExecutor<Activity>{ public Activity findByAtvId(Long atvId); public List<Activity> findByCustomer(Customer customer); }
[ "2767274907@qq.com" ]
2767274907@qq.com
87dfe61103ec312827c9e630c3e1f3621658ffad
9f96abbefebbe6eac627912b1273095743588f7c
/core/src/cs3500/marblesolitaire/view/MarbleSolitaireView.java
0d0756bfb738441aaa285e5af41c4b7028d310ca
[]
no_license
Aquilae00/Testing
2d2e51ec17901f300e5674a3c73b144df3b1672a
04c8dbca5cbcf8d9a6e248d4f3a5380149417d89
refs/heads/master
2021-05-23T00:28:46.589222
2020-04-05T04:28:34
2020-04-05T04:28:34
253,155,330
0
0
null
null
null
null
UTF-8
Java
false
false
2,627
java
package cs3500.marblesolitaire.view; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.Color; import com.badlogic.gdx.graphics.glutils.ShapeRenderer; import java.util.HashMap; import cs3500.marblesolitaire.model.hw02.Coding; import cs3500.marblesolitaire.model.hw02.MarbleSolitaireModel; import javafx.util.Pair; public class MarbleSolitaireView implements IView { ShapeRenderer sr; MarbleSolitaireModel mm; HashMap<Integer, Pair<Integer,Integer>> hmap; public MarbleSolitaireView(MarbleSolitaireModel mm) { this.mm = mm; this.sr = new ShapeRenderer(); hmap = new HashMap<Integer, Pair<Integer,Integer>>(); } @Override public void displayView() { Coding[][] board_temp = mm.getBoard(); // StringBuilder sb = new StringBuilder(mm.getGameState()); // for (int i = 0; i < sb.length(); i++) { // if (sb.charAt(i) == ' ') { // sr.begin(ShapeRenderer.ShapeType.Filled); // sr.setColor(Color.GREEN); // sr.circle(Gdx.graphics.getWidth() / 2, Gdx.graphics.getHeight() / 2, 64); // sr.end(); // } // } for (int x = 0; x < mm.getWidth(); ++x) { for (int y = 0; y < mm.getHeight(); ++y) { switch (board_temp[x][y]) { case Invalid: break; case Marbles: hmap.put(x + y,new Pair(Gdx.graphics.getWidth() * 3 / 4 - (x * 100),Gdx.graphics.getHeight() * 3 / 4 - (y * 100))); sr.begin(ShapeRenderer.ShapeType.Filled); sr.setColor(Color.GREEN); sr.circle(Gdx.graphics.getWidth() * 3 / 4 - (x * 100), Gdx.graphics.getHeight() * 3 / 4 - (y * 100), 40); sr.end(); break; case Empty: hmap.put(x + y,new Pair(Gdx.graphics.getWidth() * 3 / 4 - (x * 100),Gdx.graphics.getHeight() * 3 / 4 - (y * 100))); sr.begin(ShapeRenderer.ShapeType.Filled); sr.setColor(Color.BLACK); sr.circle(Gdx.graphics.getWidth() * 3 / 4 - (x * 100), Gdx.graphics.getHeight() * 3 / 4 - (y * 100), 40); sr.end(); break; default: } } } } @Override public void shapeRendDispose() { sr.dispose(); } @Override public HashMap<Integer, Pair<Integer, Integer>> getMap() { return this.hmap; } }
[ "linaldi03@gmail.com" ]
linaldi03@gmail.com
357c5e5a236cc31cebb2156698c6733fd4141648
ca26cce035073e4a97fc09f3d3e9377a803748c1
/AccumulateWealth/src/com/jucaipen/main/my/QuerryAccountDetail.java
8fd9e2a085b368ecbdcc43828729465fe480f449
[]
no_license
yanglangfei/jcpserver_news2016
945b74868f9d7e0c9df5ab84bdab6598cdfad168
b495bf1b09b3e60378710b66505f9f2e915495eb
refs/heads/master
2020-05-21T17:54:46.873139
2017-03-17T10:00:02
2017-03-17T10:00:02
61,979,144
0
0
null
null
null
null
GB18030
Java
false
false
2,835
java
package com.jucaipen.main.my; import java.io.IOException; import java.io.PrintWriter; 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.jucaipen.model.Account; import com.jucaipen.model.AccountDetail; import com.jucaipen.model.ClientOsInfo; import com.jucaipen.service.AccountDetailSer; import com.jucaipen.service.AccountSer; import com.jucaipen.utils.HeaderUtil; import com.jucaipen.utils.JsonUtil; import com.jucaipen.utils.StringUtil; /** * @author Administrator * * 获取账单详细信息 state 0 聚财币 1 积分 */ public class QuerryAccountDetail extends HttpServlet { private static final long serialVersionUID = -5370364459925577430L; private String result; public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setCharacterEncoding("UTF-8"); request.setCharacterEncoding("UTF-8"); response.setContentType("text/html"); PrintWriter out = response.getWriter(); String userAgent=request.getParameter("User-Agent"); ClientOsInfo os=HeaderUtil.getMobilOS(userAgent); int isDevice=HeaderUtil.isVaildDevice(os, userAgent); if(isDevice==HeaderUtil.PHONE_APP){ String userId = request.getParameter("userId"); String page = request.getParameter("page"); String state = request.getParameter("state"); if (StringUtil.isNotNull(userId)) { if (StringUtil.isInteger(userId)) { int uId = Integer.parseInt(userId); if (uId > 0) { if (StringUtil.isNotNull(page) && StringUtil.isInteger(page)) { int p = Integer.parseInt(page); if (StringUtil.isNotNull(state) && StringUtil.isInteger(state)) { int s = Integer.parseInt(state); result = initAccountData(uId, p, s); } else { result = JsonUtil.getRetMsg(1, "state 参数异常"); } } else { result = JsonUtil.getRetMsg(1, "page 参数异常"); } } else { result = JsonUtil.getRetMsg(1, "该用户还没有登录"); } } else { result = JsonUtil.getRetMsg(1, "userId 数字格式化异常"); } } else { result = JsonUtil.getRetMsg(1, "userId 参数不能为空"); } }else{ result=StringUtil.isVaild; } out.println(result); out.flush(); out.close(); } private String initAccountData(int userId, int page, int state) { // 初始化账户信息 List<AccountDetail> details = AccountDetailSer .findDetailByUserIdAndType(userId, state, page); Account account=AccountSer.findAccountByUserId(userId); return JsonUtil.getAccountDetail(details,account); } }
[ "185601452@qq.com" ]
185601452@qq.com
0824390e7b492ec92290c94e4b1b3adfafcd18a9
40d7fd6391755ff49c22136dfdcb603aa94c2bc5
/parascollectionbackend/src/test/java/career/parascollectionbackend/test/ProductTestCase.java
0d84089a62f19b6a4dcbc0b48432155883da62ed
[]
no_license
gunwantadhon/parascollection
a897a8b502b8723b6c1eba5dbcc27f53b622a606
3e93bcc304e738ced6ef0c67d8a9aa00ebd509f8
refs/heads/master
2021-08-15T04:42:56.666025
2017-11-17T10:56:51
2017-11-17T10:56:51
103,954,416
0
0
null
null
null
null
UTF-8
Java
false
false
1,799
java
package career.parascollectionbackend.test; import static org.junit.Assert.*; import org.junit.BeforeClass; import org.junit.Test; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import career.parascollectionbackend.dao.ProductDAO; import career.parascollectionbackend.dto.Product; public class ProductTestCase { private static AnnotationConfigApplicationContext context; private static ProductDAO productDAO; private Product product; @BeforeClass public static void init() { context=new AnnotationConfigApplicationContext(); context.scan("career.parascollectionbackend"); context.refresh(); productDAO=(ProductDAO) context.getBean("productDAO"); } /*@Test public void testCRUDProduct() { //create operation product=new Product(); product.setName("Oppo Selfie S7"); product.setBrand("OPPO"); product.setDescription("This is some description of oppo mobile is the good"); product.setUnitPrice(29000); product.setActive(true); product.setCategoryId(3); product.setSupplierId(3); assertEquals(" Something Went Wrong while inserting a new product !",true,productDAO.add(product)); }*/ /*@Test public void testListActiveProducts() { assertEquals(" Something Went Wrong while fetching a new product ! ", 5, productDAO. listActiveProducts(). size()); }*/ /*@Test public void testListActiveProductsByCategory() { assertEquals(" Something Went Wrong while fetching a new product ! ", 3, productDAO .listActiveProductsByCategory(3) .size()); }*/ /*@Test public void testGetLatestProducts() { assertEquals(" Something Went Wrong while fetching a new product ! ", 3, productDAO .getLatestActiveProducts(3) .size()); } */ }
[ "gunwantadhon@gmail.com" ]
gunwantadhon@gmail.com
a7368694a7757bc02fefac66529cf1734072f389
dd7c4def37a35582e3b67998c9c0524f7c3666eb
/backend/src/main/java/org/codeorange/backend/BackendApplication.java
1bcb11fd3a4fac88e1a8e77df9e14ddf0904749d
[]
no_license
nivstein/code-orange-backend
938df816f8b6df0aa62ecdbe1bf2943b42280a55
cc7981595faf7ddff85499a4c55a3aa1ebba9dfb
refs/heads/develop
2021-03-23T12:54:31.146450
2020-03-21T22:04:23
2020-03-21T22:04:23
247,456,001
0
0
null
2020-03-21T22:04:25
2020-03-15T11:48:45
Java
UTF-8
Java
false
false
393
java
package org.codeorange.backend; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.codeorange.backend.tasks.TaskScheduler; @SpringBootApplication public class BackendApplication { public static void main(String[] args) { TaskScheduler.init(); SpringApplication.run(BackendApplication.class, args); } }
[ "niv@takipi.com" ]
niv@takipi.com
67acbe779a19e69f702617508a275c522670d334
49f1ef7b3bf550e7197e6e6ef90fd9cca8ec4bd5
/src/br/com/caelum/financas/mb/MovimentacoesPorValorETipoBean.java
3616a8012b440a39e0e1ea330dda080cd6df19ba
[]
no_license
wallace-noronha/fj25-financas-web
8b6eabd2a0978c2ee52f678255672d6d3f289aea
15768798890a773fca570c098169bbf9b9312d1e
refs/heads/master
2020-04-23T07:23:48.603552
2019-03-16T20:00:00
2019-03-16T20:00:00
171,004,430
0
0
null
null
null
null
UTF-8
Java
false
false
1,132
java
package br.com.caelum.financas.mb; import java.math.BigDecimal; import java.util.List; import javax.enterprise.context.RequestScoped; import javax.inject.Inject; import javax.inject.Named; import br.com.caelum.financas.dao.MovimentacaoDao; import br.com.caelum.financas.modelo.Movimentacao; import br.com.caelum.financas.modelo.TipoMovimentacao; @Named @RequestScoped public class MovimentacoesPorValorETipoBean { @Inject private MovimentacaoDao dao; private List<Movimentacao> movimentacoes; private BigDecimal valor; private TipoMovimentacao tipoMovimentacao; public void lista() { System.out.println("Buscando movimentacoes por valor e tipo"); movimentacoes = dao.listaPorValorETipo(valor, tipoMovimentacao); } public BigDecimal getValor() { return valor; } public void setValor(BigDecimal valor) { this.valor = valor; } public TipoMovimentacao getTipoMovimentacao() { return tipoMovimentacao; } public void setTipoMovimentacao(TipoMovimentacao tipoMovimentacao) { this.tipoMovimentacao = tipoMovimentacao; } public List<Movimentacao> getMovimentacoes() { return movimentacoes; } }
[ "wallace.noronha@hotmail.com" ]
wallace.noronha@hotmail.com
6c6d931060b8c4e57f79e8fa41e94adbbe980330
f549f60fae3de4985faa36da0a8affa2e1afe7c8
/wsria-demo/src/main/java/com/wsria/arch/util/number/DoubleUtils.java
f9801291739ca328ee967cb6421867fda4c8a872
[]
no_license
killermeter/wsria
3d0145345213f65c5e62947cc660c91c1cfebc39
85702794b8cb4be59a30f05970c219d4a951d864
refs/heads/master
2021-01-10T08:21:40.853605
2011-08-02T14:40:30
2011-08-02T14:40:30
55,043,449
0
0
null
null
null
null
UTF-8
Java
false
false
1,560
java
package com.wsria.arch.util.number; /** * * * @author HenryYan * */ public class DoubleUtils { /** * 判断Long型数据是否为NULL或者0 * @param number * @return */ public static boolean isNullOrZero(Double number) { if (number == null) { return true; } return number == 0.0 ? true : false; } /** * 判断Double型数据是否为空 * @param number * @return */ public static boolean isEmpty(Double number) { return number == null ? true : false; } /** * 判断Double型数据是否不为空 * @param number * @return */ public static boolean isNotEmpty(Double number) { return !isEmpty(number); } /** * 如果数据为NULL返回0,否则直接返回该数据 * @param number * @return */ public static Double getValueIfEmptyZero(Double number) { return isEmpty(number) ? 0d : number; } /** * 将对象类型转换为Double类型,如果为空设置为0 * @param objs * @return */ public static Double[] paraseArray(Object[] objs) { Double[] doubles = new Double[objs.length]; for (int i = 0; i < objs.length; i++) { Object object = objs[i]; doubles[i] = object == null ? 0 : Double.valueOf(object.toString()); } return doubles; } /** * 判断一字符串是否可转化为Double * @param str * @return 可转为true */ public static Boolean isDoubleType(String str) { try { Double.valueOf(str); return true; } catch (Exception e) { return false; } } }
[ "yanhonglei@b4ea3878-8aa3-6609-8a57-222449c04924" ]
yanhonglei@b4ea3878-8aa3-6609-8a57-222449c04924
627e3feefca7f0db489c2aae078eb5319244649c
ee70f137f4ae15cdcf9345db48f3ddb9dd244037
/CollectionPro/List/src/test/java/ru/napadovskiub/stack/SimpleStackTest.java
f0b2b306554d594fc5b1365da5429f0776643cc4
[ "Apache-2.0" ]
permissive
BohdanNapadovskiy/jvm-byte-code
1289478aa89d7d3c60bcdad19db324932ecc8e93
aa77c5fdede7d74c84cd4bf00e46f6d927fa9b3e
refs/heads/master
2023-01-22T03:57:48.684484
2020-12-07T18:01:38
2020-12-07T18:01:38
319,394,258
0
0
null
null
null
null
UTF-8
Java
false
false
1,342
java
package ru.napadovskiub.stack; import org.junit.Test; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.is; /** * Package of CollectionPro testTask. * * @author Napadovskiy Bohdan * @version 1.0 * @since 05.07.2017 */ public class SimpleStackTest { /** * */ @Test public void whenPeekThanReturnElement() { SimpleStack<String> simpleStack = new SimpleStack<String>(); simpleStack.push("Барсик"); simpleStack.push("Моська"); String checkValue = simpleStack.peek(); assertThat(checkValue, is("Моська")); } /** * */ @Test public void whenPopThanReturnElementAndResizeStack() { SimpleStack<String> simpleStack = new SimpleStack<String>(); simpleStack.push("Барсик"); simpleStack.push("Моська"); String checkValue = simpleStack.pop(); assertThat(simpleStack.getSize(), is(1)); } /** * */ @Test public void whenPushElementThanReturnValue() { SimpleStack<String> simpleStack = new SimpleStack<String>(); simpleStack.push("Барсик"); simpleStack.push("Моська"); String checkValue = simpleStack.pop(); assertThat(checkValue, is("Моська")); } }
[ "napadovskibohdan@gmail.com" ]
napadovskibohdan@gmail.com
7942837e1333d7934d7e8b0ace23342a1f4b4220
6392035b0421990479baf09a3bc4ca6bcc431e6e
/projects/infinispan-ce4f6292/curr/core/src/test/java/org/infinispan/partitionhandling/BaseOptimisticTxPartitionAndMergeTest.java
42150dc02c73dac3c75ccdad92cd191675a1552f
[]
no_license
ameyaKetkar/RMinerEvaluationTools
4975130072bf1d4940f9aeb6583eba07d5fedd0a
6102a69d1b78ae44c59d71168fc7569ac1ccb768
refs/heads/master
2020-09-26T00:18:38.389310
2020-05-28T17:34:39
2020-05-28T17:34:39
226,119,387
3
1
null
null
null
null
UTF-8
Java
false
false
3,210
java
package org.infinispan.partitionhandling; import org.infinispan.Cache; import org.infinispan.commands.tx.TransactionBoundaryCommand; import org.infinispan.configuration.cache.CacheMode; import org.infinispan.configuration.cache.ConfigurationBuilder; import org.infinispan.transaction.LockingMode; import org.infinispan.transaction.TransactionMode; import org.infinispan.transaction.lookup.DummyTransactionManagerLookup; import org.infinispan.transaction.tm.DummyTransaction; import org.infinispan.transaction.tm.DummyTransactionManager; import java.util.concurrent.ExecutionException; import java.util.concurrent.Future; import java.util.concurrent.TimeUnit; import static org.testng.AssertJUnit.assertFalse; import static org.testng.AssertJUnit.assertTrue; /** * It tests multiple scenarios where a split can happen during a transaction. * * @author Pedro Ruivo * @since 8.0 */ public abstract class BaseOptimisticTxPartitionAndMergeTest extends BaseTxPartitionAndMergeTest { protected static final String OPTIMISTIC_TX_CACHE_NAME = "opt-cache"; @Override protected void createCacheManagers() throws Throwable { super.createCacheManagers(); ConfigurationBuilder builder = getDefaultClusteredCacheConfig(CacheMode.DIST_SYNC); builder.clustering().partitionHandling().enabled(true); builder.transaction().lockingMode(LockingMode.OPTIMISTIC).transactionMode(TransactionMode.TRANSACTIONAL).transactionManagerLookup(new DummyTransactionManagerLookup()); defineConfigurationOnAllManagers(OPTIMISTIC_TX_CACHE_NAME, builder); } protected abstract void checkLocksDuringPartition(SplitMode splitMode, KeyInfo keyInfo, boolean discard); protected abstract boolean forceRollback(); protected abstract Class<? extends TransactionBoundaryCommand> getCommandClass(); protected void doTest(final SplitMode splitMode, boolean txFail, boolean discard) throws Exception { waitForClusterToForm(OPTIMISTIC_TX_CACHE_NAME); final KeyInfo keyInfo = createKeys(OPTIMISTIC_TX_CACHE_NAME); final Cache<Object, String> originator = cache(0, OPTIMISTIC_TX_CACHE_NAME); final FilterCollection filterCollection = createFilters(OPTIMISTIC_TX_CACHE_NAME, discard, getCommandClass(), splitMode); Future<Void> put = fork(() -> { final DummyTransactionManager transactionManager = (DummyTransactionManager) originator.getAdvancedCache().getTransactionManager(); transactionManager.begin(); keyInfo.putFinalValue(originator); final DummyTransaction transaction = transactionManager.getTransaction(); transaction.runPrepare(); transaction.runCommit(forceRollback()); transaction.throwRollbackExceptionIfAny(); return null; }); filterCollection.await(30, TimeUnit.SECONDS); splitMode.split(this); filterCollection.unblock(); try { put.get(); assertFalse(txFail); } catch (ExecutionException e) { assertTrue(txFail); } checkLocksDuringPartition(splitMode, keyInfo, discard); mergeCluster(); finalAsserts(OPTIMISTIC_TX_CACHE_NAME, keyInfo, txFail ? INITIAL_VALUE : FINAL_VALUE); } }
[ "ask1604@gmail.com" ]
ask1604@gmail.com
017c9854fb22063e059d566a551d4c06b7a20a83
7aa02f902ad330c70b0b34ec2d4eb3454c7a3fc1
/com/google/android/gms/p046a/C0587f.java
cfbabd0d542fac254a518399e154c4e6820cd567
[]
no_license
hisabimbola/andexpensecal
5e42c7e687296fae478dfd39abee45fae362bc5b
c47e6f0a1a6e24fe1377d35381b7e7e37f1730ee
refs/heads/master
2021-01-19T15:20:25.262893
2016-08-11T16:00:49
2016-08-11T16:00:49
100,962,347
1
0
null
2017-08-21T14:48:33
2017-08-21T14:48:33
null
UTF-8
Java
false
false
263
java
package com.google.android.gms.p046a; /* renamed from: com.google.android.gms.a.f */ public class C0587f extends Exception { public C0587f(String str) { super(str); } public C0587f(String str, Throwable th) { super(str, th); } }
[ "m.ravinther@yahoo.com" ]
m.ravinther@yahoo.com
3ae7d6f51a19741ce213dcead8f5c2b42029fe2e
1d73232ed967213d44af9d75f4bd965ef342c0c3
/NeuralNetworkThingyBackup/programNode/Nodule.java
165358961860782bb60e3c05e14feadef2cc3add
[]
no_license
sirkibsirkib/old_B_CS_code
8e95ac5345ef83f8ef17da34ec4ae0632a7885a6
bbaed7bdde2c803e788423cf5e84007bf883720f
refs/heads/master
2021-05-07T22:43:55.487410
2017-10-17T14:52:46
2017-10-17T14:52:46
107,283,289
0
0
null
null
null
null
UTF-8
Java
false
false
2,577
java
package programNode; import program.DoubleRow; import program.Runner; public class Nodule implements Node{ private NodeRow points; private DoubleRow weights; private String name; private double stimulation, fireCap, x, y; private boolean fired; public Nodule(String name, double x, double y){ this.name = name; points = new NodeRow(); weights = new DoubleRow(); stimulation = 0; fireCap = FIRE_DOUBLE; this.x = x; this.y = y; fired = false; } public void removeRandomPoint(){ points.remove(Runner.rng(getNumberOfPoints())); } public void pointTo(Node other, double weight){ points.add(other); weights.add(weight); other.incrimentFireCap(1); } public void stimulate(double stimulation){ if(stimulation >= 1) return; //only fires once this.stimulation += stimulation; if(this.stimulation >= fireCap){ fire(); } } public void fire(){ fired = true; for(int i = 0; i < points.getNumberOfNodes(); i++){ points.getNode(i).stimulate(weights.getDouble(i)); } } public void resetFire(){ fired = false; stimulation = 0; } //GETS public String getName(){ return name; } public double getX(){ return x; } public double getY(){ return y; } public int getNumberOfPoints(){ return points.getNumberOfNodes(); } public double getXofPointedAtIndex(int index){ return points.getNode(index).getX(); } public double getYofPointedAtIndex(int index){ return points.getNode(index).getY(); } public double getWeightOfPoint(int index){ return weights.getDouble(index); } public boolean doesPointTo(Node to){ for(int i = 0; i < points.getNumberOfNodes(); i++){ if(points.getNode(i) == to){ return true; } } return false; } public boolean didFire(){ return fired; } public void incrimentFireCap(int multiplicity){ fireCap += FIRE_DOUBLE*multiplicity; } public void decrementFireCap(int multiplicity){ fireCap -= FIRE_DOUBLE*multiplicity; } public Node duplicate() { return new Nodule(name, x, y); } public PointVector[] getPointVectors() { int numVectors = points.getNumberOfNodes(); PointVector[] vectors = new PointVector[numVectors]; for(int i = 0; i < numVectors; i++){ vectors[i] = new PointVector(name, points.getNodeName(i), weights.getDouble(i)); } return vectors; } public void removePointsTo(String s){ int thingsRemoved = points.removeNodesWithNameReturnNumber(s); if(thingsRemoved > 0){ decrementFireCap(thingsRemoved); } } public boolean isRemovable(){ return 0 < y && y < 1; } }
[ "christopher.esterhuyse@gmail.com" ]
christopher.esterhuyse@gmail.com
f7b00c6559e6830f369b08afe463f6d4f7a7893c
f2bc53de09b1fe0eb013aaa7a15627371c02fd43
/app/src/main/java/pipeline/orchestrator/execution/LinkListener.java
f08ed53bc541871be6a52a541df9f8128e55879e
[]
no_license
jpcosteira/Pipeline-Orchestrator
f86085e1cf2b2434588c4b459dcfc192b273d8e2
6599483ec34076a87e0fd480042d00240ff2c1f1
refs/heads/main
2023-08-20T01:56:23.833740
2021-10-29T18:23:19
2021-10-29T18:23:19
null
0
0
null
null
null
null
UTF-8
Java
false
false
131
java
package pipeline.orchestrator.execution; @FunctionalInterface public interface LinkListener { void onNewObject(Link link); }
[ "duartemalves@tecnico.ulisboa.pt" ]
duartemalves@tecnico.ulisboa.pt
c230415e60f26b6cde14c3aa3c109caba51ac195
dd4a8106f9bdb2cb42d192644766fd93cb529eb5
/_/02/time-it/src/timeit/biz/test/StringVsStringBuffer.java
e0d6b8fec13fb4fd47dfee704373935abb85c521
[ "Apache-2.0" ]
permissive
paullewallencom/vaadin-978-1-7821-6226-1
42c8b1a503875b9626b83c4fbc74dc50994ff9ab
ee8d5a97822834d93c59058b38e35a49055c69a0
refs/heads/main
2023-02-05T20:29:23.100623
2020-12-30T01:29:17
2020-12-30T01:29:17
319,441,484
0
0
null
null
null
null
UTF-8
Java
false
false
1,206
java
package timeit.biz.test; import timeit.biz.Test; import timeit.biz.TestSet; /** * * @author Alejandro Duarte. * */ public class StringVsStringBuffer implements TestSet { private static final String ADD_THIS = "a"; @SuppressWarnings("unused") private String s; private StringBuffer sb; public class StringTest implements Test { @Override public String getName() { return "String"; } @Override public void execute() { s += "a"; } } public class StringBufferTest implements Test { @Override public String getName() { return "StringBuffer"; } @Override public void execute() { sb.append(ADD_THIS); } } @Override public Test[] getTests() { return new Test[] {new StringTest(), new StringBufferTest()}; } @Override public void init() { s = ""; sb = new StringBuffer(); } @Override public long getDefaultTimes() { return 100000; } @Override public String getTitle() { return "String vs StringBuffer"; } @Override public String getDescription() { return "How much do we gain by using StringBuffer instead of String when dealing with strings?"; } }
[ "paullewallencom@users.noreply.github.com" ]
paullewallencom@users.noreply.github.com
aed53fd0e17c0a56de58c3a5a90d38b5e8722567
250de3844d92d8ecac235d173912ca68e0cec2a1
/api/yplus-course-index-api/src/main/java/com/yplus/YplusCourseIndexApiApplication.java
0958a054c3592b0378c9ca24ab6b49e8cb58bf6b
[]
no_license
tangjiankang/yplus
f7ce468a47892e124fe23946bc7be9219a22c201
1df5bf7af7e58693ae64ce5f53779b7025bbcb7f
refs/heads/master
2022-07-17T01:57:58.221058
2019-08-30T09:45:57
2019-08-30T09:45:57
203,701,197
0
0
null
null
null
null
UTF-8
Java
false
false
340
java
package com.yplus; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @SpringBootApplication public class YplusCourseIndexApiApplication { public static void main(String[] args) { SpringApplication.run(YplusCourseIndexApiApplication.class, args); } }
[ "tjk163@163.com" ]
tjk163@163.com
4aaa9ec5a06417b548b9251d3cc68be36dea49da
b063ab697bf63613df10fa19dadb48bc0dbce2fd
/src/test/java/com/github/ejahns/JsonObject2.java
3090aa5a70c39df27822c435932d2caf8c619948
[]
no_license
ejahns/selenium-stateful
10bd68463265d3680d111b171458f671293b4604
1efbf3cc90da945759df698659f4d8db2b5ed92b
refs/heads/master
2021-01-19T22:55:42.813957
2017-06-05T22:09:50
2017-06-05T22:09:50
88,894,449
1
0
null
null
null
null
UTF-8
Java
false
false
386
java
package com.github.ejahns; import java.util.List; import com.google.common.collect.ImmutableList; import com.google.gson.annotations.Expose; /** * Created by ejahns on 4/27/2017. */ public class JsonObject2 { @Expose private List list = ImmutableList.of("One", "Two", "Three", "Four"); @Expose private int number = 314; @Expose private String text = "Some Other Text"; }
[ "ejahns@digitalmeasures.com" ]
ejahns@digitalmeasures.com
061ea55c83e3a306b2001050738a09fd9c88dd91
ec7942c929e1fcd16ae302a0b5e0e59378364afa
/core-base/core-base/src/main/java/org/nanotek/ImmutableLengthIdBase.java
dcfe6d3fecd89cf4b77a9fd2cf08bcf800b4259b
[ "Apache-2.0" ]
permissive
JoseCanova/repository-spring-core
16e2df2f50efb4d8a9268aa42031d9fae6b15ad1
10dd4a39b674180e522f4dd53155e1b2f456298c
refs/heads/master
2022-12-20T23:48:24.257644
2022-05-22T17:10:04
2022-05-22T17:10:04
249,253,054
2
1
Apache-2.0
2022-06-22T18:37:11
2020-03-22T19:04:30
Java
UTF-8
Java
false
false
206
java
package org.nanotek; import java.io.Serializable; public interface ImmutableLengthIdBase<K extends IdBase<K,ID>, L extends Serializable , ID extends Serializable> extends IdBase<K,ID>{ L getLength(); }
[ "jose.c.canova@gmail.com" ]
jose.c.canova@gmail.com
bf57c8609aa551d36b635895661567d6014875ac
5c82bb654c07d9366f7b4a11802b1862378daf50
/lib/hemesh/src/wblut/hemesh/creators/HEC_Sphere.java
2e8a0996b0eeb5dea9ac05a78062a5369b2dbf4f
[]
no_license
omegaf2k/voitree
fc9254249b319e5924c1f0e9a4f8a143abd48198
8105a9fdd4fc5ff1c7ad6cde1043317a2354306b
refs/heads/master
2021-05-27T05:43:09.509459
2011-10-23T12:20:21
2011-10-23T12:20:21
null
0
0
null
null
null
null
UTF-8
Java
false
false
4,265
java
/* * Copyright (c) 2010, Frederik Vanhoutte This library 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; either version * 2.1 of the License, or (at your option) any later version. * http://creativecommons.org/licenses/LGPL/2.1/ This library 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 this * library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, * Fifth Floor, Boston, MA 02110-1301 USA */ package wblut.hemesh.creators; import wblut.geom.WB_Vector; import wblut.hemesh.core.HE_Mesh; /** * Sphere. * * @author Frederik Vanhoutte (W:Blut) * */ public class HEC_Sphere extends HEC_Creator { /** Radius. */ private double R; /** U facets. */ private int uFacets; /** V facets. */ private int vFacets; /** * Instantiates a new HEC_Sphere. * */ public HEC_Sphere() { super(); R = 0; uFacets = 12; vFacets = 6; Z = new WB_Vector(0, 1, 0); } /** * Set fixed radius. * * @param R radius * @return self */ public HEC_Sphere setRadius(final double R) { this.R = R; return this; } /** * Set number of faces along equator. * * @param facets number of faces * @return self */ public HEC_Sphere setUFacets(final int facets) { uFacets = facets; return this; } /** * Set number of facets along meridian. * * @param facets number of faces * @return self */ public HEC_Sphere setVFacets(final int facets) { vFacets = facets; return this; } /* * (non-Javadoc) * @see wblut.hemesh.HE_Creator#create() */ @Override protected HE_Mesh createBase() { final double[][] vertices = new double[2 + uFacets * (vFacets - 1)][3]; vertices[0][0] = 0; vertices[0][1] = R; vertices[0][2] = 0; vertices[1][0] = 0; vertices[1][1] = -R; vertices[1][2] = 0; int id = 2; for (int v = 1; v < vFacets; v++) { final double Rs = R * Math.sin(v * Math.PI / vFacets); final double Rc = R * Math.cos(v * Math.PI / vFacets); for (int u = 0; u < uFacets; u++) { vertices[id][0] = Rs * Math.cos(2 * u * Math.PI / uFacets); vertices[id][1] = Rc; vertices[id][2] = Rs * Math.sin(2 * u * Math.PI / uFacets); id++; } } final int[][] faces = new int[uFacets * vFacets][]; for (int u = 0; u < uFacets; u++) { faces[u] = new int[3]; faces[u][0] = index(u, 0); faces[u][1] = index(u + 1, 1); faces[u][2] = index(u, 1); } for (int v = 1; v < vFacets - 1; v++) { for (int u = 0; u < uFacets; u++) { faces[u + uFacets * v] = new int[4]; faces[u + uFacets * v][0] = index(u, v); faces[u + uFacets * v][1] = index(u + 1, v); faces[u + uFacets * v][2] = index(u + 1, v + 1); faces[u + uFacets * v][3] = index(u, v + 1); } } for (int u = 0; u < uFacets; u++) { faces[u + uFacets * (vFacets - 1)] = new int[3]; faces[u + uFacets * (vFacets - 1)][0] = index(u, vFacets - 1); faces[u + uFacets * (vFacets - 1)][1] = index(u + 1, vFacets - 1); faces[u + uFacets * (vFacets - 1)][2] = index(u + 1, vFacets); } /* * for(int j=0;j<facets;j++){ int jp=(j==facets-1)?0:j+1; * faces[facets-1+facets*j]=new int[3]; * faces[facets-1+facets*j][0]=facets-1+(facets+1)*j; * faces[facets-1+facets*j][1]=(facets+1)*facets-1; * faces[facets-1+facets*j][2]=facets-1+(facets+1)*jp; } */ final HEC_FromFacelist fl = new HEC_FromFacelist(); fl.setVertices(vertices).setFaces(faces); return fl.createBase(); } /** * Index. * * @param u the u * @param v the v * @return the int */ private int index(final int u, final int v) { if (v == 0) { return 0; } if (v == vFacets) { return 1; } if (u == uFacets) { return index(0, v); } return 2 + u + uFacets * (v - 1); } }
[ "mail@stephanthiel.com" ]
mail@stephanthiel.com
5877767dcd437943d2aa6de5e4132f1e97ba65ab
09891aaff36ef0db918828a1382041cce1e136e3
/src/main/java/ofx/PresentmentListTransactionResponse.java
d377b9f3707e5796a402bc75290c07cd6ea1418d
[]
no_license
proyleg/InvestiaGenOFX2_mv
7f01555282b094581ae773421b23b3cae8656723
4d5524717067f66c1bec2d0702fbb8e448588611
refs/heads/master
2021-01-20T03:21:46.991208
2018-12-18T14:48:04
2018-12-18T14:48:04
89,526,447
0
0
null
null
null
null
UTF-8
Java
false
false
2,116
java
// // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> // Any modifications to this file will be lost upon recompilation of the source schema. // Generated on: 2013.12.12 at 04:58:05 PM EST // package ofx; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlType; /** * * The OFX element "PRESLISTTRNRS" is of type "PresentmentListTransactionResponse" * * * <p>Java class for PresentmentListTransactionResponse complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="PresentmentListTransactionResponse"> * &lt;complexContent> * &lt;extension base="{http://ofx.net/types/2003/04}AbstractTransactionResponse"> * &lt;sequence> * &lt;element name="PRESLISTRS" type="{http://ofx.net/types/2003/04}PresentmentListResponse" minOccurs="0"/> * &lt;/sequence> * &lt;/extension> * &lt;/complexContent> * &lt;/complexType> * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "PresentmentListTransactionResponse", propOrder = { "preslistrs" }) public class PresentmentListTransactionResponse extends AbstractTransactionResponse { @XmlElement(name = "PRESLISTRS") protected PresentmentListResponse preslistrs; /** * Gets the value of the preslistrs property. * * @return * possible object is * {@link PresentmentListResponse } * */ public PresentmentListResponse getPRESLISTRS() { return preslistrs; } /** * Sets the value of the preslistrs property. * * @param value * allowed object is * {@link PresentmentListResponse } * */ public void setPRESLISTRS(PresentmentListResponse value) { this.preslistrs = value; } }
[ "proy_leg@hotmail.com" ]
proy_leg@hotmail.com
cd1cae0f58fa0e16fd20f16bb94a0ff1bd39447e
b96100b84ce1516350808488eb08dfe7149e7704
/src/main/java/uk/co/sangharsh/service/ChatService.java
c58e61579254c231ffd04d5daf50cbdcee732fd5
[]
no_license
sangharshgautam/gennie
216509fcd85ed639f2569dd053426adc4b5a2304
651badaec9b614b5b703321a0dc2c0bb7f4ca78e
refs/heads/master
2021-01-15T15:43:52.586625
2016-10-13T22:05:45
2016-10-13T22:05:45
50,056,613
0
0
null
null
null
null
UTF-8
Java
false
false
128
java
package uk.co.sangharsh.service; import org.telegram.client.pojo.Chat; public interface ChatService extends Service<Chat>{ }
[ "sangharsh_iitd@yahoo.com" ]
sangharsh_iitd@yahoo.com
a42fe62b58e107c5ab42624e0e71f8ee0ec3556c
ae4056ee3f67a2d58620b772b1aeb33d85041d63
/core/src/main/java/com/stx/core/utils/SoftKeyBoardUtils.java
49836d721d21c3951f0822bbbaa9d746b64cc686
[ "Apache-2.0" ]
permissive
game-platform-awaresome/DMGameApp
0e163847ac1be96927fb88c38942943462562aa2
ff22e2a7a5bdcda24f4387b833d91f2ac6564830
refs/heads/master
2020-04-02T01:36:10.564620
2018-10-13T07:19:03
2018-10-13T07:19:03
153,865,048
0
2
null
2018-10-20T03:13:29
2018-10-20T03:13:29
null
UTF-8
Java
false
false
3,482
java
package com.stx.core.utils; import android.app.Activity; import android.content.Context; import android.view.View; import android.view.inputmethod.InputMethodManager; import android.widget.EditText; /** * Created by xhb on 2016/8/4. * @describe 软键盘工具类 */ public class SoftKeyBoardUtils { /** * 显示和隐藏软键盘 View : EditText、TextView isShow : true = show , false = hide * * @param context * @param view * @param isShow */ public static void popSoftKeyboard(Context context, View view, boolean isShow) { InputMethodManager imm = (InputMethodManager) context .getSystemService(Context.INPUT_METHOD_SERVICE); if (isShow) { view.requestFocus(); imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT); } else { imm.hideSoftInputFromWindow(view.getWindowToken(), 0); } } /** * 显示软键盘 * * @param view */ public static void showSoftKeyboard(View view) { Context context = view.getContext(); InputMethodManager imm = (InputMethodManager) context .getSystemService(Context.INPUT_METHOD_SERVICE); view.requestFocus(); imm.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT); } /** * 隐藏软键盘 * * @param view */ public static void hideSoftKeyboard(View view) { Context context = view.getContext(); InputMethodManager imm = (InputMethodManager) context .getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(view.getWindowToken(), 0); } /** * 显示软键盘 * @param context * @param editText */ public static void showSoftInputMethod(Context context, EditText editText) { if (context != null && editText != null) { editText.requestFocus(); InputMethodManager inputManager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); inputManager.showSoftInput(editText, 0); } } /** *关闭软键盘 * @param context * @param editText */ public static void closeSoftInputMethod(Context context, EditText editText) { if (context != null && editText != null) { InputMethodManager imm = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); if (imm != null) { imm.hideSoftInputFromWindow(editText.getWindowToken(), 0); } } } /** *显示软键盘 * @param context */ public static void showSoftInput(Context context) { InputMethodManager inputMethodManager = (InputMethodManager) context .getSystemService(Context.INPUT_METHOD_SERVICE); inputMethodManager.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS); } /** * 关闭软键盘 * @param context */ public static void closeSoftInput(Context context) { InputMethodManager inputMethodManager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); if (inputMethodManager != null && ((Activity) context).getCurrentFocus() != null) { inputMethodManager.hideSoftInputFromWindow(((Activity) context).getCurrentFocus().getWindowToken(), InputMethodManager.HIDE_NOT_ALWAYS); } } }
[ "xhb_199409@163.com" ]
xhb_199409@163.com
28960153e9f86fa472f6534374e6a368fe1157ab
b2204eed8b1e7551dd99352c531f2370a5b8a191
/src/Arrea/Main.java
a986deaa29c9c912056901daeaf97ea8979d0b74
[]
no_license
Raptar212/Car
eb233641b636fecabb63739f8c65f389851b5001
9ef7a53acede8db47c00044adf931638ba1ddb69
refs/heads/master
2023-02-19T11:17:13.988074
2021-01-19T19:02:13
2021-01-19T19:02:13
331,080,622
0
0
null
null
null
null
UTF-8
Java
false
false
143
java
package Arrea; public class Main { public static void main(String[] args) { System.out.println(MyArea.areaOfCirkl(12) ); } }
[ "generalgrevus@gmail.com" ]
generalgrevus@gmail.com
89c585a4b2b0506d46535eb216b86b4b3e1f6bd8
2edff0a87f0662610893485a80481eaa891d814f
/src/main/java/ru/topjava/graduation/config/ContextTest.java
51b906c947f48eaf8fdb33f3edeac03be923a3ac
[]
no_license
DimaSmal1994/graduation
51c0a09f790f435158324eb9867519f1100d0742
396204c2c10e066ce8d2c842630058ef93d43065
refs/heads/master
2022-02-23T10:15:38.994705
2019-10-25T09:45:54
2019-10-25T09:45:54
207,515,392
0
0
null
2022-02-10T00:08:32
2019-09-10T09:16:42
Java
UTF-8
Java
false
false
1,378
java
package ru.topjava.graduation.config; import org.springframework.context.annotation.AnnotationConfigApplicationContext; import ru.topjava.graduation.model.Restaurant; import ru.topjava.graduation.service.DishService; import ru.topjava.graduation.service.RestaurantService; import ru.topjava.graduation.to.DishTo; import java.util.ArrayList; public class ContextTest { public static void main(String[] args) { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); context.register(AppConfig.class, SecurityConfig.class, WebConfig.class); context.refresh(); // for (String currentBean : context.getBeanDefinitionNames()) { // System.out.println(currentBean); // } // RestaurantRepository restaurantRepository = context.getBean(RestaurantRepository.class); RestaurantService restaurantService = context.getBean(RestaurantService.class); Restaurant restaurant = new Restaurant("QQ", new ArrayList<>()); Restaurant savedRestaurant = restaurantService.save(restaurant); // DishRepository dishRepository = context.getBean(DishRepository.class); DishService dishService = context.getBean(DishService.class); int id = dishService.save(new DishTo(null,"steak", 1100, 9)).getId(); System.out.println(dishService.getById(id)); } }
[ "dima.smal.94@mail.ru" ]
dima.smal.94@mail.ru
a0d2b30db3b09eade79a932f94f89d515bfaaf0b
cbfccc5bee1635b2ae3e0c00406c1883fd71869c
/zetaoverflow-server/src/main/java/com/ankush/zetaoverflow/exception/ZetaOverflowErrorCode.java
78a1714695ae355354e06a0a3271ad2254d35139
[]
no_license
tlamatiniisrael/zetaoverflow
f2550d78b7e7ba599c41cbdafddd3bef383cf8af
b2f724088e648ebee8d8e4871ff407d9345e57df
refs/heads/master
2022-11-25T12:10:56.501323
2020-02-06T08:05:14
2020-02-06T08:05:14
null
0
0
null
null
null
null
UTF-8
Java
false
false
851
java
package com.ankush.zetaoverflow.exception; import org.springframework.http.HttpStatus; //@Getter //@AllArgsConstructor public enum ZetaOverflowErrorCode { INTERNAL_SERVER_ERROR("ER000", "Something went wrong", HttpStatus.INTERNAL_SERVER_ERROR), USER_NOT_FOUND("ER001", "User not found", HttpStatus.NOT_FOUND); ZetaOverflowErrorCode(String errorCode, String errorMessage, HttpStatus httpStatus) { this.errorCode = errorCode; this.errorMessage = errorMessage; this.httpStatus = httpStatus; } public String getErrorCode() { return errorCode; } public String getErrorMessage() { return errorMessage; } public HttpStatus getHttpStatus() { return httpStatus; } private String errorCode; private String errorMessage; private HttpStatus httpStatus; }
[ "1998anky@gmail.com" ]
1998anky@gmail.com
ecc365460fb27e8fe37bbc15e40ede85105c8752
71774b87620389cb7ae1c93e6b1a85ed5aaaf9b9
/libusbcamera/src/main/java/com/jiangdg/usbcamera/UVCCameraHelper.java
7dd26f8c0ce8908e8a1997d42934a967bdf3961d
[ "Apache-2.0" ]
permissive
AllThingsEqual/AndroidUSBCamera
2fc0818287743d5919fe3f0c088817d37bc5e4fd
64303b66616a946584afb55d01f441738e5bc752
refs/heads/master
2020-10-02T01:31:06.448512
2019-12-13T15:39:32
2019-12-13T15:39:32
227,669,490
0
0
Apache-2.0
2019-12-12T18:17:32
2019-12-12T18:17:31
null
UTF-8
Java
false
false
11,638
java
package com.jiangdg.usbcamera; import android.app.Activity; import android.graphics.SurfaceTexture; import android.hardware.usb.UsbDevice; import android.os.Environment; import com.jiangdg.libusbcamera.R; import com.serenegiant.usb.DeviceFilter; import com.serenegiant.usb.Size; import com.serenegiant.usb.USBMonitor; import com.serenegiant.usb.UVCCamera; import com.serenegiant.usb.common.AbstractUVCCameraHandler; import com.serenegiant.usb.common.UVCCameraHandler; import com.serenegiant.usb.encoder.RecordParams; import com.serenegiant.usb.widget.CameraViewInterface; import java.io.File; import java.lang.ref.WeakReference; import java.util.List; /** UVCCamera Helper class * * Created by jiangdongguo on 2017/9/30. */ public class UVCCameraHelper { public static final String ROOT_PATH = Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator; public static final String SUFFIX_JPEG = ".jpg"; public static final String SUFFIX_MP4 = ".mp4"; private static final String TAG = "UVCCameraHelper"; private int previewWidth = 640; private int previewHeight = 480; public static final int FRAME_FORMAT_YUYV = UVCCamera.FRAME_FORMAT_YUYV; // Default using MJPEG // if your device is connected,but have no images // please try to change it to FRAME_FORMAT_YUYV public static final int FRAME_FORMAT_MJPEG = UVCCamera.FRAME_FORMAT_MJPEG; public static final int MODE_BRIGHTNESS = UVCCamera.PU_BRIGHTNESS; public static final int MODE_CONTRAST = UVCCamera.PU_CONTRAST; private int mFrameFormat = FRAME_FORMAT_MJPEG; private static UVCCameraHelper mCameraHelper; // USB Manager private USBMonitor mUSBMonitor; // Camera Handler private UVCCameraHandler mCameraHandler; private USBMonitor.UsbControlBlock mCtrlBlock; private Activity mActivity; private CameraViewInterface mCamView; private UVCCameraHelper() { } public static UVCCameraHelper getInstance() { if (mCameraHelper == null) { mCameraHelper = new UVCCameraHelper(); } return mCameraHelper; } public void closeCamera() { if (mCameraHandler != null) { mCameraHandler.close(); } } public interface OnMyDevConnectListener { void onAttachDev(UsbDevice device); void onDettachDev(UsbDevice device); void onConnectDev(UsbDevice device, boolean isConnected); void onDisConnectDev(UsbDevice device); } public void initUSBMonitor(Activity activity, CameraViewInterface cameraView, final OnMyDevConnectListener listener) { this.mActivity = activity; this.mCamView = cameraView; mUSBMonitor = new USBMonitor(activity.getApplicationContext(), new USBMonitor.OnDeviceConnectListener() { // called by checking usb device // do request device permission @Override public void onAttach(UsbDevice device) { if (listener != null) { listener.onAttachDev(device); } } // called by taking out usb device // do close camera @Override public void onDettach(UsbDevice device) { if (listener != null) { listener.onDettachDev(device); } } // called by connect to usb camera // do open camera,start previewing @Override public void onConnect(final UsbDevice device, USBMonitor.UsbControlBlock ctrlBlock, boolean createNew) { mCtrlBlock = ctrlBlock; openCamera(ctrlBlock); new Thread(new Runnable() { @Override public void run() { // wait for camera created try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } // start previewing startPreview(mCamView); } }).start(); if(listener != null) { listener.onConnectDev(device,true); } } // called by disconnect to usb camera // do nothing @Override public void onDisconnect(UsbDevice device, USBMonitor.UsbControlBlock ctrlBlock) { if (listener != null) { listener.onDisConnectDev(device); } } @Override public void onCancel(UsbDevice device) { } }); createUVCCamera(); } public void createUVCCamera() { if (mCamView == null) throw new NullPointerException("CameraViewInterface cannot be null!"); // release resources for initializing camera handler if (mCameraHandler != null) { mCameraHandler.release(); mCameraHandler = null; } // initialize camera handler mCamView.setAspectRatio(previewWidth / (float)previewHeight); mCameraHandler = UVCCameraHandler.createHandler(mActivity, mCamView, 2, previewWidth, previewHeight, mFrameFormat); } public void updateResolution(int width, int height) { if (previewWidth == width && previewHeight == height) { return; } this.previewWidth = width; this.previewHeight = height; if (mCameraHandler != null) { mCameraHandler.release(); mCameraHandler = null; } mCamView.setAspectRatio(previewWidth / (float)previewHeight); mCameraHandler = UVCCameraHandler.createHandler(mActivity,mCamView, 2, previewWidth, previewHeight, mFrameFormat); openCamera(mCtrlBlock); new Thread(new Runnable() { @Override public void run() { // wait for camera created try { Thread.sleep(500); } catch (InterruptedException e) { e.printStackTrace(); } // start previewing startPreview(mCamView); } }).start(); } public void registerUSB() { if (mUSBMonitor != null) { mUSBMonitor.register(); } } public void unregisterUSB() { if (mUSBMonitor != null) { mUSBMonitor.unregister(); } } public boolean checkSupportFlag(final int flag) { return mCameraHandler != null && mCameraHandler.checkSupportFlag(flag); } public int getModelValue(final int flag) { return mCameraHandler != null ? mCameraHandler.getValue(flag) : 0; } public int setModelValue(final int flag, final int value) { return mCameraHandler != null ? mCameraHandler.setValue(flag, value) : 0; } public int resetModelValue(final int flag) { return mCameraHandler != null ? mCameraHandler.resetValue(flag) : 0; } public void requestPermission(int index) { List<UsbDevice> devList = getUsbDeviceList(); if (devList == null || devList.size() == 0) { return; } int count = devList.size(); if (index >= count) new IllegalArgumentException("index illegal,should be < devList.size()"); if (mUSBMonitor != null) { mUSBMonitor.requestPermission(getUsbDeviceList().get(index)); } } public int getUsbDeviceCount() { List<UsbDevice> devList = getUsbDeviceList(); if (devList == null || devList.size() == 0) { return 0; } return devList.size(); } public List<UsbDevice> getUsbDeviceList() { List<DeviceFilter> deviceFilters = DeviceFilter .getDeviceFilters(mActivity.getApplicationContext(), R.xml.device_filter); if (mUSBMonitor == null || deviceFilters == null) // throw new NullPointerException("mUSBMonitor ="+mUSBMonitor+"deviceFilters=;"+deviceFilters); return null; // matching all of filter devices return mUSBMonitor.getDeviceList(deviceFilters); } public void capturePicture(String savePath,AbstractUVCCameraHandler.OnCaptureListener listener) { if (mCameraHandler != null && mCameraHandler.isOpened()) { mCameraHandler.captureStill(savePath,listener); } } public void startPusher(AbstractUVCCameraHandler.OnEncodeResultListener listener) { if (mCameraHandler != null && !isPushing()) { mCameraHandler.startRecording(null, listener); } } public void startPusher(RecordParams params, AbstractUVCCameraHandler.OnEncodeResultListener listener) { if (mCameraHandler != null && !isPushing()) { mCameraHandler.startRecording(params, listener); } } public void stopPusher() { if (mCameraHandler != null && isPushing()) { mCameraHandler.stopRecording(); } } public boolean isPushing() { if (mCameraHandler != null) { return mCameraHandler.isRecording(); } return false; } public boolean isCameraOpened() { if (mCameraHandler != null) { return mCameraHandler.isOpened(); } return false; } public void release() { if (mCameraHandler != null) { mCameraHandler.release(); mCameraHandler = null; } if (mUSBMonitor != null) { mUSBMonitor.destroy(); mUSBMonitor = null; } } public USBMonitor getUSBMonitor() { return mUSBMonitor; } public void setOnPreviewFrameListener(AbstractUVCCameraHandler.OnPreViewResultListener listener) { if(mCameraHandler != null) { mCameraHandler.setOnPreViewResultListener(listener); } } private void openCamera(USBMonitor.UsbControlBlock ctrlBlock) { if (mCameraHandler != null) { mCameraHandler.open(ctrlBlock); } } public void startPreview(CameraViewInterface cameraView) { SurfaceTexture st = cameraView.getSurfaceTexture(); if (mCameraHandler != null) { mCameraHandler.startPreview(st); } } public void stopPreview() { if (mCameraHandler != null) { mCameraHandler.stopPreview(); } } public void startCameraFoucs() { if (mCameraHandler != null) { mCameraHandler.startCameraFoucs(); } } public List<Size> getSupportedPreviewSizes() { if (mCameraHandler == null) return null; return mCameraHandler.getSupportedPreviewSizes(); } public void setDefaultPreviewSize(int defaultWidth,int defaultHeight) { if(mUSBMonitor != null) { throw new IllegalStateException("setDefaultPreviewSize should be call before initMonitor"); } this.previewWidth = defaultWidth; this.previewHeight = defaultHeight; } public void setDefaultFrameFormat(int format) { if(mUSBMonitor != null) { throw new IllegalStateException("setDefaultFrameFormat should be call before initMonitor"); } this.mFrameFormat = format; } public int getPreviewWidth() { return previewWidth; } public int getPreviewHeight() { return previewHeight; } }
[ "765067602@qq.com" ]
765067602@qq.com
04403dbd1143b3a2ec2a1a937bff193193b9e0ac
5dabf690c8b7de8f82adb99f0546f7cbbf16d2c3
/src/main/java/com/shopping/product/ProductService.java
805bf76383fe1a0ec68d9157ba7e11ca75402fe7
[]
no_license
rgopa/SpringBootRestShopping
60438a7ed6c3671edee72b742e014d0b405dcf05
2353bced73cb0f8463f9642cfc5a5ebd865210c2
refs/heads/master
2020-09-13T05:20:01.811428
2019-11-19T10:02:30
2019-11-19T10:02:30
222,665,264
0
0
null
null
null
null
UTF-8
Java
false
false
819
java
package com.shopping.product; import java.util.ArrayList; import java.util.List; import java.util.Optional; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @Service public class ProductService { //List<Product> list = new ArrayList<>(); @Autowired ProductRepository productRepository; public Optional<Product> getProduct(String productId){ //return list.stream().filter(p -> p.getId().equalsIgnoreCase(productId)).findFirst().get(); return productRepository.findById(productId); } public List<Product> getAllProducts(){ List<Product> products = new ArrayList<>(); productRepository.findAll().forEach(products::add); return products; } public void addProduct(Product product){ productRepository.save(product); } }
[ "Raghavendra.ga57@gmail.com" ]
Raghavendra.ga57@gmail.com
9fa6511fd84efa967e6856f6922d3d0459a3ec6a
cb4a7eba6e9b0d1f7b1546b4fbd21ac40b61500e
/ticket-business/src/main/java/org/example/demo/ticket/business/manager/TicketManager.java
39713871e1780da05ec7ddd652163957216c021b
[]
no_license
SeeD7/OCR_Spring_Ticket_Manager
c23e0907cc4f844cec3f6318c003b0f6eba600fe
a595352b100196a608365f21dc522e3b0a2b6afd
refs/heads/master
2020-03-30T23:57:27.031276
2018-10-05T13:12:51
2018-10-05T13:12:51
151,719,649
0
0
null
null
null
null
UTF-8
Java
false
false
1,221
java
package org.example.demo.ticket.business.manager; import org.example.demo.ticket.model.bean.ticket.Ticket; import org.example.demo.ticket.model.exception.NotFoundException; import org.example.demo.ticket.model.recherche.ticket.RechercheTicket; import javax.inject.Named; import java.util.List; /** * Manager des beans du package Ticket. * * @author lgu */ @Named public interface TicketManager { /** * Cherche et renvoie le {@link Ticket} numéro {@code pNumero} * * @param pNumero le numéro du Ticket * @return Le {@link Ticket} * @throws NotFoundException Si le Ticket n'est pas trouvé */ Ticket getTicket(Long pNumero) throws NotFoundException; /** * Renvoie la liste des {@link Ticket} correspondants aux critères de recherche. * * @param pRechercheTicket - * @return List */ List<Ticket> getListTicket(RechercheTicket pRechercheTicket); /** * Renvoie la liste de tous les {@link Ticket}. * * @return List */ List<Ticket> getListTicket(); /** * Renvoie le nombre de {@link Ticket} correspondants aux critères de recherche. * * @param pRechercheTicket - * @return int */ int getCountTicket(RechercheTicket pRechercheTicket); }
[ "lartru@TSL.corp.thales" ]
lartru@TSL.corp.thales
7416c2e1dc7002eaba9dd607a1bfb44aaa77b704
6d7853e99094828d37eed9c630aa9401828e5fa2
/TwitterClone/src/main/java/com/TwitterClone/mapper/UserMapperImpl.java
2bb248315a0e208c0007b9700f380b9a539f2c17
[]
no_license
MdSulaiman2k/TwitterClone
54b2c7cbaf64af57b316d7fa42fce5dafd5b44e0
683858fc6d8f31e12c70dec15c89e6f69afa25a8
refs/heads/master
2023-07-03T19:15:20.556204
2021-08-05T13:32:16
2021-08-05T13:32:16
385,829,044
0
0
null
2021-07-14T09:04:36
2021-07-14T05:54:10
Java
UTF-8
Java
false
false
1,035
java
package com.TwitterClone.mapper; import java.util.ArrayList; import java.util.List; import org.springframework.stereotype.Component; import com.TwitterClone.Dto.UserDto; import com.TwitterClone.Dto.Request.UserRequestDto; import com.TwitterClone.Model.User; @Component public class UserMapperImpl implements UserMapper { @Override public UserDto userToUserDto(User user) { if(user == null) return null ; UserDto userdto = new UserDto( user.getName() , user.getEmail()) ; return userdto; } @Override public List<UserDto> userToUserDto(List<User> users) { if(users == null) return null ; List<UserDto> usersDto = new ArrayList<>(); for(User user : users) usersDto.add(userToUserDto(user)) ; return usersDto ; } @Override public User userRequestDtotoUser(UserRequestDto userReq) { if(userReq == null) return null ; User user = new User() ; user.setName(userReq.getName()); user.setEmail(userReq.getEmail()); user.setPassword(userReq.getPassword()); return user ; } }
[ "mdsulaiman132k@gmail.com" ]
mdsulaiman132k@gmail.com
c70078ffb0bc198e843d7a958c99c9cf0092436a
0114ff75f09a5a9589b82b32a300136ccbcee41b
/src/main/java/AOP/AspectJAnnotation/Audience.java
eb28117b2a91bb66ff485e6bd91123c51ef463ba
[]
no_license
JJunior97/LearningSpring
7f083bee0eba07902ed04fc4be78b412467170c7
48d866a0c2f636552f0e10491e56f36fb73eef09
refs/heads/master
2020-05-02T08:32:01.677309
2019-04-06T19:36:41
2019-04-06T19:36:41
177,845,313
0
0
null
null
null
null
UTF-8
Java
false
false
1,635
java
package AOP.AspectJAnnotation; import org.aspectj.lang.ProceedingJoinPoint; import org.aspectj.lang.annotation.*; @Aspect public class Audience { @Pointcut("execution(* AOP.AspectJAnnotation.Performer.perform(..))") public void performance(){ //Zadeklarowanie punktu przecięcia - id to nazwa metody, która oznaczona jest ADNOTACJĄ @Pointcut } /* @Before("performance()") public void takeSeats(){ System.out.println("Widzowie zajmują miejsca..."); } @Before("performance()") public void turnOffCellPhones(){ System.out.println("Widzowie wyłączają telefony komórkowe..."); } @AfterReturning("performance()") public void applaud(){ System.out.println("Brawooo! Oklaski!"); } @AfterThrowing("performance()") public void demandRefund(){ System.out.println("Buu! Oddajcie hajs za bilety!"); }*/ @Around("performance()") public void watchPerformance(ProceedingJoinPoint joinPoint){ try{ System.out.println("Widzowie zajmują miejsca..."); System.out.println("Widzowie wyłączają telefony komórkowe..."); long start = System.currentTimeMillis(); joinPoint.proceed(); //WYWOŁANIE METODY DOCELOWEJ (opakowanej) long end = System.currentTimeMillis(); System.out.println("Brawooo! Oklaski!"); System.out.println("Występ trwał " + (end - start) + " milisekund."); }catch (Throwable t){ System.out.println("Buu! Oddajcie hajs za bilety!"); } } }
[ "javajunior97@gmail.com" ]
javajunior97@gmail.com
8f1b0ffb3793d0dc520fbbd0ebbf91333bb5e0ff
2feeda65e45269c0aed069f0af8708c9e0a7b9b0
/src/model/entities/Paciente.java
23f100648eec6497236f9ebdbf077a64c83e5178
[]
no_license
rodrigod22/testeExame
74c5a3888e20af1e2cbea6770ea09f2649a6a115
4d259194fe92871fa7d22db840e3fa939b486054
refs/heads/master
2020-05-30T18:35:53.937396
2019-06-03T00:55:14
2019-06-03T00:55:14
189,900,869
0
0
null
null
null
null
UTF-8
Java
false
false
1,605
java
package model.entities; import java.io.Serializable; import java.util.Date; public class Paciente implements Serializable{ private static final long serialVersionUID = 1L; private Integer id; private String nome; private Date dataNasc; private String telefone; public Paciente() { } public Paciente(Integer id, String nome, Date dataNasc, String telefone) { this.id = id; this.nome = nome; this.dataNasc = dataNasc; this.telefone = telefone; } public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getNome() { return nome; } public void setNome(String nome) { this.nome = nome; } public Date getDataNasc() { return dataNasc; } public void setDataNasc(Date dataNasc) { this.dataNasc = dataNasc; } public String getTelefone() { return telefone; } public void setTelefone(String telefone) { this.telefone = telefone; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((id == null) ? 0 : id.hashCode()); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; Paciente other = (Paciente) obj; if (id == null) { if (other.id != null) return false; } else if (!id.equals(other.id)) return false; return true; } @Override public String toString() { return "Paciente [id=" + id + ", nome=" + nome + ", dataNasc=" + dataNasc + ", telefone=" + telefone + "]"; } }
[ "rodrigogat5@hotmail.com" ]
rodrigogat5@hotmail.com
6651822f906a66257f7023c3c7d2df2e8c07cc3f
a728e780a9c008dee82c477d625d7132fc46e19c
/CodeScanner/src/application/SessionHandler.java
b391c6460c0ce27a4d517eed0c9d51b730925f41
[]
no_license
ajbuckley/codeScanner
29bc3ae74284bc1d2051461817cd4354c3151269
80c33a0178b6224a7ddfa521b45325e3c70eb118
refs/heads/master
2021-01-11T16:01:35.377679
2017-01-25T05:42:12
2017-01-25T05:42:12
79,985,948
2
0
null
null
null
null
UTF-8
Java
false
false
2,667
java
package application; import github.handling.RepositoryPuller; import java.io.IOException; import java.sql.SQLException; import java.util.ArrayList; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import search.Searcher; import beans.FileBean; import dao.FileDAO; /** * A runnable which handles everything to do with a single session. Does not exit until the session's * results are in the DB. Needed so that CodeScannerRestApi start methods can return immediately. * @author Ethan Swartzentruber * */ public class SessionHandler implements Runnable{ //threadpools used for searching and matching, respectively private ExecutorService pool; //External github URL of repository given by the user private String repoURL; //sessionID for this search job. private int sessionID; //true is by zip upload, false is by URL private boolean zipUpload; public SessionHandler(ExecutorService pool, String repoURL, int sessionID, boolean zipUpload){ this.pool = pool; this.repoURL = repoURL; this.sessionID = sessionID; this.zipUpload = zipUpload; } //TODO I might need to synchronize these on the DAO so that if it's putting results into the DAO when //someone wants to get something out, we don't break everything. Unsure whether this is necessary, //it depends on how SQL works under the hood. public void run() { if(zipUpload){ //if this session was started by zip upload //TODO Handle this. Not sure how, ask Will }else{ //if this session was started by URL request //First, go download the files in the repository. When these statements return, files are in the DB. //TODO Reconcile syntax with Drew's new stuff, not yet merged into master RepositoryPuller repoPuller = new RepositoryPuller(sessionID, CodeScannerRestApi.programPath); try { repoPuller.download(repoURL); } catch (IOException | SQLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } //TODO Queue all files into the searchPool. The runnable for that will queue them into the matchPool. FileDAO fDAO = CodeScannerRestApi.fileDAO; ArrayList<FileBean> fbs = null; try { fbs = fDAO.getBySession(sessionID); } catch (SQLException e) { e.printStackTrace(); } System.out.println("Files: " + fbs.size()); for(FileBean f: fbs){ //Queue the filebean into the pool to have its candidates generated and results found. //System.out.println("Queueing file " + f.getFileName() + " into pool."); pool.execute(new Searcher(f)); } } }
[ "djbuckley215@gmail.com" ]
djbuckley215@gmail.com
e92ab6a3cf10f4041d6f599ed66cd5047513f213
4598f773fb03cdbdec3a79a84356b8ef9a8b1597
/simplehttp/src/main/java/com/xs/simplehttp/api/Interceptor.java
eab0ec0a3717caafb240368102c1dabf9ded5c05
[]
no_license
XScoding/simplehttp
53c2f617c099fa1477356da4b642de48ce33c9f4
36cf6cf2f6b1ffb6416de44dc02470ddf644994c
refs/heads/master
2020-05-19T05:18:14.681515
2019-05-04T03:08:21
2019-05-04T03:08:21
184,846,687
1
0
null
null
null
null
UTF-8
Java
false
false
511
java
package com.xs.simplehttp.api; /** * interceptor * Created by xs code on 2019/3/13. */ public interface Interceptor { /** * intercept * * @param chain * @return */ Response intercept(Chain chain); interface Chain { /** * request * * @return */ Request request(); /** * proceed * * @param request * @return */ Response proceed(Request request); } }
[ "zheshi13579@163.com" ]
zheshi13579@163.com
af4d33a0f51356c97e0e4ca9e5181126c8bb9fe1
25d57b3152199032b05a6b90e22c731bda9182cd
/mes/mes-web-manage/src/main/java/cn/emay/eucp/web/manage/controller/global/fms/message/FmsMessageMessageController.java
fad97c2fd35e695ffff58ed359635811ed4b903b
[]
no_license
chfcxc/mes-platform
c86c122039161c1f7a240b60de2933d332da6c5e
39c3d7ce2f748de6f5cedd3842083d61bfe3186f
refs/heads/master
2022-07-07T22:42:03.326632
2019-05-24T05:41:01
2019-05-24T05:41:01
188,359,035
0
2
null
2022-07-07T22:09:50
2019-05-24T05:39:36
JavaScript
UTF-8
Java
false
false
5,217
java
package cn.emay.eucp.web.manage.controller.global.fms.message; import java.util.ArrayList; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.annotation.Resource; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import cn.emay.common.Result; import cn.emay.common.db.Page; import cn.emay.eucp.common.constant.EucpFmsMessageState; import cn.emay.eucp.common.dto.fms.business.FmsBusinesTypeDto; import cn.emay.eucp.common.dto.fms.message.FmsMessagePageDto; import cn.emay.eucp.common.moudle.db.fms.FmsBusinessType; import cn.emay.eucp.common.moudle.db.fms.FmsServiceCode; import cn.emay.eucp.data.service.fms.FmsBusinessTypeService; import cn.emay.eucp.data.service.fms.FmsMessageService; import cn.emay.eucp.data.service.fms.FmsServiceCodeService; import cn.emay.eucp.web.common.auth.annotation.PageAuth; import cn.emay.util.RequestUtils; import cn.emay.util.ResponseUtils; @PageAuth("FMS_MESSAGE_DETAIL") @RequestMapping("/fms/message/detail") @Controller public class FmsMessageMessageController { @Resource private FmsBusinessTypeService fmsBusinessTypeService; @Resource private FmsServiceCodeService fmsServiceCodeService; @Resource private FmsMessageService fmsMessageService; @RequestMapping("") public String index(HttpServletRequest request, HttpServletResponse response, Model model) { List<FmsBusinessType> busiList = fmsBusinessTypeService.findBusiName(-1L); model.addAttribute("busiList", busiList); String batchNumber = RequestUtils.getParameter(request, "batchNumber"); model.addAttribute("batchNumber", batchNumber); return "fms/message/detail"; } @RequestMapping("/ajax/getcontent") public void busiTocontent(HttpServletRequest request, HttpServletResponse response, Model model) { int saveType = RequestUtils.getIntParameter(request, "saveType", -1); Long busiId = RequestUtils.getLongParameter(request, "busiId", -1); List<FmsBusinessType> contentList = fmsBusinessTypeService.findContentByBusi(saveType, busiId); ResponseUtils.outputWithJson(response, Result.rightResult(contentList)); } @RequestMapping("/ajax/list") public void list(HttpServletRequest request, HttpServletResponse response) { String batchNumber = RequestUtils.getParameter(request, "batchNumber"); String title = RequestUtils.getParameter(request, "title"); String serviceCodeIdString = request.getParameter("serviceCodeId"); Long serviceCodeId = 0L; int state = RequestUtils.getIntParameter(request, "state", -1); int sendType = RequestUtils.getIntParameter(request, "sendType", -1);// 提交方式 int infoType = RequestUtils.getIntParameter(request, "infoType", -1);// 信息类型 Long businessTypeId = RequestUtils.getLongParameter(request, "businessTypeId", -1);// 业务类型 int saveType = RequestUtils.getIntParameter(request, "saveType", -1);// 保存类型 Long contentTypeId = RequestUtils.getLongParameter(request, "contentTypeId", -1);// 内容类型 int start = RequestUtils.getIntParameter(request, "start", 0); int limit = RequestUtils.getIntParameter(request, "limit", 20); int operator = RequestUtils.getIntParameter(request, "operator", -1);// 运营商 List<Long> userIds = new ArrayList<Long>(); Date startTime = RequestUtils.getDateParameter(request, "startTime", "yyyy-MM-dd HH:mm:ss", null); Date endTime = RequestUtils.getDateParameter(request, "endTime", "yyyy-MM-dd HH:mm:ss", null); if (!StringUtils.isEmpty(serviceCodeIdString)) { serviceCodeIdString = serviceCodeIdString.trim(); if (serviceCodeIdString.contains("-")) { FmsServiceCode fmsServiceCode = fmsServiceCodeService.findByserviceCode(serviceCodeIdString); if (null != fmsServiceCode) { serviceCodeId = fmsServiceCode.getId(); } else { serviceCodeId = -1L; } } else { try { serviceCodeId = Long.parseLong(serviceCodeIdString); } catch (Exception e) { serviceCodeId = -1L; } } } Page<FmsMessagePageDto> page = fmsMessageService.findPage(batchNumber, title, serviceCodeId, state, sendType, infoType, businessTypeId, saveType, contentTypeId, start, limit, startTime, endTime, userIds, operator); if (page.getList() != null && page.getList().size() > 0) { List<FmsBusinesTypeDto> list = fmsBusinessTypeService.findIds(null); Map<Long, FmsBusinesTypeDto> map = new HashMap<>(); if (list != null && list.size() > 0) { for (FmsBusinesTypeDto fmsBusinesTypeDto : list) { map.put(fmsBusinesTypeDto.getId(), fmsBusinesTypeDto); } } for (FmsMessagePageDto fmsBatchPageDto : page.getList()) { fmsBatchPageDto.setBusinessType(map.get(fmsBatchPageDto.getContentTypeId()).getParentName()); fmsBatchPageDto.setContentType(map.get(fmsBatchPageDto.getContentTypeId()).getName()); fmsBatchPageDto.setChannelReportStr(EucpFmsMessageState.findNameByCode(fmsBatchPageDto.getChannelReportDesc())); } } ResponseUtils.outputWithJson(response, Result.rightResult(page)); } }
[ "cuihuifen@emay.cn" ]
cuihuifen@emay.cn
05defa89f42bcfa17730ba3408ca11b0eb257124
882692341ee924cd51bc3b98dcf848f54c92a0a6
/app/src/main/java/com/hashcode/booker/models/LoginBody.java
cfef3c9da1bca6da121b0dbf924092d736791fc5
[ "Apache-2.0" ]
permissive
Lekky71/Retrofit2Tutorial
a37f155e12a987d0167b189cbf0a51f707bd7180
91488e5538e796eed7d20c83f0a3a6775b68a9c3
refs/heads/master
2020-03-08T03:05:31.821890
2018-04-03T11:25:14
2018-04-03T11:25:14
127,880,782
0
0
null
null
null
null
UTF-8
Java
false
false
618
java
package com.hashcode.booker.models; /** * Created by HashCode on 10:57 AM 03/04/2018. */ public class LoginBody { private String username; private String password; public LoginBody(String username, String password) { this.username = username; this.password = password; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } }
[ "hashilekky@gmail.com" ]
hashilekky@gmail.com
c42ea254f5aa4ee705764f09ed819e015c4269ad
6ff9748df3de756deda7ea34529b356c298d63e7
/bank-txs/src/main/java/com/glarimy/bank/rest/BankController.java
64748538cb815fbdfecc7ba9bd64bca5a1998a70
[]
no_license
deepanshumehtaa/spring-cloud-microservice
50cf4f1ea2ffaff29c727d311069c7f4bb0eb0f0
c592a01de798ab8cd8084d62b73f19dafc197e23
refs/heads/master
2022-11-12T08:14:23.907265
2019-08-01T13:28:54
2019-08-01T13:28:54
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,702
java
package com.glarimy.bank.rest; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.util.UriComponentsBuilder; import com.glarimy.bank.api.Bank; import com.glarimy.bank.api.Transaction; @RestController public class BankController { @Autowired private Bank bank; @PostMapping("/account/{number}/transaction") public ResponseEntity<Transaction> transact(@PathVariable("number") int number, @RequestParam("type") String type, @RequestParam("amount") double amount, UriComponentsBuilder builder) { if (type.equalsIgnoreCase("deposite")) { Transaction tx = bank.deposite(number, amount); HttpHeaders headers = new HttpHeaders(); headers.setLocation( builder.path("/account/{number}/transaction/{id}").buildAndExpand(number, tx.getId()).toUri()); return new ResponseEntity<Transaction>(tx, headers, HttpStatus.CREATED); } else if (type.equalsIgnoreCase("withdraw")) { Transaction tx = bank.withdraw(number, amount); HttpHeaders headers = new HttpHeaders(); headers.setLocation( builder.path("/account/{number}/transaction/{id}").buildAndExpand(number, tx.getId()).toUri()); return new ResponseEntity<Transaction>(tx, headers, HttpStatus.CREATED); } else { return new ResponseEntity<Transaction>(HttpStatus.BAD_REQUEST); } } }
[ "krishna@glarimy.com" ]
krishna@glarimy.com
367d5bbbbe45bc59f41382f9a4df61606b09f8d8
eb08033f6fdf7b38324403ef6a7a4c9b03a6e6a7
/src/main/java/com/huotu/huobanplus/search/utils/Constant.java
ed3abf6561a16548559cd33227d3960fd2dc3043
[]
no_license
huotuinc/mall-search
e0142963bebcad0fc42eadda05ec74c46c76448e
92a35d72fa1c86e52bb909b92e2dea9cc7ab49d4
refs/heads/master
2020-12-25T14:33:19.099982
2017-05-08T02:18:29
2017-05-08T02:18:29
66,435,776
1
2
null
null
null
null
UTF-8
Java
false
false
385
java
package com.huotu.huobanplus.search.utils; /** * 常量定义 * Created by helloztt on 2017-03-02. */ public class Constant { /** * 如果设置太大可能会链接超时,所以把这个字段放在环境变量里面作为可配置项 * 在{@link com.huotu.huobanplus.search.service.ScheduleService}里面初始化 */ public static int PAGE_SIZE = 100; }
[ "347871727@qq.com" ]
347871727@qq.com
f1b60ae965933aaa2315fa287fa40e3ad7c5392e
20338b55e25d4452ce5062113842cfce8e31e874
/linkedDataGraph/src/main/java/mestrado/linkedDataGraph/jms/GeonamesPoint.java
add51f05c7f7da3777d49c1579fa562b5906b948
[]
no_license
matvargas/LinkedOntoGazetteer-labcsx
bba9b50723e7efd15779f3901ff55145b21d58fd
48c5b1ed41dfc9978677449392f86554fd9c5342
refs/heads/master
2021-05-19T09:20:11.920806
2018-03-29T12:52:20
2018-03-29T12:52:20
null
0
0
null
null
null
null
UTF-8
Java
false
false
849
java
package mestrado.linkedDataGraph.jms; public class GeonamesPoint { private String geonamesId; private String latitude; private String longitude; public GeonamesPoint(String geonamesId, String latitude, String longitude) { super(); this.geonamesId = geonamesId; this.latitude = latitude; this.longitude = longitude; } public String getGeonamesId() { return this.geonamesId; } public String getLatitude() { return this.latitude; } public String getLongitude() { return this.longitude; } public void setGeonamesId(String geonamesId) { this.geonamesId = geonamesId; } public void setLatitude(String latitude) { this.latitude = latitude; } public void setLongitude(String longitude) { this.longitude = longitude; } @Override public String toString() { return GsonBuilder.getGson().toJson(this); } }
[ "thvaladares@gmail.com" ]
thvaladares@gmail.com
176a83c8e5866b1f9068a6ce50a4dca9314251cf
52acbc630e80cf76a8a7c7b7c320b7e18d02c580
/src/main/java/sonar/logistics/client/gsi/interactions/text/TextHotKeyFunctions.java
d6873e935daee43ccfe5db6ebf59c09219698351
[]
no_license
SonarSonic/Practical-Logistics-3
2f8d11a9a86545726182dc2121f459332f9c0215
bfd78dee190fef0964470549c3e023ddff3a2a61
refs/heads/master
2021-06-13T03:30:38.550886
2021-05-26T14:51:30
2021-05-26T14:51:30
254,422,436
2
0
null
null
null
null
UTF-8
Java
false
false
5,234
java
package sonar.logistics.client.gsi.interactions.text; import net.minecraft.client.gui.screen.Screen; import net.minecraft.util.text.ITextComponent; import sonar.logistics.client.gsi.components.text.AbstractTextComponent; import sonar.logistics.client.gsi.interactions.GSIInteractionHandler; import sonar.logistics.client.gui.GSIDesignSettings; public enum TextHotKeyFunctions { //cursor move HOME((handler, key, scanCode, mod) -> key == 268 && !handler.hasShiftDown(), interaction -> {interaction.clearSelection(); interaction.moveCursorToStart(interaction.cursor);}),// END((handler, key, scanCode, mod) -> key == 269 && !handler.hasShiftDown(), interaction -> {interaction.clearSelection(); interaction.moveCursorToEnd(interaction.cursor);}),// UP((handler, key, scanCode, mod) -> key == 265 && !handler.hasShiftDown(), interaction -> {interaction.clearSelection(); interaction.moveCursorUp(interaction.cursor);}),// DOWN((handler, key, scanCode, mod) -> key == 264 && !handler.hasShiftDown(), interaction -> {interaction.clearSelection(); interaction.moveCursorDown(interaction.cursor);}),// LEFT((handler, key, scanCode, mod) -> key == 263 && !handler.hasShiftDown(), interaction -> {interaction.clearSelection(); interaction.moveCursorLeft(interaction.cursor);}),// RIGHT((handler, key, scanCode, mod) -> key == 262 && !handler.hasShiftDown(), interaction -> {interaction.clearSelection(); interaction.moveCursorRight(interaction.cursor);}),// HOME_SHIFT((handler, key, scanCode, mod) -> key == 268 && handler.hasShiftDown(), interaction -> {interaction.checkSelection(); interaction.moveCursorToStart(interaction.selectionEnd);}),// END_SHIFT((handler, key, scanCode, mod) -> key == 269 && handler.hasShiftDown(), interaction -> {interaction.checkSelection(); interaction.moveCursorToEnd(interaction.selectionEnd);}),// UP_SHIFT((handler, key, scanCode, mod) -> key == 265 && handler.hasShiftDown(), interaction -> {interaction.checkSelection(); interaction.moveCursorUp(interaction.selectionEnd);}),// DOWN_SHIFT((handler, key, scanCode, mod) -> key == 264 && handler.hasShiftDown(), interaction -> {interaction.checkSelection(); interaction.moveCursorDown(interaction.selectionEnd);}),// LEFT_SHIFT((handler, key, scanCode, mod) -> key == 263 && handler.hasShiftDown(), interaction -> {interaction.checkSelection(); interaction.moveCursorLeft(interaction.selectionEnd);}),// RIGHT_SHIFT((handler, key, scanCode, mod) -> key == 262 && handler.hasShiftDown(), interaction -> {interaction.checkSelection(); interaction.moveCursorRight(interaction.selectionEnd);}),// //selection move //format changes BOLD((handler, key, scanCode, mod) -> key == 78 && handler.hasControlDown() && !handler.hasShiftDown() && !handler.hasAltDown(), interaction -> GSIDesignSettings.toggleBoldStyling()),// ITALIC((handler, key, scanCode, mod) -> key == 73 && handler.hasControlDown() && !handler.hasShiftDown() && !handler.hasAltDown(), interaction -> GSIDesignSettings.toggleItalicStyling()),// UNDERLINE((handler, key, scanCode, mod) -> key == 85 && handler.hasControlDown() && !handler.hasShiftDown() && !handler.hasAltDown(), interaction -> GSIDesignSettings.toggleUnderlineStyling()),// OBFUSCATED((handler, key, scanCode, mod) -> key == 79 && handler.hasControlDown() && !handler.hasShiftDown() && !handler.hasAltDown(), interaction -> GSIDesignSettings.toggleObfuscatedStyling()),// ENTER((handler, key, scanCode, mod) -> key == 257 && !handler.hasShiftDown(), StandardTextInteraction::enter),// COPY((handler, key, scanCode, mod) -> Screen.isCopy(key), StandardTextInteraction::copy),// PASTE((handler, key, scanCode, mod) -> Screen.isPaste(key), StandardTextInteraction::paste),// CUT((handler, key, scanCode, mod) -> Screen.isCut(key), StandardTextInteraction::cut),// BACKSPACE((handler, key, scanCode, mod) -> key == 259, i -> i.deleteGlyph(true)),// DEL((handler, key, scanCode, mod) -> key == 261, i -> i.deleteGlyph(false)),// //no line required //SAVE((key, scanCode, mod) -> key == Keyboard.KEY_S && GuiScreen.isCtrlKeyDown() && !GuiScreen.isShiftKeyDown() && !GuiScreen.isAltKeyDown(), (gui, chr, key) -> gui.save()),// SELECT_ALL((handler, key, scanCode, mod) -> Screen.isSelectAll(key), StandardTextInteraction::selectAll); // //DESELECT_ALL((key, scanCode, mod) -> c == 4, (gui, chr, key) -> GuiActions.DESELECT_ALL.trigger(gui)); // public IKeyMatch key; public ITextFunction textFunction; TextHotKeyFunctions(IKeyMatch key, ITextFunction textFunction) { this.key = key; this.textFunction = textFunction; } public static boolean triggerHotKey(StandardTextInteraction textInteraction, GSIInteractionHandler handler, int key, int scanCode, int modifiers) { for (TextHotKeyFunctions func : TextHotKeyFunctions.values()) { if (func.key.canTrigger(handler, key, scanCode, modifiers)) { func.textFunction.trigger(textInteraction); return true; } } return false; } @FunctionalInterface public interface IKeyMatch { boolean canTrigger(GSIInteractionHandler handler, int key, int scanCode, int modifiers); } @FunctionalInterface public interface ITextFunction { void trigger(StandardTextInteraction<AbstractTextComponent> textInteraction); } }
[ "ollielansdell@hotmail.co.uk" ]
ollielansdell@hotmail.co.uk
40aad7199299bb484ca9e33ba897860c1c222ea1
b3127a84c8ff7398418c8b566fc20f8ed6fba351
/src/main/java/com/example/ivan/ewatch/DeviceList.java
9195c1f4c6a6382e1794cf5e9a155b898021f8e5
[ "MIT" ]
permissive
dylodylo/E-paperSmartwatch
dc14fdfb1c29b914985cca77cddbf9c73a885ed7
81646660eaad8980555f174ddabbdac3c64a1051
refs/heads/master
2020-03-19T04:38:14.002151
2018-06-19T04:18:54
2018-06-19T04:18:54
135,848,706
0
0
null
2018-06-02T20:07:03
2018-06-02T20:07:03
null
UTF-8
Java
false
false
2,882
java
package com.example.ivan.ewatch; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.ListView; import android.widget.TextView; import android.widget.Toast; import java.util.ArrayList; import java.util.Set; public class DeviceList extends AppCompatActivity { Button btnPaired; ListView devicelist; private BluetoothAdapter myBluetooth = null; private Set<BluetoothDevice> pairedDevices; public static String EXTRA_ADDRESS="device_address"; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_device_list); btnPaired=(Button) findViewById(R.id.button); devicelist=(ListView) findViewById(R.id.listView); myBluetooth = BluetoothAdapter.getDefaultAdapter(); if(myBluetooth==null) { Toast.makeText(getApplicationContext(),"Bluetooth device not available",Toast.LENGTH_LONG).show(); finish(); } else if (!myBluetooth.isEnabled()) { Intent turnButton = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); startActivityForResult(turnButton,1); } btnPaired.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { pairedDevicesList(); } }); } private void pairedDevicesList () { pairedDevices = myBluetooth.getBondedDevices(); ArrayList list = new ArrayList(); if ( pairedDevices.size() > 0 ) { for ( BluetoothDevice bt : pairedDevices ) { list.add(bt.getName().toString() + "\n" + bt.getAddress().toString()); } } else { Toast.makeText(getApplicationContext(), "No Paired Bluetooth Devices Found.", Toast.LENGTH_LONG).show(); } final ArrayAdapter adapter = new ArrayAdapter(this, android.R.layout.simple_list_item_1, list); devicelist.setAdapter(adapter); devicelist.setOnItemClickListener(myListClickListener); } private AdapterView.OnItemClickListener myListClickListener = new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { String info = ((TextView) view).getText().toString(); String address = info.substring(info.length()-17); Intent i = new Intent(DeviceList.this, Main.class); i.putExtra(EXTRA_ADDRESS, address); startActivity(i); } }; }
[ "novgorodtsev@wp.pl" ]
novgorodtsev@wp.pl
9fe9ffa70d06ea7cd20a463a64b8fbb1d4ac768d
1be663e957013cfa5a887f66687d4d4ea1664489
/src/test/java/br/com/exemplo/aula/dao/ProdutoDAOTest.java
e6607b54f7700b38bd2508d17c221077ac349571
[]
no_license
Gesiel-Diniz/JavaEE
62279be7fd04e6578d4f46c198bb60b26e3cbf9c
ac5c984a7f209f3b435e24b3b4df97cb9865e5ac
refs/heads/master
2020-03-29T03:52:37.957307
2018-09-21T05:00:12
2018-09-21T05:00:12
149,504,840
0
0
null
null
null
null
UTF-8
Java
false
false
2,480
java
package br.com.exemplo.aula.dao; import java.math.BigDecimal; import java.util.List; import org.junit.Ignore; import org.junit.Test; import br.com.exemplo.aula.domain.Fabricante; import br.com.exemplo.aula.domain.Produto; public class ProdutoDAOTest { @Test @Ignore public void salvar(){ FabricanteDAO fabricanteDAO = new FabricanteDAO(); Fabricante fabricante = fabricanteDAO.buscar(3L); if (fabricante != null) { Produto produto = new Produto(); produto.setDescricao("Teste 30mg"); produto.setFabricante(fabricante); produto.setPreco(new BigDecimal("15.90")); produto.setQuantidade(new Short("3")); ProdutoDAO produtoDAO = new ProdutoDAO(); produtoDAO.salvar(produto); System.out.println("Produto cadastrado com sucesso!"); }else{ System.out.println("Produto não pode ser cadastrado!"); } } @Test @Ignore public void listar(){ ProdutoDAO produtoDAO = new ProdutoDAO(); List<Produto> resultado = produtoDAO.listar(); for(Produto produto: resultado){ System.out.println(produto.getCodigo()+" "+produto.getDescricao()+" "+produto.getQuantidade()+" "+produto.getPreco()+" "+produto.getFabricante().getDescricao()); } } @Test @Ignore public void buscar(){ ProdutoDAO produtoDAO = new ProdutoDAO(); Produto produto = produtoDAO.buscar(2L); System.out.println(produto.getCodigo()+" "+produto.getDescricao()+" "+produto.getQuantidade()+" "+produto.getPreco()+" "+produto.getFabricante().getDescricao()); } @Test @Ignore public void excluir(){ ProdutoDAO produtoDAO = new ProdutoDAO(); Produto produto = produtoDAO.buscar(3L); if(produto != null){ produtoDAO.excluir(produto); System.out.println("Produto excluido com sucesso!"); }else{ System.out.println("Produto não pode ser excluido!"); } } @Test @Ignore public void editar(){ ProdutoDAO produtoDAO = new ProdutoDAO(); Produto produto = produtoDAO.buscar(5L); if(produto != null){ FabricanteDAO fabricanteDAO = new FabricanteDAO(); Fabricante fabricante = fabricanteDAO.buscar(1L); produto.setFabricante(fabricante); produto.setDescricao("Dipirona 150mg"); produto.setPreco(new BigDecimal("12.90")); produto.setQuantidade(new Short("34")); produtoDAO.editar(produto); System.out.println("Produto editado com sucesso!"); }else{ System.out.println("Produto não pode ser editado!"); } } }
[ "gesiel.diniz@gmail.com" ]
gesiel.diniz@gmail.com
aa320aacfb27b6bf43bb5e47ab4c7e0aeb17a0d0
097fee3298509ef5b9ba492cb395bbd24775ae0e
/Week_03/组合77.java
b9ae29d92882daf0c6b02c724f189367b5b6a114
[]
no_license
Quan-heng/algorithm024
824909f7b99efb423be93b5aab0ff056e122d3f3
a6d37978a883d32e49a43341f2ea0811ae830c2b
refs/heads/main
2023-04-06T03:53:14.271312
2021-04-11T03:03:02
2021-04-11T03:03:02
334,546,824
0
0
null
2021-01-31T01:13:20
2021-01-31T01:13:19
null
UTF-8
Java
false
false
1,087
java
import java.util.ArrayList; import java.util.Deque; import java.util.LinkedList; import java.util.List; /** * 解题思路:回溯 * 1->2,3,4 * 2->3,4 * 3->4 */ public class 组合77 { public static void main(String[] args) { System.out.println(combine(4, 2)); } public static List<List<Integer>> combine(int n, int k) { List<List<Integer>> result = new ArrayList<>(); if (n < k) { return result; } if (k == 0) { return result; } Deque<Integer> list = new LinkedList<>(); dfs(n, k, 1, list, result, 0); return result; } private static void dfs(int n, int k, int begin, Deque<Integer> list, List<List<Integer>> result, int depth) { if (depth == k) { result.add(new ArrayList<>(list)); return; } for (int i = begin; i <= n; i++) { list.add(i); dfs(n, k, i + 1, list, result, depth + 1); //reverse,回溯到上一步,重新组合 list.removeLast(); } } }
[ "15364446581@163.com" ]
15364446581@163.com
ce8564f0ca28200f5e75c3e9ffc2f35de1f5afad
58da82eb5f274657c33969952638ade1bd7edf5e
/src/jnn/functions/nlp/misc/readers/ParallelFormatReader.java
25503871b9eebb05b937cd8dc90e0fc358d4632c
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
githubNoob74/JNN
5c797f2019b3263fa86900f434c780d5484074a3
c4f75774112e89542961f50b86c86d0d3dc9817c
refs/heads/master
2021-01-19T09:20:43.702285
2016-09-06T06:27:53
2016-09-06T06:27:53
67,412,666
0
0
null
2016-09-05T10:47:16
2016-09-05T10:47:16
null
UTF-8
Java
false
false
715
java
package jnn.functions.nlp.aux.readers; import java.util.ArrayList; import jnn.functions.nlp.aux.input.LabelledSentence; import util.IOUtils; public class ParallelFormatReader { public static void read(String file, LabelledReaderCallback cb) { IOUtils.iterateFiles(new String[]{file}, new IOUtils.iterateFilesCallback(){ @Override public void cb(String[] lines, int lineNumber) { String line = lines[0]; String[] sourceTarget = line.split("\\s+\\|\\|\\|\\s+"); if(sourceTarget.length>0){ String[] textTokens = sourceTarget[0].split("\\s+"); String[] tagTokens = sourceTarget[1].split("\\s+"); cb.cb(new LabelledSentence(line, textTokens, tagTokens)); } } }); } }
[ "wanglin1122@gmail.com" ]
wanglin1122@gmail.com
163d1a3bcd0e6b70cdcdb8d4b6854061cf7ed609
d66bf8d0b259fd13fda80231e49fddb6457cba71
/java/leetcode/MergeIntervals_56.java
e21d2da047d7635a2d1ecd881e14ad40de67b50a
[ "Apache-2.0" ]
permissive
javayhu/XSolutions
8d7be8eba7280f4c1442d3a534f0f164003d70cd
d132a5f52a050ccfc01e83787eaaa4e2803ad43f
refs/heads/master
2021-05-30T06:43:06.717353
2015-12-21T13:03:46
2015-12-21T13:03:46
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,637
java
import java.util.*; /** * hujiawei 15/5/2 * <p/> * 模拟 * <p/> * https://leetcode.com/problems/merge-intervals/ */ public class MergeIntervals_56 { public static void main(String[] args) { List<Interval> intervals = new ArrayList<Interval>(); intervals.add(new Interval(3, 5)); intervals.add(new Interval(1, 2)); intervals.add(new Interval(4, 9)); List<Interval> list = new MergeIntervals_56().merge(intervals); System.out.println(list.size()); } //ac https://leetcode.com/discuss/33434/a-clean-java-solution public List<Interval> merge(List<Interval> intervals) { Collections.sort(intervals, new Comparator<Interval>() { @Override public int compare(Interval obj0, Interval obj1) { return obj0.start - obj1.start; } }); List<Interval> ret = new ArrayList<Interval>(); Interval prev = null; for (Interval inter : intervals) { if (prev == null || inter.start > prev.end) { ret.add(inter); prev = inter; } else if (inter.end > prev.end) { // Modify the element already in list prev.end = inter.end; } } return ret; } //超时 public List<Interval> merge2(List<Interval> intervals) { LinkedList<Interval> list = new LinkedList<Interval>(); if (intervals == null || intervals.size() == 0) return list; Collections.sort(intervals, new Comparator<Interval>() { @Override public int compare(Interval o1, Interval o2) { return o1.start - o2.start;//按照start升序排列 } }); list.add(intervals.get(0)); Interval last, cur; for (int i = 1; i < intervals.size(); i++) { last = intervals.get(i - 1);//每次当前区间插入时需要考虑的只有前面的区间 cur = intervals.get(i); //hujiawei 超时的原因在于这里存在着太多的添加删除操作!而ac的代码只是修改数据! if (cur.start > last.end) { list.addLast(cur); } else { list.removeLast(); list.add(new Interval(last.start, Math.max(last.end, cur.end))); } } return list; } static class Interval { int start; int end; Interval() { start = 0; end = 0; } Interval(int s, int e) { start = s; end = e; } } }
[ "hujiawei090807@gmail.com" ]
hujiawei090807@gmail.com
3b5e4b438dde866e417f3524980a680b9eaf4f16
48e9417bdaea01ac943574a145d156df66516a04
/tema-1/src/mas/ssatr/vilcica/adela/Simulator.java
959ad9190205865373b627a52ad40b6843efbabf
[]
no_license
vilcica/iaisc-2020-ssatr-31211-vilcica-adela
87ae9e0ee0bdae966527dc01fd5117cbb7798d0c
df2d704a422d4fd3fcaba9ebe38ac244c3dae85e
refs/heads/master
2023-01-29T23:17:45.570392
2020-12-13T20:52:16
2020-12-13T20:52:16
299,687,539
0
0
null
null
null
null
UTF-8
Java
false
false
4,685
java
package mas.ssatr.vilcica.adela; import java.io.*; import java.util.ArrayList; import java.util.List; public class Simulator { private int clock = 0; private Place place = new Place(); private Loder loder = new Loder(); private PetriNet petriNet = loder.load(); private List<String> initialMark = new ArrayList<>(); private PrintWriter printWriter = new PrintWriter(new File("src/output.txt")); private int clockTick; public Simulator(int clockTick) throws FileNotFoundException { this.clockTick = clockTick; } private List<String> setInitialMark(PetriNet petriNet) { printWriter.write("Initial Mark: "); for (int i = 0; i < petriNet.getPlaces().size(); i++) { place = petriNet.getPlaces().get(i); initialMark.add(place.getNume() + ":" + place.getNrjet()); printWriter.write(place.getNume() + ":" + place.getNrjet()+" "); } printWriter.write("\n"); System.out.println(initialMark); return initialMark; } private boolean checkTransition(Tranzition tranzition) { if (tranzition.getIn().size() == 0) { return false; } for (int i = 0; i < tranzition.getIn().size(); i++) { if (getLocationName(tranzition.getIn().get(i)) != null) { place = getLocationName(tranzition.getIn().get(i)); if (place.getNrjet() == 0) { return false; } } } return true; } private Place getLocationName(String name) { for (int i = 0; i < petriNet.getPlaces().size(); i++) { place = petriNet.getPlaces().get(i); if (place.getNume().equals(name)) { return place; } } return null; } public void simulate(PetriNet petriNet) { setInitialMark(petriNet); while (clockTick > 0) { for (int i = 0; i < petriNet.getTranzitions().size(); i++) { Tranzition tranzition = petriNet.getTranzitions().get(i); if (tranzition.getDurata() > 0) { tranzition.setDurata(tranzition.getDurata() - 1); } if (tranzition.getNrjet() == 0) { if (checkTransition(tranzition)) {// && (getLocationName( tranzition.getOut().toString()) != null)) { tackeJetonFromIn(tranzition); } } } for (int i = 0; i < petriNet.getTranzitions().size(); i++) { Tranzition tranzition = petriNet.getTranzitions().get(i); putJetonOut(tranzition); } write(); clockTick--; } printWriter.flush(); printWriter.close(); } private void putJetonOut(Tranzition tranzition) { if (tranzition.getDurata() == 0) { if (tranzition.getNrjet() != 0) { tranzition.setNrjet(tranzition.getNrjet() - 1); for (int i = 0; i < tranzition.getOut().size(); i++) { Place place = getLocationName(tranzition.getOut().get(i)); place.setNrjet(place.getNrjet() + 1); } } } } private void tackeJetonFromIn(Tranzition tranzition) { for (int i = 0; i < tranzition.getIn().size(); i++) { Place place = getLocationName(tranzition.getIn().get(i)); if (place.getNrjet() != 0) { place.setNrjet(place.getNrjet() - 1); } } tranzition.setNrjet(tranzition.getNrjet() + 1); int durata = (int) (Math.random() * (tranzition.getMaxd() - tranzition.getMind()) + tranzition.getMind()); tranzition.setDurata(durata); } private void write() { printWriter.write("Clock: " + clock + " Mark: "); System.out.print("Clock: " + clock + " "); for (Place place : petriNet.getPlaces()) { System.out.print(place.getNume() + ":" + place.getNrjet() + " "); printWriter.write( place.getNrjet() + " "); } System.out.println(); printWriter.write("\n"); try { Thread.sleep(1000); clock = clock + 1; } catch (InterruptedException ex) { ex.printStackTrace(); } } public PetriNet getPetriNet() { return petriNet; } public static void main(String[] args) throws FileNotFoundException { Simulator simulator = new Simulator(11); PetriNet petriNet = simulator.getPetriNet(); simulator.simulate(petriNet); } }
[ "vadela21@gmail.com" ]
vadela21@gmail.com
c64ae0fa5bffcd5a51ee051058811bcba5c7e672
a95eba6c79375e7a6f068104d405613a52fe0fa5
/BiglyBT/src/main/java/com/biglybt/android/client/FragmentM.java
73366c79ebe9eefe32e9906ab5e686e37a6d5982
[]
no_license
coen22/BiglyBT-Android
56420008515808d3118f8775c73e164c3a635f6e
16ec11198b339c2e2f1d0d417d93748e59729135
refs/heads/master
2020-04-10T14:43:19.971179
2018-12-12T12:55:22
2018-12-12T12:55:22
161,085,567
0
0
null
2018-12-09T22:03:50
2018-12-09T22:03:49
null
UTF-8
Java
false
false
6,584
java
/* * Copyright (c) Azureus Software, Inc, All Rights Reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * This program 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 General Public License for more details. * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ package com.biglybt.android.client; import java.util.Arrays; import android.annotation.SuppressLint; import android.content.pm.PackageManager; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.v4.app.ActivityCompat; import android.support.v4.app.Fragment; import android.support.v4.util.LongSparseArray; import android.util.Log; /** * Fragment with permission handing methods * * Created by TuxPaper on 3/18/16. * <p/> * Duplicate code in {@link AppCompatActivityM} */ public class FragmentM extends Fragment { private int requestPermissionID = 0; private final LongSparseArray<Runnable[]> requestPermissionRunnables = new LongSparseArray<>(); private String classSimpleName; private class PermissionRequestResults { final String[] permissions; final int[] grantResults; public PermissionRequestResults(String[] permissions, int[] grantResults) { this.permissions = permissions; this.grantResults = grantResults; } } private LongSparseArray<PermissionRequestResults> requestPermissionResults = null; private boolean isPaused; public void requestPermissions(String[] permissions, Runnable runnableOnGrant, @Nullable Runnable runnableOnDeny) { // requestPermissions supposedly does checkSelfPermission for us, but // I get prompted anyway, and clicking Revoke (on an already granted perm): // I/ActivityManager: Killing xxxx:com.vuze.android.client/u0a24 (adj 1): permissions revoked // Also, requestPermissions assumes PERMISSION_REVOKED on unknown // permission strings (ex READ_EXTERNAL_STORAGE on API 7) boolean allGranted = true; if (permissions.length > 0) { PackageManager packageManager = getContext().getPackageManager(); for (String permission : permissions) { try { packageManager.getPermissionInfo(permission, 0); } catch (PackageManager.NameNotFoundException e) { Log.d("Perms", "requestPermissions: Permission " + permission + " doesn't exist. Assuming granted."); continue; } if (ActivityCompat.checkSelfPermission(getContext(), permission) != PackageManager.PERMISSION_GRANTED) { allGranted = false; break; } } } if (allGranted) { if (AndroidUtils.DEBUG) { Log.d("Perms", "requestPermissions: allGranted (" + Arrays.toString(permissions) + ", running " + runnableOnGrant); } if (runnableOnGrant != null) { runnableOnGrant.run(); } return; } if (AndroidUtils.DEBUG) { Log.d("Perms", "requestPermissions: requesting " + Arrays.toString(permissions) + " for " + runnableOnGrant); } requestPermissionRunnables.put(requestPermissionID, new Runnable[] { runnableOnGrant, runnableOnDeny }); requestPermissions(permissions, requestPermissionID); requestPermissionID++; } @Override public void onPause() { isPaused = true; super.onPause(); } @Override public void onResume() { isPaused = false; super.onResume(); // https://code.google.com/p/android/issues/detail?id=190966 if (requestPermissionResults != null && requestPermissionRunnables.size() > 0) { synchronized (requestPermissionRunnables) { for (int i = 0; i < requestPermissionResults.size(); i++) { long requestCode = requestPermissionResults.keyAt(i); PermissionRequestResults results = requestPermissionResults.get( requestCode); if (results != null) { onRequestPermissionsResult((int) requestCode, results.permissions, results.grantResults); } } requestPermissionResults = null; } } } @Override public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { super.onRequestPermissionsResult(requestCode, permissions, grantResults); Runnable[] runnables = requestPermissionRunnables.get(requestCode); if (runnables != null) { if (isPaused) { // https://code.google.com/p/android/issues/detail?id=190966 // our onResume will call this function again, when it's safe for the // runnables to open dialogs if they want if (requestPermissionResults == null) { requestPermissionResults = new LongSparseArray<>(); } requestPermissionResults.put(requestCode, new PermissionRequestResults(permissions, grantResults)); return; } requestPermissionRunnables.remove(requestCode); boolean allGranted = grantResults.length > 0; if (allGranted) { for (int grantResult : grantResults) { if (grantResult != PackageManager.PERMISSION_GRANTED) { allGranted = false; break; } } } if (AndroidUtils.DEBUG) { Log.d("Perms", "onRequestPermissionsResult: " + Arrays.toString(permissions) + " " + (allGranted ? "granted" : "revoked") + " for " + runnables[0]); } if (allGranted && runnables[0] != null) { runnables[0].run(); return; } if (!allGranted && runnables[1] != null) { runnables[1].run(); return; } } } @Override public void onStart() { super.onStart(); AnalyticsTracker.getInstance(this).fragmentResume(this); } @Override public void onStop() { super.onStop(); AnalyticsTracker.getInstance(this).fragmentPause(this); } @SuppressLint("LogConditional") public void log(String TAG, String s) { if (classSimpleName == null) { classSimpleName = AndroidUtils.getSimpleName(getClass()) + "@" + Integer.toHexString(hashCode()); } Log.d(classSimpleName, TAG + ": " + s); } @SuppressLint("LogConditional") public void log(int prority, String TAG, String s) { if (classSimpleName == null) { classSimpleName = AndroidUtils.getSimpleName(getClass()) + "@" + Integer.toHexString(hashCode()); } Log.println(prority, classSimpleName, TAG + ": " + s); } }
[ "725353+TuxPaper@users.noreply.github.com" ]
725353+TuxPaper@users.noreply.github.com
f859d3ca483a12a305fbebde50c7e5d21c93f8f8
ba0294cb97b37ae2ab3ec7f32f4e0ad15396876d
/java/src/main/java/com/techelevator/controller/CheckInController.java
99c456bf2d3154b43966acf483e20656b8fb4f8f
[]
no_license
dancheatle/walk-philly
38d5c1262e8326c03b6332ece8acf3d1bf87b8bd
9cc60ee5d8be0f31abe5a5bd23d1b2c2fe1e2919
refs/heads/main
2023-07-16T04:13:58.068804
2021-09-01T16:02:53
2021-09-01T16:02:53
402,122,554
0
0
null
null
null
null
UTF-8
Java
false
false
1,143
java
package com.techelevator.controller; import com.techelevator.dao.CheckInDao; import com.techelevator.model.CheckIn; import org.springframework.http.HttpStatus; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import java.util.List; @RestController @PreAuthorize("isAuthenticated()") @CrossOrigin public class CheckInController { private CheckInDao checkInDao; public CheckInController(CheckInDao checkInDao) { this.checkInDao = checkInDao; } @RequestMapping(path = "/profile/{id}", method = RequestMethod.GET) public List<CheckIn> getCheckIns(@PathVariable int id) { List<CheckIn> checkIns = checkInDao.getCheckInsByUserId(id); return checkIns; } //Maybe need an Id Path Variable @ResponseStatus(HttpStatus.CREATED) @RequestMapping(path = "/results/checkIn", method = RequestMethod.POST) public void postCheckIn(@RequestBody CheckIn checkIn) { try { checkInDao.createCheckIn(checkIn); } catch (Exception ex) { System.out.println(ex.getMessage()); } } }
[ "dancheatle@gmail.com" ]
dancheatle@gmail.com
0ce6b45c95252f936dc60acc9c592fddb5776e96
5aabcaa98a90bf3818b944d13a6941dc21125270
/authprovider/src/test/java/com/cnpc/iam/java/web/auth/oauth/jersey/util/TestServiceTest.java
db5bd5627511c5d8c688af69c3e694e7bc055228
[]
no_license
zhouheng2017/auth-dubbo-service
03c778f68017e791ead000244eb3b7a7076e2ce8
3aae22d3f9823f2c8fcc0087bf569a395a55a97a
refs/heads/master
2021-06-30T09:23:03.707718
2017-09-20T02:39:12
2017-09-20T02:39:12
104,051,083
0
0
null
null
null
null
UTF-8
Java
false
false
621
java
package com.cnpc.iam.java.web.auth.oauth.jersey.util; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; import java.io.IOException; public class TestServiceTest { public static void main(String[] args) { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("application.xml"); context.start(); System.out.println("提供者服务已经注册成功"); try { System.in.read(); } catch (IOException e) { e.printStackTrace(); } } }
[ "zhouheng" ]
zhouheng