blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
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
689M
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
131 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
32 values
content
stringlengths
3
9.45M
authors
listlengths
1
1
author_id
stringlengths
0
313
4c1f40f09742774f0c906d515b0edd1387d45e31
f98304d6eb532501e888e34c5f47d1dea20fc476
/src/main/java/com/yousry/bookstore/security/JwtUtil.java
b7a725993b690682eaadd30e810c0774ae6217fc
[]
no_license
yousry-ibrahim/bookstore
40d7c7e2778293cf4be33d1f3dd6cb30d991dc8f
1bb75a916f5e8c14ffc9e78d52b8f2c085842aa8
refs/heads/master
2023-04-19T05:51:39.954678
2021-05-05T21:41:31
2021-05-05T21:41:31
364,679,657
0
0
null
null
null
null
UTF-8
Java
false
false
2,249
java
package com.yousry.bookstore.security; import com.yousry.bookstore.dal.domainobject.User; import com.yousry.bookstore.service.UserService; import io.jsonwebtoken.Claims; import io.jsonwebtoken.Jwts; import io.jsonwebtoken.SignatureAlgorithm; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import javax.crypto.spec.SecretKeySpec; import javax.xml.bind.DatatypeConverter; import java.io.Serializable; import java.security.Key; import java.util.Calendar; import java.util.Date; @Component @AllArgsConstructor @NoArgsConstructor @Data public class JwtUtil implements Serializable { private static final long serialVersionUID = -2550198745626007488L; private final String secret = "SMARTDXB"; private SignatureAlgorithm signatureAlgorithm = SignatureAlgorithm.HS256; private final long expirationMillSec = 300000; // 5 min @Autowired private UserService userService; public User validateToken(String token) { try { Claims claims = Jwts.parser() .setSigningKey(DatatypeConverter.parseBase64Binary(secret)) .parseClaimsJws(token).getBody(); String userName = claims.getSubject(); User user = userService.getUser(userName); if (user != null) return user; else return null; } catch (Exception e) { return null; } } public String generateToken(String name) { byte[] apiKeySecretBytes = DatatypeConverter.parseBase64Binary(secret); Key signingKey = new SecretKeySpec(apiKeySecretBytes, signatureAlgorithm.getJcaName()); Claims claims = Jwts.claims().setSubject(name); Calendar exp = Calendar.getInstance(); exp.setTimeInMillis(System.currentTimeMillis() + expirationMillSec); return Jwts.builder() .setClaims(claims) .setIssuedAt(new Date()) // now .setExpiration(exp.getTime()) // Expiration date .signWith(signatureAlgorithm, signingKey) .compact(); } }
54a7b976b361619b172281b83929efe6ca6cfdaa
42d5351a19392d467ccb90035c016f546e0090d4
/simple_text_editor.java
af613c09443e88ba55e10586314d0a7741765adb
[]
no_license
Tapszvidzwa/CodeChallenges
de4948e07b8cfa6df14015dec615b1e37193f9f6
822aaba581ea16707d4d4bbb2da212f595495fda
refs/heads/master
2018-12-21T18:39:18.313120
2018-09-29T23:58:54
2018-09-29T23:58:54
72,793,306
0
0
null
null
null
null
UTF-8
Java
false
false
4,304
java
/* In this challenge, you must implement a simple text editor. Initially, your editor contains an empty string, . You must perform operations of the following types: append - Append string to the end of . delete - Delete the last characters of . print - Print the character of . undo - Undo the last (not previously undone) operation of type or , reverting to the state it was in prior to that operation. Input Format The first line contains an integer, , denoting the number of operations. Each line of the subsequent lines (where ) defines an operation to be performed. Each operation starts with a single integer, (where ), denoting a type of operation as defined in the Problem Statement above. If the operation requires an argument, is followed by its space-separated argument. For example, if and , line will be 1 abcd. Constraints The sum of the lengths of all in the input . The sum of over all delete operations . All input characters are lowercase English letters. It is guaranteed that the sequence of operations given as input is possible to perform. Output Format Each operation of type must print the character on a new line. Sample Input 8 1 abc 3 3 2 3 1 xy 3 2 4 4 3 1 Sample Output c y a Explanation Initially, is empty. The following sequence of operations are described below: . We append to , so . Print the character on a new line. Currently, the character is c. Delete the last characters in (), so . Append to , so . Print the character on a new line. Currently, the character is y. Undo the last update to , making empty again (i.e., ). Undo the next to last update to (the deletion of the last characters), making . Print the character on a new line. Currently, the character is a. */ import java.io.*; import java.util.*; import java.text.*; import java.math.*; import java.util.regex.*; public class Solution { public static boolean prev_del = false; public static void main(String[] args) { Scanner scan = new Scanner(System.in); int num_operations = scan.nextInt(); Stack<String> stack = new Stack<String>(); for(int i = 0; i < num_operations; i++) { int op_type = scan.nextInt(); switch(op_type) { //append case 1: append(scan, stack); break; //delete case 2: delete(scan, stack); break; //print case 3: print(scan, stack); break; //undo case 4: undo(stack); break; } } } public static void append(Scanner scan, Stack<String> stack) { String str = scan.next(); String input; if(!stack.isEmpty()) { input = stack.peek() + str; } else { input = str; } stack.push(input); return; } public static void delete(Scanner scan, Stack<String> stack) { int num_del = scan.nextInt(); String old_str, new_str; if(!stack.isEmpty()) { old_str = stack.peek(); } else { old_str = ""; } new_str = old_str.substring(0, old_str.length() - num_del); stack.push(new_str); return; } public static void print(Scanner scan, Stack<String> stack) { int pos = scan.nextInt(); if(!stack.isEmpty()) { String topInput = stack.peek(); System.out.println(topInput.charAt(pos - 1)); } return; } public static void undo(Stack<String> stack) { String s = stack.pop(); return; } public static void print(Stack<String> stack) { Iterator iter = stack.iterator(); System.out.print("STACK: "); while(iter.hasNext()) { System.out.print("[" + iter.next() + "] "); } System.out.println(); } }
aa2152caee81dcf7c8fbc78f76cc596ee520ca1a
14b195a6f46f0b5f4e2c843872bb72a621937405
/app/src/main/java/com/bx/philosopher/presenter/BookShelfPresenter.java
5ffbc01efc2fa43f9c53f58568163b25a54f6344
[ "MIT" ]
permissive
leeef/Novel
23765fe97e51cdbf7cfffe66946ec671e1060e4e
4d06403bbb8783b2273d2905f29645b3adb0676f
refs/heads/master
2020-08-01T13:39:57.795983
2019-10-13T02:19:20
2019-10-13T02:19:20
211,011,257
0
0
null
null
null
null
UTF-8
Java
false
false
2,182
java
package com.bx.philosopher.presenter; import com.bx.philosopher.base.activity.BasePresenter; import com.bx.philosopher.model.bean.response.BaseResponse; import com.bx.philosopher.model.bean.response.BookBean; import com.bx.philosopher.net.BaseObserver; import com.bx.philosopher.net.HttpUtil; import com.bx.philosopher.net.RxScheduler; import com.bx.philosopher.presenter.imp.BookShelfImp; import com.bx.philosopher.utils.login.LoginUtil; import java.util.ArrayList; import java.util.List; /** * @Description: 书架 * @Author: leeeef * @CreateDate: 2019/5/17 15:40 */ public class BookShelfPresenter extends BasePresenter<BookShelfImp.View> implements BookShelfImp.Presenter { /** * @Description: 删除书籍 */ @Override public void delete(List<BookBean> book) { List<Integer> bids = new ArrayList<>(); for (BookBean bookBean : book) { bids.add(bookBean.getId()); } HttpUtil.getInstance().getRequestApi().deleteBookFromBookShelf(LoginUtil.getUserId(), bids) .compose(RxScheduler.Obs_io_main()) .subscribe(new BaseObserver<BaseResponse<Integer>>(mView) { @Override public void onSuccess(BaseResponse<Integer> o) { mView.deleteDone(o.getData()); } @Override public void onError(String msg) { } }); } /** * @Description: 获取数据 */ @Override public void getData() { HttpUtil.getInstance().getRequestApi().getBookShelf(LoginUtil.getUserId()) .compose(RxScheduler.Obs_io_main()) .subscribe(new BaseObserver<BaseResponse<List<BookBean>>>(mView) { @Override public void onSuccess(BaseResponse<List<BookBean>> o) { mView.refresh(o.getData()); } @Override public void onError(String msg) { } }); } /** * @Description: 添加 */ public void addData() { } }
41002309553a8f6dd2c219ae24cff6b26ab688d5
4376d9c0bf4e979fc74c05c2097f6f540eab2cd3
/src/main/java/com/zj/heuristic/Algorithm_HeuPlus.java
c8c3775521ab33195d8ea02bfe8d9ec51b3e16c2
[ "Apache-2.0" ]
permissive
liucesugoods1986/minnfv-jung-opl
298261cb8d18b1f21d4e7903ceccbff8456470ad
4400983bfc3696a42818aaaa9c012f4d746bf4a7
refs/heads/master
2023-04-07T06:03:19.651554
2019-03-22T06:51:05
2019-03-22T06:51:05
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,886
java
package com.zj.heuristic; import com.zj.network.Demands; import com.zj.network.Node; import com.zj.network.Topology; import com.zj.solution.Solution; import com.zj.solution.VM; public class Algorithm_HeuPlus { public static Solution start(Topology topo, Demands dems) { Solution solu = Algorithm_Heu.installNFC(topo, dems); Solution preSolu = null; Node banedNode = null; //禁用未初始化的节点 for(VM vm : solu.getVMs()){ if(!vm.hasVM()){ topo.getNode(vm.getNode().getId()).setBanFlag(true); } } do { //在已初始化的节点中寻找可以被禁用的节点,满足条件:①VMsum最小,②度最小 banedNode = findBanedNode(topo, solu); if (banedNode != null) { topo.getNode(banedNode.getId()).setBanFlag(true); } preSolu = Algorithm_Heu.installNFC(topo, dems); } while (preSolu.getFlows().size() == dems.getDemands().size()); //回溯 if (banedNode != null) { topo.getNode(banedNode.getId()).setBanFlag(false); preSolu = Algorithm_Heu.installNFC(topo, dems); } return preSolu; } /** * * @param topo * @param solu * @return */ private static Node findBanedNode(Topology topo, Solution solu) { Node banedNode = null; for(Node node : topo.getNodes()){ if (!node.getBanFlag()) { if (banedNode == null) { banedNode = node; }else { int banedVMNum = solu.getVM(node.getId()).getVMsum(); int nodeVMNum = solu.getVM(node.getId()).getVMsum(); if(nodeVMNum < banedVMNum){ banedNode = node; }else if (nodeVMNum == banedVMNum) { int banedDegree = topo.getAdjNodes(banedNode).size(); int nodeDegree = topo.getAdjNodes(node).size(); if(nodeDegree < banedDegree){ banedNode = node; } } } } } return banedNode; } // //Algorithm.removeVM(topology, demands, solution, new int[]{0,1,2,3,4,5,6,7,8,10}); }
aea28ce09db7913807a4e31db0fd56e6f0dbb964
6778d1246d535d918254136c74823f3c2987631d
/app/src/main/java/com/example/bibox/display.java
bac7c21db2aa67801f108dc31e116cec5ef33d14
[]
no_license
sys029/ProductPartsArrange
37a542d506a3c22d0e7fa26ac0931d5468b9fb2d
ae2fe576f972768e6c40d3893410ba81d989638d
refs/heads/master
2023-09-04T15:57:30.512255
2021-11-24T15:34:18
2021-11-24T15:34:18
430,401,846
0
0
null
null
null
null
UTF-8
Java
false
false
2,420
java
package com.example.bibox; import android.content.Context; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; import android.graphics.Path; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; import android.view.ViewGroup; import androidx.annotation.Nullable; import java.util.ArrayList; import static com.example.bibox.PaintActivity.paint_brush; import static com.example.bibox.PaintActivity.path; public class display extends View { public static ArrayList<Path> pathList = new ArrayList<>(); public static ArrayList<Integer> colorList = new ArrayList<>(); public ViewGroup.LayoutParams params; public static int current_brush = Color.BLACK; public display(Context context) { super(context); init(context); } public display(Context context, @Nullable AttributeSet attrs) { super(context, attrs); init(context); } public display(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); init(context); } private void init(Context context){ paint_brush.setAntiAlias(true); paint_brush.setColor(Color.BLACK); paint_brush.setStyle(Paint.Style.STROKE); paint_brush.setStrokeCap(Paint.Cap.ROUND); paint_brush.setStrokeJoin(Paint.Join.ROUND); paint_brush.setStrokeWidth(20f); params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT); } @Override public boolean onTouchEvent(MotionEvent event) { float x = event.getX(); float y = event.getY(); switch (event.getAction()){ case MotionEvent.ACTION_DOWN: path.moveTo(x,y); invalidate(); return true; case MotionEvent.ACTION_MOVE: path.lineTo(x,y); pathList.add(path); colorList.add(current_brush); invalidate(); return true; default: return false; } } @Override protected void onDraw(Canvas canvas) { for (int i=0;i<pathList.size();i++){ paint_brush.setColor(colorList.get(i)); canvas.drawPath(pathList.get(i),paint_brush); invalidate(); } } }
55576ec632398d596c918117e8e6645b5f7a8e8b
b28dc243f20f1ccf354adda468e866f00881062f
/src/main/java/edu/rit/se/history/httpd/intro/GitBisectReturnCVE20052970server_mpm_worker_worker_c.java
4c1b1c2f4210e1f4a9cebd3bd00fa719fe69ed3c
[]
no_license
andymeneely/httpd-history
8c4b63cccc5e87802a235a8f2608e5393807ad24
541264b46c894b55fda6baac4af3c21358dd8765
refs/heads/master
2021-01-17T13:30:38.444648
2016-07-05T20:09:01
2016-07-05T20:09:01
4,730,157
0
0
null
2013-09-04T14:52:52
2012-06-20T19:06:01
Java
UTF-8
Java
false
false
4,412
java
package edu.rit.se.history.httpd.intro; import java.io.BufferedReader; import java.io.DataInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStreamReader; import java.util.Arrays; import java.util.List; /** * CVE-20052970 * Vulnerable file: server/mpm/worker/worker.c * Fix commit: //___FIX___ * * <pre> * ./tryBisect.sh 20052970 server/mpm/worker/worker.c //___FIX___ GitBisectReturnCVE20052970server_mpm_worker_worker_c * </pre> * * Result: _ is the first bad commit * * @author Alberto Rodriguez * */ public class GitBisectReturnCVE20052970server_mpm_worker_worker_c { private static final int GOOD_RETURN_CODE = 0; private static final int BAD_RETURN_CODE = 1; private static final int SKIP_RETURN_CODE = 125; // Context from vulnerable version. private static List<String> oldBlocks; // Context from fixed version. private static List<String> newBlocks; private static final String CVE = "CVE-20052970"; private static final String FILE = "server/mpm/worker/worker.c"; public static void main(String[] args) { if (args.length > 0) { System.out.println("No arguments required to this script!"); } newBlocks = Arrays.asList( "apr_pool_t *ptrans = NULL; /* Pool for per-transaction stuff */", "&ptrans);", "if (ptrans == NULL) {", "ap_scoreboard_image->servers[process_slot][thread_slot].tid = apr_os_thread_current();"); oldBlocks = Arrays.asList( "apr_pool_t *ptrans; /* Pool for per-transaction stuff */", "apr_pool_t *recycled_pool = NULL;", "&recycled_pool);", "if (recycled_pool == NULL) {", "else {", "ptrans = recycled_pool;", "recycled_pool = NULL;", "recycled_pool = ptrans;"); File vulnerableFile = new File(FILE); System.out.println("===Bisect check for " + CVE + ", " + FILE + "==="); try { if (isVulnerable(vulnerableFile)) { System.out.println("===VULNERABLE==="); System.exit(BAD_RETURN_CODE); // vulnerable --> commit was "bad" // --> abnormal termination } else { System.out.println("===NEUTRAL==="); System.exit(GOOD_RETURN_CODE); // neutral --> commit was "good" // --> normal termination } } catch (IOException e) { System.err.println("===IOException! See stack trace below==="); System.err.println("Vulnerable file: " + vulnerableFile.getAbsolutePath()); e.printStackTrace(); System.exit(SKIP_RETURN_CODE); } } /** * * @param file * @return boolean good or bad commit * @throws IOException */ private static boolean isVulnerable(File file) throws IOException { StringBuffer sb = readFile(file); String fileContent = escapeChars(sb.toString()); if (hasAll(fileContent, oldBlocks) && hasNone(fileContent, newBlocks)) { return true; // It is vulnerable: // Contains some context from latest bad commit and // doesn't contain the fix. } else { return false; // It is not vulnerable: // Either contains the fix or doesn't contain // context from the latest bad commit. } } private static String escapeChars(String text) { return text.replace("\\", "\\\\") .replace("\"", "\\\""); } private static StringBuffer readFile(File fileName) throws FileNotFoundException, IOException { FileInputStream fstream = new FileInputStream(fileName); DataInputStream in = new DataInputStream(fstream); BufferedReader br = new BufferedReader(new InputStreamReader(in)); String strLine; StringBuffer sb = new StringBuffer(); while ((strLine = br.readLine()) != null) { sb.append(strLine.trim()); } in.close(); return sb; } private static boolean hasNone(String fileContent, List<String> mustNotHave) { for (String text : mustNotHave) { if (has(fileContent, text)) { return false; } } return true; } private static boolean hasAll(String fileContent, List<String> list) { for (String text : list) { if (!has(fileContent, text)) { return false; } } return true; } private static boolean has(String fileContent, String str) { boolean has = fileContent.indexOf(str) > 0; if (!has) System.out.println("\tContext not found: " + str); return has; } }
06beec7cec610b5ad87a9f24b850e0499381b38d
ac0e965cd480829148d863cc705f289876802920
/src/exceptionLogText/LoginPageExceptionMsg.java
920275fb040fbf8061de1b7b10dc93caef23eeab
[]
no_license
SagarBobade/ActivityBasedSeleniumFramework
b9540993ef21d73410e161024480f5f5f43d520f
feaee00998d2a73265d89abd5ad8a3078751ddbb
refs/heads/master
2020-04-09T14:20:28.717332
2018-12-04T17:43:45
2018-12-04T17:43:45
160,394,513
0
0
null
null
null
null
UTF-8
Java
false
false
239
java
package exceptionLogText; public class LoginPageExceptionMsg { public static final String doLoginFailed = "doLogin() function FAILED"; public static final String LoginPageObjectCreationFailed = "Login Page Object Creation FAILED"; }
63406ee96b59fbcba982ffc8ad3ff32effbc9ab7
2caf47d31114940984109ac61b38eeee57542389
/Examples/src/main/java/com/aspose/imaging/examples/memorystrategies/OptimizationStrategyInFilters.java
9deecf40cda8c189112fc8cd8d0ef2a4b6e369d8
[ "MIT" ]
permissive
aspose-imaging/Aspose.Imaging-for-Java
c7e5c201bf85be6a110da563b195899f23fd095f
5c84430993415b622c8faafe6bf7f981e93f8467
refs/heads/master
2023-08-18T19:58:34.707887
2023-08-02T07:33:37
2023-08-02T07:33:37
5,567,206
16
22
null
2016-11-18T10:42:22
2012-08-27T05:55:36
Java
UTF-8
Java
false
false
1,300
java
package com.aspose.imaging.examples.memorystrategies; import com.aspose.imaging.Image; import com.aspose.imaging.LoadOptions; import com.aspose.imaging.RasterImage; import com.aspose.imaging.examples.Logger; import com.aspose.imaging.examples.Utils; import com.aspose.imaging.imagefilters.filteroptions.FilterOptionsBase; import com.aspose.imaging.imagefilters.filteroptions.MedianFilterOptions; public class OptimizationStrategyInFilters { public static void main(String... args) { Logger.startExample("OptimizationStrategyInFilters"); // The path to the documents directory. String dataDir = Utils.getSharedDataDir() + "ModifyingImages/"; String fileName = "SampleTiff1.tiff"; String output = "SampleTiff1.out.tiff"; String inputFileName = dataDir + fileName; // Setting a memory limit of 50 megabytes for target loaded image try (RasterImage image = (RasterImage) Image.load(inputFileName, new LoadOptions() {{ setBufferSizeHint(50); }})) { FilterOptionsBase filterOptions = new MedianFilterOptions(6 /*size*/); image.filter(image.getBounds(), filterOptions); image.save(Utils.getOutDir() + output); } Logger.endExample(); } }
ccb0cd318a6a410e2f7a219f1ac9f9f3997df744
6d761cf4873b755faf1868d1bf8525836f1c97b6
/src/com/cintel/frame/auth/login/session/SessionAttributeHandler.java
c8e2820b0e5e110806be3e0aeb1fd27d573cb20a
[]
no_license
wangshuda/web-frame-2.0
22e1ff1b8dc4d5e5517a42b77303500af042b940
c17d2ff991271b1e3a0a40941a87871c4e032cf8
refs/heads/master
2016-09-06T08:42:43.455748
2014-04-01T20:59:41
2014-04-01T20:59:41
null
0
0
null
null
null
null
UTF-8
Java
false
false
493
java
package com.cintel.frame.auth.login.session; import javax.servlet.http.HttpSessionBindingEvent; /** * * @file : SessionAttributeHandler.java * @version : 1.0 * @desc : * @history : * 1) 2009-7-3 wangshuda created */ public interface SessionAttributeHandler { public void attributeAdded(HttpSessionBindingEvent event); public void attributeRemoved(HttpSessionBindingEvent event); public void attributeReplaced(HttpSessionBindingEvent event); }
2b3f55038fb89b0aec45a37c194efc495b5ae99b
3fe6c1aba49d4fec5de517881d826ab4e31b32f3
/src/main/java/mira/dbproject/carrental/domain/entity/Rental.java
2325256a07a29404df5be8e207f9e2f27c79b049
[]
no_license
michal-wiercinski/car-rental-springboot-thymeleaf-jpa-mysql
14516a9ee2e234f05bac00d958cf3e34cb40be83
354e64aaccafcd8a46f29883664ee20aa9f4b789
refs/heads/master
2022-04-05T12:02:47.703220
2020-02-27T21:30:28
2020-02-27T21:30:28
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,026
java
package mira.dbproject.carrental.domain.entity; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; import javax.persistence.JoinColumn; import javax.persistence.ManyToOne; import javax.persistence.NamedStoredProcedureQueries; import javax.persistence.NamedStoredProcedureQuery; import javax.persistence.OneToOne; import javax.persistence.ParameterMode; import javax.persistence.StoredProcedureParameter; import javax.persistence.Table; import lombok.Data; @NamedStoredProcedureQueries( @NamedStoredProcedureQuery(name = "Rental.UpdateStatus", procedureName = "set_cancel_rental_status_by_pk", parameters = { @StoredProcedureParameter(name = "p_pk_rental", mode = ParameterMode.IN, type = Long.class) } ) ) @Data @Table(name = "rental") @Entity public class Rental { @GeneratedValue(strategy = GenerationType.IDENTITY) @Id @Column(name = "PK_rental") private Long id; @ManyToOne @JoinColumn(name = "FK_car") private Car car; @ManyToOne @JoinColumn(name = "FK_user") private User user; @ManyToOne @JoinColumn(name = "FK_status") private RentalStatus rentalStatus; @OneToOne @JoinColumn(name = "FK_rental_details") private RentalDetails rentalDetails; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public Car getCar() { return car; } public void setCar(Car car) { this.car = car; } public User getUser() { return user; } public void setUser(User user) { this.user = user; } public RentalStatus getRentalStatus() { return rentalStatus; } public void setRentalStatus(RentalStatus rentalStatus) { this.rentalStatus = rentalStatus; } public RentalDetails getRentalDetails() { return rentalDetails; } public void setRentalDetails(RentalDetails rentalDetails) { this.rentalDetails = rentalDetails; } }
086dea71641515bb6cd79a4e2721122294e34989
f073593a9b0633a4d14e45b863d8eb808e585181
/ws-backend/src/main/java/dev/dgomes/backend/ws/WebsocketController.java
5a182a4e7bcb5cd05c645f040b129eb8dc8f4b05
[]
no_license
diogogomes77/stompsocket
3bca921e8320b841f6b9e0a3b5aace9bc13f4ec8
7c117adad1139b0bed0d226aa436bc02259d52d8
refs/heads/master
2022-07-20T01:34:37.475936
2020-05-17T23:35:58
2020-05-17T23:35:58
262,545,648
0
0
null
null
null
null
UTF-8
Java
false
false
947
java
package dev.dgomes.backend.ws; import dev.dgomes.backend.ws.model.WsMessage; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.messaging.handler.annotation.DestinationVariable; import org.springframework.messaging.handler.annotation.MessageMapping; import org.springframework.messaging.handler.annotation.Payload; import org.springframework.messaging.handler.annotation.SendTo; import org.springframework.messaging.simp.SimpMessageHeaderAccessor; import org.springframework.messaging.simp.SimpMessagingTemplate; import org.springframework.stereotype.Controller; import static java.lang.String.format; @Controller public class WebsocketController { @Autowired private SimpMessagingTemplate webSocket; @MessageMapping("/send/all") @SendTo("/topic/public") public WsMessage sendMessage(@Payload WsMessage message) { System.out.println(message); return message; } }
9a999b3c927218fe632aa640ac464ca376dce274
3e43a6cf08f334a85fb0998e0196c0778748cb1f
/src/main/jp/ac/uryukyu/ie/e185715/Main.java
a3f564e944908685d7d2c795c5fdaec41722b7e0
[]
no_license
e185715/report3
bffa6c27f6c994553623359d618144667771a38a
bb9f3bac71b670278e3219037666deb782e2913a
refs/heads/master
2020-04-05T19:58:01.325574
2018-11-12T16:39:14
2018-11-12T16:39:14
157,158,780
0
0
null
null
null
null
UTF-8
Java
false
false
578
java
package jp.ac.uryukyu.ie.e185715; public class Main { public static void main(String[] args){ Hero hero = new Hero("勇者", 10, 5); Enemy enemy = new Enemy("スライム", 6, 3); System.out.printf("%s vs. %s\n", hero.getName(), enemy.getName()); int turn = 0; while( hero.isDead() == false && enemy.isDead() == false ){ turn++; System.out.printf("%dターン目開始!\n", turn); hero.attack(enemy); enemy.attack(hero); } System.out.println("戦闘終了"); } }
7d6f470de0847f16bf66af38b1a11f76d8a8f557
f7a25da32609d722b7ac9220bf4694aa0476f7b2
/net/minecraft/world/item/BowlFoodItem.java
e0735ad563ad6554a1f29f3eeda006bccd62ef47
[]
no_license
basaigh/temp
89e673227e951a7c282c50cce72236bdce4870dd
1c3091333f4edb2be6d986faaa026826b05008ab
refs/heads/master
2023-05-04T22:27:28.259481
2021-05-31T17:15:09
2021-05-31T17:15:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
494
java
package net.minecraft.world.item; import net.minecraft.world.level.ItemLike; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.level.Level; public class BowlFoodItem extends Item { public BowlFoodItem(final Properties a) { super(a); } @Override public ItemStack finishUsingItem(final ItemStack bcj, final Level bhr, final LivingEntity aix) { super.finishUsingItem(bcj, bhr, aix); return new ItemStack(Items.BOWL); } }
0ad23a50d3dc5bd90bbd392bb915d24d322f2d1f
2423276ae4db6b23004bcc64e29f4f26e7deef72
/app/src/main/java/test/myapplication/MyDB.java
539ee92d4036659832ab7bf53c59ad0dd4d5de88
[]
no_license
zhaoheri/MyApplication
4ae035c52e59f77a101da611d5b16a51f25f8509
45f229e6790ee7385ef8523ebc126368944ceca0
refs/heads/master
2020-04-15T01:48:50.674031
2015-04-14T22:39:56
2015-04-14T22:39:56
31,928,773
0
0
null
null
null
null
UTF-8
Java
false
false
2,837
java
package test.myapplication; import android.content.ContentValues; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import java.sql.SQLException; import java.util.ArrayList; import java.util.List; /** * Created by zhaoheri on 3/5/15. */ public class MyDB { // Database fields private SQLiteDatabase database; private MyDBHelper dbHelper; private String[] allColumns = { MyDBHelper.COLUMN_ID, MyDBHelper.COLUMN_TITLE, MyDBHelper.COLUMN_DATE, MyDBHelper.COLUMN_START_TIME, MyDBHelper.COLUMN_END_TIME, MyDBHelper.COLUMN_VOL }; public MyDB(Context context) { dbHelper = new MyDBHelper(context); } public void open() throws SQLException { database = dbHelper.getWritableDatabase(); } public void close() { dbHelper.close(); } public void insert(Rule rule) { ContentValues values = new ContentValues(); values.put(MyDBHelper.COLUMN_TITLE, rule.getTitle()); values.put(MyDBHelper.COLUMN_DATE, rule.getDate()); values.put(MyDBHelper.COLUMN_START_TIME, rule.getStart_time()); values.put(MyDBHelper.COLUMN_END_TIME, rule.getEnd_time()); values.put(MyDBHelper.COLUMN_VOL, rule.getVolume()); long insertId = database.insert(MyDBHelper.TABLE_NAME, null, values); } public List<Rule> select() { List<Rule> rules = new ArrayList<Rule>(); Cursor cursor = database.query(MyDBHelper.TABLE_NAME, allColumns, null, null, null, null, null); cursor.moveToFirst(); while (!cursor.isAfterLast()) { Rule rule = cursorToRule(cursor); rules.add(rule); cursor.moveToNext(); } // make sure to close the cursor cursor.close(); return rules; } public void updateById(long id, String startTime, String endTime, String volume) { ContentValues values = new ContentValues(); values.put(MyDBHelper.COLUMN_ID, id); values.put(MyDBHelper.COLUMN_START_TIME, startTime); values.put(MyDBHelper.COLUMN_END_TIME, endTime); values.put(MyDBHelper.COLUMN_VOL, volume); String selection = MyDBHelper.COLUMN_ID + " = " + id; database.update(MyDBHelper.TABLE_NAME, values, selection, null); } public void deleteById(long id) { String selection = MyDBHelper.COLUMN_ID + " = " + id; database.delete(MyDBHelper.TABLE_NAME, selection, null); } private Rule cursorToRule(Cursor cursor) { Rule rule = new Rule(cursor.getString(1), cursor.getString(2), cursor.getString(3), cursor.getString(4), cursor.getString(5)); rule.setId(Long.parseLong(cursor.getString(0))); return rule; } }
45773212a9f161512e99e158bfa183a31491d779
06f54d0f307e241fd3e1a4b4269eb3467e37f976
/src/Gun60/S37.java
a9b9069cdd7807732ad92b87f5bf22223259bcfe
[]
no_license
erdhzn/javadersleri
ce872157ac76744d56a5a34d6f8a0c1970afb0b6
101b7ce915a43750b92f80e02142ffe7060a35ef
refs/heads/master
2023-01-22T05:43:32.538626
2020-11-25T18:15:43
2020-11-25T18:15:43
316,020,145
0
0
null
null
null
null
UTF-8
Java
false
false
298
java
package Gun60; import java.util.Arrays; public class S37 { public static void main(String[] args) { int[] intArr ={15,30,45,60,75}; intArr[2] = intArr[4]; // 15,30,75,60,75 intArr[4] = 90; //15,30,75,60,90} System.out.println(Arrays.toString(intArr)); } }
de69e940cf022c5ab9277fb20e841ce92fce51f3
75da1048d9cdfb409f4cccd186d2c14f43929238
/AndroidStudioProjects/RensyuP155156/app/src/main/java/com/example/rensyup155156/MainActivity.java
aa0eb08322fe787e5090a0fb47901d8f90dc74ef
[]
no_license
hama28/PolyTech
593b6a62249e37372242cb2e54a0afaf96b3a21f
8e81c0f9bd928ba843faded716202aa17bf45c9c
refs/heads/master
2023-01-01T14:45:16.656069
2020-10-26T11:52:45
2020-10-26T11:52:45
290,675,493
0
0
null
null
null
null
UTF-8
Java
false
false
3,566
java
package com.example.rensyup155156; import androidx.appcompat.app.AppCompatActivity; import android.content.Context; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.Toast; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Button button = (Button)findViewById(R.id.button); button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { OutputStream out = null; OutputStreamWriter writer = null; BufferedWriter bw = null; try { out = openFileOutput("myText.txt", Context.MODE_PRIVATE); writer = new OutputStreamWriter(out); bw = new BufferedWriter(writer); bw.write("write data"); Toast.makeText(MainActivity.this,"保存完了",Toast.LENGTH_SHORT).show(); } catch (IOException e) { Log.e("Internal","IO EXception" + e.getMessage(),e); } finally { try { if (bw != null) { bw.close(); } if (writer != null) { writer.close(); } if (out != null) { out.close(); } } catch (IOException e) { Log.e("Internal","IO Exception" + e.getMessage(),e); } } } }); Button button2 = (Button)findViewById(R.id.button2); button2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { InputStream in = null; InputStreamReader sr = null; BufferedReader br = null; try { in = openFileInput("myText.txt"); sr = new InputStreamReader(in); br = new BufferedReader(sr); String line; StringBuilder sb = new StringBuilder(); while ((line = br.readLine()) != null) { sb.append(line).append("|n"); } Toast.makeText(MainActivity.this,"読込完了",Toast.LENGTH_SHORT).show(); } catch (IOException e) { Log.e("Internal","IO Exception" + e.getMessage(),e); } finally { try { if (br != null) { br.close(); } if (sr != null) { sr.close(); } if (in != null) { in.close(); } } catch (IOException e) { Log.e("Internal", "IO Exception" + e.getMessage()); } } } }); } }
bc2cae0c74ffb52ee34870fe8ccae75e1d73a27d
ee5074859da421d30958de7457d7b23438243fbe
/SpringDataSolrDemo/src/test/java/cn/itcast/test/TestTemplate.java
cd3483859a694f80137a16ac39a91f27190f7e7c
[]
no_license
BluceBo/pinyougou-store
3aea31119b3a5dba3f5e22f297a42f47082cab2b
d4f4189e4f41c5c25c2e3065fb269056b38bc94b
refs/heads/master
2022-12-22T23:19:14.141036
2019-12-25T14:11:48
2019-12-25T14:11:48
210,393,616
0
0
null
2022-12-16T07:18:12
2019-09-23T15:46:04
JavaScript
UTF-8
Java
false
false
3,091
java
package cn.itcast.test; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.solr.core.SolrTemplate; import org.springframework.data.solr.core.query.Criteria; import org.springframework.data.solr.core.query.Query; import org.springframework.data.solr.core.query.SimpleQuery; import org.springframework.data.solr.core.query.result.ScoredPage; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import cn.itcast.pojo.TbItem; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations="classpath:applicationContext-solr.xml") public class TestTemplate { @Autowired private SolrTemplate solrTemplate; @Test public void testAdd() { TbItem item=new TbItem(); item.setId(1L); item.setBrand("华为"); item.setCategory("手机"); item.setGoodsId(1L); item.setSeller("华为2号专卖店"); item.setTitle("华为Mate9"); item.setPrice(new BigDecimal(2000)); solrTemplate.saveBean(item); solrTemplate.commit(); } @Test public void testFindOne(){ TbItem item = solrTemplate.getById(1, TbItem.class); System.out.println(item.getTitle()); } @Test public void testDelete(){ solrTemplate.deleteById("1"); solrTemplate.commit(); } @Test public void testAddList(){ List<TbItem> list=new ArrayList(); for(int i=0;i<100;i++){ TbItem item=new TbItem(); item.setId(i+1L); item.setBrand("华为"); item.setCategory("手机"); item.setGoodsId(1L); item.setSeller("华为2号专卖店"); item.setTitle("华为Mate"+i); item.setPrice(new BigDecimal(2000+i)); list.add(item); } solrTemplate.saveBeans(list); solrTemplate.commit(); } @Test public void testPageQuery(){ Query query=new SimpleQuery("*:*"); query.setOffset(20);//开始索引(默认0) query.setRows(20);//每页记录数(默认10) ScoredPage<TbItem> page = solrTemplate.queryForPage(query, TbItem.class); System.out.println("总记录数:"+page.getTotalElements()); List<TbItem> list = page.getContent(); showList(list); } //显示记录数据 private void showList(List<TbItem> list){ for(TbItem item:list){ System.out.println(item.getTitle() +item.getPrice()); } } @Test public void testPageQueryMutil(){ Query query=new SimpleQuery("*:*"); Criteria criteria=new Criteria("item_title").contains("2"); criteria=criteria.and("item_title").contains("5"); query.addCriteria(criteria); //query.setOffset(20);//开始索引(默认0) //query.setRows(20);//每页记录数(默认10) ScoredPage<TbItem> page = solrTemplate.queryForPage(query, TbItem.class); System.out.println("总记录数:"+page.getTotalElements()); List<TbItem> list = page.getContent(); showList(list); } @Test public void testDeleteAll(){ Query query=new SimpleQuery("*:*"); solrTemplate.delete(query); solrTemplate.commit(); } }
804216ddb7eda62e15bc4f149d060dce57a66199
ec3e3413893d14f66349796368a7d7dcf9549b72
/CustomerSide/src/main/java/com/manddprojectconsulant/greedapplication/Admin/UserListActivity.java
66baffde4865d0d00d7368c3c00ba188d2d80ac3
[]
no_license
mitul3195/EGreetingCard
89623849b72705660670678cb566eccbc16c42f2
10f7ff7afaad7ff79f6ea012db47dfdc0b069a2f
refs/heads/master
2023-04-11T18:46:52.545983
2021-05-12T07:39:54
2021-05-12T07:39:54
360,034,145
0
0
null
null
null
null
UTF-8
Java
false
false
3,264
java
package com.manddprojectconsulant.greedapplication.Admin; import androidx.appcompat.app.AppCompatActivity; import androidx.recyclerview.widget.LinearLayoutManager; import android.content.Intent; import android.os.Bundle; import android.view.View; import com.android.volley.Request; import com.android.volley.RequestQueue; import com.android.volley.Response; import com.android.volley.VolleyError; import com.android.volley.toolbox.StringRequest; import com.android.volley.toolbox.Volley; import com.manddprojectconsulant.greedapplication.Adapter.Adapterforuserlogin; import com.manddprojectconsulant.greedapplication.Model.UserModel; import com.manddprojectconsulant.greedapplication.PublicApi.APi; import com.manddprojectconsulant.greedapplication.databinding.ActivityUserListBinding; import org.json.JSONArray; import org.json.JSONObject; import java.util.ArrayList; import java.util.List; public class UserListActivity extends AppCompatActivity { ActivityUserListBinding userListBinding; List<UserModel>list=new ArrayList<>(); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); userListBinding=ActivityUserListBinding.inflate(getLayoutInflater()); setContentView(userListBinding.getRoot()); setSupportActionBar(userListBinding.admintoolbar); LinearLayoutManager layoutManager=new LinearLayoutManager(UserListActivity.this); userListBinding.userListRecyclerview.setLayoutManager(layoutManager); userListBinding.actionBackpressed.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { onBackPressed(); } }); StringRequest request=new StringRequest(Request.Method.POST, APi.Userlist, new Response.Listener<String>() { @Override public void onResponse(String response) { try { JSONArray array=new JSONArray(response); for (int i=0;i<array.length();i++) { JSONObject object = array.getJSONObject(i); UserModel model=new UserModel(); model.setName(object.getString("name")); model.setPhone(object.getString("phone")); list.add(model); } Adapterforuserlogin adapterforuserlogin=new Adapterforuserlogin(UserListActivity.this,list); userListBinding.userListRecyclerview.setAdapter(adapterforuserlogin); } catch (Exception e) { e.printStackTrace(); } } }, new Response.ErrorListener() { @Override public void onErrorResponse(VolleyError error) { } }); RequestQueue queue= Volley.newRequestQueue(UserListActivity.this); queue.add(request); } @Override public void onBackPressed() { Intent i=new Intent(UserListActivity.this,AdminOption.class); i.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); startActivity(i); overridePendingTransition(0,0); super.onBackPressed(); } }
87495ebb916b7e96bdaedc52c908ea4490890ab0
09f2f88b38aaeae5460be2af1a3a915260f145c1
/apiServer/src/main/java/cilicili/jz2/service/impl/CommentServiceImpl.java
463e8645563a96d72cd5e63f590aeedcfb117db4
[]
no_license
mumingbai/cilicili
67d413e033d7a2b3b6bd1e8dd5b9b70ccc778ea1
e719b484259ec068975173da35740ac96a0bb63c
refs/heads/master
2020-03-17T00:35:12.973354
2018-05-06T12:55:24
2018-05-06T12:55:24
133,122,559
1
0
null
2018-05-12T07:04:14
2018-05-12T07:04:14
null
UTF-8
Java
false
false
1,224
java
package cilicili.jz2.service.impl; import cilicili.jz2.dao.CommentMapper; import cilicili.jz2.dao.MyCommentMapper; import cilicili.jz2.pojo.Comment; import cilicili.jz2.service.ICommentService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service("commentService") public class CommentServiceImpl implements ICommentService { private final CommentMapper commentMapper; private final MyCommentMapper myCommentMapper; @Autowired public CommentServiceImpl(CommentMapper commentMapper, MyCommentMapper myCommentMapper) { this.commentMapper = commentMapper; this.myCommentMapper = myCommentMapper; } @Override public Comment findCommentById(Integer id) { return myCommentMapper.findById(id); } @Override public void addComment(Comment comment) { commentMapper.insert(comment); } @Override public void deleteComment(Integer id) { commentMapper.deleteByPrimaryKey(id); } @Override public void updateComment(Comment comment) { commentMapper.updateByPrimaryKeySelective(comment); } @Override public List<Comment> showComments(Integer videoId) { return myCommentMapper.showComments(videoId); } }
c8fc5c655b7cbe1090a69fab170c78fb664ac73e
b77ff89369a583fc29ed2e93b2abbf379b8a292f
/left/src/main/java/com/android/launcherx/left/LeftAdapter.java
309e915ae47e657854989936789b68ef0d9f92a5
[ "Apache-2.0" ]
permissive
puming/LauncherX
3d16714e339ea3e8a92a490330a7ca550a8fd6eb
fd5373e8845101afaba0c8e534d19019f349be5d
refs/heads/master
2021-08-19T01:20:02.287762
2017-11-24T09:59:51
2017-11-24T09:59:51
77,586,761
2
1
null
null
null
null
UTF-8
Java
false
false
2,039
java
package com.android.launcherx.left; import android.content.Context; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import java.util.ArrayList; /** * Created by puming on 2017/1/3. */ public class LeftAdapter extends RecyclerView.Adapter<LeftAdapter.LeftViewHolder> { private Context mContext; private ArrayList<Bean> mArrayList; public LeftAdapter(Context mContext ,ArrayList<Bean> arrayList ) { this.mContext = mContext; this.mArrayList= arrayList; } public void setData(ArrayList<Bean> arrayList) { this.mArrayList = arrayList; notifyDataSetChanged(); } @Override public LeftViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { switch (viewType) { case 0: View itemView = LayoutInflater.from(mContext).inflate(R.layout.item_left, parent,false); return new LeftViewHolder(itemView); } return null; } @Override public void onBindViewHolder(LeftViewHolder holder, int position) { switch (getItemViewType(position)) { case 0: Bean bean = mArrayList.get(position); holder.mTextViewTitle.setText(bean.getTitle()); } } @Override public int getItemCount() { return mArrayList.size() == 0 ? 0 : mArrayList.size(); } @Override public int getItemViewType(int position) { return super.getItemViewType(position); } static class LeftViewHolder extends RecyclerView.ViewHolder { protected TextView mTextViewTitle; protected ImageView mImageViewIcon; public LeftViewHolder(View itemView) { super(itemView); mTextViewTitle = (TextView) itemView.findViewById(R.id.tv_title); mImageViewIcon = (ImageView) itemView.findViewById(R.id.iv_icon); } } }
0e3d6fc0f66cc87ac5090265e1d794db557e5e02
f4eb2fd447fac7f557f165ac23549dee7b821e4f
/src/main/java/docker/ContainerStopper.java
b33040d6f482bc64d090fd99f5e591152e74a24e
[]
no_license
caiolucena/ticket-containers
ed1ac2d0bcbda40990628dedaca3554e6300a9e7
385bd1d0efe57e22113e6ff5faedc736a97affc3
refs/heads/master
2021-07-13T08:30:22.679500
2020-03-03T13:59:42
2020-03-03T13:59:42
244,650,359
0
0
null
2021-04-26T20:00:55
2020-03-03T13:59:19
HTML
UTF-8
Java
false
false
804
java
package docker; import java.io.IOException; import java.util.List; import docker.services.ComposeRunner; import docker.services.FileManipulator; import docker.services.impl.ComposeRunnerImpl; import docker.services.impl.FileManipulatorImpl; public class ContainerStopper { public static void main(String[] args) throws IOException { final String activeMicroservicesFileName = "input/active-microservices.txt"; final String outputFileName = "target/docker-compose.yml"; final FileManipulator fileManipulator = new FileManipulatorImpl(); final ComposeRunner composeRunner = new ComposeRunnerImpl(); final List<String> activeMicroservices = fileManipulator.readMicroservicesFile(activeMicroservicesFileName); composeRunner.killAllContainers(outputFileName, activeMicroservices); } }
f16967ce0fe2501e27090d8cb276bc931aea14bb
be73270af6be0a811bca4f1710dc6a038e4a8fd2
/crash-reproduction-moho/results/XCOMMONS-1057-6-12-FEMO-WeightedSum:TestLen:CallDiversity/org/xwiki/extension/job/internal/UpgradePlanJob_ESTest_scaffolding.java
4cc3a93fca05816f983d44d5f39d20d51e176b64
[]
no_license
STAMP-project/Botsing-multi-objectivization-using-helper-objectives-application
cf118b23ecb87a8bf59643e42f7556b521d1f754
3bb39683f9c343b8ec94890a00b8f260d158dfe3
refs/heads/master
2022-07-29T14:44:00.774547
2020-08-10T15:14:49
2020-08-10T15:14:49
285,804,495
0
0
null
null
null
null
UTF-8
Java
false
false
451
java
/** * Scaffolding file used to store all the setups needed to run * tests automatically generated by EvoSuite * Sat Apr 04 12:07:27 UTC 2020 */ package org.xwiki.extension.job.internal; import org.evosuite.runtime.annotation.EvoSuiteClassExclude; import org.junit.BeforeClass; import org.junit.Before; import org.junit.After; @EvoSuiteClassExclude public class UpgradePlanJob_ESTest_scaffolding { // Empty scaffolding for empty test suite }
cbd4f1469ebc6e01647443b49e7586f1e10959ad
a562508e685e0ef26d5a8e945dec9f786fce197d
/app/src/test/java/com/zhbit/administrator/video/ExampleUnitTest.java
b68971bfafa09b75d3de23b709663c7e5a8f3f5a
[]
no_license
XJF96/Video
d9c50880ff4e57e6168c9dc0ae6a9d3426829f8f
1042be5cc49932033cb3413de64aade770200762
refs/heads/master
2020-12-30T17:51:23.575302
2017-05-15T13:53:59
2017-05-15T13:53:59
90,934,478
0
0
null
null
null
null
UTF-8
Java
false
false
407
java
package com.zhbit.administrator.video; 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() throws Exception { assertEquals(4, 2 + 2); } }
43896c3b69f6e5e619f613971dce28b0b29751fe
da9e17a63a82277d530667cd7f2e1bc0e4a386dd
/src/main/java/com/model/TrackOrderSku.java
6007bb1c211808706d3c8c95444083b45254d932
[]
no_license
caesar-empereur/performance-opt
b9b9c4671942691a6e66443bb4d604fe510ae2da
8e6def3dffb4521c0af63197518ef0a879842fed
refs/heads/master
2023-04-10T09:30:51.611445
2021-04-28T07:41:42
2021-04-28T07:41:42
334,060,830
0
0
null
null
null
null
UTF-8
Java
false
false
685
java
package com.model; import lombok.Data; import javax.persistence.*; import java.time.LocalDateTime; /** * @Description * @author: yangyingyang * @date: 2021/2/8. */ @Data @Entity @Table(name = "t_track_order_sku") public class TrackOrderSku { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) private Long id; private String trackNo; private String skuCode; private String skuName = "iphone xs"; private Integer skuPrice = 5000; private String skuPhoto = "srcnwuineyruw-photo"; private String skuSpec = "128G"; private String skuDesc = "iphone"; private LocalDateTime createTime; private LocalDateTime updateTime; }
3fa52f6a9eb55826d159ee51c343d84c84af869a
30169e3a05e83c64ca529865d3475190b77e96fd
/src/cs355/lab1/modelHelpers/AddShape.java
e610114306cb3a95976cbb44de21a35d1c6d24f4
[]
no_license
mn263/simple-draw
9d42431f717f47f5425cb78f9c06116ea9f56c8f
19ee9172fbc72a19081cbd303b973c39b5d917a6
refs/heads/master
2016-09-05T16:10:33.348245
2014-02-24T21:23:57
2014-02-24T21:23:57
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,647
java
package cs355.lab1.modelHelpers; import cs355.lab1.Point; import cs355.lab1.Shape; import cs355.lab1.ShapeClasses.*; import cs355.lab1.singletonManager; public class AddShape { public Shape addCircle(int radius, double intX, double intY) { return setShapeColor(new Circle(radius, intX, intY)); } public Shape addEllipse(int height, int width, double x, double y) { return setShapeColor(new Ellipse(height, width, x, y)); } public Shape addLine(double startX, double startY, double endX, double endY) { return setShapeColor(new Line(startX, startY, endX, endY)); } public Shape addRectangle(int height, int width, double left, double top) { return setShapeColor(new Rectangle(height, width, left, top)); } public Shape addSquare(double left, double top, int size) { return setShapeColor(new Square(left, top, size)); } public Shape addTriangle(double oneX, double oneY, double twoX, double twoY, double threeX, double threeY) { return setShapeColor(new Triangle(oneX, oneY, twoX, twoY, threeX, threeY)); } public Shape checkTriangleStatus(double x, double y) { if (Triangle.cornerOne == null) { Triangle.cornerOne = new Point(x, y); } else if (Triangle.cornerTwo == null) { Triangle.cornerTwo = new Point(x, y); } else { Shape triangle = addTriangle(Triangle.cornerOne.getX(), Triangle.cornerOne.getY(), Triangle.cornerTwo.getX(), Triangle.cornerTwo.getY(), x, y); Triangle.cornerOne = null; Triangle.cornerTwo = null; return triangle; } return null; } public Shape setShapeColor(Shape shape) { shape.setColor(singletonManager.inst().getSelectedColor()); return shape; } }
7d28aa9a69c240809210908e82df1cfa13b8ef9c
5fdafa30bc71ac9fd2ac052fbefdca40d0acbdd8
/src/main/java/com/bright/push/client/mobile/MobileClientHandler.java
1d832efb4d2deb134954830d452022561b6b7961
[ "Apache-2.0" ]
permissive
wxf0322/bright
b02746b1ba2ee135043af8c3022c892e0696c3c1
6b70b3ef589bca04c8690c99621f2c41a8c1ab63
refs/heads/master
2023-01-28T21:49:04.898502
2020-12-11T02:29:30
2020-12-11T02:29:30
320,443,297
0
0
null
null
null
null
UTF-8
Java
false
false
4,582
java
/** * 项目名称 : bright * 文件名称 : MobileClientHandler.java * 日期时间 : 2020年12月10日 - 下午3:16:04 */ package com.bright.push.client.mobile; import java.util.concurrent.TimeUnit; import javax.net.ssl.SSLException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.bright.push.model.Cube; import com.bright.push.model.InMessage; import com.bright.push.util.Config; import io.netty.bootstrap.Bootstrap; import io.netty.channel.ChannelHandler.Sharable; import io.netty.channel.ChannelHandlerContext; import io.netty.channel.ChannelInboundHandlerAdapter; import io.netty.channel.EventLoop; import io.netty.handler.timeout.IdleState; import io.netty.handler.timeout.IdleStateEvent; /** * 移动端的客户端处理程序。 * * @author 王晓峰 * @since 1.0 */ @Sharable public class MobileClientHandler extends ChannelInboundHandlerAdapter { /** log:日志 */ private Logger log = LoggerFactory.getLogger(MobileClientHandler.class); private String uuid = "37fa5c42-22a8-4958-ac2c-bd5786740c57"; long startTime = -1; /** * Creates a client-side handler. */ public MobileClientHandler() { } /* * (non-Javadoc) * * @see io.netty.channel.ChannelInboundHandlerAdapter#channelActive(io.netty. * channel.ChannelHandlerContext) */ @Override public void channelActive(ChannelHandlerContext ctx) { try { ctx.writeAndFlush(uuid); } catch (Exception e) { log.error("[推送服务] - " + ctx.channel().remoteAddress() + "异常\n异常信息:" + e.getMessage(), e); } } /* * (non-Javadoc) * * @see io.netty.channel.ChannelInboundHandlerAdapter#channelRead(io.netty. * channel.ChannelHandlerContext, java.lang.Object) */ @Override @SuppressWarnings("unchecked") public void channelRead(ChannelHandlerContext ctx, Object msg) { if (msg instanceof Cube) { Cube<InMessage> cube = (Cube<InMessage>) msg; log.info(cube.toString()); } else if (msg instanceof String) { log.info(msg.toString()); } else { log.error(msg.toString()); } } /* * (non-Javadoc) * * @see * io.netty.channel.ChannelInboundHandlerAdapter#userEventTriggered(io.netty * .channel.ChannelHandlerContext, java.lang.Object) */ @Override public void userEventTriggered(ChannelHandlerContext ctx, Object evt) { try { if (!(evt instanceof IdleStateEvent)) { return; } IdleStateEvent e = (IdleStateEvent) evt; if (e.state() == IdleState.READER_IDLE) { ctx.writeAndFlush(uuid); } } catch (Exception e) { log.error("[推送服务] - " + ctx.channel().remoteAddress() + "异常\n异常信息:" + e.getMessage(), e); } } /* * (non-Javadoc) * * @see io.netty.channel.ChannelInboundHandlerAdapter#channelUnregistered(io. * netty.channel.ChannelHandlerContext) */ @Override public void channelUnregistered(final ChannelHandlerContext ctx) throws Exception { log.info("待连接时间: " + MobileClient.RECONNECT_DELAY + 's'); try { final EventLoop loop = ctx.channel().eventLoop(); loop.schedule(new Runnable() { @Override public void run() { MobileClient mc = new MobileClient(); log.info("重新连接: " + Config.getPros().getProperty("host") + ':' + Integer.parseInt(Config.getPros().getProperty("port"))); try { mc.connect(mc.configureBootstrap(new Bootstrap(), loop)); } catch (SSLException e) { log.error("MobileClient 重新连接异常!", e); } } }, MobileClient.RECONNECT_DELAY, TimeUnit.SECONDS); } catch (Exception e) { log.error("[推送服务] - " + ctx.channel().remoteAddress() + "异常\n异常信息:" + e.getMessage(), e); } } /* * (non-Javadoc) * * @see io.netty.channel.ChannelInboundHandlerAdapter#channelReadComplete(io. * netty.channel.ChannelHandlerContext) */ @Override public void channelReadComplete(ChannelHandlerContext ctx) { try { ctx.flush(); } catch (Exception e) { log.error("[推送服务] - " + ctx.channel().remoteAddress() + "异常\n异常信息:" + e.getMessage(), e); } } /* * (non-Javadoc) * * @see io.netty.channel.ChannelInboundHandlerAdapter#exceptionCaught(io.netty. * channel.ChannelHandlerContext, java.lang.Throwable) */ @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { ctx.close(); log.error("[推送服务] - " + ctx.channel().remoteAddress() + "异常\n异常信息:" + cause.getMessage(), cause); } public String getUuid() { return uuid; } public void setUuid(String uuid) { this.uuid = uuid; } }
b9be1320059e980c64d0d47ab631e82147634c19
05d33f30b0b6d63f6e4829e9c65284a147e39d33
/src/main/java/pageObjects/AuthenticationPage.java
cb1987fe11c703bd0b0e9687edbc788377603853
[]
no_license
amumunjal/autoPractice
a1bcb87ae979f1b117cd27b9372576f72f00f0a3
d98cb6c8c2793ccdb38140d4b50b795d54b7036b
refs/heads/master
2021-07-10T17:18:40.640850
2019-09-08T13:07:25
2019-09-08T13:07:25
207,113,401
0
0
null
2020-10-13T15:53:27
2019-09-08T13:02:37
Java
UTF-8
Java
false
false
762
java
package pageObjects; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.How; import org.openqa.selenium.support.PageFactory; public class AuthenticationPage { @FindBy(how = How.CSS, using="#email") private WebElement email; @FindBy(how = How.CSS, using="#passwd") private WebElement password; @FindBy(how = How.CSS, using="#SubmitLogin") private WebElement submit; public AuthenticationPage(WebDriver driver){ PageFactory.initElements(driver, this); } public void login(String user, String Pass) { email.sendKeys(user); password.sendKeys(Pass); submit.click(); } }
22358c4db0c6e86a0679b8b0ecfa086bc15843a9
02f276529164a1c33f7465fe38483fb69bf5d720
/message_app/src/test/java/DummyProducer.java
9195179a1abdf508fe9def2341a6b5072b9799dc
[]
no_license
simstoykov/part-ii-project
065e319670174679eb3538bd592d1f0e566b20f1
cb8bd5b9bdba9e0a7eb550cddeb3398ab0a53e0d
refs/heads/master
2022-10-20T18:23:12.089575
2020-05-08T10:39:29
2020-05-08T10:39:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,183
java
import org.apache.kafka.clients.consumer.OffsetAndMetadata; import org.apache.kafka.clients.producer.Callback; import org.apache.kafka.clients.producer.Producer; import org.apache.kafka.clients.producer.ProducerRecord; import org.apache.kafka.clients.producer.RecordMetadata; import org.apache.kafka.common.Metric; import org.apache.kafka.common.MetricName; import org.apache.kafka.common.PartitionInfo; import org.apache.kafka.common.TopicPartition; import org.apache.kafka.common.errors.ProducerFencedException; import java.time.Duration; import java.util.List; import java.util.Map; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Future; public class DummyProducer implements Producer<Long, EventBase> { private DummyKafka dummyKafka = DummyKafka.getDummyKafka(); @Override public Future<RecordMetadata> send(ProducerRecord<Long, EventBase> record) { long offset = dummyKafka.produceMessage(record.key(), record.value()); RecordMetadata metadata = new RecordMetadata(DummyKafka.TOPIC_PARTITION, offset, 0, 0, 0L, 0, 0); return CompletableFuture.completedFuture(metadata); } @Override public void initTransactions() { } @Override public void beginTransaction() throws ProducerFencedException { } @Override public void sendOffsetsToTransaction(Map<TopicPartition, OffsetAndMetadata> offsets, String consumerGroupId) throws ProducerFencedException { } @Override public void commitTransaction() throws ProducerFencedException { } @Override public void abortTransaction() throws ProducerFencedException { } @Override public Future<RecordMetadata> send(ProducerRecord<Long, EventBase> record, Callback callback) { return null; } @Override public void flush() { } @Override public List<PartitionInfo> partitionsFor(String topic) { return null; } @Override public Map<MetricName, ? extends Metric> metrics() { return null; } @Override public void close() { } @Override public void close(Duration timeout) { } }
2a5415a3217d7c185457368fb699016096efe59a
5f134139cafe54d9a90a05283478eecd70080acc
/src/graph/AdjListGraph.java
242076d36132e8fe993aad927e32e0bb4380c8ec
[]
no_license
dingweiqings/data_structure
619fcc80f54df6bd293d73b6295fc370c3db7ff2
596761202e9dbaad713d135151c3a6517350c844
refs/heads/master
2023-03-09T08:45:47.907056
2021-02-22T01:42:59
2021-02-22T01:42:59
325,736,315
0
0
null
null
null
null
GB18030
Java
false
false
4,490
java
package graph; import list.Node; import list.SeqList; import list.SortedSinglyLinkedList; /** * 邻接表表示的带权图类 */ public class AdjListGraph<T> extends AbstractGraph<T> { protected SeqList<Vertex<T>> vertexlist;// 顶点顺序表 int MAX_WEIGHT = 99999;// 最大权值 // 构造方法,size指定顶点顺序表容量 public AdjListGraph(int size) { size = size < 10 ? 10 : size; this.vertexlist = new SeqList<Vertex<T>>(size); } // 以顶点集合和边结合构造一个图 public AdjListGraph(T[] vertices, Edge[] edges) { this(vertices.length * 2); if (vertices != null) for (int i = 0; i < vertices.length; i++) insertVertex(vertices[i]); if (edges != null) for (int j = 0; j < edges.length; j++) insertEdge(edges[j]); } // 返回顶点数 public int vertexCount() { return this.vertexlist.length(); } // 返回顶点i的数据元素,若i指定元素无效,则返回null public T get(int i) { return this.vertexlist.get(i).data; } // 返回<vi.vj>边的权值 public int getWeight(int i, int j) { int n = this.vertexCount(); if (i >= 0 && i < n && j >= 0 && j < n) { if (i == j) return 0; Node<Edge> p = this.vertexlist.get(i).adjlink.head.next;// 第i条边的单链表的第一个节点 while (p != null) { if (p.data.dest == j) return p.data.weight;// 返回<vi,vj>的权值 p = p.next; } return MAX_WEIGHT; } throw new IndexOutOfBoundsException("i = " + i + "j=" + j);// 抛出序号越界异常 } // 返回图的顶点集合和邻接表描述字符串 public String toString() { return "出边表: \n" + this.vertexlist.toString() + "\n"; } // 插入元素为x的顶点,返回该顶点在顶点顺序表中的序号 public int insertVertex(T x) { this.vertexlist.append(new Vertex<T>(x));// 顺序表追加元素,自动扩容 return this.vertexlist.length() - 1; } // 插入一条权值为weight的边<vi,vj>,若该边已存在,则不插入 public void insertEdge(int i, int j, int weight) { if (i >= 0 && i < vertexCount() && j >= 0 && j < vertexCount() && j != i) { Edge edge = new Edge(i, j, weight); SortedSinglyLinkedList<Edge> adjlink = this.vertexlist.get(i).adjlink;// 获得第i条边单链表 Node<Edge> front = adjlink.head, p = front.next; while (p != null && p.data.compareTo(edge) < 0) {// 寻找插入位置 front = p; p = p.next; } if (p != null && p.data.compareTo(edge) == 0)// 若该边已存在,则不插入 return; front.next = new Node<Edge>(edge, p);// 将edge边结点插入到front结点之后 } } // 插入一条边 public void insertEdge(Edge e) { insertEdge(e.start, e.dest, e.weight); } // 删除边<vi,vj>,i,j指定顶点序号 public void removeEdge(int i, int j) { if (i >= 0 && i < vertexCount() && j >= 0 && j < vertexCount() && i != j) { this.vertexlist.get(i).adjlink.remove(new Edge(i, j, 1));// 调用排序单链表的删除操作 // 在第i条边单链表删除指定结点,查找依据是Edge的compareTo(e)方法返回0 } } // 删除边 public void removeEdge(Edge edge) { removeEdge(edge.start, edge.dest); } // 删除序号weivi的顶点及其关联的边 public void removeVertex(int i) { int n = vertexCount();// 删除之前的顶点数 if (i < 0 || i > n) return; this.vertexlist.remove(i);// 顶点序号减1 for (int j = 0; j < n - 1; j++) {// 未删除的边结点更改某些顶点序号 Node<Edge> front = this.vertexlist.get(j).adjlink.head; Node<Edge> p = front.next; while (p != null) { Edge e = p.data; if (e.start == i || e.dest == i) { front.next = p.next; p = front.next; } else { if (e.start > i) e.start--;// 顶点序号减1 if (e.dest > i) e.dest--; front = p; p = p.next; } } } } @Override // 返回//返回vi在vj的下一个邻接矩阵顶点序号 // 当j = -1时,返回vi的第一个邻接顶点序号,若不存在邻接顶点返回-1 public int getNextNeighbor(int i, int j) { int n = this.vertexCount(); if (i >= 0 && i < n && j >= -1 && j < n && j != i) { Node<Edge> p = this.vertexlist.get(i).adjlink.head.next;// 获得第i条边单链表首个结点 while (p != null) {// 寻找下一个邻接顶点 if (p.data.dest > j)// 当j=-1时,返回第一个邻接顶点序号 return p.data.dest;// 返回下一个邻接顶点序号 p = p.next; } } return -1; } }
d7f5cc4a4f3b51fdea4ffd4a5c203e591159faa6
7024a95129d5d04c4ef563a1004b237348f1617a
/android/src/com/geek_alarm/android/tasks/Task.java
de9bc8d7848dcd74af15a6a7389c5cf7124038b6
[]
no_license
nbeloglazov/GeekAlarm
dd70166d6dd63e3e1a32c09de23195d44840875a
6c8a0c04a90c77ce5315b6593468a4a1d1ff08e7
refs/heads/master
2020-12-24T13:44:42.990313
2015-12-04T07:05:40
2015-12-04T07:05:40
1,970,813
3
2
null
null
null
null
UTF-8
Java
false
false
1,378
java
package com.geek_alarm.android.tasks; import android.graphics.Bitmap; public class Task { private Bitmap question; private Bitmap[] choices; private int correct; private String id; private TaskType type; // Error message id is needed // when task downloading is failed. private int errorMessageId; public Task() { choices = new Bitmap[4]; } public Bitmap getQuestion() { return question; } public void setQuestion(Bitmap question) { this.question = question; } public Bitmap getChoice(int num) { return choices[num]; } public void setChoices(Bitmap[] choices) { this.choices = choices; } public void setChoice(int pos, Bitmap choice) { choices[pos] = choice; } public int getCorrect() { return correct; } public void setCorrect(int correct) { this.correct = correct; } public int getErrorMessageId() { return errorMessageId; } public void setErrorMessageId(int errorMessageId) { this.errorMessageId = errorMessageId; } public void setId(String id) { this.id = id; } public String getId() { return id; } public TaskType getType() { return type; } public void setType(TaskType type) { this.type = type; } }
737f8eaa2186e722e7c07cc43a7f3df538009f4d
3fd527ca09d2e181d7d652c242d58aa033134bf4
/src/main/java/lpf/learn/leetcode/tags/string/CompareVersionNumbers.java
030553a02c3ee59429fb9806c9b3dadac1b4e10d
[ "Apache-2.0" ]
permissive
liupengfei123/algorithm
fa47ec6f128d7a5ec75a78b14e0301b9361d13b9
f7106c90793d04fccb84cd32776587c2d1d607a6
refs/heads/master
2023-09-02T12:21:30.320443
2023-08-24T03:19:44
2023-08-24T03:19:44
253,813,334
1
0
Apache-2.0
2020-10-16T07:04:09
2020-04-07T14:12:16
Java
UTF-8
Java
false
false
2,826
java
package lpf.learn.leetcode.tags.string; /** [165]比较版本号 * 给你两个版本号 version1 和 version2 ,请你比较它们。 * 版本号由一个或多个修订号组成,各修订号由一个 '.' 连接。每个修订号由 多位数字 组成,可能包含 前导零 。每个版本号至少包含一个字符。修订号从左到右编号, * 下标从 0 开始,最左边的修订号下标为 0 ,下一个修订号下标为 1 ,以此类推。例如,2.5.33 和 0.1 都是有效的版本号。 * 比较版本号时,请按从左到右的顺序依次比较它们的修订号。比较修订号时,只需比较 忽略任何前导零后的整数值 。也就是说,修订号 1 和修订号 001 相等 。 * 如果版本号没有指定某个下标处的修订号,则该修订号视为 0 。例如,版本 1.0 小于版本 1.1 ,因为它们下标为 0 的修订号相同,而下标为 1 的修订号分别为 0 和 1 ,0 < 1 。 * * 返回规则如下: * 如果 version1 > version2 返回 1, * 如果 version1 < version2 返回 -1, * 除此之外返回 0。 * * 示例 1: * 输入:version1 = "1.01", version2 = "1.001" * 输出:0 * 解释:忽略前导零,"01" 和 "001" 都表示相同的整数 "1" * * 示例 2: * 输入:version1 = "1.0", version2 = "1.0.0" * 输出:0 * 解释:version1 没有指定下标为 2 的修订号,即视为 "0" * * 示例 3: * 输入:version1 = "0.1", version2 = "1.1" * 输出:-1 * 解释:version1 中下标为 0 的修订号是 "0",version2 中下标为 0 的修订号是 "1" 。0 < 1,所以 version1 < version2 * * 示例 4: * 输入:version1 = "1.0.1", version2 = "1" * 输出:1 * * 示例 5: * 输入:version1 = "7.5.2.4", version2 = "7.5.3" * 输出:-1 * * 提示: * 1 <= version1.length, version2.length <= 500 * version1 和 version2 仅包含数字和 '.' * version1 和 version2 都是 有效版本号 * version1 和 version2 的所有修订号都可以存储在 32 位整数 中 */ public class CompareVersionNumbers { public int compareVersion(String version1, String version2) { int[] ints1 = help(version1); int[] ints2 = help(version2); int count = Math.max(ints1.length, ints2.length); for (int i = 0; i < count; i++) { int i1 = i < ints1.length ? ints1[i] : 0; int i2 = i < ints2.length ? ints2[i] : 0; if (i1 != i2) { return i1 > i2 ? 1 : -1; } } return 0; } private int[] help(String version) { String[] split = version.split("\\."); int[] value = new int[split.length]; for (int i = 0; i < split.length; i++) { value[i] = Integer.parseInt(split[i]); } return value; } }
239526b224f8479a5ac8bbbdd1dbb3fcc02f6f98
235db80a49708a0f1bd97e24cb9940738be3f324
/src/api/java/camus/service/camera/InternalAnnotationValue.java
2ab2e72143514abae984c4c923a314cba5f30a88
[]
no_license
kwlee0220/camus.model
e72df02364e6fc97de4c8a2870e2b6704825f8cd
c7c80d280cb8b137b8d563c8b04571ac81d648f5
refs/heads/master
2022-10-01T07:46:14.480814
2022-08-25T08:21:06
2022-08-25T08:21:06
81,835,819
0
0
null
null
null
null
UTF-8
Java
false
false
119
java
package camus.service.camera; /** * * @author Kang-Woo Lee */ public interface InternalAnnotationValue { }
c470e4c619d22e9d2cc7ee12110be3b790e22b5d
95e944448000c08dd3d6915abb468767c9f29d3c
/sources/com/bytedance/android/live/core/rxutils/autodispose/C3286w.java
fdd9bf12c70005f8721b4290f881d48fa4fa536f
[]
no_license
xrealm/tiktok-src
261b1faaf7b39d64bb7cb4106dc1a35963bd6868
90f305b5f981d39cfb313d75ab231326c9fca597
refs/heads/master
2022-11-12T06:43:07.401661
2020-07-04T20:21:12
2020-07-04T20:21:12
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,287
java
package com.bytedance.android.live.core.rxutils.autodispose; import com.bytedance.android.live.core.rxutils.autodispose.p155b.C3251c; import java.util.concurrent.atomic.AtomicReference; import p346io.reactivex.C47557ad; import p346io.reactivex.C7322c; import p346io.reactivex.observers.C47865a; import p346io.reactivex.p347b.C7321c; /* renamed from: com.bytedance.android.live.core.rxutils.autodispose.w */ final class C3286w<T> implements C3251c<T> { /* renamed from: a */ final AtomicReference<C7321c> f10011a = new AtomicReference<>(); /* renamed from: b */ final AtomicReference<C7321c> f10012b = new AtomicReference<>(); /* renamed from: c */ private final C7322c f10013c; /* renamed from: d */ private final C47557ad<? super T> f10014d; public final void dispose() { C3254d.m12292a(this.f10012b); C3254d.m12292a(this.f10011a); } public final boolean isDisposed() { if (this.f10011a.get() == C3254d.DISPOSED) { return true; } return false; } public final void onError(Throwable th) { if (!isDisposed()) { this.f10011a.lazySet(C3254d.DISPOSED); C3254d.m12292a(this.f10012b); this.f10014d.onError(th); } } public final void onSuccess(T t) { if (!isDisposed()) { this.f10011a.lazySet(C3254d.DISPOSED); C3254d.m12292a(this.f10012b); this.f10014d.onSuccess(t); } } public final void onSubscribe(C7321c cVar) { C32871 r0 = new C47865a() { public final void onComplete() { C3286w.this.f10012b.lazySet(C3254d.DISPOSED); C3254d.m12292a(C3286w.this.f10011a); } public final void onError(Throwable th) { C3286w.this.f10012b.lazySet(C3254d.DISPOSED); C3286w.this.onError(th); } }; if (C3275n.m12338a(this.f10012b, (C7321c) r0, getClass())) { this.f10014d.onSubscribe(this); this.f10013c.mo10176a(r0); C3275n.m12338a(this.f10011a, cVar, getClass()); } } C3286w(C7322c cVar, C47557ad<? super T> adVar) { this.f10013c = cVar; this.f10014d = adVar; } }
2a90ab42e2b0191715459a7d9e2022c7302b03ea
5736a126081c1593db2da3941bb8489d0a2c6b26
/src/MyTestPreparation01/T29_Inheritance.java
03e85ffa27c2463deb41b25172e09210cd39ddfa
[]
no_license
rori4/JavaCertification
008aeb772b971e6a32f653a8854e9b3e6bfa0b45
6bbeff8fc22a383b7ccb73b589b8fdda61d401b0
refs/heads/master
2020-04-14T16:16:46.278285
2019-01-15T15:36:57
2019-01-15T15:36:57
163,947,455
0
0
null
null
null
null
UTF-8
Java
false
false
598
java
package MyTestPreparation01; public class T29_Inheritance { public static void main(String[] args) { A class1 = new C(); B class2 = (B) class1; System.out.println(class1.name + " " + class2.getName()); } } class A { String name = "A"; String getName() { return name; } } class B extends A { String name = "B"; String getName() { return name; } } class C extends B { String name = "C10"; String getName() { return name; } } /* A C10 A B C10 B A A C10 C10 This will throw class cast exception */
c38e28680a677da8079e69211509961afab9e7f3
f86bdbd641b4fbb475e8b60200295ae4a213e786
/java/FileExamples/src/main/java/com/devdungeon/fileexamples/GetFileExtension.java
5662544feca37b29408a3ab57074a99e67338ed1
[]
no_license
bhoj001/Cookbook-1
e082f62234149f7256e9097a69b9a9b8c24a67e1
670063e702e09cf878ea12c25e963385ac326a78
refs/heads/master
2021-09-23T12:55:34.361313
2018-09-23T01:08:29
2018-09-23T01:08:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
870
java
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package com.devdungeon.fileexamples; import java.io.File; /** * * @author dtron */ public class GetFileExtension { public static void main(String[] args) { String homeDir = System.getProperty("user.home"); String newFilepath = homeDir + File.separator + "x" + File.separator + "test.txt"; System.out.println(getFileExtension(newFilepath)); } private static String getFileExtension(String filepath) { String[] splitFilepath = filepath.split("\\."); int index = splitFilepath.length -1; if (index < 0) { index = 0; } return splitFilepath[index]; } }
6c6a46443757d64dae6598d5ff39a97949a881ec
30eecc3dec9787ad105c7e69a6ea14d651864e97
/Vraag1/src/edu/ap/registration/RegistrationClient.java
fcf715815d565506d4a15f94408a7183a00964eb
[]
no_license
aikobeyers/ExamenWebtech3
1dea7eea03b3be06257b0e32d8bd6435466c3cc3
b457f39c29d957f8db73905c2b4f25d27cf90479
refs/heads/master
2021-01-11T16:09:43.473564
2017-01-25T14:29:52
2017-01-25T14:29:52
80,022,079
0
0
null
null
null
null
UTF-8
Java
false
false
1,282
java
package edu.ap.registration; import org.restlet.resource.ClientResource; public class RegistrationClient { public static void main(String[] args) { // TODO Auto-generated method stub try { ClientResource resource = new ClientResource("http://127.0.0.1:8080/hospital/registration"); // Post a new race String registration1 = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"; registration1 += "<registration name=\"Patient 3\" date=\"25/01/2017 13:67\" born=\"07/07/1991\" verpleegkundige=\"Nurse Mustang\">"; registration1 += "<diagnose>Coffee overdose.</diagnose></registration>"; String registration2 = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"; registration2 += "<registration name=\"Patient 4\" date=\"25/01/2017 11:24\" born=\"06/05/1997\" verpleegkundige=\"Nurse Charlie\">"; registration2 += "<diagnose>Energydrink overdose.</diagnose></registration>"; resource.post(registration1); resource.post(registration2); // get the response System.out.println(resource.getResponseEntity().getText()); } catch (Exception e) { System.out.println("In main : " + e.getMessage()); } } }
cbf7dcd812d885b52b681b472b08642a64f51eb7
15585b88f46335637a201702c975cfff6b71d97b
/app/src/bithumb/java/com/googry/coinonehelper/ui/main/orderbook/TradeAdapter.java
993792cfe30b3961e6bea850824c5449da861040
[ "Apache-2.0" ]
permissive
sjjeong/CoinoneHelper
85ef30072c4cedba27b8ae4be12a067e2b3a9d5c
4707e7925feedb64e716fbcee15eb3dd09111af6
refs/heads/master
2021-01-08T11:18:01.364516
2018-07-14T04:01:42
2018-07-14T04:01:42
92,571,479
15
2
null
null
null
null
UTF-8
Java
false
false
1,950
java
package com.googry.coinonehelper.ui.main.orderbook; import android.content.Context; import android.databinding.DataBindingUtil; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import com.googry.coinonehelper.R; import com.googry.coinonehelper.data.BithumbTrade; import com.googry.coinonehelper.databinding.TradeItemBinding; import java.util.ArrayList; import java.util.List; /** * Created by seokjunjeong on 2017. 6. 14.. */ public class TradeAdapter extends RecyclerView.Adapter<TradeAdapter.ViewHolder> { private List<BithumbTrade.CompleteOrder> mTrades; private Context mContext; public TradeAdapter(Context context) { mContext = context; mTrades = new ArrayList<>(); } public void setTrades(List<BithumbTrade.CompleteOrder> trades) { mTrades = trades; notifyDataSetChanged(); } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view = LayoutInflater.from(parent.getContext()) .inflate(R.layout.trade_item, parent, false); ViewHolder viewHolder = new ViewHolder(view); return viewHolder; } @Override public void onBindViewHolder(ViewHolder holder, int position) { holder.bind(mTrades.get(position)); } @Override public int getItemCount() { return mTrades.size(); } public class ViewHolder extends RecyclerView.ViewHolder { private TradeItemBinding binding; public ViewHolder(View itemView) { super(itemView); binding = DataBindingUtil.bind(itemView); } public void bind(BithumbTrade.CompleteOrder trade) { binding.setPrice(String.format("%,d", trade.price)); binding.setQty(String.format("%,.4f", trade.units_traded)); binding.setBuy(true); } } }
8f9900e1d12176b80d2f12bab8577914caa67f98
f4757eab219e9dd2300126dc0e8e4fb1e5e93f40
/android/app/src/main/java/com/uppointme/MainActivity.java
2e90ecd7fab6c052bca82679dd8559fb77d53872
[]
no_license
syeda-sumreen-ali/uppointme
637e3ef36f9f2772506d489bbfaf0a1cd19b0c1e
f8dfcdfdf1af9b4ce805b278ae5aae887c72e5ea
refs/heads/master
2023-05-29T16:27:01.208225
2021-06-20T18:21:06
2021-06-20T18:21:06
363,691,282
0
0
null
null
null
null
UTF-8
Java
false
false
345
java
package com.uppointme; import com.facebook.react.ReactActivity; public class MainActivity extends ReactActivity { /** * Returns the name of the main component registered from JavaScript. This is used to schedule * rendering of the component. */ @Override protected String getMainComponentName() { return "uppointme"; } }
977e13d514cce3d58ba4ac69e67757e10135daee
a6722a0f940a20a4da8315b22acd8de6f5459074
/pickerview/src/main/java/com/bigkoo/pickerview/listener/OnOptionsSelectListener.java
626e36cf8331fca5ec0f324e8931c92420865693
[]
no_license
iamzhangjunhui/GiftApplication
bc6e5a3b037caf40657c2cc2011ac1c2e0fcaa66
546031d9dbf92608cdfdabaefdd346e18557af86
refs/heads/master
2022-07-18T15:07:54.630034
2020-05-19T09:16:38
2020-05-19T09:16:38
264,140,006
0
0
null
null
null
null
UTF-8
Java
false
false
250
java
package com.bigkoo.pickerview.listener; import android.view.View; /** * Created by xiaosong on 2018/3/20. */ public interface OnOptionsSelectListener { void onOptionsSelect(int options1, int options2, int options3,int options4, View v); }
fc65cfe8b8365899c5d9107cad37e1ae516cd1a5
f806b59abc65b90afce72408d64811a1842d4503
/Marathon/src/marathon/Marathon.java
ae1c74bbe8bb57dcea11905facb0d378841576a3
[]
no_license
Roberto-O/HSCompProg
90b424e2eb2255a66c31c20a4feef7a6335010af
a3a4f4484ac6ef3b4020a9fa455ae70b614fcd33
refs/heads/master
2021-01-10T23:05:20.798197
2016-10-10T00:02:46
2016-10-10T00:02:46
70,426,859
0
0
null
null
null
null
UTF-8
Java
false
false
9,378
java
package marathon; import java.io.*; import java.util.*; import javax.swing.*; import java.text.*; public class Marathon { public static void main(String[] args) throws FileNotFoundException, IOException { String filename = "H:\\run.txt"; //Here you must write the path to the file f.exp "//folder//file.txt" try{ FileReader readConnectionToFile = new FileReader(filename); BufferedReader reads = new BufferedReader(readConnectionToFile); Scanner scan = new Scanner(reads); String[][] temperatures = new String[5][8]; int counter = 0; try{ while(scan.hasNext() /*&& counter < 5*/){ for(int i = 0; i < 5; i++){ //counter = counter + 1; for(int m = 0; m < 8; m++){ temperatures[i][m] = scan.nextLine(); } } } //for(int i = 0; i < 5; i++){ System.out.println(temperatures[0][0] + "\nMiles each day: " + temperatures[0][1] + ", " + temperatures[0][2] + ", " + temperatures[0][3] + ", " + temperatures[0][4] + ", " + temperatures[0][5] + ", " + temperatures[0][6] + ", " + temperatures[0][7] + "\nTotal miles for the week: " + sum1(temperatures) + "\nThe average: " + arrAvg1(temperatures) +"\n"); System.out.println(temperatures[1][0] + "\nMiles each day: " + temperatures[1][1] + ", " + temperatures[1][2] + ", " + temperatures[1][3] + ", " + temperatures[1][4] + ", " + temperatures[1][5] + ", " + temperatures[1][6] + ", " + temperatures[1][7] + "\nTotal miles for the week: " + sum2(temperatures) + "\nThe average: " + arrAvg2(temperatures) +"\n"); System.out.println(temperatures[2][0] + "\nMiles each day: " + temperatures[2][1] + ", " + temperatures[2][2] + ", " + temperatures[2][3] + ", " + temperatures[2][4] + ", " + temperatures[2][5] + ", " + temperatures[2][6] + ", " + temperatures[2][7] + "\nTotal miles for the week: " + sum3(temperatures) + "\nThe average: " + arrAvg3(temperatures) +"\n"); System.out.println(temperatures[3][0] + "\nMiles each day: " + temperatures[3][1] + ", " + temperatures[3][2] + ", " + temperatures[3][3] + ", " + temperatures[3][4] + ", " + temperatures[3][5] + ", " + temperatures[3][6] + ", " + temperatures[3][7] + "\nTotal miles for the week: " + sum4(temperatures) + "\nThe average: " + arrAvg4(temperatures) +"\n"); System.out.println(temperatures[4][0] + "\nMiles each day: " + temperatures[4][1] + ", " + temperatures[4][2] + ", " + temperatures[4][3] + ", " + temperatures[4][4] + ", " + temperatures[4][5] + ", " + temperatures[4][6] + ", " + temperatures[4][7] + "\nTotal miles for the week: " + sum5(temperatures) + "\nThe average: " + arrAvg5(temperatures) +"\n"); //} } catch(InputMismatchException e){ System.out.println("Error converting number"); } scan.close(); reads.close(); } catch (FileNotFoundException e){ System.out.println("File not found" + filename); } catch (IOException e){ System.out.println("IO-Error open/close of file" + filename); } } public static String sum1(String a[][]) { int f1 = Integer.parseInt(a[0][1]); int f2 = Integer.parseInt(a[0][2]); int f3 = Integer.parseInt(a[0][3]); int f4 = Integer.parseInt(a[0][4]); int f5 = Integer.parseInt(a[0][5]); int f6 = Integer.parseInt(a[0][6]); int f7 = Integer.parseInt(a[0][7]); int sum = f1+f2+f3+f4+f5+f6+f7; String str1 = (Integer.valueOf(sum)).toString(); return str1; } public static String sum2(String a[][]) { int f1 = Integer.parseInt(a[1][1]); int f2 = Integer.parseInt(a[1][2]); int f3 = Integer.parseInt(a[1][3]); int f4 = Integer.parseInt(a[1][4]); int f5 = Integer.parseInt(a[1][5]); int f6 = Integer.parseInt(a[1][6]); int f7 = Integer.parseInt(a[1][7]); int sum = f1+f2+f3+f4+f5+f6+f7; String str1 = (Integer.valueOf(sum)).toString(); return str1; } public static String sum3(String a[][]) { int f1 = Integer.parseInt(a[2][1]); int f2 = Integer.parseInt(a[2][2]); int f3 = Integer.parseInt(a[2][3]); int f4 = Integer.parseInt(a[2][4]); int f5 = Integer.parseInt(a[2][5]); int f6 = Integer.parseInt(a[2][6]); int f7 = Integer.parseInt(a[2][7]); int sum = f1+f2+f3+f4+f5+f6+f7; String str1 = (Integer.valueOf(sum)).toString(); return str1; } public static String sum4(String a[][]) { int f1 = Integer.parseInt(a[3][1]); int f2 = Integer.parseInt(a[3][2]); int f3 = Integer.parseInt(a[3][3]); int f4 = Integer.parseInt(a[3][4]); int f5 = Integer.parseInt(a[3][5]); int f6 = Integer.parseInt(a[3][6]); int f7 = Integer.parseInt(a[3][7]); int sum = f1+f2+f3+f4+f5+f6+f7; String str1 = (Integer.valueOf(sum)).toString(); return str1; } public static String sum5(String a[][]) { int f1 = Integer.parseInt(a[4][1]); int f2 = Integer.parseInt(a[4][2]); int f3 = Integer.parseInt(a[4][3]); int f4 = Integer.parseInt(a[4][4]); int f5 = Integer.parseInt(a[4][5]); int f6 = Integer.parseInt(a[4][6]); int f7 = Integer.parseInt(a[4][7]); int sum = f1+f2+f3+f4+f5+f6+f7; String str1 = (Integer.valueOf(sum)).toString(); return str1; } public static String arrAvg1(String a[][]) { int f1 = Integer.parseInt(a[0][1]); int f2 = Integer.parseInt(a[0][2]); int f3 = Integer.parseInt(a[0][3]); int f4 = Integer.parseInt(a[0][4]); int f5 = Integer.parseInt(a[0][5]); int f6 = Integer.parseInt(a[0][6]); int f7 = Integer.parseInt(a[0][7]); int sum = f1+f2+f3+f4+f5+f6+f7; String str1 = (Integer.valueOf(sum)).toString(); double sum2 = (Double.valueOf(sum)).doubleValue(); double avg = sum2 / 7; DecimalFormat dollars = new DecimalFormat("0.00"); avg = Double.parseDouble(dollars.format(avg)); String str2 = (Double.valueOf(avg)).toString(); return str2; } public static String arrAvg2(String a[][]) { int f1 = Integer.parseInt(a[1][1]); int f2 = Integer.parseInt(a[1][2]); int f3 = Integer.parseInt(a[1][3]); int f4 = Integer.parseInt(a[1][4]); int f5 = Integer.parseInt(a[1][5]); int f6 = Integer.parseInt(a[1][6]); int f7 = Integer.parseInt(a[1][7]); int sum = f1+f2+f3+f4+f5+f6+f7; String str1 = (Integer.valueOf(sum)).toString(); double sum2 = (Double.valueOf(sum)).doubleValue(); double avg = sum2 / 7; DecimalFormat dollars = new DecimalFormat("0.00"); avg = Double.parseDouble(dollars.format(avg)); String str2 = (Double.valueOf(avg)).toString(); return str2; } public static String arrAvg3(String a[][]) { int f1 = Integer.parseInt(a[2][1]); int f2 = Integer.parseInt(a[2][2]); int f3 = Integer.parseInt(a[2][3]); int f4 = Integer.parseInt(a[2][4]); int f5 = Integer.parseInt(a[2][5]); int f6 = Integer.parseInt(a[2][6]); int f7 = Integer.parseInt(a[2][7]); int sum = f1+f2+f3+f4+f5+f6+f7; String str1 = (Integer.valueOf(sum)).toString(); double sum2 = (Double.valueOf(sum)).doubleValue(); double avg = sum2 / 7; DecimalFormat dollars = new DecimalFormat("0.00"); avg = Double.parseDouble(dollars.format(avg)); String str2 = (Double.valueOf(avg)).toString(); return str2; } public static String arrAvg4(String a[][]) { int f1 = Integer.parseInt(a[3][1]); int f2 = Integer.parseInt(a[3][2]); int f3 = Integer.parseInt(a[3][3]); int f4 = Integer.parseInt(a[3][4]); int f5 = Integer.parseInt(a[3][5]); int f6 = Integer.parseInt(a[3][6]); int f7 = Integer.parseInt(a[3][7]); int sum = f1+f2+f3+f4+f5+f6+f7; String str1 = (Integer.valueOf(sum)).toString(); double sum2 = (Double.valueOf(sum)).doubleValue(); double avg = sum2 / 7; DecimalFormat dollars = new DecimalFormat("0.00"); avg = Double.parseDouble(dollars.format(avg)); String str2 = (Double.valueOf(avg)).toString(); return str2; } public static String arrAvg5(String a[][]) { int f1 = Integer.parseInt(a[4][1]); int f2 = Integer.parseInt(a[4][2]); int f3 = Integer.parseInt(a[4][3]); int f4 = Integer.parseInt(a[4][4]); int f5 = Integer.parseInt(a[4][5]); int f6 = Integer.parseInt(a[4][6]); int f7 = Integer.parseInt(a[4][7]); int sum = f1+f2+f3+f4+f5+f6+f7; String str1 = (Integer.valueOf(sum)).toString(); double sum2 = (Double.valueOf(sum)).doubleValue(); double avg = sum2 / 7; DecimalFormat dollars = new DecimalFormat("0.00"); avg = Double.parseDouble(dollars.format(avg)); String str2 = (Double.valueOf(avg)).toString(); return str2; } }
3ec96d1b0e94f5e02bc76ee4b84b4f605e4a9b48
f513ca52048c4dbd4c3f3ae733fb0f107f94d64c
/backup/lama/TabAbsensiApp/app/src/main/java/com/example/tababsensiapp/Models/Admin.java
86a506b0d9ab16aa4b1b5855287eeb03583dac54
[]
no_license
palindungan/tab_absen
cd74fee27a3f4a5d88af9dd255e47c7f013c2bce
2bdc5455b272e2c6aa4fd0e821c927e806dd633a
refs/heads/master
2020-08-12T19:48:40.511442
2020-07-30T12:00:41
2020-07-30T12:00:41
214,831,835
0
0
null
null
null
null
UTF-8
Java
false
false
677
java
package com.example.tababsensiapp.Models; public class Admin{ String id_admin, nama, username, foto; public String getId_admin() { return id_admin; } public void setId_admin(String id_admin) { this.id_admin = id_admin; } public String getNama() { return nama; } public void setNama(String nama) { this.nama = nama; } public String getUsername() { return username; } public void setUsername(String username) { this.username = username; } public String getFoto() { return foto; } public void setFoto(String foto) { this.foto = foto; } }
67f4d2e389032c4f039c17c013c092f09b8237d1
2a8a8d209285d5b0e2ae754c061f78e1514b9362
/mylibrary/src/androidTest/java/com/jain/mylibrary/ExampleInstrumentedTest.java
50f984a7d34b068d92b987e63731b2845f75ffb3
[]
no_license
ankitjain10/MyLibraryExample
4b94ac1204976d572f6c323a794ac60946b51126
168f9d8aee35496f1490b470efcb7c076cf14c25
refs/heads/master
2023-03-19T01:34:03.364705
2021-01-15T03:29:38
2021-01-15T03:29:38
326,182,255
0
0
null
null
null
null
UTF-8
Java
false
false
755
java
package com.jain.mylibrary; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.jain.mylibrary.test", appContext.getPackageName()); } }
b07e101c2520d5135cc08bccd74977f379b83a1d
79860692cd03028f9d77be035cd040b3099caf2a
/2019-2/모바일/201501967 조기성 모바일프로그래밍 완성본/GuardianAngel 프로젝트 디렉토리/app/src/test/java/com/example/guardianangel/ExampleUnitTest.java
cf113c743b1496984d28a6fe7b7d51b97da592f7
[]
no_license
chogiseong/University
46dd628e0431c91a709157c77dd38149af8bb763
969d455ed8d1d517b76c4473043d0e4d2e0ac679
refs/heads/main
2022-12-31T13:35:37.529105
2020-10-21T00:18:57
2020-10-21T00:18:57
305,630,256
0
0
null
null
null
null
UTF-8
Java
false
false
386
java
package com.example.guardianangel; 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); } }
615ea94674d83e9d737c8a096eda2795a090c34b
3030c25834fed3ef823cfa7ad309615b8ff0f62b
/qizhiwei20171211/src/main/java/com/bwei/qizhiwei20171211/bean/HomeBean.java
352aea5cc027e166202aad815cbb942c394b4788
[]
no_license
shixuerenxin/Qizhiwei20171120
98fda98ea9996518f533793c4bc004eaf48ecc28
20a8dd42ceb3bab9b8ec03a3be9ae78f390507e2
refs/heads/master
2021-08-30T15:09:06.495411
2017-12-18T11:37:39
2017-12-18T11:37:39
114,633,878
0
0
null
null
null
null
UTF-8
Java
false
false
12,923
java
package com.bwei.qizhiwei20171211.bean; import java.util.List; /** * author:Created by QiZhiWei on 2017/12/11. */ public class HomeBean { /** * msg : 请求成功 * code : 0 * data : [{"bargainPrice":99,"createtime":"2017-10-14T21:38:26","detailUrl":"https://item.m.jd.com/product/4345173.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t6037/35/2944615848/95178/6cd6cff0/594a3a10Na4ec7f39.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t6607/258/1025744923/75738/da120a2d/594a3a12Ne3e6bc56.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t6370/292/1057025420/64655/f87644e3/594a3a12N5b900606.jpg!q70.jpg","itemtype":1,"pid":45,"price":2999,"pscid":39,"salenum":4666,"sellerid":1,"subhead":"高清双摄,就是清晰!2000+1600万高清摄像头,6GB大内存+高通骁龙835处理器,性能怪兽!","title":"一加手机5 (A5000) 6GB+64GB 月岩灰 全网通 双卡双待 移动联通电信4G手机"},{"bargainPrice":6666,"createtime":"2017-10-10T16:01:31","detailUrl":"https://item.m.jd.com/product/5089273.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t8284/363/1326459580/71585/6d3e8013/59b857f2N6ca75622.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t9346/182/1406837243/282106/68af5b54/59b8480aNe8af7f5c.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8434/54/1359766007/56140/579509d9/59b85801Nfea207db.jpg!q70.jpg","itemtype":0,"pid":46,"price":234,"pscid":39,"salenum":868,"sellerid":2,"subhead":"【iPhone新品上市】新一代iPhone,让智能看起来更不一样","title":"Apple iPhone 8 Plus (A1864) 64GB 金色 移动联通电信4G手机"},{"bargainPrice":1599,"createtime":"2017-10-14T21:48:08","detailUrl":"https://item.m.jd.com/product/1993026402.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t5863/302/8961270302/97126/41feade1/5981c81cNc1b1fbef.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t7003/250/1488538438/195825/53bf31ba/5981c57eN51e95176.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t5665/100/8954482513/43454/418611a9/5981c57eNd5fc97ba.jpg!q70.jpg","itemtype":2,"pid":47,"price":111,"pscid":39,"salenum":757,"sellerid":3,"subhead":"碳黑色 32GB 全网通 官方标配 1件","title":"锤子 坚果Pro 特别版 巧克力色 酒红色 全网通 移动联通电信4G手机 双卡双待 碳黑色 32GB 全网通"},{"bargainPrice":3455,"createtime":"2017-10-14T21:38:26","detailUrl":"https://item.m.jd.com/product/12224420750.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8803/356/1478945529/489755/2a163ace/59ba5e84N7bb9a666.jpg!q70.jpg","itemtype":1,"pid":48,"price":222,"pscid":39,"salenum":656,"sellerid":4,"subhead":"【现货新品抢购】全面屏2.0震撼来袭,骁龙835处理器,四曲面陶瓷机","title":"小米(MI) 小米MIX2 手机 黑色 全网通 (6GB+64GB)【标配版】"},{"bargainPrice":1999,"createtime":"2017-10-10T16:09:02","detailUrl":"https://item.m.jd.com/product/5025971.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t7210/232/3738666823/232298/9004583e/59c3a9a7N8de42e15.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8356/82/2107423621/109733/c019b8c6/59c3a9a6Ne9a4bdd7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t10219/74/25356012/171379/7d55e296/59c3a9a8N82fa6e02.jpg!q70.jpg","itemtype":0,"pid":49,"price":333,"pscid":39,"salenum":123,"sellerid":5,"subhead":"vivo X20 带你开启全面屏时代!逆光也清晰,照亮你的美!","title":"vivo X20 全面屏手机 全网通 4GB+64GB 金色 移动联通电信4G手机 双卡双待"},{"bargainPrice":3455,"createtime":"2017-10-14T21:48:08","detailUrl":"https://item.m.jd.com/product/12224420750.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8803/356/1478945529/489755/2a163ace/59ba5e84N7bb9a666.jpg!q70.jpg","itemtype":2,"pid":50,"price":444,"pscid":39,"salenum":54,"sellerid":6,"subhead":"【现货新品抢购】全面屏2.0震撼来袭,骁龙835处理器,四曲面陶瓷机","title":"小米(MI) 小米MIX2 手机 黑色 全网通 (6GB+64GB)【标配版】"},{"bargainPrice":3455,"createtime":"2017-10-14T21:38:26","detailUrl":"https://item.m.jd.com/product/12224420750.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8803/356/1478945529/489755/2a163ace/59ba5e84N7bb9a666.jpg!q70.jpg","itemtype":1,"pid":51,"price":555,"pscid":39,"salenum":424,"sellerid":7,"subhead":"【现货新品抢购】全面屏2.0震撼来袭,骁龙835处理器,四曲面陶瓷机","title":"小米(MI) 小米MIX2 手机 黑色 全网通 (6GB+64GB)【标配版】"},{"bargainPrice":3455,"createtime":"2017-10-03T23:53:28","detailUrl":"https://item.m.jd.com/product/12224420750.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8803/356/1478945529/489755/2a163ace/59ba5e84N7bb9a666.jpg!q70.jpg","itemtype":0,"pid":52,"price":666,"pscid":39,"salenum":212,"sellerid":8,"subhead":"【现货新品抢购】全面屏2.0震撼来袭,骁龙835处理器,四曲面陶瓷机","title":"小米(MI) 小米MIX2 手机 黑色 全网通 (6GB+64GB)【标配版】"},{"bargainPrice":2999,"createtime":"2017-10-14T21:48:08","detailUrl":"https://item.m.jd.com/product/2385655.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t2068/298/2448145915/157953/7be197df/56d51a42Nd86f1c8e.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t2437/128/1687178395/117431/bcc190c1/56d3fcbaNb2963d21.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t2467/222/2263160610/95597/927b8a2f/56d3eafeNdecebeb6.jpg!q70.jpg","itemtype":2,"pid":53,"price":777,"pscid":39,"salenum":0,"sellerid":9,"subhead":"Super AMOLED三星双曲面2K 屏,支持无线充电!","title":"三星 Galaxy S7 edge(G9350)4GB+32GB 铂光金 移动联通电信4G手机 双卡双待"},{"bargainPrice":3455,"createtime":"2017-10-03T23:53:28","detailUrl":"https://item.m.jd.com/product/12224420750.html?utm_source=androidapp&utm_medium=appshare&utm_campaign=t_335139774&utm_term=QQfriends","images":"https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t9106/106/1785172479/537280/253bc0ab/59bf78a7N057e5ff7.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8461/5/1492479653/68388/7255e013/59ba5e84N91091843.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t8803/356/1478945529/489755/2a163ace/59ba5e84N7bb9a666.jpg!q70.jpg","itemtype":0,"pid":54,"price":888,"pscid":39,"salenum":7575,"sellerid":10,"subhead":"【现货新品抢购】全面屏2.0震撼来袭,骁龙835处理器,四曲面陶瓷机","title":"小米(MI) 小米MIX2 手机 黑色 全网通 (6GB+64GB)【标配版】"}] * page : 1 */ private String msg; private String code; private String page; private List<DataBean> data; public String getMsg() { return msg; } public void setMsg(String msg) { this.msg = msg; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public String getPage() { return page; } public void setPage(String page) { this.page = page; } public List<DataBean> getData() { return data; } public void setData(List<DataBean> data) { this.data = data; } public static class DataBean { /** * bargainPrice : 99.0 * createtime : 2017-10-14T21:38:26 * detailUrl : https://item.m.jd.com/product/4345173.html?utm#_source=androidapp&utm#_medium=appshare&utm#_campaign=t#_335139774&utm#_term=QQfriends * images : https://m.360buyimg.com/n0/jfs/t6037/35/2944615848/95178/6cd6cff0/594a3a10Na4ec7f39.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t6607/258/1025744923/75738/da120a2d/594a3a12Ne3e6bc56.jpg!q70.jpg|https://m.360buyimg.com/n0/jfs/t6370/292/1057025420/64655/f87644e3/594a3a12N5b900606.jpg!q70.jpg * itemtype : 1 * pid : 45 * price : 2999.0 * pscid : 39 * salenum : 4666 * sellerid : 1 * subhead : 高清双摄,就是清晰!2000+1600万高清摄像头,6GB大内存+高通骁龙835处理器,性能怪兽! * title : 一加手机5 (A5000) 6GB+64GB 月岩灰 全网通 双卡双待 移动联通电信4G手机 */ private double bargainPrice; private String createtime; private String detailUrl; private String images; private int itemtype; private int pid; private double price; private int pscid; private int salenum; private int sellerid; private String subhead; private String title; public double getBargainPrice() { return bargainPrice; } public void setBargainPrice(double bargainPrice) { this.bargainPrice = bargainPrice; } public String getCreatetime() { return createtime; } public void setCreatetime(String createtime) { this.createtime = createtime; } public String getDetailUrl() { return detailUrl; } public void setDetailUrl(String detailUrl) { this.detailUrl = detailUrl; } public String getImages() { return images; } public void setImages(String images) { this.images = images; } public int getItemtype() { return itemtype; } public void setItemtype(int itemtype) { this.itemtype = itemtype; } public int getPid() { return pid; } public void setPid(int pid) { this.pid = pid; } public double getPrice() { return price; } public void setPrice(double price) { this.price = price; } public int getPscid() { return pscid; } public void setPscid(int pscid) { this.pscid = pscid; } public int getSalenum() { return salenum; } public void setSalenum(int salenum) { this.salenum = salenum; } public int getSellerid() { return sellerid; } public void setSellerid(int sellerid) { this.sellerid = sellerid; } public String getSubhead() { return subhead; } public void setSubhead(String subhead) { this.subhead = subhead; } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } } }
96a27ac0445900d008cda8beeb65e760d40bc66c
624423bd2735d64a2455483ffec9ca63f8f4841b
/src/main/java/com/test/current/account/api/model/CreateAccountResponse.java
062e3dcf11b4c7765045e11431430bb01ba2057b
[]
no_license
barbupetcu/current-account
012a6ffead5ae3f5f879b05e4c6d4a581bfa348e
b38c8d68dee0346fb479a4df2643db1beb605e50
refs/heads/master
2023-03-17T12:26:26.533699
2021-02-23T20:28:39
2021-02-23T20:28:39
340,405,160
0
0
null
null
null
null
UTF-8
Java
false
false
305
java
package com.test.current.account.api.model; import lombok.AllArgsConstructor; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; @Getter @Setter @NoArgsConstructor @AllArgsConstructor(staticName = "aResponse") public class CreateAccountResponse { private Long accountId; }
185babff7edbf9e24c9e612285127d5ce9389903
f1767bb0230abafc2b09555d05f6543dade691eb
/helloworld.eureka.server2/src/main/java/com/eureka/server/EurekaServer2Application.java
520c0d06c127cca879f39b315f6c9a30af066b6f
[]
no_license
mrqiang1/spring_cloud
9a9428b5f256d4d1012a71cdf54ce397b8c9a4df
82a8b1001101e16e7dc0435a8e385b5b117e5bb1
refs/heads/master
2020-04-30T06:49:32.205277
2019-03-21T01:39:41
2019-03-21T01:39:58
176,664,324
0
0
null
null
null
null
UTF-8
Java
false
false
420
java
package com.eureka.server; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer; @EnableEurekaServer @SpringBootApplication public class EurekaServer2Application { public static void main(String[] args) { SpringApplication.run(EurekaServer2Application.class, args); } }
c0f1b927c56fb542520fd537d11993c1aa749473
41eb70484988b9804285dd18b8e420ce4bf1e3f3
/src/com/gmail/schcrabicus/prospring3/tutorials/ch8/jdbc/basic/PlainJDBCSample.java
3c6d61089ee5d24e259dbaf2d5758da25f160c64
[]
no_license
schCRABicus/prospring3-tutorials
2c44cb92eeb4cf4f45361734fa7ce10b76c2df5c
42ecab2370fc861feb3c9dc84304594dab9d8c4c
refs/heads/master
2016-09-06T09:01:45.198649
2013-02-21T05:04:37
2013-02-21T05:04:37
null
0
0
null
null
null
null
UTF-8
Java
false
false
1,814
java
package com.gmail.schcrabicus.prospring3.tutorials.ch8.jdbc.basic; import com.gmail.schcrabicus.prospring3.tutorials.ch8.jdbc.basic.dao.IContactDao; import com.gmail.schcrabicus.prospring3.tutorials.ch8.jdbc.basic.dao.PlainJDBCContactDao; import com.gmail.schcrabicus.prospring3.tutorials.ch8.jdbc.rowMapper.Contact; import java.sql.Date; import java.util.GregorianCalendar; import java.util.List; /** * Created with IntelliJ IDEA. * User: schcrabicus * Date: 24.01.13 * Time: 8:35 * To change this template use File | Settings | File Templates. */ public class PlainJDBCSample { private static IContactDao contactDao = new PlainJDBCContactDao(); public static void main(String[] args) { // List all contacts System.out.println("Listing initial contact data:"); listAllContacts(); System.out.println(); // Insert a new contact System.out.println("Insert a new contact"); Contact contact = new Contact(); contact.setFirstName("Jacky"); contact.setLastName("Chan"); contact.setBirthDate(new Date((new GregorianCalendar(2001, 10, 1)).getTime().getTime())); contactDao.create(contact); System.out.println("Listing contact data after new contact created:"); listAllContacts(); System.out.println(); // Delete the above newly created contact System.out.println("Deleting the previous created contact"); contactDao.delete(contact); System.out.println("Listing contact data after new contact deleted:"); listAllContacts(); } private static void listAllContacts() { List<Contact> contacts = contactDao.findAll(); for (Contact contact: contacts) { System.out.println(contact); } } }
95957db95b7e2d259c27f50c8c00f7090f850d98
9946e6fcf67a0d7e32eab667e2cc53267acf781b
/ObjGenerator/src/objgenerator/ObjGenerator.java
a3bbab85cb87d09296381d2aafb4365b1da3dcc8
[ "MIT" ]
permissive
kmhasan-class/fall2016cg
52f679aace8b85c57fa35554dc3468440d82fb15
85d0df646253b7ac9fae606b6d66e6c0d87547e9
refs/heads/master
2021-01-12T16:25:47.353703
2016-11-20T06:37:46
2016-11-20T06:37:46
69,270,465
0
1
null
null
null
null
UTF-8
Java
false
false
1,508
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 objgenerator; /** * * @author kmhasan */ public class ObjGenerator { public ObjGenerator() { int n = 10; double r = 1.0; double h = 2.0; System.out.printf("o Prism\n"); for (int i = 0; i < n; i++) { double x; double y; double z; double theta = 2 * Math.PI / n * i; x = r * Math.cos(theta); y = r * Math.sin(theta); z = 0; System.out.printf("v %.3f %.3f %.3f\n", x, y, z); } for (int i = 0; i < n; i++) { double x; double y; double z; double theta = 2 * Math.PI / n * i; x = r * Math.cos(theta); y = r * Math.sin(theta); z = h; System.out.printf("v %.3f %.3f %.3f\n", x, y, z); } System.out.printf("f"); for (int i = 1; i <= n; i++) System.out.printf(" %d", i); System.out.println(); System.out.printf("f"); for (int i = n + 1; i <= 2 * n; i++) System.out.printf(" %d", i); System.out.println(); } /** * @param args the command line arguments */ public static void main(String[] args) { new ObjGenerator(); } }
[ "kmhasan@SEUPC0719" ]
kmhasan@SEUPC0719
107fbbe8adbce1fa665a608aa305a93e28ec0aff
6ee4fb54839bfe4254b4247c261475425621f25b
/test001/src/yibai/包装类/BaozhuangClass.java
42b1d15ebde6e6091a70ef4be007ab990ca55c7e
[]
no_license
qfsf0220/gitxuexi
5587d46b2aca006319b1e30a1ed7b5271e1dcba3
671e687f4301688ed4f275c1c996d83057125847
refs/heads/master
2021-01-01T04:26:11.003923
2018-09-06T03:21:56
2018-09-06T03:21:56
58,061,907
1
0
null
null
null
null
UTF-8
Java
false
false
1,165
java
package yibai.包装类; import com.sun.org.apache.xpath.internal.operations.Bool; import wxy.sumscop20170811.InterfaceUsedbyObj; /** * Created by Administrator on 2017/9/12. */ public class BaozhuangClass { int int1 = 2_012; static int int2 = 2__12; public static void staticmethod(){ Integer int1 = new Integer("2012"); Double dou1 = new Double("12.345"); Character char1 = new Character('A'); Boolean bool1 = new Boolean("true"); System.out.printf("%d,%d,%d",int1,int2,int1); System.out.println(); System.out.printf("%f,%s,%s",dou1,char1,bool1); } public static void main(String[] args) { staticmethod(); Integer int2 =Integer.valueOf(100); byte b= int2.byteValue(); int a = Integer.sum(1,1); int c =a>b?a:b; System.out.println(); System.out.println(c); String str2= "1010101010"; Integer intstr2 = Integer.valueOf(str2,2); int ints2=Integer.parseInt(str2,2); System.out.println(ints2); int xx = Integer.max(5,6)>Integer.min(7,8)?c:a; System.out.println(xx); } }
aeda5fe9c40ac0803d0e6157fff7ae613bd5dbbf
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/12/12_e613551cd50181378962f61b2a06610f0bbbfa43/ResourceLifecycle/12_e613551cd50181378962f61b2a06610f0bbbfa43_ResourceLifecycle_t.java
a6e0d063ecc778de53ff7760645135e9a7a71509
[]
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
1,221
java
/* * Copyright 2006-2007 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.springframework.batch.item; /** * Common interface for classes that require initialisation before they can be * used and need to free resources after they are no longer used. */ public interface ResourceLifecycle { /** * This method should be invoked by clients at the start of processing to * allow initialisation of resources. * */ public void open(); /** * This method should be invoked by clients after the completion of each * step and the implementing class should close all managed resources. * */ public void close(); }
e65fd4bfc9cd771de3c5bc2915a41a23c8a4862a
e832d5343b363e52a15e13fb04eabc44196ad378
/src/main/java/com/goddrinksjava/prep/model/bean/database/UsuarioPrivilegios.java
36ccab906115a8cdebbd039b38720feaf2c79e31
[]
no_license
goddrinksjava/prep
bd09b0bde4e91456de7cffc172e25d55aaacdfb2
64618537590b976d0e14189f23d12e21c9929bb7
refs/heads/master
2023-08-31T01:45:03.092609
2021-06-06T21:30:57
2021-06-06T21:30:57
369,941,652
0
0
null
null
null
null
UTF-8
Java
false
false
321
java
package com.goddrinksjava.prep.model.bean.database; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; @Data @AllArgsConstructor @NoArgsConstructor @Builder public class UsuarioPrivilegios { private Integer fkUsuario; private Integer fkPrivilegio; }
da4ebbfb632ea7eca1a40991be230bc878e18585
fc56fc9a0e418eb5da5265571a543a5d97ae0b13
/onlinebanking-hbci4java/src/main/java/de/adorsys/hbci4java/job/AccountInformationJob.java
9e3f295673e147229d3542358d5bf70477ec05e8
[]
no_license
AKuzovchikov/multibanking
893cdd480f84f91b2a9531de8d3bc7fd255ad1cb
b2a1d1d837c9592ef791c6b527e21097a6c01ec4
refs/heads/master
2020-04-30T15:11:34.646218
2019-03-21T09:17:25
2019-03-21T09:17:25
null
0
0
null
null
null
null
UTF-8
Java
false
false
5,262
java
/* * Copyright 2018-2019 adorsys GmbH & Co KG * * 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.adorsys.hbci4java.job; import de.adorsys.hbci4java.model.*; import domain.BankAccount; import domain.BankApi; import domain.Product; import domain.TanTransportType; import domain.request.LoadAccountInformationRequest; import domain.response.LoadAccountInformationResponse; import exception.HbciException; import de.adorsys.hbci4java.model.HbciCallback; import de.adorsys.hbci4java.model.HbciDialogRequest; import de.adorsys.hbci4java.model.HbciMapping; import de.adorsys.hbci4java.model.HbciPassport; import lombok.extern.slf4j.Slf4j; import org.kapott.hbci.GV.GVSEPAInfo; import org.kapott.hbci.GV.GVTANMediaList; import org.kapott.hbci.manager.HBCIDialog; import org.kapott.hbci.passport.PinTanPassport; import org.kapott.hbci.status.HBCIExecStatus; import org.kapott.hbci.structures.Konto; import java.util.*; import java.util.stream.Collectors; @Slf4j public class AccountInformationJob { public static LoadAccountInformationResponse loadBankAccounts(LoadAccountInformationRequest request, HbciCallback callback) { log.info("Loading account list for bank [{}]", request.getBankCode()); HbciDialogRequest dialogRequest = HbciDialogRequest.builder() .bankCode(request.getBankCode() != null ? request.getBankCode() : request.getBankAccess().getBankCode()) .customerId(request.getBankAccess().getBankLogin()) .login(request.getBankAccess().getBankLogin2()) .hbciPassportState(request.getBankAccess().getHbciPassportState()) .pin(request.getPin()) .callback(callback) .build(); dialogRequest.setProduct(Optional.ofNullable(request.getProduct()) .map(product -> new Product(product.getName(), product.getVersion())) .orElse(null)); dialogRequest.setBpd(request.getBpd()); HBCIDialog dialog = HbciDialogFactory.createDialog(null, dialogRequest); if (!dialog.getPassport().jobSupported("SEPAInfo")) throw new RuntimeException("SEPAInfo job not supported"); log.info("fetching SEPA informations"); dialog.addTask(new GVSEPAInfo(dialog.getPassport())); // TAN-Medien abrufen if (request.isUpdateTanTransportTypes()) { if (dialog.getPassport().jobSupported("TANMediaList")) { log.info("fetching TAN media list"); dialog.addTask(new GVTANMediaList(dialog.getPassport())); } } HBCIExecStatus status = dialog.execute(true); if (!status.isOK()) { throw new HbciException(status.getDialogStatus().getErrorString()); } request.getBankAccess().setBankName(dialog.getPassport().getInstName()); List<BankAccount> hbciAccounts = new ArrayList<>(); for (Konto konto : dialog.getPassport().getAccounts()) { BankAccount bankAccount = HbciMapping.toBankAccount(konto); bankAccount.externalId(BankApi.HBCI, UUID.randomUUID().toString()); bankAccount.bankName(request.getBankAccess().getBankName()); hbciAccounts.add(bankAccount); } if (request.isUpdateTanTransportTypes()) { request.getBankAccess().setTanTransportTypes(new HashMap<>()); request.getBankAccess().getTanTransportTypes().put(BankApi.HBCI, extractTanTransportTypes(dialog.getPassport())); } request.getBankAccess().setHbciPassportState(new HbciPassport.State(dialog.getPassport()).toJson()); return LoadAccountInformationResponse.builder() .bankAccess(request.getBankAccess()) .bankAccounts(hbciAccounts) .build(); } public static List<TanTransportType> extractTanTransportTypes(PinTanPassport hbciPassport) { return hbciPassport.getUserTwostepMechanisms() .stream() .map(id -> hbciPassport.getBankTwostepMechanisms().get(id)) .filter(Objects::nonNull) .map(hbciTwoStepMechanism -> TanTransportType.builder() .id(hbciTwoStepMechanism.getSecfunc()) .name(hbciTwoStepMechanism.getName()) .inputInfo(hbciTwoStepMechanism.getInputinfo()) .medium(hbciPassport.getTanMedia(hbciTwoStepMechanism.getId()) != null ? hbciPassport.getTanMedia(hbciTwoStepMechanism.getId()).mediaName : null) .build()) .collect(Collectors.toList()); } }
34ac001d0cdb7b809c9b6fa4205ace7e1a9ebf63
45a801ad083956e6cbe574ab52292fe0564dfe8c
/app/src/main/java/cn/true123/lottery/ui/activities/presenter/LotteryDetailPresenter.java
e34e4429f8b1fe9c5aee3ffda07c134628618e11
[]
no_license
codeqqby/lottery-history
e5e3dc59ed2bb970b49762a77e1793e369ee23cd
5eae403b33cd869d7ed4384f032afaea55ef6e28
refs/heads/master
2020-03-21T05:47:09.047573
2016-11-17T14:51:03
2016-11-17T14:51:03
null
0
0
null
null
null
null
UTF-8
Java
false
false
372
java
package cn.true123.lottery.ui.activities.presenter; import cn.true123.lottery.ui.activities.view.ILotteryDetailView; import cn.true123.lottery.ui.base.presenter.BasePresenter; /** * Created by junbo on 3/11/2016. */ public interface LotteryDetailPresenter<T extends ILotteryDetailView> extends BasePresenter<T> { void setIssueAndName(String issue,String name); }
e9c46387ffa08cc4ab4c9b65e81a229f991b481b
a48b46c0d5249340b3eba791da79b2bbb1753515
/app/src/main/java/com/b2d/b2d_project/BluetoothComService.java
147409744c6cdf7c802fa230f71ae1cf8f60146d
[]
no_license
aknckaan/B2D_project
9fd0dbca5fa49dad9e021bd741378eccac2ef4e4
9854f0ca29f7a609cc91c0a87dc57ec582092d21
refs/heads/master
2021-05-01T00:41:39.256222
2019-01-22T13:23:43
2019-01-22T13:23:43
71,463,548
0
0
null
null
null
null
UTF-8
Java
false
false
12,632
java
package com.b2d.b2d_project; import android.app.IntentService; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothSocket; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.os.IBinder; import android.support.annotation.Nullable; import android.widget.Toast; import org.json.JSONObject; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.DataInputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStream; import java.io.OutputStreamWriter; import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.MalformedURLException; import java.net.ProtocolException; import java.net.URL; import java.net.URLEncoder; import java.util.HashMap; import java.util.Map; import java.util.UUID; import cz.msebera.android.httpclient.HttpResponse; import cz.msebera.android.httpclient.client.HttpClient; import cz.msebera.android.httpclient.client.methods.HttpPost; import cz.msebera.android.httpclient.entity.ContentType; import cz.msebera.android.httpclient.entity.mime.HttpMultipartMode; import cz.msebera.android.httpclient.entity.mime.MultipartEntityBuilder; import cz.msebera.android.httpclient.entity.mime.content.FileBody; import cz.msebera.android.httpclient.impl.client.HttpClientBuilder; public class BluetoothComService extends IntentService { private HttpURLConnection conn; public Boolean connect; public String adress; public String result; public static final int CONNECTION_TIMEOUT = 15 * 1000; private static final String NOTIF_URL = "http://kaanakinci.me/B2D/sendNotification.php"; private static final String UPLOAD_URL = "http://kaanakinci.me/B2D/upload.php"; static boolean registered=false; int id; String user; boolean server = false; BluetoothAdapter myBluetoothAdapter; public BluetoothComService() { super("BluetoothComService"); myBluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); } public void generateNoteOnSD(Context context, String sFileName, String[] sBody) { try { File myDir = new File(context.getCacheDir(), "B2D"); myDir.mkdir(); File fileWithinMyDir = new File(myDir, sFileName); //Getting a file within the dir. FileOutputStream out = new FileOutputStream(fileWithinMyDir); for(int i=0;i<sBody.length;i++) { out.write((sBody[i]+"\n").getBytes());//Use the stream as usual to write into the file. } } catch (IOException e) { e.printStackTrace(); } } @Override public IBinder onBind(Intent intent) { // TODO: Return the communication channel to the service. throw new UnsupportedOperationException("Not yet implemented"); } @Override protected void onHandleIntent(@Nullable Intent intent) { /*Messenger messenger=(Messenger)((Bundle)intent.getExtras()).get("messenger"); Message msg = Message.obtain();*/ if(registered) { Bundle bundle = new Bundle(); bundle.putString("name", "Already Connected"); /*msg.setData(bundle); //put the data here try { messenger.send(msg); } catch (RemoteException e) { Log.i("error", "error"); }*/ Toast.makeText(getApplicationContext(), "Already connected.", Toast.LENGTH_LONG).show(); return; } else { /*Bundle bundle = new Bundle(); /bundle.putString("name", "Connecting"); msg.setData(bundle); //put the data here try { messenger.send(msg); } catch (RemoteException e) { Log.i("error", "error"); }*/ Toast.makeText(getApplicationContext(), "Connecting.", Toast.LENGTH_LONG).show(); registered=!registered; } this.id=intent.getIntExtra("id",0); this.adress=intent.getStringExtra("adress"); this.user=intent.getStringExtra("user"); final UUID SERIAL_UUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB"); BluetoothDevice device = myBluetoothAdapter.getRemoteDevice(adress); BluetoothSocket socket = null; OutputStream out = null; InputStream in = null; registered=!registered; try { socket = device.createRfcommSocketToServiceRecord(SERIAL_UUID); } catch (IOException e) {} try { socket.connect(); Bundle bundle = new Bundle(); bundle.putString("name", "Connected"); /*msg.setData(bundle); //put the data here try { messenger.send(msg); } catch (RemoteException e) { Log.i("error", "error"); }*/ Toast.makeText(getApplicationContext(), "Connected.", Toast.LENGTH_LONG).show(); out = socket.getOutputStream(); in=socket.getInputStream(); final DataInputStream mmInStream = new DataInputStream(in); byte[] buffer = new byte[256]; while (socket.isConnected()) { //out.write("Hello from the other side".getBytes()); int bytes = mmInStream.read(buffer); String readMessage = new String(buffer, 0, bytes); if(!readMessage.equals("Hello")) continue; out.write("Hello from the other side".getBytes()); buffer = new byte[256]; bytes = mmInStream.read(buffer); readMessage = new String(buffer, 0, bytes); final String fileName=readMessage; final String[] fileData=new String[15000]; out.write("1".getBytes()); for(int i=0;i<501;i++) { if (!socket.isConnected()) break; buffer = new byte[256]; bytes = mmInStream.read(buffer); readMessage = new String(buffer, 0, bytes); result=readMessage; if(result.equals("Bye")) break; String[] myArr=result.split("\n"); for(int k=0;k<30;k++) { fileData[i*30+k]=myArr[k]; } System.out.print(i); out.write("1".getBytes()); } out.write("0".getBytes()); generateNoteOnSD(getApplicationContext(),fileName+".txt",fileData); uploadData(id+"",user,fileName); } registered=!registered; return; //else if(socket.isConnected()&&!connect) // socket.close(); //now you can use out to send output via out.write } catch (IOException e) { e.printStackTrace(); } // We want this service to continue running until it is explicitly // stopped, so return sticky. } public void uploadData(String pid,String name,String fileName) { try { // Building Parameters if(fileName.charAt(fileName.indexOf(".")-1)=='1') { HashMap<String, String> params = new HashMap<String, String>(); params.put("PId", pid); params.put("File", fileName); params.put("message", "Your patient "+name+" is having an epilepsy attack!"); JSONObject object = null; URL url = new URL(NOTIF_URL); conn = (HttpURLConnection) url.openConnection(); conn.setReadTimeout(CONNECTION_TIMEOUT); conn.setConnectTimeout(CONNECTION_TIMEOUT); conn.setRequestMethod("POST"); conn.setDoInput(true); conn.setDoOutput(true); conn.connect(); OutputStream os = conn.getOutputStream(); OutputStreamWriter osWriter = new OutputStreamWriter(os, "UTF-8"); BufferedWriter writer = new BufferedWriter(osWriter); writer.write(getPostData(params)); writer.flush(); writer.close(); os.close(); if (conn.getResponseCode() == HttpURLConnection.HTTP_OK) { InputStream is = conn.getInputStream(); InputStreamReader isReader = new InputStreamReader(is, "UTF-8"); BufferedReader reader = new BufferedReader(isReader); result = ""; String line = ""; while ((line = reader.readLine()) != null) { result += line; } } } try { URL url2 = new URL(UPLOAD_URL); HttpURLConnection conn = (HttpURLConnection) url2.openConnection(); conn.setRequestMethod("POST"); HttpClient client; client= HttpClientBuilder.create().build(); HttpPost post = new HttpPost("http://kaanakinci.me/B2D/upload.php"); try { MultipartEntityBuilder builder = MultipartEntityBuilder.create(); builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE); FileBody fileBody = new FileBody(new File(getApplicationContext().getCacheDir(), "B2D/"+fileName+".txt")); builder.addPart("fileToUpload", fileBody); builder.addTextBody("username",name, ContentType.TEXT_PLAIN); post.setEntity(builder.build()); HttpResponse response = client.execute(post); BufferedReader rd = new BufferedReader(new InputStreamReader( response.getEntity().getContent())); String line = ""; //while ((line = rd.readLine()) != null) { line=rd.readLine(); System.out.println(line); if(line.indexOf("not")>0) return; //} trimCache(getApplicationContext()); } catch (IOException e) { e.printStackTrace(); } } catch(Exception e){ } } catch (ProtocolException e) { e.printStackTrace(); } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } public String getPostData(HashMap<String, String> values) { StringBuilder builder = new StringBuilder(); boolean first = true; for (Map.Entry<String, String> entry : values.entrySet()) { if (first) first = false; else builder.append("&"); try { builder.append(URLEncoder.encode(entry.getKey(), "UTF-8")); builder.append("="); builder.append(URLEncoder.encode(entry.getValue(), "UTF-8")); } catch (UnsupportedEncodingException e) {} } return builder.toString(); } public static void trimCache(Context context) { try { File dir = context.getCacheDir(); if (dir != null && dir.isDirectory()) { deleteDir(dir); } } catch (Exception e) { // TODO: handle exception } } public static boolean deleteDir(File dir) { if (dir != null && dir.isDirectory()) { String[] children = dir.list(); for (int i = 0; i < children.length; i++) { boolean success = deleteDir(new File(dir, children[i])); if (!success) { return false; } } } // The directory is now empty so delete it return dir.delete(); } }
1fe2f972e4e0c680f4cb7ee8217ada479c8d84b4
1370875430538cead5022990f720d56a42b07a4a
/loanChain-core/src/main/java/org/loanchian/network/Networks.java
958659ec112ffee69f39a79e39084ade8866cf30
[]
no_license
ivy0322/loanchian
8a388ca796f9e993db58d7dc466e167d1b365099
c590930b357ee5310da897257842f78fe16937e2
refs/heads/master
2021-03-16T09:14:31.282618
2017-12-15T08:27:52
2017-12-15T08:27:52
113,528,581
0
2
null
null
null
null
UTF-8
Java
false
false
1,008
java
package org.loanchian.network; import java.util.HashSet; import java.util.Set; /** * Utility class that holds all the registered NetworkParameters types used for Address auto discovery. * By default only MainNetParams and TestNet3Params are used. If you want to use TestNet2, RegTestParams or * UnitTestParams use the register and unregister the TestNet3Params as they don't have their own address * version/type code. */ public class Networks { /** Registered networks */ private static Set<NetworkParams> networks = new HashSet<NetworkParams>(); public static Set<? extends NetworkParams> get() { return networks; } public static void register(NetworkParams network) { networks.add(network); } public static void register(Set<NetworkParams> networks) { Networks.networks = networks; } public static void unregister(NetworkParams network) { if (networks.contains(network)) { networks.remove(network); } } }
4dc5d8193dfffaab497bfee8e549022ef43cb26e
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/12/12_69e0e6c4f44a4904c4dca847131598d13074a3ee/DataSetMetaDataHelper/12_69e0e6c4f44a4904c4dca847131598d13074a3ee_DataSetMetaDataHelper_s.java
f5013fe31dbe3c7305bf6dc07c8b6384d93264d4
[]
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
12,102
java
/******************************************************************************* * Copyright (c) 2004, 2005 Actuate Corporation. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Actuate Corporation - initial API and implementation *******************************************************************************/ package org.eclipse.birt.report.data.adapter.impl; import java.util.ArrayList; import java.util.HashSet; import java.util.Iterator; import java.util.List; import org.eclipse.birt.core.data.DataType; import org.eclipse.birt.core.exception.BirtException; import org.eclipse.birt.data.engine.api.DataEngine; import org.eclipse.birt.data.engine.api.IColumnDefinition; import org.eclipse.birt.data.engine.api.IResultMetaData; import org.eclipse.birt.data.engine.api.querydefn.QueryDefinition; import org.eclipse.birt.report.data.adapter.api.AdapterException; import org.eclipse.birt.report.data.adapter.api.IModelAdapter; import org.eclipse.birt.report.data.adapter.i18n.ResourceConstants; import org.eclipse.birt.report.model.api.CachedMetaDataHandle; import org.eclipse.birt.report.model.api.DataSetHandle; import org.eclipse.birt.report.model.api.ModuleHandle; import org.eclipse.birt.report.model.api.PropertyHandle; import org.eclipse.birt.report.model.api.ResultSetColumnHandle; import org.eclipse.birt.report.model.api.StructureFactory; import org.eclipse.birt.report.model.api.elements.DesignChoiceConstants; import org.eclipse.birt.report.model.api.elements.structures.ResultSetColumn; /** * One note is the relationship between resultSet, columnHints and * cachedMetaData. resultSet and columnHints are combined to be used as the * additional column definition based on the column metadata of data set. * cachedMetaData is retrieved from the data engine, and the time of its * generation is after the resultSet and columnHints is applied to the original * metadata. resultHint is processed before columnHints, and they corresponds to * the IColumnDefinition of data engine. * * When refreshing the metadata of dataset handle, resultSet should not be added * into data set design since resultSet is based on old metadata, and then it is * no use for updated metadata. But it is a little different for script dataset. * Since the metadata of script dataset comes from defined resultSet, the * special case is resultSet needs to be added when it meets script data set. */ public class DataSetMetaDataHelper { // private DataEngine dataEngine; private IModelAdapter modelAdaptor; private ModuleHandle moduleHandle; private static final char RENAME_SEPARATOR = '_';//$NON-NLS-1$ private static String UNNAME_PREFIX = "UNNAMED"; //$NON-NLS-1$ /** * * @param dataEngine * @param modelAdaptor * @param moduleHandle */ DataSetMetaDataHelper( DataEngine dataEngine, IModelAdapter modelAdaptor, ModuleHandle moduleHandle ) { this.dataEngine = dataEngine; this.modelAdaptor = modelAdaptor; this.moduleHandle = moduleHandle; } /** * * @param dataSetHandle * @param useCache * @return * @throws BirtException */ IResultMetaData getDataSetMetaData( DataSetHandle dataSetHandle, boolean useCache ) throws BirtException { if ( dataSetHandle == null ) { throw new AdapterException( ResourceConstants.DATASETHANDLE_NULL_ERROR ); } if ( useCache ) { return getCachedMetaData( dataSetHandle.getCachedMetaDataHandle( ) ); } else { return getRealMetaData( dataSetHandle ); } } /** * * @param cmdHandle * @return * @throws BirtException */ private IResultMetaData getCachedMetaData( CachedMetaDataHandle cmdHandle ) throws BirtException { if ( cmdHandle == null ) return null; Iterator it = cmdHandle.getResultSet( ).iterator( ); List columnMeta = new ArrayList( ); while ( it.hasNext( ) ) { ResultSetColumnHandle rsColumn = (ResultSetColumnHandle) it.next( ); IColumnDefinition cd = this.modelAdaptor.ColumnAdaptor( rsColumn ); columnMeta.add( cd ); } return new ResultMetaData( columnMeta ); } /** * @param dataSetName * @return * @throws BirtException */ private IResultMetaData getRealMetaData( DataSetHandle dataSetHandle ) throws BirtException { QueryDefinition query = new QueryDefinition( ); query.setDataSetName( dataSetHandle.getQualifiedName( ) ); query.setMaxRows( 1 ); IResultMetaData metaData = new QueryExecutionHelper( dataEngine, modelAdaptor, moduleHandle, false ).executeQuery( query ).getResultMetaData( ); if ( needsUseResultHint( dataSetHandle, metaData ) ) { metaData = new QueryExecutionHelper( dataEngine, modelAdaptor, moduleHandle, true ).executeQuery( query ).getResultMetaData( ); } return metaData; } /** * * @param dataSetHandle * @return * @throws BirtException */ IResultMetaData refreshMetaData( DataSetHandle dataSetHandle ) throws BirtException { IResultMetaData rsMeta = null; BirtException e = null; try { rsMeta = this.getDataSetMetaData( dataSetHandle, false ); } catch ( BirtException e1 ) { e = e1; } if ( needsSetCachedMetaData( dataSetHandle, rsMeta ) ) { dataSetHandle.setCachedMetaData( StructureFactory.createCachedMetaData( ) ); if ( rsMeta != null && rsMeta.getColumnCount( ) != 0 ) { for ( int i = 1; i <= rsMeta.getColumnCount( ); i++ ) { ResultSetColumn rsc = StructureFactory.createResultSetColumn( ); rsc.setColumnName( getColumnName( rsMeta, i ) ); rsc.setDataType( toModelDataType( rsMeta.getColumnType( i ) ) ); rsc.setPosition( new Integer( i ) ); dataSetHandle.getCachedMetaDataHandle( ) .getResultSet( ) .addItem( rsc ); } } } if ( e != null ) throw e; return rsMeta; } /** * * @param dataSetHandle * @param rsMeta * @return * @throws BirtException */ private boolean needsSetCachedMetaData( DataSetHandle dataSetHandle, IResultMetaData rsMeta ) throws BirtException { if ( dataSetHandle.getCachedMetaDataHandle( ) == null || rsMeta == null || rsMeta.getColumnCount( ) == 0 ) return true; List list = new ArrayList( ); for ( Iterator iter = dataSetHandle.getCachedMetaDataHandle( ) .getResultSet( ) .iterator( ); iter.hasNext( ); ) { list.add( iter.next( ) ); } if ( list.size( ) != rsMeta.getColumnCount( ) ) return true; for ( int i = 1; i <= rsMeta.getColumnCount( ); i++ ) { ResultSetColumnHandle handle = (ResultSetColumnHandle) list.get( i - 1 ); if ( handle.getColumnName( ) == null || !handle.getColumnName( ).equals( getColumnName( rsMeta, i ) ) || !handle.getDataType( ) .equals( toModelDataType( rsMeta.getColumnType( i ) ) ) ) return true; } return false; } /** * Whether need to use resultHint, which stands for resultSetHint, * columnHint or both * * @param dataSetHandle * @return * @throws BirtException */ private boolean needsUseResultHint( DataSetHandle dataSetHandle, IResultMetaData metaData ) throws BirtException { int columnCount = 0; boolean hasResultSetHint = false; boolean hasColumnHint = dataSetHandle.getPropertyHandle( DataSetHandle.COLUMN_HINTS_PROP ) .iterator( ) .hasNext( ); HashSet orgColumnNameSet = new HashSet( ); HashSet uniqueColumnNameSet = new HashSet( ); if ( metaData != null ) columnCount = metaData.getColumnCount( ); for ( int i = 0; i < columnCount; i++ ) { String columnName = metaData.getColumnName( i + 1 ); String uniqueColumnName = getUniqueName( orgColumnNameSet, uniqueColumnNameSet, columnName, i ); uniqueColumnNameSet.add( uniqueColumnName ); if ( !uniqueColumnName.equals( columnName ) ) { updateModelColumn( dataSetHandle, uniqueColumnName, i + 1 ); if ( hasResultSetHint != true ) hasResultSetHint = true; } } return hasResultSetHint || hasColumnHint; } /** * * @param orgColumnNameSet * @param newColumnNameSet * @param columnName * @param index * @return */ private String getUniqueName( HashSet orgColumnNameSet, HashSet newColumnNameSet, String columnName, int index ) { String newColumnName; if ( columnName == null || columnName.trim( ).length( ) == 0 || newColumnNameSet.contains( columnName ) ) { // name conflict or no name,give this column a unique name if ( columnName == null || columnName.trim( ).length( ) == 0 ) newColumnName = UNNAME_PREFIX + RENAME_SEPARATOR + String.valueOf( index + 1 ); else newColumnName = columnName + RENAME_SEPARATOR + String.valueOf( index + 1 ); int i = 1; while ( orgColumnNameSet.contains( newColumnName ) || newColumnNameSet.contains( newColumnName ) ) { newColumnName += String.valueOf( RENAME_SEPARATOR ) + i; i++; } } else { newColumnName = columnName; } return newColumnName; } /** * * @param ds * @param uniqueColumnName * @param index * @throws BirtException */ private void updateModelColumn( DataSetHandle ds, String uniqueColumnName, int index ) throws BirtException { PropertyHandle resultSetColumns = ds.getPropertyHandle( DataSetHandle.RESULT_SET_PROP ); // update result set columns Iterator iterator = resultSetColumns.iterator( ); boolean found = false; while ( iterator.hasNext( ) ) { ResultSetColumnHandle rsColumnHandle = (ResultSetColumnHandle) iterator.next( ); assert rsColumnHandle.getPosition( ) != null; if ( rsColumnHandle.getPosition( ).intValue( ) == index ) { if ( rsColumnHandle.getColumnName( ) != null && !rsColumnHandle.getColumnName( ) .equals( uniqueColumnName ) ) { rsColumnHandle.setColumnName( uniqueColumnName ); } found = true; break; } } if ( found == false ) { addResultSetColumn( resultSetColumns, uniqueColumnName, index ); } } /** * * @param resultSetColumnHandle * @param uniqueColumnName * @param index * @throws BirtException */ private void addResultSetColumn( PropertyHandle resultSetColumnHandle, String uniqueColumnName, int index ) throws BirtException { ResultSetColumn rsColumn = new ResultSetColumn( ); rsColumn.setColumnName( uniqueColumnName ); rsColumn.setPosition( new Integer( index ) ); resultSetColumnHandle.addItem( rsColumn ); } /** * * @param rsMeta * @param index * @return * @throws BirtException */ private String getColumnName( IResultMetaData rsMeta, int index ) throws BirtException { return ( rsMeta.getColumnAlias( index ) == null || rsMeta.getColumnAlias( index ) .trim( ) .length( ) == 0 ) ? rsMeta.getColumnName( index ) : rsMeta.getColumnAlias( index ); } /** * Map oda data type to model data type. * * @param modelDataType * @return */ private static String toModelDataType( int modelDataType ) { if ( modelDataType == DataType.INTEGER_TYPE ) return DesignChoiceConstants.COLUMN_DATA_TYPE_INTEGER; else if ( modelDataType == DataType.STRING_TYPE ) return DesignChoiceConstants.COLUMN_DATA_TYPE_STRING; else if ( modelDataType == DataType.DATE_TYPE ) return DesignChoiceConstants.COLUMN_DATA_TYPE_DATETIME; else if ( modelDataType == DataType.DECIMAL_TYPE ) return DesignChoiceConstants.COLUMN_DATA_TYPE_DECIMAL; else if ( modelDataType == DataType.DOUBLE_TYPE ) return DesignChoiceConstants.COLUMN_DATA_TYPE_FLOAT; return DesignChoiceConstants.COLUMN_DATA_TYPE_ANY; } }
36af6299c6ce50bdd7b13c500a2a301354977fe9
9f5afaa9b4854539a5f8c9ff3ff1030e7e80e3a2
/bravo/trunk/src/java/com/cutty/bravo/components/concurrent/locks/CyclicBarrierDemo.java
c625a311f4d9be1ce770e844f11bccc0b9ef85ac
[]
no_license
derekzhang79/cutty
523619bf3287dd5fc1ca9f05fa9d54b63fe3f432
fcada4a51c113f8f29896909581d6b284bcf89be
refs/heads/master
2020-06-19T19:56:59.294781
2014-03-24T07:38:00
2014-03-24T07:38:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,100
java
package com.cutty.bravo.components.concurrent.locks; import java.util.concurrent.BrokenBarrierException; import java.util.concurrent.CyclicBarrier; public class CyclicBarrierDemo { final CyclicBarrier barrier; final int MAX_TASK; public CyclicBarrierDemo(int cnt) { barrier = new CyclicBarrier(cnt + 1); MAX_TASK = cnt; } public void doWork(final Runnable work) { new Thread() { public void run() { work.run(); try { int index = barrier.await(); doWithIndex(index); } catch (InterruptedException e) { return; } catch (BrokenBarrierException e) { return; } } }.start(); } private void doWithIndex(int index) { if (index == MAX_TASK / 3) { System.out.println("Left 30%."); } else if (index == MAX_TASK / 2) { System.out.println("Left 50%"); } else if (index == 0) { System.out.println("run over"); } } public void waitForNext() { try { doWithIndex(barrier.await()); } catch (InterruptedException e) { return; } catch (BrokenBarrierException e) { return; } } public static void main(String[] args) { final int count = 10; System.out.println(10/3); CyclicBarrierDemo demo = new CyclicBarrierDemo(count); for (int i = 0; i < 100; i++) { demo.doWork(new Runnable() { public void run() { //do something try { Thread.sleep(1000L); } catch (Exception e) { return; } } }); if ((i + 1) % count == 0) { demo.waitForNext(); } } } }
a41686f9295e68562efcb697f895c07a72df415b
b5d4e06b3f3591db8355442ff5b6a1fbad9244fc
/src/main/java/com/effective/enums/PayRollDay.java
21c27820a227ee67f7897cac009ca647da6258ba
[]
no_license
a514760469/UnderstandJVM
a5dc3b0c2aadbdf1680ca63f478cd9390dfcad24
1b22127cb5cec4ea2615fafc1a8c56e358a04fbd
refs/heads/master
2021-08-17T00:14:41.652203
2021-06-23T09:07:24
2021-06-23T09:07:24
185,553,272
1
0
null
null
null
null
UTF-8
Java
false
false
1,475
java
package com.effective.enums; /** * 策略枚举 模板 * * 根据给定的某工人的基本工资以及当天的工作时间,来计算他当天的报酬。 * 在5个工作日中,超过8小时的工作时间会产生加班工资,在节假日中所有工作都产生加班工资。 */ public enum PayRollDay { MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY(PayType.WEEKEND), SUNDAY(PayType.WEEKEND), ; private final PayType payType; // 默认 PayRollDay() { this(PayType.WEEKDAY); } PayRollDay(PayType payType) { this.payType = payType; } int pay(int minutesWorked, int payRate) { return payType.pay(minutesWorked, payRate); } private enum PayType { WEEKDAY { @Override int overtimePay(int minutesWorked, int payRate) { return minutesWorked <= MINS_PER_SHIFT ? 0 : (minutesWorked - MINS_PER_SHIFT) * payRate / 2; } }, WEEKEND { @Override int overtimePay(int minutesWorked, int payRate) { return minutesWorked * payRate / 2; } }; private static final int MINS_PER_SHIFT = 8 * 60; int pay(int minutesWorked, int payRate) { int basePay = minutesWorked * payRate; return basePay + overtimePay(minutesWorked, payRate); } abstract int overtimePay(int minutesWorked, int payRate); } }
967a3e9bf0dbb2b28cd250e89009182fd002fc31
76fa95d7caeee406fe3b7da9fcecfcdc1440881c
/search-service/src/main/java/com/stackroute/search/aspect/LoggerAspect.java
4597cb313e6965e81727d3f5c3a06346c0e10b78
[]
no_license
murodin/Automatic-Resource-Allocation-App
f796fcd9ca0daa9258b4f52a5c0ad206b026dfe3
d4ce1f3501286c29b1a39955603dd5db656012c7
refs/heads/master
2023-03-27T22:44:50.655560
2021-04-01T08:40:24
2021-04-01T08:40:24
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,585
java
package com.stackroute.search.aspect; import org.aspectj.lang.annotation.Aspect; import org.springframework.stereotype.Component; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.annotation.*; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.Arrays; @Aspect @Component public class LoggerAspect { /* * Write loggers for each of the methods of ProjectController, any particular method * will have all the four aspectJ annotation * (@Before, @After, @AfterReturning, @AfterThrowing). */ private static final Logger logger = LoggerFactory.getLogger(LoggerAspect.class); @Pointcut("execution (* com.stackroute.search.controller.ProjectController.*(..)) || " + "execution (* com.stackroute.search.controller.UserProfileController.*(..))") public void allControllerMethods() { // pointcut method } @Before("allControllerMethods()") public void beforeAdvice(JoinPoint joinPoint) { logger.info("**********@Before**********"); logger.debug("Method Name: {}", joinPoint.getSignature().getName()); logger.debug("Method Args: {}", Arrays.toString(joinPoint.getArgs())); logger.info("**************************"); } @After("allControllerMethods()") public void afterAdvice(JoinPoint joinPoint) { logger.info("**********@After**********"); logger.debug("Method Name: {}", joinPoint.getSignature().getName()); logger.debug("Method Args: {}", Arrays.toString(joinPoint.getArgs())); logger.info("**************************"); } @AfterReturning(value="allControllerMethods()",returning = "result") public void afterAdvice(JoinPoint joinPoint, Object result) { logger.info("**********@AfterReturning**********"); logger.debug("Method Name: {}", joinPoint.getSignature().getName()); logger.debug("Method Args: {}", Arrays.toString(joinPoint.getArgs())); logger.debug("Return Value: {}", result); logger.info("**************************"); } @AfterThrowing(value="allControllerMethods()",throwing = "error") public void afterAdvice(JoinPoint joinPoint, Throwable error) { logger.info("**********@AfterThrowing**********"); logger.debug("Method Name: {}", joinPoint.getSignature().getName()); logger.debug("Method Args: {}", Arrays.toString(joinPoint.getArgs())); logger.debug("Exception: {}", error); logger.info("**************************"); } }
8d44f8f9f6114d3e603e6e65ac44e6675e80be02
0ed20fe0fc9e1cd76034d5698c4f7dcf42c47a60
/TempXMLInterpreter/src/information/dU34/Mes/DeaSet/Dea/Loa/Loan_Product.java
e1141d9d859f8b94ffe7b4281d62406d1422beb3
[]
no_license
Kamurai/EclipseRepository
61371f858ff82dfdfc70c3de16fd3322222759ed
4af50d1f63a76faf3e04a15129c0ed098fc6c545
refs/heads/master
2022-12-22T13:05:13.965919
2020-11-05T03:42:09
2020-11-05T03:42:09
101,127,637
0
0
null
2022-12-16T13:43:14
2017-08-23T02:18:08
Java
UTF-8
Java
false
false
511
java
package information.dU34.Mes.DeaSet.Dea.Loa; import information.dU34.Mes.DeaSet.Dea.Loa.LoaPro.Loan_Product_Detail; public class Loan_Product { Loan_Product_Detail loan_Product_Detail; public Loan_Product(){ loan_Product_Detail = new Loan_Product_Detail(); } public Loan_Product_Detail getLoan_Product_Detail() { return loan_Product_Detail; } public void setLoan_Product_Detail(Loan_Product_Detail loan_Product_Detail) { this.loan_Product_Detail = loan_Product_Detail; } }
290a4c2964a8150cb213f7d746fcd5f6bea16b6e
e59fa2585c8bca030dfafad3997f45d21cca35fc
/src/main/java/ru/sfedu/hibernate/providers/IMetaDataProvider.java
2ce3343a197dc5f9c24fc69c3cb6aab4c7b077d4
[]
no_license
soan52005200/hib46
7b16110c1566d749cf2631d5fda4bf36f72bd925
80ea9ad17f3913710c857d0141d3c5934da35bda
refs/heads/master
2023-03-23T04:33:23.498276
2021-03-12T17:33:03
2021-03-12T17:33:03
344,913,893
0
0
null
null
null
null
UTF-8
Java
false
false
209
java
package ru.sfedu.hibernate.providers; import java.util.List; public interface IMetaDataProvider { List getAllSchemas(); List getColumnNames(); List getDomainName(); List getAllTypes(); }
8a92f6f665df0b39633b87e3012519a533460843
d192e485651eb00d339c60e0b9d02d61a9e86125
/app/src/main/java/cps251/edu/wccnet/jh7_jjmoore_photomap/DialogCaption.java
35c991304560149bd60b4cf3d61cc59e36f41b3e
[]
no_license
jj-moore/PhotoMap
fe4af657bf4bc362c9553e0be300cb2fa5f8188e
22e20362b41c2c03b64c207c66f109c2004af507
refs/heads/master
2021-01-20T06:28:51.619991
2017-05-11T12:19:38
2017-05-11T12:19:38
89,884,782
0
0
null
null
null
null
UTF-8
Java
false
false
1,411
java
package cps251.edu.wccnet.jh7_jjmoore_photomap; import android.app.Dialog; import android.content.Context; import android.os.Bundle; import android.view.View; import android.view.inputmethod.InputMethodManager; import android.widget.EditText; class DialogCaption extends Dialog { private Context context; private ActivityInterface activityInterface; private String caption; DialogCaption(Context context, ActivityInterface activityInterface, String caption) { super(context); this.context = context; this.activityInterface = activityInterface; this.caption = caption; } protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setTitle("Set Caption"); setContentView(R.layout.dialog_caption); final EditText viewCaption = (EditText) findViewById(R.id.dialog_caption); viewCaption.setText(caption); findViewById(R.id.dialog_save).setOnClickListener(new View.OnClickListener() { public void onClick(View v) { final InputMethodManager mgr = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE); mgr.hideSoftInputFromWindow(viewCaption.getWindowToken(), 0); activityInterface.saveCaption(viewCaption.getText()); DialogCaption.this.dismiss(); } }); } }
120b3859fe32cd78ca0c39b2ce5e883fa864ab8a
ebdcaff90c72bf9bb7871574b25602ec22e45c35
/modules/dfp_axis/src/main/java/com/google/api/ads/admanager/axis/v201808/DisapproveOrders.java
b8119380283ce8ce768508fb214c4527b30fb900
[ "Apache-2.0" ]
permissive
ColleenKeegan/googleads-java-lib
3c25ea93740b3abceb52bb0534aff66388d8abd1
3d38daadf66e5d9c3db220559f099fd5c5b19e70
refs/heads/master
2023-04-06T16:16:51.690975
2018-11-15T20:50:26
2018-11-15T20:50:26
158,986,306
1
0
Apache-2.0
2023-04-04T01:42:56
2018-11-25T00:56:39
Java
UTF-8
Java
false
false
3,360
java
// Copyright 2018 Google LLC // // 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. /** * DisapproveOrders.java * * This file was auto-generated from WSDL * by the Apache Axis 1.4 Mar 02, 2009 (07:08:06 PST) WSDL2Java emitter. */ package com.google.api.ads.admanager.axis.v201808; /** * The action used for disapproving {@link Order} objects. All {@link * LineItem} * objects within the order will be disapproved as well. */ public class DisapproveOrders extends com.google.api.ads.admanager.axis.v201808.OrderAction implements java.io.Serializable { public DisapproveOrders() { } @Override public String toString() { return com.google.common.base.MoreObjects.toStringHelper(this.getClass()) .omitNullValues() .toString(); } private java.lang.Object __equalsCalc = null; public synchronized boolean equals(java.lang.Object obj) { if (!(obj instanceof DisapproveOrders)) return false; DisapproveOrders other = (DisapproveOrders) obj; if (obj == null) return false; if (this == obj) return true; if (__equalsCalc != null) { return (__equalsCalc == obj); } __equalsCalc = obj; boolean _equals; _equals = super.equals(obj); __equalsCalc = null; return _equals; } private boolean __hashCodeCalc = false; public synchronized int hashCode() { if (__hashCodeCalc) { return 0; } __hashCodeCalc = true; int _hashCode = super.hashCode(); __hashCodeCalc = false; return _hashCode; } // Type metadata private static org.apache.axis.description.TypeDesc typeDesc = new org.apache.axis.description.TypeDesc(DisapproveOrders.class, true); static { typeDesc.setXmlType(new javax.xml.namespace.QName("https://www.google.com/apis/ads/publisher/v201808", "DisapproveOrders")); } /** * Return type metadata object */ public static org.apache.axis.description.TypeDesc getTypeDesc() { return typeDesc; } /** * Get Custom Serializer */ public static org.apache.axis.encoding.Serializer getSerializer( java.lang.String mechType, java.lang.Class _javaType, javax.xml.namespace.QName _xmlType) { return new org.apache.axis.encoding.ser.BeanSerializer( _javaType, _xmlType, typeDesc); } /** * Get Custom Deserializer */ public static org.apache.axis.encoding.Deserializer getDeserializer( java.lang.String mechType, java.lang.Class _javaType, javax.xml.namespace.QName _xmlType) { return new org.apache.axis.encoding.ser.BeanDeserializer( _javaType, _xmlType, typeDesc); } }
77f297c50594158501a1dc2e43a42fc982337994
b5bedffb2dedba60bde56ba94c0c85e36700b819
/src/main/java/io/mattw/youtube/commentsuite/util/DateUtils.java
3607ace4186dce33796b9498521c8f89b0fbea3a
[ "MIT" ]
permissive
kacper1112/youtube-comment-suite
4a64fcd4024425d58eb1d6a9545263a3cc14702a
aeabc826d72c833a279c8cf16ec63037e9422b5c
refs/heads/master
2022-12-27T01:17:51.443305
2020-09-01T15:44:00
2020-09-01T15:44:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
638
java
package io.mattw.youtube.commentsuite.util; import java.time.Instant; import java.time.LocalDateTime; import java.time.ZoneId; /** * Helper methods for working with time. */ public class DateUtils { /** * Uses the current timezone. */ public static LocalDateTime epochMillisToDateTime(long epochMillis) { return epochMillisToDateTime(epochMillis, ZoneId.systemDefault()); } /** * Pass in custom timeZone */ public static LocalDateTime epochMillisToDateTime(long epochMillis, ZoneId zoneId) { return LocalDateTime.ofInstant(Instant.ofEpochMilli(epochMillis), zoneId); } }
08337f57a3f89dda62a0014e96c8067f26db1584
b3d8cf731c2610b60a0630306f294e1b246ce7ae
/src/main/java/builder/study/lucy.java
1da53a32444a50cf84dd2cd1445f0e84389f686a
[]
no_license
Helmeter/designPattern
f46734129636812f4873d54ad869e44ee2b42e11
bf38e968e8ce59d5455a1345225c10b8f4bdc4b2
refs/heads/master
2016-09-14T18:47:31.702606
2016-06-02T02:18:24
2016-06-02T02:18:24
57,868,575
1
0
null
null
null
null
UTF-8
Java
false
false
439
java
package builder.study; /** * Created by helmeter on 5/3/16. */ public class lucy extends Student{ public void preEx() { System.out.println("lucy is ok"); } public void pourReagent() { System.out.println("lucy pour Regent"); } public void pourCo2() { System.out.println("lucy por Co2"); } public void showResult() { System.out.println("lucy's result is ....."); } }
8a514a5aaa5afc8648a1bae24fd1a65500447db7
68c1fb3548a588e17acbd5f993b91069e45d93a7
/pet-clinic-data/src/main/java/com/example/springpetclinic/model/Owner.java
75e700ccb6dcfacf922e2d99bd3f478e8df10bd9
[]
no_license
rbaliwal00/spring-pet-clinic
b71cd8a63f9d645ed6a45ba755ea312d27a419ef
146988f937f1c5ca47f0bf51e105c0c8bb00689d
refs/heads/main
2023-07-24T21:41:21.119804
2021-08-27T12:54:15
2021-08-27T12:54:15
393,292,314
0
0
null
null
null
null
UTF-8
Java
false
false
1,561
java
package com.example.springpetclinic.model; import lombok.*; import javax.persistence.*; import java.util.HashSet; import java.util.Set; @Setter @Getter @NoArgsConstructor @AllArgsConstructor @Entity @Table(name="owners") public class Owner extends Person{ @Builder public Owner(Long id, String firstName, String lastName, String address, String city, String telephone, Set<Pet> pets) { super(id, firstName, lastName); this.address = address; this.city = city; this.telephone = telephone; if(pets != null) { this.pets = pets; } } @Column(name="address") private String address; @Column(name="city") private String city; @Column(name="telephone") private String telephone; @OneToMany(cascade = CascadeType.ALL, mappedBy = "owner") private Set<Pet> pets = new HashSet<>(); /** * Return the Pet with the given name, or null if none found for this Owner. * * @param name to test * @return true if pet name is already in use */ public Pet getPet(String name) { return getPet(name, false); } public Pet getPet(String name, boolean ignoreNew) { name = name.toLowerCase(); for (Pet pet : pets) { if (!ignoreNew || !pet.isNew()) { String compName = pet.getName(); compName = compName.toLowerCase(); if (compName.equals(name)) { return pet; } } } return null; } }
db169bfd2d9718a3e1210f7315af38b18b35c155
e12b4d81162a32d2e0da42a670898ff8f3cc8c47
/src/main/java/org/kylin/bean/WelfareCode.java
baa476e8c8045c9a3d76a06cd7e0d6b73f1a4c3c
[ "Apache-2.0" ]
permissive
shallotsh/kylin-welfare
df7cafb9f24fa26dcd4fd20bc93d6792aa3e9846
de447c155b09a8a3f3f76f59adefa571bb991578
refs/heads/master
2023-04-04T15:57:02.035062
2023-03-25T02:15:48
2023-03-25T02:15:48
187,450,826
0
0
Apache-2.0
2023-02-13T15:42:35
2019-05-19T08:15:08
Java
UTF-8
Java
false
false
10,740
java
package org.kylin.bean; import org.apache.commons.collections4.CollectionUtils; import org.kylin.algorithm.filter.CodeFilter; import org.kylin.constant.BitConstant; import org.kylin.constant.CodeTypeEnum; import org.kylin.util.Encoders; import org.kylin.util.TransferUtil; import java.io.Serializable; import java.util.*; /** * @author shallotsh * @date 2017/6/25 下午3:14. */ public class WelfareCode implements Serializable{ private Integer codeTypeId; private CodeTypeEnum codeTypeEnum; private List<W3DCode> w3DCodes; private List<String> codes; private Integer pairCount; private Integer nonDeletedPairCount; private Boolean randomKilled; private Integer randomKilledCount; private Integer extendRatio; private Integer countOfExtended; public CodeTypeEnum getCodeTypeEnum() { return codeTypeEnum; } public void setCodeTypeEnum(CodeTypeEnum codeTypeEnum) { this.codeTypeEnum = codeTypeEnum; } public List<String> getCodes() { return codes; } public void setCodes(List<String> codes) { this.codes = codes; } public Integer getCodeTypeId() { return codeTypeId; } public void setCodeTypeId(Integer codeTypeId) { this.codeTypeId = codeTypeId; } public List<W3DCode> getW3DCodes() { return w3DCodes; } public void setW3DCodes(List<W3DCode> w3DCodes) { this.w3DCodes = w3DCodes; } public Integer getPairCount() { return CollectionUtils.size(TransferUtil.getPairCodes(this.getW3DCodes())); } public void setPairCount(Integer pairCount) { this.pairCount = pairCount; } public Integer getNonDeletedPairCount() { return nonDeletedPairCount; } public WelfareCode setNonDeletedPairCount(Integer nonDeletedPairCount) { this.nonDeletedPairCount = nonDeletedPairCount; return this; } public Boolean getRandomKilled() { return randomKilled; } public WelfareCode setRandomKilled(Boolean randomKilled) { this.randomKilled = randomKilled; return this; } public Integer getRandomKilledCount() { return randomKilledCount; } public WelfareCode setRandomKilledCount(Integer randomKilledCount) { this.randomKilledCount = randomKilledCount; return this; } public Integer getExtendRatio() { return extendRatio; } public WelfareCode setExtendRatio(Integer extendRatio) { this.extendRatio = extendRatio; return this; } public Integer getCountOfExtended() { return countOfExtended; } public WelfareCode setCountOfExtended(Integer countOfExtended) { this.countOfExtended = countOfExtended; return this; } public WelfareCode() { this.randomKilled = false; this.nonDeletedPairCount = 0; this.randomKilledCount = 0; } public WelfareCode(WelfareCode code) { if(code == null){ return; } this.setCodeTypeEnum(code.getCodeTypeEnum()); this.setCodeTypeId(code.getCodeTypeId()); this.setPairCount(code.getPairCount()); this.setNonDeletedPairCount(code.getNonDeletedPairCount()); this.setRandomKilled(code.getRandomKilled()); this.setRandomKilledCount(code.getRandomKilledCount()); if(!CollectionUtils.isEmpty(code.getW3DCodes())){ List<W3DCode> w3DCodes = new ArrayList<>(); code.getW3DCodes().forEach(o ->{ try { w3DCodes.add((W3DCode) o.clone()); } catch (CloneNotSupportedException e) { // todo handle exception } }); this.setW3DCodes(w3DCodes); } } public WelfareCode distinct(){ if( CollectionUtils.size(this.getW3DCodes()) <= 1){ return this; } List<W3DCode> w3DCodes = this.getW3DCodes(); // 转成字典 Map<W3DCode, Integer> w3DCodeIntegerMap = new HashMap<>(); for(W3DCode w3DCode: w3DCodes){ if(w3DCodeIntegerMap.containsKey(w3DCode)){ w3DCodeIntegerMap.put(w3DCode, w3DCodeIntegerMap.get(w3DCode) + w3DCode.getFreq()); }else { w3DCodeIntegerMap.put(w3DCode, w3DCode.getFreq()); } } List<W3DCode> result = new ArrayList<>(); w3DCodeIntegerMap.forEach((w3DCode, freq) -> { w3DCode.setFreq(freq); result.add(w3DCode); }); this.setW3DCodes(result); return this; } public WelfareCode generate(){ if(CollectionUtils.isEmpty(this.getW3DCodes())){ return this; } if(this.getCodeTypeEnum() != null) { this.setCodeTypeId(this.getCodeTypeEnum().getId()); } List<W3DCode> w3DCodes = this.getW3DCodes(); List<String> w3DStrings = new ArrayList<>(); for(W3DCode w3DCode : w3DCodes){ w3DStrings.add(w3DCode.toString()); } this.setCodes(w3DStrings); this.setPairCount(CollectionUtils.size(TransferUtil.getPairCodes(this.getW3DCodes()))); this.setRandomKilledCount(TransferUtil.getDeletedCodeCount(this.getW3DCodes())); return this; } public WelfareCode toGroup(){ if(!CodeTypeEnum.DIRECT.equals(codeTypeEnum) || CollectionUtils.size(this.getW3DCodes()) <= 1){ return this; } List<W3DCode> w3DCodes = TransferUtil.grouplize(this.getW3DCodes()); this.setW3DCodes(w3DCodes); this.cleanFreq().distinct().sort(WelfareCode::bitSort); this.codeTypeEnum = CodeTypeEnum.GROUP; return this; } public WelfareCode toDirect(){ if(!CodeTypeEnum.GROUP.equals(codeTypeEnum) || CollectionUtils.size(this.getW3DCodes()) <= 1) { return this; } // todo List<W3DCode> w3DCodes = new ArrayList<>(); this.getW3DCodes().forEach(w3DCode -> { int index = TransferUtil.findInDirectW3DCodes(w3DCodes, w3DCode); if(index < 0){ w3DCodes.addAll(Encoders.permutation(w3DCode)); } }); this.setW3DCodes(w3DCodes); this.distinct().cleanFreq().sort(WelfareCode::bitSort); this.codeTypeEnum = CodeTypeEnum.DIRECT; return this; } public WelfareCode cleanFreq(){ if(CollectionUtils.isEmpty(this.getW3DCodes())){ return this; } this.getW3DCodes().forEach(w3DCode -> w3DCode.setFreq(0)); return this; } public WelfareCode asc(){ if(CollectionUtils.isEmpty(this.getW3DCodes())){ return this; } // this.getW3DCodes().forEach(w3DCode -> w3DCode.asc()); for(W3DCode w3DCode : this.getW3DCodes()){ w3DCode.asc(); } return this; } public WelfareCode filter(CodeFilter<? super WelfareCode> codeFilter, FilterParam filterParam){ codeFilter.filter(this, filterParam); return this; } public WelfareCode sort(Comparator<? super W3DCode> c){ if(CollectionUtils.isEmpty(this.getW3DCodes())){ return this; } this.getW3DCodes().sort(c); return this; } public static int bitSort(W3DCode o1, W3DCode o2){ if(o1.getCodes()[BitConstant.HUNDRED] != null && o2.getCodes()[BitConstant.HUNDRED] != null && !o1.getCodes()[BitConstant.HUNDRED].equals(o2.getCodes()[BitConstant.HUNDRED])){ return o1.getCodes()[BitConstant.HUNDRED].compareTo(o2.getCodes()[BitConstant.HUNDRED]); }else if (!o1.getCodes()[BitConstant.DECADE].equals(o2.getCodes()[BitConstant.DECADE])){ return o1.getCodes()[BitConstant.DECADE].compareTo(o2.getCodes()[BitConstant.DECADE]); }else{ return o1.getCodes()[BitConstant.UNIT].compareTo(o2.getCodes()[BitConstant.UNIT]); } } public static int freqSort(W3DCode o1, W3DCode o2){ if(o1 == null || o2 == null){ return 0; } if(o1.getFreq() == o2.getFreq()){ return tailSort(o1, o2); }else { return o2.getFreq() > o1.getFreq() ? 1 : -1; } } public static int tailSort(W3DCode o1, W3DCode o2){ if(o1 == null || o2 == null ){ return 0; } if(o1.getSumTail() == o2.getSumTail()){ return bitSort(o1, o2); } else { return o1.getSumTail() > o2.getSumTail() ? 1 : -1; } } public WelfareCode merge(WelfareCode welfareCode){ if(welfareCode == null || welfareCode.getW3DCodes() == null){ return this; } else if (welfareCode.getCodeTypeEnum() != this.getCodeTypeEnum()){ throw new IllegalArgumentException("预测码类型不匹配"); } List<W3DCode> w3DCodes = Encoders.merge(this.getW3DCodes(), welfareCode.getW3DCodes(), this.getCodeTypeEnum()); if(!CollectionUtils.isEmpty(w3DCodes)){ this.setW3DCodes(w3DCodes); } this.sort(WelfareCode::bitSort).generate(); return this; } public WelfareCode minus(WelfareCode welfareCode){ if(welfareCode == null || welfareCode.getW3DCodes() == null){ return this; } else if (welfareCode.getCodeTypeEnum() != this.getCodeTypeEnum()){ throw new IllegalArgumentException("预测码类型不匹配"); } List<W3DCode> w3DCodes = Encoders.minus(this.getW3DCodes(), welfareCode.getW3DCodes(), this.codeTypeEnum); this.setW3DCodes(w3DCodes); this.sort(WelfareCode::bitSort).generate(); return this; } public List<W3DCode> getIntersection(WelfareCode welfareCode){ if(CollectionUtils.isEmpty(this.getW3DCodes())){ return Collections.emptyList(); } if( welfareCode == null || welfareCode.getCodeTypeEnum() != this.getCodeTypeEnum()){ return Collections.emptyList(); } List<W3DCode> codes = welfareCode.getW3DCodes(); if(CollectionUtils.isEmpty(codes)){ return Collections.emptyList(); } List<W3DCode> w3DCodeList = new ArrayList<>(); List<W3DCode> w3DCodes = this.getW3DCodes(); for(W3DCode w3DCode : w3DCodes){ if (TransferUtil.findInW3DCodes(codes, w3DCode, welfareCode.codeTypeEnum) < 0){ continue; } else { w3DCodeList.add(w3DCode); } } return w3DCodeList; } }
6dc070d3dfcb1c1dda520b5f8a5c516f94f678a0
a2255ae576875703aa207451108b0816a8233d05
/workspace_luna/LeetCode/src/validate_binary_search_tree/Solution.java
5b8131ad53e4f92c2cecd83b3dc118c9ce9ea3ed
[]
no_license
llincc/Eclipse
670bad95812f2b4b96f6f2967c41c6d0c8aa9faa
23b436c5f4cb4fccf2866d990e7cc8df76df5a76
refs/heads/master
2020-03-29T21:28:50.559183
2019-01-06T17:28:30
2019-01-06T17:28:30
150,369,020
0
0
null
null
null
null
WINDOWS-1252
Java
false
false
1,052
java
package validate_binary_search_tree; class TreeNode { int val; TreeNode left; TreeNode right; TreeNode(int x) { val = x; } } /*ÌâÄ¿ÃèÊö Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is defined as follows: The left subtree of a node contains only nodes with keys less than the node's key. The right subtree of a node contains only nodes with keys greater than the node's key. Both the left and right subtrees must also be binary search trees.*/ public class Solution { boolean isBST = true; TreeNode preNode = null; public boolean isValidBST(TreeNode root) { inOrderTraverse(root); return isBST; } public void inOrderTraverse(TreeNode root){ if(!isBST) return; if(root == null) return; inOrderTraverse(root.left); if(preNode != null && preNode.val >= root.val){ isBST = false; return; } preNode = root; inOrderTraverse(root.right); } }
841e61cbfe621c303039c62ca70b00d321e5f48c
65dc5e2220e6bec70ae470b4eefd76e8c77a8f9a
/src/test/java/com/hybrid/sorter/old/GenerateTestFiles.java
48b05b67e3b8d9d24993183cf3f28341ddd4beb5
[]
no_license
markina/improve_non-dominated_sorting
3672de1c88280e76eff330be426eaf3ee22f0e50
5d16d83d0e578be26376270f18d14ca184fa7321
refs/heads/master
2021-01-21T04:44:39.109151
2017-07-11T22:36:12
2017-07-11T22:36:12
53,866,994
2
0
null
null
null
null
UTF-8
Java
false
false
2,200
java
package com.hybrid.sorter.old; import com.hybrid.sorter.FactoryNonDominatedSorting; import com.hybrid.sorter.FasterNonDominatedSorting; import com.hybrid.sorter.Sorter; import java.util.ArrayList; import java.util.List; import java.util.Random; /** * @author mmarkina */ public class GenerateTestFiles { private static final Random rnd = new Random(366239); private static FactoryNonDominatedSorting fast = new FasterNonDominatedSorting(); public static abstract class TestGenerator { public abstract double[][] generate(int n, int m); public abstract String getName(); } public static class CubeGenerator extends TestGenerator { public double[][] generate(int n, int m) { double[][] rv = new double[n][m]; for (int i = 0; i < n; ++i) { for (int j = 0; j < m; ++j) { rv[i][j] = rnd.nextDouble(); } } return rv; } public String getName() { return "cube"; } } public static class NFrontGenerator extends TestGenerator { private int nFronts; public NFrontGenerator(int nFronts) { this.nFronts = nFronts; } public double[][] generate(int n, int m) { double[][] rv = new double[n][m]; for (int i = 0; i < n; ++i) { double sum = (double) (i % nFronts) / nFronts; for (int j = 1; j < m; ++j) { rv[i][j] = (sum / m) + (i / nFronts == 0 ? 0 : rnd.nextGaussian()); sum -= rv[i][j]; } rv[i][0] = sum; } return rv; } public String getName() { return nFronts + "fronts"; } } private static List<double[][]> collectTests(TestGenerator generator, int n, int k) { double[][] input = generator.generate(n, k); int[] output = new int[n]; List<double[][]> rv = new ArrayList<>(); Sorter sorter = fast.getSorter(n, k); sorter.setParamAnalysis(true, (test) -> rv.add(test)); sorter.sort(input, output); return rv; } }
f1ec1208b49d02cd4f5011e3067188fc00f25328
2df9bdbe2e90a240c30768e571c499efebb2cd9f
/src/main/java/com/lzywsgl/sys/controller/FileController.java
1430356e2d4deab0ea865d9c9e2fadb78d8134c4
[]
no_license
lzyywsgl/carrental
2a5490d26a2429eff15747625fb3550c5b43d66c
519f344c500fed7ede360d406f8af47a2190ecba
refs/heads/master
2022-12-23T01:09:22.793854
2020-05-19T14:48:38
2020-05-19T14:48:38
244,152,074
0
0
null
2022-12-16T15:30:49
2020-03-01T13:14:30
Java
UTF-8
Java
false
false
2,464
java
package com.lzywsgl.sys.controller; import com.lzywsgl.sys.constast.SysConstast; import com.lzywsgl.sys.utils.AppFileUtils; import com.lzywsgl.sys.utils.DataGridView; import com.lzywsgl.sys.utils.RandomUtils; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; import java.io.File; import java.io.IOException; import java.util.HashMap; import java.util.Map; /** * @author Administrator * @title: FileController * @projectName carrental * @description: 文件上传下载控制器 * @date 2020/3/14 16:47 */ @Controller @RequestMapping("file") public class FileController { /** * 添加 * * @throws IOException IO操作异常 * @throws IllegalStateException 非法状态异常 */ @RequestMapping("uploadFile") @ResponseBody public DataGridView uploadFile(MultipartFile multipartFile) throws IllegalStateException, IOException { // 文件上传的父目录 String parentPath = AppFileUtils.PATH; // 得到当前日期作为文件加名称 String dirName = RandomUtils.getCurrentDateForString(); // 构造文件夹对象 File file = new File(parentPath, dirName); if (!file.exists()) { file.mkdirs(); // 创建文件夹 } // 得到文件原名 String oldName = multipartFile.getOriginalFilename(); String newName = RandomUtils.createFileNameUseTime(oldName, SysConstast.FILE_UPLOAD_TEMP); File dest = new File(file, newName); multipartFile.transferTo(dest); Map<String, Object> map = new HashMap<>(); map.put("src", dirName + "/" + newName); return new DataGridView(map); } /** * 不下载只显示 */ @RequestMapping("downloadShowFile") public ResponseEntity<Object> downloadShowFile(String path, HttpServletResponse response) { return AppFileUtils.downloadFile(response, path," "); } /** * 下载图片 */ @RequestMapping("downloadFile") public ResponseEntity<Object> downloadFile(String path, HttpServletResponse response) { String oldName = ""; return AppFileUtils.downloadFile(response, path, oldName); } }
6f7a8aaec80e087182a21df6573d552118d03ee0
abd19b1d2a5c180196bae0d071599b38adb86b12
/com.siteview.kernel.core/src/COM/dragonflow/Utils/HtmlUtil.java
315b0a0567e75075e5d67f7b60703cdccc6d966f
[]
no_license
SiteView/eclipse3.7
35d054f83daf4bb4c25d02c24286dd21e4a3a275
3fd1f09bd80964476cb40250f3fa92d57a6372f4
refs/heads/master
2016-09-05T09:56:06.465063
2012-04-19T07:29:23
2012-04-19T07:29:23
null
0
0
null
null
null
null
UTF-8
Java
false
false
3,922
java
/* * Created on 2005-2-9 3:06:20 * * .java * * History: * */ package COM.dragonflow.Utils; /** * Comment for <code></code> * * @author * @version 0.0 * * */ // Referenced classes of package COM.dragonflow.Utils: // RawXmlWriter, StringPropertyUtil public class HtmlUtil { public HtmlUtil() { } public static String createHiddenInputs(java.util.HashMap hashmap) { StringBuffer stringbuffer = new StringBuffer(); java.util.Set set = hashmap.entrySet(); java.util.Map.Entry entry; for(java.util.Iterator iterator = set.iterator(); iterator.hasNext(); stringbuffer.append("<INPUT type=hidden name='" + COM.dragonflow.Utils.RawXmlWriter.enCodeElement((String)entry.getKey()) + "' id='" + COM.dragonflow.Utils.RawXmlWriter.enCodeElement((String)entry.getKey()) + "' value='" + COM.dragonflow.Utils.RawXmlWriter.enCodeElement((String)entry.getValue()) + "'>\n")) { entry = (java.util.Map.Entry)iterator.next(); } return stringbuffer.toString(); } public static String createHiddenInputs(COM.dragonflow.Properties.StringProperty astringproperty[], String s, String s1, String s2, String s3) { StringBuffer stringbuffer = new StringBuffer(); stringbuffer.append("<INPUT type=hidden id='" + s + s3 + "' value='" + astringproperty.length + "'>\n"); for(int i = 0; i < astringproperty.length; i++) { String s4 = COM.dragonflow.Utils.RawXmlWriter.enCodeElement(astringproperty[i].getLabel()); stringbuffer.append("<INPUT type=hidden id='" + s + s1 + i + "' value='" + s4 + "'>\n"); String s5 = COM.dragonflow.Utils.RawXmlWriter.enCodeElement(astringproperty[i].getDescription()); stringbuffer.append("<INPUT type=hidden id='" + s + s2 + i + "' value='" + s5 + "'>\n"); } return stringbuffer.toString(); } public static String createCheckboxList(COM.dragonflow.Properties.StringProperty astringproperty[], String s) { COM.dragonflow.Properties.StringProperty astringproperty1[] = (COM.dragonflow.Properties.StringProperty[])astringproperty.clone(); COM.dragonflow.Utils.StringPropertyUtil.sortPropsArray(astringproperty1); StringBuffer stringbuffer = new StringBuffer("<SCRIPT LANGUAGE='Javascript' SRC='/SiteView/htdocs/js/utils.js'></SCRIPT>\n<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0>\n <TR>\n <TD width=100%><DIV style='width:100%; height:88px; OVERFLOW: auto'>\n <TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0>\n"); for(int i = 0; i < astringproperty1.length; i++) { stringbuffer.append(" <TR>\n <TD>\n <INPUT type='checkbox' id='" + s + i + "' value=\"" + COM.dragonflow.Utils.RawXmlWriter.enCodeElement(astringproperty1[i].getLabel()) + "\" title=\"" + COM.dragonflow.Utils.RawXmlWriter.enCodeElement(astringproperty1[i].getDescription()) + "\">" + COM.dragonflow.Utils.RawXmlWriter.enCodeElement(astringproperty1[i].getLabel()) + "</INPUT>\n" + " </TD>\n" + " </TR>\n"); } stringbuffer.append(" </TABLE>\n </DIV></TD>\n <TD vAlign=top>\n <TABLE width=1 cellSpacing=0 cellPadding=0 border=0 align=top>\n <TR><TD>\n <INPUT type=button title='Select all counters' value='Select All' onclick=\"checkCheckboxes('" + s + "', true)\">\n" + " </TD></TR>\n" + " <TR><TD>\n" + " <INPUT type=button value='Clear All' title='Clear all counter selections' onclick=\"checkCheckboxes('" + s + "', false)\" style='WIDTH: 100%'>\n" + " </TD></TR>\n" + " </TABLE>\n" + " </TD>\n" + " </TR>\n" + "</TABLE>\n"); return stringbuffer.toString(); } }
1c725eed17b0e89ad48a5dccab6b100833a12b72
90cb56b42b50e768e80ea7cd28ca72292797d890
/rockscript/src/test/java/io/rockscript/test/engine/http/TestRunnerHttpTest.java
fb5cd3a49e31b6047cd834e1e4c63b38b62ca627
[ "Apache-2.0" ]
permissive
fengweijp/rockscript
d7209a23cde3e944d60b2d2262a8753a23ae3859
4fc1eeae08ceb36e755a7d9766af1e01ff25f3e3
refs/heads/master
2021-05-06T00:58:13.395316
2017-12-13T15:20:09
2017-12-13T15:20:09
null
0
0
null
null
null
null
UTF-8
Java
false
false
6,814
java
/* * Copyright (c) 2017 RockScript.io. * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package io.rockscript.test.engine.http; import io.rockscript.service.test.TestError; import io.rockscript.service.test.TestResult; import io.rockscript.service.test.TestResults; import io.rockscript.api.commands.DeployScriptVersionCommand; import io.rockscript.api.commands.RunTestsCommand; import io.rockscript.engine.impl.ServiceFunctionErrorEvent; import io.rockscript.engine.impl.Event; import io.rockscript.engine.impl.ScriptExecutionErrorEvent; import io.rockscript.http.servlet.PathRequestHandler; import io.rockscript.http.servlet.RouterServlet; import io.rockscript.http.servlet.ServerRequest; import io.rockscript.http.servlet.ServerResponse; import io.rockscript.test.Assert; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.List; import static io.rockscript.http.servlet.PathRequestHandler.GET; import static io.rockscript.util.Maps.entry; import static io.rockscript.util.Maps.hashMap; import static org.junit.Assert.*; public class TestRunnerHttpTest extends AbstractHttpTest { protected static Logger log = LoggerFactory.getLogger(TestRunnerHttpTest.class); @Override protected void configure(RouterServlet routerServlet) { routerServlet .requestHandler(new PathRequestHandler(GET, "/ole") { @SuppressWarnings("unchecked") @Override public void handle(ServerRequest request, ServerResponse response) { response.status(200) .bodyJson(hashMap( entry("country", "Belgium"), entry("currency", "EUR"))); } }); } @Test public void testTestRunnerAssertionFailure() { new DeployScriptVersionCommand() .scriptName("The Script.rs") .scriptText( "var http = system.import('rockscript.io/http'); \n" + "var country = http \n" + " .get({url: 'http://localhost:4000/ole'}) \n" + " .body.country;") .execute(engine); String testScriptId = new DeployScriptVersionCommand() .scriptName("The Script Test.rst") .scriptText( "var test = system.import('rockscript.io/test'); \n" + "var scriptExecution = test.start({ \n" + " script: 'The Script.rs', \n" + " skipActivities: true}); \n" + "test.assertEquals(scriptExecution.variables.country, 'The Netherlands');") .execute(engine) .getId(); TestResults testResults = new RunTestsCommand() .execute(engine); log.debug(engine.getGson().toJson(testResults)); TestResult testResult = testResults.get(0); log.debug("Events:"); testResult.getEvents().forEach(e->log.debug(e.toString())); log.debug("Errors:"); testResult.getErrors().forEach(e->log.debug(e.toString())); List<Event> testEvents = testResult.getEvents(); ServiceFunctionErrorEvent errorEvent = (ServiceFunctionErrorEvent) testEvents.get(testEvents.size() - 1); Assert.assertContains("Expected The Netherlands, but was Belgium", errorEvent.getError()); assertNull(errorEvent.getRetryTime()); // because there's no point in retrying assertion errors TestError testError = testResult.getErrors().get(0); Assert.assertContains("Expected The Netherlands, but was Belgium", testError.getMessage()); assertEquals(testScriptId, testError.getScriptVersionId()); assertEquals(5, testError.getLine()); } @Test public void testTestRunnerScriptFailure() { String targetScriptId = new DeployScriptVersionCommand() .scriptName("The Script.rs") .scriptText( /* 1 */ "var http = system.import('rockscript.io/http'); \n" + /* 2 */ "unexistingvar.unexistingmethod();") .execute(engine) .getId(); String testScriptId = new DeployScriptVersionCommand() .scriptName("The Script Test.rst") .scriptText( /* 1 */ "var test = system.import('rockscript.io/test'); \n" + /* 2 */ "\n" + /* 3 */ "var scriptExecution = test.start({ \n" + /* 4 */ " script: 'The Script.rs', \n" + /* 5 */ " skipActivities: true}); ") .execute(engine) .getId(); TestResults testResults = new RunTestsCommand() .execute(engine); log.debug(engine.getGson().toJson(testResults)); TestResult testResult = testResults.get(0); log.debug("Events:"); testResult.getEvents().forEach(e->log.debug(e.toString())); log.debug("Errors:"); testResult.getErrors().forEach(e->log.debug(e.toString())); List<Event> testEvents = testResult.getEvents(); ScriptExecutionErrorEvent targetScriptErrorEvent = (ScriptExecutionErrorEvent) testEvents.get(testEvents.size() - 2); Assert.assertContains("ReferenceError: unexistingvar is not defined", targetScriptErrorEvent.getError()); Assert.assertContains(targetScriptId, targetScriptErrorEvent.getScriptId()); assertNotNull(targetScriptErrorEvent.getLine()); ServiceFunctionErrorEvent testScriptErrorEvent = (ServiceFunctionErrorEvent) testEvents.get(testEvents.size() - 1); Assert.assertContains("Script start failed: ReferenceError: unexistingvar is not defined", testScriptErrorEvent.getError()); Assert.assertContains(testScriptId, testScriptErrorEvent.getScriptId()); assertNotNull(testScriptErrorEvent.getLine()); List<TestError> testErrors = testResult.getErrors(); TestError firstTestError = testErrors.get(0); Assert.assertContains("ReferenceError: unexistingvar is not defined", firstTestError.getMessage()); Assert.assertContains(targetScriptId, firstTestError.getScriptVersionId()); assertNotNull(firstTestError.getLine()); TestError secondTestError = testErrors.get(1); Assert.assertContains("Script start failed: ReferenceError: unexistingvar is not defined", secondTestError.getMessage()); Assert.assertContains(testScriptId, secondTestError.getScriptVersionId()); assertNotNull(secondTestError.getLine()); } }
ee63c882d3f5079480b41747605a2414498a72f3
e15886431fad46e1f3d2d000c31d71747062072c
/JavaProject/src/com/javaProject/models/Collectable.java
a159db1955beea6e6708fe1ceda636e5fd40e235
[]
no_license
esmeraldaaguayo/pokemon-clone
aca9310d9b56bc118b63b1b50788e5eb34909651
9240a068e03a4a8b26d001cd76d9414eb3a0fdd2
refs/heads/master
2020-04-06T20:31:18.441961
2018-12-18T11:19:29
2018-12-18T11:19:29
null
0
0
null
null
null
null
UTF-8
Java
false
false
512
java
package com.javaProject.models; public class Collectable { /* * Functionality: */ // Fields private Position position; private CollectableInterface collectableObject; // Constructor public Collectable(Position position, CollectableInterface collectableObject) { this.position = position; this.collectableObject = collectableObject; } public Position getPosition() { return this.position; } public CollectableInterface getCollectableObject() { return this.collectableObject; } }
941490c8813a2ad5b1b37442bc2046779da2a10e
9e69a97c57bbabbf187d42780485d1eecfebe01c
/test_1/app/models/BookCommentModel.java
b507655993f90599050d9d6ce632ef1e53d3026e
[ "Apache-2.0" ]
permissive
CaioTsubake/gitTest
1bf6852e0ba2a59fd3c1f8d36cc7e35b33eda255
114e1e044c7fcc24dfaf1aa9443985015fd13c2a
refs/heads/master
2016-09-01T03:10:25.584374
2015-12-07T02:15:17
2015-12-07T02:15:17
36,255,864
0
0
null
null
null
null
UTF-8
Java
false
false
173
java
package models; import javax.persistence.Entity; import play.db.ebean.Model; @Entity public class BookCommentModel extends CommentModel { public int bookPageId; }
[ "Caio [email protected]" ]
5715182ead21c624b0967400b2e955bcd3e2e90b
98d755262b9fb59b386ae3ca3d6f7607bb18c92b
/src/P_19.java
8cb7e2fbdf87498dbe4f0166f76f9ac5b560d9da
[]
no_license
dinara92/Leetcode
22617fd509dbf6872379e705f64ecf87c34e6b94
df6177c4b713e32acbfba886035d29b075f0e9ee
refs/heads/master
2020-03-15T04:12:46.130854
2018-08-20T11:19:03
2018-08-20T11:19:03
131,960,071
0
0
null
null
null
null
UTF-8
Java
false
false
1,318
java
// Definition for singly-linked list. class ListNode { int val; ListNode next; ListNode(int x) { val = x; } } class P_19 { public ListNode removeNthFromEnd(ListNode head, int n) { ListNode curr = head; int i = 0; while(curr.next!=null){ curr = curr.next; i++; } ListNode node = head; int j=0; System.out.println("this is i: " + i); if(i==0){ return null; } while(node.next!=null ){ if(j == i-n){ System.out.println("this is j: " + j); System.out.println("this is node value : " + node.val); //System.out.println("this is node.next.next value : " + node.next.next.val); node.next = node.next.next; j++; } else if(i-n<0){ System.out.println("here!"); return node.next; } else{ node = node.next; j++; } } System.out.println(j); return head; } }
116fb7a6840493c7d4d73a4a207cb3e1eb765496
c1dcfce58386cb458d463f73c95e0c198a9116e2
/GTS/src/org/opengts/servers/taip/TrackServer.java
90299a78f25e7f7c5d90482bdc34f70a3c73b3a8
[]
no_license
arnoldmontiel/gts-mp-solutions
343b07db84603e03af7476023380d5a9c6667297
2ca931bfce167eca5ad12e0c6177084fc58031b7
refs/heads/master
2020-05-29T14:57:44.386940
2011-06-20T20:28:31
2011-06-20T20:28:31
33,992,003
0
0
null
null
null
null
UTF-8
Java
false
false
10,281
java
// ---------------------------------------------------------------------------- // Copyright 2006-2011, GeoTelematic Solutions, Inc. // All rights reserved // ---------------------------------------------------------------------------- // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // ---------------------------------------------------------------------------- // Description: // Server Initialization // ---------------------------------------------------------------------------- // Change History: // 2010/11/29 Martin D. Flynn (1/29) // -Initial OpenGTS release // ---------------------------------------------------------------------------- package org.opengts.servers.taip; import java.lang.*; import java.util.*; import java.io.*; import java.net.*; import java.sql.*; import org.opengts.util.*; import org.opengts.db.*; import org.opengts.db.tables.*; public class TrackServer { // ------------------------------------------------------------------------ // initialize runtime configuration public static void configInit() { DCServerConfig dcs = Main.getServerConfig(); TrackServer.setTcpIdleTimeout( dcs.getTcpIdleTimeoutMS( Constants.TIMEOUT_TCP_IDLE )); TrackServer.setTcpPacketTimeout( dcs.getTcpPacketTimeoutMS( Constants.TIMEOUT_TCP_PACKET )); TrackServer.setTcpSessionTimeout(dcs.getTcpSessionTimeoutMS(Constants.TIMEOUT_TCP_SESSION)); TrackServer.setUdpIdleTimeout( dcs.getUdpIdleTimeoutMS( Constants.TIMEOUT_UDP_IDLE )); TrackServer.setUdpPacketTimeout( dcs.getUdpPacketTimeoutMS( Constants.TIMEOUT_UDP_PACKET )); TrackServer.setUdpSessionTimeout(dcs.getUdpSessionTimeoutMS(Constants.TIMEOUT_UDP_SESSION)); } // ------------------------------------------------------------------------ // Start TrackServer (TrackServer is a singleton) private static TrackServer trackTcpInstance = null; /* start TrackServer on array of ports */ public static TrackServer startTrackServer(int tcpPorts[], int udpPorts[], int commandPort) throws Throwable { if (trackTcpInstance == null) { trackTcpInstance = new TrackServer(tcpPorts, udpPorts, commandPort); } else { //Print.logError("TrackServer already initialized!"); } return trackTcpInstance; } // ------------------------------------------------------------------------ // TCP Session timeouts /* idle timeout */ private static long tcpTimeout_idle = Constants.TIMEOUT_TCP_IDLE; public static void setTcpIdleTimeout(long timeout) { TrackServer.tcpTimeout_idle = timeout; } public static long getTcpIdleTimeout() { return TrackServer.tcpTimeout_idle; } /* inter-packet timeout */ private static long tcpTimeout_packet = Constants.TIMEOUT_TCP_PACKET; public static void setTcpPacketTimeout(long timeout) { TrackServer.tcpTimeout_packet = timeout; } public static long getTcpPacketTimeout() { return TrackServer.tcpTimeout_packet; } /* total session timeout */ private static long tcpTimeout_session = Constants.TIMEOUT_TCP_SESSION; public static void setTcpSessionTimeout(long timeout) { TrackServer.tcpTimeout_session = timeout; } public static long getTcpSessionTimeout() { return TrackServer.tcpTimeout_session; } // ------------------------------------------------------------------------ // UDP Session timeouts /* idle timeout */ private static long udpTimeout_idle = Constants.TIMEOUT_UDP_IDLE; public static void setUdpIdleTimeout(long timeout) { TrackServer.udpTimeout_idle = timeout; } public static long getUdpIdleTimeout() { return TrackServer.udpTimeout_idle; } /* inter-packet timeout */ private static long udpTimeout_packet = Constants.TIMEOUT_UDP_PACKET; public static void setUdpPacketTimeout(long timeout) { TrackServer.udpTimeout_packet = timeout; } public static long getUdpPacketTimeout() { return TrackServer.udpTimeout_packet; } /* total session timeout */ private static long udpTimeout_session = Constants.TIMEOUT_UDP_SESSION; public static void setUdpSessionTimeout(long timeout) { TrackServer.udpTimeout_session = timeout; } public static long getUdpSessionTimeout() { return TrackServer.udpTimeout_session; } // ------------------------------------------------------------------------ // ------------------------------------------------------------------------ // TCP port listener threads private java.util.List<ServerSocketThread> tcpThread = new Vector<ServerSocketThread>(); // UDP port listener threads private java.util.List<ServerSocketThread> udpThread = new Vector<ServerSocketThread>(); // Command port listener thread private ServerSocketThread cmdThread = null; // ------------------------------------------------------------------------ /* private constructor */ private TrackServer(int tcpPorts[], int udpPorts[], int commandPort) throws Throwable { int listeners = 0; // Start TCP listeners if (!ListTools.isEmpty(tcpPorts)) { for (int i = 0; i < tcpPorts.length; i++) { int port = tcpPorts[i]; if (ServerSocketThread.isValidPort(port)) { try { this._startTCP(port); listeners++; } catch (java.net.BindException be) { Print.logError("TCP: Error binding to port: %d", port); } } else { throw new Exception("TCP: Invalid port number: " + port); } } } // Start UDP listeners if (!ListTools.isEmpty(udpPorts)) { for (int i = 0; i < udpPorts.length; i++) { int port = udpPorts[i]; if (ServerSocketThread.isValidPort(port)) { try { this._startUDP(port); listeners++; } catch (java.net.BindException be) { Print.logError("UDP: Error binding to port: %d", port); } } else { throw new Exception("UDP: Invalid port number: " + port); } } } /* do we have any active listeners? */ if (listeners <= 0) { Print.logWarn("No active device communication listeners!"); } } // ------------------------------------------------------------------------ /* start TCP listener */ private void _startTCP(int port) throws Throwable { ServerSocketThread sst = null; /* create server socket */ try { sst = new ServerSocketThread(port); } catch (Throwable t) { // trap any server exception Print.logException("ServerSocket error", t); throw t; } /* initialize */ sst.setTextPackets(Constants.ASCII_PACKETS); sst.setBackspaceChar(null); // no backspaces allowed sst.setLineTerminatorChar(Constants.ASCII_LINE_TERMINATOR); sst.setIgnoreChar(Constants.ASCII_IGNORE_CHARS); sst.setMaximumPacketLength(Constants.MAX_PACKET_LENGTH); sst.setMinimumPacketLength(Constants.MIN_PACKET_LENGTH); sst.setIdleTimeout(TrackServer.tcpTimeout_idle); // time between packets sst.setPacketTimeout(TrackServer.tcpTimeout_packet); // time from start of packet to packet completion sst.setSessionTimeout(TrackServer.tcpTimeout_session); // time for entire session sst.setLingerTimeoutSec(Constants.LINGER_ON_CLOSE_SEC); sst.setTerminateOnTimeout(Constants.TERMINATE_ON_TIMEOUT); sst.setClientPacketHandlerClass(TrackClientPacketHandler.class); /* start thread */ Print.logInfo("Starting TCP listener thread on port " + port + " [timeout=" + sst.getSessionTimeout() + "ms] ..."); sst.start(); this.tcpThread.add(sst); } // ------------------------------------------------------------------------ /* start UDP listener */ private void _startUDP(int port) throws Throwable { ServerSocketThread sst = null; /* create server socket */ try { sst = new ServerSocketThread(ServerSocketThread.createDatagramSocket(port)); } catch (Throwable t) { // trap any server exception Print.logException("ServerSocket error", t); throw t; } /* initialize */ sst.setTextPackets(true); sst.setBackspaceChar(null); // no backspaces allowed sst.setLineTerminatorChar(new int[] { '\r' }); sst.setMaximumPacketLength(Constants.MAX_PACKET_LENGTH); sst.setMinimumPacketLength(Constants.MIN_PACKET_LENGTH); sst.setIdleTimeout(TrackServer.udpTimeout_idle); sst.setPacketTimeout(TrackServer.udpTimeout_packet); sst.setSessionTimeout(TrackServer.udpTimeout_session); sst.setTerminateOnTimeout(Constants.TERMINATE_ON_TIMEOUT); sst.setClientPacketHandlerClass(TrackClientPacketHandler.class); /* start thread */ Print.logInfo("Starting UDP listener thread on port " + port + " [timeout=" + sst.getSessionTimeout() + "ms] ..."); sst.start(); this.udpThread.add(sst); } // ------------------------------------------------------------------------ }
[ "[email protected]@cd8b9730-d6ca-1c52-d244-e2f71826dca3" ]
[email protected]@cd8b9730-d6ca-1c52-d244-e2f71826dca3
c2c6cc1be2392d7ec604e67f050ae23ea364c830
eee8bc10508ac244dd9a6baabf5349e59690a181
/kong-integration/src/main/java/br/com/gempe/kongintegration/KongIntegrationApplication.java
140de1f830213669b80b97e3bca750c7b360bdf0
[]
no_license
gempe/kong-key-auth
28ee67487e1001929a548b48b60d73f5d6c59d93
270e7956bce4a7088203080174f5f369eec139fd
refs/heads/main
2023-07-05T06:08:03.926060
2021-08-12T19:57:30
2021-08-12T19:57:30
394,690,926
0
0
null
null
null
null
UTF-8
Java
false
false
670
java
package br.com.gempe.kongintegration; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.cloud.openfeign.EnableFeignClients; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @SpringBootApplication @EnableFeignClients @EnableAutoConfiguration @Configuration @ComponentScan public class KongIntegrationApplication { public static void main(String[] args) { SpringApplication.run(KongIntegrationApplication.class, args); } }
80324258b65b042c3f125f733e0ff15b6dee1599
cc62e366d954a09bdad39142d86a38e27ba4ec5d
/src/main/java/com/example/bankservice/service/TransactionService.java
60e2de6a3d617c0698b5b17f96dfdbd0d0217fe4
[]
no_license
rockettoalgeria/bank-service
ba9c03b826b871f9bd0c39104307ed9176aee465
7244591081a0d1d2f248fcfc8f7c59debc5c4924
refs/heads/master
2023-01-07T03:24:56.315312
2020-11-02T09:17:38
2020-11-02T09:17:38
307,741,129
0
0
null
null
null
null
UTF-8
Java
false
false
3,287
java
package com.example.bankservice.service; import com.example.bankservice.exception.InvalidTransactionAmountException; import com.example.bankservice.exception.ResourceNotFoundException; import com.example.bankservice.model.Account; import com.example.bankservice.model.OneTargetTransaction; import com.example.bankservice.model.TransferTransaction; import com.example.bankservice.repository.AccountRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.math.BigDecimal; import java.math.RoundingMode; import java.util.UUID; @Service public class TransactionService { @Autowired private AccountRepository accountRepository; private void performWriteOff(BigDecimal amount, UUID accountId) throws InvalidTransactionAmountException, ResourceNotFoundException { if (amount.compareTo(BigDecimal.ZERO) < 0 || amount.compareTo(BigDecimal.valueOf(0.01)) < 0) { throw new InvalidTransactionAmountException(); } Account account = accountRepository.findOneById(accountId); if (account == null) { throw new ResourceNotFoundException(); } BigDecimal potentialBalance = account.getBalance() .subtract(amount).setScale(2, RoundingMode.HALF_EVEN); if (potentialBalance.compareTo(BigDecimal.ZERO) >= 0) { account.setBalance(potentialBalance); } else { throw new InvalidTransactionAmountException(); } } private void performReplenishment(BigDecimal amount, UUID accountId) throws InvalidTransactionAmountException, ResourceNotFoundException { if (amount.compareTo(BigDecimal.ZERO) < 0 || amount.compareTo(BigDecimal.valueOf(0.01)) < 0) { throw new InvalidTransactionAmountException(); } Account account = accountRepository.findOneById(accountId); if (account == null) { throw new ResourceNotFoundException(); } BigDecimal newBalance = account.getBalance() .add(amount).setScale(2, RoundingMode.HALF_EVEN); account.setBalance(newBalance); } @Transactional public void doWithdrawTransaction(OneTargetTransaction oneTargetTransaction) throws InvalidTransactionAmountException, ResourceNotFoundException { performWriteOff(oneTargetTransaction.getAmount(), oneTargetTransaction.getAccountId()); } @Transactional public void doDepositTransaction(OneTargetTransaction oneTargetTransaction) throws InvalidTransactionAmountException, ResourceNotFoundException { performReplenishment(oneTargetTransaction.getAmount(), oneTargetTransaction.getAccountId()); } @Transactional synchronized public void doTransferBetweenAccounts(TransferTransaction transferTransaction) throws InvalidTransactionAmountException, ResourceNotFoundException { performWriteOff(transferTransaction.getAmount(), transferTransaction.getFromAccountId()); performReplenishment(transferTransaction.getAmount(), transferTransaction.getToAccountId()); } }
fdd22cdc97eca65dd7eb9a4e7e00c3720163fe5a
0a4d4b808ee0724114e6153c1204de4e253c1dcb
/samples/32/b.java
ff42e83b553e8dc23b9b347dd59d32c13b46e477
[ "MIT" ]
permissive
yura-hb/sesame-sampled-pairs
543b19bf340f6a35681cfca1084349bd3eb8f853
33b061e3612a7b26198c17245c2835193f861151
refs/heads/main
2023-07-09T04:15:05.821444
2021-08-08T12:01:04
2021-08-08T12:01:04
393,947,142
0
0
null
null
null
null
UTF-8
Java
false
false
4,094
java
import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.ReentrantLock; class ArrayBlockingQueue&lt;E&gt; extends AbstractQueue&lt;E&gt; implements BlockingQueue&lt;E&gt;, Serializable { /** * Atomically removes all of the elements from this queue. * The queue will be empty after this call returns. */ public void clear() { final ReentrantLock lock = this.lock; lock.lock(); try { int k; if ((k = count) &gt; 0) { circularClear(items, takeIndex, putIndex); takeIndex = putIndex; count = 0; if (itrs != null) itrs.queueIsEmpty(); for (; k &gt; 0 && lock.hasWaiters(notFull); k--) notFull.signal(); } } finally { lock.unlock(); } } /** Main lock guarding all access */ final ReentrantLock lock; /** Number of elements in the queue */ int count; /** The queued items */ final Object[] items; /** items index for next take, poll, peek or remove */ int takeIndex; /** items index for next put, offer, or add */ int putIndex; /** * Shared state for currently active iterators, or null if there * are known not to be any. Allows queue operations to update * iterator state. */ transient Itrs itrs; /** Condition for waiting puts */ private final Condition notFull; /** * Nulls out slots starting at array index i, upto index end. * Condition i == end means "full" - the entire array is cleared. */ private static void circularClear(Object[] items, int i, int end) { // assert 0 &lt;= i && i &lt; items.length; // assert 0 &lt;= end && end &lt; items.length; for (int to = (i &lt; end) ? end : items.length;; i = 0, to = end) { for (; i &lt; to; i++) items[i] = null; if (to == end) break; } } class Itrs { /** Main lock guarding all access */ final ReentrantLock lock; /** Number of elements in the queue */ int count; /** The queued items */ final Object[] items; /** items index for next take, poll, peek or remove */ int takeIndex; /** items index for next put, offer, or add */ int putIndex; /** * Shared state for currently active iterators, or null if there * are known not to be any. Allows queue operations to update * iterator state. */ transient Itrs itrs; /** Condition for waiting puts */ private final Condition notFull; /** * Called whenever the queue becomes empty. * * Notifies all active iterators that the queue is empty, * clears all weak refs, and unlinks the itrs datastructure. */ void queueIsEmpty() { // assert lock.isHeldByCurrentThread(); for (Node p = head; p != null; p = p.next) { Itr it = p.get(); if (it != null) { p.clear(); it.shutdown(); } } head = null; itrs = null; } } class Itr implements Iterator&lt;E&gt; { /** Main lock guarding all access */ final ReentrantLock lock; /** Number of elements in the queue */ int count; /** The queued items */ final Object[] items; /** items index for next take, poll, peek or remove */ int takeIndex; /** items index for next put, offer, or add */ int putIndex; /** * Shared state for currently active iterators, or null if there * are known not to be any. Allows queue operations to update * iterator state. */ transient Itrs itrs; /** Condition for waiting puts */ private final Condition notFull; /** * Called to notify the iterator that the queue is empty, or that it * has fallen hopelessly behind, so that it should abandon any * further iteration, except possibly to return one more element * from next(), as promised by returning true from hasNext(). */ void shutdown() { // assert lock.isHeldByCurrentThread(); cursor = NONE; if (nextIndex &gt;= 0) nextIndex = REMOVED; if (lastRet &gt;= 0) { lastRet = REMOVED; lastItem = null; } prevTakeIndex = DETACHED; // Don't set nextItem to null because we must continue to be // able to return it on next(). // // Caller will unlink from itrs when convenient. } } }
987c90b8d35221adc6c4c1b834d0b1828f759641
62c232b4b38d01439b2969bed988ce16fd3fd713
/src/com/sjs/dao/vo/Project_info.java
d65334fd63bfcdb2f93738c58facecc450df979b
[]
no_license
songjunshuang/TourStudy
e4cb51015e691ef67828ef30e42bff13ba9bd7c8
5afef49b335472c443fc91a429a2f6891fec72a4
refs/heads/master
2020-04-26T18:58:58.668695
2019-04-03T02:18:13
2019-04-03T02:18:13
173,760,650
0
0
null
null
null
null
UTF-8
Java
false
false
915
java
package com.sjs.dao.vo; public class Project_info { int projectId; String name; int typeId; String introduce; String projectImage; float price; public String getName() { return name; } public void setName(String name) { this.name = name; } public int getTypeId() { return typeId; } public int getProjectId() { return projectId; } public void setProjectId(int projectId) { this.projectId = projectId; } public void setTypeId(int typeId) { this.typeId = typeId; } public String getIntroduce() { return introduce; } public void setIntroduce(String introduce) { this.introduce = introduce; } public String getProjectImage() { return projectImage; } public void setProjectImage(String projectImage) { this.projectImage = projectImage; } public float getPrice() { return price; } public void setPrice(float price) { this.price = price; } }
a78f3adbab5e6c28889ca37f9a537993cc68557c
b59cf1524233b6a0a87685b9e67440d1a8a3cbc1
/ui/src/main/java/xc/ui/views/UIWebView.java
27fa1e6350aa022afc2a6439699009a227ca85fa
[]
no_license
liangxichao/UIAdapter
c4740465f210c9b7a1a441c09589760e5db2dd4f
6c48b7c5a0f3053975f27fe4371e3b63d41d035a
refs/heads/master
2020-03-23T21:41:48.140357
2019-05-21T08:04:24
2019-05-21T08:04:24
142,126,079
1
0
null
null
null
null
UTF-8
Java
false
false
665
java
package xc.ui.views; import android.content.Context; import android.util.AttributeSet; import android.view.ViewGroup; import android.webkit.WebView; /** * @author lxc * time at 2016/11/11 */ public class UIWebView extends WebView { protected UIParams uip; public UIWebView(Context context, AttributeSet attrs) { super(context, attrs); uip = new UIParams(context, attrs); } @Override public void setLayoutParams(ViewGroup.LayoutParams params) { if (uip != null) { super.setLayoutParams(uip.updateLayoutParams(this, params)); } else { super.setLayoutParams(params); } } }
c1fdd1b46d12e4be07b668d31e549617af3b4aad
3fdef8b2c4e18b144175b2a65f0b601573f90332
/Hackerrank/src/main/java/Java/DataStructures/Easy/Arrays2D/Result.java
bab30499948adc6cb4de40891cbe8e41e4ddddfa
[]
no_license
agatarauzer/Java-exercises
53651259c862392aa11fb3db06c1d625260e2888
e340ab82c835da658b560a8dd95054fbd606051c
refs/heads/master
2022-11-05T14:55:41.172425
2022-10-27T17:36:23
2022-10-27T17:36:23
143,118,363
0
0
null
null
null
null
UTF-8
Java
false
false
862
java
package Java.DataStructures.Easy.Arrays2D; import java.util.*; class Result { /* * Complete the 'hourglassSum' function below. * * The function is expected to return an INTEGER. * The function accepts 2D_INTEGER_ARRAY arr as parameter. */ public static int hourglassSum(List<List<Integer>> arr) { // Write your code here int sum = 0; int sumMax = -100; for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { sum = arr.get(i).get(j) + arr.get(i).get(j+1) + arr.get(i).get(j+2) + arr.get(i+1).get(j+1) + arr.get(i+2).get(j) + arr.get(i+2).get(j+1) + arr.get(i+2).get(j+2); if (sum > sumMax) { sumMax = sum; } } } return sumMax; } }
01fca2f2e8d249aee27d0024900b2e91cd238046
98e654e97b71a7d937dd512073fc1d05170a1a7d
/week_08/day_2/hibernate_annotations_intro_start/src/main/java/models/Department.java
e9c1ca1a55be0d874a201cd42a7f2862b108aad8
[]
no_license
edostler/codeclan_classwork
bfd980cc32e4ab649d392d0e9dc54189b9eded1f
6486a5b981e7d8f6d45f14462dad74298ae75758
refs/heads/master
2020-03-17T19:34:17.058501
2018-05-17T21:11:11
2018-05-17T21:11:11
133,868,880
0
0
null
null
null
null
UTF-8
Java
false
false
890
java
package models; import javax.persistence.*; @Entity @Table(name="departments") public class Department { private int id; private String title; private Manager manager; public Department() { } public Department(String title, Manager manager) { this.title = title; this.manager = manager; } @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Column(name="id") public int getId() { return id; } public void setId(int id) { this.id = id; } @Column (name="title") public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } @OneToOne(fetch = FetchType.EAGER) public Manager getManager() { return manager; } public void setManager(Manager manager) { this.manager = manager; } }
b1d5fe41edad3bd2f5bafdb344eb47ea8b852d20
40bc94e665f7043b81ba75a6b3610e4a4707ff05
/RightclickTest.java
c33b390b3a81e6cb81a9fb74f5a158117aa5ef40
[]
no_license
Anita1234s/Selenium-WebDriver
898500b5d771fc3c04d2932b2b69d47eac52d6c0
fbd048a9e5d3e4b3308f2cf0fb49606ff8d31166
refs/heads/master
2020-04-20T22:50:57.609048
2019-02-05T21:09:29
2019-02-05T21:09:29
169,152,783
0
0
null
null
null
null
UTF-8
Java
false
false
592
java
package anitaseltest; import org.openqa.selenium.WebElement; import org.openqa.selenium.chrome.ChromeDriver; import org.openqa.selenium.interactions.Actions; public class RightclickTest { public static void main(String[] args) { System.setProperty("webdriver.chrome.driver","C:\\chromedriver.exe"); ChromeDriver driver= new ChromeDriver(); driver.get("https://www.google.co.in//"); driver.manage().window().maximize(); WebElement gmail= driver.findElementByLinkText("Gmail"); Actions right = new Actions(driver); right.contextClick(gmail).build().perform(); } }
ab9370ce2e9a02dc1a82c431275e6831b345e49b
88c324f48af9cd3b004d16796113fd47cee4adc3
/NetBeans-Project-PayrollSystem/PayrollSystem/src/payroll/model/Bank.java
08a30a3a59dc1964bf837fc59970e6609d94f1ed
[]
no_license
nipunaupeksha/Payroll-System
dc859b3e9e2840771cf6f0cadca8ec569defedf1
c1bbf73309f7f6e6da48c2c3f6f11cc270a8f649
refs/heads/master
2021-04-12T09:31:50.236218
2018-03-26T12:02:00
2018-03-26T12:02:00
126,821,959
0
1
null
null
null
null
UTF-8
Java
false
false
577
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 payroll.model; public class Bank { private String bankName; public Bank() { } public Bank(String bankName) { this.bankName = bankName; } public String getBankName() { return bankName; } /** * @param bankName the bankName to set */ public void setBankName(String bankName) { this.bankName = bankName; } }
5abe72ee18279e46d66884e54a87fcd05714d6f3
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/2/2_dc422f33806c7841d586224e39c42f816de25326/GroupReferenceBox/2_dc422f33806c7841d586224e39c42f816de25326_GroupReferenceBox_s.java
0a8e72ef55e82bdae7b96fdbd6e21f7dbd0cddcd
[]
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
4,958
java
// Copyright (C) 2011 The Android Open Source Project // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. package com.google.gerrit.client.admin; import com.google.gerrit.client.ui.AccountGroupSuggestOracle; import com.google.gerrit.client.ui.RPCSuggestOracle; import com.google.gerrit.common.data.GroupReference; import com.google.gwt.editor.client.LeafValueEditor; import com.google.gwt.event.dom.client.KeyCodes; import com.google.gwt.event.dom.client.KeyPressEvent; import com.google.gwt.event.dom.client.KeyPressHandler; import com.google.gwt.event.dom.client.KeyUpEvent; import com.google.gwt.event.dom.client.KeyUpHandler; import com.google.gwt.event.logical.shared.CloseEvent; import com.google.gwt.event.logical.shared.CloseHandler; import com.google.gwt.event.logical.shared.HasCloseHandlers; import com.google.gwt.event.logical.shared.HasSelectionHandlers; import com.google.gwt.event.logical.shared.SelectionEvent; import com.google.gwt.event.logical.shared.SelectionHandler; import com.google.gwt.event.shared.HandlerRegistration; import com.google.gwt.user.client.ui.Composite; import com.google.gwt.user.client.ui.Focusable; import com.google.gwt.user.client.ui.SuggestBox; import com.google.gwt.user.client.ui.SuggestBox.DefaultSuggestionDisplay; import com.google.gwt.user.client.ui.SuggestOracle.Suggestion; import com.google.gwtexpui.globalkey.client.NpTextBox; public class GroupReferenceBox extends Composite implements LeafValueEditor<GroupReference>, HasSelectionHandlers<GroupReference>, HasCloseHandlers<GroupReferenceBox>, Focusable { private final DefaultSuggestionDisplay suggestions; private final NpTextBox textBox; private final AccountGroupSuggestOracle oracle; private final SuggestBox suggestBox; private boolean submitOnSelection; public GroupReferenceBox() { suggestions = new DefaultSuggestionDisplay(); textBox = new NpTextBox(); oracle = new AccountGroupSuggestOracle(); suggestBox = new SuggestBox( // new RPCSuggestOracle(oracle), // textBox, // suggestions); initWidget(suggestBox); suggestBox.addKeyPressHandler(new KeyPressHandler() { @Override public void onKeyPress(KeyPressEvent event) { submitOnSelection = false; if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) { if (suggestions.isSuggestionListShowing()) { submitOnSelection = true; } else { SelectionEvent.fire(GroupReferenceBox.this, getValue()); } } } }); suggestBox.addKeyUpHandler(new KeyUpHandler() { @Override public void onKeyUp(KeyUpEvent event) { if (event.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) { suggestBox.setText(""); CloseEvent.fire(GroupReferenceBox.this, GroupReferenceBox.this); } } }); suggestBox.addSelectionHandler(new SelectionHandler<Suggestion>() { @Override public void onSelection(SelectionEvent<Suggestion> event) { if (submitOnSelection) { submitOnSelection = false; SelectionEvent.fire(GroupReferenceBox.this, getValue()); } } }); } public void setVisibleLength(int len) { textBox.setVisibleLength(len); } @Override public HandlerRegistration addSelectionHandler( SelectionHandler<GroupReference> handler) { return addHandler(handler, SelectionEvent.getType()); } @Override public HandlerRegistration addCloseHandler( CloseHandler<GroupReferenceBox> handler) { return addHandler(handler, CloseEvent.getType()); } @Override public GroupReference getValue() { String name = suggestBox.getText(); if (name != null && !name.isEmpty()) { return new GroupReference(oracle.getUUID(name), name); } else { return null; } } @Override public void setValue(GroupReference value) { suggestBox.setText(value != null ? value.getName() : ""); } @Override public int getTabIndex() { return suggestBox.getTabIndex(); } @Override public void setTabIndex(int index) { suggestBox.setTabIndex(index); } public void setFocus(boolean focused) { suggestBox.setFocus(focused); } @Override public void setAccessKey(char key) { suggestBox.setAccessKey(key); } }
74f4a60b368a518a1c5c2e07f7c070f65ade3686
2d7df16cf6ae999acbd7fadd4e6047d70fa8da9d
/app/src/main/java/pneumax/websales/object/AppointmentGrid.java
b1abbbce56f30223a3eff53c12b782fa79e2df3a
[]
no_license
masterUNG/Websales_6Sep
e3abbad763da83c1ac1bdba8ce3d9abffa91f75e
5141add63993a74a1e940b97d560d0c9f4a55a18
refs/heads/master
2021-01-23T08:49:08.858391
2017-09-06T03:55:56
2017-09-06T03:55:56
102,555,197
0
0
null
null
null
null
UTF-8
Java
false
false
5,258
java
package pneumax.websales.object; import java.util.List; /** * Created by Sitrach on 05/09/2017. */ public class AppointmentGrid { /** * Number1 : 1 * AppDate : 2017-09-05 00:00:00 * AppStartTime : 13:30 * CSCode : 139961 * CSthiname : ไอซิน ทาคาโอก้า ฟาวน์ดริ บางปะกง จำกัด * CTPname : คุณปราโมทย์ * PURPName : ลูกค้าใหม่ * WTname : งานโปรเจ็ค * Remark : แนะนำตัว * AppReasonReturn : * AreaName : นิคมฯอมตะนคร 2 /พานทอง * CSIcode : ATP * CSBdes : End User * SAcode : 2873-0 * DPCode : PNE * WTcode : 0001 * PURPcode : 0001 * CreateDate : 2017-09-04 22:50:24 * AppVisit_ByPhone : V */ private List<AppointmentGridBean> appointmentgrids; public List<AppointmentGridBean> getAppointmentgrids() { return appointmentgrids; } public void setAppointmentgrids(List<AppointmentGridBean> appointmentgrids) { this.appointmentgrids = appointmentgrids; } public static class AppointmentGridBean { private int Number1; private String AppDate; private String AppStartTime; private String CSCode; private String CSthiname; private String CTPname; private String PURPName; private String WTname; private String Remark; private String AppReasonReturn; private String AreaName; private String CSIcode; private String CSBdes; private String SAcode; private String DPCode; private String WTcode; private String PURPcode; private String CreateDate; private String AppVisit_ByPhone; public int getNumber1() { return Number1; } public void setNumber1(int Number1) { this.Number1 = Number1; } public String getAppDate() { return AppDate; } public void setAppDate(String AppDate) { this.AppDate = AppDate; } public String getAppStartTime() { return AppStartTime; } public void setAppStartTime(String AppStartTime) { this.AppStartTime = AppStartTime; } public String getCSCode() { return CSCode; } public void setCSCode(String CSCode) { this.CSCode = CSCode; } public String getCSthiname() { return CSthiname; } public void setCSthiname(String CSthiname) { this.CSthiname = CSthiname; } public String getCTPname() { return CTPname; } public void setCTPname(String CTPname) { this.CTPname = CTPname; } public String getPURPName() { return PURPName; } public void setPURPName(String PURPName) { this.PURPName = PURPName; } public String getWTname() { return WTname; } public void setWTname(String WTname) { this.WTname = WTname; } public String getRemark() { return Remark; } public void setRemark(String Remark) { this.Remark = Remark; } public String getAppReasonReturn() { return AppReasonReturn; } public void setAppReasonReturn(String AppReasonReturn) { this.AppReasonReturn = AppReasonReturn; } public String getAreaName() { return AreaName; } public void setAreaName(String AreaName) { this.AreaName = AreaName; } public String getCSIcode() { return CSIcode; } public void setCSIcode(String CSIcode) { this.CSIcode = CSIcode; } public String getCSBdes() { return CSBdes; } public void setCSBdes(String CSBdes) { this.CSBdes = CSBdes; } public String getSAcode() { return SAcode; } public void setSAcode(String SAcode) { this.SAcode = SAcode; } public String getDPCode() { return DPCode; } public void setDPCode(String DPCode) { this.DPCode = DPCode; } public String getWTcode() { return WTcode; } public void setWTcode(String WTcode) { this.WTcode = WTcode; } public String getPURPcode() { return PURPcode; } public void setPURPcode(String PURPcode) { this.PURPcode = PURPcode; } public String getCreateDate() { return CreateDate; } public void setCreateDate(String CreateDate) { this.CreateDate = CreateDate; } public String getAppVisit_ByPhone() { return AppVisit_ByPhone; } public void setAppVisit_ByPhone(String AppVisit_ByPhone) { this.AppVisit_ByPhone = AppVisit_ByPhone; } } }
3d5fafdff07683e56bee2b5ea2f5d691892f7996
019b263501931c33775878fa3d4c252132204469
/library_websocketclient/src/main/java/de/tavendo/autobahn/WebSocketWriter.java
b22f338e06923255220596ae469ac051556d03e4
[]
no_license
13302864582/baifen_parent_app
0d5312fae7577d2b7e5eff09f867a3be6c7d0193
b55dbd3cc6f1dfe0ec9ceef2e0b329834eea8dba
refs/heads/master
2020-07-07T13:07:51.179123
2019-08-24T10:39:57
2019-08-24T10:39:57
203,355,952
0
0
null
null
null
null
UTF-8
Java
false
false
15,202
java
/****************************************************************************** * * Copyright 2011-2012 Tavendo GmbH * * 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.tavendo.autobahn; import java.io.IOException; import java.net.SocketException; import java.nio.channels.SocketChannel; import java.util.Random; import org.apache.http.NameValuePair; import android.os.Handler; import android.os.Looper; import android.os.Message; import android.util.Base64; import android.util.Log; /** * WebSocket writer, the sending leg of a WebSockets connection. * This is run on it's background thread with it's own message loop. * The only method that needs to be called (from foreground thread) is forward(), * which is used to forward a WebSockets message to this object (running on * background thread) so that it can be formatted and sent out on the * underlying TCP socket. */ public class WebSocketWriter extends Handler { private static final boolean DEBUG = true; private static final String TAG = WebSocketWriter.class.getName(); /// Random number generator for handshake key and frame mask generation. private final Random mRng = new Random(); /// Connection master. private final Handler mMaster; /// Message looper this object is running on. private final Looper mLooper; /// The NIO socket channel created on foreground thread. private final SocketChannel mSocket; /// WebSockets options. private final WebSocketOptions mOptions; /// The send buffer that holds data to send on socket. private final ByteBufferOutputStream mBuffer; /** * Create new WebSockets background writer. * * @param looper The message looper of the background thread on which * this object is running. * @param master The message handler of master (foreground thread). * @param socket The socket channel created on foreground thread. * @param options WebSockets connection options. */ public WebSocketWriter(Looper looper, Handler master, SocketChannel socket, WebSocketOptions options) { super(looper); mLooper = looper; mMaster = master; mSocket = socket; mOptions = options; mBuffer = new ByteBufferOutputStream(options.getMaxFramePayloadSize() + 14, 4*64*1024); if (DEBUG) Log.d(TAG, "created"); } /** * Call this from the foreground (UI) thread to make the writer * (running on background thread) send a WebSocket message on the * underlying TCP. * * @param message Message to send to WebSockets writer. An instance of the message * classes inside WebSocketMessage or another type which then needs * to be handled within processAppMessage() (in a class derived from * this class). */ public void forward(Object message) { try { Message msg = obtainMessage(); msg.obj = message; sendMessage(msg); } catch (Exception e) { e.printStackTrace(); } } /** * Notify the master (foreground thread). * * @param message Message to send to master. */ private void notify(Object message) { Message msg = mMaster.obtainMessage(); msg.obj = message; mMaster.sendMessage(msg); } /** * Create new key for WebSockets handshake. * * @return WebSockets handshake key (Base64 encoded). */ private String newHandshakeKey() { final byte[] ba = new byte[16]; mRng.nextBytes(ba); return Base64.encodeToString(ba, Base64.NO_WRAP); } /** * Create new (random) frame mask. * * @return Frame mask (4 octets). */ private byte[] newFrameMask() { final byte[] ba = new byte[4]; mRng.nextBytes(ba); return ba; } /** * Send WebSocket client handshake. */ private void sendClientHandshake(WebSocketMessage.ClientHandshake message) throws IOException { // write HTTP header with handshake String path; if (message.mQuery != null) { path = message.mPath + "?" + message.mQuery; } else { path = message.mPath; } mBuffer.write("GET " + path + " HTTP/1.1"); mBuffer.crlf(); mBuffer.write("Host: " + message.mHost); mBuffer.crlf(); mBuffer.write("Upgrade: WebSocket"); mBuffer.crlf(); mBuffer.write("Connection: Upgrade"); mBuffer.crlf(); mBuffer.write("Sec-WebSocket-Key: " + newHandshakeKey()); mBuffer.crlf(); if (message.mOrigin != null && !message.mOrigin.equals("")) { mBuffer.write("Origin: " + message.mOrigin); mBuffer.crlf(); } if (message.mSubprotocols != null && message.mSubprotocols.length > 0) { mBuffer.write("Sec-WebSocket-Protocol: "); for (int i = 0; i < message.mSubprotocols.length; ++i) { mBuffer.write(message.mSubprotocols[i]); if (i != message.mSubprotocols.length-1) { mBuffer.write(", "); } } mBuffer.crlf(); } mBuffer.write("Sec-WebSocket-Version: 13"); mBuffer.crlf(); // Header injection if (message.mHeaderList != null) { for (NameValuePair pair : message.mHeaderList) { mBuffer.write( pair.getName() + ":" + pair.getValue() ); mBuffer.crlf(); } } mBuffer.crlf(); } /** * Send WebSockets close. */ private void sendClose(WebSocketMessage.Close message) throws IOException, WebSocketException { if (message.mCode > 0) { byte[] payload = null; if (message.mReason != null && !message.mReason.equals("")) { byte[] pReason = message.mReason.getBytes("UTF-8"); payload = new byte[2 + pReason.length]; for (int i = 0; i < pReason.length; ++i) { payload[i + 2] = pReason[i]; } } else { payload = new byte[2]; } if (payload != null && payload.length > 125) { throw new WebSocketException("close payload exceeds 125 octets"); } payload[0] = (byte)((message.mCode >> 8) & 0xff); payload[1] = (byte)(message.mCode & 0xff); sendFrame(8, true, payload); } else { sendFrame(8, true, null); } } /** * Send WebSockets ping. */ private void sendPing(WebSocketMessage.Ping message) throws IOException, WebSocketException { if (message.mPayload != null && message.mPayload.length > 125) { throw new WebSocketException("ping payload exceeds 125 octets"); } sendFrame(9, true, message.mPayload); } /** * Send WebSockets pong. Normally, unsolicited Pongs are not used, * but Pongs are only send in response to a Ping from the peer. */ private void sendPong(WebSocketMessage.Pong message) throws IOException, WebSocketException { if (message.mPayload != null && message.mPayload.length > 125) { throw new WebSocketException("pong payload exceeds 125 octets"); } sendFrame(10, true, message.mPayload); } /** * Send WebSockets binary message. */ private void sendBinaryMessage(WebSocketMessage.BinaryMessage message) throws IOException, WebSocketException { if (message.mPayload.length > mOptions.getMaxMessagePayloadSize()) { throw new WebSocketException("message payload exceeds payload limit"); } sendFrame(2, true, message.mPayload); } /** * Send WebSockets text message. */ private void sendTextMessage(WebSocketMessage.TextMessage message) throws IOException, WebSocketException { byte[] payload = message.mPayload.getBytes("UTF-8"); // if (payload.length > mOptions.getMaxMessagePayloadSize()) { // throw new WebSocketException("message payload exceeds payload limit"); // } sendFrame(1, true, payload); } /** * Send WebSockets binary message. */ private void sendRawTextMessage(WebSocketMessage.RawTextMessage message) throws IOException, WebSocketException { if (message.mPayload.length > mOptions.getMaxMessagePayloadSize()) { throw new WebSocketException("message payload exceeds payload limit"); } sendFrame(1, true, message.mPayload); } /** * Sends a WebSockets frame. Only need to use this method in derived classes which implement * more message types in processAppMessage(). You need to know what you are doing! * * @param opcode The WebSocket frame opcode. * @param fin FIN flag for WebSocket frame. * @param payload Frame payload or null. */ protected void sendFrame(int opcode, boolean fin, byte[] payload) throws IOException { if (payload != null) { sendFrame(opcode, fin, payload, 0, payload.length); } else { sendFrame(opcode, fin, null, 0, 0); } } /** * Sends a WebSockets frame. Only need to use this method in derived classes which implement * more message types in processAppMessage(). You need to know what you are doing! * * @param opcode The WebSocket frame opcode. * @param fin FIN flag for WebSocket frame. * @param payload Frame payload or null. * @param offset Offset within payload of the chunk to send. * @param length Length of the chunk within payload to send. */ protected void sendFrame(int opcode, boolean fin, byte[] payload, int offset, int length) throws IOException { // first octet byte b0 = 0; if (fin) { b0 |= (byte) (1 << 7); } b0 |= (byte) opcode; mBuffer.write(b0); // second octet byte b1 = 0; if (mOptions.getMaskClientFrames()) { b1 = (byte) (1 << 7); } long len = length; // extended payload length if (len <= 125) { b1 |= (byte) len; mBuffer.write(b1); } else if (len <= 0xffff) { b1 |= (byte) (126 & 0xff); mBuffer.write(b1); mBuffer.write(new byte[] {(byte)((len >> 8) & 0xff), (byte)(len & 0xff)}); } else { b1 |= (byte) (127 & 0xff); mBuffer.write(b1); mBuffer.write(new byte[] {(byte)((len >> 56) & 0xff), (byte)((len >> 48) & 0xff), (byte)((len >> 40) & 0xff), (byte)((len >> 32) & 0xff), (byte)((len >> 24) & 0xff), (byte)((len >> 16) & 0xff), (byte)((len >> 8) & 0xff), (byte)(len & 0xff)}); } byte mask[] = null; if (mOptions.getMaskClientFrames()) { // a mask is always needed, even without payload mask = newFrameMask(); mBuffer.write(mask[0]); mBuffer.write(mask[1]); mBuffer.write(mask[2]); mBuffer.write(mask[3]); } if (len > 0) { if (mOptions.getMaskClientFrames()) { /// \todo optimize masking /// \todo masking within buffer of output stream for (int i = 0; i < len; ++i) { payload[i + offset] ^= mask[i % 4]; } } mBuffer.write(payload, offset, length); } } /** * Process message received from foreground thread. This is called from * the message looper set up for the background thread running this writer. * * @param msg Message from thread message queue. */ @Override public void handleMessage(Message msg) { try { // clear send buffer mBuffer.clear(); // process message from master processMessage(msg.obj); // send out buffered data mBuffer.flip(); while (mBuffer.remaining() > 0) { // this can block on socket write @SuppressWarnings("unused") int written = mSocket.write(mBuffer.getBuffer()); } } catch (SocketException e) { if (DEBUG) Log.d(TAG, "run() : SocketException (" + e.toString() + ")"); // wrap the exception and notify master notify(new WebSocketMessage.ConnectionLost()); } catch (Exception e) { if (DEBUG) e.printStackTrace(); // wrap the exception and notify master notify(new WebSocketMessage.Error(e)); } } /** * Process WebSockets or control message from master. Normally, * there should be no reason to override this. If you do, you * need to know what you are doing. * * @param msg An instance of the message types within WebSocketMessage * or a message that is handled in processAppMessage(). */ protected void processMessage(Object msg) throws IOException, WebSocketException { if (msg instanceof WebSocketMessage.TextMessage) { sendTextMessage((WebSocketMessage.TextMessage) msg); } else if (msg instanceof WebSocketMessage.RawTextMessage) { sendRawTextMessage((WebSocketMessage.RawTextMessage) msg); } else if (msg instanceof WebSocketMessage.BinaryMessage) { sendBinaryMessage((WebSocketMessage.BinaryMessage) msg); } else if (msg instanceof WebSocketMessage.Ping) { sendPing((WebSocketMessage.Ping) msg); } else if (msg instanceof WebSocketMessage.Pong) { sendPong((WebSocketMessage.Pong) msg); } else if (msg instanceof WebSocketMessage.Close) { sendClose((WebSocketMessage.Close) msg); } else if (msg instanceof WebSocketMessage.ClientHandshake) { sendClientHandshake((WebSocketMessage.ClientHandshake) msg); } else if (msg instanceof WebSocketMessage.Quit) { mLooper.quit(); if (DEBUG) Log.d(TAG, "ended"); return; } else { // call hook which may be overridden in derived class to process // messages we don't understand in this class processAppMessage(msg); } } /** * Process message other than plain WebSockets or control message. * This is intended to be overridden in derived classes. * * @param msg Message from foreground thread to process. */ protected void processAppMessage(Object msg) throws WebSocketException, IOException { throw new WebSocketException("unknown message received by WebSocketWriter"); } }
64ff7aa0e41157a8e1f479673000f1c153a7b4f5
634c2636807609ab0a1fbee8ea97337e90de8c79
/src/main/java/edu/pps/integradorrs/repositorys/PuertaRepository.java
c8efc060346762edea54f299df7b119b4900a43b
[ "Apache-2.0" ]
permissive
mariano-dim/pps
2a6fdf41723e88e61b4dda59621f4c9e8b0b27ab
61a612638204cce8cbd1acea77b9f792a4e386d0
refs/heads/master
2023-07-22T16:48:33.240494
2017-12-05T16:03:01
2017-12-05T16:03:01
110,394,794
1
0
Apache-2.0
2023-07-16T09:23:32
2017-11-12T01:30:11
Java
UTF-8
Java
false
false
664
java
package edu.pps.integradorrs.repositorys; import edu.pps.integradorrs.model.Puerta; import org.springframework.data.mongodb.repository.MongoRepository; import org.springframework.data.mongodb.repository.Query; import org.springframework.data.rest.core.annotation.RepositoryRestResource; @RepositoryRestResource(collectionResourceRel = "puertas", path = "puertas") public interface PuertaRepository extends MongoRepository<Puerta, String>, PuertaRepositoryCustom { /** * * @param publicIdentification * @return */ @Query("{ 'publicIdentification' : ?0}") public Puerta findByPublicIdentification(String publicIdentification); }
f61b3572888989f95d0f38ee997c102050693adb
456a5015f18ce390cd76fddfa510bf81f0ee09e8
/app/src/main/java/com/sum/alchemist/ui/activity/UserInfoActivity.java
0ec73bd26d99e5b4c2e0cbad777259fa7cd06ca2
[ "Apache-2.0" ]
permissive
zhuyazun/jsdj
a8fc048b23f7dfe1ff8fa57a493c9efceca34cf9
ab639321352a166003e0010ec8de633c04ef0cb4
refs/heads/master
2021-01-22T03:48:52.702642
2017-05-25T13:10:57
2017-05-25T13:10:57
92,402,779
0
0
null
null
null
null
UTF-8
Java
false
false
5,752
java
package com.sum.alchemist.ui.activity; import android.content.Intent; import android.os.Bundle; import android.support.v7.widget.Toolbar; import android.text.TextUtils; import android.view.View; import android.widget.TextView; import com.bumptech.glide.Glide; import com.google.gson.JsonObject; import com.sum.alchemist.R; import com.sum.alchemist.model.api.RetrofitHelper; import com.sum.alchemist.model.entity.User; import com.sum.alchemist.model.impl.UserImpl; import com.sum.alchemist.utils.EventParams; import com.sum.alchemist.widget.CircleImageView; import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.Subscribe; import org.greenrobot.eventbus.ThreadMode; import rx.Observer; import rx.android.schedulers.AndroidSchedulers; import rx.functions.Action0; import rx.schedulers.Schedulers; /** * Created by Qiu on 2016/11/4. */ public class UserInfoActivity extends BaseActivity { private CircleImageView userAvatar; private TextView userPhoneTv; /** * 修改密码 */ private View change_password; private static final String TAG = "UserInfoActivity"; @Override protected int getContentView() { return R.layout.activity_user_info; } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); EventBus.getDefault().register(this); } @Override protected void initViewAndListener() { super.initViewAndListener(); userAvatar = (CircleImageView) findViewById(R.id.user_avatar); change_password = findViewById(R.id.user_change_password_layout); userPhoneTv = findView(R.id.user_phone); // findViewById(R.id.user_logout_tv).setOnClickListener(listener); findViewById(R.id.user_pro_info_layout).setOnClickListener(listener); change_password.setOnClickListener(listener); userAvatar.setOnClickListener(listener); loadUserInfo(null); } @Subscribe(threadMode = ThreadMode.MAIN) public void loadUserInfo(EventParams eventParams){ if(eventParams != null && eventParams.getCode() != EventParams.USER_INFO_CHANGE) return; User user = UserImpl.getInstance().getUserDao().queryLoginUser(); if(user != null && user.isPhoneUser()){ change_password.setVisibility(View.VISIBLE); userPhoneTv.setText(user.username); }else{ change_password.setVisibility(View.GONE); userPhoneTv.setText(null); } if(user != null && !TextUtils.isEmpty(user.avatar)) Glide.with(UserInfoActivity.this).load(user.avatar).into(userAvatar); else userAvatar.setImageResource(R.mipmap.user_ico); } View.OnClickListener listener = new View.OnClickListener(){ @Override public void onClick(View v) { switch (v.getId()){ case R.id.user_pro_info_layout: startActivity(new Intent(UserInfoActivity.this, UserProInfoActivity.class)); break; case R.id.user_change_password_layout: startActivity(new Intent(UserInfoActivity.this, ChangePasswordActivity.class)); break; case R.id.user_avatar: Intent intent = new Intent(UserInfoActivity.this, UImageActivity.class); startActivityForResult(intent, UImageActivity.UPLOAD_IMAGE); break; } } }; @Override protected void initTitle() { super.initTitle(); Toolbar toolbar = findView(R.id.toolbar); TextView titleTv = findView(R.id.toolbar_title_tv); titleTv.setText("用户中心"); toolbar.setTitle(""); setSupportActionBar(toolbar); toolbar.setNavigationIcon(R.mipmap.ic_back_white); toolbar.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); } private void logout(){ addSubscrebe(UserImpl.getInstance().doLogout() .subscribeOn(Schedulers.io()) .doOnSubscribe(new Action0() { @Override public void call() { showProgressDialog(getString(R.string.loading), true); } }) .subscribeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Observer<JsonObject>() { @Override public void onCompleted() { } @Override public void onError(Throwable e) { hideProgressDialog(); showToastMsg(RetrofitHelper.getHttpErrorMessage(e)); } @Override public void onNext(JsonObject jsonObject) { hideProgressDialog(); EventBus.getDefault().post(new EventParams(EventParams.USER_LOGIN_CHANGE)); finish(); } })); } @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); if(requestCode == UImageActivity.UPLOAD_IMAGE && resultCode == RESULT_OK && data != null){ // String url = data.getStringExtra(UImageActivity.IMAGE_URL_KEY); EventBus.getDefault().post(new EventParams(EventParams.USER_INFO_CHANGE)); } } @Override protected void onDestroy() { super.onDestroy(); EventBus.getDefault().unregister(this); } }
e04fa15869c7690a618fbfae6b8e71f206afda51
c2a6572587c0bfd9682f3d5b33f7223e8a50d2d9
/ea2ddl-dao/src/main/java/jp/sourceforge/ea2ddl/dao/exentity/TObjecttests.java
eab02da59f55aacbdeddebd1dbf08fc60f86e119
[ "Apache-2.0" ]
permissive
taktos/ea2ddl
96d6590311196d35c2d1ca1098c4aca3d2a87a39
282aa6c851be220441ee50df5c18ff575dfbe9ac
refs/heads/master
2021-01-19T01:52:01.456128
2016-07-13T06:57:34
2016-07-13T06:57:34
3,493,161
0
0
null
null
null
null
UTF-8
Java
false
false
423
java
package jp.sourceforge.ea2ddl.dao.exentity; /** * The entity of t_objecttests. * <p> * You can implement your original methods here. * This class remains when re-generating. * </p> * @author DBFlute(AutoGenerator) */ public class TObjecttests extends jp.sourceforge.ea2ddl.dao.bsentity.BsTObjecttests { /** Serial version UID. (Default) */ private static final long serialVersionUID = 1L; }
[ "taktos9@136db618-7844-41ca-8ac1-fb3fd040db1d" ]
taktos9@136db618-7844-41ca-8ac1-fb3fd040db1d
52d8cb3ea63b8db34ccb357b4ed793dadfe4cdb3
c885ef92397be9d54b87741f01557f61d3f794f3
/tests-without-trycatch/Csv-16/org.apache.commons.csv.CSVParser/BBC-F0-opt-70/18/org/apache/commons/csv/CSVParser_ESTest.java
68b255e080207fe8f05f036e356fb5fe81b0d917
[ "CC-BY-4.0", "MIT" ]
permissive
pderakhshanfar/EMSE-BBC-experiment
f60ac5f7664dd9a85f755a00a57ec12c7551e8c6
fea1a92c2e7ba7080b8529e2052259c9b697bbda
refs/heads/main
2022-11-25T00:39:58.983828
2022-04-12T16:04:26
2022-04-12T16:04:26
309,335,889
0
1
null
2021-11-05T11:18:43
2020-11-02T10:30:38
null
UTF-8
Java
false
false
29,115
java
/* * This file was automatically generated by EvoSuite * Wed Oct 20 17:52:01 GMT 2021 */ package org.apache.commons.csv; import org.junit.Test; import static org.junit.Assert.*; import static org.evosuite.shaded.org.mockito.Mockito.*; import static org.evosuite.runtime.EvoAssertions.*; import java.io.ByteArrayInputStream; import java.io.DataInputStream; import java.io.File; import java.io.FileDescriptor; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.PipedReader; import java.io.Reader; import java.io.StringReader; import java.net.URL; import java.net.URLStreamHandler; import java.nio.charset.Charset; import java.nio.file.NoSuchFileException; import java.nio.file.Path; import java.sql.ResultSet; import java.sql.ResultSetMetaData; import java.util.Locale; import java.util.Map; import java.util.function.Consumer; import javax.sql.rowset.RowSetMetaDataImpl; import org.apache.commons.csv.CSVFormat; import org.apache.commons.csv.CSVParser; import org.evosuite.runtime.EvoRunner; import org.evosuite.runtime.EvoRunnerParameters; import org.evosuite.runtime.ViolatedAssumptionAnswer; import org.evosuite.runtime.mock.java.io.MockFile; import org.evosuite.runtime.mock.java.io.MockFileInputStream; import org.evosuite.runtime.mock.java.net.MockURL; import org.junit.runner.RunWith; @RunWith(EvoRunner.class) @EvoRunnerParameters(mockJVMNonDeterminism = true, useVFS = true, useVNET = true, resetStaticState = true, separateClassLoader = true) public class CSVParser_ESTest extends CSVParser_ESTest_scaffolding { @Test(timeout = 4000) public void test00() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.ORACLE; CSVParser cSVParser0 = CSVParser.parse("No header mapping was specified, the record values can't be accessed by name", cSVFormat0); cSVParser0.getRecords(); assertEquals(1L, cSVParser0.getRecordNumber()); } @Test(timeout = 4000) public void test01() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.EXCEL; PipedReader pipedReader0 = new PipedReader(); CSVParser cSVParser0 = new CSVParser(pipedReader0, cSVFormat0); assertEquals(0L, cSVParser0.getRecordNumber()); } @Test(timeout = 4000) public void test02() throws Throwable { PipedReader pipedReader0 = new PipedReader(); CSVFormat cSVFormat0 = CSVFormat.INFORMIX_UNLOAD_CSV; CSVParser cSVParser0 = CSVParser.parse((Reader) pipedReader0, cSVFormat0); Consumer<Object> consumer0 = (Consumer<Object>) mock(Consumer.class, new ViolatedAssumptionAnswer()); // Undeclared exception! // try { cSVParser0.forEach(consumer0); // fail("Expecting exception: IllegalStateException"); // } catch(IllegalStateException e) { // // // // IOException reading next record: java.io.IOException: Pipe not connected // // // verifyException("org.apache.commons.csv.CSVParser$1", e); // } } @Test(timeout = 4000) public void test03() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.POSTGRESQL_CSV; MockFile mockFile0 = new MockFile(""); Path path0 = mockFile0.toPath(); Charset charset0 = Charset.defaultCharset(); CSVParser cSVParser0 = CSVParser.parse(path0, charset0, cSVFormat0); assertEquals(0L, cSVParser0.getRecordNumber()); } @Test(timeout = 4000) public void test04() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.DEFAULT; MockFile mockFile0 = new MockFile("org.apache.commons.csv.CSVParser$1", "X/=$aD06\"rpia%"); File file0 = MockFile.createTempFile("org.apache.commons.csv.CSVParser$1", "ZWV,Kv)k1)-Cj", (File) mockFile0); Charset charset0 = Charset.defaultCharset(); CSVParser cSVParser0 = CSVParser.parse(file0, charset0, cSVFormat0); assertEquals(0L, cSVParser0.getRecordNumber()); } @Test(timeout = 4000) public void test05() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.DEFAULT; String[] stringArray0 = new String[1]; CSVFormat cSVFormat1 = cSVFormat0.withHeader(stringArray0); CSVParser cSVParser0 = CSVParser.parse("org.apache.commons.csv.CSVFormat@0000000002,java.lang.Object@0000000003,org.apache.commons.csv.CSVFormat@0000000002", cSVFormat1); cSVParser0.nextRecord(); assertEquals(1L, cSVParser0.getRecordNumber()); } @Test(timeout = 4000) public void test06() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.DEFAULT; StringReader stringReader0 = new StringReader("(startline "); CSVParser cSVParser0 = new CSVParser(stringReader0, cSVFormat0, 2496L, (-3932L)); cSVParser0.nextRecord(); assertEquals((-3932L), cSVParser0.getRecordNumber()); } @Test(timeout = 4000) public void test07() throws Throwable { StringReader stringReader0 = new StringReader(", values="); CSVFormat cSVFormat0 = CSVFormat.DEFAULT; CSVParser cSVParser0 = CSVParser.parse((Reader) stringReader0, cSVFormat0); cSVParser0.close(); boolean boolean0 = cSVParser0.isClosed(); assertEquals(0L, cSVParser0.getRecordNumber()); assertTrue(boolean0); } @Test(timeout = 4000) public void test08() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.POSTGRESQL_CSV; CSVFormat cSVFormat1 = cSVFormat0.withTrailingDelimiter(); CSVParser cSVParser0 = CSVParser.parse("\r", cSVFormat1); cSVParser0.getRecords(); assertEquals(0L, cSVParser0.getRecordNumber()); } @Test(timeout = 4000) public void test09() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.RFC4180; CSVParser cSVParser0 = CSVParser.parse("format", cSVFormat0); cSVParser0.nextRecord(); long long0 = cSVParser0.getRecordNumber(); assertEquals(1L, long0); } @Test(timeout = 4000) public void test10() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.INFORMIX_UNLOAD_CSV; PipedReader pipedReader0 = new PipedReader(); CSVParser cSVParser0 = new CSVParser(pipedReader0, cSVFormat0, (byte)61, 0L); long long0 = cSVParser0.getRecordNumber(); assertEquals((-1L), long0); } @Test(timeout = 4000) public void test11() throws Throwable { StringReader stringReader0 = new StringReader("4Qq7q"); CSVFormat cSVFormat0 = CSVFormat.RFC4180; RowSetMetaDataImpl rowSetMetaDataImpl0 = new RowSetMetaDataImpl(); ResultSet resultSet0 = mock(ResultSet.class, new ViolatedAssumptionAnswer()); doReturn(rowSetMetaDataImpl0).when(resultSet0).getMetaData(); CSVFormat cSVFormat1 = cSVFormat0.withHeader(resultSet0); cSVFormat1.parse(stringReader0); CSVParser cSVParser0 = CSVParser.parse((Reader) stringReader0, cSVFormat1); Map<String, Integer> map0 = cSVParser0.getHeaderMap(); assertEquals(0, map0.size()); assertEquals(0L, cSVParser0.getRecordNumber()); } @Test(timeout = 4000) public void test12() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.ORACLE; CSVFormat cSVFormat1 = cSVFormat0.withFirstRecordAsHeader(); CSVParser cSVParser0 = CSVParser.parse("N\r", cSVFormat1); cSVParser0.getFirstEndOfLine(); assertEquals(0L, cSVParser0.getRecordNumber()); } @Test(timeout = 4000) public void test13() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.INFORMIX_UNLOAD_CSV; MockFile mockFile0 = new MockFile("&g34 CG6+^#J", "RecordSeparator=<"); Path path0 = mockFile0.toPath(); // Undeclared exception! // try { CSVParser.parse(path0, (Charset) null, cSVFormat0); // fail("Expecting exception: NullPointerException"); // } catch(NullPointerException e) { // // // // no message in exception (getMessage() returned null) // // // verifyException("java.nio.file.Files", e); // } } @Test(timeout = 4000) public void test14() throws Throwable { MockFile mockFile0 = new MockFile("N"); Path path0 = mockFile0.toPath(); // Undeclared exception! // try { CSVParser.parse(path0, (Charset) null, (CSVFormat) null); // fail("Expecting exception: IllegalArgumentException"); // } catch(IllegalArgumentException e) { // // // // Parameter 'format' must not be null! // // // verifyException("org.apache.commons.csv.Assertions", e); // } } @Test(timeout = 4000) public void test15() throws Throwable { Charset charset0 = Charset.defaultCharset(); CSVFormat cSVFormat0 = CSVFormat.newFormat('X'); URLStreamHandler uRLStreamHandler0 = mock(URLStreamHandler.class, new ViolatedAssumptionAnswer()); URL uRL0 = MockURL.URL("?`oc\" wH10GoEY{>n", "", 975, "gYX<| FHCySIM)k", uRLStreamHandler0); // Undeclared exception! // try { CSVParser.parse(uRL0, charset0, cSVFormat0); // fail("Expecting exception: NullPointerException"); // } catch(NullPointerException e) { // // // // no message in exception (getMessage() returned null) // // // verifyException("java.net.URL", e); // } } @Test(timeout = 4000) public void test16() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.EXCEL; URL uRL0 = MockURL.getHttpExample(); Charset charset0 = Charset.defaultCharset(); // try { CSVParser.parse(uRL0, charset0, cSVFormat0); // fail("Expecting exception: IOException"); // } catch(IOException e) { // // // // Could not find: www.someFakeButWellFormedURL.org // // // verifyException("org.evosuite.runtime.mock.java.net.EvoHttpURLConnection", e); // } } @Test(timeout = 4000) public void test17() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.RFC4180; CSVFormat cSVFormat1 = cSVFormat0.withFirstRecordAsHeader(); // try { CSVParser.parse("\"loEw2oJ74)o`", cSVFormat1); // fail("Expecting exception: IOException"); // } catch(IOException e) { // // // // (startline 1) EOF reached before encapsulated token finished // // // verifyException("org.apache.commons.csv.Lexer", e); // } } @Test(timeout = 4000) public void test18() throws Throwable { PipedReader pipedReader0 = new PipedReader(); // Undeclared exception! // try { CSVParser.parse((Reader) pipedReader0, (CSVFormat) null); // fail("Expecting exception: IllegalArgumentException"); // } catch(IllegalArgumentException e) { // // // // Parameter 'format' must not be null! // // // verifyException("org.apache.commons.csv.Assertions", e); // } } @Test(timeout = 4000) public void test19() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.EXCEL; RowSetMetaDataImpl rowSetMetaDataImpl0 = new RowSetMetaDataImpl(); CSVFormat cSVFormat1 = cSVFormat0.withHeader((ResultSetMetaData) rowSetMetaDataImpl0); PipedReader pipedReader0 = new PipedReader(); // try { CSVParser.parse((Reader) pipedReader0, cSVFormat1); // fail("Expecting exception: IOException"); // } catch(IOException e) { // // // // Pipe not connected // // // verifyException("java.io.PipedReader", e); // } } @Test(timeout = 4000) public void test20() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.EXCEL; byte[] byteArray0 = new byte[5]; ByteArrayInputStream byteArrayInputStream0 = new ByteArrayInputStream(byteArray0); // Undeclared exception! // try { CSVParser.parse((InputStream) byteArrayInputStream0, (Charset) null, cSVFormat0); // fail("Expecting exception: NullPointerException"); // } catch(NullPointerException e) { // // // // charset // // // verifyException("java.io.InputStreamReader", e); // } } @Test(timeout = 4000) public void test21() throws Throwable { Charset charset0 = Charset.defaultCharset(); CSVFormat cSVFormat0 = CSVFormat.DEFAULT; // Undeclared exception! // try { CSVParser.parse((InputStream) null, charset0, cSVFormat0); // fail("Expecting exception: IllegalArgumentException"); // } catch(IllegalArgumentException e) { // // // // Parameter 'inputStream' must not be null! // // // verifyException("org.apache.commons.csv.Assertions", e); // } } @Test(timeout = 4000) public void test22() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.INFORMIX_UNLOAD_CSV; RowSetMetaDataImpl rowSetMetaDataImpl0 = new RowSetMetaDataImpl(); CSVFormat cSVFormat1 = cSVFormat0.withHeader((ResultSetMetaData) rowSetMetaDataImpl0); Charset charset0 = Charset.defaultCharset(); FileDescriptor fileDescriptor0 = new FileDescriptor(); MockFileInputStream mockFileInputStream0 = new MockFileInputStream(fileDescriptor0); // try { CSVParser.parse((InputStream) mockFileInputStream0, charset0, cSVFormat1); // fail("Expecting exception: IOException"); // } catch(IOException e) { // // // // no message in exception (getMessage() returned null) // // // verifyException("org.evosuite.runtime.mock.java.io.NativeMockedIO", e); // } } @Test(timeout = 4000) public void test23() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.INFORMIX_UNLOAD_CSV; MockFile mockFile0 = new MockFile("9e9aoI[y60V_%$e", "Srg$=%lw[h!aWS"); File file0 = MockFile.createTempFile("dly~2/(lU' :", "\u0000\u0000\u0000", (File) mockFile0); // Undeclared exception! // try { CSVParser.parse(file0, (Charset) null, cSVFormat0); // fail("Expecting exception: NullPointerException"); // } catch(NullPointerException e) { // // // // charset // // // verifyException("java.io.InputStreamReader", e); // } } @Test(timeout = 4000) public void test24() throws Throwable { MockFile mockFile0 = new MockFile("FORMAT", "FORMAT"); CSVFormat cSVFormat0 = CSVFormat.EXCEL; // try { CSVParser.parse((File) mockFile0, (Charset) null, cSVFormat0); // fail("Expecting exception: FileNotFoundException"); // } catch(FileNotFoundException e) { // // // // no message in exception (getMessage() returned null) // // // verifyException("org.evosuite.runtime.mock.java.io.MockFileInputStream", e); // } } @Test(timeout = 4000) public void test25() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.INFORMIX_UNLOAD_CSV; PipedReader pipedReader0 = new PipedReader(); CSVParser cSVParser0 = CSVParser.parse((Reader) pipedReader0, cSVFormat0); // try { cSVParser0.nextRecord(); // fail("Expecting exception: IOException"); // } catch(IOException e) { // // // // Pipe not connected // // // verifyException("java.io.PipedReader", e); // } } @Test(timeout = 4000) public void test26() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.POSTGRESQL_CSV; PipedReader pipedReader0 = new PipedReader(); CSVParser cSVParser0 = cSVFormat0.parse(pipedReader0); // try { cSVParser0.getRecords(); // fail("Expecting exception: IOException"); // } catch(IOException e) { // // // // Pipe not connected // // // verifyException("java.io.PipedReader", e); // } } @Test(timeout = 4000) public void test27() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.MYSQL; DataInputStream dataInputStream0 = new DataInputStream((InputStream) null); Charset charset0 = Charset.defaultCharset(); CSVParser cSVParser0 = CSVParser.parse((InputStream) dataInputStream0, charset0, cSVFormat0); // Undeclared exception! // try { cSVParser0.close(); // fail("Expecting exception: NullPointerException"); // } catch(NullPointerException e) { // // // // no message in exception (getMessage() returned null) // // // verifyException("java.io.FilterInputStream", e); // } } @Test(timeout = 4000) public void test28() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.INFORMIX_UNLOAD_CSV; CSVParser cSVParser0 = null; // try { cSVParser0 = new CSVParser((Reader) null, cSVFormat0, (-1950L), 314L); // fail("Expecting exception: IllegalArgumentException"); // } catch(IllegalArgumentException e) { // // // // Parameter 'reader' must not be null! // // // verifyException("org.apache.commons.csv.Assertions", e); // } } @Test(timeout = 4000) public void test29() throws Throwable { PipedReader pipedReader0 = new PipedReader(); CSVFormat cSVFormat0 = CSVFormat.RFC4180; CSVFormat cSVFormat1 = cSVFormat0.withFirstRecordAsHeader(); CSVParser cSVParser0 = null; // try { cSVParser0 = new CSVParser(pipedReader0, cSVFormat1, 161L, 161L); // fail("Expecting exception: IOException"); // } catch(Throwable e) { // // // // Pipe not connected // // // verifyException("java.io.PipedReader", e); // } } @Test(timeout = 4000) public void test30() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.newFormat('w'); CSVParser cSVParser0 = null; // try { cSVParser0 = new CSVParser((Reader) null, cSVFormat0); // fail("Expecting exception: IllegalArgumentException"); // } catch(IllegalArgumentException e) { // // // // Parameter 'reader' must not be null! // // // verifyException("org.apache.commons.csv.Assertions", e); // } } @Test(timeout = 4000) public void test31() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.INFORMIX_UNLOAD_CSV; PipedReader pipedReader0 = new PipedReader(); CSVFormat cSVFormat1 = cSVFormat0.withFirstRecordAsHeader(); CSVParser cSVParser0 = null; // try { cSVParser0 = new CSVParser(pipedReader0, cSVFormat1); // fail("Expecting exception: IOException"); // } catch(Throwable e) { // // // // Pipe not connected // // // verifyException("java.io.PipedReader", e); // } } @Test(timeout = 4000) public void test32() throws Throwable { StringReader stringReader0 = new StringReader(", values="); CSVFormat cSVFormat0 = CSVFormat.DEFAULT; CSVParser cSVParser0 = CSVParser.parse((Reader) stringReader0, cSVFormat0); cSVParser0.isClosed(); assertEquals(0L, cSVParser0.getRecordNumber()); } @Test(timeout = 4000) public void test33() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.ORACLE; CSVParser cSVParser0 = CSVParser.parse("Wj,IP7N", cSVFormat0); Consumer<Object> consumer0 = (Consumer<Object>) mock(Consumer.class, new ViolatedAssumptionAnswer()); cSVParser0.close(); cSVParser0.forEach(consumer0); assertEquals(0L, cSVParser0.getRecordNumber()); } @Test(timeout = 4000) public void test34() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.DEFAULT; CSVFormat cSVFormat1 = cSVFormat0.withFirstRecordAsHeader(); CSVFormat cSVFormat2 = cSVFormat1.withAllowMissingColumnNames(true); CSVParser cSVParser0 = CSVParser.parse(",", cSVFormat2); assertEquals(0L, cSVParser0.getRecordNumber()); } @Test(timeout = 4000) public void test35() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.DEFAULT; CSVFormat cSVFormat1 = cSVFormat0.withFirstRecordAsHeader(); // Undeclared exception! // try { CSVParser.parse("org.apache.commons.csv.CSVFormat@0000000002,java.lang.Object@0000000003,org.apache.commons.csv.CSVFormat@0000000002", cSVFormat1); // fail("Expecting exception: IllegalArgumentException"); // } catch(IllegalArgumentException e) { // // // // The header contains a duplicate name: \"org.apache.commons.csv.CSVFormat@0000000002\" in [org.apache.commons.csv.CSVFormat@0000000002, java.lang.Object@0000000003, org.apache.commons.csv.CSVFormat@0000000002] // // // verifyException("org.apache.commons.csv.CSVParser", e); // } } @Test(timeout = 4000) public void test36() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.EXCEL; CSVFormat cSVFormat1 = cSVFormat0.withFirstRecordAsHeader(); Class<Locale.Category> class0 = Locale.Category.class; CSVFormat cSVFormat2 = cSVFormat1.withHeader(class0); CSVParser cSVParser0 = CSVParser.parse("W", cSVFormat2); assertEquals(0L, cSVParser0.getRecordNumber()); } @Test(timeout = 4000) public void test37() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.EXCEL; RowSetMetaDataImpl rowSetMetaDataImpl0 = new RowSetMetaDataImpl(); CSVFormat cSVFormat1 = cSVFormat0.withHeader((ResultSetMetaData) rowSetMetaDataImpl0); byte[] byteArray0 = new byte[3]; ByteArrayInputStream byteArrayInputStream0 = new ByteArrayInputStream(byteArray0); Charset charset0 = Charset.defaultCharset(); CSVParser.parse((InputStream) byteArrayInputStream0, charset0, cSVFormat1); CSVParser cSVParser0 = CSVParser.parse((InputStream) byteArrayInputStream0, charset0, cSVFormat1); assertEquals(0, byteArrayInputStream0.available()); assertEquals(0L, cSVParser0.getRecordNumber()); } @Test(timeout = 4000) public void test38() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.MYSQL; String[] stringArray0 = new String[2]; stringArray0[0] = "\uFFFD\uFFFD"; CSVFormat cSVFormat1 = cSVFormat0.withHeader(stringArray0); CSVFormat cSVFormat2 = cSVFormat1.withIgnoreHeaderCase(); // Undeclared exception! // try { CSVParser.parse("No quotes mode set but no escape character is set", cSVFormat2); // fail("Expecting exception: NullPointerException"); // } catch(NullPointerException e) { // } } @Test(timeout = 4000) public void test39() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.EXCEL; StringReader stringReader0 = new StringReader("N"); CSVParser cSVParser0 = cSVFormat0.parse(stringReader0); cSVParser0.getHeaderMap(); assertEquals(0L, cSVParser0.getRecordNumber()); } @Test(timeout = 4000) public void test40() throws Throwable { StringReader stringReader0 = new StringReader("4Qq7"); CSVFormat cSVFormat0 = CSVFormat.RFC4180; RowSetMetaDataImpl rowSetMetaDataImpl0 = new RowSetMetaDataImpl(); ResultSet resultSet0 = mock(ResultSet.class, new ViolatedAssumptionAnswer()); doReturn(rowSetMetaDataImpl0).when(resultSet0).getMetaData(); CSVFormat cSVFormat1 = cSVFormat0.withHeader(resultSet0); CSVParser cSVParser0 = CSVParser.parse((Reader) stringReader0, cSVFormat1); Map<String, Integer> map0 = cSVParser0.getHeaderMap(); assertEquals(0L, cSVParser0.getRecordNumber()); assertNotNull(map0); assertFalse(map0.isEmpty()); } @Test(timeout = 4000) public void test41() throws Throwable { StringReader stringReader0 = new StringReader("4Qq7q"); CSVFormat cSVFormat0 = CSVFormat.RFC4180; RowSetMetaDataImpl rowSetMetaDataImpl0 = new RowSetMetaDataImpl(); ResultSet resultSet0 = mock(ResultSet.class, new ViolatedAssumptionAnswer()); doReturn(rowSetMetaDataImpl0).when(resultSet0).getMetaData(); CSVFormat cSVFormat1 = cSVFormat0.withHeader(resultSet0); CSVFormat cSVFormat2 = cSVFormat1.withNullString("4Qq7q"); CSVParser cSVParser0 = cSVFormat2.parse(stringReader0); assertEquals(0L, cSVParser0.getRecordNumber()); } @Test(timeout = 4000) public void test42() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.POSTGRESQL_CSV; CSVFormat cSVFormat1 = cSVFormat0.withTrailingDelimiter(); CSVParser cSVParser0 = CSVParser.parse("\r", cSVFormat1); cSVParser0.nextRecord(); assertEquals(0L, cSVParser0.getRecordNumber()); } @Test(timeout = 4000) public void test43() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.DEFAULT; CSVFormat cSVFormat1 = cSVFormat0.withFirstRecordAsHeader(); // Undeclared exception! // try { CSVParser.parse("org.apache.commons.csv.CSVFormat@0000000002,,,,org.apache.commons.csv.CSVFormat@0000000002,,,java.lang.Object@0000000003,,", cSVFormat1); // fail("Expecting exception: IllegalArgumentException"); // } catch(IllegalArgumentException e) { // // // // The header contains a duplicate name: \"\" in [org.apache.commons.csv.CSVFormat@0000000002, , , , org.apache.commons.csv.CSVFormat@0000000002, , , java.lang.Object@0000000003, , ] // // // verifyException("org.apache.commons.csv.CSVParser", e); // } } @Test(timeout = 4000) public void test44() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.ORACLE; CSVFormat cSVFormat1 = cSVFormat0.withFirstRecordAsHeader(); CSVParser cSVParser0 = CSVParser.parse("N\r", cSVFormat1); cSVParser0.getCurrentLineNumber(); assertEquals(0L, cSVParser0.getRecordNumber()); } @Test(timeout = 4000) public void test45() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.EXCEL; byte[] byteArray0 = new byte[3]; ByteArrayInputStream byteArrayInputStream0 = new ByteArrayInputStream(byteArray0); Charset charset0 = Charset.defaultCharset(); CSVParser cSVParser0 = CSVParser.parse((InputStream) byteArrayInputStream0, charset0, cSVFormat0); long long0 = cSVParser0.getRecordNumber(); assertEquals(0L, long0); } @Test(timeout = 4000) public void test46() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.RFC4180; MockFile mockFile0 = new MockFile("hWHW8"); Path path0 = mockFile0.toPath(); Charset charset0 = Charset.defaultCharset(); // try { CSVParser.parse(path0, charset0, cSVFormat0); // fail("Expecting exception: NoSuchFileException"); // } catch(NoSuchFileException e) { // } } @Test(timeout = 4000) public void test47() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.EXCEL; Charset charset0 = Charset.defaultCharset(); // Undeclared exception! // try { CSVParser.parse((URL) null, charset0, cSVFormat0); // fail("Expecting exception: IllegalArgumentException"); // } catch(IllegalArgumentException e) { // // // // Parameter 'url' must not be null! // // // verifyException("org.apache.commons.csv.Assertions", e); // } } @Test(timeout = 4000) public void test48() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.EXCEL; Charset charset0 = Charset.defaultCharset(); // Undeclared exception! // try { CSVParser.parse((File) null, charset0, cSVFormat0); // fail("Expecting exception: IllegalArgumentException"); // } catch(IllegalArgumentException e) { // // // // Parameter 'file' must not be null! // // // verifyException("org.apache.commons.csv.Assertions", e); // } } @Test(timeout = 4000) public void test49() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.ORACLE; CSVParser cSVParser0 = CSVParser.parse("N\r", cSVFormat0); cSVParser0.getCurrentLineNumber(); assertEquals(0L, cSVParser0.getRecordNumber()); } @Test(timeout = 4000) public void test50() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.EXCEL; StringReader stringReader0 = new StringReader("N"); CSVParser cSVParser0 = cSVFormat0.parse(stringReader0); Consumer<Object> consumer0 = (Consumer<Object>) mock(Consumer.class, new ViolatedAssumptionAnswer()); cSVParser0.forEach(consumer0); assertEquals(1L, cSVParser0.getRecordNumber()); } @Test(timeout = 4000) public void test51() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.ORACLE; CSVParser cSVParser0 = CSVParser.parse("N\r", cSVFormat0); cSVParser0.getFirstEndOfLine(); assertEquals(0L, cSVParser0.getRecordNumber()); } @Test(timeout = 4000) public void test52() throws Throwable { CSVFormat cSVFormat0 = CSVFormat.EXCEL; byte[] byteArray0 = new byte[3]; ByteArrayInputStream byteArrayInputStream0 = new ByteArrayInputStream(byteArray0); Charset charset0 = Charset.defaultCharset(); CSVParser cSVParser0 = CSVParser.parse((InputStream) byteArrayInputStream0, charset0, cSVFormat0); cSVParser0.iterator(); assertEquals(0L, cSVParser0.getRecordNumber()); } }
4079de0764ddd172f6675139da20dde5261df8c3
7d065becb5783f5499356ccc317b244a78d771a1
/app/src/main/java/com/jeferson/thirdapplication/DatePickerActivity.java
1988786f03d09e0e56b68ef55ac0a289260e2e00
[]
no_license
Jeferson0512/Third_App
7a2aa7117615eaee24f99089080688968d565cb4
3adb9513e50e6a22b97f00b158d664171b03e74a
refs/heads/master
2021-01-21T06:52:41.610803
2017-08-31T02:34:55
2017-08-31T02:34:55
101,950,635
0
0
null
null
null
null
UTF-8
Java
false
false
1,395
java
package com.jeferson.thirdapplication; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.DatePicker; import android.widget.TextView; import java.util.Calendar; public class DatePickerActivity extends AppCompatActivity { private DatePicker datePicker; private TextView displayDate; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_date_picker); displayDate = (TextView)findViewById(R.id.display_date); datePicker = (DatePicker)findViewById(R.id.datePicker); //current DATE int year = Calendar.getInstance().get(Calendar.YEAR); int month = Calendar.getInstance().get(Calendar.MONTH); int day = Calendar.getInstance().get(Calendar.DAY_OF_MONTH); datePicker.init(year, month, day, new DatePicker.OnDateChangedListener() { @Override public void onDateChanged(DatePicker datePicker, int yy, int mm, int dd) { displayDate.setText("Date: "+ dd +"/"+ (mm+1) +"/"+ yy); } }); } public void pick(View view){ String currentDate = "Picked: "+ datePicker.getDayOfMonth() +"/"+ (datePicker.getMonth()+1) +"/"+ datePicker.getYear(); displayDate.setText(currentDate); } }
9062bb15f7769479953fb23307e7b98f646b0b60
98888431e807da1de704ebe7c7fe33e62144105d
/xss/src/main/java/de/dominikschadow/javasecurity/xss/UnprotectedServlet.java
9e2f64ef7d375929e7b10830ae19e2f43a7f204d
[ "Apache-2.0" ]
permissive
kapateldhruv/JavaSecurity
75cc8472c1362b7fa1190c328e831d20313f4cf9
7c0d4937c46325932f2d52a8b7b27b8599c6d3fe
refs/heads/master
2021-01-16T21:45:13.475585
2016-05-07T13:37:00
2016-05-07T13:37:00
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,422
java
/* * Copyright (C) 2016 Dominik Schadow, [email protected] * * This file is part of the Java Security project. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package de.dominikschadow.javasecurity.xss; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.io.PrintWriter; /** * Servlet receives unvalidated user input and returns it without further processing to the browser. * * @author Dominik Schadow */ @WebServlet(name = "UnprotectedServlet", urlPatterns = {"/unprotected"}) public class UnprotectedServlet extends HttpServlet { private static final long serialVersionUID = -8978771621644673835L; private static final Logger LOGGER = LoggerFactory.getLogger(UnprotectedServlet.class); @Override protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException { String name = request.getParameter("unprotectedName"); LOGGER.info("Received {} as name", name); response.setContentType("text/html"); try (PrintWriter out = response.getWriter()) { out.println("<html><head>"); out.println("<title>XSS - Unprotected</title>"); out.println("<link rel=\"stylesheet\" type=\"text/css\" href=\"resources/css/styles.css\" />"); out.println("</head>"); out.println("<body>"); out.println("<h1>XSS - Unprotected</h1>"); out.println("<p>[" + name + "]</p>"); out.println("<p><a href=\"index.jsp\">Home</a></p>"); out.println("</body></html>"); } catch (IOException ex) { LOGGER.error(ex.getMessage(), ex); } } }
82d73737f01ab13d6585c063a68a37c09972a931
d29587aa3bb75dce8f6f1b75d5cd12c95e60d4f1
/src/br/com/fes/scoa/model/TurmaCriteria.java
5f09341b9d6b6dfa80f261650157b04a8e3755a4
[]
no_license
DCarts/FES-UFRJ-2019.2
5574a2b57616236deb205508352ca6d69bfa404e
8e2a6a0bcd5da41d90dee0d073fd1b1ff268c624
refs/heads/master
2020-07-09T02:47:15.797285
2019-12-06T08:23:05
2019-12-06T08:23:05
203,853,215
0
1
null
null
null
null
UTF-8
Java
false
false
2,431
java
/** * "Visual Paradigm: DO NOT MODIFY THIS FILE!" * * This is an automatic generated file. It will be regenerated every time * you generate persistence class. * * Modifying its content may cause the program not work, or your work may lost. */ /** * Licensee: * License Type: Evaluation */ package br.com.fes.scoa.model; import org.hibernate.Criteria; import org.orm.PersistentException; import org.orm.PersistentSession; import org.orm.criteria.*; public class TurmaCriteria extends AbstractORMCriteria { public final IntegerExpression id; public final IntegerExpression disciplinaId; public final AssociationExpression disciplina; public final IntegerExpression professorId; public final AssociationExpression professor; public final StringExpression periodo; public final CollectionExpression alocacao_sala_turma; public final CollectionExpression inscricao_aluno; public TurmaCriteria(Criteria criteria) { super(criteria); id = new IntegerExpression("id", this); disciplinaId = new IntegerExpression("disciplina.id", this); disciplina = new AssociationExpression("disciplina", this); professorId = new IntegerExpression("professor.", this); professor = new AssociationExpression("professor", this); periodo = new StringExpression("periodo", this); alocacao_sala_turma = new CollectionExpression("ORM_Alocacao_sala_turma", this); inscricao_aluno = new CollectionExpression("ORM_Inscricao_aluno", this); } public TurmaCriteria(PersistentSession session) { this(session.createCriteria(Turma.class)); } public TurmaCriteria() throws PersistentException { this(SCOAPersistentManager.instance().getSession()); } public DisciplinaCriteria createDisciplinaCriteria() { return new DisciplinaCriteria(createCriteria("disciplina")); } public ProfessorCriteria createProfessorCriteria() { return new ProfessorCriteria(createCriteria("professor")); } public Alocacao_sala_turmaCriteria createAlocacao_sala_turmaCriteria() { return new Alocacao_sala_turmaCriteria(createCriteria("ORM_Alocacao_sala_turma")); } public Inscricao_alunoCriteria createInscricao_alunoCriteria() { return new Inscricao_alunoCriteria(createCriteria("ORM_Inscricao_aluno")); } public Turma uniqueTurma() { return (Turma) super.uniqueResult(); } public Turma[] listTurma() { java.util.List list = super.list(); return (Turma[]) list.toArray(new Turma[list.size()]); } }
11319205624dec61dc01642238b974764603fa94
c383dda43cd007574402354fc11d110ee57dcc49
/app/src/androidTest/java/com/example/loginandroidapp/ExampleInstrumentedTest.java
aa6f5b8b4a92338854edf3833090a94860c8b75a
[]
no_license
Kasunath-Lakmal/UserLoginAndRegisterApplication
ee65ea7f38eb9f17c59f7d552751f39843061c2f
01706ba707df4f3ebcf622bf43befa2a190b8e93
refs/heads/master
2023-03-05T09:38:24.335203
2021-02-04T16:08:25
2021-02-04T16:08:25
336,007,761
0
0
null
null
null
null
UTF-8
Java
false
false
768
java
package com.example.loginandroidapp; import android.content.Context; import androidx.test.platform.app.InstrumentationRegistry; import androidx.test.ext.junit.runners.AndroidJUnit4; import org.junit.Test; import org.junit.runner.RunWith; import static org.junit.Assert.*; /** * Instrumented test, which will execute on an Android device. * * @see <a href="http://d.android.com/tools/testing">Testing documentation</a> */ @RunWith(AndroidJUnit4.class) public class ExampleInstrumentedTest { @Test public void useAppContext() { // Context of the app under test. Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); assertEquals("com.example.loginandroidapp", appContext.getPackageName()); } }
427b3c46fc696ee0e9d056f7ddb85ddb97b39a57
4552214a7a89edae1b470e047d599d97dfcf01e0
/hoangpt/2014-12-30/Tutor1503_service/src/com/hoangphan/tutor1502_service/ImgIntentService.java
ed76595ba7d326d8bfec0dd944658c87ee6d5a31
[]
no_license
vickutetg/tm0614android
f09073791b5636e72ba59ea0d9352c614fdaad26
001ad1dd12a4894407eccb97b58d1570b8df40f8
refs/heads/master
2020-05-31T17:29:14.970607
2015-02-03T13:43:42
2015-02-03T13:43:42
34,943,933
0
0
null
null
null
null
UTF-8
Java
false
false
1,263
java
package com.hoangphan.tutor1502_service; import java.net.MalformedURLException; import java.net.URL; import android.app.IntentService; import android.content.Intent; import android.util.Log; import android.widget.Toast; public class ImgIntentService extends IntentService { public ImgIntentService() { super("ImgIntentService"); } @Override protected void onHandleIntent(Intent intent) { String[] urls = new String[]{ "http://vnexpress.com/1.jpg", "http://vnexpress.com/2.jpg", "http://vnexpress.com/3.jpg", "http://vnexpress.com/4.jpg", "http://vnexpress.com/5.jpg", "http://vnexpress.com/6.jpg", "http://vnexpress.com/7.jpg", "http://vnexpress.com/8.jpg", "http://vnexpress.com/9.jpg", "http://vnexpress.com/10.jpg", }; int dlAccum = 0; for (String url : urls) { int dlByte = downloadImg(url); dlAccum += dlByte; Log.d("download", "Download " +dlAccum+ " bytes"); //Toast.makeText(getApplicationContext(), "Download " +dlAccum+ " bytes", Toast.LENGTH_SHORT).show(); } } private int downloadImg(String url) { try { URL urlImg = new URL(url); Thread.sleep(3000); } catch (MalformedURLException | InterruptedException e) { e.printStackTrace(); } return 1000; } }
[ "phantichhoang@f6597a64-05d1-0719-f566-4b59fd94b772" ]
phantichhoang@f6597a64-05d1-0719-f566-4b59fd94b772
18cf30beeefc8c41e37b6269fd45db5b515f95ee
36c0a0e21f3758284242b8d2e40b60c36bd23468
/src/main/java/com/datasphere/server/query/druid/queries/JoinElement.java
261c678dd896000a4ab394c6a3fa39492cda73a6
[ "LicenseRef-scancode-mulanpsl-1.0-en" ]
permissive
neeeekoooo/datasphere-service
0185bca5a154164b4bc323deac23a5012e2e6475
cb800033ba101098b203dbe0a7e8b7f284319a7b
refs/heads/master
2022-11-15T01:10:05.530442
2020-02-01T13:54:36
2020-02-01T13:54:36
null
0
0
null
null
null
null
UTF-8
Java
false
false
2,064
java
/* * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.datasphere.server.query.druid.queries; import java.util.List; /** * */ public class JoinElement { JoinType joinType; String leftAlias; List<String> leftJoinColumns; String rightAlias; List<String> rightJoinColumns; public JoinElement() { } public JoinElement(JoinType joinType, String leftAlias, List<String> leftJoinColumns, String rightAlias, List<String> rightJoinColumns) { this.joinType = joinType; this.leftAlias = leftAlias; this.leftJoinColumns = leftJoinColumns; this.rightAlias = rightAlias; this.rightJoinColumns = rightJoinColumns; } public JoinType getJoinType() { return joinType; } public void setJoinType(JoinType joinType) { this.joinType = joinType; } public String getLeftAlias() { return leftAlias; } public void setLeftAlias(String leftAlias) { this.leftAlias = leftAlias; } public List<String> getLeftJoinColumns() { return leftJoinColumns; } public void setLeftJoinColumns(List<String> leftJoinColumns) { this.leftJoinColumns = leftJoinColumns; } public String getRightAlias() { return rightAlias; } public void setRightAlias(String rightAlias) { this.rightAlias = rightAlias; } public List<String> getRightJoinColumns() { return rightJoinColumns; } public void setRightJoinColumns(List<String> rightJoinColumns) { this.rightJoinColumns = rightJoinColumns; } public enum JoinType { INNER, LEFT_OUTER, RIGHT_OUTER } }
2b6b7f6c62fd97ec5aaccc9bc7ad52ab9df24a69
fa91450deb625cda070e82d5c31770be5ca1dec6
/Diff-Raw-Data/4/4_1b9c9f239afcee3a171bf4b123b2171dab301841/RemapperPreprocessor/4_1b9c9f239afcee3a171bf4b123b2171dab301841_RemapperPreprocessor_t.java
ba9abd6d3eafbccc9aba781f2dce65acfd99bc67
[]
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
8,019
java
/** * Copyright (c) 2012-2013, md_5. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * The name of the author may not be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ package net.md_5.specialsource; import org.objectweb.asm.ClassReader; import org.objectweb.asm.ClassWriter; import org.objectweb.asm.Opcodes; import org.objectweb.asm.Type; import org.objectweb.asm.tree.*; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; import java.util.List; /** * "Pre-process" a class file, intended to be used before remapping with JarRemapper. * * Currently includes: * - Extracting inheritance */ public class RemapperPreprocessor { public boolean debug = false; private InheritanceMap inheritanceMap; private JarMapping jarMapping; private AccessMap accessMap; /** * * @param inheritanceMap Map to add extracted inheritance information too, or null to not extract inheritance * @param jarMapping Mapping for reflection remapping, or null to not remap reflection * @throws IOException */ public RemapperPreprocessor(InheritanceMap inheritanceMap, JarMapping jarMapping, AccessMap accessMap) { this.inheritanceMap = inheritanceMap; this.jarMapping = jarMapping; this.accessMap = accessMap; } public RemapperPreprocessor(InheritanceMap inheritanceMap, JarMapping jarMapping) { this(inheritanceMap, jarMapping, null); } public byte[] preprocess(InputStream inputStream) throws IOException { return preprocess(new ClassReader(inputStream)); } public byte[] preprocess(byte[] bytecode) throws IOException { return preprocess(new ClassReader(bytecode)); } @SuppressWarnings("unchecked") public byte[] preprocess(ClassReader classReader) { byte[] bytecode = null; ClassNode classNode = new ClassNode(); int flags = ClassReader.SKIP_DEBUG; if (!isRewritingNeeded()) { // Not rewriting the class - skip the code, not needed flags |= ClassReader.SKIP_CODE | ClassReader.SKIP_FRAMES; } classReader.accept(classNode, flags); String className = classNode.name; // Inheritance extraction if (inheritanceMap != null) { logI("Loading plugin class inheritance for "+className); // Get inheritance ArrayList<String> parents = new ArrayList<String>(); for (String iface : (List<String>) classNode.interfaces) { parents.add(iface); } parents.add(classNode.superName); inheritanceMap.setParents(className.replace('.', '/'), parents); logI("Inheritance added "+className+" parents "+parents.size()); } if (isRewritingNeeded()) { // Class access if (accessMap != null) { classNode.access = accessMap.applyClassAccess(className, classNode.access); } // Field access if (accessMap != null) { for (FieldNode fieldNode : (List<FieldNode>) classNode.fields) { fieldNode.access = accessMap.applyFieldAccess(className, fieldNode.name, fieldNode.access); } } for (MethodNode methodNode : (List<MethodNode>) classNode.methods) { // Method access if (accessMap != null) { methodNode.access = accessMap.applyMethodAccess(className, methodNode.name, methodNode.desc, methodNode.access); } // Reflection remapping if (jarMapping != null) { AbstractInsnNode insn = methodNode.instructions.getFirst(); while (insn != null) { if (insn.getOpcode() == Opcodes.INVOKEVIRTUAL) { remapGetDeclaredField(insn); } insn = insn.getNext(); } } } ClassWriter cw = new ClassWriter(0); classNode.accept(cw); bytecode = cw.toByteArray(); } return bytecode; } private boolean isRewritingNeeded() { return jarMapping != null || accessMap != null; } /** * Replace class.getDeclaredField("string") with a remapped field string * @param insn Method call instruction */ private void remapGetDeclaredField(AbstractInsnNode insn) { MethodInsnNode mi = (MethodInsnNode) insn; if (!mi.owner.equals("java/lang/Class") || !mi.name.equals("getDeclaredField") || !mi.desc.equals("(Ljava/lang/String;)Ljava/lang/reflect/Field;")) { return; } logR("ReflectionRemapper found getDeclaredField!"); if (insn.getPrevious() == null || insn.getPrevious().getOpcode() != Opcodes.LDC) { logR("- not constant field; skipping"); return; } LdcInsnNode ldcField = (LdcInsnNode) insn.getPrevious(); if (!(ldcField.cst instanceof String)) { logR("- not field string; skipping: " + ldcField.cst); return; } String fieldName = (String) ldcField.cst; if (ldcField.getPrevious() == null || ldcField.getPrevious().getOpcode() != Opcodes.LDC) { logR("- not constant class; skipping: field=" + ldcField.cst); return; } LdcInsnNode ldcClass = (LdcInsnNode) ldcField.getPrevious(); if (!(ldcClass.cst instanceof Type)) { logR("- not class type; skipping: field=" + ldcClass.cst + ", class=" + ldcClass.cst); return; } String className = ((Type) ldcClass.cst).getInternalName(); String newName = jarMapping.tryClimb(jarMapping.fields, NodeType.FIELD, className, fieldName); logR("Remapping "+className+"/"+fieldName + " -> " + newName); if (newName != null) { // Change the string literal to the correct name ldcField.cst = newName; //ldcClass.cst = className; // not remapped here - taken care of by JarRemapper } } private void logI(String message) { if (debug) { System.out.println("[Inheritance] " + message); } } private void logR(String message) { if (debug) { System.out.println("[ReflectionRemapper] " + message); } } }
b7ffd24d3a9e81bd86430eb3d6b2c43df1d699e6
b02fb63ad930a05026957c89ff74c0fab485e7c2
/app/src/main/java/com/android/tacu/view/GlideImageLoader.java
3acd0e866fdcbde8d484ebfceac5e70fed08a7ef
[]
no_license
guaishoua/android
b0f182ac595a6b9fb6455bd3303c0cb4f4c5e8cd
ff6af5b40f440da32185f44d2918c74bf3bfe47a
refs/heads/master
2022-09-07T22:06:38.467313
2020-05-26T02:46:21
2020-05-26T02:46:21
267,489,167
0
1
null
null
null
null
UTF-8
Java
false
false
1,563
java
package com.android.tacu.view; import android.content.Context; import android.graphics.Bitmap; import android.graphics.drawable.Drawable; import android.support.annotation.Nullable; import com.bumptech.glide.Glide; import com.bumptech.glide.request.animation.GlideAnimation; import com.bumptech.glide.request.target.SimpleTarget; import com.qiyukf.unicorn.api.ImageLoaderListener; import com.qiyukf.unicorn.api.UnicornImageLoader; public class GlideImageLoader implements UnicornImageLoader { private Context context; public GlideImageLoader(Context context) { this.context = context.getApplicationContext(); } @Nullable @Override public Bitmap loadImageSync(String uri, int width, int height) { return null; } @Override public void loadImage(String uri, int width, int height, final ImageLoaderListener listener) { if (width <= 0 || height <= 0) { width = height = Integer.MIN_VALUE; } Glide.with(context).load(uri).asBitmap().into(new SimpleTarget<Bitmap>(width, height) { @Override public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) { if (listener != null) { listener.onLoadComplete(resource); } } @Override public void onLoadFailed(Exception e, Drawable errorDrawable) { if (listener != null) { listener.onLoadFailed(e); } } }); } }
[ "qwe8932720" ]
qwe8932720