blob_id
stringlengths
40
40
__id__
int64
225
39,780B
directory_id
stringlengths
40
40
path
stringlengths
6
313
content_id
stringlengths
40
40
detected_licenses
list
license_type
stringclasses
2 values
repo_name
stringlengths
6
132
repo_url
stringlengths
25
151
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
70
visit_date
timestamp[ns]
revision_date
timestamp[ns]
committer_date
timestamp[ns]
github_id
int64
7.28k
689M
โŒ€
star_events_count
int64
0
131k
fork_events_count
int64
0
48k
gha_license_id
stringclasses
23 values
gha_fork
bool
2 classes
gha_event_created_at
timestamp[ns]
gha_created_at
timestamp[ns]
gha_updated_at
timestamp[ns]
gha_pushed_at
timestamp[ns]
gha_size
int64
0
40.4M
โŒ€
gha_stargazers_count
int32
0
112k
โŒ€
gha_forks_count
int32
0
39.4k
โŒ€
gha_open_issues_count
int32
0
11k
โŒ€
gha_language
stringlengths
1
21
โŒ€
gha_archived
bool
2 classes
gha_disabled
bool
1 class
content
stringlengths
7
4.37M
src_encoding
stringlengths
3
16
language
stringclasses
1 value
length_bytes
int64
7
4.37M
extension
stringclasses
24 values
filename
stringlengths
4
174
language_id
stringclasses
1 value
entities
list
contaminating_dataset
stringclasses
0 values
malware_signatures
list
redacted_content
stringlengths
7
4.37M
redacted_length_bytes
int64
7
4.37M
alphanum_fraction
float32
0.25
0.94
alpha_fraction
float32
0.25
0.94
num_lines
int32
1
84k
avg_line_length
float32
0.76
99.9
std_line_length
float32
0
220
max_line_length
int32
5
998
is_vendor
bool
2 classes
is_generated
bool
1 class
max_hex_length
int32
0
319
hex_fraction
float32
0
0.38
max_unicode_length
int32
0
408
unicode_fraction
float32
0
0.36
max_base64_length
int32
0
506
base64_fraction
float32
0
0.5
avg_csv_sep_count
float32
0
4
is_autogen_header
bool
1 class
is_empty_html
bool
1 class
shard
stringclasses
16 values
2f7d71dd9c61b1cae6e1c5ca5ae609ac88bd29dc
21,268,678,119,937
642661998ab777003cef93ecc87e06acd3653b94
/Schevler/src/com/test/mvc/BoardDTO.java
aec138e097585252f78d219beb58b5ff37f5321c
[]
no_license
padabin/Shevler
https://github.com/padabin/Shevler
3bc4abb94eaed2f0394bcc8c4b2e2d9a8725cf1b
442145d990476bdc2e77c7ceae33806d082211e0
refs/heads/main
2023-05-14T04:07:10.410000
2021-06-03T13:52:59
2021-06-03T13:52:59
357,839,552
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/*===================== BoardDTO.java - ๊ฒŒ์‹œํŒ ์œ ํ˜• =====================*/ package com.test.mvc; public class BoardDTO { // ์ฃผ์š” ์†์„ฑ ๊ตฌ์„ฑ private String boardTypeCode, boardTypeDetail; // getter / setter ๊ตฌ์„ฑ public String getBoardTypeCode() { return boardTypeCode; } public void setBoardTypeCode(String boardTypeCode) { this.boardTypeCode = boardTypeCode; } public String getBoardTypeDetail() { return boardTypeDetail; } public void setBoardTypeDetail(String boardTypeDetail) { this.boardTypeDetail = boardTypeDetail; } }
UTF-8
Java
611
java
BoardDTO.java
Java
[]
null
[]
/*===================== BoardDTO.java - ๊ฒŒ์‹œํŒ ์œ ํ˜• =====================*/ package com.test.mvc; public class BoardDTO { // ์ฃผ์š” ์†์„ฑ ๊ตฌ์„ฑ private String boardTypeCode, boardTypeDetail; // getter / setter ๊ตฌ์„ฑ public String getBoardTypeCode() { return boardTypeCode; } public void setBoardTypeCode(String boardTypeCode) { this.boardTypeCode = boardTypeCode; } public String getBoardTypeDetail() { return boardTypeDetail; } public void setBoardTypeDetail(String boardTypeDetail) { this.boardTypeDetail = boardTypeDetail; } }
611
0.632479
0.632479
35
14.714286
16.652021
55
false
false
0
0
0
0
0
0
0.942857
false
false
0
09c6a34b8182157a9ddca8c86e39ff9883e70164
5,789,615,926,041
d37d50a0930461fba06e1fa1a03226eea7e7ebd1
/app/src/main/java/unal/edu/co/surtilandiapp/features/shopkeeper/competitor/Store.java
2a887c9b7eb7055c114b903676e6e9ff1983c93f
[]
no_license
hninor/Surtilandiapp
https://github.com/hninor/Surtilandiapp
98b2746c70ba4754c2c173945fc252e4e0f52c2b
91e541cfbfeed9e9302374ec42238bae2c08f6a2
refs/heads/master
2021-08-22T09:42:57.840000
2017-11-29T22:18:44
2017-11-29T22:18:44
103,058,804
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package unal.edu.co.surtilandiapp.features.shopkeeper.competitor; import java.util.List; /** * Created by USER on 16/10/2017. */ public class Store { private String name; private int image; private double rating; public String getName() { return name; } public void setName(String name) { this.name = name; } public int getImage() { return image; } public void setImage(int image) { this.image = image; } public double getRating() { return rating; } public void setRating(double rating) { this.rating = rating; } }
UTF-8
Java
636
java
Store.java
Java
[ { "context": "etitor;\n\nimport java.util.List;\n\n/**\n * Created by USER on 16/10/2017.\n */\n\npublic class Store {\n\n pri", "end": 113, "score": 0.8581745028495789, "start": 109, "tag": "USERNAME", "value": "USER" } ]
null
[]
package unal.edu.co.surtilandiapp.features.shopkeeper.competitor; import java.util.List; /** * Created by USER on 16/10/2017. */ public class Store { private String name; private int image; private double rating; public String getName() { return name; } public void setName(String name) { this.name = name; } public int getImage() { return image; } public void setImage(int image) { this.image = image; } public double getRating() { return rating; } public void setRating(double rating) { this.rating = rating; } }
636
0.599057
0.586478
39
15.307693
15.683003
65
false
false
0
0
0
0
0
0
0.282051
false
false
0
0bb4c9d49ef9fdd02912dfbbeb803c3d5796d2dd
17,952,963,365,301
0a2197271668387563f98687f7a844af8b4561de
/src/programmers/level1/x๋งŒํผ๊ฐ„๊ฒฉ์ด์žˆ๋Š”n๊ฐœ์˜์ˆซ์ž/Solution.java
b905f1c55a8b0fbf452616dfc09f1cd12bf9e4ce
[]
no_license
SamuraiLulu/algorithm
https://github.com/SamuraiLulu/algorithm
51be78cd4477b02b9dc04d35fea3932e8c99ae03
62fd75e134fcfd4dc6ab728336780f65d725c9fd
refs/heads/master
2023-06-10T23:21:24.113000
2021-07-03T07:39:24
2021-07-03T07:39:24
382,555,133
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package programmers.level1.x๋งŒํผ๊ฐ„๊ฒฉ์ด์žˆ๋Š”n๊ฐœ์˜์ˆซ์ž; class Solution { public long[] solution(int x, int y) { long[] answer = new long[y]; long sum = 0; for (int i = 0; i < y; i++) { sum += x; answer[i] = sum; } return answer; } }
UTF-8
Java
289
java
Solution.java
Java
[]
null
[]
package programmers.level1.x๋งŒํผ๊ฐ„๊ฒฉ์ด์žˆ๋Š”n๊ฐœ์˜์ˆซ์ž; class Solution { public long[] solution(int x, int y) { long[] answer = new long[y]; long sum = 0; for (int i = 0; i < y; i++) { sum += x; answer[i] = sum; } return answer; } }
289
0.520599
0.509363
14
18.071428
14.19489
42
false
false
0
0
0
0
0
0
1.428571
false
false
0
62e8d89a4b7f99b69416d54d0edb5232bb69837c
28,089,086,182,888
113f088c576a17e9ebf6a995c1e3fbe709f3a177
/app/src/main/java/oxim/digital/sanq/ui/feed/create/NewFeedSubscriptionPresenter.java
9c526e29f75ac18f2c7118d831ec79e337d97668
[]
no_license
0ximDigital/Sanq
https://github.com/0ximDigital/Sanq
8ba5d2061e782b8e8d4f215f8029c6baa59dd351
557774e841ca5eb4256f38bf483634e3ca20f760
refs/heads/master
2021-08-26T09:10:51.443000
2017-11-14T11:15:42
2017-11-14T11:15:42
103,323,428
0
0
null
false
2017-11-24T15:44:07
2017-09-12T21:44:12
2017-09-12T21:47:30
2017-11-22T18:14:14
271
0
0
0
Java
false
null
package oxim.digital.sanq.ui.feed.create; import android.content.res.Resources; import javax.inject.Inject; import io.reactivex.Completable; import io.reactivex.disposables.Disposable; import oxim.digital.sanq.base.BasePresenter; import oxim.digital.sanq.domain.interactor.feed.SubscribeUserToFeedUseCase; public final class NewFeedSubscriptionPresenter extends BasePresenter<NewFeedSubscriptionContract.View, NewFeedViewState> implements NewFeedSubscriptionContract.Presenter { @Inject SubscribeUserToFeedUseCase subscribeUserToFeedUseCase; @Inject Resources resources; @Override protected NewFeedViewState initialViewState() { return new NewFeedViewState(); } @Override protected Disposable observeView(final NewFeedSubscriptionContract.View view) { return view.newFeedRequest() .subscribe(this::onNewFeedRequestData); } private void onNewFeedRequestData(final NewFeedRequest newFeedRequest) { viewStateAction(newFeedViewState -> newFeedViewState.setMessage("")); } @Override public void subscribeToFeed(final String feedUrl) { runCommand(subscribeUserToFeedUseCase.execute(feedUrl) .startWith(Completable.fromAction(() -> viewStateAction(newFeedViewState -> newFeedViewState.setLoading(true)))) .doOnEvent(event -> viewStateAction(newFeedViewState -> newFeedViewState.setLoading(false))) .doOnError(this::showErrorMessage) .doOnComplete(this::back)); } private void showErrorMessage(final Throwable throwable) { viewStateAction(newFeedViewState -> newFeedViewState.setMessage("Invalid feed")); } }
UTF-8
Java
1,820
java
NewFeedSubscriptionPresenter.java
Java
[]
null
[]
package oxim.digital.sanq.ui.feed.create; import android.content.res.Resources; import javax.inject.Inject; import io.reactivex.Completable; import io.reactivex.disposables.Disposable; import oxim.digital.sanq.base.BasePresenter; import oxim.digital.sanq.domain.interactor.feed.SubscribeUserToFeedUseCase; public final class NewFeedSubscriptionPresenter extends BasePresenter<NewFeedSubscriptionContract.View, NewFeedViewState> implements NewFeedSubscriptionContract.Presenter { @Inject SubscribeUserToFeedUseCase subscribeUserToFeedUseCase; @Inject Resources resources; @Override protected NewFeedViewState initialViewState() { return new NewFeedViewState(); } @Override protected Disposable observeView(final NewFeedSubscriptionContract.View view) { return view.newFeedRequest() .subscribe(this::onNewFeedRequestData); } private void onNewFeedRequestData(final NewFeedRequest newFeedRequest) { viewStateAction(newFeedViewState -> newFeedViewState.setMessage("")); } @Override public void subscribeToFeed(final String feedUrl) { runCommand(subscribeUserToFeedUseCase.execute(feedUrl) .startWith(Completable.fromAction(() -> viewStateAction(newFeedViewState -> newFeedViewState.setLoading(true)))) .doOnEvent(event -> viewStateAction(newFeedViewState -> newFeedViewState.setLoading(false))) .doOnError(this::showErrorMessage) .doOnComplete(this::back)); } private void showErrorMessage(final Throwable throwable) { viewStateAction(newFeedViewState -> newFeedViewState.setMessage("Invalid feed")); } }
1,820
0.694506
0.694506
47
37.702129
41.916794
172
false
false
0
0
0
0
0
0
0.319149
false
false
0
d4a3cf6970a67ae790a5ded0f9a4cc49dae9fd42
14,456,859,974,836
1dd62bc48474e7eed17be48c64adc40f8517981e
/homework-11/src/main/java/com/ishmuradov/otus/homework11/repositories/PhoneRepository.java
e51f60eb72ff0fa34b5b2a6816316262ed93a4d6
[]
no_license
evilchewits/otus-java-2017-10-ishmuradov
https://github.com/evilchewits/otus-java-2017-10-ishmuradov
a0a5be06c112f56ba130e04cabcfda66681e3cd6
aab5c6ff4900a0ee68444cc75f65b9b1185a3a92
refs/heads/master
2020-03-30T08:17:10.179000
2018-09-30T20:16:25
2018-09-30T20:16:25
106,963,863
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ishmuradov.otus.homework11.repositories; import com.ishmuradov.otus.homework11.model.Phone; public interface PhoneRepository extends Repository<Phone> { }
UTF-8
Java
170
java
PhoneRepository.java
Java
[]
null
[]
package com.ishmuradov.otus.homework11.repositories; import com.ishmuradov.otus.homework11.model.Phone; public interface PhoneRepository extends Repository<Phone> { }
170
0.829412
0.805882
7
23.285715
26.75131
60
false
false
0
0
0
0
0
0
0.285714
false
false
0
7c2a543a1a02f593167e7be8a7d66cdba0b347a2
35,321,811,048,035
5b86d426c76be3bf2ab93645564814b48f1b79f2
/src/main/java/com/manuanand/chesstrainer/Training.java
3f7452d6fcf49e84d9255a71d12f3eabe0dd2fcb
[]
no_license
bulletkid/ChessTrainer
https://github.com/bulletkid/ChessTrainer
2844ff2702ba4f21ac1b54251290995f16c8d314
b88d76864f82fdfaf5f92b629888e27828505b10
refs/heads/master
2023-07-17T10:06:55.647000
2021-08-28T04:15:23
2021-08-28T04:15:23
400,698,288
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.manuanand.chesstrainer; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; @Entity // This tells Hibernate to make a table out of this class public class Training { @Id @GeneratedValue(strategy=GenerationType.AUTO) private Integer id; private Integer playerId; private Integer puzzleId; private PuzzleStatus status; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Integer getPlayerId() { return playerId; } public void setPlayerId(Integer userId) { this.playerId = userId; } public Integer getPuzzleId() { return puzzleId; } public void setPuzzleId(Integer puzzleId) { this.puzzleId = puzzleId; } public PuzzleStatus getStatus() { return status; } public void setStatus(PuzzleStatus status) { this.status = status; } }
UTF-8
Java
921
java
Training.java
Java
[]
null
[]
package com.manuanand.chesstrainer; import javax.persistence.Entity; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; @Entity // This tells Hibernate to make a table out of this class public class Training { @Id @GeneratedValue(strategy=GenerationType.AUTO) private Integer id; private Integer playerId; private Integer puzzleId; private PuzzleStatus status; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public Integer getPlayerId() { return playerId; } public void setPlayerId(Integer userId) { this.playerId = userId; } public Integer getPuzzleId() { return puzzleId; } public void setPuzzleId(Integer puzzleId) { this.puzzleId = puzzleId; } public PuzzleStatus getStatus() { return status; } public void setStatus(PuzzleStatus status) { this.status = status; } }
921
0.743757
0.743757
51
17.058823
16.869059
65
false
false
0
0
0
0
0
0
1.098039
false
false
0
6d9e6ba5042fb0fdb8ccce396a6d720e014c750b
3,212,635,601,041
a7ee8c2c247be28dc752649cb258b4c76588320b
/src/main/java/com/sunjung/base/sysmgr/acluser/service/AclUserService.java
d8d10570f260f78cb2913af009aa3ec5a09fbde4
[]
no_license
181282945/media
https://github.com/181282945/media
29463607aeb7f2ee6dbd15de82591f6a869efdc2
378aac315eebc1159ea176f29a16d72ef08ebc38
refs/heads/master
2021-01-23T07:51:32.876000
2017-04-21T02:28:28
2017-04-21T02:28:28
86,461,367
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.sunjung.base.sysmgr.acluser.service; import com.sunjung.base.sysmgr.acluser.dao.AclUserMapper; import com.sunjung.base.sysmgr.acluser.entity.AclUser; import com.sunjung.core.service.BaseService; /** * Created by ไธบ on 2017-4-8. */ public interface AclUserService extends BaseService<AclUser,AclUserMapper> { AclUser getUserByName(String userName); }
UTF-8
Java
371
java
AclUserService.java
Java
[ { "context": "njung.core.service.BaseService;\n\n/**\n * Created by ไธบ on 2017-4-8.\n */\npublic interface AclUserService ", "end": 228, "score": 0.8901900053024292, "start": 227, "tag": "USERNAME", "value": "ไธบ" } ]
null
[]
package com.sunjung.base.sysmgr.acluser.service; import com.sunjung.base.sysmgr.acluser.dao.AclUserMapper; import com.sunjung.base.sysmgr.acluser.entity.AclUser; import com.sunjung.core.service.BaseService; /** * Created by ไธบ on 2017-4-8. */ public interface AclUserService extends BaseService<AclUser,AclUserMapper> { AclUser getUserByName(String userName); }
371
0.794038
0.777778
12
29.75
26.160164
76
false
false
0
0
0
0
0
0
0.5
false
false
0
3d0b13a7cae5ace56b60b2c877b1fc4bf06f56e5
32,744,830,684,803
295f396331916ebc36065a5cef9c94feecda39e9
/conimal/src/com/kh/customer/controller/UpdateAnswerController.java
d5f9fe60175b75c5cbbcab1a430c0f15d27271b2
[]
no_license
rlagusthf12/SemiProject
https://github.com/rlagusthf12/SemiProject
0b2b743ba85e1588fb3283117341bb0b26496d19
3eaefc5de4cb46aa4d587e17152772bcb6cc73c2
refs/heads/master
2023-05-27T10:19:52.261000
2021-06-10T11:19:43
2021-06-10T11:19:43
366,936,674
1
2
null
false
2021-06-01T13:20:31
2021-05-13T04:47:37
2021-06-01T13:19:10
2021-06-01T13:19:07
27,881
1
1
1
Java
false
false
package com.kh.customer.controller; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.kh.customer.model.service.CustomerService; import com.kh.customer.model.vo.Customer; /** * Servlet implementation class UpdateAnswerController */ @WebServlet("/update.ca") public class UpdateAnswerController extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public UpdateAnswerController() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("UTF-8"); int queNo = Integer.parseInt(request.getParameter("cno")); String ansContent = request.getParameter("ansContent"); Customer c = new Customer(); c.setQueNo(queNo); c.setAnsContent(ansContent); int result = new CustomerService().updateAnswer(c); if(result > 0) { request.getSession().setAttribute("alertMsg", "๋‹ต๋ณ€์„ ๋“ฑ๋กํ–ˆ์Šต๋‹ˆ๋‹ค."); response.sendRedirect(request.getContextPath() + "/detail.ca?cno=" + c.getQueNo()); }else { } } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); } }
UTF-8
Java
1,773
java
UpdateAnswerController.java
Java
[]
null
[]
package com.kh.customer.controller; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import com.kh.customer.model.service.CustomerService; import com.kh.customer.model.vo.Customer; /** * Servlet implementation class UpdateAnswerController */ @WebServlet("/update.ca") public class UpdateAnswerController extends HttpServlet { private static final long serialVersionUID = 1L; /** * @see HttpServlet#HttpServlet() */ public UpdateAnswerController() { super(); // TODO Auto-generated constructor stub } /** * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) */ protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { request.setCharacterEncoding("UTF-8"); int queNo = Integer.parseInt(request.getParameter("cno")); String ansContent = request.getParameter("ansContent"); Customer c = new Customer(); c.setQueNo(queNo); c.setAnsContent(ansContent); int result = new CustomerService().updateAnswer(c); if(result > 0) { request.getSession().setAttribute("alertMsg", "๋‹ต๋ณ€์„ ๋“ฑ๋กํ–ˆ์Šต๋‹ˆ๋‹ค."); response.sendRedirect(request.getContextPath() + "/detail.ca?cno=" + c.getQueNo()); }else { } } /** * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) */ protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub doGet(request, response); } }
1,773
0.74188
0.740171
61
27.770493
29.415281
119
false
false
0
0
0
0
0
0
1.377049
false
false
0
ef4649f49e42d47a2c21a2a9e5368c2a37a479c2
27,315,992,059,434
053dd0cc186b588ff1752b2a9f6fa944ed416688
/src/com/lcc/oa/service/ISalaryService.java
ad1c476dcd2f6c33b0c51f8882b68f1acbe1a2e2
[]
no_license
liangchengcheng/activiti-master
https://github.com/liangchengcheng/activiti-master
867f407a693cc35069b84c461a70efd7173d9f3a
5049f13237e34253320aeed4faccd9cffa1148fa
refs/heads/master
2021-01-23T02:39:36.426000
2017-04-05T23:56:34
2017-04-05T23:56:34
86,010,793
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.lcc.oa.service; import com.lcc.oa.entity.Salary; import java.io.Serializable; /** * Created by asus on 2017/3/28. */ public interface ISalaryService { public Serializable doAdd(Salary salary) throws Exception; public void doUpdate(Salary salary) throws Exception; public Salary findByUserId(String userId) throws Exception; public Salary findById(Integer id) throws Exception; }
UTF-8
Java
417
java
ISalaryService.java
Java
[ { "context": ";\n\nimport java.io.Serializable;\n\n/**\n * Created by asus on 2017/3/28.\n */\npublic interface ISalaryService", "end": 115, "score": 0.9798063039779663, "start": 111, "tag": "USERNAME", "value": "asus" } ]
null
[]
package com.lcc.oa.service; import com.lcc.oa.entity.Salary; import java.io.Serializable; /** * Created by asus on 2017/3/28. */ public interface ISalaryService { public Serializable doAdd(Salary salary) throws Exception; public void doUpdate(Salary salary) throws Exception; public Salary findByUserId(String userId) throws Exception; public Salary findById(Integer id) throws Exception; }
417
0.7506
0.733813
20
19.85
23.437737
63
false
false
0
0
0
0
0
0
0.35
false
false
0
7f5b6eb0ef414bebc7519a0153059b88290556a5
14,680,198,272,858
473b76b1043df2f09214f8c335d4359d3a8151e0
/benchmark/bigclonebenchdata_partial/10460548.java
2a1ee8d0ec73ac7758f56facbc70b5f71fda3518
[]
no_license
whatafree/JCoffee
https://github.com/whatafree/JCoffee
08dc47f79f8369af32e755de01c52d9a8479d44c
fa7194635a5bd48259d325e5b0a190780a53c55f
refs/heads/master
2022-11-16T01:58:04.254000
2020-07-13T20:11:17
2020-07-13T20:11:17
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
class c10460548 { public void parse() { InputSource urlInputStream = null; SAXParserFactory spf = null; SAXParser sp = null; HttpURLConnection conn = null; try { URL url = new URL(this.urlString); _setProxy(); conn = (HttpURLConnection) url.openConnection(); urlInputStream = new InputSource(StreamUtils.inputStreamToReader(conn.getInputStream())); spf = SAXParserFactory.newInstance(); if (spf != null) { sp = spf.newSAXParser(); sp.parse(urlInputStream, this); } } catch (Exception e) { if (conn != null) { if (conn.getHeaderField("X-RateLimit-Limit") != null) { String rateLimit = conn.getHeaderField("X-RateLimit-Limit"); String rateRemaining = conn.getHeaderField("X-RateLimit-Remaining"); long rateReset = Long.valueOf(conn.getHeaderField("X-RateLimit-Reset")) * 1000; LOG.warn("Possible rate limits? LIMIT:" + rateLimit + " REMAINING:" + rateRemaining + " RESET:" + new Date(rateReset)); } } e.printStackTrace(); LOG.warn("error parsing rss feed", e); } finally { } } }
UTF-8
Java
1,333
java
10460548.java
Java
[]
null
[]
class c10460548 { public void parse() { InputSource urlInputStream = null; SAXParserFactory spf = null; SAXParser sp = null; HttpURLConnection conn = null; try { URL url = new URL(this.urlString); _setProxy(); conn = (HttpURLConnection) url.openConnection(); urlInputStream = new InputSource(StreamUtils.inputStreamToReader(conn.getInputStream())); spf = SAXParserFactory.newInstance(); if (spf != null) { sp = spf.newSAXParser(); sp.parse(urlInputStream, this); } } catch (Exception e) { if (conn != null) { if (conn.getHeaderField("X-RateLimit-Limit") != null) { String rateLimit = conn.getHeaderField("X-RateLimit-Limit"); String rateRemaining = conn.getHeaderField("X-RateLimit-Remaining"); long rateReset = Long.valueOf(conn.getHeaderField("X-RateLimit-Reset")) * 1000; LOG.warn("Possible rate limits? LIMIT:" + rateLimit + " REMAINING:" + rateRemaining + " RESET:" + new Date(rateReset)); } } e.printStackTrace(); LOG.warn("error parsing rss feed", e); } finally { } } }
1,333
0.534884
0.525881
33
39.303032
32.421921
142
false
false
0
0
0
0
0
0
0.575758
false
false
0
ff3dea61b108aece93432c1b960e41db803d35fc
21,895,743,323,257
b24818a948152b06c7d85ac442e9b37cb6becbbc
/src/main/java/com/ash/experiments/performance/whitespace/Class9043.java
e96dd19c4370f7ec2e1feee719fc0ea949f05374
[]
no_license
ajorpheus/whitespace-perf-test
https://github.com/ajorpheus/whitespace-perf-test
d0797b6aa3eea1435eaa1032612f0874537c58b8
d2b695aa09c6066fbba0aceb230fa4e308670b32
refs/heads/master
2020-04-17T23:38:39.420000
2014-06-02T09:27:17
2014-06-02T09:27:17
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class Class9043 {}
UTF-8
Java
41
java
Class9043.java
Java
[]
null
[]
public class Class9043 {}
41
0.487805
0.390244
1
25
0
25
false
false
0
0
0
0
0
0
0
false
false
0
baf17ec45d06f019985ad2d00e0981b841b84473
2,559,800,535,310
1de5c56d05f240cc94148246fcf7ef6a8387e469
/app/src/main/java/com/liuchuanzheng/study_zidingyiview/step/StepView.java
282b71c8fef84aadb89c705b29d57110e068920d
[]
no_license
liuchuanzheng/Study_zidingyiView
https://github.com/liuchuanzheng/Study_zidingyiView
3740ddd281d638864306cc699c8aed4518cfc78b
c631379c4c5e1b52e8f6d53dcdb13844a3a9e699
refs/heads/master
2022-09-26T07:19:14.043000
2020-06-02T08:54:56
2020-06-02T08:54:56
268,716,141
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.liuchuanzheng.study_zidingyiview.step; import android.animation.ValueAnimator; import android.content.Context; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.RectF; import android.util.AttributeSet; import android.view.View; import androidx.annotation.Nullable; import com.liuchuanzheng.study_zidingyiview.R; /** * @author ๅˆ˜ไผ ๆ”ฟ * @date 2020/6/1 13:55 * QQ:1052374416 * ็”ต่ฏ:18501231486 * ไฝœ็”จ: * ๆณจๆ„ไบ‹้กน: */ public class StepView extends View { /*ๅœ†ๅผงๅฎฝๅบฆ*/ private float borderWidth = 38f; /* ็”ปๆญฅๆ•ฐ็š„ๆ•ฐๅ€ผ็š„ๅญ—ไฝ“ๅคงๅฐ*/ private float numberTextSize = 0; /** * ๅผ€ๅง‹็ป˜ๅˆถๅœ†ๅผง็š„่ง’ๅบฆ */ private float startAngle = 135; /** * ็ปˆ็‚นๅฏนๅบ”็š„่ง’ๅบฆๅ’Œ่ตทๅง‹็‚นๅฏนๅบ”็š„่ง’ๅบฆ็š„ๅคน่ง’ */ private float angleLength = 270; /** * ๆ‰€่ฆ็ป˜ๅˆถ็š„ๅฝ“ๅ‰ๆญฅๆ•ฐ็š„็บข่‰ฒๅœ†ๅผง็ปˆ็‚นๅˆฐ่ตท็‚น็š„ๅคน่ง’ */ private float currentAngleLength = 0; private String stepNumber; /** * ๅŠจ็”ปๆ—ถ้•ฟ */ private int animationLength = 3000; public StepView(Context context) { super(context); } public StepView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); } public StepView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); /*ไธญๅฟƒ็‚นๅๆ ‡*/ float centerX = (getWidth()) / 2; /*ๆŒ‡ๅฎšๅœ†ๅผง็š„ๅค–่ฝฎๅป“็ŸฉๅฝขๅŒบๅŸŸ*/ RectF rectF = new RectF(0 + borderWidth, borderWidth, 2 * centerX - borderWidth, 2 * centerX - borderWidth); /*็ป˜ๅˆถ็บข่‰ฒๅœ†ๅผง*/ drawArcYellow(canvas, rectF); /*็ป˜ๅˆถ่“่‰ฒ่ตฐ่ฟ‡ๆญฅๆ•ฐ*/ drawArcRed(canvas, rectF); /*ๆ–‡ๅญ—*/ drawTex(canvas, rectF); } private void drawTex(Canvas canvas, RectF rectF) { Paint paint = new Paint(); paint.setColor(getResources().getColor(R.color.colorAccent)); paint.setAntiAlias(true); paint.setTextSize(32); int length = String.valueOf(currentAngleLength).length(); canvas.drawText(currentAngleLength + "", rectF.centerX() - 70, getHeight() / 2, paint); } /** * 1.็ป˜ๅˆถๆ€ปๆญฅๆ•ฐ็š„้ป„่‰ฒๅœ†ๅผง * * @param canvas ็”ป็ฌ” * @param rectF ๅ‚่€ƒ็š„็Ÿฉๅฝข */ private void drawArcYellow(Canvas canvas, RectF rectF) { Paint paint = new Paint(); paint.setColor(getResources().getColor(R.color.colorAccent)); /** ็ป“ๅˆๅค„ไธบๅœ†ๅผง*/ paint.setStrokeJoin(Paint.Join.ROUND); /** ่ฎพ็ฝฎ็”ป็ฌ”็š„ๆ ทๅผ Paint.Cap.Round ,Cap.SQUARE็ญ‰ๅˆ†ๅˆซไธบๅœ†ๅฝขใ€ๆ–นๅฝข*/ paint.setStrokeCap(Paint.Cap.ROUND); /** ่ฎพ็ฝฎ็”ป็ฌ”็š„ๅกซๅ……ๆ ทๅผ Paint.Style.FILL :ๅกซๅ……ๅ†…้ƒจ;Paint.Style.FILL_AND_STROKE ๏ผšๅกซๅ……ๅ†…้ƒจๅ’Œๆ่พน; Paint.Style.STROKE ๏ผšไป…ๆ่พน*/ paint.setStyle(Paint.Style.STROKE); /**ๆŠ—้”ฏ้ฝฟๅŠŸ่ƒฝ*/ paint.setAntiAlias(true); /**่ฎพ็ฝฎ็”ป็ฌ”ๅฎฝๅบฆ*/ paint.setStrokeWidth(38f); canvas.drawArc(rectF, startAngle, angleLength, false, paint); } /** * 2.็ป˜ๅˆถๅฝ“ๅ‰ๆญฅๆ•ฐ็š„่“่‰ฒๅœ†ๅผง * * @param canvas * @param rectF */ private void drawArcRed(Canvas canvas, RectF rectF) { Paint paint = new Paint(); /**่ฎพ็ฝฎ็ป“ๅˆๅค„็š„ๆ ทๅญ๏ผŒMiter:็ป“ๅˆๅค„ไธบ้”่ง’๏ผŒ Round:็ป“ๅˆๅค„ไธบๅœ†ๅผง๏ผšBEVEL๏ผš็ป“ๅˆๅค„ไธบ็›ด็บฟใ€‚*/ paint.setStrokeJoin(Paint.Join.ROUND); paint.setStyle(Paint.Style.STROKE);//่ฎพ็ฝฎๅกซๅ……ๆ ทๅผ /*** ๅฝ“็”ป็ฌ”ๆ ทๅผไธบSTROKEๆˆ–FILL_OR_STROKEๆ—ถ๏ผŒ่ฎพ็ฝฎ็ฌ”ๅˆท็š„ๅ›พๅฝขๆ ทๅผ๏ผŒๅฆ‚ๅœ†ๅฝขๆ ทๅผ Cap.ROUND,ๆˆ–ๆ–นๅฝขๆ ทๅผCap.SQUARE */ paint.setStrokeCap(Paint.Cap.ROUND); paint.setAntiAlias(true);//ๆŠ—้”ฏ้ฝฟๅŠŸ่ƒฝ paint.setStrokeWidth(borderWidth);//่ฎพ็ฝฎ็”ป็ฌ”ๅฎฝๅบฆ paint.setColor(getResources().getColor(R.color.colorPrimary)); canvas.drawArc(rectF, startAngle, currentAngleLength, false, paint); } /** * ๆ‰€่ตฐ็š„ๆญฅๆ•ฐ่ฟ›ๅบฆ * * @param totalStepNum ่ฎพ็ฝฎ็š„ๆญฅๆ•ฐ * @param currentCounts ๆ‰€่ตฐๆญฅๆ•ฐ */ public void setCurrentCount(int totalStepNum, int currentCounts) { stepNumber = currentCounts + ""; /**ๅฆ‚ๆžœๅฝ“ๅ‰่ตฐ็š„ๆญฅๆ•ฐ่ถ…่ฟ‡ๆ€ปๆญฅๆ•ฐๅˆ™ๅœ†ๅผง่ฟ˜ๆ˜ฏ270ๅบฆ๏ผŒไธ่ƒฝๆˆไธบๅ›ญ*/ if (currentCounts > totalStepNum) { currentCounts = totalStepNum; } /**ๆ‰€่ตฐๆญฅๆ•ฐๅ ็”จๆ€ปๅ…ฑๆญฅๆ•ฐ็š„็™พๅˆ†ๆฏ”*/ float scale = (float) currentCounts / totalStepNum; /**ๆข็ฎ—ๆˆๅผงๅบฆๆœ€ๅŽ่ฆๅˆฐ่พพ็š„่ง’ๅบฆ็š„้•ฟๅบฆ-->ๅผง้•ฟ*/ float currentAngleLength = scale * angleLength; /**ๅผ€ๅง‹ๆ‰ง่กŒๅŠจ็”ป*/ setAnimation(0, currentAngleLength, animationLength); } /** * ไธบ่ฟ›ๅบฆ่ฎพ็ฝฎๅŠจ็”ป * ValueAnimatorๆ˜ฏๆ•ดไธชๅฑžๆ€งๅŠจ็”ปๆœบๅˆถๅฝ“ไธญๆœ€ๆ ธๅฟƒ็š„ไธ€ไธช็ฑป๏ผŒๅฑžๆ€งๅŠจ็”ป็š„่ฟ่กŒๆœบๅˆถๆ˜ฏ้€š่ฟ‡ไธๆ–ญๅœฐๅฏนๅ€ผ่ฟ›่กŒๆ“ไฝœๆฅๅฎž็Žฐ็š„๏ผŒ * ่€Œๅˆๅง‹ๅ€ผๅ’Œ็ป“ๆŸๅ€ผไน‹้—ด็š„ๅŠจ็”ป่ฟ‡ๆธกๅฐฑๆ˜ฏ็”ฑValueAnimator่ฟ™ไธช็ฑปๆฅ่ดŸ่ดฃ่ฎก็ฎ—็š„ใ€‚ * ๅฎƒ็š„ๅ†…้ƒจไฝฟ็”จไธ€็งๆ—ถ้—ดๅพช็Žฏ็š„ๆœบๅˆถๆฅ่ฎก็ฎ—ๅ€ผไธŽๅ€ผไน‹้—ด็š„ๅŠจ็”ป่ฟ‡ๆธก๏ผŒ * ๆˆ‘ไปฌๅช้œ€่ฆๅฐ†ๅˆๅง‹ๅ€ผๅ’Œ็ป“ๆŸๅ€ผๆไพ›็ป™ValueAnimator๏ผŒๅนถไธ”ๅ‘Š่ฏ‰ๅฎƒๅŠจ็”ปๆ‰€้œ€่ฟ่กŒ็š„ๆ—ถ้•ฟ๏ผŒ * ้‚ฃไนˆValueAnimatorๅฐฑไผš่‡ชๅŠจๅธฎๆˆ‘ไปฌๅฎŒๆˆไปŽๅˆๅง‹ๅ€ผๅนณๆป‘ๅœฐ่ฟ‡ๆธกๅˆฐ็ป“ๆŸๅ€ผ่ฟ™ๆ ท็š„ๆ•ˆๆžœใ€‚ * * @param last * @param current */ private void setAnimation(float last, float current, int length) { ValueAnimator progressAnimator = ValueAnimator.ofFloat(last, current); progressAnimator.setDuration(length); progressAnimator.setTarget(currentAngleLength); progressAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { currentAngleLength = (float) animation.getAnimatedValue(); invalidate(); } }); progressAnimator.start(); } }
UTF-8
Java
6,199
java
StepView.java
Java
[ { "context": "uchuanzheng.study_zidingyiview.R;\n\n/**\n * @author ๅˆ˜ไผ ๆ”ฟ\n * @date 2020/6/1 13:55\n * QQ:1052374416\n * ็”ต่ฏ:18", "end": 383, "score": 0.9998128414154053, "start": 380, "tag": "NAME", "value": "ๅˆ˜ไผ ๆ”ฟ" } ]
null
[]
package com.liuchuanzheng.study_zidingyiview.step; import android.animation.ValueAnimator; import android.content.Context; import android.graphics.Canvas; import android.graphics.Paint; import android.graphics.RectF; import android.util.AttributeSet; import android.view.View; import androidx.annotation.Nullable; import com.liuchuanzheng.study_zidingyiview.R; /** * @author ๅˆ˜ไผ ๆ”ฟ * @date 2020/6/1 13:55 * QQ:1052374416 * ็”ต่ฏ:18501231486 * ไฝœ็”จ: * ๆณจๆ„ไบ‹้กน: */ public class StepView extends View { /*ๅœ†ๅผงๅฎฝๅบฆ*/ private float borderWidth = 38f; /* ็”ปๆญฅๆ•ฐ็š„ๆ•ฐๅ€ผ็š„ๅญ—ไฝ“ๅคงๅฐ*/ private float numberTextSize = 0; /** * ๅผ€ๅง‹็ป˜ๅˆถๅœ†ๅผง็š„่ง’ๅบฆ */ private float startAngle = 135; /** * ็ปˆ็‚นๅฏนๅบ”็š„่ง’ๅบฆๅ’Œ่ตทๅง‹็‚นๅฏนๅบ”็š„่ง’ๅบฆ็š„ๅคน่ง’ */ private float angleLength = 270; /** * ๆ‰€่ฆ็ป˜ๅˆถ็š„ๅฝ“ๅ‰ๆญฅๆ•ฐ็š„็บข่‰ฒๅœ†ๅผง็ปˆ็‚นๅˆฐ่ตท็‚น็š„ๅคน่ง’ */ private float currentAngleLength = 0; private String stepNumber; /** * ๅŠจ็”ปๆ—ถ้•ฟ */ private int animationLength = 3000; public StepView(Context context) { super(context); } public StepView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); } public StepView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); /*ไธญๅฟƒ็‚นๅๆ ‡*/ float centerX = (getWidth()) / 2; /*ๆŒ‡ๅฎšๅœ†ๅผง็š„ๅค–่ฝฎๅป“็ŸฉๅฝขๅŒบๅŸŸ*/ RectF rectF = new RectF(0 + borderWidth, borderWidth, 2 * centerX - borderWidth, 2 * centerX - borderWidth); /*็ป˜ๅˆถ็บข่‰ฒๅœ†ๅผง*/ drawArcYellow(canvas, rectF); /*็ป˜ๅˆถ่“่‰ฒ่ตฐ่ฟ‡ๆญฅๆ•ฐ*/ drawArcRed(canvas, rectF); /*ๆ–‡ๅญ—*/ drawTex(canvas, rectF); } private void drawTex(Canvas canvas, RectF rectF) { Paint paint = new Paint(); paint.setColor(getResources().getColor(R.color.colorAccent)); paint.setAntiAlias(true); paint.setTextSize(32); int length = String.valueOf(currentAngleLength).length(); canvas.drawText(currentAngleLength + "", rectF.centerX() - 70, getHeight() / 2, paint); } /** * 1.็ป˜ๅˆถๆ€ปๆญฅๆ•ฐ็š„้ป„่‰ฒๅœ†ๅผง * * @param canvas ็”ป็ฌ” * @param rectF ๅ‚่€ƒ็š„็Ÿฉๅฝข */ private void drawArcYellow(Canvas canvas, RectF rectF) { Paint paint = new Paint(); paint.setColor(getResources().getColor(R.color.colorAccent)); /** ็ป“ๅˆๅค„ไธบๅœ†ๅผง*/ paint.setStrokeJoin(Paint.Join.ROUND); /** ่ฎพ็ฝฎ็”ป็ฌ”็š„ๆ ทๅผ Paint.Cap.Round ,Cap.SQUARE็ญ‰ๅˆ†ๅˆซไธบๅœ†ๅฝขใ€ๆ–นๅฝข*/ paint.setStrokeCap(Paint.Cap.ROUND); /** ่ฎพ็ฝฎ็”ป็ฌ”็š„ๅกซๅ……ๆ ทๅผ Paint.Style.FILL :ๅกซๅ……ๅ†…้ƒจ;Paint.Style.FILL_AND_STROKE ๏ผšๅกซๅ……ๅ†…้ƒจๅ’Œๆ่พน; Paint.Style.STROKE ๏ผšไป…ๆ่พน*/ paint.setStyle(Paint.Style.STROKE); /**ๆŠ—้”ฏ้ฝฟๅŠŸ่ƒฝ*/ paint.setAntiAlias(true); /**่ฎพ็ฝฎ็”ป็ฌ”ๅฎฝๅบฆ*/ paint.setStrokeWidth(38f); canvas.drawArc(rectF, startAngle, angleLength, false, paint); } /** * 2.็ป˜ๅˆถๅฝ“ๅ‰ๆญฅๆ•ฐ็š„่“่‰ฒๅœ†ๅผง * * @param canvas * @param rectF */ private void drawArcRed(Canvas canvas, RectF rectF) { Paint paint = new Paint(); /**่ฎพ็ฝฎ็ป“ๅˆๅค„็š„ๆ ทๅญ๏ผŒMiter:็ป“ๅˆๅค„ไธบ้”่ง’๏ผŒ Round:็ป“ๅˆๅค„ไธบๅœ†ๅผง๏ผšBEVEL๏ผš็ป“ๅˆๅค„ไธบ็›ด็บฟใ€‚*/ paint.setStrokeJoin(Paint.Join.ROUND); paint.setStyle(Paint.Style.STROKE);//่ฎพ็ฝฎๅกซๅ……ๆ ทๅผ /*** ๅฝ“็”ป็ฌ”ๆ ทๅผไธบSTROKEๆˆ–FILL_OR_STROKEๆ—ถ๏ผŒ่ฎพ็ฝฎ็ฌ”ๅˆท็š„ๅ›พๅฝขๆ ทๅผ๏ผŒๅฆ‚ๅœ†ๅฝขๆ ทๅผ Cap.ROUND,ๆˆ–ๆ–นๅฝขๆ ทๅผCap.SQUARE */ paint.setStrokeCap(Paint.Cap.ROUND); paint.setAntiAlias(true);//ๆŠ—้”ฏ้ฝฟๅŠŸ่ƒฝ paint.setStrokeWidth(borderWidth);//่ฎพ็ฝฎ็”ป็ฌ”ๅฎฝๅบฆ paint.setColor(getResources().getColor(R.color.colorPrimary)); canvas.drawArc(rectF, startAngle, currentAngleLength, false, paint); } /** * ๆ‰€่ตฐ็š„ๆญฅๆ•ฐ่ฟ›ๅบฆ * * @param totalStepNum ่ฎพ็ฝฎ็š„ๆญฅๆ•ฐ * @param currentCounts ๆ‰€่ตฐๆญฅๆ•ฐ */ public void setCurrentCount(int totalStepNum, int currentCounts) { stepNumber = currentCounts + ""; /**ๅฆ‚ๆžœๅฝ“ๅ‰่ตฐ็š„ๆญฅๆ•ฐ่ถ…่ฟ‡ๆ€ปๆญฅๆ•ฐๅˆ™ๅœ†ๅผง่ฟ˜ๆ˜ฏ270ๅบฆ๏ผŒไธ่ƒฝๆˆไธบๅ›ญ*/ if (currentCounts > totalStepNum) { currentCounts = totalStepNum; } /**ๆ‰€่ตฐๆญฅๆ•ฐๅ ็”จๆ€ปๅ…ฑๆญฅๆ•ฐ็š„็™พๅˆ†ๆฏ”*/ float scale = (float) currentCounts / totalStepNum; /**ๆข็ฎ—ๆˆๅผงๅบฆๆœ€ๅŽ่ฆๅˆฐ่พพ็š„่ง’ๅบฆ็š„้•ฟๅบฆ-->ๅผง้•ฟ*/ float currentAngleLength = scale * angleLength; /**ๅผ€ๅง‹ๆ‰ง่กŒๅŠจ็”ป*/ setAnimation(0, currentAngleLength, animationLength); } /** * ไธบ่ฟ›ๅบฆ่ฎพ็ฝฎๅŠจ็”ป * ValueAnimatorๆ˜ฏๆ•ดไธชๅฑžๆ€งๅŠจ็”ปๆœบๅˆถๅฝ“ไธญๆœ€ๆ ธๅฟƒ็š„ไธ€ไธช็ฑป๏ผŒๅฑžๆ€งๅŠจ็”ป็š„่ฟ่กŒๆœบๅˆถๆ˜ฏ้€š่ฟ‡ไธๆ–ญๅœฐๅฏนๅ€ผ่ฟ›่กŒๆ“ไฝœๆฅๅฎž็Žฐ็š„๏ผŒ * ่€Œๅˆๅง‹ๅ€ผๅ’Œ็ป“ๆŸๅ€ผไน‹้—ด็š„ๅŠจ็”ป่ฟ‡ๆธกๅฐฑๆ˜ฏ็”ฑValueAnimator่ฟ™ไธช็ฑปๆฅ่ดŸ่ดฃ่ฎก็ฎ—็š„ใ€‚ * ๅฎƒ็š„ๅ†…้ƒจไฝฟ็”จไธ€็งๆ—ถ้—ดๅพช็Žฏ็š„ๆœบๅˆถๆฅ่ฎก็ฎ—ๅ€ผไธŽๅ€ผไน‹้—ด็š„ๅŠจ็”ป่ฟ‡ๆธก๏ผŒ * ๆˆ‘ไปฌๅช้œ€่ฆๅฐ†ๅˆๅง‹ๅ€ผๅ’Œ็ป“ๆŸๅ€ผๆไพ›็ป™ValueAnimator๏ผŒๅนถไธ”ๅ‘Š่ฏ‰ๅฎƒๅŠจ็”ปๆ‰€้œ€่ฟ่กŒ็š„ๆ—ถ้•ฟ๏ผŒ * ้‚ฃไนˆValueAnimatorๅฐฑไผš่‡ชๅŠจๅธฎๆˆ‘ไปฌๅฎŒๆˆไปŽๅˆๅง‹ๅ€ผๅนณๆป‘ๅœฐ่ฟ‡ๆธกๅˆฐ็ป“ๆŸๅ€ผ่ฟ™ๆ ท็š„ๆ•ˆๆžœใ€‚ * * @param last * @param current */ private void setAnimation(float last, float current, int length) { ValueAnimator progressAnimator = ValueAnimator.ofFloat(last, current); progressAnimator.setDuration(length); progressAnimator.setTarget(currentAngleLength); progressAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { currentAngleLength = (float) animation.getAnimatedValue(); invalidate(); } }); progressAnimator.start(); } }
6,199
0.639984
0.627939
169
29.455622
24.047035
116
false
false
0
0
0
0
0
0
0.568047
false
false
13
161c796bef601ea1af1c683b2883da9f492a8825
33,389,075,759,513
ae6d14f29e1380164b5b35c475df0a1323bc6296
/app/src/main/java/android/coolweather/com/bestui/adapter/ProduceAdapter.java
8a6a5976e449a1fe8be7c90a7d667b3b340237c8
[]
no_license
zyxdSTU/BestUI
https://github.com/zyxdSTU/BestUI
eb10324aad70f8465dbe1ecf2febc7361588477b
61066e92c3d44b9ffa703429c01130c7598b4c93
refs/heads/master
2021-01-19T03:23:19.289000
2017-07-14T04:11:39
2017-07-14T04:11:39
87,310,104
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package android.coolweather.com.bestui.adapter; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.coolweather.com.bestui.ProduceItemActivity; import android.coolweather.com.bestui.R; import android.coolweather.com.bestui.util.HttpUtil; import android.coolweather.com.bestui.util.PreferenceManager; import android.support.v7.widget.RecyclerView; import android.util.Base64; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import android.coolweather.com.bestui.JavaBean.Produce; import com.bumptech.glide.Glide; import com.google.gson.Gson; import java.io.IOException; import java.util.ArrayList; import okhttp3.Call; import okhttp3.Callback; import okhttp3.Response; import static android.coolweather.com.bestui.util.HttpUtil.urlDownload; import static android.coolweather.com.bestui.util.HttpUtil.urlImage; /** * Created by Administrator on 2017/4/13. */ public class ProduceAdapter extends RecyclerView.Adapter<ProduceAdapter.ViewHolder> { private Context mContext; private ArrayList<Produce> mProduceList; static class ViewHolder extends RecyclerView.ViewHolder { ImageView produceImage; TextView produceName; TextView producePrice; public ViewHolder(View view) { super(view); produceImage = (ImageView) view.findViewById(R.id.produce_image); produceName = (TextView) view.findViewById(R.id.produce_name); producePrice = (TextView) view.findViewById(R.id.produce_price); } } public ProduceAdapter(ArrayList<Produce> produceArrayList) { mProduceList= produceArrayList; } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { if(mContext == null) { mContext = parent.getContext(); } View view = LayoutInflater.from(mContext).inflate(R.layout.produce_item, parent, false); final ViewHolder holder = new ViewHolder(view); /** * ๅ›พ็‰‡็‚นๅ‡ปไบ‹ไปถ */ holder.produceImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { int position = holder.getAdapterPosition(); Produce produce = mProduceList.get(position); Intent intent=new Intent(mContext, ProduceItemActivity.class); intent.putExtra("produce",new Gson().toJson(produce)); mContext.startActivity(intent); } }); return holder; } @Override public void onBindViewHolder(ViewHolder holder, int position) { Produce produce = mProduceList.get(position); String tempUrl = urlImage + produce.getImage(); loadImage(holder); holder.produceName.setText(produce.getName()); holder.producePrice.setText("ยฅ" + String.valueOf(produce.getPrice())); } @Override public int getItemCount() { return mProduceList.size(); } public void loadImage(final ViewHolder holder) { int position = holder.getAdapterPosition(); final Produce produce = mProduceList.get(position); /**ๅฆ‚ๆžœ็ผ“ๅญ˜ๆœ‰็›ดๆŽฅไปŽ็ผ“ๅญ˜ไธญๅŠ ่ฝฝ**/ if (!PreferenceManager.getInstance().preferenceManagerGet(String.valueOf(produce.getImage())).equals("")) { String imageString = PreferenceManager.getInstance().preferenceManagerGet(String.valueOf(produce.getImage())); byte[] imageByte = Base64.decode(imageString.getBytes(), Base64.DEFAULT); Glide.with(mContext).load(imageByte).into(holder.produceImage); } else { /**ไปŽ็ฝ‘็ปœๅŠ ่ฝฝ่ฟ›็ผ“ๅญ˜**/ HttpUtil.sendOkHttpRequest(urlDownload + String.valueOf(produce.getImage()), new Callback() { @Override public void onFailure(Call call, IOException e) { Log.d("MainActivity", "ไปŽ็ฝ‘็ปœๅŠ ่ฝฝๅ›พ็‰‡ๅคฑ่ดฅ"); } @Override public void onResponse(Call call, Response response) throws IOException { final byte[] imageByte = response.body().bytes(); if (mContext instanceof Activity) { Activity mActivity = (Activity) mContext; mActivity.runOnUiThread(new Runnable() { @Override public void run() { if (imageByte.length > 0) { Glide.with(mContext).load(imageByte).into(holder.produceImage); /**ๆทปๅŠ ่ฟ›็ผ“ๅญ˜**/ String imageString = new String(Base64.encodeToString(imageByte, Base64.DEFAULT)); PreferenceManager.getInstance().preferenceManagerSave(String.valueOf(produce.getImage()), imageString); } } }); } } }); } } }
UTF-8
Java
5,224
java
ProduceAdapter.java
Java
[]
null
[]
package android.coolweather.com.bestui.adapter; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.coolweather.com.bestui.ProduceItemActivity; import android.coolweather.com.bestui.R; import android.coolweather.com.bestui.util.HttpUtil; import android.coolweather.com.bestui.util.PreferenceManager; import android.support.v7.widget.RecyclerView; import android.util.Base64; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.TextView; import android.coolweather.com.bestui.JavaBean.Produce; import com.bumptech.glide.Glide; import com.google.gson.Gson; import java.io.IOException; import java.util.ArrayList; import okhttp3.Call; import okhttp3.Callback; import okhttp3.Response; import static android.coolweather.com.bestui.util.HttpUtil.urlDownload; import static android.coolweather.com.bestui.util.HttpUtil.urlImage; /** * Created by Administrator on 2017/4/13. */ public class ProduceAdapter extends RecyclerView.Adapter<ProduceAdapter.ViewHolder> { private Context mContext; private ArrayList<Produce> mProduceList; static class ViewHolder extends RecyclerView.ViewHolder { ImageView produceImage; TextView produceName; TextView producePrice; public ViewHolder(View view) { super(view); produceImage = (ImageView) view.findViewById(R.id.produce_image); produceName = (TextView) view.findViewById(R.id.produce_name); producePrice = (TextView) view.findViewById(R.id.produce_price); } } public ProduceAdapter(ArrayList<Produce> produceArrayList) { mProduceList= produceArrayList; } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { if(mContext == null) { mContext = parent.getContext(); } View view = LayoutInflater.from(mContext).inflate(R.layout.produce_item, parent, false); final ViewHolder holder = new ViewHolder(view); /** * ๅ›พ็‰‡็‚นๅ‡ปไบ‹ไปถ */ holder.produceImage.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { int position = holder.getAdapterPosition(); Produce produce = mProduceList.get(position); Intent intent=new Intent(mContext, ProduceItemActivity.class); intent.putExtra("produce",new Gson().toJson(produce)); mContext.startActivity(intent); } }); return holder; } @Override public void onBindViewHolder(ViewHolder holder, int position) { Produce produce = mProduceList.get(position); String tempUrl = urlImage + produce.getImage(); loadImage(holder); holder.produceName.setText(produce.getName()); holder.producePrice.setText("ยฅ" + String.valueOf(produce.getPrice())); } @Override public int getItemCount() { return mProduceList.size(); } public void loadImage(final ViewHolder holder) { int position = holder.getAdapterPosition(); final Produce produce = mProduceList.get(position); /**ๅฆ‚ๆžœ็ผ“ๅญ˜ๆœ‰็›ดๆŽฅไปŽ็ผ“ๅญ˜ไธญๅŠ ่ฝฝ**/ if (!PreferenceManager.getInstance().preferenceManagerGet(String.valueOf(produce.getImage())).equals("")) { String imageString = PreferenceManager.getInstance().preferenceManagerGet(String.valueOf(produce.getImage())); byte[] imageByte = Base64.decode(imageString.getBytes(), Base64.DEFAULT); Glide.with(mContext).load(imageByte).into(holder.produceImage); } else { /**ไปŽ็ฝ‘็ปœๅŠ ่ฝฝ่ฟ›็ผ“ๅญ˜**/ HttpUtil.sendOkHttpRequest(urlDownload + String.valueOf(produce.getImage()), new Callback() { @Override public void onFailure(Call call, IOException e) { Log.d("MainActivity", "ไปŽ็ฝ‘็ปœๅŠ ่ฝฝๅ›พ็‰‡ๅคฑ่ดฅ"); } @Override public void onResponse(Call call, Response response) throws IOException { final byte[] imageByte = response.body().bytes(); if (mContext instanceof Activity) { Activity mActivity = (Activity) mContext; mActivity.runOnUiThread(new Runnable() { @Override public void run() { if (imageByte.length > 0) { Glide.with(mContext).load(imageByte).into(holder.produceImage); /**ๆทปๅŠ ่ฟ›็ผ“ๅญ˜**/ String imageString = new String(Base64.encodeToString(imageByte, Base64.DEFAULT)); PreferenceManager.getInstance().preferenceManagerSave(String.valueOf(produce.getImage()), imageString); } } }); } } }); } } }
5,224
0.624976
0.620696
136
36.801472
30.327579
139
false
false
0
0
0
0
0
0
0.573529
false
false
13
26c1536a57ec59686f207550a33b9c2c5094de90
28,552,942,608,213
e566db41e373f6bdaa219f1b4d2d27f414c97104
/src/datastructures/Node.java
9a949f7f7ec38ec7eef508f7fb4b799963c9eeb2
[]
no_license
CanterFr/JavaWork
https://github.com/CanterFr/JavaWork
2a71ac7a834642827ff89f349f8f427d0048b159
b6e1d6ecb3953b6ab86c0f5a04f9994193db8f5d
refs/heads/master
2021-01-20T22:09:53.685000
2016-06-12T01:43:23
2016-06-12T01:43:23
60,934,960
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package datastructures; /** * * @author c.carrillo2014 */ public class Node <T extends Comparable<T>>{ public Node<T> left; public Node<T> right; public int height; public T data; public Node(Node<T> node) { if(node==null) { left = null; right = null; height = 0; data=null; } else { this.data = node.data; left = node.left; right = node.right; height = node.getHeight(); } } public Node(T data) { left = null; right = null; height = 0; this.data = data; } public T getData() { return data; } public int getHeight(){ return height; } public void increment(){ height++; } public boolean hasLeft(){ return left==null; } public boolean hasRight(){ return right == null; } public void setData(T data) { this.data = data; } @Override public String toString() { if(this == null) return ""; return data.toString(); } }
UTF-8
Java
1,197
java
Node.java
Java
[ { "context": "\n\npackage datastructures;\n/**\n *\n * @author c.carrillo2014\n */\npublic class Node <T extends Comparable<T>>{\n", "end": 58, "score": 0.9875683188438416, "start": 44, "tag": "USERNAME", "value": "c.carrillo2014" } ]
null
[]
package datastructures; /** * * @author c.carrillo2014 */ public class Node <T extends Comparable<T>>{ public Node<T> left; public Node<T> right; public int height; public T data; public Node(Node<T> node) { if(node==null) { left = null; right = null; height = 0; data=null; } else { this.data = node.data; left = node.left; right = node.right; height = node.getHeight(); } } public Node(T data) { left = null; right = null; height = 0; this.data = data; } public T getData() { return data; } public int getHeight(){ return height; } public void increment(){ height++; } public boolean hasLeft(){ return left==null; } public boolean hasRight(){ return right == null; } public void setData(T data) { this.data = data; } @Override public String toString() { if(this == null) return ""; return data.toString(); } }
1,197
0.461988
0.456976
67
16.835821
11.109491
44
false
false
0
0
0
0
0
0
0.38806
false
false
13
0ce5dc331978d3035266711364a2ded797807e85
28,552,942,607,733
a5c9d79326cb1a19742c26c043831be4bd977404
/app/src/main/java/com/mtecc/mmp/invoicing/activity/employee/SelectEmployeeListActivity.java
ce5550a652c59a475642d940ddbeffe7579d2a1c
[]
no_license
wanglili6/Invoicing
https://github.com/wanglili6/Invoicing
4b94876ef4f4834980ad30e4799a9a71a9187c84
832f5fa47c4658c852e4ea9689d28c6cb8d54085
refs/heads/master
2020-03-08T01:56:05.035000
2018-06-25T02:34:45
2018-06-25T02:34:45
127,844,875
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mtecc.mmp.invoicing.activity.employee; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; import com.apkfuns.logutils.LogUtils; import com.google.gson.Gson; import com.mtecc.mmp.invoicing.R; import com.mtecc.mmp.invoicing.activity.employee.adapter.SelectEmployeeListAdapter; import com.mtecc.mmp.invoicing.activity.employee.bean.EmployeeListBean; import com.mtecc.mmp.invoicing.base.BaseActivity; import com.mtecc.mmp.invoicing.base.InvoicingConstants; import com.mtecc.mmp.invoicing.utils.PreferencesUtils; import com.scwang.smartrefresh.layout.SmartRefreshLayout; import com.scwang.smartrefresh.layout.api.RefreshLayout; import com.scwang.smartrefresh.layout.listener.OnLoadmoreListener; import com.scwang.smartrefresh.layout.listener.OnRefreshListener; import com.zhy.http.okhttp.OkHttpUtils; import com.zhy.http.okhttp.callback.StringCallback; import java.util.ArrayList; import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; import okhttp3.Call; public class SelectEmployeeListActivity extends BaseActivity { @BindView(R.id.iv_back) ImageView ivBack; @BindView(R.id.tv_back) TextView tvBack; @BindView(R.id.rl_back) RelativeLayout rlBack; @BindView(R.id.tv_title) TextView tvTitle; @BindView(R.id.tv_select) TextView tvSelect; @BindView(R.id.rl_select) RelativeLayout rlSelect; @BindView(R.id.rl_title_bg) RelativeLayout rlTitleBg; @BindView(R.id.iv_bar_search) RelativeLayout ivBarSearch; @BindView(R.id.et_serch) EditText etSerch; @BindView(R.id.iv_serch) ImageView ivSerch; @BindView(R.id.img_select) ImageButton imgSelect; @BindView(R.id.rl_serch_bar) LinearLayout rlSerchBar; @BindView(R.id.tv_search) TextView tvSearch; @BindView(R.id.tv_error) TextView tvError; @BindView(R.id.shop_list_recycler_view) ListView shopListRecyclerView; @BindView(R.id.smart_refresh_layout) SmartRefreshLayout smartRefreshLayout; @BindView(R.id.tv_select_names) TextView tvSelectNames; @BindView(R.id.tv_select_sure) TextView tvSelectSure; private String employee_list_type = ""; private int pagenum = 1; List<EmployeeListBean.DataBean> mList = new ArrayList<>(); private SelectEmployeeListAdapter adapter; private String shopId; private String cid; private List<EmployeeListBean.DataBean> shopEmployeeList; @Override public void widgetClick(View v) { } @Override public void initParms(Bundle parms) { parms = getIntent().getExtras(); shopEmployeeList = (List<EmployeeListBean.DataBean>) parms.getSerializable(InvoicingConstants.shopEmployeeSelect); shopId = parms.getString(InvoicingConstants.shopId); ivBack.setVisibility(View.VISIBLE); imgSelect.setVisibility(View.VISIBLE); imgSelect.setBackgroundResource(R.mipmap.add_select); cid = PreferencesUtils.getInt(this, InvoicingConstants.QY_ID, 0) + ""; //ๅ…จ้ƒจๅ‘˜ๅทฅ tvTitle.setText("ๅ‘˜ๅทฅๅˆ—่กจ"); requestNetEmployeeList(pagenum + "", cid); shopListRecyclerView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); adapter = new SelectEmployeeListAdapter(this, mList, shopListRecyclerView, shopEmployeeList,tvSelectNames,tvSelectSure,shopId); shopListRecyclerView.setAdapter(adapter); adapter.notifyDataSetChanged(); smartRefreshLayout.setOnRefreshListener(new OnRefreshListener() { @Override public void onRefresh(RefreshLayout refreshlayout) { refreshlayout.finishRefresh(1500); mList.clear(); pagenum = 1; requestNetEmployeeList(pagenum + "", cid); adapter.notifyDataSetChanged(); } }); smartRefreshLayout.setOnLoadmoreListener(new OnLoadmoreListener() { @Override public void onLoadmore(RefreshLayout refreshlayout) { refreshlayout.finishLoadmore(1500); pagenum++; requestNetEmployeeList(pagenum + "", cid); } }); } @Override public View bindView() { return null; } @Override public int bindLayout() { return R.layout.activity_select_employee_list; } @Override public void initView(View view) { ButterKnife.bind(this); //่ฎพ็ฝฎrecycleView็š„ๅธƒๅฑ€็ฎก็†ๅ™จ } @Override public void setListener() { } @Override public void doBusiness(Context mContext) { } @OnClick({R.id.rl_back, R.id.iv_bar_search, R.id.tv_search, R.id.iv_serch, R.id.img_select}) public void onViewClicked(View view) { switch (view.getId()) { case R.id.rl_back: finish(); break; case R.id.iv_bar_search: //็‚นๅ‡ปๆœ็ดขๅ›พๆ ‡ rlSerchBar.setVisibility(View.VISIBLE); ivBarSearch.setVisibility(View.GONE); break; case R.id.tv_search: //็‚นๅ‡ปๆœ็ดข break; case R.id.iv_serch: //็‚นๅ‡ปๅ‰ๅท rlSerchBar.setVisibility(View.GONE); ivBarSearch.setVisibility(View.VISIBLE); etSerch.setText(""); break; case R.id.img_select: //็‚นๅ‡ปๅŠ ๅท Intent intent = new Intent(); Bundle bundle = new Bundle(); bundle.putString(InvoicingConstants.EMPLOYEE_TYPE, InvoicingConstants.companyEmployeeAdd); intent.setClass(this, EmployeeManagemnetActivity.class); intent.putExtras(bundle); startActivity(intent); break; } } /** * ๆŸฅ็œ‹ๅ…ฌๅธๅ‘˜ๅทฅ * * @param page * @param id */ private void requestNetEmployeeList(String page, String id) { String url = ""; url = InvoicingConstants.BASE_URL + InvoicingConstants.employee_listfortable_URL; LogUtils.d("็™ป้™†็š„url" + url); LogUtils.d("็™ป้™†็š„url" + id); OkHttpUtils.post().tag(this) .addParams("page", page) .addParams("cid", id) .url(url) .build() .execute(new StringCallback() { @Override public void onError(Call call, Exception e, int id) { try { LogUtils.d("้”™่ฏฏไฟกๆฏEmployeeListActivity" + e.toString()); Toast.makeText(SelectEmployeeListActivity.this, R.string.net_error, Toast.LENGTH_SHORT).show(); } catch (Exception e1) { LogUtils.d("้”™่ฏฏไฟกๆฏEmployeeListActivity" + e1.toString()); } } @Override public void onResponse(String response, int id) { try { LogUtils.d("่ฟ”ๅ›žๅ€ผไฟกๆฏEmployeeListActivity" + response.toString()); Gson gson = new Gson(); EmployeeListBean employeeListBean = gson.fromJson(response, EmployeeListBean.class); if (employeeListBean != null) { List<EmployeeListBean.DataBean> dataList = employeeListBean.getData(); if (dataList != null) { mList.addAll(dataList); adapter.notifyDataSetChanged(); shopListRecyclerView.setVisibility(View.VISIBLE); tvError.setVisibility(View.GONE); } else { shopListRecyclerView.setVisibility(View.GONE); tvError.setVisibility(View.VISIBLE); showToast("ๆš‚ๆ— ๆ•ฐๆฎ!"); } } else { Toast.makeText(SelectEmployeeListActivity.this, R.string.net_error, Toast.LENGTH_SHORT).show(); } } catch (Exception e1) { LogUtils.d("้”™่ฏฏไฟกๆฏEmployeeListActivity" + e1.toString()); Toast.makeText(SelectEmployeeListActivity.this, R.string.net_error, Toast.LENGTH_SHORT).show(); } } }); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // TODO: add setContentView(...) invocation ButterKnife.bind(this); } }
UTF-8
Java
9,232
java
SelectEmployeeListActivity.java
Java
[]
null
[]
package com.mtecc.mmp.invoicing.activity.employee; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.ImageButton; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.RelativeLayout; import android.widget.TextView; import android.widget.Toast; import com.apkfuns.logutils.LogUtils; import com.google.gson.Gson; import com.mtecc.mmp.invoicing.R; import com.mtecc.mmp.invoicing.activity.employee.adapter.SelectEmployeeListAdapter; import com.mtecc.mmp.invoicing.activity.employee.bean.EmployeeListBean; import com.mtecc.mmp.invoicing.base.BaseActivity; import com.mtecc.mmp.invoicing.base.InvoicingConstants; import com.mtecc.mmp.invoicing.utils.PreferencesUtils; import com.scwang.smartrefresh.layout.SmartRefreshLayout; import com.scwang.smartrefresh.layout.api.RefreshLayout; import com.scwang.smartrefresh.layout.listener.OnLoadmoreListener; import com.scwang.smartrefresh.layout.listener.OnRefreshListener; import com.zhy.http.okhttp.OkHttpUtils; import com.zhy.http.okhttp.callback.StringCallback; import java.util.ArrayList; import java.util.List; import butterknife.BindView; import butterknife.ButterKnife; import butterknife.OnClick; import okhttp3.Call; public class SelectEmployeeListActivity extends BaseActivity { @BindView(R.id.iv_back) ImageView ivBack; @BindView(R.id.tv_back) TextView tvBack; @BindView(R.id.rl_back) RelativeLayout rlBack; @BindView(R.id.tv_title) TextView tvTitle; @BindView(R.id.tv_select) TextView tvSelect; @BindView(R.id.rl_select) RelativeLayout rlSelect; @BindView(R.id.rl_title_bg) RelativeLayout rlTitleBg; @BindView(R.id.iv_bar_search) RelativeLayout ivBarSearch; @BindView(R.id.et_serch) EditText etSerch; @BindView(R.id.iv_serch) ImageView ivSerch; @BindView(R.id.img_select) ImageButton imgSelect; @BindView(R.id.rl_serch_bar) LinearLayout rlSerchBar; @BindView(R.id.tv_search) TextView tvSearch; @BindView(R.id.tv_error) TextView tvError; @BindView(R.id.shop_list_recycler_view) ListView shopListRecyclerView; @BindView(R.id.smart_refresh_layout) SmartRefreshLayout smartRefreshLayout; @BindView(R.id.tv_select_names) TextView tvSelectNames; @BindView(R.id.tv_select_sure) TextView tvSelectSure; private String employee_list_type = ""; private int pagenum = 1; List<EmployeeListBean.DataBean> mList = new ArrayList<>(); private SelectEmployeeListAdapter adapter; private String shopId; private String cid; private List<EmployeeListBean.DataBean> shopEmployeeList; @Override public void widgetClick(View v) { } @Override public void initParms(Bundle parms) { parms = getIntent().getExtras(); shopEmployeeList = (List<EmployeeListBean.DataBean>) parms.getSerializable(InvoicingConstants.shopEmployeeSelect); shopId = parms.getString(InvoicingConstants.shopId); ivBack.setVisibility(View.VISIBLE); imgSelect.setVisibility(View.VISIBLE); imgSelect.setBackgroundResource(R.mipmap.add_select); cid = PreferencesUtils.getInt(this, InvoicingConstants.QY_ID, 0) + ""; //ๅ…จ้ƒจๅ‘˜ๅทฅ tvTitle.setText("ๅ‘˜ๅทฅๅˆ—่กจ"); requestNetEmployeeList(pagenum + "", cid); shopListRecyclerView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); adapter = new SelectEmployeeListAdapter(this, mList, shopListRecyclerView, shopEmployeeList,tvSelectNames,tvSelectSure,shopId); shopListRecyclerView.setAdapter(adapter); adapter.notifyDataSetChanged(); smartRefreshLayout.setOnRefreshListener(new OnRefreshListener() { @Override public void onRefresh(RefreshLayout refreshlayout) { refreshlayout.finishRefresh(1500); mList.clear(); pagenum = 1; requestNetEmployeeList(pagenum + "", cid); adapter.notifyDataSetChanged(); } }); smartRefreshLayout.setOnLoadmoreListener(new OnLoadmoreListener() { @Override public void onLoadmore(RefreshLayout refreshlayout) { refreshlayout.finishLoadmore(1500); pagenum++; requestNetEmployeeList(pagenum + "", cid); } }); } @Override public View bindView() { return null; } @Override public int bindLayout() { return R.layout.activity_select_employee_list; } @Override public void initView(View view) { ButterKnife.bind(this); //่ฎพ็ฝฎrecycleView็š„ๅธƒๅฑ€็ฎก็†ๅ™จ } @Override public void setListener() { } @Override public void doBusiness(Context mContext) { } @OnClick({R.id.rl_back, R.id.iv_bar_search, R.id.tv_search, R.id.iv_serch, R.id.img_select}) public void onViewClicked(View view) { switch (view.getId()) { case R.id.rl_back: finish(); break; case R.id.iv_bar_search: //็‚นๅ‡ปๆœ็ดขๅ›พๆ ‡ rlSerchBar.setVisibility(View.VISIBLE); ivBarSearch.setVisibility(View.GONE); break; case R.id.tv_search: //็‚นๅ‡ปๆœ็ดข break; case R.id.iv_serch: //็‚นๅ‡ปๅ‰ๅท rlSerchBar.setVisibility(View.GONE); ivBarSearch.setVisibility(View.VISIBLE); etSerch.setText(""); break; case R.id.img_select: //็‚นๅ‡ปๅŠ ๅท Intent intent = new Intent(); Bundle bundle = new Bundle(); bundle.putString(InvoicingConstants.EMPLOYEE_TYPE, InvoicingConstants.companyEmployeeAdd); intent.setClass(this, EmployeeManagemnetActivity.class); intent.putExtras(bundle); startActivity(intent); break; } } /** * ๆŸฅ็œ‹ๅ…ฌๅธๅ‘˜ๅทฅ * * @param page * @param id */ private void requestNetEmployeeList(String page, String id) { String url = ""; url = InvoicingConstants.BASE_URL + InvoicingConstants.employee_listfortable_URL; LogUtils.d("็™ป้™†็š„url" + url); LogUtils.d("็™ป้™†็š„url" + id); OkHttpUtils.post().tag(this) .addParams("page", page) .addParams("cid", id) .url(url) .build() .execute(new StringCallback() { @Override public void onError(Call call, Exception e, int id) { try { LogUtils.d("้”™่ฏฏไฟกๆฏEmployeeListActivity" + e.toString()); Toast.makeText(SelectEmployeeListActivity.this, R.string.net_error, Toast.LENGTH_SHORT).show(); } catch (Exception e1) { LogUtils.d("้”™่ฏฏไฟกๆฏEmployeeListActivity" + e1.toString()); } } @Override public void onResponse(String response, int id) { try { LogUtils.d("่ฟ”ๅ›žๅ€ผไฟกๆฏEmployeeListActivity" + response.toString()); Gson gson = new Gson(); EmployeeListBean employeeListBean = gson.fromJson(response, EmployeeListBean.class); if (employeeListBean != null) { List<EmployeeListBean.DataBean> dataList = employeeListBean.getData(); if (dataList != null) { mList.addAll(dataList); adapter.notifyDataSetChanged(); shopListRecyclerView.setVisibility(View.VISIBLE); tvError.setVisibility(View.GONE); } else { shopListRecyclerView.setVisibility(View.GONE); tvError.setVisibility(View.VISIBLE); showToast("ๆš‚ๆ— ๆ•ฐๆฎ!"); } } else { Toast.makeText(SelectEmployeeListActivity.this, R.string.net_error, Toast.LENGTH_SHORT).show(); } } catch (Exception e1) { LogUtils.d("้”™่ฏฏไฟกๆฏEmployeeListActivity" + e1.toString()); Toast.makeText(SelectEmployeeListActivity.this, R.string.net_error, Toast.LENGTH_SHORT).show(); } } }); } @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // TODO: add setContentView(...) invocation ButterKnife.bind(this); } }
9,232
0.596395
0.594636
256
34.539063
26.499529
135
false
false
0
0
0
0
0
0
0.605469
false
false
13
4b2af82cddc169a3b61867dbcde9380b5334ef32
27,762,668,626,268
7b55c2df53c14ecfcd344062fe7f36b9ea217f29
/๋ฏผ๊ท /2์ฃผ์ฐจ/code_1292.java
5f12150d63dd05247db65646fd973ef9bb2f6004
[]
no_license
dvlops87/Algorithm_Study
https://github.com/dvlops87/Algorithm_Study
0a9ea5537759f3d916cd8895dd058f66d506bdf7
51753a87faf2689f8deacb07f09d89c3ba28dc97
refs/heads/main
2023-07-08T23:55:43.182000
2021-08-22T09:40:55
2021-08-22T09:40:55
379,687,501
2
5
null
false
2021-07-08T15:22:22
2021-06-23T17:53:45
2021-07-07T08:53:04
2021-07-08T15:22:21
76
2
3
0
Python
false
false
package baekjoon.study.week2; import java.util.ArrayList; import java.util.Scanner; public class code_1292 { public static void main(String[] args) { ArrayList<Integer> arr = new ArrayList<Integer>(); int num = 1; int count = 0; for (int i = 0; i < 1000; i++) { arr.add(num);count++; if (num == count) { num++; count = 0; } } Scanner sc = new Scanner(System.in); int num1 = sc.nextInt(); int num2 = sc.nextInt(); int sum = 0; for (int i = num1 - 1; i <= num2 - 1; i++) { sum += arr.get(i); } System.out.println(sum); sc.close(); } }
UTF-8
Java
733
java
code_1292.java
Java
[]
null
[]
package baekjoon.study.week2; import java.util.ArrayList; import java.util.Scanner; public class code_1292 { public static void main(String[] args) { ArrayList<Integer> arr = new ArrayList<Integer>(); int num = 1; int count = 0; for (int i = 0; i < 1000; i++) { arr.add(num);count++; if (num == count) { num++; count = 0; } } Scanner sc = new Scanner(System.in); int num1 = sc.nextInt(); int num2 = sc.nextInt(); int sum = 0; for (int i = num1 - 1; i <= num2 - 1; i++) { sum += arr.get(i); } System.out.println(sum); sc.close(); } }
733
0.463847
0.436562
32
21.84375
16.033382
58
false
false
0
0
0
0
0
0
0.65625
false
false
13
70d7b0e8d9d1da3cf61fc1ce21c8eccb0da664ee
944,892,835,567
c5881178f4117423d3f94ac778ca2feb738e8561
/canvas/src/test/java/gov/nasa/arc/mct/canvas/panel/PanelBorderTest.java
e265fded7b512add9b88b4efbbd835b1c27864ce
[]
no_license
alpearson/mct
https://github.com/alpearson/mct
5b772336621737904fb88e846904e2c5d4f2f58f
0007c2d13e83bcf388d495eba42ef9cae7dc30da
refs/heads/master
2021-01-24T05:28:34.295000
2012-09-21T21:43:26
2012-09-21T21:43:26
5,619,477
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/******************************************************************************* * Mission Control Technologies, Copyright (c) 2009-2012, United States Government * as represented by the Administrator of the National Aeronautics and Space * Administration. All rights reserved. * * The MCT platform is 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. * * MCT includes source code licensed under additional open source licenses. See * the MCT Open Source Licenses file included with this distribution or the About * MCT Licenses dialog available at runtime from the MCT Help menu for additional * information. *******************************************************************************/ package gov.nasa.arc.mct.canvas.panel; import java.awt.Color; import java.awt.Component; import java.awt.Graphics2D; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; public class PanelBorderTest { @Mock private Component c; @Mock private Graphics2D g1,g2; @BeforeMethod public void setup() { MockitoAnnotations.initMocks(this); } @Test public void testGraphicsContextNotReset() { PanelBorder panelBorder = new PanelBorder(Color.BLUE); Mockito.when(g1.create()).thenReturn(g2); panelBorder.paintBorder(c, g1, 0, 0, 10, 10); Mockito.verify(g1).create(); Mockito.verify(g1, Mockito.times(0)).setColor((Color)Mockito.anyObject()); Mockito.verify(g2,Mockito.atLeastOnce()).setColor(Color.BLUE); Mockito.verify(g2, Mockito.times(1)).dispose(); } }
UTF-8
Java
2,211
java
PanelBorderTest.java
Java
[]
null
[]
/******************************************************************************* * Mission Control Technologies, Copyright (c) 2009-2012, United States Government * as represented by the Administrator of the National Aeronautics and Space * Administration. All rights reserved. * * The MCT platform is 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. * * MCT includes source code licensed under additional open source licenses. See * the MCT Open Source Licenses file included with this distribution or the About * MCT Licenses dialog available at runtime from the MCT Help menu for additional * information. *******************************************************************************/ package gov.nasa.arc.mct.canvas.panel; import java.awt.Color; import java.awt.Component; import java.awt.Graphics2D; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.MockitoAnnotations; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; public class PanelBorderTest { @Mock private Component c; @Mock private Graphics2D g1,g2; @BeforeMethod public void setup() { MockitoAnnotations.initMocks(this); } @Test public void testGraphicsContextNotReset() { PanelBorder panelBorder = new PanelBorder(Color.BLUE); Mockito.when(g1.create()).thenReturn(g2); panelBorder.paintBorder(c, g1, 0, 0, 10, 10); Mockito.verify(g1).create(); Mockito.verify(g1, Mockito.times(0)).setColor((Color)Mockito.anyObject()); Mockito.verify(g2,Mockito.atLeastOnce()).setColor(Color.BLUE); Mockito.verify(g2, Mockito.times(1)).dispose(); } }
2,211
0.66938
0.65536
58
36.758621
29.175634
82
false
false
0
0
0
0
0
0
0.603448
false
false
13
7a17240c030944730c3b2874ded2bcfd787c76e0
9,629,316,712,780
1966aeb6b9c25dd91102f5a912d73de87ed213f3
/prysmradio/src/main/java/com/prysmradio/api/requests/NewsDetailsRequest.java
e8f30a68c4e205ea44b1466a26bf66529e7b369a
[]
no_license
deionalims/PrysmRadio
https://github.com/deionalims/PrysmRadio
cf73ea14d36cc4c51936db97cfc2f3d1ac431ae8
5aaa810c850aab3f0bb120dc6c57f404dca800a0
refs/heads/master
2021-01-17T10:15:05.980000
2014-11-23T21:31:15
2014-11-23T21:31:15
17,573,613
0
0
null
false
2014-05-03T23:35:31
2014-03-09T21:00:20
2014-05-03T23:35:30
2014-05-03T23:35:30
1,128
0
0
0
Java
null
null
package com.prysmradio.api.requests; import com.octo.android.robospice.request.retrofit.RetrofitSpiceRequest; import com.prysmradio.api.PrysmApi; import com.prysmradio.objects.News; /** * Created by fxoxe_000 on 12/05/2014. */ public class NewsDetailsRequest extends RetrofitSpiceRequest<News, PrysmApi> { public static String NEWS_DETAILS_REQUEST = "newsDetailsRequest"; private int newsId; private String lang; public NewsDetailsRequest(int id, String lang) { super(News.class, PrysmApi.class); this.newsId = id; this.lang = lang; } @Override public News loadDataFromNetwork() throws Exception { return getService().getNews(newsId); } }
UTF-8
Java
711
java
NewsDetailsRequest.java
Java
[ { "context": "rt com.prysmradio.objects.News;\n\n/**\n * Created by fxoxe_000 on 12/05/2014.\n */\npublic class NewsDetailsReques", "end": 211, "score": 0.9995975494384766, "start": 202, "tag": "USERNAME", "value": "fxoxe_000" } ]
null
[]
package com.prysmradio.api.requests; import com.octo.android.robospice.request.retrofit.RetrofitSpiceRequest; import com.prysmradio.api.PrysmApi; import com.prysmradio.objects.News; /** * Created by fxoxe_000 on 12/05/2014. */ public class NewsDetailsRequest extends RetrofitSpiceRequest<News, PrysmApi> { public static String NEWS_DETAILS_REQUEST = "newsDetailsRequest"; private int newsId; private String lang; public NewsDetailsRequest(int id, String lang) { super(News.class, PrysmApi.class); this.newsId = id; this.lang = lang; } @Override public News loadDataFromNetwork() throws Exception { return getService().getNews(newsId); } }
711
0.714487
0.699015
27
25.333334
24.361475
78
false
false
0
0
0
0
0
0
0.518519
false
false
13
7f8783f07a70ebf0b3323ccbb75f222381a55da6
9,706,626,105,129
916c315f4d922a47459cb8a14e32b08656457b92
/src/test/java/com/training/examples/stream_api/SimpleStreamTest.java
d6929777ee6ccdffce388a7124ae35edf4a94cb3
[]
no_license
vdvdev/unit-tests-example
https://github.com/vdvdev/unit-tests-example
b5e8b1aa2c6fe9b04779b241091e1640243eaf0b
750979009790e10b1bac714c0043a1781874c930
refs/heads/master
2020-03-21T05:05:34.764000
2018-12-25T14:30:31
2018-12-25T14:30:31
138,143,772
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.training.examples.stream_api; import org.junit.Test; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; public class SimpleStreamTest { @Test public void sumTest(){ List<Integer> integerList = Arrays.asList(2,3,4,6); System.out.println(integerList.stream().mapToInt(s->s).sum()); System.out.println(integerList.stream().reduce((s1,s2)-> s1+s2).orElse(0)); } @Test public void filterTest(){ String[] strings = {"abbs", "tresh", "3erw", "223"}; int reqLong = 4; System.out.println(Arrays.stream(strings).filter(s->s.length() == reqLong) .collect(Collectors.toList())); System.out.println(Arrays.stream(strings).parallel().filter(s->s.length() == reqLong) .count()); System.out.println(Arrays.stream(strings).filter(s->s.length() == reqLong) .collect(Collectors.joining(", "))); } @Test public void sortedTest(){ Integer[] ints = {3,15,9,7,9}; System.out.println( Arrays.stream(ints).distinct().filter(s -> s>3).sorted().collect(Collectors.toList()) ); } }
UTF-8
Java
1,193
java
SimpleStreamTest.java
Java
[]
null
[]
package com.training.examples.stream_api; import org.junit.Test; import java.util.Arrays; import java.util.List; import java.util.stream.Collectors; public class SimpleStreamTest { @Test public void sumTest(){ List<Integer> integerList = Arrays.asList(2,3,4,6); System.out.println(integerList.stream().mapToInt(s->s).sum()); System.out.println(integerList.stream().reduce((s1,s2)-> s1+s2).orElse(0)); } @Test public void filterTest(){ String[] strings = {"abbs", "tresh", "3erw", "223"}; int reqLong = 4; System.out.println(Arrays.stream(strings).filter(s->s.length() == reqLong) .collect(Collectors.toList())); System.out.println(Arrays.stream(strings).parallel().filter(s->s.length() == reqLong) .count()); System.out.println(Arrays.stream(strings).filter(s->s.length() == reqLong) .collect(Collectors.joining(", "))); } @Test public void sortedTest(){ Integer[] ints = {3,15,9,7,9}; System.out.println( Arrays.stream(ints).distinct().filter(s -> s>3).sorted().collect(Collectors.toList()) ); } }
1,193
0.601844
0.584241
37
31.243244
29.213478
101
false
false
0
0
0
0
0
0
0.72973
false
false
13
0e252ac98b25ecbc207911da1114bbea6218b5fd
678,604,869,259
0f64fdabcbf4650628509e14894fb9d5c244a5e3
/a2/src/test/java/view/UILogin.java
35f1b5033305d7f543349d521fc1875923a67849
[]
no_license
SorinUrcan/Assign2
https://github.com/SorinUrcan/Assign2
720de169fa2a60fbc25e5765e239d723d201b92b
731c2774c1d9bf8332fce78ffa26363303a78ad0
refs/heads/master
2021-04-03T10:14:03.855000
2018-03-12T09:57:08
2018-03-12T09:57:08
124,868,431
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package view; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JTextField; import javax.swing.UIManager; import control.Control; public class UILogin { private final Control control; private JFrame frame; private JTextField txtUsername; private JTextField textUsername; private JTextField txtPassword; private JTextField textPassword; /** * Create the application. */ public UILogin(Control control) { initialize(); this.control = control; } /** * Initialize the contents of the frame. */ private void initialize() { frame = new JFrame(); frame.setBounds(100, 100, 394, 320); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(null); txtUsername = new JTextField(); txtUsername.setBackground(UIManager.getColor("Button.background")); txtUsername.setColumns(10); txtUsername.setEditable(false); txtUsername.setText("Username:"); txtUsername.setBounds(93, 77, 91, 20); frame.getContentPane().add(txtUsername); textUsername = new JTextField(); textUsername.setBounds(194, 77, 86, 20); frame.getContentPane().add(textUsername); textUsername.setColumns(10); txtPassword = new JTextField(); txtPassword.setEditable(false); txtPassword.setText("Password:"); txtPassword.setBounds(93, 108, 91, 20); frame.getContentPane().add(txtPassword); txtPassword.setColumns(10); textPassword = new JTextField(); textPassword.setBounds(194, 108, 86, 20); frame.getContentPane().add(textPassword); textPassword.setColumns(10); JButton btnLogin = new JButton("Login"); btnLogin.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (textUsername.getText().equals("") || textPassword.getText().equals("")) JOptionPane.showMessageDialog(null, "Empty input fields!"); else { control.loginButtonClicked(); } } }); btnLogin.setBounds(134, 154, 89, 23); frame.getContentPane().add(btnLogin); } public void showLoginWindow() { this.frame.setVisible(true); } /** * @return the textUsername */ public String getTextUsername() { return this.textUsername.getText(); } /** * @return the textPassword */ public String getTextPassword() { return this.textPassword.getText(); } }
UTF-8
Java
2,414
java
UILogin.java
Java
[]
null
[]
package view; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JTextField; import javax.swing.UIManager; import control.Control; public class UILogin { private final Control control; private JFrame frame; private JTextField txtUsername; private JTextField textUsername; private JTextField txtPassword; private JTextField textPassword; /** * Create the application. */ public UILogin(Control control) { initialize(); this.control = control; } /** * Initialize the contents of the frame. */ private void initialize() { frame = new JFrame(); frame.setBounds(100, 100, 394, 320); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(null); txtUsername = new JTextField(); txtUsername.setBackground(UIManager.getColor("Button.background")); txtUsername.setColumns(10); txtUsername.setEditable(false); txtUsername.setText("Username:"); txtUsername.setBounds(93, 77, 91, 20); frame.getContentPane().add(txtUsername); textUsername = new JTextField(); textUsername.setBounds(194, 77, 86, 20); frame.getContentPane().add(textUsername); textUsername.setColumns(10); txtPassword = new JTextField(); txtPassword.setEditable(false); txtPassword.setText("Password:"); txtPassword.setBounds(93, 108, 91, 20); frame.getContentPane().add(txtPassword); txtPassword.setColumns(10); textPassword = new JTextField(); textPassword.setBounds(194, 108, 86, 20); frame.getContentPane().add(textPassword); textPassword.setColumns(10); JButton btnLogin = new JButton("Login"); btnLogin.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (textUsername.getText().equals("") || textPassword.getText().equals("")) JOptionPane.showMessageDialog(null, "Empty input fields!"); else { control.loginButtonClicked(); } } }); btnLogin.setBounds(134, 154, 89, 23); frame.getContentPane().add(btnLogin); } public void showLoginWindow() { this.frame.setVisible(true); } /** * @return the textUsername */ public String getTextUsername() { return this.textUsername.getText(); } /** * @return the textPassword */ public String getTextPassword() { return this.textPassword.getText(); } }
2,414
0.719967
0.692626
101
22.90099
18.124163
79
false
false
0
0
0
0
0
0
2.128713
false
false
13
c45885df478985836ce4f3b9259eaa3e6145007b
678,604,872,499
e68e1d6dbf89d09093d10777fac1a3efb6515bb3
/ADDREV.java
e80622259e096ee3ee72bc1caa3f3cfc05d45ecf
[]
no_license
kshitij123/Collections
https://github.com/kshitij123/Collections
744dbc8b14b8ceb6cf22a340573581e64da5469c
5628b9cfaa9b6c82287a692703375f2b243e7395
refs/heads/master
2020-05-18T05:03:22.750000
2013-02-27T04:37:24
2013-02-27T04:37:24
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.Scanner; class ADDREV { static StringBuilder s = null; public static void main(String[] args) { Scanner in = new Scanner(System.in); String[] s=null; String s1 = null; int cases = Integer.parseInt(in.nextLine()); while (cases != 0){ s1 = in.nextLine(); s=s1.split(" "); System.out.println(""+(rev(rev(Integer.parseInt(s[0]))+rev(Integer.parseInt(s[1]))))); cases--; } }// main ends here private static int rev(int number) { int res = 0; while (number > 0) { res = res*10 + number%10; number /= 10; } return res; } }// class ends here
UTF-8
Java
758
java
ADDREV.java
Java
[]
null
[]
import java.util.Scanner; class ADDREV { static StringBuilder s = null; public static void main(String[] args) { Scanner in = new Scanner(System.in); String[] s=null; String s1 = null; int cases = Integer.parseInt(in.nextLine()); while (cases != 0){ s1 = in.nextLine(); s=s1.split(" "); System.out.println(""+(rev(rev(Integer.parseInt(s[0]))+rev(Integer.parseInt(s[1]))))); cases--; } }// main ends here private static int rev(int number) { int res = 0; while (number > 0) { res = res*10 + number%10; number /= 10; } return res; } }// class ends here
758
0.486807
0.468338
34
21.264706
19.790533
98
false
false
0
0
0
0
0
0
0.411765
false
false
13
eaac92165cd7c9f622c48753bfd96a053b40d652
17,789,754,567,248
41fe59ea9a363730543d8d9d1b475546e2fd4e08
/src/main/java/com/wewebu/ow/server/ecmimpl/opencmis/ui/OwCMISUILoginModule.java
62213c479795c606ef1eecc8b85f01531a320d6e
[]
no_license
flashboss/workdesk
https://github.com/flashboss/workdesk
49a8c99e864edf121a31f2b043803ef0e36af633
fcf280c918c7d895d55be166e32c7c214045d367
refs/heads/master
2016-08-11T05:37:44.452000
2015-05-22T14:56:27
2015-05-22T14:56:27
36,077,649
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.wewebu.ow.server.ecmimpl.opencmis.ui; import java.io.Writer; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.log4j.Logger; import com.wewebu.ow.server.ecm.ui.OwUILoginModul; import com.wewebu.ow.server.ecmimpl.opencmis.OwCMISAuthenticatedNetwork; import com.wewebu.ow.server.ecmimpl.opencmis.log.OwLog; import com.wewebu.ow.server.exceptions.OwException; import com.wewebu.ow.server.exceptions.OwServerException; import com.wewebu.ow.server.ui.OwAppContext; import com.wewebu.ow.server.util.OwHTMLHelper; import com.wewebu.ow.server.util.OwString; /** *<p> * Login module for basic authentication. *</p> * *<p><font size="-2"> * Alfresco Workdesk<br/> * Copyright (c) Alfresco Software, Inc.<br/> * All rights reserved.<br/> * <br/> * For licensing information read the license.txt file or<br/> * go to: http://wiki.alfresco.com<br/> *</font></p> */ public class OwCMISUILoginModule<N extends OwCMISAuthenticatedNetwork> extends OwUILoginModul<N> { /** Logger for this class */ private static final Logger LOG = OwLog.getLogger(OwCMISUILoginModule.class); public static final String INPUT_NAME = "loginName"; public static final String INPUT_PWD = "loginPwd"; /** temporary saves the login name */ private String strUserName; /** render the view and all contained views * @param w_p Writer object to write HTML to */ protected void onRender(Writer w_p) throws Exception { renderLoginForm(w_p); } public void init(N theNetwork_p) throws OwException { try { super.init(theNetwork_p); } catch (OwException e) { throw e; } catch (Exception ex) { LOG.fatal("OwCMISUILoginModule.init(): Failed to initialize the CMIS login module", ex); throw new OwServerException(new OwString("opencmis.ui.OwCMISUILoginModule.err.init", "Failed to initialize the CMIS login module!"), ex); } } @Override protected void init() throws Exception { super.init(); if (getNetwork().getAuthInterceptor() != null) { enableRequestListener(); } } /** render the view and all contained views * @param w_p Writer object to write HTML to */ protected void renderLoginForm(Writer w_p) throws Exception { String submitEvent = getEventURL("Login", null); // === enable return key for login getContext().registerKeyFormEvent(OwAppContext.KEYBOARD_KEY_RETURN, OwAppContext.KEYBOARD_CTRLKEY_NONE, submitEvent, "loginForm", getContext().localize("opencmis.ui.OwCMISUILoginModule.login", "Login")); // write the form w_p.write("<form name=\"loginForm\" method=\"post\" action=\""); w_p.write(submitEvent); w_p.write("\">\n"); renderErrors(w_p); w_p.write("\n <div class=\"OwLoginModule\">\n"); w_p.write(" <div class=\"OwLoginModuleTitle\">\n "); w_p.write(getContext().localize("opencmis.ui.OwCMISUILoginModule.title", "CMIS Login")); w_p.write("\n </div>\n <div class=\"OwLoginModuleLogin\">\n <div class=\"block blockLabel\">\n <label for=\"loginNameId\">"); w_p.write(getContext().localize("opencmis.ui.OwCMISUILoginModule.name", "Name:")); w_p.write("</label>\n <input id=\"loginNameId\" type=\"text\" size=\"30\" name=\""); w_p.write(INPUT_NAME); w_p.write("\" value=\""); if (strUserName != null) { OwHTMLHelper.writeSecureHTML(w_p, strUserName); } w_p.write("\" />"); w_p.write("\n <label for=\"loginPasswordId\">"); w_p.write(getContext().localize("opencmis.ui.OwCMISUILoginModule.password", "Password:")); w_p.write("</label>\n <input id=\"loginPasswordId\" type=\"password\" size=\"30\" name=\""); w_p.write(INPUT_PWD); w_p.write("\" />\n </div>\n <div class=\"block\">\n"); // write the button for login w_p.write(" <input type=\"submit\" value=\""); w_p.write(getContext().localize("opencmis.ui.OwCMISUILoginModule.login", "Login")); w_p.write("\" />\n"); // write the button for reset w_p.write(" <input type=\"button\" onclick=\"window.location.href ='"); String resetEvent = getEventURL("Reset", null); w_p.write(resetEvent); w_p.write("';\" onkeydown=\"return onKey(event,13,true,function(event){window.location.href='"); w_p.write(resetEvent); w_p.write("';});\" value=\""); w_p.write(getContext().localize("opencmis.ui.OwCMISUILoginModule.reset", "Reset")); w_p.write("\" />\n </div>\n </div>\n </div>\n\n"); w_p.write("</form>\n"); // set focus to NAME element or if last name was restored to the password element, see Bug 874 if ((strUserName != null) && (strUserName.length() > 0)) {// forward to password, name has been restored from last trial getContext().setFocusControlID(INPUT_PWD); } else { getContext().setFocusControlID(INPUT_NAME); } } /** event called when user pressed login in the login submodule * @param request_p a {@link HttpServletRequest} */ public void onLogin(HttpServletRequest request_p) throws Exception { strUserName = request_p.getParameter(INPUT_NAME); // log user in getNetwork().loginDefault(strUserName, request_p.getParameter(INPUT_PWD)); disableRequestListener(); strUserName = null; } /** event called when user pressed reset in the login submodule * @param request_p a {@link HttpServletRequest} */ public void onReset(HttpServletRequest request_p) throws Exception { this.strUserName = null; } @Override public boolean onRequest(HttpServletRequest request_p, HttpServletResponse response_p) throws Exception { if (getNetwork().getAuthInterceptor().onRequest(request_p, response_p)) { getNetwork().loginDefault("", ""); disableRequestListener(); return true; } else { return getNetwork().getAuthInterceptor().processRendering(request_p, response_p); } } }
UTF-8
Java
6,638
java
OwCMISUILoginModule.java
Java
[ { "context": "\";\r\n\r\n public static final String INPUT_PWD = \"loginPwd\";\r\n\r\n /** temporary saves the login name */\r\n ", "end": 1307, "score": 0.9990431666374207, "start": 1299, "tag": "PASSWORD", "value": "loginPwd" } ]
null
[]
package com.wewebu.ow.server.ecmimpl.opencmis.ui; import java.io.Writer; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.apache.log4j.Logger; import com.wewebu.ow.server.ecm.ui.OwUILoginModul; import com.wewebu.ow.server.ecmimpl.opencmis.OwCMISAuthenticatedNetwork; import com.wewebu.ow.server.ecmimpl.opencmis.log.OwLog; import com.wewebu.ow.server.exceptions.OwException; import com.wewebu.ow.server.exceptions.OwServerException; import com.wewebu.ow.server.ui.OwAppContext; import com.wewebu.ow.server.util.OwHTMLHelper; import com.wewebu.ow.server.util.OwString; /** *<p> * Login module for basic authentication. *</p> * *<p><font size="-2"> * Alfresco Workdesk<br/> * Copyright (c) Alfresco Software, Inc.<br/> * All rights reserved.<br/> * <br/> * For licensing information read the license.txt file or<br/> * go to: http://wiki.alfresco.com<br/> *</font></p> */ public class OwCMISUILoginModule<N extends OwCMISAuthenticatedNetwork> extends OwUILoginModul<N> { /** Logger for this class */ private static final Logger LOG = OwLog.getLogger(OwCMISUILoginModule.class); public static final String INPUT_NAME = "loginName"; public static final String INPUT_PWD = "<PASSWORD>"; /** temporary saves the login name */ private String strUserName; /** render the view and all contained views * @param w_p Writer object to write HTML to */ protected void onRender(Writer w_p) throws Exception { renderLoginForm(w_p); } public void init(N theNetwork_p) throws OwException { try { super.init(theNetwork_p); } catch (OwException e) { throw e; } catch (Exception ex) { LOG.fatal("OwCMISUILoginModule.init(): Failed to initialize the CMIS login module", ex); throw new OwServerException(new OwString("opencmis.ui.OwCMISUILoginModule.err.init", "Failed to initialize the CMIS login module!"), ex); } } @Override protected void init() throws Exception { super.init(); if (getNetwork().getAuthInterceptor() != null) { enableRequestListener(); } } /** render the view and all contained views * @param w_p Writer object to write HTML to */ protected void renderLoginForm(Writer w_p) throws Exception { String submitEvent = getEventURL("Login", null); // === enable return key for login getContext().registerKeyFormEvent(OwAppContext.KEYBOARD_KEY_RETURN, OwAppContext.KEYBOARD_CTRLKEY_NONE, submitEvent, "loginForm", getContext().localize("opencmis.ui.OwCMISUILoginModule.login", "Login")); // write the form w_p.write("<form name=\"loginForm\" method=\"post\" action=\""); w_p.write(submitEvent); w_p.write("\">\n"); renderErrors(w_p); w_p.write("\n <div class=\"OwLoginModule\">\n"); w_p.write(" <div class=\"OwLoginModuleTitle\">\n "); w_p.write(getContext().localize("opencmis.ui.OwCMISUILoginModule.title", "CMIS Login")); w_p.write("\n </div>\n <div class=\"OwLoginModuleLogin\">\n <div class=\"block blockLabel\">\n <label for=\"loginNameId\">"); w_p.write(getContext().localize("opencmis.ui.OwCMISUILoginModule.name", "Name:")); w_p.write("</label>\n <input id=\"loginNameId\" type=\"text\" size=\"30\" name=\""); w_p.write(INPUT_NAME); w_p.write("\" value=\""); if (strUserName != null) { OwHTMLHelper.writeSecureHTML(w_p, strUserName); } w_p.write("\" />"); w_p.write("\n <label for=\"loginPasswordId\">"); w_p.write(getContext().localize("opencmis.ui.OwCMISUILoginModule.password", "Password:")); w_p.write("</label>\n <input id=\"loginPasswordId\" type=\"password\" size=\"30\" name=\""); w_p.write(INPUT_PWD); w_p.write("\" />\n </div>\n <div class=\"block\">\n"); // write the button for login w_p.write(" <input type=\"submit\" value=\""); w_p.write(getContext().localize("opencmis.ui.OwCMISUILoginModule.login", "Login")); w_p.write("\" />\n"); // write the button for reset w_p.write(" <input type=\"button\" onclick=\"window.location.href ='"); String resetEvent = getEventURL("Reset", null); w_p.write(resetEvent); w_p.write("';\" onkeydown=\"return onKey(event,13,true,function(event){window.location.href='"); w_p.write(resetEvent); w_p.write("';});\" value=\""); w_p.write(getContext().localize("opencmis.ui.OwCMISUILoginModule.reset", "Reset")); w_p.write("\" />\n </div>\n </div>\n </div>\n\n"); w_p.write("</form>\n"); // set focus to NAME element or if last name was restored to the password element, see Bug 874 if ((strUserName != null) && (strUserName.length() > 0)) {// forward to password, name has been restored from last trial getContext().setFocusControlID(INPUT_PWD); } else { getContext().setFocusControlID(INPUT_NAME); } } /** event called when user pressed login in the login submodule * @param request_p a {@link HttpServletRequest} */ public void onLogin(HttpServletRequest request_p) throws Exception { strUserName = request_p.getParameter(INPUT_NAME); // log user in getNetwork().loginDefault(strUserName, request_p.getParameter(INPUT_PWD)); disableRequestListener(); strUserName = null; } /** event called when user pressed reset in the login submodule * @param request_p a {@link HttpServletRequest} */ public void onReset(HttpServletRequest request_p) throws Exception { this.strUserName = null; } @Override public boolean onRequest(HttpServletRequest request_p, HttpServletResponse response_p) throws Exception { if (getNetwork().getAuthInterceptor().onRequest(request_p, response_p)) { getNetwork().loginDefault("", ""); disableRequestListener(); return true; } else { return getNetwork().getAuthInterceptor().processRendering(request_p, response_p); } } }
6,640
0.600181
0.598373
172
36.593021
34.567219
211
false
false
0
0
0
0
0
0
0.569767
false
false
13
63031d873fc53eff7b07284fda4ef1a3e109a982
19,954,418,096,244
ade8f8de5c976bf8d098dce2cc695d15b25e078b
/src/main/java/co/edu/unicartagena/alertsystem/domain/enumdomain/TipoEmpresa.java
07cbfe35c4b3fd81467dec5d845c1f7f297de4a7
[]
no_license
Pedrioko/AS-sever
https://github.com/Pedrioko/AS-sever
881f971d9da57d44292f144b01543ee45aee49ab
dc4abd80393a91096ca69e27534dd819de6784f3
refs/heads/master
2019-06-28T17:37:07.160000
2018-03-22T04:52:01
2018-03-22T04:52:01
101,360,485
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package co.edu.unicartagena.alertsystem.domain.enumdomain; /** * The Enum TipoEmpresa. */ public enum TipoEmpresa { /** The entidadhotel. */ ENTIDADHOTEL, /** The entidadcontrol. */ ENTIDADCONTROL, /** The entidadestatal. */ ENTIDADESTATAL, /** The entidadestandar. */ ENTIDADESTANDAR, /** The entidadsalud. */ ENTIDADSALUD, /** The entidadturismo. */ ENTIDADTURISMO, /** The seguro. */ SEGURO; }
UTF-8
Java
424
java
TipoEmpresa.java
Java
[]
null
[]
package co.edu.unicartagena.alertsystem.domain.enumdomain; /** * The Enum TipoEmpresa. */ public enum TipoEmpresa { /** The entidadhotel. */ ENTIDADHOTEL, /** The entidadcontrol. */ ENTIDADCONTROL, /** The entidadestatal. */ ENTIDADESTATAL, /** The entidadestandar. */ ENTIDADESTANDAR, /** The entidadsalud. */ ENTIDADSALUD, /** The entidadturismo. */ ENTIDADTURISMO, /** The seguro. */ SEGURO; }
424
0.67217
0.67217
29
13.620689
13.51988
58
false
false
0
0
0
0
0
0
0.827586
false
false
13
de0196a7d75142a349b138dc306561449232f71a
7,189,775,266,320
755d08c2d5aaa9787469b4b15e134cf89a061a0b
/src/main/java/com/thingtek/view/panel/manager/DataManagerPanel.java
7c521113221322505c597820fc967c1048457c29
[]
no_license
chosoma/CJYCLIENT1.0
https://github.com/chosoma/CJYCLIENT1.0
0757502cb49f083d6b1eb8b5bf1ceed66ad56530
3809cebece111f95a0268b6ae59bbda2c7dcc6d7
refs/heads/master
2020-04-01T08:31:35.316000
2018-10-29T00:34:15
2018-10-29T00:34:15
153,034,728
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.thingtek.view.panel.manager; import com.thingtek.database.domain.DataBean; import com.thingtek.database.domain.EntityBean; import com.thingtek.database.domain.UnitBean; import com.thingtek.database.service.DataService; import com.thingtek.database.service.UnitService; import com.thingtek.view.panel.BasePanel; import com.thingtek.view.panel.manager.dataManagerComponent.DataManageModel; import com.thingtek.view.panel.manager.dataManagerComponent.TableRenderer; import org.springframework.stereotype.Component; import javax.annotation.Resource; import javax.swing.*; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.JTableHeader; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Vector; @Component public class DataManagerPanel extends BasePanel { private JPanel toolPanel; private JComboBox<String> jcbSnids; @Resource private DataService dataService; @Resource private UnitService unitService; public DataManagerPanel init() { setLayout(new BorderLayout()); initTool(); initCenter(); return this; } private void initTool() { toolPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); toolPanel.setBackground(Color.WHITE); JTextArea jtaSnid = new JTextArea("่ฎพๅค‡็ผ–ๅท:"); jtaSnid.setEnabled(false); jtaSnid.setOpaque(false); toolPanel.add(jtaSnid); Vector<String> snid = new Vector<>(); snid.addAll(unitService.getSnids()); jcbSnids = new JComboBox<>(snid); jcbSnids.setSelectedItem(null); toolPanel.add(jcbSnids); JButton search = new JButton("ๆŸฅ่ฏข"); search.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String snid = (String) jcbSnids.getSelectedItem(); UnitBean unitBean = unitService.getUnitBySnid(snid); model = new DataManageModel(unitBean); table.setModel(model); java.util.List<Vector<Object>> datas = new ArrayList<>(); List<DataBean> databeans = dataService.findBySNID(new EntityBean(snid, null, null)); for (DataBean data : databeans) { datas.add(data.getTableData(unitBean)); } model.addDatas(datas); } }); toolPanel.add(search); add(toolPanel, BorderLayout.NORTH); } private JTable table; private DataManageModel model; private void initCenter() { table = new JTable(); initializeTable(); JScrollPane jScrollPane = new JScrollPane(table); add(jScrollPane, BorderLayout.CENTER); } private void initializeTable() { TableRenderer tcr = new TableRenderer(); table.setDefaultRenderer(String.class, tcr); table.setDefaultRenderer(Number.class, tcr); table.setDefaultRenderer(Float.class, tcr); table.setDefaultRenderer(Double.class, tcr); table.setDefaultRenderer(Date.class, tcr); // ่กจๅคด่ฎพ็ฝฎ JTableHeader tableHeader = table.getTableHeader(); DefaultTableCellRenderer dtcr = (DefaultTableCellRenderer) tableHeader.getDefaultRenderer(); dtcr.setHorizontalAlignment(SwingConstants.CENTER);// ่กจๅคดๅฑ…ไธญ Dimension dimension = dtcr.getSize(); dimension.height = 40; dtcr.setPreferredSize(dimension);// ่ฎพ็ฝฎ่กจๅคด้ซ˜ๅบฆ tableHeader.setDefaultRenderer(dtcr); // ่กจๅคดไธๅฏๆ‹–ๅŠจ tableHeader.setReorderingAllowed(false); // ๅˆ—ๅฎฝไธๅฏไฟฎๆ”น tableHeader.setResizingAllowed(false); // ่‡ชๅŠจๆŽ’ๅบ table.setAutoCreateRowSorter(true); table.setRowHeight(20);// ่ฎพ็ฝฎ่กŒ้ซ˜ } @Override public Color getBackground() { return Color.WHITE; } }
UTF-8
Java
4,041
java
DataManagerPanel.java
Java
[]
null
[]
package com.thingtek.view.panel.manager; import com.thingtek.database.domain.DataBean; import com.thingtek.database.domain.EntityBean; import com.thingtek.database.domain.UnitBean; import com.thingtek.database.service.DataService; import com.thingtek.database.service.UnitService; import com.thingtek.view.panel.BasePanel; import com.thingtek.view.panel.manager.dataManagerComponent.DataManageModel; import com.thingtek.view.panel.manager.dataManagerComponent.TableRenderer; import org.springframework.stereotype.Component; import javax.annotation.Resource; import javax.swing.*; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.JTableHeader; import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Vector; @Component public class DataManagerPanel extends BasePanel { private JPanel toolPanel; private JComboBox<String> jcbSnids; @Resource private DataService dataService; @Resource private UnitService unitService; public DataManagerPanel init() { setLayout(new BorderLayout()); initTool(); initCenter(); return this; } private void initTool() { toolPanel = new JPanel(new FlowLayout(FlowLayout.LEFT)); toolPanel.setBackground(Color.WHITE); JTextArea jtaSnid = new JTextArea("่ฎพๅค‡็ผ–ๅท:"); jtaSnid.setEnabled(false); jtaSnid.setOpaque(false); toolPanel.add(jtaSnid); Vector<String> snid = new Vector<>(); snid.addAll(unitService.getSnids()); jcbSnids = new JComboBox<>(snid); jcbSnids.setSelectedItem(null); toolPanel.add(jcbSnids); JButton search = new JButton("ๆŸฅ่ฏข"); search.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String snid = (String) jcbSnids.getSelectedItem(); UnitBean unitBean = unitService.getUnitBySnid(snid); model = new DataManageModel(unitBean); table.setModel(model); java.util.List<Vector<Object>> datas = new ArrayList<>(); List<DataBean> databeans = dataService.findBySNID(new EntityBean(snid, null, null)); for (DataBean data : databeans) { datas.add(data.getTableData(unitBean)); } model.addDatas(datas); } }); toolPanel.add(search); add(toolPanel, BorderLayout.NORTH); } private JTable table; private DataManageModel model; private void initCenter() { table = new JTable(); initializeTable(); JScrollPane jScrollPane = new JScrollPane(table); add(jScrollPane, BorderLayout.CENTER); } private void initializeTable() { TableRenderer tcr = new TableRenderer(); table.setDefaultRenderer(String.class, tcr); table.setDefaultRenderer(Number.class, tcr); table.setDefaultRenderer(Float.class, tcr); table.setDefaultRenderer(Double.class, tcr); table.setDefaultRenderer(Date.class, tcr); // ่กจๅคด่ฎพ็ฝฎ JTableHeader tableHeader = table.getTableHeader(); DefaultTableCellRenderer dtcr = (DefaultTableCellRenderer) tableHeader.getDefaultRenderer(); dtcr.setHorizontalAlignment(SwingConstants.CENTER);// ่กจๅคดๅฑ…ไธญ Dimension dimension = dtcr.getSize(); dimension.height = 40; dtcr.setPreferredSize(dimension);// ่ฎพ็ฝฎ่กจๅคด้ซ˜ๅบฆ tableHeader.setDefaultRenderer(dtcr); // ่กจๅคดไธๅฏๆ‹–ๅŠจ tableHeader.setReorderingAllowed(false); // ๅˆ—ๅฎฝไธๅฏไฟฎๆ”น tableHeader.setResizingAllowed(false); // ่‡ชๅŠจๆŽ’ๅบ table.setAutoCreateRowSorter(true); table.setRowHeight(20);// ่ฎพ็ฝฎ่กŒ้ซ˜ } @Override public Color getBackground() { return Color.WHITE; } }
4,041
0.670538
0.669528
118
32.567795
21.848663
100
false
false
0
0
0
0
0
0
0.720339
false
false
13
74d9e97130b6e016da8f5fd29260c9944370aaec
8,074,538,555,093
f43cedbc19f48c966579241c761f922b115230f1
/hw06/src/main/java/hr/fer/zemris/java/hw06/shell/commands/SymbolShellCommand.java
886a8b116c4bc4a5979255bf4e30613aad084614
[]
no_license
tonimartincic/basics-of-programming-language-java-homeworks
https://github.com/tonimartincic/basics-of-programming-language-java-homeworks
f6ebbd18feb7a8ce0c2ad2247c9a1a1ef3358149
6885bae36cb7a2eb441a366824ab4449b457576b
refs/heads/master
2022-11-30T23:17:31.907000
2018-09-12T21:19:00
2018-09-12T21:19:00
231,240,177
0
0
null
false
2022-11-24T07:43:33
2020-01-01T16:45:51
2020-01-01T16:46:21
2022-11-24T07:43:31
10,486
0
0
21
HTML
false
false
package hr.fer.zemris.java.hw06.shell.commands; import java.util.ArrayList; import java.util.Collections; import java.util.List; import hr.fer.zemris.java.hw06.shell.Environment; import hr.fer.zemris.java.hw06.shell.ShellCommand; import hr.fer.zemris.java.hw06.shell.ShellStatus; /** * This class represents shell command symbol. It can be called with 1 or 2 arguments. * First argument must be name of the symbol. If there is no second argument then command prints * the symbol for the accepted symbol name. If there is second argument, it must symbol which will be new * symbol for accepted symbol name. * * @author Toni Martinฤiฤ‡ * @version 1.0 */ public class SymbolShellCommand implements ShellCommand { /** * Environment of the command. */ private Environment env; @Override public ShellStatus executeCommand(Environment env, String arguments) { this.env = env; if(arguments == null) { env.writeln("Argument must not be null."); return ShellStatus.CONTINUE; } ArgumentParser argumentParser = new ArgumentParser(arguments); List<String> parts = argumentParser.parse(); if(parts.size() != 1 && parts.size() != 2) { env.writeln("Number of arguments must be 1 or 2."); return ShellStatus.CONTINUE; } if(!parts.get(0).equals("PROMPT") && !parts.get(0).equals("MORELINES") && !parts.get(0).equals("MULTILINE")) { env.writeln("Invalid name of the symbol."); return ShellStatus.CONTINUE; } if(parts.size() == 1) { printSymbol(parts.get(0)); } else { if(parts.get(1).length() != 1) { env.writeln("Length of the symbol must be 1."); return ShellStatus.CONTINUE; } changeSymbol(parts.get(0), parts.get(1)); } return ShellStatus.CONTINUE; } /** * Method prints symbol for the accepted symbol name. * * @param symbolName symbol name of the symbol which is printed */ private void printSymbol(String symbolName) { char symbol = 0; switch(symbolName) { case "PROMPT" : symbol = env.getPromptSymbol(); break; case "MORELINES" : symbol = env.getMorelinesSymbol(); break; case "MULTILINE" : symbol = env.getMultilineSymbol(); } env.writeln("Symbol for " + symbolName + " is '" + symbol + "'."); } /** * Method changes symbol for accepted symbol name. It sets symbol to newSymbol. * * @param symbolName name of the symbol which is changed * @param newSymbol new symbol */ private void changeSymbol(String symbolName, String newSymbol) { char symbol = newSymbol.toCharArray()[0]; char oldSymbol = 0; switch(symbolName) { case "PROMPT" : if(symbol == env.getPromptSymbol()) { env.writeln("New symbol is equal to current symbol."); } else { oldSymbol = env.getPromptSymbol(); env.setPromptSymbol(symbol); } break; case "MORELINES" : if(symbol == env.getMorelinesSymbol()) { env.writeln("New symbol is equal to current symbol."); } else { oldSymbol = env.getMorelinesSymbol(); env.setMorelinesSymbol(symbol); } break; case "MULTILINE" : if(symbol == env.getMultilineSymbol()) { env.writeln("New symbol is equal to current symbol."); } else { oldSymbol = env.getMultilineSymbol(); env.setMultilineSymbol(symbol); } } env.writeln("Symbol for " + symbolName + " changed from '" + oldSymbol + "' to '" + symbol + "'."); } @Override public String getCommandName() { return "symbol"; } @Override public List<String> getCommandDescription() { List<String> description = new ArrayList<>(); description.add("Command can be called with one or two arguments."); description.add("First argument can be PROMPTSYMBOL, MORELINESSYMBOL and MULTILINESYMBOL."); description.add("If it is called with one argument it prints that symbol."); description.add("Command symbol can be used to change PROMPTSYMBOL, MORELINESSYMBOL or" + " MULTILINESYMBOL when it is called with two arguments."); description.add("Second argument is new symbol"); return Collections.unmodifiableList(description); } }
UTF-8
Java
4,118
java
SymbolShellCommand.java
Java
[ { "context": "* symbol for accepted symbol name. \n * \n * @author Toni Martinฤiฤ‡\n * @version 1.0\n */\npublic class SymbolShellComma", "end": 644, "score": 0.9998289942741394, "start": 630, "tag": "NAME", "value": "Toni Martinฤiฤ‡" } ]
null
[]
package hr.fer.zemris.java.hw06.shell.commands; import java.util.ArrayList; import java.util.Collections; import java.util.List; import hr.fer.zemris.java.hw06.shell.Environment; import hr.fer.zemris.java.hw06.shell.ShellCommand; import hr.fer.zemris.java.hw06.shell.ShellStatus; /** * This class represents shell command symbol. It can be called with 1 or 2 arguments. * First argument must be name of the symbol. If there is no second argument then command prints * the symbol for the accepted symbol name. If there is second argument, it must symbol which will be new * symbol for accepted symbol name. * * @author <NAME> * @version 1.0 */ public class SymbolShellCommand implements ShellCommand { /** * Environment of the command. */ private Environment env; @Override public ShellStatus executeCommand(Environment env, String arguments) { this.env = env; if(arguments == null) { env.writeln("Argument must not be null."); return ShellStatus.CONTINUE; } ArgumentParser argumentParser = new ArgumentParser(arguments); List<String> parts = argumentParser.parse(); if(parts.size() != 1 && parts.size() != 2) { env.writeln("Number of arguments must be 1 or 2."); return ShellStatus.CONTINUE; } if(!parts.get(0).equals("PROMPT") && !parts.get(0).equals("MORELINES") && !parts.get(0).equals("MULTILINE")) { env.writeln("Invalid name of the symbol."); return ShellStatus.CONTINUE; } if(parts.size() == 1) { printSymbol(parts.get(0)); } else { if(parts.get(1).length() != 1) { env.writeln("Length of the symbol must be 1."); return ShellStatus.CONTINUE; } changeSymbol(parts.get(0), parts.get(1)); } return ShellStatus.CONTINUE; } /** * Method prints symbol for the accepted symbol name. * * @param symbolName symbol name of the symbol which is printed */ private void printSymbol(String symbolName) { char symbol = 0; switch(symbolName) { case "PROMPT" : symbol = env.getPromptSymbol(); break; case "MORELINES" : symbol = env.getMorelinesSymbol(); break; case "MULTILINE" : symbol = env.getMultilineSymbol(); } env.writeln("Symbol for " + symbolName + " is '" + symbol + "'."); } /** * Method changes symbol for accepted symbol name. It sets symbol to newSymbol. * * @param symbolName name of the symbol which is changed * @param newSymbol new symbol */ private void changeSymbol(String symbolName, String newSymbol) { char symbol = newSymbol.toCharArray()[0]; char oldSymbol = 0; switch(symbolName) { case "PROMPT" : if(symbol == env.getPromptSymbol()) { env.writeln("New symbol is equal to current symbol."); } else { oldSymbol = env.getPromptSymbol(); env.setPromptSymbol(symbol); } break; case "MORELINES" : if(symbol == env.getMorelinesSymbol()) { env.writeln("New symbol is equal to current symbol."); } else { oldSymbol = env.getMorelinesSymbol(); env.setMorelinesSymbol(symbol); } break; case "MULTILINE" : if(symbol == env.getMultilineSymbol()) { env.writeln("New symbol is equal to current symbol."); } else { oldSymbol = env.getMultilineSymbol(); env.setMultilineSymbol(symbol); } } env.writeln("Symbol for " + symbolName + " changed from '" + oldSymbol + "' to '" + symbol + "'."); } @Override public String getCommandName() { return "symbol"; } @Override public List<String> getCommandDescription() { List<String> description = new ArrayList<>(); description.add("Command can be called with one or two arguments."); description.add("First argument can be PROMPTSYMBOL, MORELINESSYMBOL and MULTILINESYMBOL."); description.add("If it is called with one argument it prints that symbol."); description.add("Command symbol can be used to change PROMPTSYMBOL, MORELINESSYMBOL or" + " MULTILINESYMBOL when it is called with two arguments."); description.add("Second argument is new symbol"); return Collections.unmodifiableList(description); } }
4,108
0.676628
0.669582
157
25.21656
25.39555
106
false
false
0
0
0
0
0
0
2.229299
false
false
13
de10985bd24f029ad3d717bcb1ae3e3bb2252fb7
29,549,375,000,618
b3127cb9856a92bdf8f2176cf94ab829c6ef7ff1
/src/test/java/piswib/tests/CiTest.java
feeb19a6df0ad396977502192e1bb2e4e7f44b42
[]
no_license
dawid0kubiak/piswibTests
https://github.com/dawid0kubiak/piswibTests
f653bfaa72bf099aa759f230daf75d645e17f9bd
7bbb80424c4e67c5d031d603faf60a6c3ef1454e
refs/heads/master
2020-03-08T03:47:14.092000
2018-06-06T07:30:51
2018-06-06T07:30:51
127,901,045
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package piswib.tests; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import piswib.BaseSeleniumPiswib; public class CiTest extends BaseSeleniumPiswib { @BeforeClass public void setUpTest() { } @Test public void viewPage() { } }
UTF-8
Java
290
java
CiTest.java
Java
[]
null
[]
package piswib.tests; import org.testng.annotations.BeforeClass; import org.testng.annotations.Test; import piswib.BaseSeleniumPiswib; public class CiTest extends BaseSeleniumPiswib { @BeforeClass public void setUpTest() { } @Test public void viewPage() { } }
290
0.72069
0.72069
18
15.111111
16.203186
48
false
false
0
0
0
0
0
0
0.222222
false
false
13
7290785c20e6888be82b4d4ba0abc19ec811f026
32,521,492,426,027
bebb17d92ddbc77abdcea45a7d6b50567f5eb330
/bsoft-attendance/src/main/java/com/bsoft/attendance/service/impl/ProjectLogServiceImpl.java
0e20211d6e4d1f233a02e26a06352e43b89a595b
[]
no_license
bellmit/kernel
https://github.com/bellmit/kernel
da0bd58abcf961292b1b06059f6e82476b9d1112
737ae18f766dc602d1075bdada17662beb9d2a38
refs/heads/master
2023-04-25T06:15:06.814000
2021-05-19T05:36:37
2021-05-19T05:36:37
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.bsoft.attendance.service.impl; import com.bsoft.attendance.condition.ProjectLogQueryCnd; import com.bsoft.attendance.dto.*; import com.bsoft.attendance.entity.primary.*; import com.bsoft.attendance.manager.AttendanceManager; import com.bsoft.attendance.manager.ProjectLogManager; import com.bsoft.attendance.service.ProjectLogService; import com.bsoft.common.dozer.IGenerator; import com.bsoft.common.dto.PublicDicDTO; import com.bsoft.common.entity.primary.PublicDicDO; import com.bsoft.common.key.KeyGenerator; import com.bsoft.common.manager.PublicDicManager; import com.bsoft.common.manager.ServerDateManager; import com.bsoft.common.performance.TimeConsumer; import com.bsoft.common.result.Result; import com.bsoft.common.utils.ResultUtils; import com.bsoft.attendance.condition.WorkLogAuditCnd; import com.bsoft.project.dto.ProjectWorkLogSituationDTO; import com.bsoft.project.entity.primary.ProjectBaseDO; import com.bsoft.project.manager.ProjectGroupManager; import com.bsoft.project.dto.ProjectBaseDTO; import com.bsoft.attendance.dto.ProjectLogDTO; import com.bsoft.attendance.dto.ProjectLogBaseDTO; import com.github.pagehelper.PageInfo; import com.google.common.collect.Lists; import org.apache.dubbo.config.annotation.Service; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import java.sql.Date; import java.util.Comparator; import java.util.List; @Service public class ProjectLogServiceImpl implements ProjectLogService { private final static Logger logger = LoggerFactory.getLogger(ProjectLogServiceImpl.class); @Autowired private ProjectLogManager projectLogManager; @Autowired private IGenerator generator; @Autowired private ProjectGroupManager projectGroupManager; @Autowired private AttendanceManager attendanceManager; @Autowired private KeyGenerator keyGenerator; @Autowired private ServerDateManager serverDateManager; @Autowired private PublicDicManager publicDicManager; @Override public List<ProjectLogDTO> getProjectWorkLogs(String projectId, String personId, Integer milepostId, Date attendanceDate) { List<ProjectLogDO> list = projectLogManager.getProjectWorkLogs(projectId,personId, milepostId,attendanceDate); return generator.convert(list,ProjectLogDTO.class); } @Override public List<ProjectLogDTO> getProjectWorkLogs(String personId, java.util.Date attendanceDate) { List<ProjectLogViewDO> projectWorkLogs = projectLogManager.getProjectWorkLogs(personId, attendanceDate); return generator.convert(projectWorkLogs,ProjectLogDTO.class); } @Override public List<ProjectLogDTO> getProjectWorkLogsWithNoTechnum(String projectId, String personId, java.util.Date attendanceDate) { List<ProjectLogDO> list = projectLogManager.getProjectWorkLogsWithNoTechnum(projectId,personId,attendanceDate); return generator.convert(list,ProjectLogDTO.class); } @Override public List<ProjectLogDTO> getProjectWorkLogsWithNoTechnum(String personId, java.util.Date attendanceDate) { List<ProjectLogDO> list = projectLogManager.getProjectWorkLogsWithNoTechnum(null,personId,attendanceDate); return generator.convert(list,ProjectLogDTO.class); } @Override public int getProjectWorkLogSituation(String submitter, java.util.Date attendanceDate) { return projectLogManager.getProjectLogSituation(submitter,attendanceDate); } @Override public List<ProjectLogDTO> saveProjectLogsAndWorkLogs(String personId, ProjectLogBaseDTO projectLogBaseDTO, List<ProjectLogDTO> list,Integer flag) { List<ProjectLogDO> logs = generator.convert(list,ProjectLogDO.class); Integer auditType = null; if(projectLogBaseDTO.getContractNo() != null){ auditType = getAuditType(personId,projectLogBaseDTO.getContractNo()); } for(ProjectLogDO log : logs){ if(log.getWorkLogId() == null){ Integer id = keyGenerator.increaseWorkLog(); if(projectLogBaseDTO.getContractNo() == null){ auditType = getAuditType(personId,log.getContractNo()); } log.setWorkLogId(id); log.setAuditType(auditType); } log.setNextAuditter(projectLogManager.getLeaderOrProjectManager(log.getSubmitter(),log.getProjectId())); } // logs = projectLogManager.saveProjectLogsAndWorkLogs(personId, projectLogBaseDTO,logs); logs = projectLogManager.saveProjectLogsAndWorkLogs(personId, projectLogBaseDTO,logs,flag); return generator.convert(logs,ProjectLogDTO.class); } private Integer getAuditType(String personId,String contractNo){ Boolean isLeader = projectGroupManager.isLeader(personId, contractNo); Boolean haveLeader = projectGroupManager.haveLeader(personId, contractNo);//ๅˆคๆ–ญๆ˜ฏๅฆๆœ‰็ป„้•ฟ int auditType; if(isLeader || !haveLeader){ auditType = 2; }else{ auditType = 1; } return auditType; } @Override public ProjectLogDTO editProjectLogAndWorkLog(String personId, String contractNo, Date attendanceDate, String projectName, ProjectLogDTO projectLog, Boolean projectChangeFlag,Integer flag) { ProjectLogDO log = generator.convert(projectLog,ProjectLogDO.class); if (projectChangeFlag) { log.setRefuse(0); } Boolean isLeader = projectGroupManager.isLeader(personId,contractNo); Boolean haveLeader = projectGroupManager.haveLeader(personId,contractNo);//ๅˆคๆ–ญๆ˜ฏๅฆๆœ‰็ป„้•ฟ int auditType; if(isLeader || !haveLeader){ auditType = 2; }else{ auditType = 1; } log.setAuditType(auditType); log.setNextAuditter(projectLogManager.getLeaderOrProjectManager(log.getSubmitter(),log.getProjectId())); java.util.Date now = serverDateManager.getServerDateTime(); log.setSubmitDate(now); log.setProjectName(projectName); AttendanceDO attendanceDO = attendanceManager.getAttendance(personId, attendanceDate); ProjectLogBaseDTO projectLogBaseDTO = new ProjectLogBaseDTO(); projectLogBaseDTO.setContractNo(contractNo); projectLogBaseDTO.setAttendanceDate(attendanceDate); projectLogBaseDTO.setHouseId(attendanceDO.getRentId()); projectLogBaseDTO.setHouseType(attendanceDO.getStay()); projectLogBaseDTO.setEvection(attendanceDO.getEvection()); // List<ProjectLogDO> logs = projectLogManager.saveProjectLogsAndWorkLogs(personId, projectLogBaseDTO, Lists.newArrayList(log)); List<ProjectLogDO> logs = projectLogManager.saveProjectLogsAndWorkLogs(personId, projectLogBaseDTO, Lists.newArrayList(log),flag); return generator.convert(logs.get(0),ProjectLogDTO.class); } @Override public List<ProjectWorkLogSituationDTO> getProjectWorkLogSituation(String personId, Integer days) { List<ProjectLogSituationDO> result = projectLogManager.getLastSituation(personId,days); return generator.convert(result,ProjectWorkLogSituationDTO.class); } @Override public ProjectBaseDTO getLastestProjectBase(String personId) { ProjectBaseDO customerProjectDO = projectLogManager.getLastestProjectBase(personId); return generator.convert(customerProjectDO, ProjectBaseDTO.class); } @Override public Result<ProjectBaseDTO> searchProjectsWithCommon(String personId, String context, Integer pageNo, Integer pageSize) { PageInfo<ProjectBaseDO> pageInfo = projectLogManager.searchProjectsWithCommon(personId,context,pageNo,pageSize); return ResultUtils.parseResult(pageInfo,ProjectBaseDTO.class); } @Override public ProjectLogDTO getProjectLog(Integer id) { ProjectLogDO projectLog = projectLogManager.getProjectLog(id); return generator.convert(projectLog,ProjectLogDTO.class); } @Override public void deleteProjectLog(Integer id) { projectLogManager.deleteProjectLog(id); } @Override public List<ProjectLogDTO> saveProjectLogs(List<ProjectLogDTO> logs) { List<ProjectLogDO> projectLogs = generator.convert(logs,ProjectLogDO.class); projectLogs = projectLogManager.saveProjectLogs(projectLogs); return generator.convert(projectLogs,ProjectLogDTO.class); } @Override public List<ProjectLogDTO> getByMilepostId(List<Integer> milePostId) { List<ProjectLogDO> projectLogDO = projectLogManager.getByMilepostId(milePostId); return generator.convert(projectLogDO, ProjectLogDTO.class); } @Override public void auditProjectLog(ProjectLogAuditDTO projectLogAuditDTO) { ProjectLogAuditDO projectLogAudit = generator.convert(projectLogAuditDTO,ProjectLogAuditDO.class); projectLogAudit = projectLogManager.processProjectLogType(projectLogAudit); projectLogManager.auditProjectLog(projectLogAudit); } @Override public void auditProjectLogs(List<ProjectLogAuditDTO> projectLogAuditDTO) { List<ProjectLogAuditDO> projectLogAudits = generator.convert(projectLogAuditDTO,ProjectLogAuditDO.class); projectLogAudits.forEach(log->{ log = projectLogManager.processProjectLogType(log); projectLogManager.auditProjectLog(log); }); } @Override public Result<ProjectPlanQueryLogDTO> getProjectPlanQueryLogList(Integer pageSize, Integer pageNo, Integer milepostId, String contractNo) { TimeConsumer timeConsumer = TimeConsumer.start(); Page<ProjectPlanQueryLogDO> logs = projectLogManager.getProjectPlanQueryLogList(pageSize, pageNo, milepostId, contractNo); long times = timeConsumer.end(); logger.info("้กน็›ฎ่ฎกๅˆ’ๆŸฅ่ฏข-ๆ—ฅๅฟ—ๅˆ—่กจ่€—ๆ—ถ:{},้˜ถๆฎตid:{},ๅˆๅŒๅท:{}",new Object[]{times,milepostId,contractNo}); return ResultUtils.parseResult(logs, ProjectPlanQueryLogDTO.class); } @Override public Result<ProjectLogNeedAuditDTO> getProjectLogNeedAudit(String auditter, WorkLogAuditCndDTO params, Integer page, Integer size) { WorkLogAuditCnd workLogAuditCnd = generator.convert(params,WorkLogAuditCnd.class); Page<ProjectLogNeedAuditDO> result = projectLogManager.getProjectLogNeedAudit(auditter,workLogAuditCnd,page,size); return ResultUtils.parseResult(result,ProjectLogNeedAuditDTO.class); } @Override public ProjectLogNeedDealCountDTO getWorkLogsCount(String userId) { TimeConsumer timeConsumer = TimeConsumer.start(); ProjectLogNeedDealCountDO count = projectLogManager.getWorkLogsCount(userId); long times = timeConsumer.end(); logger.info("่Žทๅ–ๆ‰€ๆœ‰ๅพ…ๅŠž่€—ๆ—ถ:{}",new Object[]{count,times}); return generator.convert(count,ProjectLogNeedDealCountDTO.class); } @Override public Integer getProjectLogAuditCount(Integer projectLogId) { Integer count = projectLogManager.getProjectLogAuditCount(projectLogId); return count; } @Override public List<PublicDicDTO> getProjectLogRoles() { TimeConsumer timeConsumer = TimeConsumer.start(); List<PublicDicDO> roles = publicDicManager.getPublicDic(2003); roles.sort(Comparator.comparing(PublicDicDO::getSort)); long times = timeConsumer.end(); logger.info("่Žทๅ–็ป“ๆž„ๅŒ–ๆ—ฅๅฟ—่ง’่‰ฒ่€—ๆ—ถ:{}",times); return generator.convert(roles, PublicDicDTO.class); } @Override public List<PublicDicDTO> getProjectLogTypes() { TimeConsumer timeConsumer = TimeConsumer.start(); List<PublicDicDO> types = publicDicManager.getPublicDic(2004); types.sort(Comparator.comparing(PublicDicDO::getSort)); long times = timeConsumer.end(); logger.info("่Žทๅ–็ป“ๆž„ๅŒ–ๆ—ฅๅฟ—็ฑปๅˆซ่€—ๆ—ถ:{}",times); return generator.convert(types, PublicDicDTO.class); } @Override public Boolean haveProjectLogs(String personId) { Integer size = projectLogManager.countProjectLogs(personId); return size > 0; } @Override public Result<ProjectWithAuditDTO> getProjectWithAuditList(String userId,WorkLogAuditCndDTO params, Integer pageNo, Integer pageSize) { TimeConsumer timeConsumer = TimeConsumer.start(); WorkLogAuditCnd workLogAuditCnd = generator.convert(params,WorkLogAuditCnd.class); PageInfo<ProjectWithAuditDO> pageInfo = projectLogManager.getProjectWithAuditList(userId,workLogAuditCnd,pageNo,pageSize); // List<ProjectWithAuditDTO> projectWithAuditDTOS = generator.convert(projectWithAuditDOS, ProjectWithAuditDTO.class); // Integer count = projectLogManager.countProjectWithAuditCount(userId); Result<ProjectWithAuditDTO> result = ResultUtils.parseResult(pageInfo,ProjectWithAuditDTO.class); long times = timeConsumer.end(); logger.info("่Žทๅ–็™ปๅฝ•ไบบๆ‰€ๅฑž็š„ๆ‰€ๆœ‰้กน็›ฎ่€—ๆ—ถ:{}",new Object[]{times}); return result; } @Override public Result<ProjectLogQueryProjectDTO> getProjectLogQueryProjectList(ProjectLogQueryCndDTO params) { TimeConsumer timeConsumer = TimeConsumer.start(); ProjectLogQueryCnd cnd = generator.convert(params, ProjectLogQueryCnd.class); PageInfo<ProjectLogQueryProjectDO> projects = projectLogManager.getProjectLogQueryProjectList(cnd); long times = timeConsumer.end(); logger.info("่Žทๅ–็™ปๅฝ•ไบบๅกซๅ†™ๆ—ฅๅฟ—ๆˆ–็™ปๅฝ•ไบบไธบ้กน็›ฎ็ป็†็š„้กน็›ฎๅˆ—่กจ่€—ๆ—ถ:{},ๅทฅๅท:{}",new Object[]{times,params.getUserId()}); return ResultUtils.parseResult(projects, ProjectLogQueryProjectDTO.class); } @Override public Result<ProjectLogQueryDetailDTO> getProjectLogQueryLogList(ProjectLogQueryCndDTO params, String inputContent, String projectId) { TimeConsumer timeConsumer = TimeConsumer.start(); ProjectLogQueryCnd cnd = generator.convert(params, ProjectLogQueryCnd.class); Page<ProjectLogQueryDetailDO> logs = projectLogManager.getProjectLogQueryLogList(cnd, inputContent, projectId); long times = timeConsumer.end(); logger.info("่Žทๅ–็™ปๅฝ•ไบบๅกซๅ†™ๆ—ฅๅฟ—ๆˆ–็™ปๅฝ•ไบบไธบ้กน็›ฎ็ป็†็š„้กน็›ฎๆ—ฅๅฟ—ๅˆ—่กจ่€—ๆ—ถ:{},ๅทฅๅท:{},ๅง“ๅๆˆ–้ƒจ้—จ:{},้กน็›ฎid:{}",new Object[]{times,params.getUserId(),inputContent,projectId}); return ResultUtils.parseResult(logs, ProjectLogQueryDetailDTO.class); } @Override public List<ProjectBaseDTO> getCommonProjects(String personId) { TimeConsumer timeConsumer = TimeConsumer.start(); List<ProjectBaseDO> projects = projectLogManager.getCommonProjects(personId); long times = timeConsumer.end(); logger.info("่Žทๅ–็™ปๅฝ•ไบบ็ป“ๆž„ๅŒ–ๆ—ฅๅฟ—ๅธธ็”จ้กน็›ฎๅˆ—่กจ่€—ๆ—ถ:{},ๅทฅๅท:{}",new Object[]{times,personId}); return generator.convert(projects,ProjectBaseDTO.class); } }
UTF-8
Java
15,016
java
ProjectLogServiceImpl.java
Java
[]
null
[]
package com.bsoft.attendance.service.impl; import com.bsoft.attendance.condition.ProjectLogQueryCnd; import com.bsoft.attendance.dto.*; import com.bsoft.attendance.entity.primary.*; import com.bsoft.attendance.manager.AttendanceManager; import com.bsoft.attendance.manager.ProjectLogManager; import com.bsoft.attendance.service.ProjectLogService; import com.bsoft.common.dozer.IGenerator; import com.bsoft.common.dto.PublicDicDTO; import com.bsoft.common.entity.primary.PublicDicDO; import com.bsoft.common.key.KeyGenerator; import com.bsoft.common.manager.PublicDicManager; import com.bsoft.common.manager.ServerDateManager; import com.bsoft.common.performance.TimeConsumer; import com.bsoft.common.result.Result; import com.bsoft.common.utils.ResultUtils; import com.bsoft.attendance.condition.WorkLogAuditCnd; import com.bsoft.project.dto.ProjectWorkLogSituationDTO; import com.bsoft.project.entity.primary.ProjectBaseDO; import com.bsoft.project.manager.ProjectGroupManager; import com.bsoft.project.dto.ProjectBaseDTO; import com.bsoft.attendance.dto.ProjectLogDTO; import com.bsoft.attendance.dto.ProjectLogBaseDTO; import com.github.pagehelper.PageInfo; import com.google.common.collect.Lists; import org.apache.dubbo.config.annotation.Service; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import java.sql.Date; import java.util.Comparator; import java.util.List; @Service public class ProjectLogServiceImpl implements ProjectLogService { private final static Logger logger = LoggerFactory.getLogger(ProjectLogServiceImpl.class); @Autowired private ProjectLogManager projectLogManager; @Autowired private IGenerator generator; @Autowired private ProjectGroupManager projectGroupManager; @Autowired private AttendanceManager attendanceManager; @Autowired private KeyGenerator keyGenerator; @Autowired private ServerDateManager serverDateManager; @Autowired private PublicDicManager publicDicManager; @Override public List<ProjectLogDTO> getProjectWorkLogs(String projectId, String personId, Integer milepostId, Date attendanceDate) { List<ProjectLogDO> list = projectLogManager.getProjectWorkLogs(projectId,personId, milepostId,attendanceDate); return generator.convert(list,ProjectLogDTO.class); } @Override public List<ProjectLogDTO> getProjectWorkLogs(String personId, java.util.Date attendanceDate) { List<ProjectLogViewDO> projectWorkLogs = projectLogManager.getProjectWorkLogs(personId, attendanceDate); return generator.convert(projectWorkLogs,ProjectLogDTO.class); } @Override public List<ProjectLogDTO> getProjectWorkLogsWithNoTechnum(String projectId, String personId, java.util.Date attendanceDate) { List<ProjectLogDO> list = projectLogManager.getProjectWorkLogsWithNoTechnum(projectId,personId,attendanceDate); return generator.convert(list,ProjectLogDTO.class); } @Override public List<ProjectLogDTO> getProjectWorkLogsWithNoTechnum(String personId, java.util.Date attendanceDate) { List<ProjectLogDO> list = projectLogManager.getProjectWorkLogsWithNoTechnum(null,personId,attendanceDate); return generator.convert(list,ProjectLogDTO.class); } @Override public int getProjectWorkLogSituation(String submitter, java.util.Date attendanceDate) { return projectLogManager.getProjectLogSituation(submitter,attendanceDate); } @Override public List<ProjectLogDTO> saveProjectLogsAndWorkLogs(String personId, ProjectLogBaseDTO projectLogBaseDTO, List<ProjectLogDTO> list,Integer flag) { List<ProjectLogDO> logs = generator.convert(list,ProjectLogDO.class); Integer auditType = null; if(projectLogBaseDTO.getContractNo() != null){ auditType = getAuditType(personId,projectLogBaseDTO.getContractNo()); } for(ProjectLogDO log : logs){ if(log.getWorkLogId() == null){ Integer id = keyGenerator.increaseWorkLog(); if(projectLogBaseDTO.getContractNo() == null){ auditType = getAuditType(personId,log.getContractNo()); } log.setWorkLogId(id); log.setAuditType(auditType); } log.setNextAuditter(projectLogManager.getLeaderOrProjectManager(log.getSubmitter(),log.getProjectId())); } // logs = projectLogManager.saveProjectLogsAndWorkLogs(personId, projectLogBaseDTO,logs); logs = projectLogManager.saveProjectLogsAndWorkLogs(personId, projectLogBaseDTO,logs,flag); return generator.convert(logs,ProjectLogDTO.class); } private Integer getAuditType(String personId,String contractNo){ Boolean isLeader = projectGroupManager.isLeader(personId, contractNo); Boolean haveLeader = projectGroupManager.haveLeader(personId, contractNo);//ๅˆคๆ–ญๆ˜ฏๅฆๆœ‰็ป„้•ฟ int auditType; if(isLeader || !haveLeader){ auditType = 2; }else{ auditType = 1; } return auditType; } @Override public ProjectLogDTO editProjectLogAndWorkLog(String personId, String contractNo, Date attendanceDate, String projectName, ProjectLogDTO projectLog, Boolean projectChangeFlag,Integer flag) { ProjectLogDO log = generator.convert(projectLog,ProjectLogDO.class); if (projectChangeFlag) { log.setRefuse(0); } Boolean isLeader = projectGroupManager.isLeader(personId,contractNo); Boolean haveLeader = projectGroupManager.haveLeader(personId,contractNo);//ๅˆคๆ–ญๆ˜ฏๅฆๆœ‰็ป„้•ฟ int auditType; if(isLeader || !haveLeader){ auditType = 2; }else{ auditType = 1; } log.setAuditType(auditType); log.setNextAuditter(projectLogManager.getLeaderOrProjectManager(log.getSubmitter(),log.getProjectId())); java.util.Date now = serverDateManager.getServerDateTime(); log.setSubmitDate(now); log.setProjectName(projectName); AttendanceDO attendanceDO = attendanceManager.getAttendance(personId, attendanceDate); ProjectLogBaseDTO projectLogBaseDTO = new ProjectLogBaseDTO(); projectLogBaseDTO.setContractNo(contractNo); projectLogBaseDTO.setAttendanceDate(attendanceDate); projectLogBaseDTO.setHouseId(attendanceDO.getRentId()); projectLogBaseDTO.setHouseType(attendanceDO.getStay()); projectLogBaseDTO.setEvection(attendanceDO.getEvection()); // List<ProjectLogDO> logs = projectLogManager.saveProjectLogsAndWorkLogs(personId, projectLogBaseDTO, Lists.newArrayList(log)); List<ProjectLogDO> logs = projectLogManager.saveProjectLogsAndWorkLogs(personId, projectLogBaseDTO, Lists.newArrayList(log),flag); return generator.convert(logs.get(0),ProjectLogDTO.class); } @Override public List<ProjectWorkLogSituationDTO> getProjectWorkLogSituation(String personId, Integer days) { List<ProjectLogSituationDO> result = projectLogManager.getLastSituation(personId,days); return generator.convert(result,ProjectWorkLogSituationDTO.class); } @Override public ProjectBaseDTO getLastestProjectBase(String personId) { ProjectBaseDO customerProjectDO = projectLogManager.getLastestProjectBase(personId); return generator.convert(customerProjectDO, ProjectBaseDTO.class); } @Override public Result<ProjectBaseDTO> searchProjectsWithCommon(String personId, String context, Integer pageNo, Integer pageSize) { PageInfo<ProjectBaseDO> pageInfo = projectLogManager.searchProjectsWithCommon(personId,context,pageNo,pageSize); return ResultUtils.parseResult(pageInfo,ProjectBaseDTO.class); } @Override public ProjectLogDTO getProjectLog(Integer id) { ProjectLogDO projectLog = projectLogManager.getProjectLog(id); return generator.convert(projectLog,ProjectLogDTO.class); } @Override public void deleteProjectLog(Integer id) { projectLogManager.deleteProjectLog(id); } @Override public List<ProjectLogDTO> saveProjectLogs(List<ProjectLogDTO> logs) { List<ProjectLogDO> projectLogs = generator.convert(logs,ProjectLogDO.class); projectLogs = projectLogManager.saveProjectLogs(projectLogs); return generator.convert(projectLogs,ProjectLogDTO.class); } @Override public List<ProjectLogDTO> getByMilepostId(List<Integer> milePostId) { List<ProjectLogDO> projectLogDO = projectLogManager.getByMilepostId(milePostId); return generator.convert(projectLogDO, ProjectLogDTO.class); } @Override public void auditProjectLog(ProjectLogAuditDTO projectLogAuditDTO) { ProjectLogAuditDO projectLogAudit = generator.convert(projectLogAuditDTO,ProjectLogAuditDO.class); projectLogAudit = projectLogManager.processProjectLogType(projectLogAudit); projectLogManager.auditProjectLog(projectLogAudit); } @Override public void auditProjectLogs(List<ProjectLogAuditDTO> projectLogAuditDTO) { List<ProjectLogAuditDO> projectLogAudits = generator.convert(projectLogAuditDTO,ProjectLogAuditDO.class); projectLogAudits.forEach(log->{ log = projectLogManager.processProjectLogType(log); projectLogManager.auditProjectLog(log); }); } @Override public Result<ProjectPlanQueryLogDTO> getProjectPlanQueryLogList(Integer pageSize, Integer pageNo, Integer milepostId, String contractNo) { TimeConsumer timeConsumer = TimeConsumer.start(); Page<ProjectPlanQueryLogDO> logs = projectLogManager.getProjectPlanQueryLogList(pageSize, pageNo, milepostId, contractNo); long times = timeConsumer.end(); logger.info("้กน็›ฎ่ฎกๅˆ’ๆŸฅ่ฏข-ๆ—ฅๅฟ—ๅˆ—่กจ่€—ๆ—ถ:{},้˜ถๆฎตid:{},ๅˆๅŒๅท:{}",new Object[]{times,milepostId,contractNo}); return ResultUtils.parseResult(logs, ProjectPlanQueryLogDTO.class); } @Override public Result<ProjectLogNeedAuditDTO> getProjectLogNeedAudit(String auditter, WorkLogAuditCndDTO params, Integer page, Integer size) { WorkLogAuditCnd workLogAuditCnd = generator.convert(params,WorkLogAuditCnd.class); Page<ProjectLogNeedAuditDO> result = projectLogManager.getProjectLogNeedAudit(auditter,workLogAuditCnd,page,size); return ResultUtils.parseResult(result,ProjectLogNeedAuditDTO.class); } @Override public ProjectLogNeedDealCountDTO getWorkLogsCount(String userId) { TimeConsumer timeConsumer = TimeConsumer.start(); ProjectLogNeedDealCountDO count = projectLogManager.getWorkLogsCount(userId); long times = timeConsumer.end(); logger.info("่Žทๅ–ๆ‰€ๆœ‰ๅพ…ๅŠž่€—ๆ—ถ:{}",new Object[]{count,times}); return generator.convert(count,ProjectLogNeedDealCountDTO.class); } @Override public Integer getProjectLogAuditCount(Integer projectLogId) { Integer count = projectLogManager.getProjectLogAuditCount(projectLogId); return count; } @Override public List<PublicDicDTO> getProjectLogRoles() { TimeConsumer timeConsumer = TimeConsumer.start(); List<PublicDicDO> roles = publicDicManager.getPublicDic(2003); roles.sort(Comparator.comparing(PublicDicDO::getSort)); long times = timeConsumer.end(); logger.info("่Žทๅ–็ป“ๆž„ๅŒ–ๆ—ฅๅฟ—่ง’่‰ฒ่€—ๆ—ถ:{}",times); return generator.convert(roles, PublicDicDTO.class); } @Override public List<PublicDicDTO> getProjectLogTypes() { TimeConsumer timeConsumer = TimeConsumer.start(); List<PublicDicDO> types = publicDicManager.getPublicDic(2004); types.sort(Comparator.comparing(PublicDicDO::getSort)); long times = timeConsumer.end(); logger.info("่Žทๅ–็ป“ๆž„ๅŒ–ๆ—ฅๅฟ—็ฑปๅˆซ่€—ๆ—ถ:{}",times); return generator.convert(types, PublicDicDTO.class); } @Override public Boolean haveProjectLogs(String personId) { Integer size = projectLogManager.countProjectLogs(personId); return size > 0; } @Override public Result<ProjectWithAuditDTO> getProjectWithAuditList(String userId,WorkLogAuditCndDTO params, Integer pageNo, Integer pageSize) { TimeConsumer timeConsumer = TimeConsumer.start(); WorkLogAuditCnd workLogAuditCnd = generator.convert(params,WorkLogAuditCnd.class); PageInfo<ProjectWithAuditDO> pageInfo = projectLogManager.getProjectWithAuditList(userId,workLogAuditCnd,pageNo,pageSize); // List<ProjectWithAuditDTO> projectWithAuditDTOS = generator.convert(projectWithAuditDOS, ProjectWithAuditDTO.class); // Integer count = projectLogManager.countProjectWithAuditCount(userId); Result<ProjectWithAuditDTO> result = ResultUtils.parseResult(pageInfo,ProjectWithAuditDTO.class); long times = timeConsumer.end(); logger.info("่Žทๅ–็™ปๅฝ•ไบบๆ‰€ๅฑž็š„ๆ‰€ๆœ‰้กน็›ฎ่€—ๆ—ถ:{}",new Object[]{times}); return result; } @Override public Result<ProjectLogQueryProjectDTO> getProjectLogQueryProjectList(ProjectLogQueryCndDTO params) { TimeConsumer timeConsumer = TimeConsumer.start(); ProjectLogQueryCnd cnd = generator.convert(params, ProjectLogQueryCnd.class); PageInfo<ProjectLogQueryProjectDO> projects = projectLogManager.getProjectLogQueryProjectList(cnd); long times = timeConsumer.end(); logger.info("่Žทๅ–็™ปๅฝ•ไบบๅกซๅ†™ๆ—ฅๅฟ—ๆˆ–็™ปๅฝ•ไบบไธบ้กน็›ฎ็ป็†็š„้กน็›ฎๅˆ—่กจ่€—ๆ—ถ:{},ๅทฅๅท:{}",new Object[]{times,params.getUserId()}); return ResultUtils.parseResult(projects, ProjectLogQueryProjectDTO.class); } @Override public Result<ProjectLogQueryDetailDTO> getProjectLogQueryLogList(ProjectLogQueryCndDTO params, String inputContent, String projectId) { TimeConsumer timeConsumer = TimeConsumer.start(); ProjectLogQueryCnd cnd = generator.convert(params, ProjectLogQueryCnd.class); Page<ProjectLogQueryDetailDO> logs = projectLogManager.getProjectLogQueryLogList(cnd, inputContent, projectId); long times = timeConsumer.end(); logger.info("่Žทๅ–็™ปๅฝ•ไบบๅกซๅ†™ๆ—ฅๅฟ—ๆˆ–็™ปๅฝ•ไบบไธบ้กน็›ฎ็ป็†็š„้กน็›ฎๆ—ฅๅฟ—ๅˆ—่กจ่€—ๆ—ถ:{},ๅทฅๅท:{},ๅง“ๅๆˆ–้ƒจ้—จ:{},้กน็›ฎid:{}",new Object[]{times,params.getUserId(),inputContent,projectId}); return ResultUtils.parseResult(logs, ProjectLogQueryDetailDTO.class); } @Override public List<ProjectBaseDTO> getCommonProjects(String personId) { TimeConsumer timeConsumer = TimeConsumer.start(); List<ProjectBaseDO> projects = projectLogManager.getCommonProjects(personId); long times = timeConsumer.end(); logger.info("่Žทๅ–็™ปๅฝ•ไบบ็ป“ๆž„ๅŒ–ๆ—ฅๅฟ—ๅธธ็”จ้กน็›ฎๅˆ—่กจ่€—ๆ—ถ:{},ๅทฅๅท:{}",new Object[]{times,personId}); return generator.convert(projects,ProjectBaseDTO.class); } }
15,016
0.744694
0.743537
307
46.882736
38.766644
194
false
false
0
0
0
0
0
0
0.973941
false
false
13
f58342f4d0671f307f2618038ee3f0e7ec9b694d
16,174,846,888,429
915fc4417e1c52e450f76a2b43aa6168f0a8a97d
/src/com/eagle/programmar/Template/Template_Program.java
4c33decbe11551236a3f09c34d3c7ae2b2f9a54e
[ "Apache-2.0" ]
permissive
oharasteve/eagle
https://github.com/oharasteve/eagle
6d685d6d0dcdcd6e07dd874da7051db50ec8acfa
7d440333ecae0d04a6b7385e28c654a58140ddb4
refs/heads/master
2021-01-10T05:51:05.308000
2016-11-07T16:47:11
2016-11-07T16:47:11
43,583,889
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
// Copyright Eagle Legacy Modernization, LLC, 2010-date // Original author: Steven A. O'Hara, Nov 12, 2015 package com.eagle.programmar.Template; import com.eagle.programmar.EagleLanguage; import com.eagle.tests.EagleInterpreter; import com.eagle.tests.EagleRunnable; import com.eagle.tokens.TokenList; public class Template_Program extends EagleLanguage implements EagleRunnable { public static final String NAME = "Template"; public Template_Program() { super(NAME, new Template_Syntax()); } @Override public String getDocRoot() { return "TBD"; } public @OPT TokenList<Template_Statement> statements; @Override public void interpret(EagleInterpreter interpreter) { if (statements._present) { for (Template_Statement stmt : statements._elements) { interpreter.tryToInterpret(stmt); } } } }
UTF-8
Java
836
java
Template_Program.java
Java
[ { "context": " Modernization, LLC, 2010-date\n// Original author: Steven A. O'Hara, Nov 12, 2015\n\npackage com.eagle.programmar.Templ", "end": 92, "score": 0.9998770952224731, "start": 76, "tag": "NAME", "value": "Steven A. O'Hara" } ]
null
[]
// Copyright Eagle Legacy Modernization, LLC, 2010-date // Original author: <NAME>, Nov 12, 2015 package com.eagle.programmar.Template; import com.eagle.programmar.EagleLanguage; import com.eagle.tests.EagleInterpreter; import com.eagle.tests.EagleRunnable; import com.eagle.tokens.TokenList; public class Template_Program extends EagleLanguage implements EagleRunnable { public static final String NAME = "Template"; public Template_Program() { super(NAME, new Template_Syntax()); } @Override public String getDocRoot() { return "TBD"; } public @OPT TokenList<Template_Statement> statements; @Override public void interpret(EagleInterpreter interpreter) { if (statements._present) { for (Template_Statement stmt : statements._elements) { interpreter.tryToInterpret(stmt); } } } }
826
0.746412
0.73445
39
20.461538
21.714754
76
false
false
0
0
0
0
0
0
1.384615
false
false
13
f62b13d6647e95a4e318a657343b595ea6c3aa2f
25,082,609,067,424
76e51c3d0b5642b8dfd69f29a12c43feb3e55d2a
/app/src/main/java/com/syt/balram/syt/RequirementSummary.java
a1e48572492e053d0a31d041a387ba8d93b4c329
[]
no_license
androidPranav/SYT
https://github.com/androidPranav/SYT
5867a9c7893b340d4299b2af0dfb1f9dedf9cb37
53a6b3957af221ddb0aa2863f12bb64e0a3f12e0
refs/heads/master
2021-01-10T13:46:52.511000
2015-10-08T12:48:38
2015-10-08T12:48:38
43,887,814
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.syt.balram.syt; import android.app.AlertDialog; import android.app.ProgressDialog; import android.content.DialogInterface; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.provider.Settings; import android.support.v7.app.ActionBarActivity; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ImageButton; import android.widget.LinearLayout; import android.widget.Toast; import com.syt.balram.syt.BE.RequirementBE; import com.syt.balram.syt.BL.RequirementBL; import com.syt.constant.Constant; import com.syt.dialog.TransparentProgressDialog; import com.syt.util.Configuration; import com.google.android.gms.analytics.HitBuilders; public class RequirementSummary extends ActionBarActivity { EditText etSubcategory,etExp,etdays,etLocation,etMinPrice,etMaxPrice,etTitle,etSummary,etFixPrice; Button btnSummary,btnNotNow; RequirementBE objRequirementBE; ProgressDialog progressDialog; RequirementBL objRequirementBL; String titleSummary; AlertDialog alertDialog; TransparentProgressDialog pd; ImageButton back; LinearLayout llout; String priceType; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_requirement_summary); overridePendingTransition(R.animator.anim_in, R.animator.anim_out); back= (ImageButton) findViewById(R.id.summary_back); btnNotNow= (Button) findViewById(R.id.summary_not_now); progressDialog=new ProgressDialog(RequirementSummary.this,R.style.MyDialogTheme); pd=new TransparentProgressDialog(RequirementSummary.this,R.drawable.logo_single); Intent intent=getIntent(); objRequirementBE= (RequirementBE) intent.getSerializableExtra("RequirementBE"); objRequirementBL=new RequirementBL(); back.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); llout= (LinearLayout) findViewById(R.id.summary_price_layout); alertDialog = new AlertDialog.Builder(RequirementSummary.this,R.style.MyDialogTheme).create(); etFixPrice= (EditText) findViewById(R.id.summary_fixPrice); etSubcategory= (EditText) findViewById(R.id.summary_subcategory); etExp= (EditText) findViewById(R.id.summary_exp); etdays= (EditText) findViewById(R.id.summary_days); etLocation= (EditText) findViewById(R.id.summary_location); btnSummary= (Button) findViewById(R.id.summary_btn); etMaxPrice= (EditText) findViewById(R.id.summary_maxprice); etMinPrice= (EditText) findViewById(R.id.summary_minprice); etTitle= (EditText) findViewById(R.id.summary_title); etSummary= (EditText) findViewById(R.id.summary_desciption); etSubcategory.setText(objRequirementBE.getSubCategory()); etExp.setText(objRequirementBE.getExperience()); etdays.setText(objRequirementBE.getServiceDays()); etLocation.setText(objRequirementBE.getServiceLocation()); if(objRequirementBE.getServiceCharge().equalsIgnoreCase("Pay a fixed price")) { etFixPrice.setVisibility(View.VISIBLE); llout.setVisibility(View.GONE); priceType="Fixed"; } else { etFixPrice.setVisibility(View.GONE); llout.setVisibility(View.VISIBLE); priceType="Not Fixed"; } titleSummary="Hi, I am looking for "+objRequirementBE.getSubCategory()+", required on "+objRequirementBE.getServiceDays()+". Experience required is "+objRequirementBE.getExperience()+"."; etSummary.setText(titleSummary); btnSummary.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String subCategory = etSubcategory.getText().toString(); String exp = etExp.getText().toString(); String days = etdays.getText().toString(); String location = etLocation.getText().toString(); String maxPrice = etMaxPrice.getText().toString(); String minPrice = etMinPrice.getText().toString(); String title = etTitle.getText().toString(); if (subCategory.trim().length() == 0) { } else if (exp.length() == 0) { } else if (days.length() == 0) { } else if (location.length() == 0) { } else if (title.length() == 0) { etTitle.setError("required"); } else { if (priceType.equals("Fixed")) { if (etFixPrice.getText().toString().length() == 0) { etFixPrice.setError("required"); } else { minPrice = etFixPrice.getText().toString(); maxPrice = ""; objRequirementBE.setSubCategory(subCategory); objRequirementBE.setExperience(exp); objRequirementBE.setServiceDays(days); objRequirementBE.setServiceLocation(location); objRequirementBE.setMaxPrice(maxPrice); objRequirementBE.setMinPrice(minPrice); objRequirementBE.setTitle(title); objRequirementBE.setDesc(titleSummary); if (Configuration.isInternetConnection(RequirementSummary.this)) { new LongRunningGetIO().execute(); } else { alertDialog .setTitle(Constant.ERR_INTERNET_CONNECTION_NOT_FOUND); alertDialog.setMessage(Constant.ERR_INTERNET_CONNECTION_NOT_FOUND_MSG); alertDialog.setButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { //finish(); startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS)); } }); alertDialog.show(); } } } else { int valueMin = Integer.valueOf(minPrice); int valueMax = Integer.valueOf(maxPrice); if (minPrice.length() == 0 && maxPrice.length() == 0) { etMaxPrice.setError("required"); etMinPrice.setError("required"); } else if (valueMin > valueMax) { etMaxPrice.setError("should be greater than min price"); } else { objRequirementBE.setSubCategory(subCategory); objRequirementBE.setExperience(exp); objRequirementBE.setServiceDays(days); objRequirementBE.setServiceLocation(location); objRequirementBE.setMaxPrice(maxPrice); objRequirementBE.setMinPrice(minPrice); objRequirementBE.setTitle(title); objRequirementBE.setDesc(titleSummary); if (Configuration.isInternetConnection(RequirementSummary.this)) { new LongRunningGetIO().execute(); } else { alertDialog .setTitle(Constant.ERR_INTERNET_CONNECTION_NOT_FOUND); alertDialog.setMessage(Constant.ERR_INTERNET_CONNECTION_NOT_FOUND_MSG); alertDialog.setButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { //finish(); startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS)); } }); alertDialog.show(); } } } } } }); btnNotNow.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent1=new Intent(getApplicationContext(),HomeScreen.class); startActivity(intent1); } }); } private class LongRunningGetIO extends AsyncTask<String, String, String> { // ProgressDialog progress; @Override protected void onPreExecute ( ) { pd.show(); } @Override protected String doInBackground(String... params) { // TODO Auto-generated method stub String result=objRequirementBL.registerRequirement(objRequirementBE,getApplicationContext()); return result; } @Override protected void onPostExecute (String result) { //set adapter here // progress.dismiss(); //userName.setText(result); pd.dismiss(); if(result.equals("y")) { try { MyApp.tracker().setScreenName("New Post"); MyApp.tracker().send(new HitBuilders.EventBuilder("Button", "Click") .setCategory("UI") .setAction("Click") .setLabel("Submit") .build()); /* Hashtable<String, Object> hashtable = new Hashtable<String, Object>(); hashtable.put("EmailID", objRequirementBE.getEmail()); hashtable.put("Category", objRequirementBE.getCategory()); hashtable.put("SubCategory", objRequirementBE.getSubCategory()); hashtable.put("Location", objRequirementBE.getServiceLocation()); hashtable.put("Availability", objRequirementBE.getServiceDays()); AffleInAppTracker.inAppTrackerViewName(getApplicationContext(), "Post Requirement", "New Requirement successfully posted by user", "Click", hashtable);*/ } catch (Exception e) { e.printStackTrace(); } Toast.makeText(getApplicationContext(),"Your Requirement has been successfully posted",Toast.LENGTH_LONG).show(); Intent intent = new Intent(getApplicationContext(),HomeScreen.class); startActivity(intent); } else { } //super.onPostExecute(result); } /* if(result!=null) { String emailId=validate(result); //Toast.makeText(getApplicationContext(), emailId, Toast.LENGTH_LONG).show(); } } */ } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_requirement_summary, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
UTF-8
Java
12,612
java
RequirementSummary.java
Java
[]
null
[]
package com.syt.balram.syt; import android.app.AlertDialog; import android.app.ProgressDialog; import android.content.DialogInterface; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.provider.Settings; import android.support.v7.app.ActionBarActivity; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.ImageButton; import android.widget.LinearLayout; import android.widget.Toast; import com.syt.balram.syt.BE.RequirementBE; import com.syt.balram.syt.BL.RequirementBL; import com.syt.constant.Constant; import com.syt.dialog.TransparentProgressDialog; import com.syt.util.Configuration; import com.google.android.gms.analytics.HitBuilders; public class RequirementSummary extends ActionBarActivity { EditText etSubcategory,etExp,etdays,etLocation,etMinPrice,etMaxPrice,etTitle,etSummary,etFixPrice; Button btnSummary,btnNotNow; RequirementBE objRequirementBE; ProgressDialog progressDialog; RequirementBL objRequirementBL; String titleSummary; AlertDialog alertDialog; TransparentProgressDialog pd; ImageButton back; LinearLayout llout; String priceType; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_requirement_summary); overridePendingTransition(R.animator.anim_in, R.animator.anim_out); back= (ImageButton) findViewById(R.id.summary_back); btnNotNow= (Button) findViewById(R.id.summary_not_now); progressDialog=new ProgressDialog(RequirementSummary.this,R.style.MyDialogTheme); pd=new TransparentProgressDialog(RequirementSummary.this,R.drawable.logo_single); Intent intent=getIntent(); objRequirementBE= (RequirementBE) intent.getSerializableExtra("RequirementBE"); objRequirementBL=new RequirementBL(); back.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }); llout= (LinearLayout) findViewById(R.id.summary_price_layout); alertDialog = new AlertDialog.Builder(RequirementSummary.this,R.style.MyDialogTheme).create(); etFixPrice= (EditText) findViewById(R.id.summary_fixPrice); etSubcategory= (EditText) findViewById(R.id.summary_subcategory); etExp= (EditText) findViewById(R.id.summary_exp); etdays= (EditText) findViewById(R.id.summary_days); etLocation= (EditText) findViewById(R.id.summary_location); btnSummary= (Button) findViewById(R.id.summary_btn); etMaxPrice= (EditText) findViewById(R.id.summary_maxprice); etMinPrice= (EditText) findViewById(R.id.summary_minprice); etTitle= (EditText) findViewById(R.id.summary_title); etSummary= (EditText) findViewById(R.id.summary_desciption); etSubcategory.setText(objRequirementBE.getSubCategory()); etExp.setText(objRequirementBE.getExperience()); etdays.setText(objRequirementBE.getServiceDays()); etLocation.setText(objRequirementBE.getServiceLocation()); if(objRequirementBE.getServiceCharge().equalsIgnoreCase("Pay a fixed price")) { etFixPrice.setVisibility(View.VISIBLE); llout.setVisibility(View.GONE); priceType="Fixed"; } else { etFixPrice.setVisibility(View.GONE); llout.setVisibility(View.VISIBLE); priceType="Not Fixed"; } titleSummary="Hi, I am looking for "+objRequirementBE.getSubCategory()+", required on "+objRequirementBE.getServiceDays()+". Experience required is "+objRequirementBE.getExperience()+"."; etSummary.setText(titleSummary); btnSummary.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { String subCategory = etSubcategory.getText().toString(); String exp = etExp.getText().toString(); String days = etdays.getText().toString(); String location = etLocation.getText().toString(); String maxPrice = etMaxPrice.getText().toString(); String minPrice = etMinPrice.getText().toString(); String title = etTitle.getText().toString(); if (subCategory.trim().length() == 0) { } else if (exp.length() == 0) { } else if (days.length() == 0) { } else if (location.length() == 0) { } else if (title.length() == 0) { etTitle.setError("required"); } else { if (priceType.equals("Fixed")) { if (etFixPrice.getText().toString().length() == 0) { etFixPrice.setError("required"); } else { minPrice = etFixPrice.getText().toString(); maxPrice = ""; objRequirementBE.setSubCategory(subCategory); objRequirementBE.setExperience(exp); objRequirementBE.setServiceDays(days); objRequirementBE.setServiceLocation(location); objRequirementBE.setMaxPrice(maxPrice); objRequirementBE.setMinPrice(minPrice); objRequirementBE.setTitle(title); objRequirementBE.setDesc(titleSummary); if (Configuration.isInternetConnection(RequirementSummary.this)) { new LongRunningGetIO().execute(); } else { alertDialog .setTitle(Constant.ERR_INTERNET_CONNECTION_NOT_FOUND); alertDialog.setMessage(Constant.ERR_INTERNET_CONNECTION_NOT_FOUND_MSG); alertDialog.setButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { //finish(); startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS)); } }); alertDialog.show(); } } } else { int valueMin = Integer.valueOf(minPrice); int valueMax = Integer.valueOf(maxPrice); if (minPrice.length() == 0 && maxPrice.length() == 0) { etMaxPrice.setError("required"); etMinPrice.setError("required"); } else if (valueMin > valueMax) { etMaxPrice.setError("should be greater than min price"); } else { objRequirementBE.setSubCategory(subCategory); objRequirementBE.setExperience(exp); objRequirementBE.setServiceDays(days); objRequirementBE.setServiceLocation(location); objRequirementBE.setMaxPrice(maxPrice); objRequirementBE.setMinPrice(minPrice); objRequirementBE.setTitle(title); objRequirementBE.setDesc(titleSummary); if (Configuration.isInternetConnection(RequirementSummary.this)) { new LongRunningGetIO().execute(); } else { alertDialog .setTitle(Constant.ERR_INTERNET_CONNECTION_NOT_FOUND); alertDialog.setMessage(Constant.ERR_INTERNET_CONNECTION_NOT_FOUND_MSG); alertDialog.setButton("OK", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { //finish(); startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS)); } }); alertDialog.show(); } } } } } }); btnNotNow.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent1=new Intent(getApplicationContext(),HomeScreen.class); startActivity(intent1); } }); } private class LongRunningGetIO extends AsyncTask<String, String, String> { // ProgressDialog progress; @Override protected void onPreExecute ( ) { pd.show(); } @Override protected String doInBackground(String... params) { // TODO Auto-generated method stub String result=objRequirementBL.registerRequirement(objRequirementBE,getApplicationContext()); return result; } @Override protected void onPostExecute (String result) { //set adapter here // progress.dismiss(); //userName.setText(result); pd.dismiss(); if(result.equals("y")) { try { MyApp.tracker().setScreenName("New Post"); MyApp.tracker().send(new HitBuilders.EventBuilder("Button", "Click") .setCategory("UI") .setAction("Click") .setLabel("Submit") .build()); /* Hashtable<String, Object> hashtable = new Hashtable<String, Object>(); hashtable.put("EmailID", objRequirementBE.getEmail()); hashtable.put("Category", objRequirementBE.getCategory()); hashtable.put("SubCategory", objRequirementBE.getSubCategory()); hashtable.put("Location", objRequirementBE.getServiceLocation()); hashtable.put("Availability", objRequirementBE.getServiceDays()); AffleInAppTracker.inAppTrackerViewName(getApplicationContext(), "Post Requirement", "New Requirement successfully posted by user", "Click", hashtable);*/ } catch (Exception e) { e.printStackTrace(); } Toast.makeText(getApplicationContext(),"Your Requirement has been successfully posted",Toast.LENGTH_LONG).show(); Intent intent = new Intent(getApplicationContext(),HomeScreen.class); startActivity(intent); } else { } //super.onPostExecute(result); } /* if(result!=null) { String emailId=validate(result); //Toast.makeText(getApplicationContext(), emailId, Toast.LENGTH_LONG).show(); } } */ } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present. getMenuInflater().inflate(R.menu.menu_requirement_summary, menu); return true; } @Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_settings) { return true; } return super.onOptionsItemSelected(item); } }
12,612
0.546702
0.545829
304
40.486843
31.764032
195
false
false
0
0
0
0
0
0
0.628289
false
false
13
9f3e21c175b86f881466881cf942fa90ae878a63
14,740,327,825,708
0b0cf5a65b699a1eec70d967f6d5606665577927
/app/src/main/java/com/example/cma/model/capacity_verification/CapacityVerificationPlan.java
b315ae3be8eabed00d5e63bbe8c1adf42a13589f
[]
no_license
lgyhhh/CMA_PM
https://github.com/lgyhhh/CMA_PM
5ec754bb0c858b517ee07c27b0ecf7020607d6d9
65d105a0b29a772a6b02448183cf0cc141e7b658
refs/heads/master
2020-03-18T00:55:33.951000
2018-07-22T02:46:56
2018-07-22T02:46:56
134,119,634
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.cma.model.capacity_verification; import java.io.Serializable; /** * Created by admin on 2018/7/16. */ public class CapacityVerificationPlan implements Serializable { private long planId; //่ƒฝๅŠ›้ชŒ่ฏ่ฎกๅˆ’ๅบๅท private String name;//่ƒฝๅŠ›้ชŒ่ฏ่ฎกๅˆ’ๅ็งฐ private String organizer;//่ƒฝๅŠ›้ชŒ่ฏ้กน็›ฎ็š„็ป„็ป‡ๆ–น private int state; //0ๅณๆœชๅฎŒๆˆ๏ผŒ1็š„่ฏๆ˜ฏไป–่ฎพ่ฎก็š„ๆ‰€ๆœ‰้กน็›ฎๅ‡ๆ‰ง่กŒๆˆ่ฎฐๅฝ•ๆ‰ๆˆไธบ่ฎฐๅฝ•ๅ˜ๆˆ1 private String year; //ๅ‚ๅŠ ๅนดๅบฆ private String note;//่ฎกๅˆ’็š„ๅค‡ๆณจ private String analysis;//ๅฆ‚ๆžœๆœ‰ๆ–‡ๆกฃๆ–‡ๆกฃ็š„ๅˆ†ๆžๆŠฅๅ‘Šๅๅญ— CapacityVerificationPlan(long planId,String name,String organizer,int state,String year,String note,String analysis) { this.planId=planId; this.name=name; this.organizer=organizer; this.state=state; this.year=year; this.note=note; this.analysis=analysis; } public long getPlanId() { return planId; } public void setPlanId(long planId) { this.planId=planId; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getOrganizer() { return organizer; } public void setOrganizer(String organizer) { this.organizer = organizer; } public int getState() { return state; } public void setState(int state) { this.state = state; } public String getYear() { return year; } public void setYear(String year) { this.year = year; } public String getNote() { return note; } public void setNote(String note) { this.note = note; } public String getAnalysis() { return analysis; } public void setAnalysis(String analysis) { this.analysis = analysis; } }
UTF-8
Java
1,941
java
CapacityVerificationPlan.java
Java
[ { "context": ";\n\nimport java.io.Serializable;\n\n/**\n * Created by admin on 2018/7/16.\n */\n\npublic class CapacityVerificat", "end": 107, "score": 0.886623740196228, "start": 102, "tag": "USERNAME", "value": "admin" } ]
null
[]
package com.example.cma.model.capacity_verification; import java.io.Serializable; /** * Created by admin on 2018/7/16. */ public class CapacityVerificationPlan implements Serializable { private long planId; //่ƒฝๅŠ›้ชŒ่ฏ่ฎกๅˆ’ๅบๅท private String name;//่ƒฝๅŠ›้ชŒ่ฏ่ฎกๅˆ’ๅ็งฐ private String organizer;//่ƒฝๅŠ›้ชŒ่ฏ้กน็›ฎ็š„็ป„็ป‡ๆ–น private int state; //0ๅณๆœชๅฎŒๆˆ๏ผŒ1็š„่ฏๆ˜ฏไป–่ฎพ่ฎก็š„ๆ‰€ๆœ‰้กน็›ฎๅ‡ๆ‰ง่กŒๆˆ่ฎฐๅฝ•ๆ‰ๆˆไธบ่ฎฐๅฝ•ๅ˜ๆˆ1 private String year; //ๅ‚ๅŠ ๅนดๅบฆ private String note;//่ฎกๅˆ’็š„ๅค‡ๆณจ private String analysis;//ๅฆ‚ๆžœๆœ‰ๆ–‡ๆกฃๆ–‡ๆกฃ็š„ๅˆ†ๆžๆŠฅๅ‘Šๅๅญ— CapacityVerificationPlan(long planId,String name,String organizer,int state,String year,String note,String analysis) { this.planId=planId; this.name=name; this.organizer=organizer; this.state=state; this.year=year; this.note=note; this.analysis=analysis; } public long getPlanId() { return planId; } public void setPlanId(long planId) { this.planId=planId; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getOrganizer() { return organizer; } public void setOrganizer(String organizer) { this.organizer = organizer; } public int getState() { return state; } public void setState(int state) { this.state = state; } public String getYear() { return year; } public void setYear(String year) { this.year = year; } public String getNote() { return note; } public void setNote(String note) { this.note = note; } public String getAnalysis() { return analysis; } public void setAnalysis(String analysis) { this.analysis = analysis; } }
1,941
0.617367
0.611765
87
19.517241
19.707552
120
false
false
0
0
0
0
0
0
0.413793
false
false
13
ddee8623733af872a659d863862614d55a29f8ce
10,840,497,459,101
f6303dc7fb31566f4d193d9678aefbc339696d30
/src/main/java/com/mayard/booksearch/book/repository/SearchHistoryRepository.java
d84fc5488669a2f66515f11eae70a93ef8db5e64
[]
no_license
mayardbooksearch/booksearch
https://github.com/mayardbooksearch/booksearch
9cdfe9114d33411166f9375e9161acef473b8bc0
e0b2c37a0bca3c4ded19760812587a9f9723298b
refs/heads/master
2020-03-23T00:57:25.595000
2018-08-05T12:22:51
2018-08-05T12:22:51
140,893,563
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mayard.booksearch.book.repository; import com.mayard.booksearch.book.model.entity.SearchHistory; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @Repository public interface SearchHistoryRepository extends JpaRepository<SearchHistory, Integer> { Page<SearchHistory> findByUserNo(int userNo, Pageable pageable); SearchHistory findFirstByUserNoOrderBySearchDateDesc(int userNo); }
UTF-8
Java
560
java
SearchHistoryRepository.java
Java
[]
null
[]
package com.mayard.booksearch.book.repository; import com.mayard.booksearch.book.model.entity.SearchHistory; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @Repository public interface SearchHistoryRepository extends JpaRepository<SearchHistory, Integer> { Page<SearchHistory> findByUserNo(int userNo, Pageable pageable); SearchHistory findFirstByUserNoOrderBySearchDateDesc(int userNo); }
560
0.844643
0.844643
14
39
29.466688
88
false
false
0
0
0
0
0
0
0.714286
false
false
13
c8b743cb6400a6592f44689a47fe5fe6d281b32f
12,592,844,158,531
45ef8a73cbfaffc5f32558e4f58a12f4d6067143
/src/main/java/XplorJavaDB/pg/PGConn.java
6fb6051e8a055ed8836b54414f79756ce6ccae7d
[]
no_license
lcaballero/XplorJavaDB
https://github.com/lcaballero/XplorJavaDB
6964f0faeb7b3d8c0feab9995a8a0c666857f369
77d271494d61c1f4b381d0e8c26b23ea4c6cc2d5
refs/heads/master
2020-03-31T12:12:32.530000
2014-05-18T02:22:22
2014-05-18T02:22:22
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package XplorJavaDB.pg; import com.google.common.base.Joiner; import org.skife.jdbi.v2.tweak.ConnectionFactory; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.util.Map; import java.util.Properties; /** * Implements a connection factory suiteable for JDBI, which is prepares to connect * to a PostGre DB via JDBC. */ public class PGConn implements ConnectionFactory { /** * See http://www.postgresql.org/docs/9.3/static/libpq-connect.html#AEN39024 */ public static final String DEFAULT_CONNECTION_URL = "jdbc:postgresql://localhost:5432/xploring_java"; private String url = DEFAULT_CONNECTION_URL; /** * Uses the default connection string. */ public PGConn() {} /** * Constructs the connection string from the provided parts. * * @param driver The driver to use (jdbc). * @param protocol The protocol to use (postgresql). * @param host The host to use (localhost). * @param port The port to use (5432). * @param databaseName The db name to use (xploring_java). */ public PGConn(String driver, String protocol, String host, int port, String databaseName) { url = Joiner.on("").join(driver, ":", protocol, "://", host, ":", port, "/", databaseName); } /** * Creates a Properties instance with user and password as found in the * environment as PG_USER and PG_PASS. * * @return A properties instance with user and password pulled from * the environment. */ public Properties getConnectionProperties() { Map<String,String> env = System.getenv(); Properties props = new Properties(); props.setProperty("user", env.get("PG_USER")); props.setProperty("password", env.get("PG_PASS")); return props; } /** * @return gets the url, either the default, or the one made from the parts. */ public String getConnectionUrl() { return url; } /** * Creates a new Connection based on the getConnectionProperties and getConnectionUrl. * * @return A newly obtained connection. * @throws SQLException */ @Override public Connection openConnection() throws SQLException { return DriverManager.getConnection(getConnectionUrl(), getConnectionProperties()); } }
UTF-8
Java
2,371
java
PGConn.java
Java
[]
null
[]
package XplorJavaDB.pg; import com.google.common.base.Joiner; import org.skife.jdbi.v2.tweak.ConnectionFactory; import java.sql.Connection; import java.sql.DriverManager; import java.sql.SQLException; import java.util.Map; import java.util.Properties; /** * Implements a connection factory suiteable for JDBI, which is prepares to connect * to a PostGre DB via JDBC. */ public class PGConn implements ConnectionFactory { /** * See http://www.postgresql.org/docs/9.3/static/libpq-connect.html#AEN39024 */ public static final String DEFAULT_CONNECTION_URL = "jdbc:postgresql://localhost:5432/xploring_java"; private String url = DEFAULT_CONNECTION_URL; /** * Uses the default connection string. */ public PGConn() {} /** * Constructs the connection string from the provided parts. * * @param driver The driver to use (jdbc). * @param protocol The protocol to use (postgresql). * @param host The host to use (localhost). * @param port The port to use (5432). * @param databaseName The db name to use (xploring_java). */ public PGConn(String driver, String protocol, String host, int port, String databaseName) { url = Joiner.on("").join(driver, ":", protocol, "://", host, ":", port, "/", databaseName); } /** * Creates a Properties instance with user and password as found in the * environment as PG_USER and PG_PASS. * * @return A properties instance with user and password pulled from * the environment. */ public Properties getConnectionProperties() { Map<String,String> env = System.getenv(); Properties props = new Properties(); props.setProperty("user", env.get("PG_USER")); props.setProperty("password", env.get("PG_PASS")); return props; } /** * @return gets the url, either the default, or the one made from the parts. */ public String getConnectionUrl() { return url; } /** * Creates a new Connection based on the getConnectionProperties and getConnectionUrl. * * @return A newly obtained connection. * @throws SQLException */ @Override public Connection openConnection() throws SQLException { return DriverManager.getConnection(getConnectionUrl(), getConnectionProperties()); } }
2,371
0.660059
0.653311
75
30.613333
29.272009
105
false
false
0
0
0
0
0
0
0.493333
false
false
13
501dea2e0a847d4ff6c6804851c69243fe4f16b0
24,807,731,145,103
0dfe72db13f2a2939a38ee8ca287aaff93d2648f
/src/main/java/q002/Q002.java
f06653af6cfabad3a3abd561e2141405b530dd83
[]
no_license
ooshimayuji/skill-check
https://github.com/ooshimayuji/skill-check
3a5decd0a91933975dc5877cbde3963a24cabdec
5742c7c67b10537a975865ecceb87a49125530b8
refs/heads/master
2022-07-11T01:07:20.005000
2020-05-08T05:36:23
2020-05-08T05:36:23
260,360,827
0
0
null
true
2020-05-01T02:10:50
2020-05-01T02:10:50
2020-04-15T16:56:31
2020-04-28T07:08:01
14
0
0
0
null
false
false
package q002; import java.util.*; /** * Q002 ไธฆในๆ›ฟใˆใ‚‹ * * dataListใซ "ID,ๅๅญ—" ใฎๅฝขๅผใง20ๅ€‹ใฎใƒ‡ใƒผใ‚ฟใŒใ‚ใ‚Šใพใ™ใ€‚ * ใ“ใ‚Œใ‚’ID้ †ใซไธฆในใฆ่กจ็คบใ™ใ‚‹ใƒ—ใƒญใ‚ฐใƒฉใƒ ใ‚’่จ˜่ฟฐใ—ใฆใใ ใ•ใ„ใ€‚ * * dataListใฎๅฎš็พฉใ‚’ๅค‰ๆ›ดใ—ใฆใฏใ„ใ‘ใพใ›ใ‚“ใ€‚ * * [ๅ‡บๅŠ›็ตๆžœใ‚คใƒกใƒผใ‚ธ] 1,ไผŠ่—ค 2,ไบ•ไธŠ ๏ผˆ็œ็•ฅ๏ผ‰ 9,ๆธ…ๆฐด 10,้ˆดๆœจ 11,้ซ˜ๆฉ‹ ๏ผˆ็œ็•ฅ๏ผ‰ 20,ๆธก่พบ */ public class Q002 { /** * ใƒ‡ใƒผใ‚ฟไธ€่ฆง */ private static final String[] dataList = { "8,ไฝ่—ค", "10,้ˆดๆœจ", "11,้ซ˜ๆฉ‹", "12,็”ฐไธญ", "20,ๆธก่พบ", "1,ไผŠ่—ค", "18,ๅฑฑๆœฌ", "13,ไธญๆ‘", "5,ๅฐๆž—", "3,ๅŠ ่—ค", "19,ๅ‰็”ฐ", "17,ๅฑฑ็”ฐ", "7,ไฝใ€…ๆœจ", "16,ๅฑฑๅฃ", "6,ๆ–‰่—ค", "15,ๆพๆœฌ", "2,ไบ•ไธŠ", "4,ๆœจๆ‘", "14,ๆž—", "9,ๆธ…ๆฐด" }; public static void main(String[] args) { int[] idList = new int[dataList.length] ; int i = 0; // IDใ‚’ๆŠฝๅ‡บ for (String str: dataList){ String[] cutStr = str.split(",", 0); idList[i] = Integer.parseInt(cutStr[0]); i++; } // IDใ‚’ใ‚ฝใƒผใƒˆ Arrays.sort(idList); // ใ‚ฝใƒผใƒˆใ—ใŸID้ †ใซใ€dataListใ‚’่กจ็คบ for (int id: idList) { for (String ptintStr: dataList) { String[] cutStr = ptintStr.split(",", 0); if (id == Integer.parseInt(cutStr[0])) { System.out.println(ptintStr); } } } } } // ๅฎŒๆˆใพใงใฎๆ™‚้–“: 50ๅˆ†
UTF-8
Java
1,593
java
Q002.java
Java
[]
null
[]
package q002; import java.util.*; /** * Q002 ไธฆในๆ›ฟใˆใ‚‹ * * dataListใซ "ID,ๅๅญ—" ใฎๅฝขๅผใง20ๅ€‹ใฎใƒ‡ใƒผใ‚ฟใŒใ‚ใ‚Šใพใ™ใ€‚ * ใ“ใ‚Œใ‚’ID้ †ใซไธฆในใฆ่กจ็คบใ™ใ‚‹ใƒ—ใƒญใ‚ฐใƒฉใƒ ใ‚’่จ˜่ฟฐใ—ใฆใใ ใ•ใ„ใ€‚ * * dataListใฎๅฎš็พฉใ‚’ๅค‰ๆ›ดใ—ใฆใฏใ„ใ‘ใพใ›ใ‚“ใ€‚ * * [ๅ‡บๅŠ›็ตๆžœใ‚คใƒกใƒผใ‚ธ] 1,ไผŠ่—ค 2,ไบ•ไธŠ ๏ผˆ็œ็•ฅ๏ผ‰ 9,ๆธ…ๆฐด 10,้ˆดๆœจ 11,้ซ˜ๆฉ‹ ๏ผˆ็œ็•ฅ๏ผ‰ 20,ๆธก่พบ */ public class Q002 { /** * ใƒ‡ใƒผใ‚ฟไธ€่ฆง */ private static final String[] dataList = { "8,ไฝ่—ค", "10,้ˆดๆœจ", "11,้ซ˜ๆฉ‹", "12,็”ฐไธญ", "20,ๆธก่พบ", "1,ไผŠ่—ค", "18,ๅฑฑๆœฌ", "13,ไธญๆ‘", "5,ๅฐๆž—", "3,ๅŠ ่—ค", "19,ๅ‰็”ฐ", "17,ๅฑฑ็”ฐ", "7,ไฝใ€…ๆœจ", "16,ๅฑฑๅฃ", "6,ๆ–‰่—ค", "15,ๆพๆœฌ", "2,ไบ•ไธŠ", "4,ๆœจๆ‘", "14,ๆž—", "9,ๆธ…ๆฐด" }; public static void main(String[] args) { int[] idList = new int[dataList.length] ; int i = 0; // IDใ‚’ๆŠฝๅ‡บ for (String str: dataList){ String[] cutStr = str.split(",", 0); idList[i] = Integer.parseInt(cutStr[0]); i++; } // IDใ‚’ใ‚ฝใƒผใƒˆ Arrays.sort(idList); // ใ‚ฝใƒผใƒˆใ—ใŸID้ †ใซใ€dataListใ‚’่กจ็คบ for (int id: idList) { for (String ptintStr: dataList) { String[] cutStr = ptintStr.split(",", 0); if (id == Integer.parseInt(cutStr[0])) { System.out.println(ptintStr); } } } } } // ๅฎŒๆˆใพใงใฎๆ™‚้–“: 50ๅˆ†
1,593
0.455336
0.409486
77
15.441559
12.863412
46
false
false
0
0
0
0
0
0
1.493507
false
false
13
9800c92a73c29a5189dc037b067bab587aeddff3
12,884,901,956,478
6c00de574dab4c4b89f07cf5e4f7359ac9ab05b3
/src/com/company/Main.java
895a8ddd0086f001360ebaa9aeebbd337e36be81
[]
no_license
kostet802/lab2
https://github.com/kostet802/lab2
9d5e5833ffbd1e9d71a8b7119107bf6a4671fd7c
0c712d3b3dadf5fc91ccee97810600a97ad0d713
refs/heads/master
2020-09-14T05:47:29.926000
2019-11-20T22:23:52
2019-11-20T22:23:52
223,038,347
0
0
null
false
2019-11-21T08:30:04
2019-11-20T22:21:43
2019-11-20T22:23:54
2019-11-21T08:26:34
2
0
0
1
Java
false
false
package com.company; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); Phone phone1 = new Phone(); System.out.println("Enter num " + "\n"); String num = sc.nextLine(); System.out.println("Enter fio " + "\n"); String fio = sc.nextLine(); System.out.println("Enter adres " + "\n"); String adr = sc.nextLine(); phone1.setNumber(num); phone1.setFio(fio); phone1.setAdres(adr); System.out.println("Number " + "\n" + phone1.getNumber()); System.out.println("Fio " + "\n" + phone1.getFio()); System.out.println("Adres " + "\n" + phone1.getAdres()); } }
UTF-8
Java
747
java
Main.java
Java
[]
null
[]
package com.company; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); Phone phone1 = new Phone(); System.out.println("Enter num " + "\n"); String num = sc.nextLine(); System.out.println("Enter fio " + "\n"); String fio = sc.nextLine(); System.out.println("Enter adres " + "\n"); String adr = sc.nextLine(); phone1.setNumber(num); phone1.setFio(fio); phone1.setAdres(adr); System.out.println("Number " + "\n" + phone1.getNumber()); System.out.println("Fio " + "\n" + phone1.getFio()); System.out.println("Adres " + "\n" + phone1.getAdres()); } }
747
0.56091
0.551539
27
26.666666
21.614468
66
false
false
0
0
0
0
0
0
0.592593
false
false
13
6dc8853ed355baedd53b8b33b25185be51405b22
25,512,105,773,188
fcff798714737e65f63594b553d8102f9cd8182c
/src/Utils/Images.java
63781897a2ffad0553481fa22b67f375059b3a46
[]
no_license
dmchen2015/Dynamic-AGVs-Management-Simulation
https://github.com/dmchen2015/Dynamic-AGVs-Management-Simulation
c133dfd3a769f3cac89d5a8a272cbc2b5373e444
6bae70c403d3ee806576dcf422d73b48d13839d2
refs/heads/master
2021-01-16T15:14:51.156000
2017-02-01T21:57:53
2017-02-01T21:57:53
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Utils; import javax.imageio.ImageIO; import java.awt.*; import java.io.File; import java.io.IOException; import java.util.HashMap; /** * Created by danie on 10/12/2016. */ public class Images { private final HashMap images = new HashMap(); public Images() { try { for (int i = 1; i <= 5; i++) { for (int x = 1; x <= 8; x++) { String name = i + "_" + x; Image image = ImageIO.read(new File("src/AGVimages/" + name+".jpg")); images.put(name, image); } } } catch (IOException e) { e.printStackTrace(); } } public Image getImage(int initialPower,int power,int maxCapacity, int currentCapacity) { int bat = power*5/initialPower; int cap = currentCapacity*8/maxCapacity; System.out.println("MERDA: "+currentCapacity); if(bat == 0) bat=1; cap++; if(cap > 8) cap = 8; String im = bat+"_"+cap; return (Image) images.get(im); } public static void main(String[] args) { Images im = new Images(); Image img = im.getImage(10,10,50,20); if(img == null) System.out.println("รฉ nulo"); } }
UTF-8
Java
1,294
java
Images.java
Java
[ { "context": "tion;\nimport java.util.HashMap;\n\n/**\n * Created by danie on 10/12/2016.\n */\npublic class Images {\n priv", "end": 164, "score": 0.9956179857254028, "start": 159, "tag": "USERNAME", "value": "danie" } ]
null
[]
package Utils; import javax.imageio.ImageIO; import java.awt.*; import java.io.File; import java.io.IOException; import java.util.HashMap; /** * Created by danie on 10/12/2016. */ public class Images { private final HashMap images = new HashMap(); public Images() { try { for (int i = 1; i <= 5; i++) { for (int x = 1; x <= 8; x++) { String name = i + "_" + x; Image image = ImageIO.read(new File("src/AGVimages/" + name+".jpg")); images.put(name, image); } } } catch (IOException e) { e.printStackTrace(); } } public Image getImage(int initialPower,int power,int maxCapacity, int currentCapacity) { int bat = power*5/initialPower; int cap = currentCapacity*8/maxCapacity; System.out.println("MERDA: "+currentCapacity); if(bat == 0) bat=1; cap++; if(cap > 8) cap = 8; String im = bat+"_"+cap; return (Image) images.get(im); } public static void main(String[] args) { Images im = new Images(); Image img = im.getImage(10,10,50,20); if(img == null) System.out.println("รฉ nulo"); } }
1,294
0.511988
0.491879
48
25.916666
20.764385
92
false
false
0
0
0
0
0
0
0.6875
false
false
13
90f89d6665e62ff657814e5a2f27be7b61ec6b84
6,408,091,260,299
ecb8b37613fb3c41bb58e90a23c5383a0444e490
/clients-k8s/src/main/java/com/simplyti/service/clients/k8s/pods/builder/ResourcesHolder.java
df6e344a7280ce1252e88608af97e09a5b920458
[]
no_license
simplyti/simple-server
https://github.com/simplyti/simple-server
56d232ded25198a17c92c9b732b7a5986933aff8
edb32f6db6d3bb38ce3400a904f8e942817d385b
refs/heads/master
2022-12-22T10:38:54.273000
2022-04-10T19:31:25
2022-04-10T19:31:25
129,148,945
6
1
null
false
2022-12-12T21:44:11
2018-04-11T20:15:54
2021-12-28T23:10:15
2022-12-12T21:44:11
293,778
5
1
2
Java
false
false
package com.simplyti.service.clients.k8s.pods.builder; import com.simplyti.service.clients.k8s.pods.domain.Resources; public interface ResourcesHolder { void setResources(Resources resources); }
UTF-8
Java
200
java
ResourcesHolder.java
Java
[]
null
[]
package com.simplyti.service.clients.k8s.pods.builder; import com.simplyti.service.clients.k8s.pods.domain.Resources; public interface ResourcesHolder { void setResources(Resources resources); }
200
0.815
0.805
9
21.222221
24.638622
62
false
false
0
0
0
0
0
0
0.444444
false
false
13
430f6550e83b4d44eb3514eb165d50290081b390
18,313,740,590,890
05f920c6ad6e23890979da4381527ec1d0586d33
/src/main/java/com/grad/controller/ProjectController.java
88c8238abbc5241bcb851af405f8f0f327e29e46
[]
no_license
37176427/grad
https://github.com/37176427/grad
5e3fc3dfdec7519b000d7c5a60f83c2086c649b2
2f03df80bd518f3526affe3cd9313ce94eaa4405
refs/heads/master
2020-03-10T05:32:34.769000
2018-04-24T08:14:18
2018-04-24T08:14:18
129,183,266
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.grad.controller; import com.grad.common.eneity.QueryResultObject; import com.grad.eneity.Project; import com.grad.eneity.User; import com.grad.service.ProjectService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import javax.servlet.http.HttpSession; import java.util.List; import java.util.Map; /** * ๆ่ฟฐ ๏ผš้กน็›ฎ้กต้ขcontroller * ไฝœ่€… ๏ผšWangYunHe * ๆ—ถ้—ด ๏ผš2018/4/18 14:37 **/ @Controller @RequestMapping("/project/pro") public class ProjectController { @Autowired private ProjectService ps; /** * ๅˆ†้กตๆŸฅ่ฏข */ @RequestMapping("/initPaging") @ResponseBody public QueryResultObject initPaging(Integer pageNumber, Integer pageSize, String projectName) { QueryResultObject object = new QueryResultObject(); Map<String, Object> map = ps.limitQuery(pageNumber, pageSize, projectName); object.setMsg("ๆŸฅ่ฏขๆˆๅŠŸ"); object.setData(map); object.setResult(true); return object; } /** * ็”จๆˆทๅๆŸฅ่ฏข */ @RequestMapping("/initPagingByName") @ResponseBody public QueryResultObject initPagingByName(Integer pageNumber, Integer pageSize, String realName) { QueryResultObject object = new QueryResultObject(); Map<String, Object> map = ps.limitQueryByName(pageNumber, pageSize, realName); object.setMsg("ๆŸฅ่ฏขๆˆๅŠŸ"); object.setData(map); object.setResult(true); return object; } /** * ๆทปๅŠ ้กน็›ฎ */ @RequestMapping("/add") @ResponseBody public QueryResultObject add(Project project, HttpSession session) { return ps.addProjectService(project, session); } /** * ๆ นๆฎ็ผ–ๅทๆŸฅ่ฏข้กน็›ฎ */ @RequestMapping("/queryByNumber") @ResponseBody public QueryResultObject queryByNumber(Integer number) { return ps.queryByNumber(number); } /** * ไฟฎๆ”น้กน็›ฎ */ @RequestMapping("/edit") @ResponseBody public QueryResultObject edit(Project project, HttpSession session) { return ps.updateProjectService(project, session); } /** * ๅ•ไธชๅˆ ้™ค้กน็›ฎ */ @RequestMapping("/del") @ResponseBody public QueryResultObject del(String name, Integer id, HttpSession session) { QueryResultObject object = new QueryResultObject(); User nowUser = (User) session.getAttribute("user"); if (nowUser == null) { object.setMsg("็™ปๅฝ•่ฟ‡ๆœŸ๏ผ่ฏท้‡ๆ–ฐ็™ปๅฝ•๏ผ"); object.setResult(false); return object; } Project p = ps.findById(id); if (p != null) { //ไธ่ƒฝๅˆ ้™คไป–ไบบ็š„้กน็›ฎ if (!p.getCreateUser().equals(nowUser.getRealName())) { object.setMsg("ไฝ ๆ— ๆƒๅˆ ้™คไป–ไบบ็š„้กน็›ฎ๏ผ"); object.setResult(false); return object; } //ๅทฒๅฎกๆ ธ็š„ไธ่ƒฝๅˆ ้™ค if (p.getStatus() == 1) { object.setMsg("ๅทฒๅฎกๆ ธ้€š่ฟ‡็š„ไธ่ƒฝๅˆ ้™ค๏ผ"); object.setResult(false); return object; } Integer integer = ps.delById(id); if (integer > 0) { object.setResult(true); object.setMsg("ๅˆ ้™คๆˆๅŠŸ"); } else { object.setResult(false); object.setMsg("ๅˆ ้™คๅคฑ่ดฅ๏ผŒ่ฏท็จๅŽๅฐ่ฏ•"); } } return object; } /** * ๆ‰น้‡ๅˆ ้™ค้กน็›ฎ */ @RequestMapping("/batchDel") @ResponseBody public QueryResultObject batchDel(String ids, HttpSession session) { QueryResultObject object = new QueryResultObject(); User nowUser = (User) session.getAttribute("user"); if (nowUser == null) { object.setMsg("็™ปๅฝ•่ฟ‡ๆœŸ๏ผ่ฏท้‡ๆ–ฐ็™ปๅฝ•๏ผ"); object.setResult(false); return object; } if (ids != null && ids.length() > 0) { String[] array = ids.split(","); List<Project> list = ps.findByIds(array); for (Project p : list) { if (!p.getCreateUser().equals(nowUser.getRealName())) { object.setMsg("ๆ‚จ้€‰ๆ‹ฉ็š„้กน็›ฎไธญๅŒ…ๅซๅˆ›ๅปบ่€…ไธๆ˜ฏๆ‚จ็š„๏ผ"); object.setResult(false); return object; } if (p.getStatus() == 1) { object.setResult(false); object.setMsg("ๆ‚จ้€‰ๆ‹ฉ็š„้กน็›ฎไธญๅŒ…ๅซๅทฒ็ปๅฎกๆ ธ้€š่ฟ‡็š„๏ผ"); return object; } } int counter = ps.batchDel(array); if (counter > 0 && counter == array.length) { object.setMsg("ๅˆ ้™คๆˆๅŠŸ"); object.setResult(true); } else { object.setMsg("้ƒจๅˆ†ๅˆ ้™คๆˆๅŠŸ"); object.setResult(true); } } else { object.setResult(false); object.setMsg("่ฏทๆฃ€ๆŸฅ่ฆๅˆ ้™ค็š„้กน็›ฎ็š„ๅ‡†็กฎๆ€ง"); } return object; } }
UTF-8
Java
5,304
java
ProjectController.java
Java
[ { "context": " java.util.Map;\n\n/**\n * ๆ่ฟฐ ๏ผš้กน็›ฎ้กต้ขcontroller\n * ไฝœ่€… ๏ผšWangYunHe\n * ๆ—ถ้—ด ๏ผš2018/4/18 14:37\n **/\n@Controller\n@RequestM", "end": 545, "score": 0.9994928240776062, "start": 536, "tag": "NAME", "value": "WangYunHe" } ]
null
[]
package com.grad.controller; import com.grad.common.eneity.QueryResultObject; import com.grad.eneity.Project; import com.grad.eneity.User; import com.grad.service.ProjectService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; import javax.servlet.http.HttpSession; import java.util.List; import java.util.Map; /** * ๆ่ฟฐ ๏ผš้กน็›ฎ้กต้ขcontroller * ไฝœ่€… ๏ผšWangYunHe * ๆ—ถ้—ด ๏ผš2018/4/18 14:37 **/ @Controller @RequestMapping("/project/pro") public class ProjectController { @Autowired private ProjectService ps; /** * ๅˆ†้กตๆŸฅ่ฏข */ @RequestMapping("/initPaging") @ResponseBody public QueryResultObject initPaging(Integer pageNumber, Integer pageSize, String projectName) { QueryResultObject object = new QueryResultObject(); Map<String, Object> map = ps.limitQuery(pageNumber, pageSize, projectName); object.setMsg("ๆŸฅ่ฏขๆˆๅŠŸ"); object.setData(map); object.setResult(true); return object; } /** * ็”จๆˆทๅๆŸฅ่ฏข */ @RequestMapping("/initPagingByName") @ResponseBody public QueryResultObject initPagingByName(Integer pageNumber, Integer pageSize, String realName) { QueryResultObject object = new QueryResultObject(); Map<String, Object> map = ps.limitQueryByName(pageNumber, pageSize, realName); object.setMsg("ๆŸฅ่ฏขๆˆๅŠŸ"); object.setData(map); object.setResult(true); return object; } /** * ๆทปๅŠ ้กน็›ฎ */ @RequestMapping("/add") @ResponseBody public QueryResultObject add(Project project, HttpSession session) { return ps.addProjectService(project, session); } /** * ๆ นๆฎ็ผ–ๅทๆŸฅ่ฏข้กน็›ฎ */ @RequestMapping("/queryByNumber") @ResponseBody public QueryResultObject queryByNumber(Integer number) { return ps.queryByNumber(number); } /** * ไฟฎๆ”น้กน็›ฎ */ @RequestMapping("/edit") @ResponseBody public QueryResultObject edit(Project project, HttpSession session) { return ps.updateProjectService(project, session); } /** * ๅ•ไธชๅˆ ้™ค้กน็›ฎ */ @RequestMapping("/del") @ResponseBody public QueryResultObject del(String name, Integer id, HttpSession session) { QueryResultObject object = new QueryResultObject(); User nowUser = (User) session.getAttribute("user"); if (nowUser == null) { object.setMsg("็™ปๅฝ•่ฟ‡ๆœŸ๏ผ่ฏท้‡ๆ–ฐ็™ปๅฝ•๏ผ"); object.setResult(false); return object; } Project p = ps.findById(id); if (p != null) { //ไธ่ƒฝๅˆ ้™คไป–ไบบ็š„้กน็›ฎ if (!p.getCreateUser().equals(nowUser.getRealName())) { object.setMsg("ไฝ ๆ— ๆƒๅˆ ้™คไป–ไบบ็š„้กน็›ฎ๏ผ"); object.setResult(false); return object; } //ๅทฒๅฎกๆ ธ็š„ไธ่ƒฝๅˆ ้™ค if (p.getStatus() == 1) { object.setMsg("ๅทฒๅฎกๆ ธ้€š่ฟ‡็š„ไธ่ƒฝๅˆ ้™ค๏ผ"); object.setResult(false); return object; } Integer integer = ps.delById(id); if (integer > 0) { object.setResult(true); object.setMsg("ๅˆ ้™คๆˆๅŠŸ"); } else { object.setResult(false); object.setMsg("ๅˆ ้™คๅคฑ่ดฅ๏ผŒ่ฏท็จๅŽๅฐ่ฏ•"); } } return object; } /** * ๆ‰น้‡ๅˆ ้™ค้กน็›ฎ */ @RequestMapping("/batchDel") @ResponseBody public QueryResultObject batchDel(String ids, HttpSession session) { QueryResultObject object = new QueryResultObject(); User nowUser = (User) session.getAttribute("user"); if (nowUser == null) { object.setMsg("็™ปๅฝ•่ฟ‡ๆœŸ๏ผ่ฏท้‡ๆ–ฐ็™ปๅฝ•๏ผ"); object.setResult(false); return object; } if (ids != null && ids.length() > 0) { String[] array = ids.split(","); List<Project> list = ps.findByIds(array); for (Project p : list) { if (!p.getCreateUser().equals(nowUser.getRealName())) { object.setMsg("ๆ‚จ้€‰ๆ‹ฉ็š„้กน็›ฎไธญๅŒ…ๅซๅˆ›ๅปบ่€…ไธๆ˜ฏๆ‚จ็š„๏ผ"); object.setResult(false); return object; } if (p.getStatus() == 1) { object.setResult(false); object.setMsg("ๆ‚จ้€‰ๆ‹ฉ็š„้กน็›ฎไธญๅŒ…ๅซๅทฒ็ปๅฎกๆ ธ้€š่ฟ‡็š„๏ผ"); return object; } } int counter = ps.batchDel(array); if (counter > 0 && counter == array.length) { object.setMsg("ๅˆ ้™คๆˆๅŠŸ"); object.setResult(true); } else { object.setMsg("้ƒจๅˆ†ๅˆ ้™คๆˆๅŠŸ"); object.setResult(true); } } else { object.setResult(false); object.setMsg("่ฏทๆฃ€ๆŸฅ่ฆๅˆ ้™ค็š„้กน็›ฎ็š„ๅ‡†็กฎๆ€ง"); } return object; } }
5,304
0.56905
0.5658
164
29.024391
21.642876
102
false
false
0
0
0
0
0
0
0.518293
false
false
13
14f64f830a8e82c4b1f0b099dd420f424d7d52e5
22,771,916,665,024
e41102529330587388f252bfe45a5b2664abb901
/API-Consultor/app/controllers/Application.java
ab01c0a823db22269fbd79400e7d8478447a7550
[ "Apache-2.0" ]
permissive
mehernandez/should-i
https://github.com/mehernandez/should-i
38e1e5a59dc4f26a70c5308e3aaf6273410a5627
ecb0532ece94aeca37738ac0b53f4e1e78f13aff
refs/heads/master
2016-09-09T21:14:28.399000
2015-05-04T03:41:47
2015-05-04T03:41:47
33,203,717
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package controllers; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; import org.json.*; import play.mvc.*; import views.html.*; public class Application extends Controller { public static Result index() { return ok(index.render("API CONSULTOR is ready.")); } public static Result prueba(){ return ok("Todo esta perfecto"); } public static Result consulta(String marca , String modelo , String anio){ Result respuesta = null; String resp = ""; JSONObject ult = new JSONObject(); try { String url = "https://api.edmunds.com/"+"api/vehicle/v2/"+marca+"/"+modelo+"/"+anio+"/styles"+"?view=full&fmt=json&api_key=6zca5s7tcwmd53pjdbn7tqzw"; URL obj = new URL(url); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); int responseCode = con.getResponseCode(); BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); resp = response.toString(); // obtenemos info del JSON de edmunds try { JSONObject json = new JSONObject(resp); JSONArray ar = json.optJSONArray("styles"); boolean automatico = false; boolean manual = false; double promedio = 0; int maxPuertas = 0; int maxColores = 0; int maxVelocidades = 0; double max = 0; double min = Double.POSITIVE_INFINITY; double maxHorsePower = 0; String motor = ""; String id = ""; for (int i = 0; i < ar.length() ; i ++){ JSONObject temp = (JSONObject)ar.opt(i); System.out.println(temp); id = temp.optString("id"); motor = temp.optJSONObject("engine").optString("type"); // obtenemos max , min , promedio , numPuertas , colores double horse = temp.optJSONObject("engine").optDouble("horsepower"); if(horse > maxHorsePower){ maxHorsePower = horse; } int speeds = temp.optJSONObject("transmission").optInt("numberOfSpeeds"); if(speeds > maxVelocidades){ maxVelocidades = speeds; } String trans = temp.optJSONObject("transmission").optString("transmissionType"); if(trans.equals("AUTOMATIC")){ automatico = true; }else { manual = true; } int col = temp.optJSONArray("colors").length(); if(col > maxColores){ maxColores = col; } int pu = temp.optInt("numOfDoors"); if(pu > maxPuertas){ maxPuertas = pu; } double precio = temp.optJSONObject("price").optDouble("baseMSRP"); promedio += precio; if(precio > max ){ max = precio; } if(precio < min ){ min = precio; } } promedio = promedio/ ar.length(); ult.append("id", id); ult.append("automatico",automatico); ult.append("manual", manual); ult.append("precioPromedio", promedio); ult.append("precioMax", max); ult.append("precioMin", min); ult.append("maxPuertas", maxPuertas); ult.append("maxColores", maxColores); ult.append("maxVelocidades", maxVelocidades); ult.append("maxHP", maxHorsePower); ult.append("motor", motor); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } catch (IOException ex) { } return ok(ult.toString()); // return ok("La marca del carro es "+marca + "\n El modelo es "+ modelo + // " \n y el anio es " + anio); } }
UTF-8
Java
3,876
java
Application.java
Java
[ { "context": "o+\"/\"+anio+\"/styles\"+\"?view=full&fmt=json&api_key=6zca5s7tcwmd53pjdbn7tqzw\";\n URL obj = new URL(url);\n \t\tHttpU", "end": 825, "score": 0.999718189239502, "start": 801, "tag": "KEY", "value": "6zca5s7tcwmd53pjdbn7tqzw" } ]
null
[]
package controllers; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; import org.json.*; import play.mvc.*; import views.html.*; public class Application extends Controller { public static Result index() { return ok(index.render("API CONSULTOR is ready.")); } public static Result prueba(){ return ok("Todo esta perfecto"); } public static Result consulta(String marca , String modelo , String anio){ Result respuesta = null; String resp = ""; JSONObject ult = new JSONObject(); try { String url = "https://api.edmunds.com/"+"api/vehicle/v2/"+marca+"/"+modelo+"/"+anio+"/styles"+"?view=full&fmt=json&api_key=<KEY>"; URL obj = new URL(url); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); int responseCode = con.getResponseCode(); BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); resp = response.toString(); // obtenemos info del JSON de edmunds try { JSONObject json = new JSONObject(resp); JSONArray ar = json.optJSONArray("styles"); boolean automatico = false; boolean manual = false; double promedio = 0; int maxPuertas = 0; int maxColores = 0; int maxVelocidades = 0; double max = 0; double min = Double.POSITIVE_INFINITY; double maxHorsePower = 0; String motor = ""; String id = ""; for (int i = 0; i < ar.length() ; i ++){ JSONObject temp = (JSONObject)ar.opt(i); System.out.println(temp); id = temp.optString("id"); motor = temp.optJSONObject("engine").optString("type"); // obtenemos max , min , promedio , numPuertas , colores double horse = temp.optJSONObject("engine").optDouble("horsepower"); if(horse > maxHorsePower){ maxHorsePower = horse; } int speeds = temp.optJSONObject("transmission").optInt("numberOfSpeeds"); if(speeds > maxVelocidades){ maxVelocidades = speeds; } String trans = temp.optJSONObject("transmission").optString("transmissionType"); if(trans.equals("AUTOMATIC")){ automatico = true; }else { manual = true; } int col = temp.optJSONArray("colors").length(); if(col > maxColores){ maxColores = col; } int pu = temp.optInt("numOfDoors"); if(pu > maxPuertas){ maxPuertas = pu; } double precio = temp.optJSONObject("price").optDouble("baseMSRP"); promedio += precio; if(precio > max ){ max = precio; } if(precio < min ){ min = precio; } } promedio = promedio/ ar.length(); ult.append("id", id); ult.append("automatico",automatico); ult.append("manual", manual); ult.append("precioPromedio", promedio); ult.append("precioMax", max); ult.append("precioMin", min); ult.append("maxPuertas", maxPuertas); ult.append("maxColores", maxColores); ult.append("maxVelocidades", maxVelocidades); ult.append("maxHP", maxHorsePower); ult.append("motor", motor); } catch (JSONException e) { // TODO Auto-generated catch block e.printStackTrace(); } } catch (IOException ex) { } return ok(ult.toString()); // return ok("La marca del carro es "+marca + "\n El modelo es "+ modelo + // " \n y el anio es " + anio); } }
3,857
0.594169
0.590557
163
22.77914
22.383995
161
false
false
0
0
0
0
0
0
3.092025
false
false
13
3585e1d4adbcfa7e2fb81c4fc514a0ba2899405c
2,997,887,225,883
b45a2279db7c205a89ac66d07ad27d49528dffb0
/src/JDBCHelper/ConnectHelper.java
8c62bbab155966a7a76e72214efe0baf0e79f3b0
[]
no_license
DungnmPH11742/Du-AnMau
https://github.com/DungnmPH11742/Du-AnMau
addd77cfeda65d17208b0ba20baa6784b5b6c88d
43571d8e64c22367318c2b318a4f9134ecb3810b
refs/heads/master
2023-03-12T12:50:35.449000
2021-03-01T09:08:15
2021-03-01T09:08:15
333,067,374
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package JDBCHelper; import java.sql.Connection; import java.sql.DriverManager; public class ConnectHelper { static Connection cn; static String userName = "sa", pass = "123"; static String url = "jdbc:sqlserver://localhost:1433;databaseName=polyPro"; public static Connection Connected() { if (cn == null) { openConnection(); } return cn; } //Phฦฐฦกng thแปฉc kแบฟt nแป‘i public static void openConnection() { try { cn = DriverManager.getConnection(url, userName, pass); System.out.println("Thร nh cรดng"); } catch (Exception e) { System.out.println(e); } } }
UTF-8
Java
693
java
ConnectHelper.java
Java
[ { "context": "atic Connection cn;\n static String userName = \"sa\", pass = \"123\";\n static String url = \"jdbc:sql", "end": 169, "score": 0.9984239339828491, "start": 167, "tag": "USERNAME", "value": "sa" }, { "context": "on cn;\n static String userName = \"sa\", pass = \...
null
[]
package JDBCHelper; import java.sql.Connection; import java.sql.DriverManager; public class ConnectHelper { static Connection cn; static String userName = "sa", pass = "123"; static String url = "jdbc:sqlserver://localhost:1433;databaseName=polyPro"; public static Connection Connected() { if (cn == null) { openConnection(); } return cn; } //Phฦฐฦกng thแปฉc kแบฟt nแป‘i public static void openConnection() { try { cn = DriverManager.getConnection(url, userName, pass); System.out.println("Thร nh cรดng"); } catch (Exception e) { System.out.println(e); } } }
693
0.5959
0.585652
29
22.551723
20.286884
79
false
false
0
0
0
0
0
0
0.517241
false
false
13
5d3f36b1d37dd06869486523079c55210e08aa19
19,645,180,465,187
b87d2a120f2a75799f9d2767b881644b8696fb33
/jvm-test/src/main/java/lecture1/MyTest6.java
d036702d1029edfaf80433b2b05095add772afd9
[]
no_license
hquzlh/Project
https://github.com/hquzlh/Project
48702c72667d88ffaad957a0799f9cc1cd4ade63
3056c80790ff16b839fc78fa865d6fe3729f2d6b
refs/heads/zhuliheng
2022-08-13T21:34:04.246000
2019-11-05T00:49:43
2019-11-05T00:49:43
219,624,892
0
0
null
false
2022-06-10T20:00:11
2019-11-05T00:44:58
2019-11-05T00:53:06
2022-06-10T20:00:11
32,162
0
0
11
Java
false
false
package lecture1; import java.security.Signature; /** * @program: jvm-test * @description: * @author: Mr.Zhu * @create: 2019-09-24 13:30 **/ public class MyTest6 { public static void main(String[] args) { Singleton singleton=Singleton.getInstance(); System.out.println("counter1="+Singleton.counter1); System.out.println("counter2="+Singleton.counter2); } } class Singleton{ public static int counter1=1; private static Singleton singleton = new Singleton(); private Singleton(){ counter1++; counter2++; System.out.println(counter1+"----"+counter2); } public static int counter2=0; public static Singleton getInstance(){ return singleton; } }
UTF-8
Java
745
java
MyTest6.java
Java
[ { "context": " * @program: jvm-test\n * @description:\n * @author: Mr.Zhu\n * @create: 2019-09-24 13:30\n **/\n\npublic class M", "end": 113, "score": 0.9591768980026245, "start": 107, "tag": "NAME", "value": "Mr.Zhu" } ]
null
[]
package lecture1; import java.security.Signature; /** * @program: jvm-test * @description: * @author: Mr.Zhu * @create: 2019-09-24 13:30 **/ public class MyTest6 { public static void main(String[] args) { Singleton singleton=Singleton.getInstance(); System.out.println("counter1="+Singleton.counter1); System.out.println("counter2="+Singleton.counter2); } } class Singleton{ public static int counter1=1; private static Singleton singleton = new Singleton(); private Singleton(){ counter1++; counter2++; System.out.println(counter1+"----"+counter2); } public static int counter2=0; public static Singleton getInstance(){ return singleton; } }
745
0.644295
0.609396
33
21.575758
19.116913
59
false
false
0
0
0
0
0
0
0.363636
false
false
13
2a4196e15605284052184af947f32ff933b95ed1
30,408,368,469,150
440c882b073b074432ace396d17b13ee87b0e703
/framework/src/main/java/org/radargun/stages/ReportBackgroundStatsStage.java
019e949d1d647d0b30b361874bdcd65fbee2c5bf
[]
no_license
leizhilong/radargun
https://github.com/leizhilong/radargun
e69eeff3ff3fb266ea5fdca31851445feeb3da31
1e64339906315b77e279682aefdb06e349b2fab9
refs/heads/master
2021-01-18T19:41:44.565000
2013-07-09T05:10:34
2013-07-09T05:10:34
10,960,413
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.radargun.stages; import java.io.*; import java.text.DecimalFormat; import java.text.Format; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.List; import java.util.Map; import java.util.Set; import org.radargun.config.Property; import org.radargun.config.Stage; import org.radargun.reporting.CSVChart; import org.radargun.stressors.BackgroundOpsManager; import org.radargun.stressors.SimpleStatistics; /** * Generates reports from Statistics. * * @author Michal Linhard <mlinhard@redhat.com> */ @Stage(doc = "Generates reports from Statistics.") public class ReportBackgroundStatsStage extends AbstractMasterStage { public static final Format NUMFORMAT = new DecimalFormat("0.000"); private static final SimpleDateFormat DATEFORMAT = new SimpleDateFormat("HH:mm:ss,SSS"); private static final double NS_IN_MS = 1000000; @Property(doc = "Directory where the reports should be written. Default is 'reports'") private String targetDir = "reports"; @Property(doc = "Width of the produced charts. Default is 800px.") private int chartWidth = 800; @Property(doc = "Height of the produced charts. Default is 600px.") private int chartHeight = 600; @Property(doc = "Generate files for verifying time synchronization of slaves. Default is false.") private boolean generateIntervalTimeData = false; @Property(doc = "Set of slaves whose results should be ignored. Default is empty.") private Set<Integer> ignore; public boolean execute() { @SuppressWarnings("unchecked") Map<Integer, List<SimpleStatistics>> allResults = (Map<Integer, List<SimpleStatistics>>) masterState.get(BackgroundOpsManager.NAME); if (allResults == null) { log.error("Could not find BackgroundStressors results on the master. Master's state is " + masterState); return false; } if (allResults.size() == 0) { log.warn("Nothing to report!"); return false; } if (masterState.getSlavesCountForCurrentStage() != allResults.size()) { log.error("We're missing statistics from some slaves"); return false; } List<List<SimpleStatistics>> results = new ArrayList<List<SimpleStatistics>>(); if (ignore != null) { for (int slave : allResults.keySet()) { if (!ignore.contains(slave)) { results.add(allResults.get(slave)); } } } else { results.addAll(allResults.values()); } try { File reportDir = new File(targetDir); if (!reportDir.exists() && !reportDir.mkdirs()) { log.error("Couldn't create directory " + targetDir); return false; } File subdir = new File(reportDir, masterState.nameOfTheCurrentBenchmark() + "_" + masterState.configNameOfTheCurrentBenchmark() + "_" + results.size()); if (!subdir.exists() && !subdir.mkdirs()) { log.error("Couldn't create directory " + subdir.getAbsolutePath()); return false; } int maxResultSize = -1; for (int i = 0; i < results.size(); i++) { if (maxResultSize < results.get(i).size()) { maxResultSize = results.get(i).size(); } } File csvThroughput = new File(subdir, "throughput.csv"); File csvTotalThroughput = new File(subdir, "total-throughput.csv"); File csvAvgRespTimes = new File(subdir, "avg-response-times.csv"); File csvEntryCounts = new File(subdir, "entry-counts.csv"); File csvNullGets = new File(subdir, "null-responses.csv"); File csvErrors = new File(subdir, "errors.csv"); File csvTotals = new File(subdir, "total.csv"); generateMultiSlaveCsv(csvThroughput, results, maxResultSize, new StatGetter() { @Override public String getStat(SimpleStatistics cell) { if (cell != null && cell.isNodeUp()) { return ffcsv(cell.getThroughput()); } else { return "0.0"; } } }); generateMultiSlaveCsv(csvAvgRespTimes, results, maxResultSize, new StatGetter() { @Override public String getStat(SimpleStatistics cell) { if (cell != null && cell.isNodeUp()) { return ffcsv(cell.getAvgResponseTime() / NS_IN_MS); } else { return "0.0"; } } }); generateMultiSlaveCsv(csvNullGets, results, maxResultSize, new StatGetter() { @Override public String getStat(SimpleStatistics cell) { if (cell != null && cell.isNodeUp()) { return Long.toString(cell.getRequestsNullGet()); } else { return "0"; } } }); generateMultiSlaveCsv(csvErrors, results, maxResultSize, new StatGetter() { @Override public String getStat(SimpleStatistics cell) { if (cell != null && cell.isNodeUp()) { return Long.toString(cell.getNumErrors()); } else { return "0"; } } }); if (generateIntervalTimeData) { generateMultiSlaveCsv(new File(subdir, "interval-time-begin.csv"), results, maxResultSize, new StatGetter() { @Override public String getStat(SimpleStatistics cell) { return cell != null ? humanReadableTime(cell.getIntervalBeginTime()) : ""; } }); generateMultiSlaveCsv(new File(subdir, "interval-time-end.csv"), results, maxResultSize, new StatGetter() { @Override public String getStat(SimpleStatistics cell) { return cell != null ? humanReadableTime(cell.getIntervalEndTime()) : ""; } }); generateMultiSlaveCsv(new File(subdir, "interval-duration.csv"), results, maxResultSize, new StatGetter() { @Override public String getStat(SimpleStatistics cell) { return cell != null ? Long.toString(cell.getDuration()) : ""; } }); } generateEntryCountCsv(csvEntryCounts, results, maxResultSize); generateTotalsCsv(csvTotals, results, maxResultSize); generateTotalThroughputCsvFromThroughputCsv(csvThroughput.getAbsolutePath(), csvTotalThroughput.getAbsolutePath()); List<String> total = new ArrayList<String>(); total.add("TOTAL"); CSVChart.writeCSVAsChart("Throughput on slaves", "Iteration", "Throughput (ops/sec)", csvThroughput.getAbsolutePath(), CSVChart.SEPARATOR, "Iteration", getSlaveNames(), chartWidth, chartHeight, replaceExtension(csvThroughput.getAbsolutePath(), "png")); CSVChart.writeCSVAsChart("Total Throughput", "Iteration", "Throughput (ops/sec)", csvTotalThroughput.getAbsolutePath(), CSVChart.SEPARATOR, "Iteration", total, chartWidth, chartHeight, replaceExtension(csvTotalThroughput.getAbsolutePath(), "png")); CSVChart.writeCSVAsChart("Average response times", "Iteration", "Average response time (ms)", csvAvgRespTimes.getAbsolutePath(), CSVChart.SEPARATOR, "Iteration", getSlaveNames(), chartWidth, chartHeight, replaceExtension(csvAvgRespTimes.getAbsolutePath(), "png")); CSVChart.writeCSVAsChart("Entry counts in slaves", "Iteration", "Number of entries", csvEntryCounts.getAbsolutePath(), CSVChart.SEPARATOR, "Iteration", getSlaveNames(), chartWidth, chartHeight, replaceExtension(csvEntryCounts.getAbsolutePath(), "png")); CSVChart.writeCSVAsChart("Max. Relative deviation of entry counts", "Iteration", "Relative deviation (%)", csvEntryCounts.getAbsolutePath(), CSVChart.SEPARATOR, "Iteration", Collections.singletonList("MaxRelDev"), chartWidth, chartHeight, replaceExtension(csvEntryCounts.getAbsolutePath(), "deviation.png")); CSVChart.writeCSVAsChart("Null response count", "Iteration", "Number of null responses", csvNullGets.getAbsolutePath(), CSVChart.SEPARATOR, "Iteration", getSlaveNames(), chartWidth, chartHeight, replaceExtension(csvNullGets.getAbsolutePath(), "png")); CSVChart.writeCSVAsChart("Number of errors on slaves", "Iteration", "Number of errors", csvErrors.getAbsolutePath(), CSVChart.SEPARATOR, "Iteration", getSlaveNames(), chartWidth, chartHeight, replaceExtension(csvErrors.getAbsolutePath(), "png")); return true; } catch (Exception e) { log.error("Error while generating CSV from BackgroundStressors", e); return false; } } private String replaceExtension(String filename, String newExtension) { if (filename == null) { return null; } int dotIndex = filename.lastIndexOf("."); if (dotIndex == -1) { return filename + newExtension; } else { return filename.substring(0, dotIndex + 1) + newExtension; } } private static String ffcsv(double val) { return (Double.isNaN(val) || val == Double.MAX_VALUE || val == Double.MIN_VALUE) ? CSVChart.NULL : NUMFORMAT .format(val); } private List<String> getSlaveNames() { List<String> result = new ArrayList<String>(); for (int i = 0; i < masterState.getSlavesCountForCurrentStage(); i++) { result.add("slave" + i); } return result; } private void generateMultiSlaveCsv(File file, List<List<SimpleStatistics>> results, int maxResultSize, StatGetter getter) throws Exception { PrintWriter w = new PrintWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8")); w.print("Iteration"); List<String> slaveNames = getSlaveNames(); for (int i = 0; i < slaveNames.size(); i++) { w.print(CSVChart.SEPARATOR); w.print(slaveNames.get(i)); } w.println(); for (int i = 0; i < maxResultSize; i++) { w.print(i); for (int j = 0; j < results.size(); j++) { w.print(CSVChart.SEPARATOR); List<SimpleStatistics> statList = results.get(j); if (i < statList.size()) { w.print(getter.getStat(statList.get(i))); } else { w.print(CSVChart.NULL); } } w.println(); } w.close(); } private void generateEntryCountCsv(File file, List<List<SimpleStatistics>> results, int maxResultSize) throws Exception { PrintWriter w = new PrintWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8")); w.print("Iteration"); List<String> slaveNames = getSlaveNames(); for (int i = 0; i < slaveNames.size(); i++) { w.print(CSVChart.SEPARATOR); w.print(slaveNames.get(i)); } w.print(CSVChart.SEPARATOR); w.print("MaxRelDev"); w.println(); List<SimpleStatistics> row = new ArrayList<SimpleStatistics>(); for (int i = 0; i < maxResultSize; i++) { w.print(i); row.clear(); for (int j = 0; j < results.size(); j++) { w.print(CSVChart.SEPARATOR); List<SimpleStatistics> statList = results.get(j); if (i < statList.size() && statList.get(i).getCacheSize() != -1 && statList.get(i).isNodeUp()) { w.print(statList.get(i).getCacheSize()); row.add(statList.get(i)); } else { w.print(0); } } w.print(CSVChart.SEPARATOR); w.print(ffcsv(SimpleStatistics.getCacheSizeMaxRelativeDeviation(row))); w.println(); } w.close(); } private void generateTotalsCsv(File file, List<List<SimpleStatistics>> results, int maxResultSize) throws Exception { PrintWriter w = new PrintWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8")); w.print("Iteration"); w.print(CSVChart.SEPARATOR); w.print("IntervalBeginMin"); w.print(CSVChart.SEPARATOR); w.print("IntervalEndMax"); w.print(CSVChart.SEPARATOR); w.print("IntervalBeginDiff"); w.print(CSVChart.SEPARATOR); w.print("IntervalEndDiff"); w.print(CSVChart.SEPARATOR); w.print("TotalThroughput"); w.print(CSVChart.SEPARATOR); w.print("AvgThroughput"); w.print(CSVChart.SEPARATOR); w.print("AvgRespTime"); w.print(CSVChart.SEPARATOR); w.print("MaxRespTime"); w.print(CSVChart.SEPARATOR); w.print("EntryCount"); w.print(CSVChart.SEPARATOR); w.print("Errors"); w.print(CSVChart.SEPARATOR); w.print("NullRequests"); w.print(CSVChart.SEPARATOR); w.print("SlaveCount"); w.println(); List<SimpleStatistics> row = new ArrayList<SimpleStatistics>(); List<SimpleStatistics> rowAll = new ArrayList<SimpleStatistics>(); for (int i = 0; i < maxResultSize; i++) { row.clear(); rowAll.clear(); for (int j = 0; j < results.size(); j++) { List<SimpleStatistics> statList = results.get(j); if (i < statList.size()) { if (statList.get(i).isNodeUp()) { row.add(statList.get(i)); } rowAll.add(statList.get(i)); } } w.print(i); long beginMin = SimpleStatistics.getIntervalBeginMin(rowAll); long beginMax = SimpleStatistics.getIntervalBeginMax(rowAll); long endMin = SimpleStatistics.getIntervalEndMin(rowAll); long endMax = SimpleStatistics.getIntervalEndMax(rowAll); w.print(CSVChart.SEPARATOR); w.print(humanReadableTime(beginMin)); w.print(CSVChart.SEPARATOR); w.print(humanReadableTime(endMax)); w.print(CSVChart.SEPARATOR); w.print(beginMax - beginMin); w.print(CSVChart.SEPARATOR); w.print(endMax - endMin); w.print(CSVChart.SEPARATOR); w.print(SimpleStatistics.getTotalThroughput(row)); w.print(CSVChart.SEPARATOR); w.print(SimpleStatistics.getAvgThroughput(row)); w.print(CSVChart.SEPARATOR); w.print(ffcsv(SimpleStatistics.getAvgRespTime(row))); w.print(CSVChart.SEPARATOR); w.print(SimpleStatistics.getMaxRespTime(row)); w.print(CSVChart.SEPARATOR); w.print(SimpleStatistics.getTotalCacheSize(row)); w.print(CSVChart.SEPARATOR); w.print(SimpleStatistics.getTotalErrors(row)); w.print(CSVChart.SEPARATOR); w.print(SimpleStatistics.getTotalNullRequests(row)); w.print(CSVChart.SEPARATOR); w.print(row.size()); w.println(); } w.close(); } private String humanReadableTime(long aTime) { return DATEFORMAT.format(new Date(aTime)); } private interface StatGetter { String getStat(SimpleStatistics cell); } private void generateTotalThroughputCsvFromThroughputCsv(String from, String to){ try{ // Create output file FileWriter fstreamOut = new FileWriter(to); BufferedWriter out = new BufferedWriter(fstreamOut); // Initialize input FileInputStream fstreamIn = new FileInputStream(from); DataInputStream in = new DataInputStream(fstreamIn); BufferedReader br = new BufferedReader(new InputStreamReader(in)); // initialize strLine String strLine; //first line br.readLine(); out.write("Iteration;TOTAL" + System.getProperty( "line.separator" )); String[] temp; String delimiter=";"; double toReturn; while ((strLine = br.readLine()) != null) { toReturn=0; temp = strLine.split(delimiter); for (int i=1; i<temp.length; i++){ toReturn = toReturn + addValue(temp[i]); } out.write(temp[0] +";"+toReturn); out.write(System.getProperty( "line.separator" )); } //Close the input and output stream in.close(); out.close(); } catch (Exception e) {//Catch exception if any log.error("Error creating total throughput csv: ", e); } } private static boolean isDouble(String string) { try { Double.valueOf(string); return true; } catch (NumberFormatException e) { return false; } } private static double addValue(String value){ if (isDouble(value)){ return Double.valueOf(value); } return 0; } }
UTF-8
Java
16,896
java
ReportBackgroundStatsStage.java
Java
[ { "context": " Generates reports from Statistics.\n * \n * @author Michal Linhard <mlinhard@redhat.com>\n */\n@Stage(doc = \"Generates", "end": 572, "score": 0.9998592138290405, "start": 558, "tag": "NAME", "value": "Michal Linhard" }, { "context": "s from Statistics.\n * \n * @autho...
null
[]
package org.radargun.stages; import java.io.*; import java.text.DecimalFormat; import java.text.Format; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Collections; import java.util.Date; import java.util.List; import java.util.Map; import java.util.Set; import org.radargun.config.Property; import org.radargun.config.Stage; import org.radargun.reporting.CSVChart; import org.radargun.stressors.BackgroundOpsManager; import org.radargun.stressors.SimpleStatistics; /** * Generates reports from Statistics. * * @author <NAME> <<EMAIL>> */ @Stage(doc = "Generates reports from Statistics.") public class ReportBackgroundStatsStage extends AbstractMasterStage { public static final Format NUMFORMAT = new DecimalFormat("0.000"); private static final SimpleDateFormat DATEFORMAT = new SimpleDateFormat("HH:mm:ss,SSS"); private static final double NS_IN_MS = 1000000; @Property(doc = "Directory where the reports should be written. Default is 'reports'") private String targetDir = "reports"; @Property(doc = "Width of the produced charts. Default is 800px.") private int chartWidth = 800; @Property(doc = "Height of the produced charts. Default is 600px.") private int chartHeight = 600; @Property(doc = "Generate files for verifying time synchronization of slaves. Default is false.") private boolean generateIntervalTimeData = false; @Property(doc = "Set of slaves whose results should be ignored. Default is empty.") private Set<Integer> ignore; public boolean execute() { @SuppressWarnings("unchecked") Map<Integer, List<SimpleStatistics>> allResults = (Map<Integer, List<SimpleStatistics>>) masterState.get(BackgroundOpsManager.NAME); if (allResults == null) { log.error("Could not find BackgroundStressors results on the master. Master's state is " + masterState); return false; } if (allResults.size() == 0) { log.warn("Nothing to report!"); return false; } if (masterState.getSlavesCountForCurrentStage() != allResults.size()) { log.error("We're missing statistics from some slaves"); return false; } List<List<SimpleStatistics>> results = new ArrayList<List<SimpleStatistics>>(); if (ignore != null) { for (int slave : allResults.keySet()) { if (!ignore.contains(slave)) { results.add(allResults.get(slave)); } } } else { results.addAll(allResults.values()); } try { File reportDir = new File(targetDir); if (!reportDir.exists() && !reportDir.mkdirs()) { log.error("Couldn't create directory " + targetDir); return false; } File subdir = new File(reportDir, masterState.nameOfTheCurrentBenchmark() + "_" + masterState.configNameOfTheCurrentBenchmark() + "_" + results.size()); if (!subdir.exists() && !subdir.mkdirs()) { log.error("Couldn't create directory " + subdir.getAbsolutePath()); return false; } int maxResultSize = -1; for (int i = 0; i < results.size(); i++) { if (maxResultSize < results.get(i).size()) { maxResultSize = results.get(i).size(); } } File csvThroughput = new File(subdir, "throughput.csv"); File csvTotalThroughput = new File(subdir, "total-throughput.csv"); File csvAvgRespTimes = new File(subdir, "avg-response-times.csv"); File csvEntryCounts = new File(subdir, "entry-counts.csv"); File csvNullGets = new File(subdir, "null-responses.csv"); File csvErrors = new File(subdir, "errors.csv"); File csvTotals = new File(subdir, "total.csv"); generateMultiSlaveCsv(csvThroughput, results, maxResultSize, new StatGetter() { @Override public String getStat(SimpleStatistics cell) { if (cell != null && cell.isNodeUp()) { return ffcsv(cell.getThroughput()); } else { return "0.0"; } } }); generateMultiSlaveCsv(csvAvgRespTimes, results, maxResultSize, new StatGetter() { @Override public String getStat(SimpleStatistics cell) { if (cell != null && cell.isNodeUp()) { return ffcsv(cell.getAvgResponseTime() / NS_IN_MS); } else { return "0.0"; } } }); generateMultiSlaveCsv(csvNullGets, results, maxResultSize, new StatGetter() { @Override public String getStat(SimpleStatistics cell) { if (cell != null && cell.isNodeUp()) { return Long.toString(cell.getRequestsNullGet()); } else { return "0"; } } }); generateMultiSlaveCsv(csvErrors, results, maxResultSize, new StatGetter() { @Override public String getStat(SimpleStatistics cell) { if (cell != null && cell.isNodeUp()) { return Long.toString(cell.getNumErrors()); } else { return "0"; } } }); if (generateIntervalTimeData) { generateMultiSlaveCsv(new File(subdir, "interval-time-begin.csv"), results, maxResultSize, new StatGetter() { @Override public String getStat(SimpleStatistics cell) { return cell != null ? humanReadableTime(cell.getIntervalBeginTime()) : ""; } }); generateMultiSlaveCsv(new File(subdir, "interval-time-end.csv"), results, maxResultSize, new StatGetter() { @Override public String getStat(SimpleStatistics cell) { return cell != null ? humanReadableTime(cell.getIntervalEndTime()) : ""; } }); generateMultiSlaveCsv(new File(subdir, "interval-duration.csv"), results, maxResultSize, new StatGetter() { @Override public String getStat(SimpleStatistics cell) { return cell != null ? Long.toString(cell.getDuration()) : ""; } }); } generateEntryCountCsv(csvEntryCounts, results, maxResultSize); generateTotalsCsv(csvTotals, results, maxResultSize); generateTotalThroughputCsvFromThroughputCsv(csvThroughput.getAbsolutePath(), csvTotalThroughput.getAbsolutePath()); List<String> total = new ArrayList<String>(); total.add("TOTAL"); CSVChart.writeCSVAsChart("Throughput on slaves", "Iteration", "Throughput (ops/sec)", csvThroughput.getAbsolutePath(), CSVChart.SEPARATOR, "Iteration", getSlaveNames(), chartWidth, chartHeight, replaceExtension(csvThroughput.getAbsolutePath(), "png")); CSVChart.writeCSVAsChart("Total Throughput", "Iteration", "Throughput (ops/sec)", csvTotalThroughput.getAbsolutePath(), CSVChart.SEPARATOR, "Iteration", total, chartWidth, chartHeight, replaceExtension(csvTotalThroughput.getAbsolutePath(), "png")); CSVChart.writeCSVAsChart("Average response times", "Iteration", "Average response time (ms)", csvAvgRespTimes.getAbsolutePath(), CSVChart.SEPARATOR, "Iteration", getSlaveNames(), chartWidth, chartHeight, replaceExtension(csvAvgRespTimes.getAbsolutePath(), "png")); CSVChart.writeCSVAsChart("Entry counts in slaves", "Iteration", "Number of entries", csvEntryCounts.getAbsolutePath(), CSVChart.SEPARATOR, "Iteration", getSlaveNames(), chartWidth, chartHeight, replaceExtension(csvEntryCounts.getAbsolutePath(), "png")); CSVChart.writeCSVAsChart("Max. Relative deviation of entry counts", "Iteration", "Relative deviation (%)", csvEntryCounts.getAbsolutePath(), CSVChart.SEPARATOR, "Iteration", Collections.singletonList("MaxRelDev"), chartWidth, chartHeight, replaceExtension(csvEntryCounts.getAbsolutePath(), "deviation.png")); CSVChart.writeCSVAsChart("Null response count", "Iteration", "Number of null responses", csvNullGets.getAbsolutePath(), CSVChart.SEPARATOR, "Iteration", getSlaveNames(), chartWidth, chartHeight, replaceExtension(csvNullGets.getAbsolutePath(), "png")); CSVChart.writeCSVAsChart("Number of errors on slaves", "Iteration", "Number of errors", csvErrors.getAbsolutePath(), CSVChart.SEPARATOR, "Iteration", getSlaveNames(), chartWidth, chartHeight, replaceExtension(csvErrors.getAbsolutePath(), "png")); return true; } catch (Exception e) { log.error("Error while generating CSV from BackgroundStressors", e); return false; } } private String replaceExtension(String filename, String newExtension) { if (filename == null) { return null; } int dotIndex = filename.lastIndexOf("."); if (dotIndex == -1) { return filename + newExtension; } else { return filename.substring(0, dotIndex + 1) + newExtension; } } private static String ffcsv(double val) { return (Double.isNaN(val) || val == Double.MAX_VALUE || val == Double.MIN_VALUE) ? CSVChart.NULL : NUMFORMAT .format(val); } private List<String> getSlaveNames() { List<String> result = new ArrayList<String>(); for (int i = 0; i < masterState.getSlavesCountForCurrentStage(); i++) { result.add("slave" + i); } return result; } private void generateMultiSlaveCsv(File file, List<List<SimpleStatistics>> results, int maxResultSize, StatGetter getter) throws Exception { PrintWriter w = new PrintWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8")); w.print("Iteration"); List<String> slaveNames = getSlaveNames(); for (int i = 0; i < slaveNames.size(); i++) { w.print(CSVChart.SEPARATOR); w.print(slaveNames.get(i)); } w.println(); for (int i = 0; i < maxResultSize; i++) { w.print(i); for (int j = 0; j < results.size(); j++) { w.print(CSVChart.SEPARATOR); List<SimpleStatistics> statList = results.get(j); if (i < statList.size()) { w.print(getter.getStat(statList.get(i))); } else { w.print(CSVChart.NULL); } } w.println(); } w.close(); } private void generateEntryCountCsv(File file, List<List<SimpleStatistics>> results, int maxResultSize) throws Exception { PrintWriter w = new PrintWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8")); w.print("Iteration"); List<String> slaveNames = getSlaveNames(); for (int i = 0; i < slaveNames.size(); i++) { w.print(CSVChart.SEPARATOR); w.print(slaveNames.get(i)); } w.print(CSVChart.SEPARATOR); w.print("MaxRelDev"); w.println(); List<SimpleStatistics> row = new ArrayList<SimpleStatistics>(); for (int i = 0; i < maxResultSize; i++) { w.print(i); row.clear(); for (int j = 0; j < results.size(); j++) { w.print(CSVChart.SEPARATOR); List<SimpleStatistics> statList = results.get(j); if (i < statList.size() && statList.get(i).getCacheSize() != -1 && statList.get(i).isNodeUp()) { w.print(statList.get(i).getCacheSize()); row.add(statList.get(i)); } else { w.print(0); } } w.print(CSVChart.SEPARATOR); w.print(ffcsv(SimpleStatistics.getCacheSizeMaxRelativeDeviation(row))); w.println(); } w.close(); } private void generateTotalsCsv(File file, List<List<SimpleStatistics>> results, int maxResultSize) throws Exception { PrintWriter w = new PrintWriter(new OutputStreamWriter(new FileOutputStream(file), "UTF-8")); w.print("Iteration"); w.print(CSVChart.SEPARATOR); w.print("IntervalBeginMin"); w.print(CSVChart.SEPARATOR); w.print("IntervalEndMax"); w.print(CSVChart.SEPARATOR); w.print("IntervalBeginDiff"); w.print(CSVChart.SEPARATOR); w.print("IntervalEndDiff"); w.print(CSVChart.SEPARATOR); w.print("TotalThroughput"); w.print(CSVChart.SEPARATOR); w.print("AvgThroughput"); w.print(CSVChart.SEPARATOR); w.print("AvgRespTime"); w.print(CSVChart.SEPARATOR); w.print("MaxRespTime"); w.print(CSVChart.SEPARATOR); w.print("EntryCount"); w.print(CSVChart.SEPARATOR); w.print("Errors"); w.print(CSVChart.SEPARATOR); w.print("NullRequests"); w.print(CSVChart.SEPARATOR); w.print("SlaveCount"); w.println(); List<SimpleStatistics> row = new ArrayList<SimpleStatistics>(); List<SimpleStatistics> rowAll = new ArrayList<SimpleStatistics>(); for (int i = 0; i < maxResultSize; i++) { row.clear(); rowAll.clear(); for (int j = 0; j < results.size(); j++) { List<SimpleStatistics> statList = results.get(j); if (i < statList.size()) { if (statList.get(i).isNodeUp()) { row.add(statList.get(i)); } rowAll.add(statList.get(i)); } } w.print(i); long beginMin = SimpleStatistics.getIntervalBeginMin(rowAll); long beginMax = SimpleStatistics.getIntervalBeginMax(rowAll); long endMin = SimpleStatistics.getIntervalEndMin(rowAll); long endMax = SimpleStatistics.getIntervalEndMax(rowAll); w.print(CSVChart.SEPARATOR); w.print(humanReadableTime(beginMin)); w.print(CSVChart.SEPARATOR); w.print(humanReadableTime(endMax)); w.print(CSVChart.SEPARATOR); w.print(beginMax - beginMin); w.print(CSVChart.SEPARATOR); w.print(endMax - endMin); w.print(CSVChart.SEPARATOR); w.print(SimpleStatistics.getTotalThroughput(row)); w.print(CSVChart.SEPARATOR); w.print(SimpleStatistics.getAvgThroughput(row)); w.print(CSVChart.SEPARATOR); w.print(ffcsv(SimpleStatistics.getAvgRespTime(row))); w.print(CSVChart.SEPARATOR); w.print(SimpleStatistics.getMaxRespTime(row)); w.print(CSVChart.SEPARATOR); w.print(SimpleStatistics.getTotalCacheSize(row)); w.print(CSVChart.SEPARATOR); w.print(SimpleStatistics.getTotalErrors(row)); w.print(CSVChart.SEPARATOR); w.print(SimpleStatistics.getTotalNullRequests(row)); w.print(CSVChart.SEPARATOR); w.print(row.size()); w.println(); } w.close(); } private String humanReadableTime(long aTime) { return DATEFORMAT.format(new Date(aTime)); } private interface StatGetter { String getStat(SimpleStatistics cell); } private void generateTotalThroughputCsvFromThroughputCsv(String from, String to){ try{ // Create output file FileWriter fstreamOut = new FileWriter(to); BufferedWriter out = new BufferedWriter(fstreamOut); // Initialize input FileInputStream fstreamIn = new FileInputStream(from); DataInputStream in = new DataInputStream(fstreamIn); BufferedReader br = new BufferedReader(new InputStreamReader(in)); // initialize strLine String strLine; //first line br.readLine(); out.write("Iteration;TOTAL" + System.getProperty( "line.separator" )); String[] temp; String delimiter=";"; double toReturn; while ((strLine = br.readLine()) != null) { toReturn=0; temp = strLine.split(delimiter); for (int i=1; i<temp.length; i++){ toReturn = toReturn + addValue(temp[i]); } out.write(temp[0] +";"+toReturn); out.write(System.getProperty( "line.separator" )); } //Close the input and output stream in.close(); out.close(); } catch (Exception e) {//Catch exception if any log.error("Error creating total throughput csv: ", e); } } private static boolean isDouble(String string) { try { Double.valueOf(string); return true; } catch (NumberFormatException e) { return false; } } private static double addValue(String value){ if (isDouble(value)){ return Double.valueOf(value); } return 0; } }
16,876
0.608073
0.604936
430
38.293022
30.083801
138
false
false
0
0
0
0
0
0
1.165116
false
false
13
b4f82d29c64ce9c2f791009565ff5d0b02bd812c
24,747,601,598,882
37a5d78f3948a39322891ef9151d5f6078790154
/src/main/java/com/gorilla/myapp/repository/LayerRepository.java
2cd14701acb766010790977969d1552a17ce6930
[]
no_license
zhuning331/LBStest
https://github.com/zhuning331/LBStest
40999f09f5fe378af02a1054cf840fe164e89312
f12bb3b13f7afbe4b46b9b3926d1d612fc34571f
refs/heads/master
2021-06-02T14:07:51.736000
2017-09-05T09:57:24
2017-09-05T09:57:24
102,438,296
0
1
null
false
2020-09-18T14:40:31
2017-09-05T05:34:00
2017-09-05T05:36:50
2017-09-05T09:57:41
581
0
1
1
Java
false
false
package com.gorilla.myapp.repository; import com.gorilla.myapp.domain.Layer; import org.springframework.stereotype.Repository; import org.springframework.data.jpa.repository.*; /** * Spring Data JPA repository for the Layer entity. */ @SuppressWarnings("unused") @Repository public interface LayerRepository extends JpaRepository<Layer, Long> { }
UTF-8
Java
354
java
LayerRepository.java
Java
[]
null
[]
package com.gorilla.myapp.repository; import com.gorilla.myapp.domain.Layer; import org.springframework.stereotype.Repository; import org.springframework.data.jpa.repository.*; /** * Spring Data JPA repository for the Layer entity. */ @SuppressWarnings("unused") @Repository public interface LayerRepository extends JpaRepository<Layer, Long> { }
354
0.79096
0.79096
16
21.125
23.326153
69
false
false
0
0
0
0
0
0
0.3125
false
false
13
ba6da0072141ba28f9980d37d086237d21a1817e
21,990,232,569,995
d4138d1a8326ee4bdff60f6715ce3058aeb06a76
/jar/src/test/java/com/runtimeverification/rvpredict/smt/RaceBucketTest.java
b7d6fcde666cc8507feb6ae0207519c596ba2902
[ "LicenseRef-scancode-warranty-disclaimer" ]
no_license
isabella232/rv-predict
https://github.com/isabella232/rv-predict
65fce39fce22093fe4c61b9a5a0f46ef16c95aab
6733dcc0811c16be8e10ea7df77ef238dc152d87
refs/heads/master
2023-06-16T20:30:47.419000
2019-01-03T19:35:53
2019-01-03T19:35:53
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.runtimeverification.rvpredict.smt; import com.google.common.collect.ImmutableList; import com.runtimeverification.rvpredict.violation.Race; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import java.util.Optional; @RunWith(MockitoJUnitRunner.class) public class RaceBucketTest { @Mock private Race mockRace1; @Mock private Race mockRace2; @Test public void iteratesThroughElements() { RaceBucket bucket = new RaceBucket("b1", ImmutableList.of(mockRace1, mockRace2)); Optional<Race> race = bucket.nextRace(); Assert.assertTrue(race.isPresent()); Assert.assertEquals(mockRace1, race.get()); race = bucket.nextRace(); Assert.assertTrue(race.isPresent()); Assert.assertEquals(mockRace2, race.get()); race = bucket.nextRace(); Assert.assertFalse(race.isPresent()); } @Test public void stopsIterationAfterSolving() { RaceBucket bucket = new RaceBucket("b1", ImmutableList.of(mockRace1, mockRace2)); Optional<Race> race = bucket.nextRace(); Assert.assertTrue(race.isPresent()); Assert.assertEquals(mockRace1, race.get()); Assert.assertEquals("b1", bucket.getNameAndMarkAsSolved()); race = bucket.nextRace(); Assert.assertFalse(race.isPresent()); } }
UTF-8
Java
1,432
java
RaceBucketTest.java
Java
[]
null
[]
package com.runtimeverification.rvpredict.smt; import com.google.common.collect.ImmutableList; import com.runtimeverification.rvpredict.violation.Race; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.runners.MockitoJUnitRunner; import java.util.Optional; @RunWith(MockitoJUnitRunner.class) public class RaceBucketTest { @Mock private Race mockRace1; @Mock private Race mockRace2; @Test public void iteratesThroughElements() { RaceBucket bucket = new RaceBucket("b1", ImmutableList.of(mockRace1, mockRace2)); Optional<Race> race = bucket.nextRace(); Assert.assertTrue(race.isPresent()); Assert.assertEquals(mockRace1, race.get()); race = bucket.nextRace(); Assert.assertTrue(race.isPresent()); Assert.assertEquals(mockRace2, race.get()); race = bucket.nextRace(); Assert.assertFalse(race.isPresent()); } @Test public void stopsIterationAfterSolving() { RaceBucket bucket = new RaceBucket("b1", ImmutableList.of(mockRace1, mockRace2)); Optional<Race> race = bucket.nextRace(); Assert.assertTrue(race.isPresent()); Assert.assertEquals(mockRace1, race.get()); Assert.assertEquals("b1", bucket.getNameAndMarkAsSolved()); race = bucket.nextRace(); Assert.assertFalse(race.isPresent()); } }
1,432
0.697626
0.689246
47
29.468084
23.664185
89
false
false
0
0
0
0
0
0
0.744681
false
false
13
49bd2ec53783870d258740b1747e50c96221dbf2
14,611,478,776,897
4a3dab468cd6829bbff5b804f5587ecc36f12832
/.svn/pristine/16/16b55f6cae03aa3cc95809119d879a0a70770f94.svn-base
80e494e2e15360a3d35ae3ec0205803687906ab7
[]
no_license
wangyz123456/tmapi
https://github.com/wangyz123456/tmapi
b941edc395c3fa043c2daa5bfca242e5553136dc
713c99798a717dc4f277e903fea92e531fed0d5e
refs/heads/master
2023-01-15T15:56:23.368000
2020-11-23T03:20:12
2020-11-23T03:20:12
308,851,989
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.tmapi.controller; import com.example.tmapi.entity.Goods; import com.example.tmapi.entity.TargetsSeller; import com.example.tmapi.service.TargetsSellerService; import com.example.tmapi.utils.JsonData; import com.github.pagehelper.PageInfo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import java.util.List; import java.util.Map; @RestController @RequestMapping(value="/pri/TMStockSale/target") public class TargetsSellerController { @Autowired private TargetsSellerService targetsSellerService; /** * ๆŸฅ่ฏขๅบ—ๅ‘˜็›ฎๆ ‡้”€ๅ”ฎไธš็ปฉ๏ผŒ้”€ๅ”ฎ้ข * @param StoreID StoreID * @param SellerID SellerID * @return JsonData */ @RequestMapping(value="getResult", method = RequestMethod.POST) public JsonData checkMember(String StoreID,String SellerID){ if(StoreID==null||StoreID.isEmpty()||SellerID==null||SellerID.isEmpty()){ return JsonData.buildError("ๅ‚ๆ•ฐไธ่ƒฝไธบ็ฉบ๏ผ"); } Map<String, Object> map = targetsSellerService.queryTargetsSellerByCond(StoreID,SellerID); return JsonData.buildSuccess(map); } /** * ๆŸฅ่ฏขๅฝ“ๅคฉ้”€ๅ”ฎไธš็ปฉๅฎŒๆˆๅบฆ * @param storeId storeId * @param sellerId sellerId * @return */ @RequestMapping(value = "queryTargetsSellerDay",method = RequestMethod.POST) public JsonData queryByCondDay(String storeId,String sellerId){ if(storeId==null||storeId.isEmpty()||sellerId==null||sellerId.isEmpty()){ return JsonData.buildError("ๅ‚ๆ•ฐไธ่ƒฝไธบ็ฉบ๏ผ"); } TargetsSeller targetsSeller = new TargetsSeller(); targetsSeller.setStoreId(storeId); targetsSeller.setSellerId(sellerId); List<TargetsSeller> list = targetsSellerService.queryByCond(targetsSeller); return JsonData.buildSuccess(list); } /** * ๆŸฅ่ฏขๅฝ“ๆœˆ้”€ๅ”ฎไธš็ปฉๅฎŒๆˆๅบฆ * @param storeId storeId * @param sellerId sellerId * @return */ @RequestMapping(value = "queryTargetsSellerMonth",method = RequestMethod.POST) public JsonData queryByCondMonth(String storeId,String sellerId){ if(storeId==null||storeId.isEmpty()||sellerId==null||sellerId.isEmpty()){ return JsonData.buildError("ๅ‚ๆ•ฐไธ่ƒฝไธบ็ฉบ๏ผ"); } TargetsSeller targetsSeller = new TargetsSeller(); targetsSeller.setStoreId(storeId); targetsSeller.setSellerId(sellerId); List<TargetsSeller> list = targetsSellerService.queryByCondMonth(targetsSeller); return JsonData.buildSuccess(list); } }
UTF-8
Java
2,840
16b55f6cae03aa3cc95809119d879a0a70770f94.svn-base
Java
[]
null
[]
package com.example.tmapi.controller; import com.example.tmapi.entity.Goods; import com.example.tmapi.entity.TargetsSeller; import com.example.tmapi.service.TargetsSellerService; import com.example.tmapi.utils.JsonData; import com.github.pagehelper.PageInfo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import java.util.List; import java.util.Map; @RestController @RequestMapping(value="/pri/TMStockSale/target") public class TargetsSellerController { @Autowired private TargetsSellerService targetsSellerService; /** * ๆŸฅ่ฏขๅบ—ๅ‘˜็›ฎๆ ‡้”€ๅ”ฎไธš็ปฉ๏ผŒ้”€ๅ”ฎ้ข * @param StoreID StoreID * @param SellerID SellerID * @return JsonData */ @RequestMapping(value="getResult", method = RequestMethod.POST) public JsonData checkMember(String StoreID,String SellerID){ if(StoreID==null||StoreID.isEmpty()||SellerID==null||SellerID.isEmpty()){ return JsonData.buildError("ๅ‚ๆ•ฐไธ่ƒฝไธบ็ฉบ๏ผ"); } Map<String, Object> map = targetsSellerService.queryTargetsSellerByCond(StoreID,SellerID); return JsonData.buildSuccess(map); } /** * ๆŸฅ่ฏขๅฝ“ๅคฉ้”€ๅ”ฎไธš็ปฉๅฎŒๆˆๅบฆ * @param storeId storeId * @param sellerId sellerId * @return */ @RequestMapping(value = "queryTargetsSellerDay",method = RequestMethod.POST) public JsonData queryByCondDay(String storeId,String sellerId){ if(storeId==null||storeId.isEmpty()||sellerId==null||sellerId.isEmpty()){ return JsonData.buildError("ๅ‚ๆ•ฐไธ่ƒฝไธบ็ฉบ๏ผ"); } TargetsSeller targetsSeller = new TargetsSeller(); targetsSeller.setStoreId(storeId); targetsSeller.setSellerId(sellerId); List<TargetsSeller> list = targetsSellerService.queryByCond(targetsSeller); return JsonData.buildSuccess(list); } /** * ๆŸฅ่ฏขๅฝ“ๆœˆ้”€ๅ”ฎไธš็ปฉๅฎŒๆˆๅบฆ * @param storeId storeId * @param sellerId sellerId * @return */ @RequestMapping(value = "queryTargetsSellerMonth",method = RequestMethod.POST) public JsonData queryByCondMonth(String storeId,String sellerId){ if(storeId==null||storeId.isEmpty()||sellerId==null||sellerId.isEmpty()){ return JsonData.buildError("ๅ‚ๆ•ฐไธ่ƒฝไธบ็ฉบ๏ผ"); } TargetsSeller targetsSeller = new TargetsSeller(); targetsSeller.setStoreId(storeId); targetsSeller.setSellerId(sellerId); List<TargetsSeller> list = targetsSellerService.queryByCondMonth(targetsSeller); return JsonData.buildSuccess(list); } }
2,840
0.716434
0.716434
75
35.346668
26.814669
98
false
false
0
0
0
0
0
0
0.733333
false
false
13
52673ecc085532034c1f40f6f00c3b24f1d1a816
29,970,281,822,337
87f420a0e7b23aefe65623ceeaa0021fb0c40c56
/demo/src/main/java/com/example/demo/util/MyRSAUtils.java
79ffc1183c1c303eef5124a4eb54cf474e8b337c
[]
no_license
xioxu-web/xioxu-web
https://github.com/xioxu-web/xioxu-web
0361a292b675d8209578d99451598bf4a56f9b08
7fe3f9539e3679e1de9f5f614f3f9b7f41a28491
refs/heads/master
2023-05-05T01:59:43.228000
2023-04-28T07:44:58
2023-04-28T07:44:58
367,005,744
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.demo.util; import java.security.*; import java.security.interfaces.RSAPrivateKey; import java.security.spec.InvalidKeySpecException; import java.security.spec.PKCS8EncodedKeySpec; import java.util.Base64; /** *็ญพๅๅค„็†ๅทฅๅ…ท็ฑป * @author xiaoxu123 */ public class MyRSAUtils { public static final String CHARSET = "utf-8"; /** * RSA็ง้’ฅ็ญพๅ * @param src ๅฎขๆˆท็ซฏไผ ่ฟ‡ๆฅ็š„ๅŽŸๅง‹ๅ‚ๆ•ฐ * @param priKey ๅฎขๆˆท็ซฏ็ง้’ฅ * @return * @throws Exception */ public static String sign(String src, String priKey){ try { KeyFactory rsa = KeyFactory.getInstance( "RSA" ); byte[] pribyte = Base64.getDecoder().decode( priKey ); PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec( pribyte ); RSAPrivateKey privateKey = (RSAPrivateKey) rsa.generatePrivate(keySpec); Signature sign= Signature.getInstance("SHA1withRSA"); sign.initSign(privateKey); sign.update(src.getBytes(MyRSAUtils.CHARSET)); byte[] signature=sign.sign(); return Base64.getEncoder().encodeToString(signature); } catch (Exception e) { e.printStackTrace(); } return null; } }
UTF-8
Java
1,270
java
MyRSAUtils.java
Java
[ { "context": "import java.util.Base64;\n\n/**\n *็ญพๅๅค„็†ๅทฅๅ…ท็ฑป\n * @author xiaoxu123\n */\npublic class MyRSAUtils {\n\n public static ", "end": 261, "score": 0.9994331002235413, "start": 252, "tag": "USERNAME", "value": "xiaoxu123" } ]
null
[]
package com.example.demo.util; import java.security.*; import java.security.interfaces.RSAPrivateKey; import java.security.spec.InvalidKeySpecException; import java.security.spec.PKCS8EncodedKeySpec; import java.util.Base64; /** *็ญพๅๅค„็†ๅทฅๅ…ท็ฑป * @author xiaoxu123 */ public class MyRSAUtils { public static final String CHARSET = "utf-8"; /** * RSA็ง้’ฅ็ญพๅ * @param src ๅฎขๆˆท็ซฏไผ ่ฟ‡ๆฅ็š„ๅŽŸๅง‹ๅ‚ๆ•ฐ * @param priKey ๅฎขๆˆท็ซฏ็ง้’ฅ * @return * @throws Exception */ public static String sign(String src, String priKey){ try { KeyFactory rsa = KeyFactory.getInstance( "RSA" ); byte[] pribyte = Base64.getDecoder().decode( priKey ); PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec( pribyte ); RSAPrivateKey privateKey = (RSAPrivateKey) rsa.generatePrivate(keySpec); Signature sign= Signature.getInstance("SHA1withRSA"); sign.initSign(privateKey); sign.update(src.getBytes(MyRSAUtils.CHARSET)); byte[] signature=sign.sign(); return Base64.getEncoder().encodeToString(signature); } catch (Exception e) { e.printStackTrace(); } return null; } }
1,270
0.640625
0.629112
44
26.636364
24.091766
84
false
false
0
0
0
0
0
0
0.431818
false
false
13
c20fefdc0544f6ec532b1e8a0e4540ea9689061e
13,451,837,623,670
fd0158247e5461ae503da457f89799ce4c65bc88
/lab12/Runner.java
d8ff2e4649f1e8551711948e31ea9f3087f7fdc6
[]
no_license
Shaharyar07/OOP-SP21
https://github.com/Shaharyar07/OOP-SP21
80766baa55bdb0ced8e70906f7dde6791556fdbf
68ba258536c2da55127eb5c0659dd0a49c7537f0
refs/heads/main
2023-06-02T03:27:04.948000
2021-06-26T10:34:58
2021-06-26T10:34:58
345,087,884
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class Runner { public static void main(String[] args) { HumanResources checkResources = new HumanResources(); checkResources.add("huzaifa", "1", "Student"); checkResources.add("Mukhtar Azeem", "2", "Teacher"); checkResources.add("tahir", "3", "Student"); checkResources.delete("tahir"); System.out.println(checkResources); } }
UTF-8
Java
358
java
Runner.java
Java
[ { "context": "\"huzaifa\", \"1\", \"Student\");\n\t\tcheckResources.add(\"Mukhtar Azeem\", \"2\", \"Teacher\");\n\t\tcheckResources.add(\"tahir\", ", "end": 210, "score": 0.999882161617279, "start": 197, "tag": "NAME", "value": "Mukhtar Azeem" } ]
null
[]
public class Runner { public static void main(String[] args) { HumanResources checkResources = new HumanResources(); checkResources.add("huzaifa", "1", "Student"); checkResources.add("<NAME>", "2", "Teacher"); checkResources.add("tahir", "3", "Student"); checkResources.delete("tahir"); System.out.println(checkResources); } }
351
0.687151
0.678771
17
20
21.895473
55
false
false
0
0
0
0
0
0
1.647059
false
false
13
73fc92f51bae168d05eb66fb67875f7172f8610e
21,208,548,543,098
f3198d1e33824791dcbb361e1b7702ffd6ba5109
/src/main/java/com/emotion/ecm/model/dto/SmscAccountDto.java
31a67e28726bb0945a3d4b75f4e5ebd4fa9fece5
[]
no_license
dmgrosu/BulkSMS
https://github.com/dmgrosu/BulkSMS
c4538f0b53683c270afc6d697d5c7747e9bc81df
ce379a0e59d64dde101ac18e721c13227221b63a
refs/heads/master
2020-04-01T15:32:56.230000
2018-12-26T08:06:22
2018-12-26T08:06:22
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.emotion.ecm.model.dto; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import javax.validation.constraints.Max; import javax.validation.constraints.Min; import javax.validation.constraints.NotEmpty; @Data @AllArgsConstructor @NoArgsConstructor public class SmscAccountDto { private int smscAccountId; @NotEmpty private String systemId; @NotEmpty private String password; @NotEmpty private String ipAddress; @Min(1) @Max(65535) private int port; @Min(1) @Max(500) private short tps; @Min(1) @Max(10) private byte maxConnections; private boolean asynchronous; private int accountId; }
UTF-8
Java
718
java
SmscAccountDto.java
Java
[]
null
[]
package com.emotion.ecm.model.dto; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import javax.validation.constraints.Max; import javax.validation.constraints.Min; import javax.validation.constraints.NotEmpty; @Data @AllArgsConstructor @NoArgsConstructor public class SmscAccountDto { private int smscAccountId; @NotEmpty private String systemId; @NotEmpty private String password; @NotEmpty private String ipAddress; @Min(1) @Max(65535) private int port; @Min(1) @Max(500) private short tps; @Min(1) @Max(10) private byte maxConnections; private boolean asynchronous; private int accountId; }
718
0.721448
0.703343
42
16.095238
13.764706
45
false
false
0
0
0
0
0
0
0.380952
false
false
13
ab052eeb4adbd47932604f4ae2745975c7b3df0e
21,500,606,340,859
81938dcde7374f669986262248e98e7c1d4a6f6b
/leetcode-learning-demo/src/main/java/com/hzt/demo/link/ReverseListDemo.java
8456a75f8efe5bcd38b0230d4c8016e8519b9093
[]
no_license
hzt563h/java-learning
https://github.com/hzt563h/java-learning
14a467821e2bee9f764a71d6c18a13b62295cbb7
cb6a6db5cf3d5fdea4aec65207242f429ed5bebb
refs/heads/main
2023-06-15T05:52:36.103000
2021-07-14T08:21:07
2021-07-14T08:21:07
335,276,531
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.hzt.demo.link; /** * @author hzt * @version 1.0.0 * @ClassName Solution.java * @createTime 2021ๅนด03ๆœˆ30ๆ—ฅ 10:40:00 */ public class ReverseListDemo { public ListNode ReverseList(ListNode head) { if(head==null) { return null; } ListNode two=head.next; head.next=null; ListNode there=null; while (two !=null){ there=two.next; two.next=head; head=two; two=there; } return head; } }
UTF-8
Java
538
java
ReverseListDemo.java
Java
[ { "context": "package com.hzt.demo.link;\n\n/**\n * @author hzt\n * @version 1.0.0\n * @ClassName Solution.java\n * ", "end": 46, "score": 0.9996660947799683, "start": 43, "tag": "USERNAME", "value": "hzt" } ]
null
[]
package com.hzt.demo.link; /** * @author hzt * @version 1.0.0 * @ClassName Solution.java * @createTime 2021ๅนด03ๆœˆ30ๆ—ฅ 10:40:00 */ public class ReverseListDemo { public ListNode ReverseList(ListNode head) { if(head==null) { return null; } ListNode two=head.next; head.next=null; ListNode there=null; while (two !=null){ there=two.next; two.next=head; head=two; two=there; } return head; } }
538
0.524436
0.492481
26
19.461538
11.623023
48
false
false
0
0
0
0
0
0
0.384615
false
false
13
13852b2a2d580e93bd1bc1bb78955eec483288bd
10,917,806,929,364
e5d8d1de63e602833efe001f174995a0609cbbe5
/src/com/structurizr/onpremises/web/api/ApiMessageResponse.java
6f157f6bf83c5efb2f82b6d517c395b832679d63
[ "Apache-2.0" ]
permissive
braincat/api
https://github.com/braincat/api
a52737e602251b4eea49651ef7de81a9b6cf3586
050f7cd31b67639b3f8e27baaca4c701f22b5c98
refs/heads/master
2021-06-17T20:13:08.244000
2017-04-18T16:21:36
2017-04-18T16:21:36
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.structurizr.onpremises.web.api; abstract class ApiMessageResponse extends ApiResponse { private String message; protected ApiMessageResponse(String message, int status) { super(status); this.message = message; } @Override public String toString() { return String.format("{\"message\":\"%s\"}", message); } }
UTF-8
Java
374
java
ApiMessageResponse.java
Java
[]
null
[]
package com.structurizr.onpremises.web.api; abstract class ApiMessageResponse extends ApiResponse { private String message; protected ApiMessageResponse(String message, int status) { super(status); this.message = message; } @Override public String toString() { return String.format("{\"message\":\"%s\"}", message); } }
374
0.65508
0.65508
18
19.777779
22.129808
62
false
false
0
0
0
0
0
0
0.388889
false
false
13
d9968ab805ce7bb4120b0ab115c2793125b86b20
10,823,317,648,428
64da9f72d6b735dd3ea8797e7cf90821fc07afed
/TopDownResolute/src/TopDown.java
fd46420422763e6043439d1780259d8748e826c7
[]
no_license
lahlidahlia/TinsExperimentalProjects
https://github.com/lahlidahlia/TinsExperimentalProjects
7f33d36c552e5595e81f5f4868b7ff6452a8a7e5
8af2876fab3e99dbe75339b84fdcea324506627f
refs/heads/master
2023-07-01T21:14:08.877000
2014-07-26T23:18:59
2014-07-26T23:18:59
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import org.lwjgl.LWJGLException; import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.Display; import org.lwjgl.opengl.DisplayMode; import org.lwjgl.opengl.GL11; public class TopDown { public static boolean finished = false; public FPSCounter FPS; public Player mainPlayer; public Enemy enemy; //Font used for FPS counter //////////// //VOID MAIN //////////// public static void main(String[] args){ TopDown TopDown = new TopDown(); TopDown.start(); TopDown.loop(); TopDown.cleanUp(); } /////////////// //GENERAL INIT /////////////// public void start(){ init(); FPS = new FPSCounter(); mainPlayer = new Player(100, 100, 4, 4, 16, 16); enemy = new Enemy(200, 200, 4, 4, 16, 16); } //////////// //MAIN LOOP //////////// public void loop(){ while(!Display.isCloseRequested() && !finished){ GL11.glClearColor(Global.BG_Color.r, Global.BG_Color.g, Global.BG_Color.b ,1); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); Text.drawText(FPS.getFPS()); pollInput(); Group.update(); Group.render(); FPS.tick(); Display.update(); Display.sync(Global.FPS); } } //////////////// //INPUT POLLING //////////////// public void pollInput(){ //Player manipulation key input if(mainPlayer != null){ if(Keyboard.isKeyDown(Player.KEY_MOVE_WEST)){ mainPlayer.moveWest(); } if(Keyboard.isKeyDown(Player.KEY_MOVE_EAST)){ mainPlayer.moveEast(); } if(Keyboard.isKeyDown(Player.KEY_MOVE_NORTH)){ mainPlayer.moveNorth(); } if(Keyboard.isKeyDown(Player.KEY_MOVE_SOUTH)){ mainPlayer.moveSouth(); } } while(Keyboard.next()){ if(Keyboard.getEventKey() == Keyboard.KEY_ESCAPE){ if(Keyboard.getEventKeyState()){ finished = true; } } } } ///////////// //LWJGL INIT ///////////// public void init(){ //Setting up display try { Display.setDisplayMode(new DisplayMode(Global.SCREEN_WIDTH, Global.SCREEN_HEIGHT)); Display.setTitle("TDR"); Display.create(); } catch (LWJGLException e) { System.exit(1); } // //Setting up GL GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); // Resets any previous projection matrices GL11.glOrtho(0, Display.getWidth(), Display.getHeight(), 0, 1, -1); GL11.glMatrixMode(GL11.GL_MODELVIEW); } public void cleanUp(){ Display.destroy(); System.exit(0); } }
UTF-8
Java
2,391
java
TopDown.java
Java
[]
null
[]
import org.lwjgl.LWJGLException; import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.Display; import org.lwjgl.opengl.DisplayMode; import org.lwjgl.opengl.GL11; public class TopDown { public static boolean finished = false; public FPSCounter FPS; public Player mainPlayer; public Enemy enemy; //Font used for FPS counter //////////// //VOID MAIN //////////// public static void main(String[] args){ TopDown TopDown = new TopDown(); TopDown.start(); TopDown.loop(); TopDown.cleanUp(); } /////////////// //GENERAL INIT /////////////// public void start(){ init(); FPS = new FPSCounter(); mainPlayer = new Player(100, 100, 4, 4, 16, 16); enemy = new Enemy(200, 200, 4, 4, 16, 16); } //////////// //MAIN LOOP //////////// public void loop(){ while(!Display.isCloseRequested() && !finished){ GL11.glClearColor(Global.BG_Color.r, Global.BG_Color.g, Global.BG_Color.b ,1); GL11.glClear(GL11.GL_COLOR_BUFFER_BIT); Text.drawText(FPS.getFPS()); pollInput(); Group.update(); Group.render(); FPS.tick(); Display.update(); Display.sync(Global.FPS); } } //////////////// //INPUT POLLING //////////////// public void pollInput(){ //Player manipulation key input if(mainPlayer != null){ if(Keyboard.isKeyDown(Player.KEY_MOVE_WEST)){ mainPlayer.moveWest(); } if(Keyboard.isKeyDown(Player.KEY_MOVE_EAST)){ mainPlayer.moveEast(); } if(Keyboard.isKeyDown(Player.KEY_MOVE_NORTH)){ mainPlayer.moveNorth(); } if(Keyboard.isKeyDown(Player.KEY_MOVE_SOUTH)){ mainPlayer.moveSouth(); } } while(Keyboard.next()){ if(Keyboard.getEventKey() == Keyboard.KEY_ESCAPE){ if(Keyboard.getEventKeyState()){ finished = true; } } } } ///////////// //LWJGL INIT ///////////// public void init(){ //Setting up display try { Display.setDisplayMode(new DisplayMode(Global.SCREEN_WIDTH, Global.SCREEN_HEIGHT)); Display.setTitle("TDR"); Display.create(); } catch (LWJGLException e) { System.exit(1); } // //Setting up GL GL11.glMatrixMode(GL11.GL_PROJECTION); GL11.glLoadIdentity(); // Resets any previous projection matrices GL11.glOrtho(0, Display.getWidth(), Display.getHeight(), 0, 1, -1); GL11.glMatrixMode(GL11.GL_MODELVIEW); } public void cleanUp(){ Display.destroy(); System.exit(0); } }
2,391
0.619406
0.598076
115
19.791304
17.786901
86
false
false
0
0
0
0
0
0
2.382609
false
false
13
7d0bf69a4077e0c4b89877c728a649a012b4699d
6,519,760,415,653
1c0c986fe811d7ad4c3c8d2b4b5330b567287805
/src/main/java/org/gooru/nucleus/handlers/dataclass/api/processors/MessageProcessor.java
2a4140f63388b2d37e252da9dfeab6a106b4a9a9
[ "Apache-2.0" ]
permissive
Gooru/ln-nucleus-data-class-api-handler
https://github.com/Gooru/ln-nucleus-data-class-api-handler
6dc5e7b60dc261bb5ab5034341369e5e8dfd17e5
f7d10741c9939e1d1bccd3483aa06ab8a17f145f
refs/heads/master
2022-06-21T20:51:19.444000
2019-08-04T17:04:19
2019-08-04T17:04:19
261,716,426
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.gooru.nucleus.handlers.dataclass.api.processors; import java.util.ResourceBundle; import java.util.UUID; import org.gooru.nucleus.handlers.dataclass.api.constants.JsonConstants; import org.gooru.nucleus.handlers.dataclass.api.constants.MessageConstants; import org.gooru.nucleus.handlers.dataclass.api.processors.repositories.RepoBuilder; import org.gooru.nucleus.handlers.dataclass.api.processors.repositories.activejdbc.validators.FieldValidator; import org.gooru.nucleus.handlers.dataclass.api.processors.responses.ExecutionResult; import org.gooru.nucleus.handlers.dataclass.api.processors.responses.MessageResponse; import org.gooru.nucleus.handlers.dataclass.api.processors.responses.MessageResponseFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.hazelcast.util.StringUtil; import io.vertx.core.eventbus.Message; import io.vertx.core.json.JsonObject; class MessageProcessor implements Processor { private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class); private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle("messages"); private final Message<Object> message; private JsonObject request; public MessageProcessor(Message<Object> message) { this.message = message; } @Override public MessageResponse process() { MessageResponse result; try { // Validate the message itself ExecutionResult<MessageResponse> validateResult = validateAndInitialize(); if (validateResult.isCompleted()) { return validateResult.result(); } final String msgOp = message.headers().get(MessageConstants.MSG_HEADER_OP); // There should be only one handler switch (msgOp) { case MessageConstants.MSG_OP_COURSE_PEERS: result = getStudentPeersInCourse(); break; case MessageConstants.MSG_OP_UNIT_PEERS: result = getStudentPeersInUnit(); break; case MessageConstants.MSG_OP_LESSON_PEERS: result = getStudentPeersInLesson(); break; case MessageConstants.MSG_OP_STUDENT_CURRENT_LOC: result = getStudentCurrentLocation(); break; case MessageConstants.MSG_OP_STUDENT_COURSE_PERF: result = getStudentPerfInCourse(); break; case MessageConstants.MSG_OP_STUDENT_UNIT_PERF: result = getStudentPerfInUnit(); break; case MessageConstants.MSG_OP_STUDENT_LESSON_PERF: result = getStudentPerfInLesson(); break; case MessageConstants.MSG_OP_STUDENT_COLLECTION_PERF: result = getStudentPerfInCollection(); break; case MessageConstants.MSG_OP_STUDENT_ASSESSMENT_PERF: result = getStudentPerfInAssessment(); break; case MessageConstants.MSG_OP_STUDENT_COLLECTION_SUMMARY: result = getStudentSummaryInCollection(); break; case MessageConstants.MSG_OP_STUDENT_ASSESSMENT_SUMMARY: result = getStudentSummaryInAssessment(); break; case MessageConstants.MSG_OP_SESSION_STATUS: result = getSessionStatus(); break; case MessageConstants.MSG_OP_USER_ALL_ASSESSMENT_SESSIONS: result = getUserAssessmentSessions(); break; case MessageConstants.MSG_OP_USER_ALL_COLLECTION_SESSIONS: result = getUserCollectionSessions(); break; case MessageConstants.MSG_OP_SESSION_TAXONOMY_REPORT: result = getSessionWiseTaxonomyReport(); break; case MessageConstants.MSG_OP_ALL_STUDENT_CLASSES_PERF: result = getStudentPerfInAllClasses(); break; case MessageConstants.MSG_OP_STUDENT_LOC_ALL_CLASSES: result = getStudentLocInAllClasses(); break; case MessageConstants.MSG_OP_STUDENT_PERF_MULT_COLLECTION: result = getStudentPerfMultipleCollections(); break; case MessageConstants.MSG_OP_STUDENT_PERF_COURSE_ASSESSMENT: result = getStudentPerfCourseAssessments(); break; case MessageConstants.MSG_OP_STUDENT_PERF_COURSE_COLLECTION: result = getStudentPerfCourseCollections(); break; case MessageConstants.MSG_OP_INDEPENDENT_LEARNER_COURSE_PERF: result = getUserIndepedentLearningPerfInCourse(); break; case MessageConstants.MSG_OP_INDEPENDENT_LEARNER_UNIT_PERF: result = getUserIndepedentLearningPerfInUnit(); break; case MessageConstants.MSG_OP_INDEPENDENT_LEARNER_LESSON_PERF: result = getUserIndepedentLearningPerfInLesson(); break; case MessageConstants.MSG_OP_INDEPENDENT_LEARNER_ASSESSMENT_PERF: result = getUserIndepedentLearningPerfInAssessment(); break; case MessageConstants.MSG_OP_INDEPENDENT_LEARNER_INDEPENDENT_ASSESSMENT_PERF: result = getUserLearningPerfInIndepedentAssessment(); break; case MessageConstants.MSG_OP_INDEPENDENT_LEARNER_COURSES: // result = getIndependentLearnerCourses(); result = getLearnerCourses(); break; case MessageConstants.MSG_OP_IND_LEARNER_ALL_LOCATION: result = getIndependentLearnerLoc(); break; case MessageConstants.MSG_OP_IND_LEARNER_ALL_PERFORMANCE: result = getIndependentLearnerPerf(); break; case MessageConstants.MSG_OP_IND_LEARNER_CURRENT_LOC: result = getIndependentLearnerCoursesLoc(); break; case MessageConstants.MSG_OP_IND_LEARNER_LOCATION_ALL_IND_ASSESSMENTS: result = getIndependentLearnerAssessmentsLoc(); break; case MessageConstants.MSG_OP_IND_LEARNER_LOCATION_ALL_IND_COLLECTIONS: result = getIndependentLearnerCollectionsLoc(); break; case MessageConstants.MSG_OP_IND_LEARNER_ALL_COURSES_PERF: result = getIndependentLearnerAllCoursesPerf(); break; case MessageConstants.MSG_OP_IND_LEARNER_PERF_ALL_IND_ASSESSMENTS: result = getIndependentLearnerIndAssessmentsPerf(); break; case MessageConstants.MSG_OP_IND_LEARNER_PERF_ALL_IND_COLLECTIONS: result = getIndependentLearnerIndCollectionsPerf(); break; case MessageConstants.MSG_OP_IND_LEARNER_COURSE_ALL_COLLECTIONS_PERF: result = getIndependentLearnerCourseCollectionsPerf(); break; case MessageConstants.MSG_OP_IND_LEARNER_COURSE_ALL_ASSESSMENTS_PERF: result = getIndependentLearnerCourseAssessmentsPerf(); break; case MessageConstants.MSG_OP_IND_LEARNER_TAX_SUBJECTS: result = getIndependentLearnerTaxSubjects(); break; case MessageConstants.MSG_OP_IND_LEARNER_COLLECTION_SUMMARY: result = getIndependentLearnerSummaryInCollection(); break; case MessageConstants.MSG_OP_IND_LEARNER_ASSESSMENT_SUMMARY: result = getIndependentLearnerSummaryInAssessment(); break; case MessageConstants.MSG_OP_IND_LEARNER_ALL_ASSESSMENT_SESSIONS: result = getIndependentLearnerAssessmentSessions(); break; case MessageConstants.MSG_OP_IND_LEARNER_ALL_COLLECTION_SESSIONS: result = getIndependentLearnerCollectionSessions(); break; // Rubric Grading case MessageConstants.MSG_OP_RUBRICS_QUESTIONS_TO_GRADE: result = getRubricQuestionsToGrade(); break; case MessageConstants.MSG_OP_RUBRIC_QUESTIONS_STUDENTS_LIST: result = getStudentsForRubricQue(); break; case MessageConstants.MSG_OP_RUBRIC_QUESTIONS_STUDENT_ANSWERS: result = getStudAnswersForRubricQue(); break; case MessageConstants.MSG_OP_RUBRIC_QUESTIONS_GRADE_SUMMARY: result = getRubricSummaryforQue(); break; // DCA case MessageConstants.MSG_OP_STUDENT_PERF_DAILY_CLASS_ACTIVITY: result = getStudentPerfDailyClassActivity(); break; case MessageConstants.MSG_OP_DCA_STUDENT_COLLECTION_SUMMARY: result = getStudentSummaryInDCACollection(); break; case MessageConstants.MSG_OP_DCA_STUDENT_ASSESSMENT_SUMMARY: result = getStudentSummaryInDCAAssessment(); break; case MessageConstants.MSG_OP_DCA_SESSION_TAXONOMY_REPORT: result = getDCASessionTaxonomyReport(); break; case MessageConstants.MSG_OP_DCA_STUDENT_ASSESSMENT_PERF: result = getStudentPerfInDCAAssessment(); break; case MessageConstants.MSG_OP_DCA_STUDENT_COLLECTION_PERF: result = getStudentPerfInDCACollection(); break; case MessageConstants.MSG_OP_DCA_STUDENT_ASSESSMENT_ALL_SESSIONS: result = getStudDCAAssessmentSessions(); break; case MessageConstants.MSG_OP_DCA_CLASS_PERF: result = getDCAClassPerf(); break; case MessageConstants.MSG_OP_DCA_ALL_CLASSES_PERF: result = getDCAAllClassesPerf(); break; case MessageConstants.MSG_OP_NU_DATA_REPORT: result = getDataReports(); break; case MessageConstants.MSG_OP_NU_COURSES_COMPETENCY_COMPLETION: result = getCoursesCompetencyCompletion(); break; case MessageConstants.MSG_OP_STUDENT_PERF_DAILY_TIMELY_CLASS_ACTIVITY: result = getDCATeacherReport(); break; // ATC case MessageConstants.MSG_OP_STUDENTS_PERF_VS_COMPLETION: result = getStudentPerfVsCompletionReport(); break; case MessageConstants.MSG_OP_STUDENTS_COURSE_ALL_ITEMS_PERF: result = getStudentCourseAllItemsReport(); break; case MessageConstants.MSG_OP_IND_LEARNER_COURSE_ALL_ITEMS_PERF: result = getIndependentLearnerCourseAllItemsReport(); break; case MessageConstants.MSG_OP_DCA_CLASS_SUMMARY_MONTHLY: result = getDCAMonthlyClassSummaryHandler(); break; case MessageConstants.MSG_OP_DCA_CLASS_SUMMARY_FOR_MONTH: result = getDCAClassSummaryForMonthHandler(); break; case MessageConstants.MSG_OP_DCA_CLASS_USER_SUMMARY_FOR_MONTH: result = getDCAActivityAllStudentSummaryReportHandler(); break; case MessageConstants.MSG_OP_CA_STUDENT_ASSESSMENT_SESSION_PERF: result = getCAAssessmentSessionPerfReportHandler(); break; case MessageConstants.MSG_OP_CA_STUDENT_COLLECTION_SESSION_PERF: result = getCACollectionSessionPerfReportHandler(); break; // MILESTONE case MessageConstants.MSG_OP_STUDENT_MILESTONE_LESSON_PERF: result = getStudentMilestoneLessonPerformanceHandler(); break; case MessageConstants.MSG_OP_STUDENT_MILESTONE_PERF: result = getStudentMilestonePerformanceHandler(); break; // MILESTONE - Independent Learner case MessageConstants.MSG_OP_IND_LEARNER_MILESTONE_LESSON_PERF: result = getILMilestoneLessonPerformanceHandler(); break; case MessageConstants.MSG_OP_IND_LEARNER_MILESTONE_PERF: result = getILMilestonePerformanceHandler(); break; case MessageConstants.MSG_OP_INTERNAL_ALL_STUDENT_CLASSES_PERF: result = getAllClassPerfInternal(); break; case MessageConstants.MSG_OP_INTERNAL_DCA_ALL_CLASSES_PERF: result = getDCAAllClassesPerfInternal(); break; // DCA Rubric Grading case MessageConstants.MSG_OP_DCA_RUBRICS_QUESTIONS_TO_GRADE: result = getDCARubricQuestionsToGrade(); break; case MessageConstants.MSG_OP_DCA_RUBRIC_QUESTIONS_STUDENTS_LIST: result = getDCAStudentsForRubricQue(); break; case MessageConstants.MSG_OP_DCA_RUBRIC_QUESTIONS_STUDENT_ANSWERS: result = getDCAStudAnswersForRubricQue(); break; case MessageConstants.MSG_OP_DCA_RUBRIC_QUESTIONS_GRADE_SUMMARY: result = getDCARubricSummaryforQue(); break; // DCA OA Grading case MessageConstants.MSG_OP_ITEMS_TO_GRADE: result = getOAsToGrade(); break; case MessageConstants.MSG_OP_ITEMS_TO_GRADE_STUDENTS_LIST: result = getStudentsToGradeForOA(); break; case MessageConstants.MSG_OP_DCA_OA_STUDENT_SUBMISSIONS: result = getDCAStudentSubmissionsForOA(); break; case MessageConstants.MSG_OP_DCA_OA_COMPLETE_BY_STUDENT_LIST: result = getDCAOACompleteMarkedByStudents(); break; case MessageConstants.MSG_OP_CM_OA_STUDENT_SUBMISSIONS: result = getStudentSubmissionsOfOA(); break; case MessageConstants.MSG_OP_CM_OA_COMPLETE_BY_STUDENT_LIST: result = getOACompleteMarkedByStudents(); break; default: LOGGER.error("Invalid operation type passed in, not able to handle"); return MessageResponseFactory .createInvalidRequestResponse(RESOURCE_BUNDLE.getString("invalid.operation")); } return result; } catch (Throwable e) { LOGGER.error("Unhandled exception in processing", e); return MessageResponseFactory.createInternalErrorResponse(); } } // ************ DAILY CLASS ACTIVITY // ****************************************************************************************** private MessageResponse getStudentPerfDailyClassActivity() { try { ProcessorContext context = createContext(); if (!checkRequest(context)) { LOGGER.error("Invalid request received to fetch Student Performance in class"); return MessageResponseFactory.createInvalidRequestResponse("Invalid request"); } if (!checkCollectionType(context)) { LOGGER.error("collectionType not available or invalid to obtain Student Perf. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid collectionType"); } if (checkIfCollectionTypeIsOa(context)) { return new RepoBuilder().buildReportRepo(context).getDCAStudOAPerformance(); } else { return new RepoBuilder().buildReportRepo(context).getStudPerfDailyClassActivity(); } } catch (Throwable t) { LOGGER.error("Exception while getting Student Performance in Daily Class Activity.", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentSummaryInDCACollection() { try { ProcessorContext context = createContext(); if (!checkCollectionId(context)) { LOGGER.error("Collection id not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid collectionId"); } if (!validateUser(context.userIdFromSession())) { LOGGER.error("Invalid User ID. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid userId"); } return new RepoBuilder().buildReportRepo(context).getStudentSummaryInDCACollection(); } catch (Throwable t) { LOGGER.error("Exception while getting Student DCA Collection Summary Report", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentSummaryInDCAAssessment() { try { ProcessorContext context = createContext(); if (!checkCollectionId(context)) { LOGGER.error("Collection id not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid collectionId"); } if (!validateUser(context.userIdFromSession())) { LOGGER.error("Invalid User ID. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid userId"); } return new RepoBuilder().buildReportRepo(context).getStudentSummaryInDCAAssessment(); } catch (Throwable t) { LOGGER.error("Exception while getting Student DCA Assessment Summary Report", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getDCASessionTaxonomyReport() { try { ProcessorContext context = createContext(); if (!checkSessionId(context)) { LOGGER.error("Session id not available in the request. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid sessionId"); } return new RepoBuilder().buildReportRepo(context).getDCASessionTaxonomyReport(); } catch (Throwable t) { LOGGER.error("Exception while getting Student DCA Session Taxonomy Report", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getDCATeacherReport() { try { ProcessorContext context = createContext(); if (!checkClassId(context)) { LOGGER.error("Class id not available to obtain Weekly/Monthly DCA Report. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid classId"); } return new RepoBuilder().buildReportRepo(context).getDCAMonthlyTeacherReport(); } catch (Throwable t) { LOGGER.error("Exception while getting Weekly/Monthly DCA Report", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentPerfInDCAAssessment() { try { ProcessorContext context = createContext(); if (!checkClassId(context)) { LOGGER .error("Class id not available to obtain Student DCA Assessment Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid classId"); } if (!checkCollectionId(context)) { LOGGER.error( "AssessmentId not available to obtain Student DCA Assessment Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid assessmentId"); } return new RepoBuilder().buildReportRepo(context).getStudentPerformanceInDCAAssessment(); } catch (Throwable t) { LOGGER.error("Exception while getting Student performance in a DCA Assessment", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentPerfInDCACollection() { try { ProcessorContext context = createContext(); if (!checkClassId(context)) { LOGGER .error("Class id not available to obtain Student DCA Collection Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid classId"); } if (!checkCollectionId(context)) { LOGGER.error( "CollectionId not available to obtain Student DCA Collection Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid collectionId"); } return new RepoBuilder().buildReportRepo(context).getStudentPerformanceInDCACollection(); } catch (Throwable t) { LOGGER.error("Exception while getting Student performance in a DCA Collection", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudDCAAssessmentSessions() { try { ProcessorContext context = createContext(); if (!checkCollectionId(context)) { LOGGER.error("Collection id not available to obtain User Sessions. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid collectionId"); } return new RepoBuilder().buildReportRepo(context).getStudentDCAAssessmentSessions(); } catch (Throwable t) { LOGGER.error("Exception while getting User Sessions for Assessment", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getDCAClassPerf() { try { ProcessorContext context = createContext(); if (!checkClassId(context)) { LOGGER.error("Class id not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid classId"); } return new RepoBuilder().buildReportRepo(context).getDCAClassPerformance(); } catch (Throwable t) { LOGGER.error("Exception while getting DCA Class Performance", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getDCAAllClassesPerf() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getDCAAllClassesPerformance(); } catch (Throwable t) { LOGGER.error("Exception while getting DCA Class Performance", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } // ************************************************************************************************************************* private MessageResponse getDataReports() { try { ProcessorContext context = createContext(); LOGGER.info("classId : {}", context.classId()); LOGGER.info("userId : {}", context.getUserIdFromRequest()); LOGGER.info("startDate : {}", context.startDate()); LOGGER.info("endDate : {}", context.endDate()); if (!checkClassId(context)) { LOGGER.error("ClassId not available to obtain NU data reports. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid ClassId"); } if (!validateUser(context.userIdFromSession())) { LOGGER.error("Invalid User ID. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid UserId"); } if (!FieldValidator.validateDate(context.startDate())) { LOGGER.error("Invalid start date. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid startDate"); } if (!FieldValidator.validateDate(context.endDate())) { LOGGER.error("Invalid end date. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid endDate"); } return new RepoBuilder().buildReportRepo(context).getDataReports(); } catch (Throwable t) { LOGGER.error("Exception while getting NU data reports", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getCoursesCompetencyCompletion() { try { ProcessorContext context = createContext(); LOGGER.info("userId : {}", context.getUserIdFromRequest()); if (!validateUser(context.getUserIdFromRequest())) { LOGGER.error("Invalid User ID. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid UserId"); } return new RepoBuilder().buildReportRepo(context).getCoursesComptencyCompletion(); } catch (Throwable t) { LOGGER.error("Exception while getting course competency completion", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } // ************ RUBRIC GRADING // ****************************************************************************************** private MessageResponse getRubricQuestionsToGrade() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getRubricQuesToGrade(); } catch (Throwable t) { LOGGER.error("Exception while getting Questions pending Grading", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentsForRubricQue() { try { ProcessorContext context = createContext(); if (!checkQuestionId(context)) { LOGGER.error("QuestionId not available to obtain Student Ids. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid QuestionId"); } return new RepoBuilder().buildReportRepo(context).getStudentsForRubricQuestion(); } catch (Throwable t) { LOGGER.error("Exception while getting Student List for Rubric Grading", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudAnswersForRubricQue() { try { ProcessorContext context = createContext(); if (!checkQuestionId(context)) { LOGGER.error("QuestionId not available to obtain answers. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid QuestionId"); } if (!checkStudentId(context)) { LOGGER.error("StudentId not available to obtain answers. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid StudentId"); } return new RepoBuilder().buildReportRepo(context).getStudentAnswersForRubricQuestion(); } catch (Throwable t) { LOGGER.error("Exception while getting Student answers for Rubric Grading", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getRubricSummaryforQue() { try { ProcessorContext context = createContext(); if (!checkClassId(context)) { LOGGER.error("ClassId not available to obtain Student Rubric Question Summary. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid ClassId"); } if (!checkCourseId(context)) { LOGGER.error("Course id not available to obtain Student Rubric Question Summary. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid CourseId"); } if (!checkCollectionId(context)) { LOGGER.error( "Collection id not available to obtain Student Rubric Question Summary. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid collectionId"); } if (!checkQuestionId(context)) { LOGGER.error("QuestionId not available to obtain Rubric Question Summary. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid QuestionId"); } return new RepoBuilder().buildReportRepo(context).getRubricSummaryforQuestion(); } catch (Throwable t) { LOGGER.error("Exception while getting Student answers for Rubric Grading", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } // ************************************************************************************************************** private MessageResponse getStudentPeersInCourse() { try { ProcessorContext context = createContext(); if (!checkClassId(context)) { LOGGER.error("ClassId not available to obtain Student Peers. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid ClassId"); } if (!checkCourseId(context)) { LOGGER.error("Course Id not available to obtain Student Peers. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid CourseId"); } return new RepoBuilder().buildReportRepo(context).getStudentPeersInCourse(); } catch (Throwable t) { LOGGER.error("Exception while getting Student peers in Course", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentPeersInUnit() { try { ProcessorContext context = createContext(); if (!checkClassId(context)) { LOGGER.error("ClassId not available to obtain Student Peers. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid ClassId"); } if (!checkCourseId(context)) { LOGGER.error("Course id not available to obtain Student Peers. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid CourseId"); } if (!checkUnitId(context)) { LOGGER.error("Unit id not available to obtain Student Peers. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid UnitId"); } return new RepoBuilder().buildReportRepo(context).getStudentPeersInUnit(); } catch (Throwable t) { LOGGER.error("Exception while getting Student peers in Unit", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentPeersInLesson() { try { ProcessorContext context = createContext(); if (!checkClassId(context)) { LOGGER.error("ClassId not available to obtain Student Peers. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid ClassId"); } if (!checkCourseId(context)) { LOGGER.error("CourseId not available to obtain Student Peers. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid CourseId"); } if (!checkUnitId(context)) { LOGGER.error("UnitId not available to obtain Student Peers. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid UnitId"); } if (!checkLessonId(context)) { LOGGER.error("LessonId not available to obtain Student Peers. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid LessonId"); } return new RepoBuilder().buildReportRepo(context).getStudentPeersInLesson(); } catch (Throwable t) { LOGGER.error("Exception while getting Student peers in Lesson", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentCurrentLocation() { try { ProcessorContext context = createContext(); if (!checkClassId(context)) { LOGGER.error("ClassId not available to obtain Student Current Location. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid ClassId"); } if (!validateUser(context.userIdFromSession())) { LOGGER.error("Invalid User ID. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid UserId"); } return new RepoBuilder().buildReportRepo(context).getStudentCurrentLocation(); } catch (Throwable t) { LOGGER.error("Exception while getting Student Current Location", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentPerfInCourse() { try { ProcessorContext context = createContext(); if (!checkClassId(context)) { LOGGER.error("ClassId not available to obtain Student Performance. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid ClassId"); } if (!checkCourseId(context)) { LOGGER.error("CourseId not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid CourseId"); } return new RepoBuilder().buildReportRepo(context).getStudentPerformanceInCourse(); } catch (Throwable t) { LOGGER.error("Exception while getting Student performance in Course", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentPerfInUnit() { try { ProcessorContext context = createContext(); if (!checkClassId(context)) { LOGGER.error("ClassId not available to obtain Student Performance. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid ClassId"); } if (!checkCourseId(context)) { LOGGER.error("CourseId not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid CourseId"); } if (!checkUnitId(context)) { LOGGER.error("UnitId not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid UnitId"); } return new RepoBuilder().buildReportRepo(context).getStudentPerformanceInUnit(); } catch (Throwable t) { LOGGER.error("Exception while getting Student performance in Unit", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentPerfInLesson() { try { ProcessorContext context = createContext(); if (!checkClassId(context)) { LOGGER.error("ClassId not available to obtain Student Performance. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid ClassId"); } if (!checkCourseId(context)) { LOGGER.error("CourseId not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid CourseId"); } if (!checkUnitId(context)) { LOGGER.error("UnitId not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid UnitId"); } if (!checkLessonId(context)) { LOGGER.error("LessonId not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid LessonId"); } return new RepoBuilder().buildReportRepo(context).getStudentPerformanceInLesson(); } catch (Throwable t) { LOGGER.error("Exception while getting Student performance in Lesson", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentPerfInAssessment() { try { ProcessorContext context = createContext(); if (!checkClassId(context)) { LOGGER.error("ClassId not available to obtain Student Performance. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid ClassId"); } if (!checkCourseId(context)) { LOGGER.error("CourseId not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid CourseId"); } if (!checkUnitId(context)) { LOGGER.error("UnitId not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid UnitId"); } if (!checkLessonId(context)) { LOGGER.error("LessonId not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid LessonId"); } if (!checkCollectionId(context)) { LOGGER.error("AssessmentId not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid assessmentId"); } return new RepoBuilder().buildReportRepo(context).getStudentPerformanceInAssessment(); } catch (Throwable t) { LOGGER.error("Exception while getting Student performance in an Assessment", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentPerfInCollection() { try { ProcessorContext context = createContext(); if (!checkClassId(context)) { LOGGER.error("ClassId not available to obtain Student Performance. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid ClassId"); } if (!checkCourseId(context)) { LOGGER.error("CourseId not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid CourseId"); } if (!checkUnitId(context)) { LOGGER.error("UnitId not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid UnitId"); } if (!checkLessonId(context)) { LOGGER.error("LessonId not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid LessonId"); } if (!checkCollectionId(context)) { LOGGER.error("CollectionId not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid collectionId"); } return new RepoBuilder().buildReportRepo(context).getStudentPerformanceInCollection(); } catch (Throwable t) { LOGGER.error("Exception while getting Student performance in an Collection", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentSummaryInCollection() { try { ProcessorContext context = createContext(); if (!checkCollectionId(context)) { LOGGER.error("Collection id not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid collectionId"); } if (!validateUser(context.userIdFromSession())) { LOGGER.error("Invalid User ID. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid userId"); } return new RepoBuilder().buildReportRepo(context).getStudentSummaryInCollection(); } catch (Throwable t) { LOGGER.error("Exception while getting Student Collection Summary", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentSummaryInAssessment() { try { ProcessorContext context = createContext(); if (!checkCollectionId(context)) { LOGGER.error("Collection id not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid collectionId"); } if (!validateUser(context.userIdFromSession())) { LOGGER.error("Invalid User ID. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid userId"); } return new RepoBuilder().buildReportRepo(context).getStudentSummaryInAssessment(); } catch (Throwable t) { LOGGER.error("Exception while getting Student Assessment Summary", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getSessionStatus() { try { ProcessorContext context = createContext(); if (!checkSessionId(context)) { LOGGER.error("SessionId not available. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid SessionId"); } if (!checkCollectionId(context)) { LOGGER.error("CollectionId not available to get Session Status. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid CollectionId"); } return new RepoBuilder().buildReportRepo(context).getSessionStatus(); } catch (Throwable t) { LOGGER.error("Exception while getting Student peers in Unit", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getUserAssessmentSessions() { try { ProcessorContext context = createContext(); if (!checkCollectionId(context)) { LOGGER.error("Collection id not available to obtain User Sessions. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid collectionId"); } return new RepoBuilder().buildReportRepo(context).getUserAssessmentSessions(); } catch (Throwable t) { LOGGER.error("Exception while getting User Sessions for Assessment", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getUserCollectionSessions() { try { ProcessorContext context = createContext(); if (!checkCollectionId(context)) { LOGGER.error("Collection id not available to obtain User Sessions. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid collectionId"); } return new RepoBuilder().buildReportRepo(context).getUserCollectionSessions(); } catch (Throwable t) { LOGGER.error("Exception while getting User Sessions for Collection", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getSessionWiseTaxonomyReport() { try { ProcessorContext context = createContext(); if (!checkSessionId(context)) { LOGGER.error("Session id not available in the request. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid sessionId"); } return new RepoBuilder().buildReportRepo(context).getSessionWiseTaxonmyReport(); } catch (Throwable t) { LOGGER.error("Exception while getting Student performance in Unit", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } // =================================User Independent Learning // ===============================================// private MessageResponse getUserIndepedentLearningPerfInCourse() { try { ProcessorContext context = createContext(); if (!checkCourseId(context)) { LOGGER.error("CourseId not available to obtain Learner Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid CourseId"); } return new RepoBuilder().buildReportRepo(context).getLearnerPerformanceInCourse(); } catch (Throwable t) { LOGGER.error("Exception while getting learner performance in Course", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getUserIndepedentLearningPerfInUnit() { try { ProcessorContext context = createContext(); if (!checkCourseId(context)) { LOGGER.error("CourseId not available to obtain Learner Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid CourseId"); } if (!checkUnitId(context)) { LOGGER.error("UnitId not available to obtain Learner Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid UnitId"); } return new RepoBuilder().buildReportRepo(context).getLearnerPerformanceInUnit(); } catch (Throwable t) { LOGGER.error("Exception while getting learner performance in Unit", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getUserIndepedentLearningPerfInLesson() { try { ProcessorContext context = createContext(); if (!checkCourseId(context)) { LOGGER.error("CourseId not available to obtain Learner Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid CourseId"); } if (!checkUnitId(context)) { LOGGER.error("UnitId not available to obtain Learner Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid UnitId"); } if (!checkLessonId(context)) { LOGGER.error("LessonId not available to obtain Learner Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid LessonId"); } return new RepoBuilder().buildReportRepo(context).getLearnerPerformanceInLesson(); } catch (Throwable t) { LOGGER.error("Exception while getting learner performance in Lesson", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getUserIndepedentLearningPerfInAssessment() { try { ProcessorContext context = createContext(); if (!checkCourseId(context)) { LOGGER.error("CourseId not available to obtain Learner Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid CourseId"); } if (!checkUnitId(context)) { LOGGER.error("UnitId not available to obtain Learner Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid UnitId"); } if (!checkLessonId(context)) { LOGGER.error("LessonId not available to obtain Learner Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid LessonId"); } if (!checkCollectionId(context)) { LOGGER.error("AssessmentId not available to obtain Learner Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid assessmentId"); } return new RepoBuilder().buildReportRepo(context).getLearnerPerformanceInAssessment(); } catch (Throwable t) { LOGGER.error("Exception while getting learner performance in assessment", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getUserLearningPerfInIndepedentAssessment() { try { ProcessorContext context = createContext(); if (!checkCollectionId(context)) { LOGGER .error("AssessmentId not available to obtain learner assessment performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid assessmentId"); } return new RepoBuilder().buildReportRepo(context) .getLearnerPerformanceInIndependentAssessment(); } catch (Throwable t) { LOGGER.error("Exception while getting Learner performance in Lesson", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getLearnerCourses() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getLearnerCourses(); } catch (Throwable t) { LOGGER.error("Exception while getting learner courses", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getIndependentLearnerLoc() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getIndependentLearnerLocation(); } catch (Throwable t) { LOGGER.error("Exception while getting Independent Learner Location", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getIndependentLearnerPerf() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getIndependentLearnerPerformance(); } catch (Throwable t) { LOGGER.error("Exception while getting Independent Learner Performance", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getIndependentLearnerCoursesLoc() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getIndLearnerCoursesLocation(); } catch (Throwable t) { LOGGER.error("Exception while getting independent learner courses", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getIndependentLearnerAssessmentsLoc() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getIndLearnerAssessmentsLocation(); } catch (Throwable t) { LOGGER.error("Exception while getting independent learner courses", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getIndependentLearnerCollectionsLoc() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getIndLearnerCollectionsLocation(); } catch (Throwable t) { LOGGER.error("Exception while getting independent learner courses", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getIndependentLearnerAllCoursesPerf() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getIndLearnerAllCoursesPerf(); } catch (Throwable t) { LOGGER.error("Exception while getting independent learner courses", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getIndependentLearnerIndAssessmentsPerf() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getIndLearnerIndAssessmentsPerf(); } catch (Throwable t) { LOGGER.error("Exception while getting independent learner courses", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getIndependentLearnerIndCollectionsPerf() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getIndLearnerIndCollectionsPerf(); } catch (Throwable t) { LOGGER.error("Exception while getting independent learner courses", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } // ---------------------- private MessageResponse getIndependentLearnerCourseCollectionsPerf() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getIndLearnerCourseCollectionsPerf(); } catch (Throwable t) { LOGGER.error("Exception while getting independent learner courses", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getIndependentLearnerCourseAssessmentsPerf() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getIndLearnerCourseAssessmentsPerf(); } catch (Throwable t) { LOGGER.error("Exception while getting independent learner courses", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getIndependentLearnerTaxSubjects() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getIndLearnerTaxSubjects(); } catch (Throwable t) { LOGGER.error("Exception while getting independent learner tax subjects", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getIndependentLearnerSummaryInCollection() { try { ProcessorContext context = createContext(); if (!checkCollectionId(context)) { LOGGER.error( "Collection id not available to obtain Independent Learner Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid collectionId"); } if (!validateUser(context.userIdFromSession())) { LOGGER.error("Invalid User ID. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid userId"); } return new RepoBuilder().buildReportRepo(context).getIndLearnerSummaryInCollection(); } catch (Throwable t) { LOGGER.error("Exception while getting Independent Learner Collection Summary", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getIndependentLearnerSummaryInAssessment() { try { ProcessorContext context = createContext(); if (!checkCollectionId(context)) { LOGGER.error( "Collection id not available to obtain Independent Learner Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid collectionId"); } if (!validateUser(context.userIdFromSession())) { LOGGER.error("Invalid User ID. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid userId"); } return new RepoBuilder().buildReportRepo(context).getIndLearnerSummaryInAssessment(); } catch (Throwable t) { LOGGER.error("Exception while getting Independent Learner Assessment Summary", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getIndependentLearnerAssessmentSessions() { try { ProcessorContext context = createContext(); if (!checkCollectionId(context)) { LOGGER .error("Collection id not available to obtain Independent Learner Sessions. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid collectionId"); } return new RepoBuilder().buildReportRepo(context).getIndLearnerAssessmentSessions(); } catch (Throwable t) { LOGGER.error("Exception while getting Independent Learner Sessions for Assessment", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getIndependentLearnerCollectionSessions() { try { ProcessorContext context = createContext(); if (!checkCollectionId(context)) { LOGGER .error("Collection id not available to obtain Independent Learner Sessions. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid collectionId"); } return new RepoBuilder().buildReportRepo(context).getIndLearnerCollectionSessions(); } catch (Throwable t) { LOGGER.error("Exception while getting Independent Learner Sessions for Collection", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } // ********************************************************************************************************************* private MessageResponse getStudentPerfInAllClasses() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getStudentPerfInAllClasses(); } catch (Throwable t) { LOGGER.error("Exception while getting Student performance in all Classes", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentLocInAllClasses() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getStudentLocationInAllClasses(); } catch (Throwable t) { LOGGER.error("Exception while getting Student Location in all Classes", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentPerfMultipleCollections() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getStudPerfMultipleCollections(); } catch (Throwable t) { LOGGER.error("Exception while getting Student Performance in Multiple Collections", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentPerfCourseAssessments() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getStudPerfCourseAssessments(); } catch (Throwable t) { LOGGER.error("Exception while getting Student Performance in Course Assessments", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentPerfCourseCollections() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getStudPerfCourseCollections(); } catch (Throwable t) { LOGGER.error("Exception while getting Student Performance in Course Collections", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } // ATC private MessageResponse getStudentPerfVsCompletionReport() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getStudentPerfVsCompletion(); } catch (Throwable t) { LOGGER.error("Exception while getting Student Performance Vs Completion Report", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentCourseAllItemsReport() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getStudentCourseAllItemsReport(); } catch (Throwable t) { LOGGER.error("Exception while getting Student Performance of all Items in Class", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getIndependentLearnerCourseAllItemsReport() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getIndependentLearnerCourseAllItemsReport(); } catch (Throwable t) { LOGGER.error("Exception while getting Learner Performance of all Items in Course", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getDCAMonthlyClassSummaryHandler() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getDCAMonthlyClassSummaryHandler(); } catch (Throwable t) { LOGGER.error("Exception while getting getDCAMonthlyClassSummaryHandler", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getDCAClassSummaryForMonthHandler() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getDCAClassSummaryForMonthHandler(); } catch (Throwable t) { LOGGER.error("Exception while getting getDCAClassSummaryForMonthHandler", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getDCAActivityAllStudentSummaryReportHandler() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context) .getDCAActivityAllStudentSummaryReportHandler(); } catch (Throwable t) { LOGGER.error("Exception while getting getDCAActivityAllStudentSummaryReportHandler", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getCAAssessmentSessionPerfReportHandler() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getStudentCAAssessmentSessionPerformance(); } catch (Throwable t) { LOGGER.error("Exception while getting getCAAssessmentSessionPerfReportHandler", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getCACollectionSessionPerfReportHandler() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getStudentCACollectionSessionPerformance(); } catch (Throwable t) { LOGGER.error("Exception while getting getCACollectionSessionPerfReportHandler", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } // MILESTONE // ************************************************************************************************************************** private MessageResponse getStudentMilestoneLessonPerformanceHandler() { try { ProcessorContext context = createContext(); if (!checkClassId(context)) { LOGGER.error("ClassId not available to obtain Student Performance. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid ClassId"); } if (!checkCourseId(context)) { LOGGER.error("CourseId not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid CourseId"); } return new RepoBuilder().buildReportRepo(context).getStudentMilestoneLessonPerfHandler(); } catch (Throwable t) { LOGGER.error("Exception while getting Student performance in Unit", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentMilestonePerformanceHandler() { try { ProcessorContext context = createContext(); if (!checkClassId(context)) { LOGGER.error("ClassId not available to obtain Student Performance. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid ClassId"); } if (!checkCourseId(context)) { LOGGER.error("CourseId not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid CourseId"); } return new RepoBuilder().buildReportRepo(context).getStudentMilestonePerfHandler(); } catch (Throwable t) { LOGGER.error("Exception while getting Student performance in Unit", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } // ******************************************************************************************************************************** // MILESTONE - Independent Learner private MessageResponse getILMilestoneLessonPerformanceHandler() { try { ProcessorContext context = createContext(); if (!checkCourseId(context)) { LOGGER.error("CourseId not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid CourseId"); } return new RepoBuilder().buildReportRepo(context).getILMilestoneLessonPerfHandler(); } catch (Throwable t) { LOGGER.error("Exception while getting Student performance in Unit", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getILMilestonePerformanceHandler() { try { ProcessorContext context = createContext(); if (!checkCourseId(context)) { LOGGER.error("CourseId not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid CourseId"); } return new RepoBuilder().buildReportRepo(context).getILMilestonePerfHandler(); } catch (Throwable t) { LOGGER.error("Exception while getting Student performance in Unit", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } // ******************************************************************************************************************************** private MessageResponse getAllClassPerfInternal() { try { ProcessorContext context = createContext(); context.setIsIntenal(true); return new RepoBuilder().buildReportRepo(context).getStudentPerfInAllClasses(); } catch (Throwable t) { LOGGER.error("Exception while getting getClassPerformance", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getDCAAllClassesPerfInternal() { try { ProcessorContext context = createContext(); context.setIsIntenal(true); return new RepoBuilder().buildReportRepo(context).getDCAAllClassesPerformance(); } catch (Throwable t) { LOGGER.error("Exception while getting getClassPerformance", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } // ************ DCA RUBRIC GRADING // ****************************************************************************************** private MessageResponse getDCARubricQuestionsToGrade() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getDCARubricQuesToGrade(); } catch (Throwable t) { LOGGER.error("Exception while getting Questions pending Grading", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getDCAStudentsForRubricQue() { try { ProcessorContext context = createContext(); if (!checkQuestionId(context)) { LOGGER.error("QuestionId not available to obtain Student Ids. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid QuestionId"); } return new RepoBuilder().buildReportRepo(context).getDCAStudentsForRubricQuestion(); } catch (Throwable t) { LOGGER.error("Exception while getting Student List for Rubric Grading", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getDCAStudAnswersForRubricQue() { try { ProcessorContext context = createContext(); if (!checkQuestionId(context)) { LOGGER.error("QuestionId not available to obtain answers. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid QuestionId"); } if (!checkStudentId(context)) { LOGGER.error("StudentId not available to obtain answers. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid StudentId"); } return new RepoBuilder().buildReportRepo(context).getDCAStudentAnswersForRubricQuestion(); } catch (Throwable t) { LOGGER.error("Exception while getting Student answers for Rubric Grading", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getDCARubricSummaryforQue() { try { ProcessorContext context = createContext(); if (!checkClassId(context)) { LOGGER.error("ClassId not available to obtain Student Rubric Question Summary. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid ClassId"); } if (!checkCollectionId(context)) { LOGGER.error( "Collection id not available to obtain Student Rubric Question Summary. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid collectionId"); } if (!checkQuestionId(context)) { LOGGER.error("QuestionId not available to obtain Rubric Question Summary. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid QuestionId"); } return new RepoBuilder().buildReportRepo(context).getDCARubricSummaryforQuestion(); } catch (Throwable t) { LOGGER.error("Exception while getting Student answers for Rubric Grading", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getOAsToGrade() { try { ProcessorContext context = createContext(); String studentId = context.request().getString(MessageConstants.USER_ID); String type = context.request().getString(MessageConstants.TYPE, MessageConstants.OA); String source = context.request().getString(MessageConstants.SOURCE, MessageConstants.DCA); if(!type.equalsIgnoreCase(MessageConstants.OA) || !MessageConstants.CM_CA_SOURCE_TYPES.matcher(source).matches()) { LOGGER.error("Source or type is invalid. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid type or source"); } if (source.equals(MessageConstants.DCA)) { if (!StringUtil.isNullOrEmpty(studentId)) { return new RepoBuilder().buildReportRepo(context).getDCAOAToSelfGrade(); } else { return new RepoBuilder().buildReportRepo(context).getDCAOAToTeacherGrade(); } } else { if (!StringUtil.isNullOrEmpty(studentId)) { return new RepoBuilder().buildReportRepo(context).getOAToSelfGrade(); } else { return new RepoBuilder().buildReportRepo(context).getOAToTeacherGrade(); } } } catch (Throwable t) { LOGGER.error("Exception while getting OA pending Grading", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentsToGradeForOA() { try { ProcessorContext context = createContext(); if (!checkItemId(context)) { LOGGER.error("oaId not available to obtain grading items. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid ItemId"); } String type = context.request().getString(MessageConstants.TYPE, MessageConstants.OA); String source = context.request().getString(MessageConstants.SOURCE, MessageConstants.DCA); if(!type.equalsIgnoreCase(MessageConstants.OA) || !MessageConstants.CM_CA_SOURCE_TYPES.matcher(source).matches()) { LOGGER.error("Source or type is invalid. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid type or source"); } if (source.equals(MessageConstants.DCA)) { return new RepoBuilder().buildReportRepo(context).getDCAStudentsToGradeForOA(); } else { return new RepoBuilder().buildReportRepo(context).getStudentsToGradeForOA(); } } catch (Throwable t) { LOGGER.error("Exception while getting Student List for OA Grading", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getDCAStudentSubmissionsForOA() { try { ProcessorContext context = createContext(); if (!checkOaId(context)) { LOGGER.error("oaId not available to obtain Student Submissions. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid oaId"); } return new RepoBuilder().buildReportRepo(context).getDCAStudentSubmissionsOfOA(); } catch (Throwable t) { LOGGER.error("Exception while getting Student Submissions for OA Grading", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getDCAOACompleteMarkedByStudents() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getDCAOACompleteMarkedByStudents(); } catch (Throwable t) { LOGGER.error("Exception while getting OA complete student list", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentSubmissionsOfOA() { try { ProcessorContext context = createContext(); if (!checkOaId(context)) { LOGGER.error("oaId not available to obtain CM OA Student Submissions. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid oaId"); } return new RepoBuilder().buildReportRepo(context).getStudentSubmissionsOfOA(); } catch (Throwable t) { LOGGER.error("Exception while getting CM OA Student Submissions for OA Grading", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getOACompleteMarkedByStudents() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getOACompleteMarkedByStudents(); } catch (Throwable t) { LOGGER.error("Exception while getting CM OA complete student list", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } // ************************************************************************************************************** private ProcessorContext createContext() { String classId = message.headers().get(MessageConstants.CLASS_ID); String courseId = message.headers().get(MessageConstants.COURSE_ID); String unitId = message.headers().get(MessageConstants.UNIT_ID); String lessonId = message.headers().get(MessageConstants.LESSON_ID); String collectionId = message.headers().get(MessageConstants.COLLECTION_ID); String milestoneId = message.headers().get(MessageConstants.MILESTONE_ID); /* user id from session */ String userId = (request).getString(MessageConstants._USER_ID); /* user id from api request */ String userUId = (request).getString(MessageConstants.USER_UID); userUId = userUId == null ? (request).getString(MessageConstants.USER_ID) : userUId; String sessionId = message.headers().get(MessageConstants.SESSION_ID); String studentId = message.headers().get(MessageConstants.STUDENT_ID); String questionId = message.headers().get(MessageConstants.QUESTION_ID); String startDate = message.headers().get(MessageConstants.START_DATE); String endDate = message.headers().get(MessageConstants.END_DATE); String collectionType = message.headers().get(MessageConstants.COLLECTION_TYPE); String studId = message.headers().get(MessageConstants.STUDENTID); String oaId = message.headers().get(MessageConstants.OA_ID); String itemId = message.headers().get(MessageConstants.ITEM_ID); return new ProcessorContext(request, userId, userUId, classId, courseId, unitId, lessonId, collectionId, sessionId, studentId, questionId, startDate, endDate, collectionType, milestoneId, studId, oaId, itemId); } // This is just the first level validation. Each Individual Handler would need to do more // validation based on the // handler specific params that are needed for processing. private ExecutionResult<MessageResponse> validateAndInitialize() { if (message == null || !(message.body() instanceof JsonObject)) { LOGGER.error("Invalid message received, either null or body of message is not JsonObject "); return new ExecutionResult<>( MessageResponseFactory .createInvalidRequestResponse(RESOURCE_BUNDLE.getString("invalid.message")), ExecutionResult.ExecutionStatus.FAILED); } /** * userId = ((JsonObject) message.body()).getString(MessageConstants.MSG_USER_ID); if * (!validateUser(userId)) { LOGGER.error("Invalid user id passed. Not authorized."); return new * ExecutionResult<>( * MessageResponseFactory.createForbiddenResponse(RESOURCE_BUNDLE.getString("missing.user")), * ExecutionResult.ExecutionStatus.FAILED); } **/ request = ((JsonObject) message.body()).getJsonObject(MessageConstants.MSG_HTTP_BODY); LOGGER.info(request.toString()); if (request == null) { LOGGER.error("Invalid JSON payload on Message Bus"); return new ExecutionResult<>( MessageResponseFactory .createInvalidRequestResponse(RESOURCE_BUNDLE.getString("invalid.payload")), ExecutionResult.ExecutionStatus.FAILED); } // All is well, continue processing return new ExecutionResult<>(null, ExecutionResult.ExecutionStatus.CONTINUE_PROCESSING); } private boolean checkCollectionId(ProcessorContext context) { return validateId(context.collectionId()); } private boolean checkLessonId(ProcessorContext context) { return validateId(context.lessonId()); } private boolean checkUnitId(ProcessorContext context) { return validateId(context.unitId()); } private boolean checkCourseId(ProcessorContext context) { return validateId(context.courseId()); } private boolean checkClassId(ProcessorContext context) { return validateId(context.classId()); } private boolean checkSessionId(ProcessorContext context) { return validateId(context.sessionId()); } private boolean checkQuestionId(ProcessorContext context) { return validateId(context.questionId()); } private boolean checkStudentId(ProcessorContext context) { return validateId(context.studentId()); } private boolean checkOaId(ProcessorContext context) { return checkIsNotNull(context.oaId()); } private boolean checkItemId(ProcessorContext context) { return checkIsNotNull(context.itemId()); } private boolean checkRequest(ProcessorContext context) { return checkJsonObjIsNotNull(context.request()); } private boolean checkCollectionType(ProcessorContext context) { String collectionType = context.request().getString(MessageConstants.COLLECTION_TYPE); return checkIsNotNull(collectionType) && isValidCollectionType(collectionType); } private boolean checkIfCollectionTypeIsOa(ProcessorContext context) { String collectionType = context.request().getString(MessageConstants.COLLECTION_TYPE); return (collectionType != null && !collectionType.isEmpty() && collectionType.equalsIgnoreCase(JsonConstants.OFFLINE_ACTIVITY)); } private boolean validateUser(String userId) { return !(userId == null || userId.isEmpty() || (userId.equalsIgnoreCase(MessageConstants.MSG_USER_ANONYMOUS)) && validateUuid(userId)); } private boolean validateId(String id) { return !(id == null || id.isEmpty()) && validateUuid(id); } private boolean checkIsNotNull(String id) { return !(id == null || id.isEmpty()); } private boolean checkJsonObjIsNotNull(JsonObject jsonObj) { return !(jsonObj == null || jsonObj.isEmpty()); } private boolean isValidCollectionType(String type) { return JsonConstants.COLLECTION_TYPES.matcher(type).matches(); } private boolean validateUuid(String uuidString) { try { UUID uuid = UUID.fromString(uuidString); return true; } catch (Exception e) { return false; } } }
UTF-8
Java
78,291
java
MessageProcessor.java
Java
[]
null
[]
package org.gooru.nucleus.handlers.dataclass.api.processors; import java.util.ResourceBundle; import java.util.UUID; import org.gooru.nucleus.handlers.dataclass.api.constants.JsonConstants; import org.gooru.nucleus.handlers.dataclass.api.constants.MessageConstants; import org.gooru.nucleus.handlers.dataclass.api.processors.repositories.RepoBuilder; import org.gooru.nucleus.handlers.dataclass.api.processors.repositories.activejdbc.validators.FieldValidator; import org.gooru.nucleus.handlers.dataclass.api.processors.responses.ExecutionResult; import org.gooru.nucleus.handlers.dataclass.api.processors.responses.MessageResponse; import org.gooru.nucleus.handlers.dataclass.api.processors.responses.MessageResponseFactory; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import com.hazelcast.util.StringUtil; import io.vertx.core.eventbus.Message; import io.vertx.core.json.JsonObject; class MessageProcessor implements Processor { private static final Logger LOGGER = LoggerFactory.getLogger(Processor.class); private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle("messages"); private final Message<Object> message; private JsonObject request; public MessageProcessor(Message<Object> message) { this.message = message; } @Override public MessageResponse process() { MessageResponse result; try { // Validate the message itself ExecutionResult<MessageResponse> validateResult = validateAndInitialize(); if (validateResult.isCompleted()) { return validateResult.result(); } final String msgOp = message.headers().get(MessageConstants.MSG_HEADER_OP); // There should be only one handler switch (msgOp) { case MessageConstants.MSG_OP_COURSE_PEERS: result = getStudentPeersInCourse(); break; case MessageConstants.MSG_OP_UNIT_PEERS: result = getStudentPeersInUnit(); break; case MessageConstants.MSG_OP_LESSON_PEERS: result = getStudentPeersInLesson(); break; case MessageConstants.MSG_OP_STUDENT_CURRENT_LOC: result = getStudentCurrentLocation(); break; case MessageConstants.MSG_OP_STUDENT_COURSE_PERF: result = getStudentPerfInCourse(); break; case MessageConstants.MSG_OP_STUDENT_UNIT_PERF: result = getStudentPerfInUnit(); break; case MessageConstants.MSG_OP_STUDENT_LESSON_PERF: result = getStudentPerfInLesson(); break; case MessageConstants.MSG_OP_STUDENT_COLLECTION_PERF: result = getStudentPerfInCollection(); break; case MessageConstants.MSG_OP_STUDENT_ASSESSMENT_PERF: result = getStudentPerfInAssessment(); break; case MessageConstants.MSG_OP_STUDENT_COLLECTION_SUMMARY: result = getStudentSummaryInCollection(); break; case MessageConstants.MSG_OP_STUDENT_ASSESSMENT_SUMMARY: result = getStudentSummaryInAssessment(); break; case MessageConstants.MSG_OP_SESSION_STATUS: result = getSessionStatus(); break; case MessageConstants.MSG_OP_USER_ALL_ASSESSMENT_SESSIONS: result = getUserAssessmentSessions(); break; case MessageConstants.MSG_OP_USER_ALL_COLLECTION_SESSIONS: result = getUserCollectionSessions(); break; case MessageConstants.MSG_OP_SESSION_TAXONOMY_REPORT: result = getSessionWiseTaxonomyReport(); break; case MessageConstants.MSG_OP_ALL_STUDENT_CLASSES_PERF: result = getStudentPerfInAllClasses(); break; case MessageConstants.MSG_OP_STUDENT_LOC_ALL_CLASSES: result = getStudentLocInAllClasses(); break; case MessageConstants.MSG_OP_STUDENT_PERF_MULT_COLLECTION: result = getStudentPerfMultipleCollections(); break; case MessageConstants.MSG_OP_STUDENT_PERF_COURSE_ASSESSMENT: result = getStudentPerfCourseAssessments(); break; case MessageConstants.MSG_OP_STUDENT_PERF_COURSE_COLLECTION: result = getStudentPerfCourseCollections(); break; case MessageConstants.MSG_OP_INDEPENDENT_LEARNER_COURSE_PERF: result = getUserIndepedentLearningPerfInCourse(); break; case MessageConstants.MSG_OP_INDEPENDENT_LEARNER_UNIT_PERF: result = getUserIndepedentLearningPerfInUnit(); break; case MessageConstants.MSG_OP_INDEPENDENT_LEARNER_LESSON_PERF: result = getUserIndepedentLearningPerfInLesson(); break; case MessageConstants.MSG_OP_INDEPENDENT_LEARNER_ASSESSMENT_PERF: result = getUserIndepedentLearningPerfInAssessment(); break; case MessageConstants.MSG_OP_INDEPENDENT_LEARNER_INDEPENDENT_ASSESSMENT_PERF: result = getUserLearningPerfInIndepedentAssessment(); break; case MessageConstants.MSG_OP_INDEPENDENT_LEARNER_COURSES: // result = getIndependentLearnerCourses(); result = getLearnerCourses(); break; case MessageConstants.MSG_OP_IND_LEARNER_ALL_LOCATION: result = getIndependentLearnerLoc(); break; case MessageConstants.MSG_OP_IND_LEARNER_ALL_PERFORMANCE: result = getIndependentLearnerPerf(); break; case MessageConstants.MSG_OP_IND_LEARNER_CURRENT_LOC: result = getIndependentLearnerCoursesLoc(); break; case MessageConstants.MSG_OP_IND_LEARNER_LOCATION_ALL_IND_ASSESSMENTS: result = getIndependentLearnerAssessmentsLoc(); break; case MessageConstants.MSG_OP_IND_LEARNER_LOCATION_ALL_IND_COLLECTIONS: result = getIndependentLearnerCollectionsLoc(); break; case MessageConstants.MSG_OP_IND_LEARNER_ALL_COURSES_PERF: result = getIndependentLearnerAllCoursesPerf(); break; case MessageConstants.MSG_OP_IND_LEARNER_PERF_ALL_IND_ASSESSMENTS: result = getIndependentLearnerIndAssessmentsPerf(); break; case MessageConstants.MSG_OP_IND_LEARNER_PERF_ALL_IND_COLLECTIONS: result = getIndependentLearnerIndCollectionsPerf(); break; case MessageConstants.MSG_OP_IND_LEARNER_COURSE_ALL_COLLECTIONS_PERF: result = getIndependentLearnerCourseCollectionsPerf(); break; case MessageConstants.MSG_OP_IND_LEARNER_COURSE_ALL_ASSESSMENTS_PERF: result = getIndependentLearnerCourseAssessmentsPerf(); break; case MessageConstants.MSG_OP_IND_LEARNER_TAX_SUBJECTS: result = getIndependentLearnerTaxSubjects(); break; case MessageConstants.MSG_OP_IND_LEARNER_COLLECTION_SUMMARY: result = getIndependentLearnerSummaryInCollection(); break; case MessageConstants.MSG_OP_IND_LEARNER_ASSESSMENT_SUMMARY: result = getIndependentLearnerSummaryInAssessment(); break; case MessageConstants.MSG_OP_IND_LEARNER_ALL_ASSESSMENT_SESSIONS: result = getIndependentLearnerAssessmentSessions(); break; case MessageConstants.MSG_OP_IND_LEARNER_ALL_COLLECTION_SESSIONS: result = getIndependentLearnerCollectionSessions(); break; // Rubric Grading case MessageConstants.MSG_OP_RUBRICS_QUESTIONS_TO_GRADE: result = getRubricQuestionsToGrade(); break; case MessageConstants.MSG_OP_RUBRIC_QUESTIONS_STUDENTS_LIST: result = getStudentsForRubricQue(); break; case MessageConstants.MSG_OP_RUBRIC_QUESTIONS_STUDENT_ANSWERS: result = getStudAnswersForRubricQue(); break; case MessageConstants.MSG_OP_RUBRIC_QUESTIONS_GRADE_SUMMARY: result = getRubricSummaryforQue(); break; // DCA case MessageConstants.MSG_OP_STUDENT_PERF_DAILY_CLASS_ACTIVITY: result = getStudentPerfDailyClassActivity(); break; case MessageConstants.MSG_OP_DCA_STUDENT_COLLECTION_SUMMARY: result = getStudentSummaryInDCACollection(); break; case MessageConstants.MSG_OP_DCA_STUDENT_ASSESSMENT_SUMMARY: result = getStudentSummaryInDCAAssessment(); break; case MessageConstants.MSG_OP_DCA_SESSION_TAXONOMY_REPORT: result = getDCASessionTaxonomyReport(); break; case MessageConstants.MSG_OP_DCA_STUDENT_ASSESSMENT_PERF: result = getStudentPerfInDCAAssessment(); break; case MessageConstants.MSG_OP_DCA_STUDENT_COLLECTION_PERF: result = getStudentPerfInDCACollection(); break; case MessageConstants.MSG_OP_DCA_STUDENT_ASSESSMENT_ALL_SESSIONS: result = getStudDCAAssessmentSessions(); break; case MessageConstants.MSG_OP_DCA_CLASS_PERF: result = getDCAClassPerf(); break; case MessageConstants.MSG_OP_DCA_ALL_CLASSES_PERF: result = getDCAAllClassesPerf(); break; case MessageConstants.MSG_OP_NU_DATA_REPORT: result = getDataReports(); break; case MessageConstants.MSG_OP_NU_COURSES_COMPETENCY_COMPLETION: result = getCoursesCompetencyCompletion(); break; case MessageConstants.MSG_OP_STUDENT_PERF_DAILY_TIMELY_CLASS_ACTIVITY: result = getDCATeacherReport(); break; // ATC case MessageConstants.MSG_OP_STUDENTS_PERF_VS_COMPLETION: result = getStudentPerfVsCompletionReport(); break; case MessageConstants.MSG_OP_STUDENTS_COURSE_ALL_ITEMS_PERF: result = getStudentCourseAllItemsReport(); break; case MessageConstants.MSG_OP_IND_LEARNER_COURSE_ALL_ITEMS_PERF: result = getIndependentLearnerCourseAllItemsReport(); break; case MessageConstants.MSG_OP_DCA_CLASS_SUMMARY_MONTHLY: result = getDCAMonthlyClassSummaryHandler(); break; case MessageConstants.MSG_OP_DCA_CLASS_SUMMARY_FOR_MONTH: result = getDCAClassSummaryForMonthHandler(); break; case MessageConstants.MSG_OP_DCA_CLASS_USER_SUMMARY_FOR_MONTH: result = getDCAActivityAllStudentSummaryReportHandler(); break; case MessageConstants.MSG_OP_CA_STUDENT_ASSESSMENT_SESSION_PERF: result = getCAAssessmentSessionPerfReportHandler(); break; case MessageConstants.MSG_OP_CA_STUDENT_COLLECTION_SESSION_PERF: result = getCACollectionSessionPerfReportHandler(); break; // MILESTONE case MessageConstants.MSG_OP_STUDENT_MILESTONE_LESSON_PERF: result = getStudentMilestoneLessonPerformanceHandler(); break; case MessageConstants.MSG_OP_STUDENT_MILESTONE_PERF: result = getStudentMilestonePerformanceHandler(); break; // MILESTONE - Independent Learner case MessageConstants.MSG_OP_IND_LEARNER_MILESTONE_LESSON_PERF: result = getILMilestoneLessonPerformanceHandler(); break; case MessageConstants.MSG_OP_IND_LEARNER_MILESTONE_PERF: result = getILMilestonePerformanceHandler(); break; case MessageConstants.MSG_OP_INTERNAL_ALL_STUDENT_CLASSES_PERF: result = getAllClassPerfInternal(); break; case MessageConstants.MSG_OP_INTERNAL_DCA_ALL_CLASSES_PERF: result = getDCAAllClassesPerfInternal(); break; // DCA Rubric Grading case MessageConstants.MSG_OP_DCA_RUBRICS_QUESTIONS_TO_GRADE: result = getDCARubricQuestionsToGrade(); break; case MessageConstants.MSG_OP_DCA_RUBRIC_QUESTIONS_STUDENTS_LIST: result = getDCAStudentsForRubricQue(); break; case MessageConstants.MSG_OP_DCA_RUBRIC_QUESTIONS_STUDENT_ANSWERS: result = getDCAStudAnswersForRubricQue(); break; case MessageConstants.MSG_OP_DCA_RUBRIC_QUESTIONS_GRADE_SUMMARY: result = getDCARubricSummaryforQue(); break; // DCA OA Grading case MessageConstants.MSG_OP_ITEMS_TO_GRADE: result = getOAsToGrade(); break; case MessageConstants.MSG_OP_ITEMS_TO_GRADE_STUDENTS_LIST: result = getStudentsToGradeForOA(); break; case MessageConstants.MSG_OP_DCA_OA_STUDENT_SUBMISSIONS: result = getDCAStudentSubmissionsForOA(); break; case MessageConstants.MSG_OP_DCA_OA_COMPLETE_BY_STUDENT_LIST: result = getDCAOACompleteMarkedByStudents(); break; case MessageConstants.MSG_OP_CM_OA_STUDENT_SUBMISSIONS: result = getStudentSubmissionsOfOA(); break; case MessageConstants.MSG_OP_CM_OA_COMPLETE_BY_STUDENT_LIST: result = getOACompleteMarkedByStudents(); break; default: LOGGER.error("Invalid operation type passed in, not able to handle"); return MessageResponseFactory .createInvalidRequestResponse(RESOURCE_BUNDLE.getString("invalid.operation")); } return result; } catch (Throwable e) { LOGGER.error("Unhandled exception in processing", e); return MessageResponseFactory.createInternalErrorResponse(); } } // ************ DAILY CLASS ACTIVITY // ****************************************************************************************** private MessageResponse getStudentPerfDailyClassActivity() { try { ProcessorContext context = createContext(); if (!checkRequest(context)) { LOGGER.error("Invalid request received to fetch Student Performance in class"); return MessageResponseFactory.createInvalidRequestResponse("Invalid request"); } if (!checkCollectionType(context)) { LOGGER.error("collectionType not available or invalid to obtain Student Perf. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid collectionType"); } if (checkIfCollectionTypeIsOa(context)) { return new RepoBuilder().buildReportRepo(context).getDCAStudOAPerformance(); } else { return new RepoBuilder().buildReportRepo(context).getStudPerfDailyClassActivity(); } } catch (Throwable t) { LOGGER.error("Exception while getting Student Performance in Daily Class Activity.", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentSummaryInDCACollection() { try { ProcessorContext context = createContext(); if (!checkCollectionId(context)) { LOGGER.error("Collection id not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid collectionId"); } if (!validateUser(context.userIdFromSession())) { LOGGER.error("Invalid User ID. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid userId"); } return new RepoBuilder().buildReportRepo(context).getStudentSummaryInDCACollection(); } catch (Throwable t) { LOGGER.error("Exception while getting Student DCA Collection Summary Report", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentSummaryInDCAAssessment() { try { ProcessorContext context = createContext(); if (!checkCollectionId(context)) { LOGGER.error("Collection id not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid collectionId"); } if (!validateUser(context.userIdFromSession())) { LOGGER.error("Invalid User ID. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid userId"); } return new RepoBuilder().buildReportRepo(context).getStudentSummaryInDCAAssessment(); } catch (Throwable t) { LOGGER.error("Exception while getting Student DCA Assessment Summary Report", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getDCASessionTaxonomyReport() { try { ProcessorContext context = createContext(); if (!checkSessionId(context)) { LOGGER.error("Session id not available in the request. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid sessionId"); } return new RepoBuilder().buildReportRepo(context).getDCASessionTaxonomyReport(); } catch (Throwable t) { LOGGER.error("Exception while getting Student DCA Session Taxonomy Report", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getDCATeacherReport() { try { ProcessorContext context = createContext(); if (!checkClassId(context)) { LOGGER.error("Class id not available to obtain Weekly/Monthly DCA Report. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid classId"); } return new RepoBuilder().buildReportRepo(context).getDCAMonthlyTeacherReport(); } catch (Throwable t) { LOGGER.error("Exception while getting Weekly/Monthly DCA Report", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentPerfInDCAAssessment() { try { ProcessorContext context = createContext(); if (!checkClassId(context)) { LOGGER .error("Class id not available to obtain Student DCA Assessment Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid classId"); } if (!checkCollectionId(context)) { LOGGER.error( "AssessmentId not available to obtain Student DCA Assessment Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid assessmentId"); } return new RepoBuilder().buildReportRepo(context).getStudentPerformanceInDCAAssessment(); } catch (Throwable t) { LOGGER.error("Exception while getting Student performance in a DCA Assessment", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentPerfInDCACollection() { try { ProcessorContext context = createContext(); if (!checkClassId(context)) { LOGGER .error("Class id not available to obtain Student DCA Collection Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid classId"); } if (!checkCollectionId(context)) { LOGGER.error( "CollectionId not available to obtain Student DCA Collection Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid collectionId"); } return new RepoBuilder().buildReportRepo(context).getStudentPerformanceInDCACollection(); } catch (Throwable t) { LOGGER.error("Exception while getting Student performance in a DCA Collection", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudDCAAssessmentSessions() { try { ProcessorContext context = createContext(); if (!checkCollectionId(context)) { LOGGER.error("Collection id not available to obtain User Sessions. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid collectionId"); } return new RepoBuilder().buildReportRepo(context).getStudentDCAAssessmentSessions(); } catch (Throwable t) { LOGGER.error("Exception while getting User Sessions for Assessment", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getDCAClassPerf() { try { ProcessorContext context = createContext(); if (!checkClassId(context)) { LOGGER.error("Class id not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid classId"); } return new RepoBuilder().buildReportRepo(context).getDCAClassPerformance(); } catch (Throwable t) { LOGGER.error("Exception while getting DCA Class Performance", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getDCAAllClassesPerf() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getDCAAllClassesPerformance(); } catch (Throwable t) { LOGGER.error("Exception while getting DCA Class Performance", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } // ************************************************************************************************************************* private MessageResponse getDataReports() { try { ProcessorContext context = createContext(); LOGGER.info("classId : {}", context.classId()); LOGGER.info("userId : {}", context.getUserIdFromRequest()); LOGGER.info("startDate : {}", context.startDate()); LOGGER.info("endDate : {}", context.endDate()); if (!checkClassId(context)) { LOGGER.error("ClassId not available to obtain NU data reports. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid ClassId"); } if (!validateUser(context.userIdFromSession())) { LOGGER.error("Invalid User ID. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid UserId"); } if (!FieldValidator.validateDate(context.startDate())) { LOGGER.error("Invalid start date. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid startDate"); } if (!FieldValidator.validateDate(context.endDate())) { LOGGER.error("Invalid end date. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid endDate"); } return new RepoBuilder().buildReportRepo(context).getDataReports(); } catch (Throwable t) { LOGGER.error("Exception while getting NU data reports", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getCoursesCompetencyCompletion() { try { ProcessorContext context = createContext(); LOGGER.info("userId : {}", context.getUserIdFromRequest()); if (!validateUser(context.getUserIdFromRequest())) { LOGGER.error("Invalid User ID. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid UserId"); } return new RepoBuilder().buildReportRepo(context).getCoursesComptencyCompletion(); } catch (Throwable t) { LOGGER.error("Exception while getting course competency completion", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } // ************ RUBRIC GRADING // ****************************************************************************************** private MessageResponse getRubricQuestionsToGrade() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getRubricQuesToGrade(); } catch (Throwable t) { LOGGER.error("Exception while getting Questions pending Grading", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentsForRubricQue() { try { ProcessorContext context = createContext(); if (!checkQuestionId(context)) { LOGGER.error("QuestionId not available to obtain Student Ids. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid QuestionId"); } return new RepoBuilder().buildReportRepo(context).getStudentsForRubricQuestion(); } catch (Throwable t) { LOGGER.error("Exception while getting Student List for Rubric Grading", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudAnswersForRubricQue() { try { ProcessorContext context = createContext(); if (!checkQuestionId(context)) { LOGGER.error("QuestionId not available to obtain answers. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid QuestionId"); } if (!checkStudentId(context)) { LOGGER.error("StudentId not available to obtain answers. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid StudentId"); } return new RepoBuilder().buildReportRepo(context).getStudentAnswersForRubricQuestion(); } catch (Throwable t) { LOGGER.error("Exception while getting Student answers for Rubric Grading", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getRubricSummaryforQue() { try { ProcessorContext context = createContext(); if (!checkClassId(context)) { LOGGER.error("ClassId not available to obtain Student Rubric Question Summary. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid ClassId"); } if (!checkCourseId(context)) { LOGGER.error("Course id not available to obtain Student Rubric Question Summary. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid CourseId"); } if (!checkCollectionId(context)) { LOGGER.error( "Collection id not available to obtain Student Rubric Question Summary. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid collectionId"); } if (!checkQuestionId(context)) { LOGGER.error("QuestionId not available to obtain Rubric Question Summary. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid QuestionId"); } return new RepoBuilder().buildReportRepo(context).getRubricSummaryforQuestion(); } catch (Throwable t) { LOGGER.error("Exception while getting Student answers for Rubric Grading", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } // ************************************************************************************************************** private MessageResponse getStudentPeersInCourse() { try { ProcessorContext context = createContext(); if (!checkClassId(context)) { LOGGER.error("ClassId not available to obtain Student Peers. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid ClassId"); } if (!checkCourseId(context)) { LOGGER.error("Course Id not available to obtain Student Peers. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid CourseId"); } return new RepoBuilder().buildReportRepo(context).getStudentPeersInCourse(); } catch (Throwable t) { LOGGER.error("Exception while getting Student peers in Course", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentPeersInUnit() { try { ProcessorContext context = createContext(); if (!checkClassId(context)) { LOGGER.error("ClassId not available to obtain Student Peers. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid ClassId"); } if (!checkCourseId(context)) { LOGGER.error("Course id not available to obtain Student Peers. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid CourseId"); } if (!checkUnitId(context)) { LOGGER.error("Unit id not available to obtain Student Peers. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid UnitId"); } return new RepoBuilder().buildReportRepo(context).getStudentPeersInUnit(); } catch (Throwable t) { LOGGER.error("Exception while getting Student peers in Unit", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentPeersInLesson() { try { ProcessorContext context = createContext(); if (!checkClassId(context)) { LOGGER.error("ClassId not available to obtain Student Peers. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid ClassId"); } if (!checkCourseId(context)) { LOGGER.error("CourseId not available to obtain Student Peers. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid CourseId"); } if (!checkUnitId(context)) { LOGGER.error("UnitId not available to obtain Student Peers. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid UnitId"); } if (!checkLessonId(context)) { LOGGER.error("LessonId not available to obtain Student Peers. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid LessonId"); } return new RepoBuilder().buildReportRepo(context).getStudentPeersInLesson(); } catch (Throwable t) { LOGGER.error("Exception while getting Student peers in Lesson", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentCurrentLocation() { try { ProcessorContext context = createContext(); if (!checkClassId(context)) { LOGGER.error("ClassId not available to obtain Student Current Location. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid ClassId"); } if (!validateUser(context.userIdFromSession())) { LOGGER.error("Invalid User ID. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid UserId"); } return new RepoBuilder().buildReportRepo(context).getStudentCurrentLocation(); } catch (Throwable t) { LOGGER.error("Exception while getting Student Current Location", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentPerfInCourse() { try { ProcessorContext context = createContext(); if (!checkClassId(context)) { LOGGER.error("ClassId not available to obtain Student Performance. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid ClassId"); } if (!checkCourseId(context)) { LOGGER.error("CourseId not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid CourseId"); } return new RepoBuilder().buildReportRepo(context).getStudentPerformanceInCourse(); } catch (Throwable t) { LOGGER.error("Exception while getting Student performance in Course", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentPerfInUnit() { try { ProcessorContext context = createContext(); if (!checkClassId(context)) { LOGGER.error("ClassId not available to obtain Student Performance. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid ClassId"); } if (!checkCourseId(context)) { LOGGER.error("CourseId not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid CourseId"); } if (!checkUnitId(context)) { LOGGER.error("UnitId not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid UnitId"); } return new RepoBuilder().buildReportRepo(context).getStudentPerformanceInUnit(); } catch (Throwable t) { LOGGER.error("Exception while getting Student performance in Unit", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentPerfInLesson() { try { ProcessorContext context = createContext(); if (!checkClassId(context)) { LOGGER.error("ClassId not available to obtain Student Performance. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid ClassId"); } if (!checkCourseId(context)) { LOGGER.error("CourseId not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid CourseId"); } if (!checkUnitId(context)) { LOGGER.error("UnitId not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid UnitId"); } if (!checkLessonId(context)) { LOGGER.error("LessonId not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid LessonId"); } return new RepoBuilder().buildReportRepo(context).getStudentPerformanceInLesson(); } catch (Throwable t) { LOGGER.error("Exception while getting Student performance in Lesson", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentPerfInAssessment() { try { ProcessorContext context = createContext(); if (!checkClassId(context)) { LOGGER.error("ClassId not available to obtain Student Performance. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid ClassId"); } if (!checkCourseId(context)) { LOGGER.error("CourseId not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid CourseId"); } if (!checkUnitId(context)) { LOGGER.error("UnitId not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid UnitId"); } if (!checkLessonId(context)) { LOGGER.error("LessonId not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid LessonId"); } if (!checkCollectionId(context)) { LOGGER.error("AssessmentId not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid assessmentId"); } return new RepoBuilder().buildReportRepo(context).getStudentPerformanceInAssessment(); } catch (Throwable t) { LOGGER.error("Exception while getting Student performance in an Assessment", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentPerfInCollection() { try { ProcessorContext context = createContext(); if (!checkClassId(context)) { LOGGER.error("ClassId not available to obtain Student Performance. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid ClassId"); } if (!checkCourseId(context)) { LOGGER.error("CourseId not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid CourseId"); } if (!checkUnitId(context)) { LOGGER.error("UnitId not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid UnitId"); } if (!checkLessonId(context)) { LOGGER.error("LessonId not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid LessonId"); } if (!checkCollectionId(context)) { LOGGER.error("CollectionId not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid collectionId"); } return new RepoBuilder().buildReportRepo(context).getStudentPerformanceInCollection(); } catch (Throwable t) { LOGGER.error("Exception while getting Student performance in an Collection", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentSummaryInCollection() { try { ProcessorContext context = createContext(); if (!checkCollectionId(context)) { LOGGER.error("Collection id not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid collectionId"); } if (!validateUser(context.userIdFromSession())) { LOGGER.error("Invalid User ID. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid userId"); } return new RepoBuilder().buildReportRepo(context).getStudentSummaryInCollection(); } catch (Throwable t) { LOGGER.error("Exception while getting Student Collection Summary", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentSummaryInAssessment() { try { ProcessorContext context = createContext(); if (!checkCollectionId(context)) { LOGGER.error("Collection id not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid collectionId"); } if (!validateUser(context.userIdFromSession())) { LOGGER.error("Invalid User ID. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid userId"); } return new RepoBuilder().buildReportRepo(context).getStudentSummaryInAssessment(); } catch (Throwable t) { LOGGER.error("Exception while getting Student Assessment Summary", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getSessionStatus() { try { ProcessorContext context = createContext(); if (!checkSessionId(context)) { LOGGER.error("SessionId not available. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid SessionId"); } if (!checkCollectionId(context)) { LOGGER.error("CollectionId not available to get Session Status. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid CollectionId"); } return new RepoBuilder().buildReportRepo(context).getSessionStatus(); } catch (Throwable t) { LOGGER.error("Exception while getting Student peers in Unit", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getUserAssessmentSessions() { try { ProcessorContext context = createContext(); if (!checkCollectionId(context)) { LOGGER.error("Collection id not available to obtain User Sessions. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid collectionId"); } return new RepoBuilder().buildReportRepo(context).getUserAssessmentSessions(); } catch (Throwable t) { LOGGER.error("Exception while getting User Sessions for Assessment", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getUserCollectionSessions() { try { ProcessorContext context = createContext(); if (!checkCollectionId(context)) { LOGGER.error("Collection id not available to obtain User Sessions. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid collectionId"); } return new RepoBuilder().buildReportRepo(context).getUserCollectionSessions(); } catch (Throwable t) { LOGGER.error("Exception while getting User Sessions for Collection", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getSessionWiseTaxonomyReport() { try { ProcessorContext context = createContext(); if (!checkSessionId(context)) { LOGGER.error("Session id not available in the request. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid sessionId"); } return new RepoBuilder().buildReportRepo(context).getSessionWiseTaxonmyReport(); } catch (Throwable t) { LOGGER.error("Exception while getting Student performance in Unit", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } // =================================User Independent Learning // ===============================================// private MessageResponse getUserIndepedentLearningPerfInCourse() { try { ProcessorContext context = createContext(); if (!checkCourseId(context)) { LOGGER.error("CourseId not available to obtain Learner Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid CourseId"); } return new RepoBuilder().buildReportRepo(context).getLearnerPerformanceInCourse(); } catch (Throwable t) { LOGGER.error("Exception while getting learner performance in Course", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getUserIndepedentLearningPerfInUnit() { try { ProcessorContext context = createContext(); if (!checkCourseId(context)) { LOGGER.error("CourseId not available to obtain Learner Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid CourseId"); } if (!checkUnitId(context)) { LOGGER.error("UnitId not available to obtain Learner Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid UnitId"); } return new RepoBuilder().buildReportRepo(context).getLearnerPerformanceInUnit(); } catch (Throwable t) { LOGGER.error("Exception while getting learner performance in Unit", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getUserIndepedentLearningPerfInLesson() { try { ProcessorContext context = createContext(); if (!checkCourseId(context)) { LOGGER.error("CourseId not available to obtain Learner Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid CourseId"); } if (!checkUnitId(context)) { LOGGER.error("UnitId not available to obtain Learner Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid UnitId"); } if (!checkLessonId(context)) { LOGGER.error("LessonId not available to obtain Learner Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid LessonId"); } return new RepoBuilder().buildReportRepo(context).getLearnerPerformanceInLesson(); } catch (Throwable t) { LOGGER.error("Exception while getting learner performance in Lesson", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getUserIndepedentLearningPerfInAssessment() { try { ProcessorContext context = createContext(); if (!checkCourseId(context)) { LOGGER.error("CourseId not available to obtain Learner Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid CourseId"); } if (!checkUnitId(context)) { LOGGER.error("UnitId not available to obtain Learner Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid UnitId"); } if (!checkLessonId(context)) { LOGGER.error("LessonId not available to obtain Learner Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid LessonId"); } if (!checkCollectionId(context)) { LOGGER.error("AssessmentId not available to obtain Learner Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid assessmentId"); } return new RepoBuilder().buildReportRepo(context).getLearnerPerformanceInAssessment(); } catch (Throwable t) { LOGGER.error("Exception while getting learner performance in assessment", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getUserLearningPerfInIndepedentAssessment() { try { ProcessorContext context = createContext(); if (!checkCollectionId(context)) { LOGGER .error("AssessmentId not available to obtain learner assessment performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid assessmentId"); } return new RepoBuilder().buildReportRepo(context) .getLearnerPerformanceInIndependentAssessment(); } catch (Throwable t) { LOGGER.error("Exception while getting Learner performance in Lesson", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getLearnerCourses() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getLearnerCourses(); } catch (Throwable t) { LOGGER.error("Exception while getting learner courses", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getIndependentLearnerLoc() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getIndependentLearnerLocation(); } catch (Throwable t) { LOGGER.error("Exception while getting Independent Learner Location", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getIndependentLearnerPerf() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getIndependentLearnerPerformance(); } catch (Throwable t) { LOGGER.error("Exception while getting Independent Learner Performance", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getIndependentLearnerCoursesLoc() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getIndLearnerCoursesLocation(); } catch (Throwable t) { LOGGER.error("Exception while getting independent learner courses", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getIndependentLearnerAssessmentsLoc() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getIndLearnerAssessmentsLocation(); } catch (Throwable t) { LOGGER.error("Exception while getting independent learner courses", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getIndependentLearnerCollectionsLoc() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getIndLearnerCollectionsLocation(); } catch (Throwable t) { LOGGER.error("Exception while getting independent learner courses", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getIndependentLearnerAllCoursesPerf() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getIndLearnerAllCoursesPerf(); } catch (Throwable t) { LOGGER.error("Exception while getting independent learner courses", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getIndependentLearnerIndAssessmentsPerf() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getIndLearnerIndAssessmentsPerf(); } catch (Throwable t) { LOGGER.error("Exception while getting independent learner courses", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getIndependentLearnerIndCollectionsPerf() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getIndLearnerIndCollectionsPerf(); } catch (Throwable t) { LOGGER.error("Exception while getting independent learner courses", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } // ---------------------- private MessageResponse getIndependentLearnerCourseCollectionsPerf() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getIndLearnerCourseCollectionsPerf(); } catch (Throwable t) { LOGGER.error("Exception while getting independent learner courses", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getIndependentLearnerCourseAssessmentsPerf() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getIndLearnerCourseAssessmentsPerf(); } catch (Throwable t) { LOGGER.error("Exception while getting independent learner courses", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getIndependentLearnerTaxSubjects() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getIndLearnerTaxSubjects(); } catch (Throwable t) { LOGGER.error("Exception while getting independent learner tax subjects", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getIndependentLearnerSummaryInCollection() { try { ProcessorContext context = createContext(); if (!checkCollectionId(context)) { LOGGER.error( "Collection id not available to obtain Independent Learner Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid collectionId"); } if (!validateUser(context.userIdFromSession())) { LOGGER.error("Invalid User ID. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid userId"); } return new RepoBuilder().buildReportRepo(context).getIndLearnerSummaryInCollection(); } catch (Throwable t) { LOGGER.error("Exception while getting Independent Learner Collection Summary", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getIndependentLearnerSummaryInAssessment() { try { ProcessorContext context = createContext(); if (!checkCollectionId(context)) { LOGGER.error( "Collection id not available to obtain Independent Learner Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid collectionId"); } if (!validateUser(context.userIdFromSession())) { LOGGER.error("Invalid User ID. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid userId"); } return new RepoBuilder().buildReportRepo(context).getIndLearnerSummaryInAssessment(); } catch (Throwable t) { LOGGER.error("Exception while getting Independent Learner Assessment Summary", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getIndependentLearnerAssessmentSessions() { try { ProcessorContext context = createContext(); if (!checkCollectionId(context)) { LOGGER .error("Collection id not available to obtain Independent Learner Sessions. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid collectionId"); } return new RepoBuilder().buildReportRepo(context).getIndLearnerAssessmentSessions(); } catch (Throwable t) { LOGGER.error("Exception while getting Independent Learner Sessions for Assessment", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getIndependentLearnerCollectionSessions() { try { ProcessorContext context = createContext(); if (!checkCollectionId(context)) { LOGGER .error("Collection id not available to obtain Independent Learner Sessions. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid collectionId"); } return new RepoBuilder().buildReportRepo(context).getIndLearnerCollectionSessions(); } catch (Throwable t) { LOGGER.error("Exception while getting Independent Learner Sessions for Collection", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } // ********************************************************************************************************************* private MessageResponse getStudentPerfInAllClasses() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getStudentPerfInAllClasses(); } catch (Throwable t) { LOGGER.error("Exception while getting Student performance in all Classes", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentLocInAllClasses() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getStudentLocationInAllClasses(); } catch (Throwable t) { LOGGER.error("Exception while getting Student Location in all Classes", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentPerfMultipleCollections() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getStudPerfMultipleCollections(); } catch (Throwable t) { LOGGER.error("Exception while getting Student Performance in Multiple Collections", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentPerfCourseAssessments() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getStudPerfCourseAssessments(); } catch (Throwable t) { LOGGER.error("Exception while getting Student Performance in Course Assessments", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentPerfCourseCollections() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getStudPerfCourseCollections(); } catch (Throwable t) { LOGGER.error("Exception while getting Student Performance in Course Collections", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } // ATC private MessageResponse getStudentPerfVsCompletionReport() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getStudentPerfVsCompletion(); } catch (Throwable t) { LOGGER.error("Exception while getting Student Performance Vs Completion Report", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentCourseAllItemsReport() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getStudentCourseAllItemsReport(); } catch (Throwable t) { LOGGER.error("Exception while getting Student Performance of all Items in Class", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getIndependentLearnerCourseAllItemsReport() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getIndependentLearnerCourseAllItemsReport(); } catch (Throwable t) { LOGGER.error("Exception while getting Learner Performance of all Items in Course", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getDCAMonthlyClassSummaryHandler() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getDCAMonthlyClassSummaryHandler(); } catch (Throwable t) { LOGGER.error("Exception while getting getDCAMonthlyClassSummaryHandler", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getDCAClassSummaryForMonthHandler() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getDCAClassSummaryForMonthHandler(); } catch (Throwable t) { LOGGER.error("Exception while getting getDCAClassSummaryForMonthHandler", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getDCAActivityAllStudentSummaryReportHandler() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context) .getDCAActivityAllStudentSummaryReportHandler(); } catch (Throwable t) { LOGGER.error("Exception while getting getDCAActivityAllStudentSummaryReportHandler", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getCAAssessmentSessionPerfReportHandler() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getStudentCAAssessmentSessionPerformance(); } catch (Throwable t) { LOGGER.error("Exception while getting getCAAssessmentSessionPerfReportHandler", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getCACollectionSessionPerfReportHandler() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getStudentCACollectionSessionPerformance(); } catch (Throwable t) { LOGGER.error("Exception while getting getCACollectionSessionPerfReportHandler", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } // MILESTONE // ************************************************************************************************************************** private MessageResponse getStudentMilestoneLessonPerformanceHandler() { try { ProcessorContext context = createContext(); if (!checkClassId(context)) { LOGGER.error("ClassId not available to obtain Student Performance. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid ClassId"); } if (!checkCourseId(context)) { LOGGER.error("CourseId not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid CourseId"); } return new RepoBuilder().buildReportRepo(context).getStudentMilestoneLessonPerfHandler(); } catch (Throwable t) { LOGGER.error("Exception while getting Student performance in Unit", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentMilestonePerformanceHandler() { try { ProcessorContext context = createContext(); if (!checkClassId(context)) { LOGGER.error("ClassId not available to obtain Student Performance. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid ClassId"); } if (!checkCourseId(context)) { LOGGER.error("CourseId not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid CourseId"); } return new RepoBuilder().buildReportRepo(context).getStudentMilestonePerfHandler(); } catch (Throwable t) { LOGGER.error("Exception while getting Student performance in Unit", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } // ******************************************************************************************************************************** // MILESTONE - Independent Learner private MessageResponse getILMilestoneLessonPerformanceHandler() { try { ProcessorContext context = createContext(); if (!checkCourseId(context)) { LOGGER.error("CourseId not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid CourseId"); } return new RepoBuilder().buildReportRepo(context).getILMilestoneLessonPerfHandler(); } catch (Throwable t) { LOGGER.error("Exception while getting Student performance in Unit", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getILMilestonePerformanceHandler() { try { ProcessorContext context = createContext(); if (!checkCourseId(context)) { LOGGER.error("CourseId not available to obtain Student Performance. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid CourseId"); } return new RepoBuilder().buildReportRepo(context).getILMilestonePerfHandler(); } catch (Throwable t) { LOGGER.error("Exception while getting Student performance in Unit", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } // ******************************************************************************************************************************** private MessageResponse getAllClassPerfInternal() { try { ProcessorContext context = createContext(); context.setIsIntenal(true); return new RepoBuilder().buildReportRepo(context).getStudentPerfInAllClasses(); } catch (Throwable t) { LOGGER.error("Exception while getting getClassPerformance", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getDCAAllClassesPerfInternal() { try { ProcessorContext context = createContext(); context.setIsIntenal(true); return new RepoBuilder().buildReportRepo(context).getDCAAllClassesPerformance(); } catch (Throwable t) { LOGGER.error("Exception while getting getClassPerformance", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } // ************ DCA RUBRIC GRADING // ****************************************************************************************** private MessageResponse getDCARubricQuestionsToGrade() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getDCARubricQuesToGrade(); } catch (Throwable t) { LOGGER.error("Exception while getting Questions pending Grading", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getDCAStudentsForRubricQue() { try { ProcessorContext context = createContext(); if (!checkQuestionId(context)) { LOGGER.error("QuestionId not available to obtain Student Ids. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid QuestionId"); } return new RepoBuilder().buildReportRepo(context).getDCAStudentsForRubricQuestion(); } catch (Throwable t) { LOGGER.error("Exception while getting Student List for Rubric Grading", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getDCAStudAnswersForRubricQue() { try { ProcessorContext context = createContext(); if (!checkQuestionId(context)) { LOGGER.error("QuestionId not available to obtain answers. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid QuestionId"); } if (!checkStudentId(context)) { LOGGER.error("StudentId not available to obtain answers. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid StudentId"); } return new RepoBuilder().buildReportRepo(context).getDCAStudentAnswersForRubricQuestion(); } catch (Throwable t) { LOGGER.error("Exception while getting Student answers for Rubric Grading", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getDCARubricSummaryforQue() { try { ProcessorContext context = createContext(); if (!checkClassId(context)) { LOGGER.error("ClassId not available to obtain Student Rubric Question Summary. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid ClassId"); } if (!checkCollectionId(context)) { LOGGER.error( "Collection id not available to obtain Student Rubric Question Summary. Aborting"); return MessageResponseFactory.createInvalidRequestResponse("Invalid collectionId"); } if (!checkQuestionId(context)) { LOGGER.error("QuestionId not available to obtain Rubric Question Summary. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid QuestionId"); } return new RepoBuilder().buildReportRepo(context).getDCARubricSummaryforQuestion(); } catch (Throwable t) { LOGGER.error("Exception while getting Student answers for Rubric Grading", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getOAsToGrade() { try { ProcessorContext context = createContext(); String studentId = context.request().getString(MessageConstants.USER_ID); String type = context.request().getString(MessageConstants.TYPE, MessageConstants.OA); String source = context.request().getString(MessageConstants.SOURCE, MessageConstants.DCA); if(!type.equalsIgnoreCase(MessageConstants.OA) || !MessageConstants.CM_CA_SOURCE_TYPES.matcher(source).matches()) { LOGGER.error("Source or type is invalid. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid type or source"); } if (source.equals(MessageConstants.DCA)) { if (!StringUtil.isNullOrEmpty(studentId)) { return new RepoBuilder().buildReportRepo(context).getDCAOAToSelfGrade(); } else { return new RepoBuilder().buildReportRepo(context).getDCAOAToTeacherGrade(); } } else { if (!StringUtil.isNullOrEmpty(studentId)) { return new RepoBuilder().buildReportRepo(context).getOAToSelfGrade(); } else { return new RepoBuilder().buildReportRepo(context).getOAToTeacherGrade(); } } } catch (Throwable t) { LOGGER.error("Exception while getting OA pending Grading", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentsToGradeForOA() { try { ProcessorContext context = createContext(); if (!checkItemId(context)) { LOGGER.error("oaId not available to obtain grading items. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid ItemId"); } String type = context.request().getString(MessageConstants.TYPE, MessageConstants.OA); String source = context.request().getString(MessageConstants.SOURCE, MessageConstants.DCA); if(!type.equalsIgnoreCase(MessageConstants.OA) || !MessageConstants.CM_CA_SOURCE_TYPES.matcher(source).matches()) { LOGGER.error("Source or type is invalid. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid type or source"); } if (source.equals(MessageConstants.DCA)) { return new RepoBuilder().buildReportRepo(context).getDCAStudentsToGradeForOA(); } else { return new RepoBuilder().buildReportRepo(context).getStudentsToGradeForOA(); } } catch (Throwable t) { LOGGER.error("Exception while getting Student List for OA Grading", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getDCAStudentSubmissionsForOA() { try { ProcessorContext context = createContext(); if (!checkOaId(context)) { LOGGER.error("oaId not available to obtain Student Submissions. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid oaId"); } return new RepoBuilder().buildReportRepo(context).getDCAStudentSubmissionsOfOA(); } catch (Throwable t) { LOGGER.error("Exception while getting Student Submissions for OA Grading", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getDCAOACompleteMarkedByStudents() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getDCAOACompleteMarkedByStudents(); } catch (Throwable t) { LOGGER.error("Exception while getting OA complete student list", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getStudentSubmissionsOfOA() { try { ProcessorContext context = createContext(); if (!checkOaId(context)) { LOGGER.error("oaId not available to obtain CM OA Student Submissions. Aborting!"); return MessageResponseFactory.createInvalidRequestResponse("Invalid oaId"); } return new RepoBuilder().buildReportRepo(context).getStudentSubmissionsOfOA(); } catch (Throwable t) { LOGGER.error("Exception while getting CM OA Student Submissions for OA Grading", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } private MessageResponse getOACompleteMarkedByStudents() { try { ProcessorContext context = createContext(); return new RepoBuilder().buildReportRepo(context).getOACompleteMarkedByStudents(); } catch (Throwable t) { LOGGER.error("Exception while getting CM OA complete student list", t); return MessageResponseFactory.createInternalErrorResponse(t.getMessage()); } } // ************************************************************************************************************** private ProcessorContext createContext() { String classId = message.headers().get(MessageConstants.CLASS_ID); String courseId = message.headers().get(MessageConstants.COURSE_ID); String unitId = message.headers().get(MessageConstants.UNIT_ID); String lessonId = message.headers().get(MessageConstants.LESSON_ID); String collectionId = message.headers().get(MessageConstants.COLLECTION_ID); String milestoneId = message.headers().get(MessageConstants.MILESTONE_ID); /* user id from session */ String userId = (request).getString(MessageConstants._USER_ID); /* user id from api request */ String userUId = (request).getString(MessageConstants.USER_UID); userUId = userUId == null ? (request).getString(MessageConstants.USER_ID) : userUId; String sessionId = message.headers().get(MessageConstants.SESSION_ID); String studentId = message.headers().get(MessageConstants.STUDENT_ID); String questionId = message.headers().get(MessageConstants.QUESTION_ID); String startDate = message.headers().get(MessageConstants.START_DATE); String endDate = message.headers().get(MessageConstants.END_DATE); String collectionType = message.headers().get(MessageConstants.COLLECTION_TYPE); String studId = message.headers().get(MessageConstants.STUDENTID); String oaId = message.headers().get(MessageConstants.OA_ID); String itemId = message.headers().get(MessageConstants.ITEM_ID); return new ProcessorContext(request, userId, userUId, classId, courseId, unitId, lessonId, collectionId, sessionId, studentId, questionId, startDate, endDate, collectionType, milestoneId, studId, oaId, itemId); } // This is just the first level validation. Each Individual Handler would need to do more // validation based on the // handler specific params that are needed for processing. private ExecutionResult<MessageResponse> validateAndInitialize() { if (message == null || !(message.body() instanceof JsonObject)) { LOGGER.error("Invalid message received, either null or body of message is not JsonObject "); return new ExecutionResult<>( MessageResponseFactory .createInvalidRequestResponse(RESOURCE_BUNDLE.getString("invalid.message")), ExecutionResult.ExecutionStatus.FAILED); } /** * userId = ((JsonObject) message.body()).getString(MessageConstants.MSG_USER_ID); if * (!validateUser(userId)) { LOGGER.error("Invalid user id passed. Not authorized."); return new * ExecutionResult<>( * MessageResponseFactory.createForbiddenResponse(RESOURCE_BUNDLE.getString("missing.user")), * ExecutionResult.ExecutionStatus.FAILED); } **/ request = ((JsonObject) message.body()).getJsonObject(MessageConstants.MSG_HTTP_BODY); LOGGER.info(request.toString()); if (request == null) { LOGGER.error("Invalid JSON payload on Message Bus"); return new ExecutionResult<>( MessageResponseFactory .createInvalidRequestResponse(RESOURCE_BUNDLE.getString("invalid.payload")), ExecutionResult.ExecutionStatus.FAILED); } // All is well, continue processing return new ExecutionResult<>(null, ExecutionResult.ExecutionStatus.CONTINUE_PROCESSING); } private boolean checkCollectionId(ProcessorContext context) { return validateId(context.collectionId()); } private boolean checkLessonId(ProcessorContext context) { return validateId(context.lessonId()); } private boolean checkUnitId(ProcessorContext context) { return validateId(context.unitId()); } private boolean checkCourseId(ProcessorContext context) { return validateId(context.courseId()); } private boolean checkClassId(ProcessorContext context) { return validateId(context.classId()); } private boolean checkSessionId(ProcessorContext context) { return validateId(context.sessionId()); } private boolean checkQuestionId(ProcessorContext context) { return validateId(context.questionId()); } private boolean checkStudentId(ProcessorContext context) { return validateId(context.studentId()); } private boolean checkOaId(ProcessorContext context) { return checkIsNotNull(context.oaId()); } private boolean checkItemId(ProcessorContext context) { return checkIsNotNull(context.itemId()); } private boolean checkRequest(ProcessorContext context) { return checkJsonObjIsNotNull(context.request()); } private boolean checkCollectionType(ProcessorContext context) { String collectionType = context.request().getString(MessageConstants.COLLECTION_TYPE); return checkIsNotNull(collectionType) && isValidCollectionType(collectionType); } private boolean checkIfCollectionTypeIsOa(ProcessorContext context) { String collectionType = context.request().getString(MessageConstants.COLLECTION_TYPE); return (collectionType != null && !collectionType.isEmpty() && collectionType.equalsIgnoreCase(JsonConstants.OFFLINE_ACTIVITY)); } private boolean validateUser(String userId) { return !(userId == null || userId.isEmpty() || (userId.equalsIgnoreCase(MessageConstants.MSG_USER_ANONYMOUS)) && validateUuid(userId)); } private boolean validateId(String id) { return !(id == null || id.isEmpty()) && validateUuid(id); } private boolean checkIsNotNull(String id) { return !(id == null || id.isEmpty()); } private boolean checkJsonObjIsNotNull(JsonObject jsonObj) { return !(jsonObj == null || jsonObj.isEmpty()); } private boolean isValidCollectionType(String type) { return JsonConstants.COLLECTION_TYPES.matcher(type).matches(); } private boolean validateUuid(String uuidString) { try { UUID uuid = UUID.fromString(uuidString); return true; } catch (Exception e) { return false; } } }
78,291
0.700144
0.700119
2,037
37.434464
34.335995
133
false
false
0
0
0
0
0
0
0.448699
false
false
13
07523ed922e17837f4080b25d645331351cad931
10,153,302,749,357
e5ba4a33c601e278834b800658969640d458d895
/WebSecurityServer1.0/src/com/pitaya/bookingnow/service/socket/ClientThread.java
cbaeb97248f5a1ae345a76df29a397d2271fd024
[]
no_license
drad944/bookingnow
https://github.com/drad944/bookingnow
a1a0f347463b24cd123070b00518cd50ffd942b1
37640452966806285daf198cd12e184e50d6327a
refs/heads/master
2021-01-23T06:39:19.530000
2013-10-12T09:10:09
2013-10-12T09:10:09
33,586,302
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.pitaya.bookingnow.service.socket; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.net.InetAddress; import java.net.Socket; import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /* * Receive message from connected client and the socket connection is controlled by * such client. */ public class ClientThread extends Thread{ private static Log logger = LogFactory.getLog(ClientThread.class); Socket client_socket; EnhancedMessageService _service; OutputStreamWriter out; BufferedWriter bwriter; BufferedReader in; List<String> messages; private boolean isSending = false; public ClientThread(EnhancedMessageService service, Socket socket){ this.client_socket = socket; this._service = service; this.messages = Collections.synchronizedList(new ArrayList<String>()); } InetAddress getInetAddress(){ if(this.client_socket != null){ return this.client_socket.getInetAddress(); } else { return null; } } int getPort(){ if(this.client_socket != null){ return this.client_socket.getPort(); } else { return -1; } } public void run(){ try{ in = new BufferedReader(new InputStreamReader(client_socket.getInputStream(), "UTF-8")); out = new OutputStreamWriter(client_socket.getOutputStream(), "UTF-8"); bwriter = new BufferedWriter(out); String message = null; this.sendMessage("ready"); while((message = in.readLine()) != null){ logger.debug("Receive message:" + message); this._service.onMessage(message, this); } } catch (Exception e) { e.printStackTrace(); } finally { try { in.close(); out.close(); if(client_socket != null && !client_socket.isClosed()){ client_socket.close(); } } catch (IOException ex) { ex.printStackTrace(); } client_socket = null; logger.debug("Closed by client"); } } void sendMessage(String message){ this.messages.add(message); synchronized(this){ if(this.isSending == true){ return; } else { this.isSending = true; } } while(this.messages.size() > 0){ String msg = this.messages.get(0); try { bwriter.write(msg + "\r\n"); bwriter.flush(); this.messages.remove(0); } catch (IOException e) { e.printStackTrace(); logger.error("Fail to send message."); break; } } /* Notice!!! It's unsafe to add any codes without sync here. Because during the * logic, it's possible that a new thread is asking send message, so it won't be * sent until next time because isSending still true. */ synchronized(this){ this.isSending = false; } } void shutdown(String message){ if(message != null){ this.sendMessage(message); } try { in.close(); } catch (IOException e) { e.printStackTrace(); } try { bwriter.close(); } catch (IOException e) { e.printStackTrace(); } try{ if(client_socket != null && !client_socket.isClosed()){ client_socket.close(); } } catch (IOException e) { e.printStackTrace(); } } }
UTF-8
Java
3,415
java
ClientThread.java
Java
[]
null
[]
package com.pitaya.bookingnow.service.socket; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.net.InetAddress; import java.net.Socket; import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; /* * Receive message from connected client and the socket connection is controlled by * such client. */ public class ClientThread extends Thread{ private static Log logger = LogFactory.getLog(ClientThread.class); Socket client_socket; EnhancedMessageService _service; OutputStreamWriter out; BufferedWriter bwriter; BufferedReader in; List<String> messages; private boolean isSending = false; public ClientThread(EnhancedMessageService service, Socket socket){ this.client_socket = socket; this._service = service; this.messages = Collections.synchronizedList(new ArrayList<String>()); } InetAddress getInetAddress(){ if(this.client_socket != null){ return this.client_socket.getInetAddress(); } else { return null; } } int getPort(){ if(this.client_socket != null){ return this.client_socket.getPort(); } else { return -1; } } public void run(){ try{ in = new BufferedReader(new InputStreamReader(client_socket.getInputStream(), "UTF-8")); out = new OutputStreamWriter(client_socket.getOutputStream(), "UTF-8"); bwriter = new BufferedWriter(out); String message = null; this.sendMessage("ready"); while((message = in.readLine()) != null){ logger.debug("Receive message:" + message); this._service.onMessage(message, this); } } catch (Exception e) { e.printStackTrace(); } finally { try { in.close(); out.close(); if(client_socket != null && !client_socket.isClosed()){ client_socket.close(); } } catch (IOException ex) { ex.printStackTrace(); } client_socket = null; logger.debug("Closed by client"); } } void sendMessage(String message){ this.messages.add(message); synchronized(this){ if(this.isSending == true){ return; } else { this.isSending = true; } } while(this.messages.size() > 0){ String msg = this.messages.get(0); try { bwriter.write(msg + "\r\n"); bwriter.flush(); this.messages.remove(0); } catch (IOException e) { e.printStackTrace(); logger.error("Fail to send message."); break; } } /* Notice!!! It's unsafe to add any codes without sync here. Because during the * logic, it's possible that a new thread is asking send message, so it won't be * sent until next time because isSending still true. */ synchronized(this){ this.isSending = false; } } void shutdown(String message){ if(message != null){ this.sendMessage(message); } try { in.close(); } catch (IOException e) { e.printStackTrace(); } try { bwriter.close(); } catch (IOException e) { e.printStackTrace(); } try{ if(client_socket != null && !client_socket.isClosed()){ client_socket.close(); } } catch (IOException e) { e.printStackTrace(); } } }
3,415
0.641581
0.639824
135
23.281481
20.033176
91
false
false
0
0
0
0
0
0
2.422222
false
false
13
293e527f2c785bc2528ba0a6df5436b32a638522
15,144,054,729,174
ede7b4897be382cfcbc646e45716ae70591cf8f9
/Ch6/src/Test2.java
fddf6d3f4dd9f327f6a2a3f8cabf9ef6490c6acb
[]
no_license
laurajshi/data-structures
https://github.com/laurajshi/data-structures
b98117c544ada21531881c717bda34ac9aa7f770
01dc0e260437edeb8ca5f67186667532fddceba6
refs/heads/main
2023-02-15T05:29:52.573000
2021-01-06T05:51:31
2021-01-06T05:51:31
327,211,998
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Created by laurashi on 11/7/17. */ public class Test2 { public static void main (String [] args) { /* for (int i = 4; i>=1; i--) { for (int j= 4-i+1; j>=1; j--) System.out.print(i); System.out.println(); } */ /* for (int i =1; i <= 4; i++) { for (int j= 1; j<=i; j++) System.out.print(4-i+1); System.out.println(); } */ for (int i =1; i <= 4; i++) { for (int j= 4; j>=4- i + 1; j--) System.out.print(4-i+1); System.out.println(); } } }
UTF-8
Java
682
java
Test2.java
Java
[ { "context": "/**\n * Created by laurashi on 11/7/17.\n */\npublic class Test2\n{\n public s", "end": 26, "score": 0.9567708969116211, "start": 18, "tag": "NAME", "value": "laurashi" } ]
null
[]
/** * Created by laurashi on 11/7/17. */ public class Test2 { public static void main (String [] args) { /* for (int i = 4; i>=1; i--) { for (int j= 4-i+1; j>=1; j--) System.out.print(i); System.out.println(); } */ /* for (int i =1; i <= 4; i++) { for (int j= 1; j<=i; j++) System.out.print(4-i+1); System.out.println(); } */ for (int i =1; i <= 4; i++) { for (int j= 4; j>=4- i + 1; j--) System.out.print(4-i+1); System.out.println(); } } }
682
0.347507
0.313783
33
19.666666
15.534257
44
false
false
0
0
0
0
0
0
0.545455
false
false
13
4ab0ad869d9de7313ecbc895135e13ce27f35613
14,963,666,113,279
d4285021a4ed9728a9f0348e9a856efb92869903
/src/main/java/com/springboot/model/response/Fifa17Player.java
0db59ed1ec9963cf769266ccb43a0a79c45395ba
[]
no_license
vijaykiran225/fifa-server
https://github.com/vijaykiran225/fifa-server
95bf71783b16225b9404d32e30be1f6a2a5b1a63
966326c78447494f5beae1e8134c40c7f47579e2
refs/heads/master
2020-03-27T21:02:37.084000
2018-12-02T17:23:42
2018-12-02T17:23:42
147,111,264
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.springboot.model.response; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import org.springframework.web.bind.annotation.ResponseBody; @ResponseBody @JsonInclude(JsonInclude.Include.NON_NULL) public class Fifa17Player { @JsonProperty("name") private String name; @JsonProperty("nationality") private String nationality; @JsonProperty("national_position") private String nationalPosition; @JsonProperty("national_kit") private Long nationalKit; @JsonProperty("club") private String club; @JsonProperty("club_position") private String clubPosition; @JsonProperty("club_kit") private Long clubKit; @JsonProperty("club_joining") private String clubJoining; @JsonProperty("contract_expiry") private String contractExpiry; @JsonProperty("rating") private String rating; @JsonProperty("height") private String height; @JsonProperty("weight") private String weight; @JsonProperty("preffered_foot") private String prefferedFoot; @JsonProperty("birth_date") private String birthDate; @JsonProperty("age") private String age; @JsonProperty("preffered_position") private String prefferedPosition; @JsonProperty("work_rate") private String workRate; @JsonProperty("weak_foot") private String weakFoot; @JsonProperty("skill_moves") private String skillMoves; @JsonProperty("ball_control") private String ballControl; @JsonProperty("dribbling") private String dribbling; @JsonProperty("marking") private String marking; @JsonProperty("sliding_tackle") private String slidingTackle; @JsonProperty("standing_tackle") private String standingTackle; @JsonProperty("aggression") private String aggression; @JsonProperty("reactions") private String reactions; @JsonProperty("attacking_position") private String attackingPosition; @JsonProperty("interceptions") private String interceptions; @JsonProperty("vision") private String vision; @JsonProperty("composure") private String composure; @JsonProperty("crossing") private String crossing; @JsonProperty("short_pass") private String shortPass; @JsonProperty("long_pass") private String longPass; @JsonProperty("acceleration") private String acceleration; @JsonProperty("speed") private String speed; @JsonProperty("stamina") private String stamina; @JsonProperty("strength") private String strength; @JsonProperty("balance") private String balance; @JsonProperty("agility") private String agility; @JsonProperty("jumping") private String jumping; @JsonProperty("heading") private String heading; @JsonProperty("shot_power") private String shotPower; @JsonProperty("finishing") private String finishing; @JsonProperty("long_shots") private String longShots; @JsonProperty("curve") private String curve; @JsonProperty("freekick_accuracy") private String freekickAccuracy; @JsonProperty("penalties") private String penalties; @JsonProperty("volleys") private String volleys; @JsonProperty("gk_positioning") private String gkPositioning; @JsonProperty("gk_diving") private String gkDiving; @JsonProperty("gk_kicking") private String gkKicking; @JsonProperty("gk_handling") private String gkHandling; @JsonProperty("GK_reflexes") private String GKReflexes; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getNationality() { return nationality; } public void setNationality(String nationality) { this.nationality = nationality; } public String getNationalPosition() { return nationalPosition; } public void setNationalPosition(String nationalPosition) { this.nationalPosition = nationalPosition; } public Long getNationalKit() { return nationalKit; } public void setNationalKit(Long nationalKit) { this.nationalKit = nationalKit; } public String getClub() { return club; } public void setClub(String club) { this.club = club; } public String getClubPosition() { return clubPosition; } public void setClubPosition(String clubPosition) { this.clubPosition = clubPosition; } public Long getClubKit() { return clubKit; } public void setClubKit(Long clubKit) { this.clubKit = clubKit; } public String getClubJoining() { return clubJoining; } public void setClubJoining(String clubJoining) { this.clubJoining = clubJoining; } public String getContractExpiry() { return contractExpiry; } public void setContractExpiry(String contractExpiry) { this.contractExpiry = contractExpiry; } public String getRating() { return rating; } public void setRating(String rating) { this.rating = rating; } public String getHeight() { return height; } public void setHeight(String height) { this.height = height; } public String getWeight() { return weight; } public void setWeight(String weight) { this.weight = weight; } public String getPrefferedFoot() { return prefferedFoot; } public void setPrefferedFoot(String prefferedFoot) { this.prefferedFoot = prefferedFoot; } public String getBirthDate() { return birthDate; } public void setBirthDate(String birthDate) { this.birthDate = birthDate; } public String getAge() { return age; } public void setAge(String age) { this.age = age; } public String getPrefferedPosition() { return prefferedPosition; } public void setPrefferedPosition(String prefferedPosition) { this.prefferedPosition = prefferedPosition; } public String getWorkRate() { return workRate; } public void setWorkRate(String workRate) { this.workRate = workRate; } public String getWeakFoot() { return weakFoot; } public void setWeakFoot(String weakFoot) { this.weakFoot = weakFoot; } public String getSkillMoves() { return skillMoves; } public void setSkillMoves(String skillMoves) { this.skillMoves = skillMoves; } public String getBallControl() { return ballControl; } public void setBallControl(String ballControl) { this.ballControl = ballControl; } public String getDribbling() { return dribbling; } public void setDribbling(String dribbling) { this.dribbling = dribbling; } public String getMarking() { return marking; } public void setMarking(String marking) { this.marking = marking; } public String getSlidingTackle() { return slidingTackle; } public void setSlidingTackle(String slidingTackle) { this.slidingTackle = slidingTackle; } public String getStandingTackle() { return standingTackle; } public void setStandingTackle(String standingTackle) { this.standingTackle = standingTackle; } public String getAggression() { return aggression; } public void setAggression(String aggression) { this.aggression = aggression; } public String getReactions() { return reactions; } public void setReactions(String reactions) { this.reactions = reactions; } public String getAttackingPosition() { return attackingPosition; } public void setAttackingPosition(String attackingPosition) { this.attackingPosition = attackingPosition; } public String getInterceptions() { return interceptions; } public void setInterceptions(String interceptions) { this.interceptions = interceptions; } public String getVision() { return vision; } public void setVision(String vision) { this.vision = vision; } public String getComposure() { return composure; } public void setComposure(String composure) { this.composure = composure; } public String getCrossing() { return crossing; } public void setCrossing(String crossing) { this.crossing = crossing; } public String getShortPass() { return shortPass; } public void setShortPass(String shortPass) { this.shortPass = shortPass; } public String getLongPass() { return longPass; } public void setLongPass(String longPass) { this.longPass = longPass; } public String getAcceleration() { return acceleration; } public void setAcceleration(String acceleration) { this.acceleration = acceleration; } public String getSpeed() { return speed; } public void setSpeed(String speed) { this.speed = speed; } public String getStamina() { return stamina; } public void setStamina(String stamina) { this.stamina = stamina; } public String getStrength() { return strength; } public void setStrength(String strength) { this.strength = strength; } public String getBalance() { return balance; } public void setBalance(String balance) { this.balance = balance; } public String getAgility() { return agility; } public void setAgility(String agility) { this.agility = agility; } public String getJumping() { return jumping; } public void setJumping(String jumping) { this.jumping = jumping; } public String getHeading() { return heading; } public void setHeading(String heading) { this.heading = heading; } public String getShotPower() { return shotPower; } public void setShotPower(String shotPower) { this.shotPower = shotPower; } public String getFinishing() { return finishing; } public void setFinishing(String finishing) { this.finishing = finishing; } public String getLongShots() { return longShots; } public void setLongShots(String longShots) { this.longShots = longShots; } public String getCurve() { return curve; } public void setCurve(String curve) { this.curve = curve; } public String getFreekickAccuracy() { return freekickAccuracy; } public void setFreekickAccuracy(String freekickAccuracy) { this.freekickAccuracy = freekickAccuracy; } public String getPenalties() { return penalties; } public void setPenalties(String penalties) { this.penalties = penalties; } public String getVolleys() { return volleys; } public void setVolleys(String volleys) { this.volleys = volleys; } public String getGkPositioning() { return gkPositioning; } public void setGkPositioning(String gkPositioning) { this.gkPositioning = gkPositioning; } public String getGkDiving() { return gkDiving; } public void setGkDiving(String gkDiving) { this.gkDiving = gkDiving; } public String getGkKicking() { return gkKicking; } public void setGkKicking(String gkKicking) { this.gkKicking = gkKicking; } public String getGkHandling() { return gkHandling; } public void setGkHandling(String gkHandling) { this.gkHandling = gkHandling; } public String getGKReflexes() { return GKReflexes; } public void setGKReflexes(String GKReflexes) { this.GKReflexes = GKReflexes; } @Override public String toString() { return "Fifa17Player{" + "name='" + name + '\'' + ", nationality='" + nationality + '\'' + ", nationalPosition='" + nationalPosition + '\'' + ", nationalKit='" + nationalKit + '\'' + ", club='" + club + '\'' + ", clubPosition='" + clubPosition + '\'' + ", clubKit='" + clubKit + '\'' + ", clubJoining='" + clubJoining + '\'' + ", contractExpiry='" + contractExpiry + '\'' + ", rating='" + rating + '\'' + ", height='" + height + '\'' + ", weight='" + weight + '\'' + ", prefferedFoot='" + prefferedFoot + '\'' + ", birthDate='" + birthDate + '\'' + ", age='" + age + '\'' + ", prefferedPosition='" + prefferedPosition + '\'' + ", workRate='" + workRate + '\'' + ", weakFoot='" + weakFoot + '\'' + ", skillMoves='" + skillMoves + '\'' + ", ballControl='" + ballControl + '\'' + ", dribbling='" + dribbling + '\'' + ", marking='" + marking + '\'' + ", slidingTackle='" + slidingTackle + '\'' + ", standingTackle='" + standingTackle + '\'' + ", aggression='" + aggression + '\'' + ", reactions='" + reactions + '\'' + ", attackingPosition='" + attackingPosition + '\'' + ", interceptions='" + interceptions + '\'' + ", vision='" + vision + '\'' + ", composure='" + composure + '\'' + ", crossing='" + crossing + '\'' + ", shortPass='" + shortPass + '\'' + ", longPass='" + longPass + '\'' + ", acceleration='" + acceleration + '\'' + ", speed='" + speed + '\'' + ", stamina='" + stamina + '\'' + ", strength='" + strength + '\'' + ", balance='" + balance + '\'' + ", agility='" + agility + '\'' + ", jumping='" + jumping + '\'' + ", heading='" + heading + '\'' + ", shotPower='" + shotPower + '\'' + ", finishing='" + finishing + '\'' + ", longShots='" + longShots + '\'' + ", curve='" + curve + '\'' + ", freekickAccuracy='" + freekickAccuracy + '\'' + ", penalties='" + penalties + '\'' + ", volleys='" + volleys + '\'' + ", gkPositioning='" + gkPositioning + '\'' + ", gkDiving='" + gkDiving + '\'' + ", gkKicking='" + gkKicking + '\'' + ", gkHandling='" + gkHandling + '\'' + ", GKReflexes='" + GKReflexes + '\'' + '}'; } }
UTF-8
Java
15,149
java
Fifa17Player.java
Java
[]
null
[]
package com.springboot.model.response; import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import org.springframework.web.bind.annotation.ResponseBody; @ResponseBody @JsonInclude(JsonInclude.Include.NON_NULL) public class Fifa17Player { @JsonProperty("name") private String name; @JsonProperty("nationality") private String nationality; @JsonProperty("national_position") private String nationalPosition; @JsonProperty("national_kit") private Long nationalKit; @JsonProperty("club") private String club; @JsonProperty("club_position") private String clubPosition; @JsonProperty("club_kit") private Long clubKit; @JsonProperty("club_joining") private String clubJoining; @JsonProperty("contract_expiry") private String contractExpiry; @JsonProperty("rating") private String rating; @JsonProperty("height") private String height; @JsonProperty("weight") private String weight; @JsonProperty("preffered_foot") private String prefferedFoot; @JsonProperty("birth_date") private String birthDate; @JsonProperty("age") private String age; @JsonProperty("preffered_position") private String prefferedPosition; @JsonProperty("work_rate") private String workRate; @JsonProperty("weak_foot") private String weakFoot; @JsonProperty("skill_moves") private String skillMoves; @JsonProperty("ball_control") private String ballControl; @JsonProperty("dribbling") private String dribbling; @JsonProperty("marking") private String marking; @JsonProperty("sliding_tackle") private String slidingTackle; @JsonProperty("standing_tackle") private String standingTackle; @JsonProperty("aggression") private String aggression; @JsonProperty("reactions") private String reactions; @JsonProperty("attacking_position") private String attackingPosition; @JsonProperty("interceptions") private String interceptions; @JsonProperty("vision") private String vision; @JsonProperty("composure") private String composure; @JsonProperty("crossing") private String crossing; @JsonProperty("short_pass") private String shortPass; @JsonProperty("long_pass") private String longPass; @JsonProperty("acceleration") private String acceleration; @JsonProperty("speed") private String speed; @JsonProperty("stamina") private String stamina; @JsonProperty("strength") private String strength; @JsonProperty("balance") private String balance; @JsonProperty("agility") private String agility; @JsonProperty("jumping") private String jumping; @JsonProperty("heading") private String heading; @JsonProperty("shot_power") private String shotPower; @JsonProperty("finishing") private String finishing; @JsonProperty("long_shots") private String longShots; @JsonProperty("curve") private String curve; @JsonProperty("freekick_accuracy") private String freekickAccuracy; @JsonProperty("penalties") private String penalties; @JsonProperty("volleys") private String volleys; @JsonProperty("gk_positioning") private String gkPositioning; @JsonProperty("gk_diving") private String gkDiving; @JsonProperty("gk_kicking") private String gkKicking; @JsonProperty("gk_handling") private String gkHandling; @JsonProperty("GK_reflexes") private String GKReflexes; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getNationality() { return nationality; } public void setNationality(String nationality) { this.nationality = nationality; } public String getNationalPosition() { return nationalPosition; } public void setNationalPosition(String nationalPosition) { this.nationalPosition = nationalPosition; } public Long getNationalKit() { return nationalKit; } public void setNationalKit(Long nationalKit) { this.nationalKit = nationalKit; } public String getClub() { return club; } public void setClub(String club) { this.club = club; } public String getClubPosition() { return clubPosition; } public void setClubPosition(String clubPosition) { this.clubPosition = clubPosition; } public Long getClubKit() { return clubKit; } public void setClubKit(Long clubKit) { this.clubKit = clubKit; } public String getClubJoining() { return clubJoining; } public void setClubJoining(String clubJoining) { this.clubJoining = clubJoining; } public String getContractExpiry() { return contractExpiry; } public void setContractExpiry(String contractExpiry) { this.contractExpiry = contractExpiry; } public String getRating() { return rating; } public void setRating(String rating) { this.rating = rating; } public String getHeight() { return height; } public void setHeight(String height) { this.height = height; } public String getWeight() { return weight; } public void setWeight(String weight) { this.weight = weight; } public String getPrefferedFoot() { return prefferedFoot; } public void setPrefferedFoot(String prefferedFoot) { this.prefferedFoot = prefferedFoot; } public String getBirthDate() { return birthDate; } public void setBirthDate(String birthDate) { this.birthDate = birthDate; } public String getAge() { return age; } public void setAge(String age) { this.age = age; } public String getPrefferedPosition() { return prefferedPosition; } public void setPrefferedPosition(String prefferedPosition) { this.prefferedPosition = prefferedPosition; } public String getWorkRate() { return workRate; } public void setWorkRate(String workRate) { this.workRate = workRate; } public String getWeakFoot() { return weakFoot; } public void setWeakFoot(String weakFoot) { this.weakFoot = weakFoot; } public String getSkillMoves() { return skillMoves; } public void setSkillMoves(String skillMoves) { this.skillMoves = skillMoves; } public String getBallControl() { return ballControl; } public void setBallControl(String ballControl) { this.ballControl = ballControl; } public String getDribbling() { return dribbling; } public void setDribbling(String dribbling) { this.dribbling = dribbling; } public String getMarking() { return marking; } public void setMarking(String marking) { this.marking = marking; } public String getSlidingTackle() { return slidingTackle; } public void setSlidingTackle(String slidingTackle) { this.slidingTackle = slidingTackle; } public String getStandingTackle() { return standingTackle; } public void setStandingTackle(String standingTackle) { this.standingTackle = standingTackle; } public String getAggression() { return aggression; } public void setAggression(String aggression) { this.aggression = aggression; } public String getReactions() { return reactions; } public void setReactions(String reactions) { this.reactions = reactions; } public String getAttackingPosition() { return attackingPosition; } public void setAttackingPosition(String attackingPosition) { this.attackingPosition = attackingPosition; } public String getInterceptions() { return interceptions; } public void setInterceptions(String interceptions) { this.interceptions = interceptions; } public String getVision() { return vision; } public void setVision(String vision) { this.vision = vision; } public String getComposure() { return composure; } public void setComposure(String composure) { this.composure = composure; } public String getCrossing() { return crossing; } public void setCrossing(String crossing) { this.crossing = crossing; } public String getShortPass() { return shortPass; } public void setShortPass(String shortPass) { this.shortPass = shortPass; } public String getLongPass() { return longPass; } public void setLongPass(String longPass) { this.longPass = longPass; } public String getAcceleration() { return acceleration; } public void setAcceleration(String acceleration) { this.acceleration = acceleration; } public String getSpeed() { return speed; } public void setSpeed(String speed) { this.speed = speed; } public String getStamina() { return stamina; } public void setStamina(String stamina) { this.stamina = stamina; } public String getStrength() { return strength; } public void setStrength(String strength) { this.strength = strength; } public String getBalance() { return balance; } public void setBalance(String balance) { this.balance = balance; } public String getAgility() { return agility; } public void setAgility(String agility) { this.agility = agility; } public String getJumping() { return jumping; } public void setJumping(String jumping) { this.jumping = jumping; } public String getHeading() { return heading; } public void setHeading(String heading) { this.heading = heading; } public String getShotPower() { return shotPower; } public void setShotPower(String shotPower) { this.shotPower = shotPower; } public String getFinishing() { return finishing; } public void setFinishing(String finishing) { this.finishing = finishing; } public String getLongShots() { return longShots; } public void setLongShots(String longShots) { this.longShots = longShots; } public String getCurve() { return curve; } public void setCurve(String curve) { this.curve = curve; } public String getFreekickAccuracy() { return freekickAccuracy; } public void setFreekickAccuracy(String freekickAccuracy) { this.freekickAccuracy = freekickAccuracy; } public String getPenalties() { return penalties; } public void setPenalties(String penalties) { this.penalties = penalties; } public String getVolleys() { return volleys; } public void setVolleys(String volleys) { this.volleys = volleys; } public String getGkPositioning() { return gkPositioning; } public void setGkPositioning(String gkPositioning) { this.gkPositioning = gkPositioning; } public String getGkDiving() { return gkDiving; } public void setGkDiving(String gkDiving) { this.gkDiving = gkDiving; } public String getGkKicking() { return gkKicking; } public void setGkKicking(String gkKicking) { this.gkKicking = gkKicking; } public String getGkHandling() { return gkHandling; } public void setGkHandling(String gkHandling) { this.gkHandling = gkHandling; } public String getGKReflexes() { return GKReflexes; } public void setGKReflexes(String GKReflexes) { this.GKReflexes = GKReflexes; } @Override public String toString() { return "Fifa17Player{" + "name='" + name + '\'' + ", nationality='" + nationality + '\'' + ", nationalPosition='" + nationalPosition + '\'' + ", nationalKit='" + nationalKit + '\'' + ", club='" + club + '\'' + ", clubPosition='" + clubPosition + '\'' + ", clubKit='" + clubKit + '\'' + ", clubJoining='" + clubJoining + '\'' + ", contractExpiry='" + contractExpiry + '\'' + ", rating='" + rating + '\'' + ", height='" + height + '\'' + ", weight='" + weight + '\'' + ", prefferedFoot='" + prefferedFoot + '\'' + ", birthDate='" + birthDate + '\'' + ", age='" + age + '\'' + ", prefferedPosition='" + prefferedPosition + '\'' + ", workRate='" + workRate + '\'' + ", weakFoot='" + weakFoot + '\'' + ", skillMoves='" + skillMoves + '\'' + ", ballControl='" + ballControl + '\'' + ", dribbling='" + dribbling + '\'' + ", marking='" + marking + '\'' + ", slidingTackle='" + slidingTackle + '\'' + ", standingTackle='" + standingTackle + '\'' + ", aggression='" + aggression + '\'' + ", reactions='" + reactions + '\'' + ", attackingPosition='" + attackingPosition + '\'' + ", interceptions='" + interceptions + '\'' + ", vision='" + vision + '\'' + ", composure='" + composure + '\'' + ", crossing='" + crossing + '\'' + ", shortPass='" + shortPass + '\'' + ", longPass='" + longPass + '\'' + ", acceleration='" + acceleration + '\'' + ", speed='" + speed + '\'' + ", stamina='" + stamina + '\'' + ", strength='" + strength + '\'' + ", balance='" + balance + '\'' + ", agility='" + agility + '\'' + ", jumping='" + jumping + '\'' + ", heading='" + heading + '\'' + ", shotPower='" + shotPower + '\'' + ", finishing='" + finishing + '\'' + ", longShots='" + longShots + '\'' + ", curve='" + curve + '\'' + ", freekickAccuracy='" + freekickAccuracy + '\'' + ", penalties='" + penalties + '\'' + ", volleys='" + volleys + '\'' + ", gkPositioning='" + gkPositioning + '\'' + ", gkDiving='" + gkDiving + '\'' + ", gkKicking='" + gkKicking + '\'' + ", gkHandling='" + gkHandling + '\'' + ", GKReflexes='" + GKReflexes + '\'' + '}'; } }
15,149
0.585583
0.585319
652
22.234663
18.99617
68
false
false
0
0
0
0
0
0
0.331288
false
false
13
230b34a7212c28c0c3a67dbcf2dc1026faf6917a
14,963,666,112,557
83f2f979992b5f8d16154f2409e7619eeb1340a3
/telco/churn/java-client/src/main/java/com/hazelcast/platform/demos/telco/churn/MyRestController.java
7ff2e25019e94ff8b5f6d7304fdb3621ccf3e022
[]
no_license
hazelcast/hazelcast-platform-demos
https://github.com/hazelcast/hazelcast-platform-demos
5bf0cc1614a2967376ddb0757c484f535c569327
6c19b5a70fefc790d770a82636bc5581bbde2091
refs/heads/master
2023-08-17T13:53:03.694000
2023-05-23T09:36:56
2023-05-23T09:36:56
226,069,921
35
13
null
false
2023-09-05T22:01:39
2019-12-05T09:56:00
2023-04-20T12:04:32
2023-09-05T22:01:38
36,548
34
14
75
Java
false
false
/* * Copyright (c) 2008-2023, Hazelcast, 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. */ package com.hazelcast.platform.demos.telco.churn; import java.util.List; import java.util.Set; import java.util.TreeSet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.hazelcast.core.HazelcastInstance; import com.hazelcast.jet.datamodel.Tuple3; import com.hazelcast.sql.SqlResult; /** * <p>A controller for vending out REST requests, all of which * are prefixed by "{@code /rest}". So "{@code /rest/one}", * "{@code /rest/two}", "{@code /rest/three}" and so on. * </p> */ @RestController @RequestMapping("/rest") public class MyRestController { private static final Logger LOGGER = LoggerFactory.getLogger(MyRestController.class); @Autowired private HazelcastInstance hazelcastInstance; @Autowired private MyProperties myProperties; /** * <p>Provide a URL for Kubernetes to test the client is alive. * </p> * * @return Any String, doesn't matter, so why not the build timestamp. */ @GetMapping(value = "/k8s") public String k8s() { LOGGER.trace("k8s()"); return myProperties.getBuildTimestamp(); } /** * <p>Return the size of the important maps, also available in Management * Center, except we may not have permissions</p> * * @return */ @GetMapping(value = "/mapSizes", produces = MediaType.APPLICATION_JSON_VALUE) public String mapSizes() { LOGGER.trace("mapSizes()"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("{ \"sizes\": ["); // Alphabetical order, handling security error Set<String> mapNames = new TreeSet<>(MyConstants.IMAP_NAMES); int count = 0; for (String mapName : mapNames) { stringBuilder.append("{ \"name\": \"" + mapName + "\","); try { int size = this.hazelcastInstance.getMap(mapName).size(); stringBuilder.append("\"error\": \"\", \"size\": " + size + " }"); } catch (Exception e) { stringBuilder.append("\"error\": \"" + MyUtils.safeForJsonStr(e.getMessage()) + "\", \"size\": -1 }"); } count++; if (count < mapNames.size()) { stringBuilder.append(", "); } } stringBuilder.append("] }"); return stringBuilder.toString(); } /** * <p>Run an SQL query via REST * </p> * * @param query Already HTML decoded. * @return */ @GetMapping(value = "/sql", produces = MediaType.APPLICATION_JSON_VALUE) public String sql(@RequestParam("query") String query) { LOGGER.info("sql(query '{}')", query); try { SqlResult sqlResult = this.hazelcastInstance.getSql().execute(query); Tuple3<String, String, List<String>> result = MyUtils.prettyPrintSqlResult(sqlResult); // Turn tuple3 into JSON StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("{ "); stringBuilder.append(" \"error\": \"") .append(MyUtils.safeForJsonStr(result.f0())).append("\""); stringBuilder.append(", \"warning\": \"") .append(MyUtils.safeForJsonStr(result.f1())).append("\""); stringBuilder.append(", \"rows\": ["); for (int i = 0; i < result.f2().size(); i++) { if (i > 0) { stringBuilder.append(","); } stringBuilder.append(" \"" + MyUtils.safeForJsonStr(result.f2().get(i)) + "\""); } stringBuilder.append(" ] }"); LOGGER.trace("sql(query '{}') => '{}'", query, stringBuilder); return stringBuilder.toString(); } catch (Exception e) { LOGGER.error(String.format("sql(query '%s')", query), e); return "{ \"error\": \"" + MyUtils.safeForJsonStr(e.getMessage()) + "\"" + ", \"warning\": \"\"" + ", \"rows\" : [] }"; } } }
UTF-8
Java
5,077
java
MyRestController.java
Java
[]
null
[]
/* * Copyright (c) 2008-2023, Hazelcast, 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. */ package com.hazelcast.platform.demos.telco.churn; import java.util.List; import java.util.Set; import java.util.TreeSet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import com.hazelcast.core.HazelcastInstance; import com.hazelcast.jet.datamodel.Tuple3; import com.hazelcast.sql.SqlResult; /** * <p>A controller for vending out REST requests, all of which * are prefixed by "{@code /rest}". So "{@code /rest/one}", * "{@code /rest/two}", "{@code /rest/three}" and so on. * </p> */ @RestController @RequestMapping("/rest") public class MyRestController { private static final Logger LOGGER = LoggerFactory.getLogger(MyRestController.class); @Autowired private HazelcastInstance hazelcastInstance; @Autowired private MyProperties myProperties; /** * <p>Provide a URL for Kubernetes to test the client is alive. * </p> * * @return Any String, doesn't matter, so why not the build timestamp. */ @GetMapping(value = "/k8s") public String k8s() { LOGGER.trace("k8s()"); return myProperties.getBuildTimestamp(); } /** * <p>Return the size of the important maps, also available in Management * Center, except we may not have permissions</p> * * @return */ @GetMapping(value = "/mapSizes", produces = MediaType.APPLICATION_JSON_VALUE) public String mapSizes() { LOGGER.trace("mapSizes()"); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("{ \"sizes\": ["); // Alphabetical order, handling security error Set<String> mapNames = new TreeSet<>(MyConstants.IMAP_NAMES); int count = 0; for (String mapName : mapNames) { stringBuilder.append("{ \"name\": \"" + mapName + "\","); try { int size = this.hazelcastInstance.getMap(mapName).size(); stringBuilder.append("\"error\": \"\", \"size\": " + size + " }"); } catch (Exception e) { stringBuilder.append("\"error\": \"" + MyUtils.safeForJsonStr(e.getMessage()) + "\", \"size\": -1 }"); } count++; if (count < mapNames.size()) { stringBuilder.append(", "); } } stringBuilder.append("] }"); return stringBuilder.toString(); } /** * <p>Run an SQL query via REST * </p> * * @param query Already HTML decoded. * @return */ @GetMapping(value = "/sql", produces = MediaType.APPLICATION_JSON_VALUE) public String sql(@RequestParam("query") String query) { LOGGER.info("sql(query '{}')", query); try { SqlResult sqlResult = this.hazelcastInstance.getSql().execute(query); Tuple3<String, String, List<String>> result = MyUtils.prettyPrintSqlResult(sqlResult); // Turn tuple3 into JSON StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("{ "); stringBuilder.append(" \"error\": \"") .append(MyUtils.safeForJsonStr(result.f0())).append("\""); stringBuilder.append(", \"warning\": \"") .append(MyUtils.safeForJsonStr(result.f1())).append("\""); stringBuilder.append(", \"rows\": ["); for (int i = 0; i < result.f2().size(); i++) { if (i > 0) { stringBuilder.append(","); } stringBuilder.append(" \"" + MyUtils.safeForJsonStr(result.f2().get(i)) + "\""); } stringBuilder.append(" ] }"); LOGGER.trace("sql(query '{}') => '{}'", query, stringBuilder); return stringBuilder.toString(); } catch (Exception e) { LOGGER.error(String.format("sql(query '%s')", query), e); return "{ \"error\": \"" + MyUtils.safeForJsonStr(e.getMessage()) + "\"" + ", \"warning\": \"\"" + ", \"rows\" : [] }"; } } }
5,077
0.595036
0.589521
142
34.753521
26.540743
96
false
false
0
0
0
0
0
0
0.584507
false
false
13
11895412340d6c495e5730316273edd22b259c6d
22,694,607,229,093
481e4aa4ec500f9caebaf354d72dfd39e56511ed
/app/src/main/java/com/ahengling/itsreadingtime/model/BookDao.java
ef5073e1ce692023103f7eb2dbe3ef57de9947c5
[]
no_license
hengling/ItsReadingTime
https://github.com/hengling/ItsReadingTime
e8d7755f6e9dc682acb1f1f132bffcf5de50f12f
0c769284a8b512ed8cb90603628160f90ed658f2
refs/heads/master
2021-04-27T11:01:59.632000
2018-02-25T16:11:48
2018-02-25T16:11:48
122,551,326
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ahengling.itsreadingtime.model; import android.arch.persistence.room.Dao; import android.arch.persistence.room.Delete; import android.arch.persistence.room.Insert; import android.arch.persistence.room.Query; import java.util.List; /** * Created by adolfohengling on 2/22/18. */ @Dao public interface BookDao { @Query("SELECT * FROM book") List<Book> getAll(); @Query("SELECT * FROM book WHERE id = :id") Book getById(Long id); @Insert void insertAll(Book... books); @Delete void delete(Book book); }
UTF-8
Java
555
java
BookDao.java
Java
[ { "context": ".Query;\n\nimport java.util.List;\n\n/**\n * Created by adolfohengling on 2/22/18.\n */\n\n@Dao\npublic interface BookDao {\n", "end": 278, "score": 0.9995340704917908, "start": 264, "tag": "USERNAME", "value": "adolfohengling" } ]
null
[]
package com.ahengling.itsreadingtime.model; import android.arch.persistence.room.Dao; import android.arch.persistence.room.Delete; import android.arch.persistence.room.Insert; import android.arch.persistence.room.Query; import java.util.List; /** * Created by adolfohengling on 2/22/18. */ @Dao public interface BookDao { @Query("SELECT * FROM book") List<Book> getAll(); @Query("SELECT * FROM book WHERE id = :id") Book getById(Long id); @Insert void insertAll(Book... books); @Delete void delete(Book book); }
555
0.700901
0.691892
29
18.137932
17.73118
47
false
false
0
0
0
0
0
0
0.344828
false
false
13
0ee61dadbcbab861dd3dd3eb97738f76871f276a
23,467,701,324,435
aba4fe8fb9f5a32bd86c723343a50c9f75bd14e3
/MergeFileGit/src/com/wangtaoqi/merge/Merge.java
a98f6b3201bce0602919bcd87430672d6600e8b3
[]
no_license
wangtaoqi/MergeFile
https://github.com/wangtaoqi/MergeFile
505ba1deeaed01162f50014942e1460ece3203bc
9f62a541029e6b8ecd2ef0d0875ef57795b2ce56
refs/heads/master
2022-11-25T04:26:54.632000
2019-12-10T15:11:03
2019-12-10T15:11:03
52,443,697
2
0
null
false
2022-11-16T08:59:01
2016-02-24T13:19:33
2019-12-10T15:11:06
2022-11-16T08:58:59
5,598
1
0
4
Java
false
false
/** * */ package com.wangtaoqi.merge; import java.io.File; import java.util.List; /** * @author ็Ž‹ๆท˜ๆฐ” * */ public interface Merge { /** * ๆ–‡ไปถๅˆๅนถ * @param targetfile */ public void mergeFile(File targetfile); /** * ๅˆ›ๅปบไธ€ไธชๆ–ฐๆ–‡ไปถ * ๆ นๆฎ {@link #isCreate()} * @return */ public File createNewFile(); /** * ๆ˜ฏๅฆ้œ€่ฆๅˆ›ๅปบไธ€ไธชๆ–‡ไปถ * @return ่ฟ”ๅ›žtrue ๅˆ›ๅปบ ๅฆๅˆ™่ฟ”ๅ›žfalse` */ public boolean isCreate() ; /** * ่Žทๅพ—ๅˆๅนถๆ–‡ไปถๅˆ—่กจ * @return */ public List<String> getMergeFileList ( ); }
UTF-8
Java
603
java
Merge.java
Java
[ { "context": ".File;\r\nimport java.util.List;\r\n\r\n/**\r\n * @author ็Ž‹ๆท˜ๆฐ”\r\n *\r\n */\r\npublic interface Merge {\r\n\t/**\r\n\t * ๆ–‡ไปถๅˆ", "end": 114, "score": 0.9991227388381958, "start": 111, "tag": "NAME", "value": "็Ž‹ๆท˜ๆฐ”" } ]
null
[]
/** * */ package com.wangtaoqi.merge; import java.io.File; import java.util.List; /** * @author ็Ž‹ๆท˜ๆฐ” * */ public interface Merge { /** * ๆ–‡ไปถๅˆๅนถ * @param targetfile */ public void mergeFile(File targetfile); /** * ๅˆ›ๅปบไธ€ไธชๆ–ฐๆ–‡ไปถ * ๆ นๆฎ {@link #isCreate()} * @return */ public File createNewFile(); /** * ๆ˜ฏๅฆ้œ€่ฆๅˆ›ๅปบไธ€ไธชๆ–‡ไปถ * @return ่ฟ”ๅ›žtrue ๅˆ›ๅปบ ๅฆๅˆ™่ฟ”ๅ›žfalse` */ public boolean isCreate() ; /** * ่Žทๅพ—ๅˆๅนถๆ–‡ไปถๅˆ—่กจ * @return */ public List<String> getMergeFileList ( ); }
603
0.55684
0.55684
37
12.027027
11.965009
42
false
false
0
0
0
0
0
0
0.297297
false
false
13
8ebcc1675a660b164bfee7942cf33d61199db2ab
31,310,311,609,289
0b1fbf3b9b2ba12bf0635634d16717c744b5f216
/deplor-server/src/main/java/net/narusas/tools/deplor/domain/model/Change.java
7b935552956d47a6c3c5d8a8b38d3fea2de8d0ab
[]
no_license
narusas/deplor
https://github.com/narusas/deplor
d7f57743cfa744ffd0e7b5dcef89271676d99379
ca54f677f08762ea830058515763153fcc0da7d2
refs/heads/master
2016-09-09T12:38:41.026000
2015-11-11T02:08:51
2015-11-11T02:08:51
35,586,401
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package net.narusas.tools.deplor.domain.model; 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.Table; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import lombok.ToString; @Entity @Table(name = "changes") @NoArgsConstructor @Getter @Setter @EqualsAndHashCode(of = "id") @ToString(of = "id") public class Change { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) Long id; @JoinColumn(name = "REVISION") Revision revision; @Column String type; @Column String path; @JoinColumn(name = "resource") Resource resource; public Change(Resource resource, String path, String type) { this.resource = resource; this.path = path; this.type = type; } }
UTF-8
Java
970
java
Change.java
Java
[]
null
[]
package net.narusas.tools.deplor.domain.model; 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.Table; import lombok.EqualsAndHashCode; import lombok.Getter; import lombok.NoArgsConstructor; import lombok.Setter; import lombok.ToString; @Entity @Table(name = "changes") @NoArgsConstructor @Getter @Setter @EqualsAndHashCode(of = "id") @ToString(of = "id") public class Change { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) Long id; @JoinColumn(name = "REVISION") Revision revision; @Column String type; @Column String path; @JoinColumn(name = "resource") Resource resource; public Change(Resource resource, String path, String type) { this.resource = resource; this.path = path; this.type = type; } }
970
0.771134
0.771134
49
18.795918
15.43119
61
false
false
0
0
0
0
0
0
1.040816
false
false
13
d233e2ab3d94094301db741a616a094c24bcf223
22,771,916,635,549
1fbb0dd53648fd4e4c354d08952302917c0c7d5f
/foreground/member-oilbank/src/main/java/com/sinochem/crude/trade/member/service/impl/PartnerServiceImpl.java
f06b777779e7ceb44c05b7b79581ca653c212173
[]
no_license
wang-shun/transaction
https://github.com/wang-shun/transaction
2a68d96e4197bbdd71d05f0e6e91b1914e395ebc
8a3bd4af7180d9fbafbb01ab1739702798430441
refs/heads/master
2020-04-04T18:10:33.235000
2018-11-05T02:27:57
2018-11-05T02:27:57
156,152,857
0
1
null
true
2018-11-05T03:03:30
2018-11-05T03:03:29
2018-11-05T02:33:15
2018-11-05T02:32:38
0
0
0
0
null
false
null
package com.sinochem.crude.trade.member.service.impl; import com.github.pagehelper.PageInfo; import com.sinochem.crude.trade.member.dao.PartnerMapper; import com.sinochem.crude.trade.member.domain.Partner; import com.sinochem.crude.trade.member.service.PartnerService; import com.sinochem.it.b2b.common.exception.BizException; import com.sinochem.it.b2b.common.page.PageUtils; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.Date; import java.util.List; @Service public class PartnerServiceImpl implements PartnerService { private static final Logger LOGGER = LoggerFactory.getLogger(PartnerServiceImpl.class); @Autowired private PartnerMapper partnerMapper; @Override public Partner selectByPrimaryKey(Long id) throws BizException { if (id == null) throw new BizException("idไธ่ƒฝไธบ็ฉบ๏ผ"); return this.partnerMapper.selectByPrimaryKey(id); } @Override @Transactional public void insert(Partner partner, Long memberId) throws BizException { validatePartner(partner); Date now = new Date(); partner.setDelFlg(false); partner.setCreater(memberId); partner.setCreateTime(now); partner.setUpdater(memberId); partner.setUpdateTime(now); this.partnerMapper.insert(partner); } @Override public List<Partner> getPartnerList(Partner partner, PageInfo pageInfo) { PageUtils.page(pageInfo); // partner.setDelFlg(false); return this.partnerMapper.selectByPrimary(partner); } @Override @Transactional public void update(Partner partner, Long memberId) throws BizException { if (partner.getId() == null) throw new BizException("idไธ่ƒฝไธบ็ฉบ๏ผ"); partner.setUpdater(memberId); partner.setUpdateTime(new Date()); this.partnerMapper.updateByPrimaryKeySelective(partner); } private void validatePartner(Partner partner) throws BizException { String errorMsg = null; if (StringUtils.isBlank(partner.getName())) errorMsg = "ๅ็งฐไธ่ƒฝไธบ็ฉบ๏ผ"; if (StringUtils.isBlank(partner.getUrl())) errorMsg = "้“พๆŽฅๅœฐๅ€ไธ่ƒฝไธบ็ฉบ๏ผ"; if (StringUtils.isBlank(partner.getType())) errorMsg = "็ฑปๅž‹ไธ่ƒฝไธบ็ฉบ๏ผ"; if (StringUtils.isNotBlank(errorMsg)) throw new BizException(errorMsg); } }
UTF-8
Java
2,583
java
PartnerServiceImpl.java
Java
[]
null
[]
package com.sinochem.crude.trade.member.service.impl; import com.github.pagehelper.PageInfo; import com.sinochem.crude.trade.member.dao.PartnerMapper; import com.sinochem.crude.trade.member.domain.Partner; import com.sinochem.crude.trade.member.service.PartnerService; import com.sinochem.it.b2b.common.exception.BizException; import com.sinochem.it.b2b.common.page.PageUtils; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.Date; import java.util.List; @Service public class PartnerServiceImpl implements PartnerService { private static final Logger LOGGER = LoggerFactory.getLogger(PartnerServiceImpl.class); @Autowired private PartnerMapper partnerMapper; @Override public Partner selectByPrimaryKey(Long id) throws BizException { if (id == null) throw new BizException("idไธ่ƒฝไธบ็ฉบ๏ผ"); return this.partnerMapper.selectByPrimaryKey(id); } @Override @Transactional public void insert(Partner partner, Long memberId) throws BizException { validatePartner(partner); Date now = new Date(); partner.setDelFlg(false); partner.setCreater(memberId); partner.setCreateTime(now); partner.setUpdater(memberId); partner.setUpdateTime(now); this.partnerMapper.insert(partner); } @Override public List<Partner> getPartnerList(Partner partner, PageInfo pageInfo) { PageUtils.page(pageInfo); // partner.setDelFlg(false); return this.partnerMapper.selectByPrimary(partner); } @Override @Transactional public void update(Partner partner, Long memberId) throws BizException { if (partner.getId() == null) throw new BizException("idไธ่ƒฝไธบ็ฉบ๏ผ"); partner.setUpdater(memberId); partner.setUpdateTime(new Date()); this.partnerMapper.updateByPrimaryKeySelective(partner); } private void validatePartner(Partner partner) throws BizException { String errorMsg = null; if (StringUtils.isBlank(partner.getName())) errorMsg = "ๅ็งฐไธ่ƒฝไธบ็ฉบ๏ผ"; if (StringUtils.isBlank(partner.getUrl())) errorMsg = "้“พๆŽฅๅœฐๅ€ไธ่ƒฝไธบ็ฉบ๏ผ"; if (StringUtils.isBlank(partner.getType())) errorMsg = "็ฑปๅž‹ไธ่ƒฝไธบ็ฉบ๏ผ"; if (StringUtils.isNotBlank(errorMsg)) throw new BizException(errorMsg); } }
2,583
0.72944
0.727851
70
34.957142
26.492283
91
false
false
0
0
0
0
0
0
0.6
false
false
13
49554abd6381e1ceb8c28ac7e1b6066f5d3f211b
32,633,161,539,761
a2c60c9a9728c7e383a8f8bf05fda3f95e3f5f94
/USMclient/src/appTemoin1/createArticleUser.java
66f69aa0de909df8443cc1925d4cba0c99d84264
[]
no_license
RomainChatron/USMclient
https://github.com/RomainChatron/USMclient
dc742ed5b70d61ee2d2ab8a6ab4539ed564699ed
f80907647053a282c605d0a9c7bdfcf739b584e9
refs/heads/master
2021-01-01T04:40:03.015000
2016-05-03T04:53:10
2016-05-03T04:53:10
57,467,914
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package appTemoin1; import java.awt.BorderLayout; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import java.awt.Toolkit; import java.awt.Color; import javax.swing.JLabel; import javax.swing.ImageIcon; import javax.swing.JTextField; import java.awt.Font; import javax.swing.JButton; import javax.swing.SwingConstants; import javax.swing.JTextArea; import java.awt.TextArea; import java.awt.Button; import javax.swing.JTextPane; import javax.swing.JComboBox; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.HashMap; import java.awt.event.ItemListener; import java.awt.event.ItemEvent; public class createArticleUser extends JFrame { private JPanel contentPane; private JTextField txtSaisissezVotreTitre; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { //createArticleUser frame = new createArticleUser(); //frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public createArticleUser(HashMap<String, Object> rmi) { setIconImage(Toolkit.getDefaultToolkit().getImage(createArticleUser.class.getResource("/appTemoin1/images/fleches-echange.gif"))); setTitle("Ultimate Sociey Messenger"); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setBounds(100, 100, 662, 772); contentPane = new JPanel(); contentPane.setBackground(new Color(0, 102, 204)); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JLabel label = new JLabel(""); label.setIcon(new ImageIcon(createArticleUser.class.getResource("/appTemoin1/images/48px-Icon-wiki.png"))); label.setBounds(33, 16, 73, 63); contentPane.add(label); JLabel lblNewLabel = new JLabel("Ajouter un nouvelle article"); lblNewLabel.setForeground(Color.WHITE); lblNewLabel.setFont(new Font("Comic Sans MS", Font.PLAIN, 16)); lblNewLabel.setBounds(103, 38, 219, 20); contentPane.add(lblNewLabel); txtSaisissezVotreTitre = new JTextField(); txtSaisissezVotreTitre.setFont(new Font("Comic Sans MS", Font.PLAIN, 18)); txtSaisissezVotreTitre.setText("Saisissez votre titre ici"); txtSaisissezVotreTitre.setBounds(33, 95, 560, 26); contentPane.add(txtSaisissezVotreTitre); txtSaisissezVotreTitre.setColumns(10); JButton btAddFile = new JButton("Ajouter un fichier"); btAddFile.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { SelectFile sf = new SelectFile(rmi); } }); btAddFile.setHorizontalAlignment(SwingConstants.LEFT); btAddFile.setIcon(new ImageIcon(createArticleUser.class.getResource("/appTemoin1/images/image-inserer-icone-7309-48.png"))); btAddFile.setFont(new Font("Comic Sans MS", Font.PLAIN, 16)); btAddFile.setBackground(Color.BLACK); btAddFile.setForeground(Color.WHITE); btAddFile.setBounds(33, 136, 232, 29); contentPane.add(btAddFile); JButton btnNewButton = new JButton("Publier sur mon journal"); btnNewButton.setBackground(Color.BLACK); btnNewButton.setForeground(Color.WHITE); btnNewButton.setFont(new Font("Comic Sans MS", Font.PLAIN, 16)); btnNewButton.setBounds(33, 603, 209, 29); contentPane.add(btnNewButton); JButton btnNewButton_1 = new JButton("Publier sur un groupe"); btnNewButton_1.setForeground(Color.WHITE); btnNewButton_1.setBackground(Color.BLACK); btnNewButton_1.setFont(new Font("Comic Sans MS", Font.PLAIN, 16)); btnNewButton_1.setBounds(257, 603, 193, 29); contentPane.add(btnNewButton_1); JButton btnNewButton_2 = new JButton("Annuler"); btnNewButton_2.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { dispose(); } }); btnNewButton_2.setBackground(Color.BLACK); btnNewButton_2.setForeground(Color.WHITE); btnNewButton_2.setFont(new Font("Comic Sans MS", Font.PLAIN, 16)); btnNewButton_2.setBounds(33, 648, 115, 29); contentPane.add(btnNewButton_2); String[] exemplesGroup = { "Developpement C", "Kepp calm i'm global", "The 100", "Laziness"}; JComboBox cbGroup = new JComboBox(exemplesGroup); cbGroup.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { // ici rรฉcuperer System.out.println("test : " + cbGroup.getSelectedItem()); } }); cbGroup.setBounds(465, 605, 128, 26); contentPane.add(cbGroup); JTextPane txtpnEcrivezUnMessage = new JTextPane(); txtpnEcrivezUnMessage.setText("Ecrivez un message..."); txtpnEcrivezUnMessage.setFont(new Font("Comic Sans MS", Font.PLAIN, 16)); txtpnEcrivezUnMessage.setBounds(33, 181, 560, 392); contentPane.add(txtpnEcrivezUnMessage); } }
WINDOWS-1250
Java
4,975
java
createArticleUser.java
Java
[]
null
[]
package appTemoin1; import java.awt.BorderLayout; import java.awt.EventQueue; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import java.awt.Toolkit; import java.awt.Color; import javax.swing.JLabel; import javax.swing.ImageIcon; import javax.swing.JTextField; import java.awt.Font; import javax.swing.JButton; import javax.swing.SwingConstants; import javax.swing.JTextArea; import java.awt.TextArea; import java.awt.Button; import javax.swing.JTextPane; import javax.swing.JComboBox; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.HashMap; import java.awt.event.ItemListener; import java.awt.event.ItemEvent; public class createArticleUser extends JFrame { private JPanel contentPane; private JTextField txtSaisissezVotreTitre; /** * Launch the application. */ public static void main(String[] args) { EventQueue.invokeLater(new Runnable() { public void run() { try { //createArticleUser frame = new createArticleUser(); //frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); } /** * Create the frame. */ public createArticleUser(HashMap<String, Object> rmi) { setIconImage(Toolkit.getDefaultToolkit().getImage(createArticleUser.class.getResource("/appTemoin1/images/fleches-echange.gif"))); setTitle("Ultimate Sociey Messenger"); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setBounds(100, 100, 662, 772); contentPane = new JPanel(); contentPane.setBackground(new Color(0, 102, 204)); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JLabel label = new JLabel(""); label.setIcon(new ImageIcon(createArticleUser.class.getResource("/appTemoin1/images/48px-Icon-wiki.png"))); label.setBounds(33, 16, 73, 63); contentPane.add(label); JLabel lblNewLabel = new JLabel("Ajouter un nouvelle article"); lblNewLabel.setForeground(Color.WHITE); lblNewLabel.setFont(new Font("Comic Sans MS", Font.PLAIN, 16)); lblNewLabel.setBounds(103, 38, 219, 20); contentPane.add(lblNewLabel); txtSaisissezVotreTitre = new JTextField(); txtSaisissezVotreTitre.setFont(new Font("Comic Sans MS", Font.PLAIN, 18)); txtSaisissezVotreTitre.setText("Saisissez votre titre ici"); txtSaisissezVotreTitre.setBounds(33, 95, 560, 26); contentPane.add(txtSaisissezVotreTitre); txtSaisissezVotreTitre.setColumns(10); JButton btAddFile = new JButton("Ajouter un fichier"); btAddFile.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { SelectFile sf = new SelectFile(rmi); } }); btAddFile.setHorizontalAlignment(SwingConstants.LEFT); btAddFile.setIcon(new ImageIcon(createArticleUser.class.getResource("/appTemoin1/images/image-inserer-icone-7309-48.png"))); btAddFile.setFont(new Font("Comic Sans MS", Font.PLAIN, 16)); btAddFile.setBackground(Color.BLACK); btAddFile.setForeground(Color.WHITE); btAddFile.setBounds(33, 136, 232, 29); contentPane.add(btAddFile); JButton btnNewButton = new JButton("Publier sur mon journal"); btnNewButton.setBackground(Color.BLACK); btnNewButton.setForeground(Color.WHITE); btnNewButton.setFont(new Font("Comic Sans MS", Font.PLAIN, 16)); btnNewButton.setBounds(33, 603, 209, 29); contentPane.add(btnNewButton); JButton btnNewButton_1 = new JButton("Publier sur un groupe"); btnNewButton_1.setForeground(Color.WHITE); btnNewButton_1.setBackground(Color.BLACK); btnNewButton_1.setFont(new Font("Comic Sans MS", Font.PLAIN, 16)); btnNewButton_1.setBounds(257, 603, 193, 29); contentPane.add(btnNewButton_1); JButton btnNewButton_2 = new JButton("Annuler"); btnNewButton_2.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { dispose(); } }); btnNewButton_2.setBackground(Color.BLACK); btnNewButton_2.setForeground(Color.WHITE); btnNewButton_2.setFont(new Font("Comic Sans MS", Font.PLAIN, 16)); btnNewButton_2.setBounds(33, 648, 115, 29); contentPane.add(btnNewButton_2); String[] exemplesGroup = { "Developpement C", "Kepp calm i'm global", "The 100", "Laziness"}; JComboBox cbGroup = new JComboBox(exemplesGroup); cbGroup.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { // ici rรฉcuperer System.out.println("test : " + cbGroup.getSelectedItem()); } }); cbGroup.setBounds(465, 605, 128, 26); contentPane.add(cbGroup); JTextPane txtpnEcrivezUnMessage = new JTextPane(); txtpnEcrivezUnMessage.setText("Ecrivez un message..."); txtpnEcrivezUnMessage.setFont(new Font("Comic Sans MS", Font.PLAIN, 16)); txtpnEcrivezUnMessage.setBounds(33, 181, 560, 392); contentPane.add(txtpnEcrivezUnMessage); } }
4,975
0.722557
0.690792
140
33.528572
24.389824
132
false
false
0
0
0
0
0
0
2.75
false
false
13
bf77420610fb9139216eec32c9603b53b11816e7
30,872,224,946,038
c15fcc27ed4f894079ccaa0566e101f298c160ef
/flyt-admin/src/main/java/com/flyt/web/controller/fwe/FweCollegeController.java
783def3b927c764e4886fdfc976803f89c22c952
[]
no_license
ipv6-git/CERNET_NGII20170505
https://github.com/ipv6-git/CERNET_NGII20170505
70a82e5fd2a71aca61fea3b57fa85b2314adb143
df35f52fe1e6f6bd64ba6b7ba5bed37ab728664a
refs/heads/master
2023-07-31T06:09:54.657000
2021-09-16T03:35:30
2021-09-16T03:35:30
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.flyt.web.controller.fwe; import com.flyt.common.annotation.Log; import com.flyt.common.core.controller.BaseController; import com.flyt.common.core.domain.AjaxResult; import com.flyt.common.core.page.TableDataInfo; import com.flyt.common.enums.BusinessType; import com.flyt.common.utils.poi.ExcelUtil; import com.flyt.framework.util.ShiroUtils; import com.flyt.fwe.domain.FweCollege; import com.flyt.fwe.service.IFweCollegeService; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.*; import java.util.List; /** * ๅญฆ้™ข ไฟกๆฏๆ“ไฝœๅค„็† * * @author Wwang * @date 2019-06-17 */ @Controller @RequestMapping("/fwe/fweCollege") public class FweCollegeController extends BaseController { private String prefix = "fwe/fweCollege"; @Autowired private IFweCollegeService fweCollegeService; @RequiresPermissions("fwe:fweCollege:view") @GetMapping() public String fweCollege() { return prefix + "/fweCollege"; } /** * ๆŸฅ่ฏขๅญฆ้™ขๅˆ—่กจ */ @RequiresPermissions("fwe:fweCollege:list") @PostMapping("/list") @ResponseBody public TableDataInfo list(FweCollege fweCollege) { startPage(); List<FweCollege> list = fweCollegeService.selectFweCollegeList(fweCollege); return getDataTable(list); } /** * ๅฏผๅ‡บๅญฆ้™ขๅˆ—่กจ */ @RequiresPermissions("fwe:fweCollege:export") @PostMapping("/export") @ResponseBody public AjaxResult export(FweCollege fweCollege) { List<FweCollege> list = fweCollegeService.selectFweCollegeList(fweCollege); ExcelUtil<FweCollege> util = new ExcelUtil<FweCollege>(FweCollege.class); return util.exportExcel(list, "fweCollege"); } /** * ๆ–ฐๅขžๅญฆ้™ข */ @GetMapping("/add") public String add() { return prefix + "/add"; } /** * ๆ–ฐๅขžไฟๅญ˜ๅญฆ้™ข */ @RequiresPermissions("fwe:fweCollege:add") @Log(title = "ๅญฆ้™ข", businessType = BusinessType.INSERT) @PostMapping("/add") @ResponseBody public AjaxResult addSave(FweCollege fweCollege) { fweCollege.setCreateBy(ShiroUtils.getLoginName()); fweCollege.setUpdateBy(ShiroUtils.getLoginName()); return toAjax(fweCollegeService.insertFweCollege(fweCollege)); } /** * ไฟฎๆ”นๅญฆ้™ข */ @GetMapping("/edit/{id}") public String edit(@PathVariable("id") Long id, ModelMap mmap) { FweCollege fweCollege = fweCollegeService.selectFweCollegeById(id); mmap.put("fweCollege", fweCollege); return prefix + "/edit"; } /** * ไฟฎๆ”นไฟๅญ˜ๅญฆ้™ข */ @RequiresPermissions("fwe:fweCollege:edit") @Log(title = "ๅญฆ้™ข", businessType = BusinessType.UPDATE) @PostMapping("/edit") @ResponseBody public AjaxResult editSave(FweCollege fweCollege) { fweCollege.setUpdateBy(ShiroUtils.getLoginName()); return toAjax(fweCollegeService.updateFweCollege(fweCollege)); } /** * ๅˆ ้™คๅญฆ้™ข */ @RequiresPermissions("fwe:fweCollege:remove") @Log(title = "ๅญฆ้™ข", businessType = BusinessType.DELETE) @PostMapping( "/remove") @ResponseBody public AjaxResult remove(String ids) { return toAjax(fweCollegeService.deleteFweCollegeByIds(ids)); } }
UTF-8
Java
3,414
java
FweCollegeController.java
Java
[ { "context": "a.util.List;\r\n\r\n/**\r\n * ๅญฆ้™ข ไฟกๆฏๆ“ไฝœๅค„็†\r\n * \r\n * @author Wwang\r\n * @date 2019-06-17\r\n */\r\n@Controller\r\n@RequestM", "end": 793, "score": 0.9970932006835938, "start": 788, "tag": "NAME", "value": "Wwang" } ]
null
[]
package com.flyt.web.controller.fwe; import com.flyt.common.annotation.Log; import com.flyt.common.core.controller.BaseController; import com.flyt.common.core.domain.AjaxResult; import com.flyt.common.core.page.TableDataInfo; import com.flyt.common.enums.BusinessType; import com.flyt.common.utils.poi.ExcelUtil; import com.flyt.framework.util.ShiroUtils; import com.flyt.fwe.domain.FweCollege; import com.flyt.fwe.service.IFweCollegeService; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.*; import java.util.List; /** * ๅญฆ้™ข ไฟกๆฏๆ“ไฝœๅค„็† * * @author Wwang * @date 2019-06-17 */ @Controller @RequestMapping("/fwe/fweCollege") public class FweCollegeController extends BaseController { private String prefix = "fwe/fweCollege"; @Autowired private IFweCollegeService fweCollegeService; @RequiresPermissions("fwe:fweCollege:view") @GetMapping() public String fweCollege() { return prefix + "/fweCollege"; } /** * ๆŸฅ่ฏขๅญฆ้™ขๅˆ—่กจ */ @RequiresPermissions("fwe:fweCollege:list") @PostMapping("/list") @ResponseBody public TableDataInfo list(FweCollege fweCollege) { startPage(); List<FweCollege> list = fweCollegeService.selectFweCollegeList(fweCollege); return getDataTable(list); } /** * ๅฏผๅ‡บๅญฆ้™ขๅˆ—่กจ */ @RequiresPermissions("fwe:fweCollege:export") @PostMapping("/export") @ResponseBody public AjaxResult export(FweCollege fweCollege) { List<FweCollege> list = fweCollegeService.selectFweCollegeList(fweCollege); ExcelUtil<FweCollege> util = new ExcelUtil<FweCollege>(FweCollege.class); return util.exportExcel(list, "fweCollege"); } /** * ๆ–ฐๅขžๅญฆ้™ข */ @GetMapping("/add") public String add() { return prefix + "/add"; } /** * ๆ–ฐๅขžไฟๅญ˜ๅญฆ้™ข */ @RequiresPermissions("fwe:fweCollege:add") @Log(title = "ๅญฆ้™ข", businessType = BusinessType.INSERT) @PostMapping("/add") @ResponseBody public AjaxResult addSave(FweCollege fweCollege) { fweCollege.setCreateBy(ShiroUtils.getLoginName()); fweCollege.setUpdateBy(ShiroUtils.getLoginName()); return toAjax(fweCollegeService.insertFweCollege(fweCollege)); } /** * ไฟฎๆ”นๅญฆ้™ข */ @GetMapping("/edit/{id}") public String edit(@PathVariable("id") Long id, ModelMap mmap) { FweCollege fweCollege = fweCollegeService.selectFweCollegeById(id); mmap.put("fweCollege", fweCollege); return prefix + "/edit"; } /** * ไฟฎๆ”นไฟๅญ˜ๅญฆ้™ข */ @RequiresPermissions("fwe:fweCollege:edit") @Log(title = "ๅญฆ้™ข", businessType = BusinessType.UPDATE) @PostMapping("/edit") @ResponseBody public AjaxResult editSave(FweCollege fweCollege) { fweCollege.setUpdateBy(ShiroUtils.getLoginName()); return toAjax(fweCollegeService.updateFweCollege(fweCollege)); } /** * ๅˆ ้™คๅญฆ้™ข */ @RequiresPermissions("fwe:fweCollege:remove") @Log(title = "ๅญฆ้™ข", businessType = BusinessType.DELETE) @PostMapping( "/remove") @ResponseBody public AjaxResult remove(String ids) { return toAjax(fweCollegeService.deleteFweCollegeByIds(ids)); } }
3,414
0.707604
0.70519
128
23.890625
22.681641
83
false
false
0
0
0
0
0
0
1.117188
false
false
13
9b9fe836529e1cabd81d2c32cb31aac7034bd7d8
22,067,541,993,301
372d2e2de3ad0a2aa0267f2156eb8eb051639f73
/src/main/java/com/glitter/working/properties/spring/security/WorkingSecurityLoginProperty.java
953293c6d371aebd55cb162c0ae0661c37a066de
[]
no_license
BigBigTimberWolf/working
https://github.com/BigBigTimberWolf/working
530f8edb0ea257bb3cec8620249e4393da765370
5ba66dd1bc785aa136e6dd79dabbb59dc69b5182
refs/heads/master
2022-06-23T06:33:24.528000
2019-11-08T08:01:17
2019-11-08T08:01:17
220,417,118
1
0
null
false
2022-06-17T02:37:22
2019-11-08T08:03:36
2019-11-08T09:19:25
2022-06-17T02:37:22
84
1
0
2
Java
false
false
package com.glitter.working.properties.spring.security; import lombok.Data; /** * @program: * @author: Player * @create: 2019-09-12 **/ @Data public class WorkingSecurityLoginProperty { /*ๆ˜ฏๅฆๅผ€ๅฏ่‡ชๅฎšไน‰็™ปๅฝ•*/ private boolean enable=false; /*็™ปๅฝ•้“พๆŽฅ*/ private String loginUrl="/login"; /*็™ปๅฝ•้กต้ข*/ private String loginPage="/login"; /*็™ปๅฝ•ๆˆๅŠŸ้กต้ข*/ private String successForwardUrl="/"; /*ๆณจ้”€้“พๆŽฅ*/ private String logoutUrl="/logout"; /*ๆณจ้”€ๆˆๅŠŸไน‹ๅŽ่ทณ่ฝฌurl*/ private String logoutSuccess="/logout/success"; @Override public String toString() { return "{" + "loginUrl='" + loginUrl + '\'' + ", loginPage='" + loginPage + '\'' + ", successForwardUrl='" + successForwardUrl + '\'' + ", logoutUrl='" + logoutUrl + '\'' + ", logoutSuccess='" + logoutSuccess + '\'' + '}'; } }
UTF-8
Java
982
java
WorkingSecurityLoginProperty.java
Java
[ { "context": "\nimport lombok.Data;\n\n/**\n * @program:\n * @author: Player\n * @create: 2019-09-12\n **/\n@Data\npublic class Wo", "end": 113, "score": 0.5525857210159302, "start": 107, "tag": "NAME", "value": "Player" } ]
null
[]
package com.glitter.working.properties.spring.security; import lombok.Data; /** * @program: * @author: Player * @create: 2019-09-12 **/ @Data public class WorkingSecurityLoginProperty { /*ๆ˜ฏๅฆๅผ€ๅฏ่‡ชๅฎšไน‰็™ปๅฝ•*/ private boolean enable=false; /*็™ปๅฝ•้“พๆŽฅ*/ private String loginUrl="/login"; /*็™ปๅฝ•้กต้ข*/ private String loginPage="/login"; /*็™ปๅฝ•ๆˆๅŠŸ้กต้ข*/ private String successForwardUrl="/"; /*ๆณจ้”€้“พๆŽฅ*/ private String logoutUrl="/logout"; /*ๆณจ้”€ๆˆๅŠŸไน‹ๅŽ่ทณ่ฝฌurl*/ private String logoutSuccess="/logout/success"; @Override public String toString() { return "{" + "loginUrl='" + loginUrl + '\'' + ", loginPage='" + loginPage + '\'' + ", successForwardUrl='" + successForwardUrl + '\'' + ", logoutUrl='" + logoutUrl + '\'' + ", logoutSuccess='" + logoutSuccess + '\'' + '}'; } }
982
0.547149
0.538377
37
23.648649
19.699385
68
false
false
0
0
0
0
0
0
0.351351
false
false
13
f17d4d1c9f71c57531a7a9032430d6d093c210b4
32,229,434,617,445
a8a5b98457dce960ad09d90147ae43d324839f49
/middleware/src/main/java/com/byyd/middleware/campaign/dao/jpa/CampaignTargetCTRDaoJpaImpl.java
a30232160bd407a87b7ba9b6eab0212b5bf845bf
[]
no_license
graemeparker/cinofda
https://github.com/graemeparker/cinofda
fbb88791f964fefd37134b5845d9f69ca6875bd4
5f669d9dfdded5d511eeea585ea25d7b244d3635
refs/heads/master
2021-03-22T03:01:36.367000
2016-10-14T14:17:54
2016-10-14T14:17:54
70,915,669
1
2
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.byyd.middleware.campaign.dao.jpa; import org.springframework.stereotype.Repository; import com.adfonic.domain.CampaignTargetCTR; import com.byyd.middleware.campaign.dao.CampaignTargetCTRDao; import com.byyd.middleware.iface.dao.jpa.BusinessKeyDaoJpaImpl; @Repository public class CampaignTargetCTRDaoJpaImpl extends BusinessKeyDaoJpaImpl<CampaignTargetCTR> implements CampaignTargetCTRDao { }
UTF-8
Java
421
java
CampaignTargetCTRDaoJpaImpl.java
Java
[]
null
[]
package com.byyd.middleware.campaign.dao.jpa; import org.springframework.stereotype.Repository; import com.adfonic.domain.CampaignTargetCTR; import com.byyd.middleware.campaign.dao.CampaignTargetCTRDao; import com.byyd.middleware.iface.dao.jpa.BusinessKeyDaoJpaImpl; @Repository public class CampaignTargetCTRDaoJpaImpl extends BusinessKeyDaoJpaImpl<CampaignTargetCTR> implements CampaignTargetCTRDao { }
421
0.83848
0.83848
12
33.083332
36.707081
123
false
false
0
0
0
0
0
0
0.416667
false
false
13
462be92125fb71b38a88e5e808293c14aefe6bdf
10,110,353,044,245
ab71e6f0b5f9bf20ab7f9e1a1356a7fc0c4e3b24
/Pack2/Tree.java
a29ab4523054e9c3111425229cde2926c81d7636
[]
no_license
Securiteru/RoadToJava-Done
https://github.com/Securiteru/RoadToJava-Done
bfa97cf8cd3b253d54964b65d4d28dba8aabd7ee
c529492de66f281827a20a32ef668d0cd4fcd0bf
refs/heads/master
2020-03-22T12:09:05.758000
2018-08-21T18:09:05
2018-08-21T18:09:05
140,020,378
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Pack2; public class Tree extends Plant { public void grow(){ System.out.println("growing tree"); } public void shedLeaves(){ System.out.println("leaves sheding"); } }
UTF-8
Java
184
java
Tree.java
Java
[]
null
[]
package Pack2; public class Tree extends Plant { public void grow(){ System.out.println("growing tree"); } public void shedLeaves(){ System.out.println("leaves sheding"); } }
184
0.701087
0.695652
10
17.4
14.941218
39
false
false
0
0
0
0
0
0
1.1
false
false
13
702324e06ae889642b486bb297e1b2f5fa9ecbf4
10,110,353,045,012
9d8e1dbe02ba4757242845690a5c6b95d2dc810f
/Palak/src/Login.java
df61e50d7041290b5130bde930023b85d3c07852
[]
no_license
faiyazalam15/learning
https://github.com/faiyazalam15/learning
5d8445d7bc1cff8278100759ab7dc3280bff7f91
eb737d914e8afe4d0c0c2906d93649afa033ba25
refs/heads/master
2021-01-01T05:18:43.277000
2016-04-25T22:05:49
2016-04-25T22:05:49
56,916,892
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.io.IOException; import java.io.PrintWriter; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; @WebServlet("/Login") public class Login extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { { PrintWriter out=response.getWriter(); String uname=request.getParameter("uname"); String password=request.getParameter("pwd"); System.out.println(uname); System.out.println(password); try { Class.forName("oracle.jdbc.driver.OracleDriver"); Connection con=DriverManager.getConnection ("jdbc:oracle:thin:@localhost:1521:xe","pramod","pramod"); Statement st=con.createStatement(); String sql= "select * from RegnForm where usernm= '"+uname+"' and pass='"+password+"' "; ResultSet rs=st.executeQuery(sql); if(rs.next()) { RequestDispatcher rd=request.getRequestDispatcher("NidhiFrontPage.jsp"); rd.forward(request, response); } else { RequestDispatcher rd=request.getRequestDispatcher("fail.jsp"); rd.forward(request, response); } } catch (ClassNotFoundException | SQLException e) { out.println(e); } } } }
UTF-8
Java
1,717
java
Login.java
Java
[]
null
[]
import java.io.IOException; import java.io.PrintWriter; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import javax.servlet.RequestDispatcher; import javax.servlet.ServletException; import javax.servlet.annotation.WebServlet; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; @WebServlet("/Login") public class Login extends HttpServlet { protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { { PrintWriter out=response.getWriter(); String uname=request.getParameter("uname"); String password=request.getParameter("pwd"); System.out.println(uname); System.out.println(password); try { Class.forName("oracle.jdbc.driver.OracleDriver"); Connection con=DriverManager.getConnection ("jdbc:oracle:thin:@localhost:1521:xe","pramod","pramod"); Statement st=con.createStatement(); String sql= "select * from RegnForm where usernm= '"+uname+"' and pass='"+password+"' "; ResultSet rs=st.executeQuery(sql); if(rs.next()) { RequestDispatcher rd=request.getRequestDispatcher("NidhiFrontPage.jsp"); rd.forward(request, response); } else { RequestDispatcher rd=request.getRequestDispatcher("fail.jsp"); rd.forward(request, response); } } catch (ClassNotFoundException | SQLException e) { out.println(e); } } } }
1,717
0.688992
0.686663
56
29.535715
26.706049
121
false
false
0
0
0
0
0
0
2.767857
false
false
13
375450235a963ca965f1830461988dd9ea302504
31,696,858,669,254
52e66f4640acef25c0e908552e9bd7fca742945b
/src/main/java/algorithm/hidhlevelexam/Test.java
a4bf35520f2f7f32d4c9cb93297c29c2b5c16cec
[]
no_license
dashe02/exam
https://github.com/dashe02/exam
eefff5d5d2f30b6f94c5cf06fec3d00c8adad2d4
0afaee402d9dd73e3b2df616eb8f081766f97a31
refs/heads/master
2021-01-23T20:21:35.997000
2014-08-29T14:36:41
2014-08-29T14:36:41
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package algorithm.hidhlevelexam; /** * Created with IntelliJ IDEA. * User: ThinkPad * Date: 14-8-19 * Time: ไธŠๅˆ11:32 * To change this template use File | Settings | File Templates. */ public class Test { public static int fun(int n){ return 0; } public static void main(String[] args){ String s="I am a student."; String[] ss=s.split(" "); for(int i=ss.length-1;i>=0;i--){ System.out.print(ss[i]+" "); } } }
UTF-8
Java
479
java
Test.java
Java
[ { "context": "exam;\n\n/**\n * Created with IntelliJ IDEA.\n * User: ThinkPad\n * Date: 14-8-19\n * Time: ไธŠๅˆ11:32\n * To change th", "end": 86, "score": 0.9995779991149902, "start": 78, "tag": "USERNAME", "value": "ThinkPad" } ]
null
[]
package algorithm.hidhlevelexam; /** * Created with IntelliJ IDEA. * User: ThinkPad * Date: 14-8-19 * Time: ไธŠๅˆ11:32 * To change this template use File | Settings | File Templates. */ public class Test { public static int fun(int n){ return 0; } public static void main(String[] args){ String s="I am a student."; String[] ss=s.split(" "); for(int i=ss.length-1;i>=0;i--){ System.out.print(ss[i]+" "); } } }
479
0.574737
0.549474
21
21.619047
16.740246
64
false
false
0
0
0
0
0
0
0.428571
false
false
13
eb4545b78c7bd7b77af82d5b2b1f9f4fb59e9928
31,696,858,672,549
defca512ddef667235cc2608dead3f147cbd8dc7
/src/com/Model/User.java
f4049d669ab601a7487181021c9b4bcaed51f4ef
[]
no_license
2308502963/TravelAgency
https://github.com/2308502963/TravelAgency
b4e3fb79aca40f878bfb6c9db5f692f0c7dc6cca
d7c4667ae4a3040e57f0b26cbae73f2463242828
refs/heads/master
2022-04-22T08:55:34.342000
2020-04-19T11:31:31
2020-04-19T11:31:31
256,980,523
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.Model; public class User { public User(String name, String id, String sex, String home, String password) { super(); this.name = name; this.id = id; this.sex = sex; this.home = home; this.password = password; } public User() { super(); // TODO Auto-generated constructor stub } private String name; private String id; private String sex; private String home; private String password; private int type; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getSex() { return sex; } public void setSex(String sex) { this.sex = sex; } public String getHome() { return home; } public void setHome(String home) { this.home = home; } public String getPassword() { return password; } public void setPassword(String password) { this.password = password; } public int getType() { return type; } public void setType(int type) { this.type = type; } @Override public String toString() { return name+home; } }
UTF-8
Java
1,131
java
User.java
Java
[ { "context": "s.sex = sex;\n\t\tthis.home = home;\n\t\tthis.password = password;\n\t}\n\tpublic User() {\n\t\tsuper();\n\t\t// TODO Auto-ge", "end": 232, "score": 0.9555656313896179, "start": 224, "tag": "PASSWORD", "value": "password" }, { "context": "d setPassword(String password) ...
null
[]
package com.Model; public class User { public User(String name, String id, String sex, String home, String password) { super(); this.name = name; this.id = id; this.sex = sex; this.home = home; this.password = <PASSWORD>; } public User() { super(); // TODO Auto-generated constructor stub } private String name; private String id; private String sex; private String home; private String password; private int type; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getSex() { return sex; } public void setSex(String sex) { this.sex = sex; } public String getHome() { return home; } public void setHome(String home) { this.home = home; } public String getPassword() { return password; } public void setPassword(String password) { this.password = <PASSWORD>; } public int getType() { return type; } public void setType(int type) { this.type = type; } @Override public String toString() { return name+home; } }
1,135
0.667551
0.667551
64
16.671875
13.777308
80
false
false
0
0
0
0
0
0
1.734375
false
false
13
70a378740a5daab6ac9d8b59e943dae15c5b3a29
31,696,858,670,255
16e94f0f20a44fb2521b88efcc9e8e14f95d5354
/src/courriers/Money.java
b13b8324561570c0d9a9c9312e520653c57a81d9
[]
no_license
mlegoff/Courrier
https://github.com/mlegoff/Courrier
5ad64433a3acd5d600142e98463f1f071af22ccd
b8283a4d170bbdf3e22351b0bec81f31cf0c7c5e
refs/heads/master
2016-09-06T09:53:05.695000
2014-11-18T22:52:15
2014-11-18T22:52:15
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package courriers; public class Money extends AbstractContent<Integer> { public Money(Integer value) { super(value); } public String toString() { return "a money content (" + this.getValue() + ")"; } }
UTF-8
Java
215
java
Money.java
Java
[]
null
[]
package courriers; public class Money extends AbstractContent<Integer> { public Money(Integer value) { super(value); } public String toString() { return "a money content (" + this.getValue() + ")"; } }
215
0.674419
0.674419
13
15.538462
18.947763
53
false
false
0
0
0
0
0
0
0.923077
false
false
13
abd9cb520b57c779374a82882489d320144d3972
23,802,708,785,996
a96151055c9b541cb02b8fc50c851f29b4665722
/Shrimp_Proto2/src/ss/controller/board/BoardController.java
77144ac20aa78045b4c7093133083028b5de29c8
[]
no_license
Santorowa/Box-Of-N
https://github.com/Santorowa/Box-Of-N
69490c88d103037db61ec5dda6d2c85274ab2bcd
c07f814265aa775733b26bf1e5f504308b0bb4e7
refs/heads/master
2022-12-21T10:55:05.862000
2020-07-04T15:21:07
2020-07-04T15:21:07
133,738,315
0
0
null
false
2022-12-16T09:01:31
2018-05-17T00:41:46
2020-07-04T15:22:24
2022-12-16T09:01:28
1,714
0
0
20
Java
false
false
package ss.controller.board; import java.io.File; import java.io.IOException; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.stereotype.Repository; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.SessionAttributes; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.ModelAndView; import ss.biz.board.BoardCommentBiz; import ss.biz.board.BoardPager; import ss.biz.board.BoardService; import ss.biz.board.BoardVoteBiz; import ss.vo.board.BoardVO; import ss.vo.board.WriteBoardVO; import ss.vo.user.UserVO; import ss.controller.user.LoginController; @Controller @SessionAttributes("board") public class BoardController { @Autowired private BoardService boardService; @Autowired private BoardCommentBiz boardCommentBiz; @Autowired private BoardVoteBiz boardVoteBiz; // CRUD ๊ธฐ๋Šฅ // ๊ธ€ ๋“ฑ๋ก @RequestMapping(value="/insertBoard.do") public String insertBoard(WriteBoardVO vo, HttpServletRequest req) throws IOException { System.out.println("๊ธ€ ๋“ฑ๋ก ์ฒ˜๋ฆฌ Spring Annotation"); System.out.println(vo); UserVO uvo = (UserVO) req.getSession().getAttribute("userInfo"); // btype ๊ฐ’์— ๋”ฐ๋ผ์„œ ๊ธ€ ๋“ฑ๋ก ๋กœ์ง์ด ๋‹ฌ๋ผ์ง„๋‹ค. // 1 : ๋‹จ์ˆœ ํ…์ŠคํŠธ // 2 : ๋งํฌ // 3 : ์ด๋ฏธ์ง€ // 4 : ๋น„๋””์˜ค switch(vo.getBtype()) { case 1: boardService.insertBoard(vo, uvo); break; case 2: boardService.insertLinkBoard(vo, uvo); break; case 3: boardService.insertImageBoard(vo, uvo, req); break; case 4: boardService.insertVideoBoard(vo, uvo, req); break; } // ํŒŒ์ผ ์—…๋กœ๋“œ ์ฒ˜๋ฆฌ /*MultipartFile uploadFile = vo.getUploadFile(); if (!uploadFile.isEmpty()) { String fileName = uploadFile.getOriginalFilename(); uploadFile.transferTo(new File("C:\\Users\\Playdata\\Desktop\\Upload\\" + fileName)); }*/ //boardService.insertBoard(vo, uvo); return "redirect:getBoardList.do"; //๊ฒŒ์‹œ๊ธ€ ์ž‘์„ฑ ํ›„ ์–ด๋””๋กœ ์ด๋™ํ• ์ง€... ๊ธ€๋ชฉ๋ก? ๊ธ€ ์ƒ์„ธํ™”๋ฉด? } // ๊ธ€ ์ˆ˜์ • /*@RequestMapping("/updateBoard.do") public String updateBoard(@ModelAttribute("board") BoardVO vo) { System.out.println("๊ธ€ ์ˆ˜์ • ์ฒ˜๋ฆฌ MVC Annotation"); boardService.updateBoard(vo); return "redirect:getBoardList.do"; }*/ // ๊ธ€ ์‚ญ์ œ @RequestMapping("/deleteBoard.do") public String deleteBoard(BoardVO vo) { System.out.println("๊ธ€ ์‚ญ์ œ ์ฒ˜๋ฆฌ MVC"); boardService.deleteBoard(vo); return "redirect:getBoardList.do"; } // ๊ธ€ ์ƒ์„ธ ์กฐํšŒ @RequestMapping("/getBoard.do") public String getBoard(BoardVO vo, Model model, HttpSession session) { System.out.println("๊ธ€ ์ƒ์„ธ ์กฐํšŒ ์ฒ˜๋ฆฌ MVC"); String checkstat = ""; // ์กฐํšŒ์ˆ˜ ์ฆ๊ฐ€ ์ฒ˜๋ฆฌ boardService.increaseHit(vo); vo = boardService.getBoard(vo); System.out.println("BOARD ์ปจํŠธ๋กค๋Ÿฌ์—์„œ vo๊ฐ’"+vo); model.addAttribute("board", vo);//๊ฒŒ์‹œ๊ธ€์— ๋Œ€ํ•œ VO model.addAttribute("commentList", boardCommentBiz.SelectListBoardComment(vo.getBseq()));//๊ฒŒ์‹œ๊ธ€์˜ commentVO List //VOTE TABLE์—์„œ ๋ฐ์ดํ„ฐ ์กด์žฌํ•˜๋Š”์ง€ ํ™•์ธํ•˜๊ณ  //์—†์œผ๋ฉด ๊ทธ๋ƒฅ "0" //์žˆ์œผ๋ฉด, try { UserVO uservo = (UserVO)session.getAttribute("userInfo"); int result = boardVoteBiz.checkVoteInViewBoard(uservo.getUseq(), vo.getBseq()); System.out.println("boardVoteBiz ๊ฒฐ๊ณผ : " + result); checkstat = Integer.toString(result); }catch(NullPointerException e) { checkstat = "0"; } model.addAttribute("checkstat", checkstat);//๊ฒŒ์‹œ๊ธ€์— ํ•ด๋‹น ์‚ฌ์šฉ์ž๊ฐ€ ํˆฌํ‘œ๋ฅผ ํ–ˆ๋˜ ์ ์ด ์žˆ๋Š”์ง€... ์—†๋Š”์ง€... return "getBoard_D"; } // ๊ฒ€์ƒ‰ ์กฐ๊ฑด ์„ค์ •(For Jsp) @ModelAttribute("conditionMap") public Map<String, String> searchConditionMap() { Map<String, String> conditionMap = new HashMap<>(); conditionMap.put("์ œ๋ชฉ", "TITLE"); conditionMap.put("๋‚ด์šฉ", "CONTENT"); return conditionMap; } // ๊ธ€ ๋ชฉ๋ก ๊ฒ€์ƒ‰ @RequestMapping("/getBoardList.do") public ModelAndView getBoardList(@RequestParam(defaultValue="title") String searchOption, @RequestParam(defaultValue="") String keyword, @RequestParam(defaultValue="1") int curPage ) { System.out.println("๊ธ€ ๋ชฉ๋ก ๊ฒ€์ƒ‰ ์ฒ˜๋ฆฌ MVC"); // ๋ ˆ์ฝ”๋“œ์˜ ๊ฐฏ์ˆ˜ ๊ณ„์‚ฐ int count = boardService.countArticle(searchOption, keyword); System.out.println("searchOption : " + searchOption + "keyWord"+ keyword); // ํŽ˜์ด์ง€ ๋‚˜๋ˆ„๊ธฐ ๊ด€๋ จ ์ฒ˜๋ฆฌ BoardPager boardPager = new BoardPager(count, curPage); int start = boardPager.getPageBegin() - 1; System.out.println(start); int end = boardPager.getPageEnd(); List<BoardVO> list = boardService.getBoardList(start, end, searchOption, keyword); // ๋ฐ์ดํ„ฐ๋ฅผ ๋งต์— ์ €์žฅ Map<String, Object> map = new HashMap<String, Object>(); map.put("list", list); // list map.put("count", count); // ๋ ˆ์ฝ”๋“œ์˜ ๊ฐฏ์ˆ˜ map.put("searchOption", searchOption); // ๊ฒ€์ƒ‰์˜ต์…˜ map.put("keyword", keyword); // ๊ฒ€์ƒ‰ํ‚ค์›Œ๋“œ map.put("boardPager", boardPager); ModelAndView mav = new ModelAndView(); mav.addObject("map", map); // ๋งต์— ์ €์žฅ๋œ ๋ฐ์ดํ„ฐ๋ฅผ mav์— ์ €์žฅ mav.setViewName("dukjilList"); // ๋ทฐ๋ฅผ dukjilList.jsp๋กœ ์„ค์ • // Null Check // if (vo.getSearchCondition() == null) vo.setSearchCondition("TITLE"); // if (vo.getSearchKeyword() == null) vo.setSearchKeyword(""); // model.addAttribute("boardList", boardService.getBoardList(vo)); return mav; } }
UHC
Java
5,976
java
BoardController.java
Java
[]
null
[]
package ss.controller.board; import java.io.File; import java.io.IOException; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.stereotype.Repository; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.SessionAttributes; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.ModelAndView; import ss.biz.board.BoardCommentBiz; import ss.biz.board.BoardPager; import ss.biz.board.BoardService; import ss.biz.board.BoardVoteBiz; import ss.vo.board.BoardVO; import ss.vo.board.WriteBoardVO; import ss.vo.user.UserVO; import ss.controller.user.LoginController; @Controller @SessionAttributes("board") public class BoardController { @Autowired private BoardService boardService; @Autowired private BoardCommentBiz boardCommentBiz; @Autowired private BoardVoteBiz boardVoteBiz; // CRUD ๊ธฐ๋Šฅ // ๊ธ€ ๋“ฑ๋ก @RequestMapping(value="/insertBoard.do") public String insertBoard(WriteBoardVO vo, HttpServletRequest req) throws IOException { System.out.println("๊ธ€ ๋“ฑ๋ก ์ฒ˜๋ฆฌ Spring Annotation"); System.out.println(vo); UserVO uvo = (UserVO) req.getSession().getAttribute("userInfo"); // btype ๊ฐ’์— ๋”ฐ๋ผ์„œ ๊ธ€ ๋“ฑ๋ก ๋กœ์ง์ด ๋‹ฌ๋ผ์ง„๋‹ค. // 1 : ๋‹จ์ˆœ ํ…์ŠคํŠธ // 2 : ๋งํฌ // 3 : ์ด๋ฏธ์ง€ // 4 : ๋น„๋””์˜ค switch(vo.getBtype()) { case 1: boardService.insertBoard(vo, uvo); break; case 2: boardService.insertLinkBoard(vo, uvo); break; case 3: boardService.insertImageBoard(vo, uvo, req); break; case 4: boardService.insertVideoBoard(vo, uvo, req); break; } // ํŒŒ์ผ ์—…๋กœ๋“œ ์ฒ˜๋ฆฌ /*MultipartFile uploadFile = vo.getUploadFile(); if (!uploadFile.isEmpty()) { String fileName = uploadFile.getOriginalFilename(); uploadFile.transferTo(new File("C:\\Users\\Playdata\\Desktop\\Upload\\" + fileName)); }*/ //boardService.insertBoard(vo, uvo); return "redirect:getBoardList.do"; //๊ฒŒ์‹œ๊ธ€ ์ž‘์„ฑ ํ›„ ์–ด๋””๋กœ ์ด๋™ํ• ์ง€... ๊ธ€๋ชฉ๋ก? ๊ธ€ ์ƒ์„ธํ™”๋ฉด? } // ๊ธ€ ์ˆ˜์ • /*@RequestMapping("/updateBoard.do") public String updateBoard(@ModelAttribute("board") BoardVO vo) { System.out.println("๊ธ€ ์ˆ˜์ • ์ฒ˜๋ฆฌ MVC Annotation"); boardService.updateBoard(vo); return "redirect:getBoardList.do"; }*/ // ๊ธ€ ์‚ญ์ œ @RequestMapping("/deleteBoard.do") public String deleteBoard(BoardVO vo) { System.out.println("๊ธ€ ์‚ญ์ œ ์ฒ˜๋ฆฌ MVC"); boardService.deleteBoard(vo); return "redirect:getBoardList.do"; } // ๊ธ€ ์ƒ์„ธ ์กฐํšŒ @RequestMapping("/getBoard.do") public String getBoard(BoardVO vo, Model model, HttpSession session) { System.out.println("๊ธ€ ์ƒ์„ธ ์กฐํšŒ ์ฒ˜๋ฆฌ MVC"); String checkstat = ""; // ์กฐํšŒ์ˆ˜ ์ฆ๊ฐ€ ์ฒ˜๋ฆฌ boardService.increaseHit(vo); vo = boardService.getBoard(vo); System.out.println("BOARD ์ปจํŠธ๋กค๋Ÿฌ์—์„œ vo๊ฐ’"+vo); model.addAttribute("board", vo);//๊ฒŒ์‹œ๊ธ€์— ๋Œ€ํ•œ VO model.addAttribute("commentList", boardCommentBiz.SelectListBoardComment(vo.getBseq()));//๊ฒŒ์‹œ๊ธ€์˜ commentVO List //VOTE TABLE์—์„œ ๋ฐ์ดํ„ฐ ์กด์žฌํ•˜๋Š”์ง€ ํ™•์ธํ•˜๊ณ  //์—†์œผ๋ฉด ๊ทธ๋ƒฅ "0" //์žˆ์œผ๋ฉด, try { UserVO uservo = (UserVO)session.getAttribute("userInfo"); int result = boardVoteBiz.checkVoteInViewBoard(uservo.getUseq(), vo.getBseq()); System.out.println("boardVoteBiz ๊ฒฐ๊ณผ : " + result); checkstat = Integer.toString(result); }catch(NullPointerException e) { checkstat = "0"; } model.addAttribute("checkstat", checkstat);//๊ฒŒ์‹œ๊ธ€์— ํ•ด๋‹น ์‚ฌ์šฉ์ž๊ฐ€ ํˆฌํ‘œ๋ฅผ ํ–ˆ๋˜ ์ ์ด ์žˆ๋Š”์ง€... ์—†๋Š”์ง€... return "getBoard_D"; } // ๊ฒ€์ƒ‰ ์กฐ๊ฑด ์„ค์ •(For Jsp) @ModelAttribute("conditionMap") public Map<String, String> searchConditionMap() { Map<String, String> conditionMap = new HashMap<>(); conditionMap.put("์ œ๋ชฉ", "TITLE"); conditionMap.put("๋‚ด์šฉ", "CONTENT"); return conditionMap; } // ๊ธ€ ๋ชฉ๋ก ๊ฒ€์ƒ‰ @RequestMapping("/getBoardList.do") public ModelAndView getBoardList(@RequestParam(defaultValue="title") String searchOption, @RequestParam(defaultValue="") String keyword, @RequestParam(defaultValue="1") int curPage ) { System.out.println("๊ธ€ ๋ชฉ๋ก ๊ฒ€์ƒ‰ ์ฒ˜๋ฆฌ MVC"); // ๋ ˆ์ฝ”๋“œ์˜ ๊ฐฏ์ˆ˜ ๊ณ„์‚ฐ int count = boardService.countArticle(searchOption, keyword); System.out.println("searchOption : " + searchOption + "keyWord"+ keyword); // ํŽ˜์ด์ง€ ๋‚˜๋ˆ„๊ธฐ ๊ด€๋ จ ์ฒ˜๋ฆฌ BoardPager boardPager = new BoardPager(count, curPage); int start = boardPager.getPageBegin() - 1; System.out.println(start); int end = boardPager.getPageEnd(); List<BoardVO> list = boardService.getBoardList(start, end, searchOption, keyword); // ๋ฐ์ดํ„ฐ๋ฅผ ๋งต์— ์ €์žฅ Map<String, Object> map = new HashMap<String, Object>(); map.put("list", list); // list map.put("count", count); // ๋ ˆ์ฝ”๋“œ์˜ ๊ฐฏ์ˆ˜ map.put("searchOption", searchOption); // ๊ฒ€์ƒ‰์˜ต์…˜ map.put("keyword", keyword); // ๊ฒ€์ƒ‰ํ‚ค์›Œ๋“œ map.put("boardPager", boardPager); ModelAndView mav = new ModelAndView(); mav.addObject("map", map); // ๋งต์— ์ €์žฅ๋œ ๋ฐ์ดํ„ฐ๋ฅผ mav์— ์ €์žฅ mav.setViewName("dukjilList"); // ๋ทฐ๋ฅผ dukjilList.jsp๋กœ ์„ค์ • // Null Check // if (vo.getSearchCondition() == null) vo.setSearchCondition("TITLE"); // if (vo.getSearchKeyword() == null) vo.setSearchKeyword(""); // model.addAttribute("boardList", boardService.getBoardList(vo)); return mav; } }
5,976
0.706708
0.704521
179
29.648045
24.532368
111
false
false
0
0
0
0
0
0
2.061453
false
false
13
54000f56e5a95410f5b643d67c69c00816fde712
27,281,632,298,889
b99c49b5a3fae60e6bd394ed11997dd8fc040c02
/Final Android App/GprsCrimeTracking/src/pack/my/history.java
3c97e9a5a223cb9e3b5d5cc87f81ef02124d4a51
[]
no_license
ParinModi2/Crime-Tracking
https://github.com/ParinModi2/Crime-Tracking
404396c254f41e844fe130a608d5f54d61936403
49bd67e56ff080cd461c131fdaf6f260a500b6a4
refs/heads/master
2020-05-18T08:42:28.639000
2014-09-28T17:49:32
2014-09-28T17:49:32
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package pack.my; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.zip.GZIPInputStream; import org.apache.http.Header; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicHeader; import org.apache.http.message.BasicNameValuePair; import org.apache.http.protocol.HTTP; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.app.AlertDialog; import android.app.ListActivity; import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Color; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.AdapterView; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.SimpleAdapter; import android.widget.TextView; import android.widget.Toast; import pack.my.AlertDialogManager; import pack.my.ConnectionDetector; import pack.my.JSONParser; public class history extends ListActivity { // Connection detector ConnectionDetector cd; Bundle bl; final JSONObject jsonobj = new JSONObject(); public static String email,addr,caseid; // Alert dialog manager AlertDialogManager alert = new AlertDialogManager(); // Progress Dialog private ProgressDialog pDialog; // Creating JSON Parser object JSONParser jsonParser = new JSONParser(); ArrayList<HashMap<String, String>> albumsList; // albums JSONArray JSONArray albums = null; // albums JSON url private static final String URL_ALBUMS = "http://training.artoonsolutions.com/crimetracking/history.php"; ImageView b1,b2,b3,b4,b6; Button b5; // ALL JSON node names private static final String TAG_ID = "uemail"; private static final String TAG_NAME = "add"; private static final String TAG_SONGS_COUNT = "case_id"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.albums_activity); SharedPreferences sharedPreferences = getSharedPreferences("MY_SHARED_PREF", MODE_PRIVATE); String emai = sharedPreferences.getString("MEM1", ""); TextView emailId=(TextView)findViewById(R.id.EmailId); emailId.setText(emai); b1=(ImageView)findViewById(R.id.button1); b2=(ImageView)findViewById(R.id.button2); b3=(ImageView)findViewById(R.id.button3); b4=(ImageView)findViewById(R.id.button4); b5=(Button)findViewById(R.id.button5); b6=(ImageView)findViewById(R.id.button6); b6.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { SharedPreferences Preferences = getSharedPreferences("MY_SHARED_PREF", MODE_PRIVATE); String type = Preferences.getString("MEM3", ""); if(type.equals("user")) { Toast.makeText(history.this, "USER", Toast.LENGTH_LONG).show(); Intent i=new Intent ("PACK.MY.APPLICATION"); startActivity(i); } else { Toast.makeText(history.this, "POLICE", Toast.LENGTH_LONG).show(); Intent i=new Intent ("PACK.MY.POLICEAPP"); startActivity(i); } finish(); } }); b1.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent i=new Intent ("PACK.MY.CAM"); startActivity(i); finish(); } }); b2.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent i1=new Intent ("PACK.MY.VIDEO"); startActivity(i1); finish(); } }); b3.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent i2=new Intent ("PACK.MY.TEXT"); startActivity(i2); finish(); } }); b4.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo ni = cm.getActiveNetworkInfo(); if (ni == null) { // There are no active networks. //Toast.makeText(application.this, "Check your internet connection. Try again.", Toast.LENGTH_LONG).show(); new AlertDialog.Builder(history.this) .setTitle("Alert!") .setMessage("Check your internet connection. Try again.") .setNeutralButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }).show(); } else { Intent i3=new Intent ("PACK.MY.LOCATIONUPDATE"); bl.putString("type", "map"); i3.putExtras(bl); startActivity(i3); finish(); } } }); b5.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent i4=new Intent ("PACK.MY.EDITPRO"); startActivity(i4); finish(); } }); cd = new ConnectionDetector(getApplicationContext()); // Check for internet connection if (!cd.isConnectingToInternet()) { // Internet Connection is not present alert.showAlertDialog(history.this, "Internet Connection Error", "Please connect to working Internet connection", false); // stop executing code by return return; } //send(); // Hashmap for ListView albumsList = new ArrayList<HashMap<String, String>>(); // Loading Albums JSON in Background Thread new LoadAlbums().execute(); // get listview ListView lv = getListView(); /** * Listview item click listener * TrackListActivity will be lauched by passing album id * */ lv.setOnItemClickListener(new android.widget.AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View view, int arg2, long arg3) { // on selecting a single album // TrackListActivity will be launched to show tracks inside the album Intent i = new Intent(getApplicationContext(), feedback.class); //Object obj=arg0.getItemAtPosition(arg2); caseid = ((TextView) view.findViewById(R.id.songs_count)).getText().toString(); addr = ((TextView) view.findViewById(R.id.album_name)).getText().toString(); email = ((TextView) view.findViewById(R.id.album_id)).getText().toString(); //Toast.makeText(history.this, "Value in onclick:"+caseid+","+addr+","+email, Toast.LENGTH_LONG).show(); startActivity(i); finish(); } }); } /** * Background Async Task to Load all Albums by making http request * */ class LoadAlbums extends AsyncTask<String, String, String> { /** * Before starting background thread Show Progress Dialog * */ @Override protected void onPreExecute() { super.onPreExecute(); pDialog = new ProgressDialog(history.this); pDialog.setMessage("Listing all the cases ..."); pDialog.setIndeterminate(false); pDialog.setCancelable(false); pDialog.show(); } /** * getting Albums JSON * */ protected String doInBackground(String... args) { // Building Parameters SharedPreferences sharedPreferences = getSharedPreferences("MY_SHARED_PREF", MODE_PRIVATE); String email = sharedPreferences.getString("MEM1", ""); List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add((NameValuePair) new BasicNameValuePair("email",email )); // getting JSON string from URL String json = jsonParser.makeHttpRequest(URL_ALBUMS, "POST", params); // Check your log cat for JSON reponse Log.d("Albums JSON: ", "> " + json); try { albums = new JSONArray(json); if (albums != null) { // looping through All albums for (int i = 0; i < albums.length(); i++) { JSONObject c = albums.getJSONObject(i); // Storing each json item values in variable String id = c.getString(TAG_ID); String name = c.getString(TAG_NAME); String songs_count = c.getString(TAG_SONGS_COUNT); // creating new HashMap HashMap<String, String> map = new HashMap<String, String>(); // adding each child node to HashMap key => value map.put(TAG_ID, id); map.put(TAG_NAME, name); map.put(TAG_SONGS_COUNT, songs_count); // adding HashList to ArrayList albumsList.add(map); } }else{ Log.d("Albums: ", "null"); } } catch (JSONException e) { e.printStackTrace(); } return null; } /** * After completing background task Dismiss the progress dialog * **/ protected void onPostExecute(String file_url) { // dismiss the dialog after getting all albums pDialog.dismiss(); // updating UI from Background Thread runOnUiThread(new Runnable() { public void run() { /** * Updating parsed JSON data into ListView * */ //Toast.makeText(history.this, "JSON:"+TAG_NAME, Toast.LENGTH_LONG).show(); ListAdapter adapter = new SimpleAdapter( history.this, albumsList, R.layout.list_item_albums, new String[] { TAG_ID, TAG_NAME, TAG_SONGS_COUNT }, new int[] { R.id.album_id, R.id.album_name, R.id.songs_count }); // updating listview setListAdapter(adapter); } }); } } public void send() { try { SharedPreferences sharedPreferences = getSharedPreferences("MY_SHARED_PREF", MODE_PRIVATE); String email = sharedPreferences.getString("MEM1", ""); Toast.makeText(history.this, "send"+email,Toast.LENGTH_LONG).show(); jsonobj.put("email", email); //final String wurl = "http://training.artoonsolutions.com/crimetracking/email.php"; DefaultHttpClient httpclient = new DefaultHttpClient(); HttpPost httppostreq = new HttpPost(URL_ALBUMS); StringEntity se = new StringEntity(jsonobj.toString()); se.setContentType("application/json;charset=UTF-8"); se.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE, "application/json;charset=UTF-8")); httppostreq.setEntity(se); HttpResponse httpresponse = httpclient.execute(httppostreq); HttpEntity resultentity = httpresponse.getEntity(); if(resultentity != null) { InputStream inputstream = resultentity.getContent(); Header contentencoding = httpresponse.getFirstHeader("Content-Encoding"); if(contentencoding != null && contentencoding.getValue().equalsIgnoreCase("gzip")) { inputstream = new GZIPInputStream(inputstream); } String resultstring = convertStreamToString(inputstream); inputstream.close(); resultstring = resultstring.substring(0,resultstring.length()); resultstring=resultstring.trim(); //Toast.makeText(history.this, "UPLOADED...", Toast.LENGTH_LONG).show(); Toast.makeText(history.this, "Res from php:"+resultstring, Toast.LENGTH_LONG).show(); /*Intent intent=new Intent("PACK.MY.APPLICATION"); startActivity(intent);*/ } else { Toast.makeText(history.this, "Could not register. Try again.", Toast.LENGTH_LONG).show(); } } catch (Exception e) { Toast.makeText(history.this, "Error:"+e, Toast.LENGTH_SHORT).show(); } } private String convertStreamToString(InputStream is) { String line = ""; StringBuilder total = new StringBuilder(); BufferedReader rd = new BufferedReader(new InputStreamReader(is)); try { while ((line = rd.readLine()) != null) { total.append(line); } } catch (Exception e) { e.printStackTrace(); } return total.toString(); } }
UTF-8
Java
13,505
java
history.java
Java
[]
null
[]
package pack.my; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.zip.GZIPInputStream; import org.apache.http.Header; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.NameValuePair; import org.apache.http.client.methods.HttpPost; import org.apache.http.entity.StringEntity; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.message.BasicHeader; import org.apache.http.message.BasicNameValuePair; import org.apache.http.protocol.HTTP; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import android.app.AlertDialog; import android.app.ListActivity; import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.SharedPreferences; import android.graphics.Color; import android.net.ConnectivityManager; import android.net.NetworkInfo; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log; import android.view.View; import android.widget.AdapterView; import android.widget.Button; import android.widget.EditText; import android.widget.ImageView; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.SimpleAdapter; import android.widget.TextView; import android.widget.Toast; import pack.my.AlertDialogManager; import pack.my.ConnectionDetector; import pack.my.JSONParser; public class history extends ListActivity { // Connection detector ConnectionDetector cd; Bundle bl; final JSONObject jsonobj = new JSONObject(); public static String email,addr,caseid; // Alert dialog manager AlertDialogManager alert = new AlertDialogManager(); // Progress Dialog private ProgressDialog pDialog; // Creating JSON Parser object JSONParser jsonParser = new JSONParser(); ArrayList<HashMap<String, String>> albumsList; // albums JSONArray JSONArray albums = null; // albums JSON url private static final String URL_ALBUMS = "http://training.artoonsolutions.com/crimetracking/history.php"; ImageView b1,b2,b3,b4,b6; Button b5; // ALL JSON node names private static final String TAG_ID = "uemail"; private static final String TAG_NAME = "add"; private static final String TAG_SONGS_COUNT = "case_id"; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.albums_activity); SharedPreferences sharedPreferences = getSharedPreferences("MY_SHARED_PREF", MODE_PRIVATE); String emai = sharedPreferences.getString("MEM1", ""); TextView emailId=(TextView)findViewById(R.id.EmailId); emailId.setText(emai); b1=(ImageView)findViewById(R.id.button1); b2=(ImageView)findViewById(R.id.button2); b3=(ImageView)findViewById(R.id.button3); b4=(ImageView)findViewById(R.id.button4); b5=(Button)findViewById(R.id.button5); b6=(ImageView)findViewById(R.id.button6); b6.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { SharedPreferences Preferences = getSharedPreferences("MY_SHARED_PREF", MODE_PRIVATE); String type = Preferences.getString("MEM3", ""); if(type.equals("user")) { Toast.makeText(history.this, "USER", Toast.LENGTH_LONG).show(); Intent i=new Intent ("PACK.MY.APPLICATION"); startActivity(i); } else { Toast.makeText(history.this, "POLICE", Toast.LENGTH_LONG).show(); Intent i=new Intent ("PACK.MY.POLICEAPP"); startActivity(i); } finish(); } }); b1.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent i=new Intent ("PACK.MY.CAM"); startActivity(i); finish(); } }); b2.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent i1=new Intent ("PACK.MY.VIDEO"); startActivity(i1); finish(); } }); b3.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent i2=new Intent ("PACK.MY.TEXT"); startActivity(i2); finish(); } }); b4.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo ni = cm.getActiveNetworkInfo(); if (ni == null) { // There are no active networks. //Toast.makeText(application.this, "Check your internet connection. Try again.", Toast.LENGTH_LONG).show(); new AlertDialog.Builder(history.this) .setTitle("Alert!") .setMessage("Check your internet connection. Try again.") .setNeutralButton("Ok", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }).show(); } else { Intent i3=new Intent ("PACK.MY.LOCATIONUPDATE"); bl.putString("type", "map"); i3.putExtras(bl); startActivity(i3); finish(); } } }); b5.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub Intent i4=new Intent ("PACK.MY.EDITPRO"); startActivity(i4); finish(); } }); cd = new ConnectionDetector(getApplicationContext()); // Check for internet connection if (!cd.isConnectingToInternet()) { // Internet Connection is not present alert.showAlertDialog(history.this, "Internet Connection Error", "Please connect to working Internet connection", false); // stop executing code by return return; } //send(); // Hashmap for ListView albumsList = new ArrayList<HashMap<String, String>>(); // Loading Albums JSON in Background Thread new LoadAlbums().execute(); // get listview ListView lv = getListView(); /** * Listview item click listener * TrackListActivity will be lauched by passing album id * */ lv.setOnItemClickListener(new android.widget.AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View view, int arg2, long arg3) { // on selecting a single album // TrackListActivity will be launched to show tracks inside the album Intent i = new Intent(getApplicationContext(), feedback.class); //Object obj=arg0.getItemAtPosition(arg2); caseid = ((TextView) view.findViewById(R.id.songs_count)).getText().toString(); addr = ((TextView) view.findViewById(R.id.album_name)).getText().toString(); email = ((TextView) view.findViewById(R.id.album_id)).getText().toString(); //Toast.makeText(history.this, "Value in onclick:"+caseid+","+addr+","+email, Toast.LENGTH_LONG).show(); startActivity(i); finish(); } }); } /** * Background Async Task to Load all Albums by making http request * */ class LoadAlbums extends AsyncTask<String, String, String> { /** * Before starting background thread Show Progress Dialog * */ @Override protected void onPreExecute() { super.onPreExecute(); pDialog = new ProgressDialog(history.this); pDialog.setMessage("Listing all the cases ..."); pDialog.setIndeterminate(false); pDialog.setCancelable(false); pDialog.show(); } /** * getting Albums JSON * */ protected String doInBackground(String... args) { // Building Parameters SharedPreferences sharedPreferences = getSharedPreferences("MY_SHARED_PREF", MODE_PRIVATE); String email = sharedPreferences.getString("MEM1", ""); List<NameValuePair> params = new ArrayList<NameValuePair>(); params.add((NameValuePair) new BasicNameValuePair("email",email )); // getting JSON string from URL String json = jsonParser.makeHttpRequest(URL_ALBUMS, "POST", params); // Check your log cat for JSON reponse Log.d("Albums JSON: ", "> " + json); try { albums = new JSONArray(json); if (albums != null) { // looping through All albums for (int i = 0; i < albums.length(); i++) { JSONObject c = albums.getJSONObject(i); // Storing each json item values in variable String id = c.getString(TAG_ID); String name = c.getString(TAG_NAME); String songs_count = c.getString(TAG_SONGS_COUNT); // creating new HashMap HashMap<String, String> map = new HashMap<String, String>(); // adding each child node to HashMap key => value map.put(TAG_ID, id); map.put(TAG_NAME, name); map.put(TAG_SONGS_COUNT, songs_count); // adding HashList to ArrayList albumsList.add(map); } }else{ Log.d("Albums: ", "null"); } } catch (JSONException e) { e.printStackTrace(); } return null; } /** * After completing background task Dismiss the progress dialog * **/ protected void onPostExecute(String file_url) { // dismiss the dialog after getting all albums pDialog.dismiss(); // updating UI from Background Thread runOnUiThread(new Runnable() { public void run() { /** * Updating parsed JSON data into ListView * */ //Toast.makeText(history.this, "JSON:"+TAG_NAME, Toast.LENGTH_LONG).show(); ListAdapter adapter = new SimpleAdapter( history.this, albumsList, R.layout.list_item_albums, new String[] { TAG_ID, TAG_NAME, TAG_SONGS_COUNT }, new int[] { R.id.album_id, R.id.album_name, R.id.songs_count }); // updating listview setListAdapter(adapter); } }); } } public void send() { try { SharedPreferences sharedPreferences = getSharedPreferences("MY_SHARED_PREF", MODE_PRIVATE); String email = sharedPreferences.getString("MEM1", ""); Toast.makeText(history.this, "send"+email,Toast.LENGTH_LONG).show(); jsonobj.put("email", email); //final String wurl = "http://training.artoonsolutions.com/crimetracking/email.php"; DefaultHttpClient httpclient = new DefaultHttpClient(); HttpPost httppostreq = new HttpPost(URL_ALBUMS); StringEntity se = new StringEntity(jsonobj.toString()); se.setContentType("application/json;charset=UTF-8"); se.setContentEncoding(new BasicHeader(HTTP.CONTENT_TYPE, "application/json;charset=UTF-8")); httppostreq.setEntity(se); HttpResponse httpresponse = httpclient.execute(httppostreq); HttpEntity resultentity = httpresponse.getEntity(); if(resultentity != null) { InputStream inputstream = resultentity.getContent(); Header contentencoding = httpresponse.getFirstHeader("Content-Encoding"); if(contentencoding != null && contentencoding.getValue().equalsIgnoreCase("gzip")) { inputstream = new GZIPInputStream(inputstream); } String resultstring = convertStreamToString(inputstream); inputstream.close(); resultstring = resultstring.substring(0,resultstring.length()); resultstring=resultstring.trim(); //Toast.makeText(history.this, "UPLOADED...", Toast.LENGTH_LONG).show(); Toast.makeText(history.this, "Res from php:"+resultstring, Toast.LENGTH_LONG).show(); /*Intent intent=new Intent("PACK.MY.APPLICATION"); startActivity(intent);*/ } else { Toast.makeText(history.this, "Could not register. Try again.", Toast.LENGTH_LONG).show(); } } catch (Exception e) { Toast.makeText(history.this, "Error:"+e, Toast.LENGTH_SHORT).show(); } } private String convertStreamToString(InputStream is) { String line = ""; StringBuilder total = new StringBuilder(); BufferedReader rd = new BufferedReader(new InputStreamReader(is)); try { while ((line = rd.readLine()) != null) { total.append(line); } } catch (Exception e) { e.printStackTrace(); } return total.toString(); } }
13,505
0.614513
0.611107
411
31.861315
25.70311
125
false
false
0
0
0
0
0
0
1.822384
false
false
13
57472fdd2e6bc427c6e9a0553b42f29faf1309e6
33,105,607,952,309
56425f325d11031cf4ada17d54428026860a4ad7
/app/src/main/java/com/test/foodcookybook/Models/MyList.java
48ff94520a8c63b0914f42fdaa5deba99134ccdd
[]
no_license
eswarsatya/FoodCook
https://github.com/eswarsatya/FoodCook
5125cd3a9c48ba7b400e233fa4d6a84d6434efbc
7154788fa7ddd77805330bba3e60a421a4c582ae
refs/heads/master
2023-02-26T17:54:29.288000
2021-02-02T11:14:57
2021-02-02T11:14:57
335,260,656
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.test.foodcookybook.Models; import com.google.gson.annotations.SerializedName; public class MyList { @SerializedName("idMeal") public String idMeal=""; @SerializedName("strMeal") public String strMeal=""; @SerializedName("strMealThumb") public String strMealThumb=""; @SerializedName("strCategory") public String strCategory=""; @SerializedName("strArea") public String strArea=""; public int issel=0; public MyList(String idMeal, String strMeal, String strMealThumb, String strCategory, String strArea,int issel) { this.idMeal = idMeal; this.strMeal = strMeal; this.strMealThumb = strMealThumb; this.strCategory = strCategory; this.strArea=strArea; this.issel=issel; } public MyList() { } public MyList(MyList myList) { idMeal = myList.idMeal; strMeal = myList.strMeal; strMealThumb = myList. strMealThumb; strCategory = myList.strCategory; strArea= myList.strArea; issel= myList.issel; } public int getIssel() { return issel; } public void setIssel(int issel) { this.issel = issel; } public String getIdMeal() { return idMeal; } public void setIdMeal(String idMeal) { this.idMeal = idMeal; } public String getStrMeal() { return strMeal; } public void setStrMeal(String strMeal) { this.strMeal = strMeal; } public String getStrMealThumb() { return strMealThumb; } public void setStrMealThumb(String strMealThumb) { this.strMealThumb = strMealThumb; } public String getStrCategory() { return strCategory; } public void setStrCategory(String strCategory) { this.strCategory = strCategory; } public String getStrArea() { return strArea; } public void setStrArea(String strArea) { this.strArea = strArea; } }
UTF-8
Java
2,000
java
MyList.java
Java
[]
null
[]
package com.test.foodcookybook.Models; import com.google.gson.annotations.SerializedName; public class MyList { @SerializedName("idMeal") public String idMeal=""; @SerializedName("strMeal") public String strMeal=""; @SerializedName("strMealThumb") public String strMealThumb=""; @SerializedName("strCategory") public String strCategory=""; @SerializedName("strArea") public String strArea=""; public int issel=0; public MyList(String idMeal, String strMeal, String strMealThumb, String strCategory, String strArea,int issel) { this.idMeal = idMeal; this.strMeal = strMeal; this.strMealThumb = strMealThumb; this.strCategory = strCategory; this.strArea=strArea; this.issel=issel; } public MyList() { } public MyList(MyList myList) { idMeal = myList.idMeal; strMeal = myList.strMeal; strMealThumb = myList. strMealThumb; strCategory = myList.strCategory; strArea= myList.strArea; issel= myList.issel; } public int getIssel() { return issel; } public void setIssel(int issel) { this.issel = issel; } public String getIdMeal() { return idMeal; } public void setIdMeal(String idMeal) { this.idMeal = idMeal; } public String getStrMeal() { return strMeal; } public void setStrMeal(String strMeal) { this.strMeal = strMeal; } public String getStrMealThumb() { return strMealThumb; } public void setStrMealThumb(String strMealThumb) { this.strMealThumb = strMealThumb; } public String getStrCategory() { return strCategory; } public void setStrCategory(String strCategory) { this.strCategory = strCategory; } public String getStrArea() { return strArea; } public void setStrArea(String strArea) { this.strArea = strArea; } }
2,000
0.626
0.6255
95
20.052631
19.292414
117
false
false
0
0
0
0
0
0
0.389474
false
false
13
6187f299d131db895f0a2da57337804cbf62e3ca
1,468,878,854,668
2f497ab170f89a056ec4c522e710779bd3ee598e
/Sortable.java
bbbecd8d525296361205948a169a53e576a90620
[]
no_license
trevorbrown-school/ads-assign5
https://github.com/trevorbrown-school/ads-assign5
2db61c29854dc2ab902d83f6d2a5cbce59f84154
dd07dea2908c9a34f5ff446d3320477245227ed1
refs/heads/master
2023-01-20T17:56:06.008000
2020-11-25T13:25:57
2020-11-25T13:25:57
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public interface Sortable { public static void sort(int[] arr) { }; }
UTF-8
Java
79
java
Sortable.java
Java
[]
null
[]
public interface Sortable { public static void sort(int[] arr) { }; }
79
0.620253
0.620253
5
14.8
15.942396
40
false
false
0
0
0
0
0
0
0.2
false
false
13
f8a3e337208cb1a2073dd99e3a98f5bff2f38804
9,526,237,530,809
b5b6c5d0e6e5b0ea7a199cb2432f8cd6a54c33b7
/src/main/java/book30/ch07/_4/_2/sqlservice/updatable/SqlUpdateFailureException.java
b1c37ced492a23fc88db1e3eab1e8c3a37bda4b9
[]
no_license
bluebibi/mySpringFrame
https://github.com/bluebibi/mySpringFrame
aa9eec45f57fdcdb99e07e2607aa1f18ecdd7c1e
9db7cb11317784574e0daa1215a5db2f338d105f
refs/heads/master
2016-08-08T12:29:18.909000
2014-11-05T08:09:25
2014-11-05T08:09:25
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package book30.ch07._4._2.sqlservice.updatable; public class SqlUpdateFailureException extends RuntimeException { /** * */ private static final long serialVersionUID = -4765907612657180326L; }
UTF-8
Java
202
java
SqlUpdateFailureException.java
Java
[]
null
[]
package book30.ch07._4._2.sqlservice.updatable; public class SqlUpdateFailureException extends RuntimeException { /** * */ private static final long serialVersionUID = -4765907612657180326L; }
202
0.767327
0.643564
9
21.444445
27.825293
68
false
false
0
0
0
0
0
0
0.666667
false
false
13
20ec32b8258824f2395110821f213c27c1e97f64
37,323,265,837,168
ce31f8de02cfa09892e676a11efb349d3ec9b470
/lib-utils/src/main/java/websiteschema/element/StyleSheet.java
fed7f9119caff467c68ac05771f5cf0724ebace2
[]
no_license
yingrui/websiteschema
https://github.com/yingrui/websiteschema
2582a62701b218a6ccbe889dbd3639a4e9dfed75
329ff626a2331b140ccd97c1c728d76fbfb51dc8
refs/heads/master
2021-01-16T21:16:18.161000
2015-01-21T10:35:09
2015-01-21T10:35:28
28,562,587
2
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package websiteschema.element; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ import java.util.LinkedHashMap; import java.util.Map; /** * * @author ray */ public class StyleSheet { Map<String, Map<String, String>> styles = new LinkedHashMap<String, Map<String, String>>(); public void put(String selector, String rule) { styles.put(selector, wrap(rule)); } public Map<String, String> get(String rule) { return styles.get(rule.toLowerCase()); } private Map<String, String> wrap(String rule) { Map<String, String> ret = new LinkedHashMap<String, String>(); String[] properties = rule.split(";"); for (String property : properties) { String[] pair = property.trim().split(":"); if (pair.length == 2) { ret.put(pair[0].trim(), pair[1].trim()); } } return ret; } }
UTF-8
Java
960
java
StyleSheet.java
Java
[ { "context": "dHashMap;\nimport java.util.Map;\n\n/**\n *\n * @author ray\n */\npublic class StyleSheet {\n\n Map<String, Ma", "end": 210, "score": 0.9347062110900879, "start": 207, "tag": "USERNAME", "value": "ray" } ]
null
[]
package websiteschema.element; /* * To change this template, choose Tools | Templates * and open the template in the editor. */ import java.util.LinkedHashMap; import java.util.Map; /** * * @author ray */ public class StyleSheet { Map<String, Map<String, String>> styles = new LinkedHashMap<String, Map<String, String>>(); public void put(String selector, String rule) { styles.put(selector, wrap(rule)); } public Map<String, String> get(String rule) { return styles.get(rule.toLowerCase()); } private Map<String, String> wrap(String rule) { Map<String, String> ret = new LinkedHashMap<String, String>(); String[] properties = rule.split(";"); for (String property : properties) { String[] pair = property.trim().split(":"); if (pair.length == 2) { ret.put(pair[0].trim(), pair[1].trim()); } } return ret; } }
960
0.59375
0.590625
39
23.615385
24.328537
95
false
false
0
0
0
0
0
0
0.641026
false
false
13
b681c1bf54ba95d919f608a959e01f2e71976b6f
39,616,778,352,485
66b683f37a44a005ebd07cf9ae210dbebf855cc1
/src/main/java/com/messaging/peerNode/PeerNodeHelpers.java
4940d46d1112f26e2c85d08a2cb68279b78c55b4
[]
no_license
christianstefaniw/p2p-network
https://github.com/christianstefaniw/p2p-network
a8085715017c7d3d1bf8a9196d6afab54a5c27e4
09ff83804297a93b8ca72f5f5bcfb42bfc41d586
refs/heads/master
2023-08-15T09:40:02.489000
2021-09-29T21:22:29
2021-09-29T21:22:29
388,902,422
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.messaging.peerNode; import com.messaging.peerNode.stubs.*; import com.messaging.peerNode.stubs.PeerNodeServiceGrpc.PeerNodeServiceBlockingStub; import io.grpc.*; public class PeerNodeHelpers { public static PeerNodeServiceBlockingStub newBlockingStub(ManagedChannel channel) { return PeerNodeServiceGrpc.newBlockingStub(channel); } }
UTF-8
Java
365
java
PeerNodeHelpers.java
Java
[]
null
[]
package com.messaging.peerNode; import com.messaging.peerNode.stubs.*; import com.messaging.peerNode.stubs.PeerNodeServiceGrpc.PeerNodeServiceBlockingStub; import io.grpc.*; public class PeerNodeHelpers { public static PeerNodeServiceBlockingStub newBlockingStub(ManagedChannel channel) { return PeerNodeServiceGrpc.newBlockingStub(channel); } }
365
0.808219
0.808219
12
29.416666
30.90431
87
false
false
0
0
0
0
0
0
0.416667
false
false
13
3e42c44ffcd495f8f650d627582fa55de1dc2a3c
163,208,824,120
4575bf4dccc45f0527290d212e37e47f7bc4033e
/src/main/java/io/servertap/api/v1/models/Balance.java
bfb0a9a99a555ec65b50c4aa0eda194ac77937fd
[]
no_license
2b2tau/ServerAPI
https://github.com/2b2tau/ServerAPI
5b1c8c206b6158d985ef94b36b2c699416148fb1
4835a6a3339678c4bdb76ed7dcc07bbba2c684a0
refs/heads/master
2023-04-29T23:32:06.124000
2023-01-30T13:13:37
2023-01-30T13:13:37
367,114,245
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package io.servertap.api.v1.models; import lombok.Getter; import lombok.Setter; import me.clip.placeholderapi.libs.gson.annotations.Expose; public class Balance { @Expose @Getter @Setter private int wallet; @Expose @Getter @Setter private int costs; @Expose @Getter @Setter private String currency; @Expose @Getter @Setter private String month; }
UTF-8
Java
418
java
Balance.java
Java
[]
null
[]
package io.servertap.api.v1.models; import lombok.Getter; import lombok.Setter; import me.clip.placeholderapi.libs.gson.annotations.Expose; public class Balance { @Expose @Getter @Setter private int wallet; @Expose @Getter @Setter private int costs; @Expose @Getter @Setter private String currency; @Expose @Getter @Setter private String month; }
418
0.660287
0.657895
29
13.413794
12.769893
59
false
false
0
0
0
0
0
0
0.275862
false
false
13
16f6c49363a1a3727c58cba3ab32f97823cb5777
6,073,083,761,156
9e039b9ad4dae2c7f4ef092ca95f3b61c82abc1b
/homework-g595-murzin/src/main/java/ru/mipt/java2016/homework/g595/murzin/task2/SerializationStrategy.java
6d5f4f341df8d9394785606f41b9a6d0f0f85866
[]
no_license
DanAnastasyev/mipt-java-2016
https://github.com/DanAnastasyev/mipt-java-2016
80e1484c4cc0abcf4714fcd3ab344c7676df5dea
fbb6099f3b8a4b8695e249c6de4de47ef6c528cd
refs/heads/master
2021-05-04T08:18:12.319000
2016-12-28T21:50:48
2016-12-28T21:50:48
70,343,099
3
0
null
true
2016-10-08T16:14:59
2016-10-08T16:14:59
2016-10-08T15:45:19
2016-10-08T15:57:41
45
0
0
0
null
null
null
package ru.mipt.java2016.homework.g595.murzin.task2; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; /** * Created by ะ”ะผะธั‚ั€ะธะน ะœัƒั€ะทะธะฝ on 24.10.16. */ public interface SerializationStrategy<Value> { /** * ะ—ะฐะฟะธัะฐั‚ัŒ ัะตั€ะธะฐะปะธะทะพะฒะฐะฝะฝะพะต ะทะฝะฐั‡ะตะฝะธะต ะฒ ะฟะพั‚ะพะบ */ void serializeToStream(Value value, DataOutputStream output) throws IOException; /** * ะŸั€ะพั‡ะตัั‚ัŒ ัะตั€ะธะฐะปะธะทะพะฒะฐะฝะฝะพะต ะทะฝะฐั‡ะตะฝะธะต ะธะท ั‚ะตะบัƒั‰ะตะณะพ ะผะตัั‚ะฐ ะฒ ะฟะพั‚ะพะบะต */ Value deserializeFromStream(DataInputStream input) throws IOException; SerializationStrategy<String> FOR_STRING = new SerializationStrategy<String>() { @Override public void serializeToStream(String s, DataOutputStream output) throws IOException { output.writeUTF(s); } @Override public String deserializeFromStream(DataInputStream input) throws IOException { return input.readUTF(); } }; SerializationStrategy<Integer> FOR_INTEGER = new SerializationStrategy<Integer>() { @Override public void serializeToStream(Integer integer, DataOutputStream output) throws IOException { output.writeInt(integer); } @Override public Integer deserializeFromStream(DataInputStream input) throws IOException { return input.readInt(); } }; SerializationStrategy<Double> FOR_DOUBLE = new SerializationStrategy<Double>() { @Override public void serializeToStream(Double value, DataOutputStream output) throws IOException { output.writeDouble(value); } @Override public Double deserializeFromStream(DataInputStream input) throws IOException { return input.readDouble(); } }; }
UTF-8
Java
1,893
java
SerializationStrategy.java
Java
[ { "context": "am;\nimport java.io.IOException;\n\n/**\n * Created by ะ”ะผะธั‚ั€ะธะน ะœัƒั€ะทะธะฝ on 24.10.16.\n */\npublic interface SerializationSt", "end": 180, "score": 0.9998958110809326, "start": 166, "tag": "NAME", "value": "ะ”ะผะธั‚ั€ะธะน ะœัƒั€ะทะธะฝ" } ]
null
[]
package ru.mipt.java2016.homework.g595.murzin.task2; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.IOException; /** * Created by <NAME> on 24.10.16. */ public interface SerializationStrategy<Value> { /** * ะ—ะฐะฟะธัะฐั‚ัŒ ัะตั€ะธะฐะปะธะทะพะฒะฐะฝะฝะพะต ะทะฝะฐั‡ะตะฝะธะต ะฒ ะฟะพั‚ะพะบ */ void serializeToStream(Value value, DataOutputStream output) throws IOException; /** * ะŸั€ะพั‡ะตัั‚ัŒ ัะตั€ะธะฐะปะธะทะพะฒะฐะฝะฝะพะต ะทะฝะฐั‡ะตะฝะธะต ะธะท ั‚ะตะบัƒั‰ะตะณะพ ะผะตัั‚ะฐ ะฒ ะฟะพั‚ะพะบะต */ Value deserializeFromStream(DataInputStream input) throws IOException; SerializationStrategy<String> FOR_STRING = new SerializationStrategy<String>() { @Override public void serializeToStream(String s, DataOutputStream output) throws IOException { output.writeUTF(s); } @Override public String deserializeFromStream(DataInputStream input) throws IOException { return input.readUTF(); } }; SerializationStrategy<Integer> FOR_INTEGER = new SerializationStrategy<Integer>() { @Override public void serializeToStream(Integer integer, DataOutputStream output) throws IOException { output.writeInt(integer); } @Override public Integer deserializeFromStream(DataInputStream input) throws IOException { return input.readInt(); } }; SerializationStrategy<Double> FOR_DOUBLE = new SerializationStrategy<Double>() { @Override public void serializeToStream(Double value, DataOutputStream output) throws IOException { output.writeDouble(value); } @Override public Double deserializeFromStream(DataInputStream input) throws IOException { return input.readDouble(); } }; }
1,872
0.682123
0.674302
57
30.403509
32.111572
100
false
false
0
0
0
0
0
0
0.333333
false
false
13
e513a1e5d41f1f5d0d9ba67e71cd53ef62e667cf
26,783,416,123,346
1129c8cb1506ef041c917d5aa62f18cdddebd104
/linkedList/palindromeLinkedList.java
20e6594a00bfa903c70c13e278c04f50ca6a5cc3
[]
no_license
AkashBalani/LeetcodePr
https://github.com/AkashBalani/LeetcodePr
fac62f2bf74c79f5dc05edc4f13b5136b4e26b45
5b91270bbcc5b277a31ae82952b0e1c36c06b28b
refs/heads/master
2023-06-03T03:10:59.030000
2021-06-16T04:42:42
2021-06-16T04:42:42
227,236,635
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.ArrayList; import java.util.List; class Solution{ public boolean isPalindrome(ListNode head){ List<Integer> list = new ArrayList<>(); ListNode current = head; while(current != null){ list.add(current.val); current = current.next; } int front = 0; int back = list.size() - 1; while(front < back){ if(!list.get(front).equals(list.get(back))) return false; front++; back--; } return true; } } // Advanced Solution class Solution1{ ListNode front; public boolean isPalindrome(ListNode head){ front = head; return recursively(front); } public boolean recursively(ListNode current){ if(current != null){ if(!recursively(current.next)) return false; if(current.val != front.val) return false; current = current.next; } return true; } } // More Advanced class Solution { public boolean isPalindrome(ListNode head) { if (head == null) return true; // Find the end of first half and reverse second half. ListNode firstHalfEnd = endOfFirstHalf(head); ListNode secondHalfStart = reverseList(firstHalfEnd.next); // Check whether or not there is a palindrome. ListNode p1 = head; ListNode p2 = secondHalfStart; boolean result = true; while (result && p2 != null) { if (p1.val != p2.val) result = false; p1 = p1.next; p2 = p2.next; } // Restore the list and return the result. firstHalfEnd.next = reverseList(secondHalfStart); return result; } // Taken from https://leetcode.com/problems/reverse-linked-list/solution/ private ListNode reverseList(ListNode head) { ListNode prev = null; ListNode curr = head; while (curr != null) { ListNode nextTemp = curr.next; curr.next = prev; prev = curr; curr = nextTemp; } return prev; } private ListNode endOfFirstHalf(ListNode head) { ListNode fast = head; ListNode slow = head; while (fast.next != null && fast.next.next != null) { fast = fast.next.next; slow = slow.next; } return slow; } } class Solution3 { public static boolean isPalindrome(ListNode head){ ListNode slow = head; ListNode fast = head; while(fast != null && fast.next != null){ fast = fast.next.next; slow = slow.next; } slow = reverse(slow); fast = head; while(slow != null){ if(fast.val != slow.val) return false; slow = slow.next; fast = fast.next; } return true; } public static ListNode reverse(ListNode head){ ListNode prev = null; while(head != null){ ListNode next = head.next; head.next = prev; prev = head; head = next; } return prev; } }
UTF-8
Java
3,178
java
palindromeLinkedList.java
Java
[]
null
[]
import java.util.ArrayList; import java.util.List; class Solution{ public boolean isPalindrome(ListNode head){ List<Integer> list = new ArrayList<>(); ListNode current = head; while(current != null){ list.add(current.val); current = current.next; } int front = 0; int back = list.size() - 1; while(front < back){ if(!list.get(front).equals(list.get(back))) return false; front++; back--; } return true; } } // Advanced Solution class Solution1{ ListNode front; public boolean isPalindrome(ListNode head){ front = head; return recursively(front); } public boolean recursively(ListNode current){ if(current != null){ if(!recursively(current.next)) return false; if(current.val != front.val) return false; current = current.next; } return true; } } // More Advanced class Solution { public boolean isPalindrome(ListNode head) { if (head == null) return true; // Find the end of first half and reverse second half. ListNode firstHalfEnd = endOfFirstHalf(head); ListNode secondHalfStart = reverseList(firstHalfEnd.next); // Check whether or not there is a palindrome. ListNode p1 = head; ListNode p2 = secondHalfStart; boolean result = true; while (result && p2 != null) { if (p1.val != p2.val) result = false; p1 = p1.next; p2 = p2.next; } // Restore the list and return the result. firstHalfEnd.next = reverseList(secondHalfStart); return result; } // Taken from https://leetcode.com/problems/reverse-linked-list/solution/ private ListNode reverseList(ListNode head) { ListNode prev = null; ListNode curr = head; while (curr != null) { ListNode nextTemp = curr.next; curr.next = prev; prev = curr; curr = nextTemp; } return prev; } private ListNode endOfFirstHalf(ListNode head) { ListNode fast = head; ListNode slow = head; while (fast.next != null && fast.next.next != null) { fast = fast.next.next; slow = slow.next; } return slow; } } class Solution3 { public static boolean isPalindrome(ListNode head){ ListNode slow = head; ListNode fast = head; while(fast != null && fast.next != null){ fast = fast.next.next; slow = slow.next; } slow = reverse(slow); fast = head; while(slow != null){ if(fast.val != slow.val) return false; slow = slow.next; fast = fast.next; } return true; } public static ListNode reverse(ListNode head){ ListNode prev = null; while(head != null){ ListNode next = head.next; head.next = prev; prev = head; head = next; } return prev; } }
3,178
0.536501
0.53241
119
25.714285
17.54904
77
false
false
0
0
0
0
0
0
0.487395
false
false
13
e304951d98d5166bc3620a8163919bf632ab648c
26,783,416,123,318
3f7edab2e31b6cd2f9c59b6feabc8e15c3f57c26
/core/src/onion/szxb74om7zsmd2jm/limitlesslabyrinth/mechanics/MusicDirector.java
219df88f72aca09c1f506efd13fd0dc498f111da
[]
no_license
ErikTheCleric/OVERSTORY
https://github.com/ErikTheCleric/OVERSTORY
dc128ab68714d437b597da18ce1e93f47fc2f436
8274b447a6799c05de09c6d51f9eec98629eac76
refs/heads/master
2021-05-15T14:40:50.259000
2017-10-17T19:30:35
2017-10-17T19:30:35
107,324,921
0
0
null
true
2017-10-17T21:16:03
2017-10-17T21:16:03
2017-10-17T18:58:00
2017-10-17T19:34:37
155,147
0
0
0
null
null
null
package onion.szxb74om7zsmd2jm.limitlesslabyrinth.mechanics; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.audio.Music; import com.badlogic.gdx.audio.Sound; /** * Created by 226864 on 3/28/2017. */ public class MusicDirector { public MusicDirector(SoundName sn) { currentSound = sn; } public MusicDirector(SongName s) { currentSong = s; } public static enum SongName { MEGALOVANIA, SONIC06, ONEONESEVEN, SUPERSANIC } public static enum SoundName { PLAYERHIT } static Music megalovania = Gdx.audio.newMusic(Gdx.files.internal("Megalovania/Undertale.mp3")); static Music sanic = Gdx.audio.newMusic(Gdx.files.internal("Megalovania/Sanic.mp3")); static Music UnoUnoSiete = Gdx.audio.newMusic(Gdx.files.internal("Megalovania/117.mp3")); static Music supersanic = Gdx.audio.newMusic(Gdx.files.internal("Megalovania/GOTTAGOFEST.mp3")); static Sound weaponFire = Gdx.audio.newSound(Gdx.files.internal("Megalovania/memes.mp3")); static Sound playerhit; SongName currentSong; Music nowPlaying; SoundName currentSound; Sound soundPlaying; public void setNowPlaying(SongName s) { currentSong = s; } private void setSoundNowPlaying(SoundName sn) { currentSound = sn; } public void playSound(SoundName sn) { this.setSoundNowPlaying(sn); switch (currentSound) { case PLAYERHIT: soundPlaying = weaponFire; } soundPlaying.play(); } public void play() { switch (currentSong) { case MEGALOVANIA: nowPlaying = megalovania; break; case SONIC06: nowPlaying = sanic; break; case ONEONESEVEN: nowPlaying = UnoUnoSiete; break; case SUPERSANIC: nowPlaying = supersanic; break; } nowPlaying.play(); nowPlaying.setLooping(true); } public void stop() { nowPlaying.stop(); } public void switchSong(SongName s) { this.setNowPlaying(s); if(this.nowPlaying.isPlaying()) { this.stop(); } this.play(); } }
UTF-8
Java
2,331
java
MusicDirector.java
Java
[ { "context": " com.badlogic.gdx.audio.Sound;\n\n/**\n * Created by 226864 on 3/28/2017.\n */\npublic class MusicDirector {\n ", "end": 190, "score": 0.9959822297096252, "start": 184, "tag": "USERNAME", "value": "226864" } ]
null
[]
package onion.szxb74om7zsmd2jm.limitlesslabyrinth.mechanics; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.audio.Music; import com.badlogic.gdx.audio.Sound; /** * Created by 226864 on 3/28/2017. */ public class MusicDirector { public MusicDirector(SoundName sn) { currentSound = sn; } public MusicDirector(SongName s) { currentSong = s; } public static enum SongName { MEGALOVANIA, SONIC06, ONEONESEVEN, SUPERSANIC } public static enum SoundName { PLAYERHIT } static Music megalovania = Gdx.audio.newMusic(Gdx.files.internal("Megalovania/Undertale.mp3")); static Music sanic = Gdx.audio.newMusic(Gdx.files.internal("Megalovania/Sanic.mp3")); static Music UnoUnoSiete = Gdx.audio.newMusic(Gdx.files.internal("Megalovania/117.mp3")); static Music supersanic = Gdx.audio.newMusic(Gdx.files.internal("Megalovania/GOTTAGOFEST.mp3")); static Sound weaponFire = Gdx.audio.newSound(Gdx.files.internal("Megalovania/memes.mp3")); static Sound playerhit; SongName currentSong; Music nowPlaying; SoundName currentSound; Sound soundPlaying; public void setNowPlaying(SongName s) { currentSong = s; } private void setSoundNowPlaying(SoundName sn) { currentSound = sn; } public void playSound(SoundName sn) { this.setSoundNowPlaying(sn); switch (currentSound) { case PLAYERHIT: soundPlaying = weaponFire; } soundPlaying.play(); } public void play() { switch (currentSong) { case MEGALOVANIA: nowPlaying = megalovania; break; case SONIC06: nowPlaying = sanic; break; case ONEONESEVEN: nowPlaying = UnoUnoSiete; break; case SUPERSANIC: nowPlaying = supersanic; break; } nowPlaying.play(); nowPlaying.setLooping(true); } public void stop() { nowPlaying.stop(); } public void switchSong(SongName s) { this.setNowPlaying(s); if(this.nowPlaying.isPlaying()) { this.stop(); } this.play(); } }
2,331
0.592879
0.580438
97
23.030928
22.562836
100
false
false
0
0
0
0
0
0
0.391753
false
false
13
35c91827176800a5a77dd9576a4086d36f6434e0
14,474,039,789,270
c3ed79907f56c8848bd06bc006125cc9439b1668
/src/main/java/com/tr/mita/org/model/Company.java
3e593dff76f94963015584c2854fad97403e3927
[]
no_license
lk8808/mita
https://github.com/lk8808/mita
3c41b2d10ea4253dde3a64194ae5809abcbcac72
0bbe9e2bf0a3931bb3168b29cc1e2f9e382cd964
refs/heads/master
2023-02-20T21:47:40.806000
2021-01-25T02:47:36
2021-01-25T02:47:36
324,038,805
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.tr.mita.org.model; import java.util.Date; public class Company { private Long id; private String compname; private String workphone; private String tax; private String email; private String address; private String postcode; private String website; private Date createtime; private String delflag; private String gps; private String dsname; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getCompname() { return compname; } public void setCompname(String compname) { this.compname = compname == null ? null : compname.trim(); } public String getWorkphone() { return workphone; } public void setWorkphone(String workphone) { this.workphone = workphone == null ? null : workphone.trim(); } public String getTax() { return tax; } public void setTax(String tax) { this.tax = tax == null ? null : tax.trim(); } public String getEmail() { return email; } public void setEmail(String email) { this.email = email == null ? null : email.trim(); } public String getAddress() { return address; } public void setAddress(String address) { this.address = address == null ? null : address.trim(); } public String getPostcode() { return postcode; } public void setPostcode(String postcode) { this.postcode = postcode == null ? null : postcode.trim(); } public String getWebsite() { return website; } public void setWebsite(String website) { this.website = website == null ? null : website.trim(); } public Date getCreatetime() { return createtime; } public void setCreatetime(Date createtime) { this.createtime = createtime; } public String getDelflag() { return delflag; } public void setDelflag(String delflag) { this.delflag = delflag == null ? null : delflag.trim(); } public String getGps() { return gps; } public void setGps(String gps) { this.gps = gps == null ? null : gps.trim(); } public String getDsname() { return dsname; } public void setDsname(String dsname) { this.dsname = dsname == null ? null : dsname.trim(); } }
UTF-8
Java
2,441
java
Company.java
Java
[]
null
[]
package com.tr.mita.org.model; import java.util.Date; public class Company { private Long id; private String compname; private String workphone; private String tax; private String email; private String address; private String postcode; private String website; private Date createtime; private String delflag; private String gps; private String dsname; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getCompname() { return compname; } public void setCompname(String compname) { this.compname = compname == null ? null : compname.trim(); } public String getWorkphone() { return workphone; } public void setWorkphone(String workphone) { this.workphone = workphone == null ? null : workphone.trim(); } public String getTax() { return tax; } public void setTax(String tax) { this.tax = tax == null ? null : tax.trim(); } public String getEmail() { return email; } public void setEmail(String email) { this.email = email == null ? null : email.trim(); } public String getAddress() { return address; } public void setAddress(String address) { this.address = address == null ? null : address.trim(); } public String getPostcode() { return postcode; } public void setPostcode(String postcode) { this.postcode = postcode == null ? null : postcode.trim(); } public String getWebsite() { return website; } public void setWebsite(String website) { this.website = website == null ? null : website.trim(); } public Date getCreatetime() { return createtime; } public void setCreatetime(Date createtime) { this.createtime = createtime; } public String getDelflag() { return delflag; } public void setDelflag(String delflag) { this.delflag = delflag == null ? null : delflag.trim(); } public String getGps() { return gps; } public void setGps(String gps) { this.gps = gps == null ? null : gps.trim(); } public String getDsname() { return dsname; } public void setDsname(String dsname) { this.dsname = dsname == null ? null : dsname.trim(); } }
2,441
0.589922
0.589922
125
18.535999
19.201893
69
false
false
0
0
0
0
0
0
0.304
false
false
13
878f434616d7338eac1689abafb6af8621deb595
25,701,084,367,856
9aba8e572243791af5ffa25385c21294fbb8016f
/Teach Yourself Java/ControlStatement/CountDigitLetter2.java
0469e2ec5fc4986faa95c3ada1c981a8c637ed06
[]
no_license
pratikv06/Java
https://github.com/pratikv06/Java
930ea105a42abd4ce9d0253d3a253fd69bc5ada8
ebe8a7c41c828c2a961755671b2bef19d4ebac55
refs/heads/master
2020-12-12T01:19:30.364000
2020-02-08T10:10:06
2020-02-08T10:10:06
231,201,946
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Program: * Accept one command line argument, * count the number of digits and letter in that string, * and display that values */ class CountDigitLetter { public static void main(String[] args) { int letter = 0; int digit = 0; for(int i=0; i< args[0].length(); i++){ char ch = args[0].charAt(i); if(Character.isDigit(ch)) digit++; else if(Character.isLetter(ch)) letter++; } System.out.println("There are "+ digit +" digits"); System.out.println("There are "+ letter +" letters"); } }
UTF-8
Java
590
java
CountDigitLetter2.java
Java
[]
null
[]
/** * Program: * Accept one command line argument, * count the number of digits and letter in that string, * and display that values */ class CountDigitLetter { public static void main(String[] args) { int letter = 0; int digit = 0; for(int i=0; i< args[0].length(); i++){ char ch = args[0].charAt(i); if(Character.isDigit(ch)) digit++; else if(Character.isLetter(ch)) letter++; } System.out.println("There are "+ digit +" digits"); System.out.println("There are "+ letter +" letters"); } }
590
0.567797
0.559322
23
24.695652
18.965494
59
false
false
0
0
0
0
0
0
0.478261
false
false
13
a1b1a16c100a47a9232e04c2a1a4e48fc41ccab7
6,167,573,040,277
3833cb2afce24ca7cc04de73be72f9c9ee36dd5a
/Dot Bridge/core/src/com/pebblegamesindustry/Actors/GameScreenActors/UniversalScreenActors/SolutionActors/SolutionBulbTempExplosion.java
3b8bf9f82581b424163357900a7970a87e72f49a
[]
no_license
CraigLangford/Game-Projects
https://github.com/CraigLangford/Game-Projects
f23869d14e726569a1eddd44fbb349f75efd06df
5def1a679b59da2772140b3f5fb6a1a2f5a46953
refs/heads/master
2016-09-23T05:34:35.457000
2016-07-06T02:49:16
2016-07-06T02:49:16
62,673,869
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.pebblegamesindustry.Actors.GameScreenActors.UniversalScreenActors.SolutionActors; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.g2d.ParticleEffect; import com.pebblegamesindustry.Actors.GameScreenActors.FirstPackActors.FirstPackLevelCompleteActors.LevelCompleteLabel; /** * Created by Craig on 3/21/2016. */ public class SolutionBulbTempExplosion extends ParticleEffect { public SolutionBulbTempExplosion(SolutionBulbTemp bulb) { super(); load(Gdx.files.internal("data/effects/light-bulb.p"), Gdx.files.internal("data/effects")); setPosition(bulb.getX() + bulb.getWidth()/2, bulb.getY()+bulb.getHeight()/2); scaleEffect(bulb.getWidth() / 150); start(); } }
UTF-8
Java
739
java
SolutionBulbTempExplosion.java
Java
[ { "context": "pleteActors.LevelCompleteLabel;\n\n/**\n * Created by Craig on 3/21/2016.\n */\npublic class SolutionBulbTempEx", "end": 321, "score": 0.9929028749465942, "start": 316, "tag": "NAME", "value": "Craig" } ]
null
[]
package com.pebblegamesindustry.Actors.GameScreenActors.UniversalScreenActors.SolutionActors; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.graphics.g2d.ParticleEffect; import com.pebblegamesindustry.Actors.GameScreenActors.FirstPackActors.FirstPackLevelCompleteActors.LevelCompleteLabel; /** * Created by Craig on 3/21/2016. */ public class SolutionBulbTempExplosion extends ParticleEffect { public SolutionBulbTempExplosion(SolutionBulbTemp bulb) { super(); load(Gdx.files.internal("data/effects/light-bulb.p"), Gdx.files.internal("data/effects")); setPosition(bulb.getX() + bulb.getWidth()/2, bulb.getY()+bulb.getHeight()/2); scaleEffect(bulb.getWidth() / 150); start(); } }
739
0.749662
0.73207
20
35.950001
37.724628
119
false
false
0
0
0
0
0
0
0.55
false
false
13
9bd5c7fcc25546d566523a77ab72828f2245ea13
3,298,534,947,849
4d74ea7260f35b75f24c255a7a36f8188373f6ec
/MavenCRMProject/src/test/java/com/scripts/mavencrm/createaccount.java
68b0a3dc4c3292171c9ea5772feeb6455156d9dd
[]
no_license
shraeyakbasu/automationzohocrm
https://github.com/shraeyakbasu/automationzohocrm
23167252e98680989d9c4f9fa620ef42df61c739
74d05ea901e84b1742093357ded3b5e46db49a5c
refs/heads/master
2023-03-25T20:19:10.956000
2021-03-18T17:02:32
2021-03-18T17:02:32
345,745,437
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.scripts.mavencrm; import java.io.IOException; import org.testng.annotations.Listeners; import org.testng.annotations.Test; import com.generics.mavencrm.Basetest; import com.generics.mavencrm.Utility; import com.pages.mavencrm.zohocrmaccountlistpage; import com.pages.mavencrm.zohocrmcreateaccountpage; import com.pages.mavencrm.zohocrmhomepage; @Listeners(Utility.class) public class createaccount extends Basetest { @Test(description = "integration testing between create account page and account list page") public void accountcreate() throws IOException, InterruptedException { zohocrmhomepage zhp=new zohocrmhomepage(driver); zhp.accounts(); zohocrmaccountlistpage zcalp=new zohocrmaccountlistpage(driver); zcalp.newaccountclick(); zohocrmcreateaccountpage zccap=new zohocrmcreateaccountpage(driver); zccap.createaccount(); zhp.accounts(); zcalp.findaccount(); //zcalp.accountclick(); } }
UTF-8
Java
935
java
createaccount.java
Java
[]
null
[]
package com.scripts.mavencrm; import java.io.IOException; import org.testng.annotations.Listeners; import org.testng.annotations.Test; import com.generics.mavencrm.Basetest; import com.generics.mavencrm.Utility; import com.pages.mavencrm.zohocrmaccountlistpage; import com.pages.mavencrm.zohocrmcreateaccountpage; import com.pages.mavencrm.zohocrmhomepage; @Listeners(Utility.class) public class createaccount extends Basetest { @Test(description = "integration testing between create account page and account list page") public void accountcreate() throws IOException, InterruptedException { zohocrmhomepage zhp=new zohocrmhomepage(driver); zhp.accounts(); zohocrmaccountlistpage zcalp=new zohocrmaccountlistpage(driver); zcalp.newaccountclick(); zohocrmcreateaccountpage zccap=new zohocrmcreateaccountpage(driver); zccap.createaccount(); zhp.accounts(); zcalp.findaccount(); //zcalp.accountclick(); } }
935
0.807487
0.807487
32
28.21875
24.42173
93
false
false
0
0
0
0
0
0
1.34375
false
false
13
3065ad77453c296514069dddcb776fceacc8f3e5
30,425,548,340,425
008cea92adc7f17984b8572f96ff89967a033980
/CRM/web-common/src/main/java/com/liuhy/crm/thisapply/Son.java
c7172cd7ab7533cfed18a844f792b528e8f38e25
[]
no_license
sadicLiu/CRM
https://github.com/sadicLiu/CRM
357742c0986af22aa3d59b94c188cceab876cc55
40acbe63351a639f2c3ef5301b6a0ec420d4f669
refs/heads/master
2021-01-21T05:29:02.986000
2017-03-10T08:30:33
2017-03-10T08:30:33
83,195,110
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.liuhy.crm.thisapply; public class Son extends Parent { public void init() { super.init(); System.out.println("3 in son"); this.demo(); } public void demo() { System.out.println("4 in son"); } public static void main(String[] args) { Son son = new Son(); /* * ๆ‰ง่กŒ็ป“ๆžœๆ˜ฏ1 4 3 4 * ่ฏดๆ˜ŽthisๆŒ‡ๅ‘็š„ๆ˜ฏๆญฃๅœจ่ฟ่กŒ็š„ๅฏน่ฑก * */ son.init(); } }
UTF-8
Java
469
java
Son.java
Java
[]
null
[]
package com.liuhy.crm.thisapply; public class Son extends Parent { public void init() { super.init(); System.out.println("3 in son"); this.demo(); } public void demo() { System.out.println("4 in son"); } public static void main(String[] args) { Son son = new Son(); /* * ๆ‰ง่กŒ็ป“ๆžœๆ˜ฏ1 4 3 4 * ่ฏดๆ˜ŽthisๆŒ‡ๅ‘็š„ๆ˜ฏๆญฃๅœจ่ฟ่กŒ็š„ๅฏน่ฑก * */ son.init(); } }
469
0.503464
0.489607
23
17.826086
13.914809
44
false
false
0
0
0
0
0
0
0.304348
false
false
13
c131eed5a5dd0c69891d7737414fffa44eb830f3
20,538,533,621,801
08cca5b70e4dc7dbdf0306f8814c71220752d5e2
/src/main/java/util/ExcelUtil.java
7bc3f5b009a75be332c8933dfbc24c7c64bf2c1f
[]
no_license
RadhakrishnanKandasamy/Workspace
https://github.com/RadhakrishnanKandasamy/Workspace
9a29b5e8685e9fd3ba69ae29182cfcffd1e4e121
1cc3231b8340f5ce104f73176b32c39485c24605
refs/heads/master
2022-07-09T04:39:55.754000
2017-10-18T15:59:06
2017-10-18T15:59:06
102,175,727
0
1
null
false
2020-10-13T02:36:25
2017-09-02T05:45:36
2017-10-13T06:46:02
2020-10-13T02:36:24
12
1
1
1
Java
false
false
package util; import java.io.File; import java.io.FileNotFoundException; import java.util.Objects; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook; /** * This class is the utility class for the excel files. To process and * manipulate excel files using the Apache POI library. * * @author sasihan * @since 18-10-2017 * @version 1.0.0 */ public class ExcelUtil { Workbook workbook;// excel workbook object to manipulate with the excel files public ExcelUtil(String fileName) { try { workbook = new XSSFWorkbook(new File(fileName)); } catch (FileNotFoundException f) { System.out.println("FileNotFoundException" + f); } catch (Exception e) { System.out.println("Error while reading the file." + e); } } /** * This method is used to get the workbook object * * @return */ public Workbook getWorkbook() { if (Objects.isNull(workbook)) { System.out.println("Workbook not initialized."); } return workbook; } }
UTF-8
Java
1,009
java
ExcelUtil.java
Java
[ { "context": "files using the Apache POI library.\n * \n * @author sasihan\n * @since 18-10-2017\n * @version 1.0.0\n */\npublic", "end": 351, "score": 0.9984481334686279, "start": 344, "tag": "USERNAME", "value": "sasihan" } ]
null
[]
package util; import java.io.File; import java.io.FileNotFoundException; import java.util.Objects; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook; /** * This class is the utility class for the excel files. To process and * manipulate excel files using the Apache POI library. * * @author sasihan * @since 18-10-2017 * @version 1.0.0 */ public class ExcelUtil { Workbook workbook;// excel workbook object to manipulate with the excel files public ExcelUtil(String fileName) { try { workbook = new XSSFWorkbook(new File(fileName)); } catch (FileNotFoundException f) { System.out.println("FileNotFoundException" + f); } catch (Exception e) { System.out.println("Error while reading the file." + e); } } /** * This method is used to get the workbook object * * @return */ public Workbook getWorkbook() { if (Objects.isNull(workbook)) { System.out.println("Workbook not initialized."); } return workbook; } }
1,009
0.707631
0.696729
45
21.422222
21.974216
78
false
false
0
0
0
0
0
0
1.066667
false
false
13
a4d1a8eb4b58f86186f4887d3af92ef051ba6332
8,065,948,598,343
35fd42c9949f8c7d6b59a093f4892955af1d6322
/src/java/com/jiapengcs/leetcode/easy/No_20.java
6bce4785456982fa6123e584be5205bffc1bc3f0
[]
no_license
jiapengcs/leetcode
https://github.com/jiapengcs/leetcode
a044caadd7c18fea1cd9e24c1256a1ae66f5bd18
9f6ecac233d95c0501038c2e5029b8ab8aa16401
refs/heads/master
2020-12-30T13:40:13.142000
2018-04-17T11:28:38
2018-04-17T11:28:38
91,242,393
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.jiapengcs.leetcode.easy; import java.util.Stack; /** * Created by Jiapeng on 2017/9/6. * * 20. Valid Parentheses * * Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. * The brackets must close in the correct order, "()" and "()[]{}" are all valid but "(]" and "([)]" are not. * * ๅˆ†ๆž๏ผš้‡ๅˆฐๅทฆๆ‹ฌๅทๅ…ฅๆ ˆ๏ผŒ้‡ๅˆฐๅณๆ‹ฌๅทๅˆ™ๅผนๅ‡บๆ ˆ้กถๅ…ƒ็ด ๏ผŒๆฃ€ๆŸฅๆ˜ฏๅฆๅŒน้…ใ€‚ */ public class No_20 { // TC: O(n), SC: O(n) public static boolean isValid(String s) { char[] buf = s.toCharArray(); Stack<Character> stack = new Stack<>(); for (char c : buf) { if (c == '(' || c == '[' || c == '{') { stack.push(c); } else if (stack.empty() || (c == ')' && stack.pop() != '(') || (c == ']' && stack.pop() != '[') || (c == '}' && stack.pop() != '{')) { return false; } } return stack.empty(); } public static void main(String[] args) { System.out.println(isValid("()(){}")); System.out.println(isValid("())({}")); System.out.println(isValid(")(){}")); System.out.println(isValid("()(){")); System.out.println(isValid("")); } }
UTF-8
Java
1,279
java
No_20.java
Java
[ { "context": ".easy;\n\nimport java.util.Stack;\n\n/**\n * Created by Jiapeng on 2017/9/6.\n *\n * 20. Valid Parentheses\n *\n * Gi", "end": 88, "score": 0.9990526437759399, "start": 81, "tag": "NAME", "value": "Jiapeng" } ]
null
[]
package com.jiapengcs.leetcode.easy; import java.util.Stack; /** * Created by Jiapeng on 2017/9/6. * * 20. Valid Parentheses * * Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. * The brackets must close in the correct order, "()" and "()[]{}" are all valid but "(]" and "([)]" are not. * * ๅˆ†ๆž๏ผš้‡ๅˆฐๅทฆๆ‹ฌๅทๅ…ฅๆ ˆ๏ผŒ้‡ๅˆฐๅณๆ‹ฌๅทๅˆ™ๅผนๅ‡บๆ ˆ้กถๅ…ƒ็ด ๏ผŒๆฃ€ๆŸฅๆ˜ฏๅฆๅŒน้…ใ€‚ */ public class No_20 { // TC: O(n), SC: O(n) public static boolean isValid(String s) { char[] buf = s.toCharArray(); Stack<Character> stack = new Stack<>(); for (char c : buf) { if (c == '(' || c == '[' || c == '{') { stack.push(c); } else if (stack.empty() || (c == ')' && stack.pop() != '(') || (c == ']' && stack.pop() != '[') || (c == '}' && stack.pop() != '{')) { return false; } } return stack.empty(); } public static void main(String[] args) { System.out.println(isValid("()(){}")); System.out.println(isValid("())({}")); System.out.println(isValid(")(){}")); System.out.println(isValid("()(){")); System.out.println(isValid("")); } }
1,279
0.492194
0.483977
37
31.891891
32.86153
147
false
false
0
0
0
0
0
0
0.783784
false
false
13
46e74697a6dcc52cdfa74f04951110e1a74ee303
10,522,669,886,814
947d2e4a8e419bce457a1f42306023784de160cb
/app/src/main/java/com/marioprieto/biopassword/MainActivity.java
e6cece25f4f2e7986364a0e7890ef38faee1e7a2
[]
no_license
Mariops99/BioPassword
https://github.com/Mariops99/BioPassword
1b6c546b805183fc38418c30fb6d48f5973bf90a
8e79b0306adf7541ea2b7d26bce42cba41aa60e2
refs/heads/master
2023-01-23T22:33:43.820000
2020-12-08T00:47:53
2020-12-08T00:47:53
316,736,975
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.marioprieto.biopassword; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.biometric.BiometricManager; import androidx.biometric.BiometricPrompt; import androidx.core.content.ContextCompat; import android.app.ActionBar; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.widget.ImageView; import android.widget.Toast; import java.util.concurrent.Executor; public class MainActivity extends AppCompatActivity { private ImageView fingerPrint; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getSupportActionBar().hide(); setContentView(R.layout.activity_main); //Biometric Manager -- Used to know if fingerprint hardware is avaliable BiometricManager biometricManager = BiometricManager.from(this); switch (biometricManager.canAuthenticate()) { case BiometricManager.BIOMETRIC_SUCCESS: break; case BiometricManager.BIOMETRIC_ERROR_NO_HARDWARE: break; case BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE: break; case BiometricManager.BIOMETRIC_ERROR_NONE_ENROLLED: break; } Executor executor = ContextCompat.getMainExecutor(this); final BiometricPrompt biometricPrompt = new BiometricPrompt(MainActivity.this,executor,new BiometricPrompt.AuthenticationCallback(){ @Override public void onAuthenticationError(int errorCode, @NonNull CharSequence errString) { super.onAuthenticationError(errorCode, errString); } @Override public void onAuthenticationSucceeded(@NonNull BiometricPrompt.AuthenticationResult result) { super.onAuthenticationSucceeded(result); Intent intent = new Intent(MainActivity.this, ViewPasswords.class); startActivity(intent); } @Override public void onAuthenticationFailed() { super.onAuthenticationFailed(); } }); final BiometricPrompt.PromptInfo promptInfo = new BiometricPrompt.PromptInfo.Builder() .setTitle(getString(R.string.PromptTitle)) .setSubtitle(getString(R.string.PromptSubtitle)) .setDescription(getString(R.string.PromptDescription)) .setNegativeButtonText(getString(R.string.PromptNegative)) .build(); fingerPrint = (ImageView) findViewById(R.id.fingerPrint); fingerPrint.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { biometricPrompt.authenticate(promptInfo); } }); } }
UTF-8
Java
3,035
java
MainActivity.java
Java
[]
null
[]
package com.marioprieto.biopassword; import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.biometric.BiometricManager; import androidx.biometric.BiometricPrompt; import androidx.core.content.ContextCompat; import android.app.ActionBar; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.view.Window; import android.view.WindowManager; import android.widget.ImageView; import android.widget.Toast; import java.util.concurrent.Executor; public class MainActivity extends AppCompatActivity { private ImageView fingerPrint; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getSupportActionBar().hide(); setContentView(R.layout.activity_main); //Biometric Manager -- Used to know if fingerprint hardware is avaliable BiometricManager biometricManager = BiometricManager.from(this); switch (biometricManager.canAuthenticate()) { case BiometricManager.BIOMETRIC_SUCCESS: break; case BiometricManager.BIOMETRIC_ERROR_NO_HARDWARE: break; case BiometricManager.BIOMETRIC_ERROR_HW_UNAVAILABLE: break; case BiometricManager.BIOMETRIC_ERROR_NONE_ENROLLED: break; } Executor executor = ContextCompat.getMainExecutor(this); final BiometricPrompt biometricPrompt = new BiometricPrompt(MainActivity.this,executor,new BiometricPrompt.AuthenticationCallback(){ @Override public void onAuthenticationError(int errorCode, @NonNull CharSequence errString) { super.onAuthenticationError(errorCode, errString); } @Override public void onAuthenticationSucceeded(@NonNull BiometricPrompt.AuthenticationResult result) { super.onAuthenticationSucceeded(result); Intent intent = new Intent(MainActivity.this, ViewPasswords.class); startActivity(intent); } @Override public void onAuthenticationFailed() { super.onAuthenticationFailed(); } }); final BiometricPrompt.PromptInfo promptInfo = new BiometricPrompt.PromptInfo.Builder() .setTitle(getString(R.string.PromptTitle)) .setSubtitle(getString(R.string.PromptSubtitle)) .setDescription(getString(R.string.PromptDescription)) .setNegativeButtonText(getString(R.string.PromptNegative)) .build(); fingerPrint = (ImageView) findViewById(R.id.fingerPrint); fingerPrint.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { biometricPrompt.authenticate(promptInfo); } }); } }
3,035
0.675453
0.675453
84
35.130951
28.999088
140
false
false
0
0
0
0
0
0
0.5
false
false
13
0599c884ec80ce3539b4bcef9c942ff031fce705
24,386,824,308,256
c92a5494926e79be7ef60137b5212970226eb346
/EventQ.java
343eba59420e882351d0d0f83aea5695b3f3d7c5
[]
no_license
mittalgyati025/Hospital_Simulation
https://github.com/mittalgyati025/Hospital_Simulation
ad5321c8f3dee1daf10c102ca6ebe10c9e4baafc
eeeb838caeba7154e21d392e6dca3c475d912dc8
refs/heads/main
2023-07-15T04:13:01.293000
2021-08-19T04:56:58
2021-08-19T04:56:58
397,819,614
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.Vector; public class EventQ { Vector<Event> evQ = new Vector<Event>(); /** * To get the vector queue * @return */ public Event getfirstevent() { if (evQ.size()>0) { return (Event) evQ.elementAt(0) ; } return null; } public Event getithevent(int i) { if (evQ.size()>0) { return (Event) evQ.elementAt(i) ; } return null; } public int getsize() { if (evQ.size()>0) { return (int) evQ.size() ; } return 0; } //Just a simple add function to add end or other events public void addEvent(Event evAdd) { if(evAdd.objsType.equalsIgnoreCase("end")) { evQ.add(evAdd); } else if (evQ.size()>0) { double time = evAdd.objdTime; for(int i = 0; i < evQ.size(); i++ ) { Event ev = (Event) evQ.elementAt(i); if(time < ev.objdTime) { evQ.insertElementAt(evAdd, i); break; } } } else { evQ.add(0,evAdd); } } public void eraseEvent() { this.evQ.removeElementAt(0); } public void eraseEventAti(int i) { this.evQ.removeElementAt(i); } }
UTF-8
Java
1,036
java
EventQ.java
Java
[]
null
[]
import java.util.Vector; public class EventQ { Vector<Event> evQ = new Vector<Event>(); /** * To get the vector queue * @return */ public Event getfirstevent() { if (evQ.size()>0) { return (Event) evQ.elementAt(0) ; } return null; } public Event getithevent(int i) { if (evQ.size()>0) { return (Event) evQ.elementAt(i) ; } return null; } public int getsize() { if (evQ.size()>0) { return (int) evQ.size() ; } return 0; } //Just a simple add function to add end or other events public void addEvent(Event evAdd) { if(evAdd.objsType.equalsIgnoreCase("end")) { evQ.add(evAdd); } else if (evQ.size()>0) { double time = evAdd.objdTime; for(int i = 0; i < evQ.size(); i++ ) { Event ev = (Event) evQ.elementAt(i); if(time < ev.objdTime) { evQ.insertElementAt(evAdd, i); break; } } } else { evQ.add(0,evAdd); } } public void eraseEvent() { this.evQ.removeElementAt(0); } public void eraseEventAti(int i) { this.evQ.removeElementAt(i); } }
1,036
0.604247
0.59556
72
13.402778
14.191801
55
false
false
0
0
0
0
0
0
1.472222
false
false
13
e8a20c1c330df1db62c73797587c4a36b8e38cb9
12,060,268,204,192
ebbeccc9152daa7f931bd128da8101fef2e21997
/PSP_ChatCliente/src/psp_chatcliente/PSP_ChatCliente.java
37f6e93986f9dde53f80ae3df2964eac8d1ab4fa
[]
no_license
adrianbrandariz/PSP_Repositorio
https://github.com/adrianbrandariz/PSP_Repositorio
7fee9c16365362b9ea9be3355dd414a21b88e819
60ceda95e2c0d6c27456c8dfb91c15fcd7ddd220
refs/heads/master
2020-04-05T07:32:32.405000
2019-03-21T15:36:16
2019-03-21T15:36:16
156,679,564
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package psp_chatcliente; import java.io.InputStream; /** * * @author abrandarizdominguez */ public class PSP_ChatCliente { public static void main(String[] args) { GUILogin log = new GUILogin(); log.setVisible(true); } } class RecibirMensaje extends Thread { InputStream is; public RecibirMensaje(InputStream is) { this.is = is; } @Override public void run() { while (true) { GUIChat.control.recibirMensaje(GUIChat.jTexto, GUIChat.textPane); } } }
UTF-8
Java
579
java
PSP_ChatCliente.java
Java
[ { "context": "import java.io.InputStream;\r\n\r\n/**\r\n *\r\n * @author abrandarizdominguez\r\n */\r\npublic class PSP_ChatCliente {\r\n\r\n publi", "end": 98, "score": 0.9654866456985474, "start": 79, "tag": "USERNAME", "value": "abrandarizdominguez" } ]
null
[]
package psp_chatcliente; import java.io.InputStream; /** * * @author abrandarizdominguez */ public class PSP_ChatCliente { public static void main(String[] args) { GUILogin log = new GUILogin(); log.setVisible(true); } } class RecibirMensaje extends Thread { InputStream is; public RecibirMensaje(InputStream is) { this.is = is; } @Override public void run() { while (true) { GUIChat.control.recibirMensaje(GUIChat.jTexto, GUIChat.textPane); } } }
579
0.578584
0.578584
34
15.029411
17.951708
77
false
false
0
0
0
0
0
0
0.235294
false
false
13
f795c12923b54549f19bede6b80f22a1cd900f51
7,653,631,763,475
3de16e95ad14e0a140b10709300b40b72f10a0a9
/Final Examples/src/main/java/DesignPatterns/Decorator/notifications/NotificationSettings.java
07b7b07da7a6492f71b2e1ccfa09e57c8f08b58d
[]
no_license
arealjones/Personal
https://github.com/arealjones/Personal
727ccb21f0a6ffe6bb80496a762e7c09f9dae691
f37d58713040f5806db0f7c638fedd14f2c0eaba
refs/heads/master
2021-05-17T03:20:51.619000
2021-03-04T17:57:24
2021-03-04T17:57:24
250,595,407
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package DesignPatterns.Decorator.notifications; public class NotificationSettings { private boolean emailEnabled; private boolean facebookEnabled; private boolean slackEnabled; private NotificationSettings(Builder builder) { this.emailEnabled = builder.emailEnabled; this.facebookEnabled = builder.facebookEnabled; this.slackEnabled = builder.slackEnabled; } public boolean isEmailEnabled() { return this.emailEnabled; } public boolean isFacebookEnabled() { return this.facebookEnabled; } public boolean isSlackEnabled() { return this.slackEnabled; } public INotification buildNotifier(String message) { INotification notification = new Notification(message); if (this.isEmailEnabled()) notification = new EmailDecorator(notification); if (this.isFacebookEnabled()) notification = new FacebookDecorator(notification); if (this.isSlackEnabled()) notification = new SlackDecorator(notification); return notification; } public static class Builder { private boolean emailEnabled; private boolean facebookEnabled; private boolean slackEnabled; public Builder() { this.emailEnabled = false; this.facebookEnabled = false; this.slackEnabled = false; } public Builder enableEmail() { this.emailEnabled = true; return this; } public Builder enableFacebook() { this.facebookEnabled = true; return this; } public Builder enableSlack() { this.slackEnabled = true; return this; } private boolean validateChoices() { return this.emailEnabled || this.slackEnabled || this.facebookEnabled; } public NotificationSettings build() throws PlatformRequiredException { if (!this.validateChoices()) throw new PlatformRequiredException("At least one platform must be enabled!"); return new NotificationSettings(this); } } }
UTF-8
Java
2,177
java
NotificationSettings.java
Java
[]
null
[]
package DesignPatterns.Decorator.notifications; public class NotificationSettings { private boolean emailEnabled; private boolean facebookEnabled; private boolean slackEnabled; private NotificationSettings(Builder builder) { this.emailEnabled = builder.emailEnabled; this.facebookEnabled = builder.facebookEnabled; this.slackEnabled = builder.slackEnabled; } public boolean isEmailEnabled() { return this.emailEnabled; } public boolean isFacebookEnabled() { return this.facebookEnabled; } public boolean isSlackEnabled() { return this.slackEnabled; } public INotification buildNotifier(String message) { INotification notification = new Notification(message); if (this.isEmailEnabled()) notification = new EmailDecorator(notification); if (this.isFacebookEnabled()) notification = new FacebookDecorator(notification); if (this.isSlackEnabled()) notification = new SlackDecorator(notification); return notification; } public static class Builder { private boolean emailEnabled; private boolean facebookEnabled; private boolean slackEnabled; public Builder() { this.emailEnabled = false; this.facebookEnabled = false; this.slackEnabled = false; } public Builder enableEmail() { this.emailEnabled = true; return this; } public Builder enableFacebook() { this.facebookEnabled = true; return this; } public Builder enableSlack() { this.slackEnabled = true; return this; } private boolean validateChoices() { return this.emailEnabled || this.slackEnabled || this.facebookEnabled; } public NotificationSettings build() throws PlatformRequiredException { if (!this.validateChoices()) throw new PlatformRequiredException("At least one platform must be enabled!"); return new NotificationSettings(this); } } }
2,177
0.632522
0.632522
73
28.821918
22.447102
94
false
false
0
0
0
0
0
0
0.465753
false
false
13
9073810e07c05c4acafcddbfe525d5e58b02fd78
7,653,631,761,572
9c709173a2cb759bd138904a65719e3b87dec551
/app/src/main/java/com/frostdev/todolist/ToDoAdapter.java
ee4c85632c074422751f1affc3f4d3dd1dfd399b
[]
no_license
FebriyanAPK/ToDoList
https://github.com/FebriyanAPK/ToDoList
77d4a297b09bfcddcc27ac24d8f6273055371a6a
c4b752e01f104e04500a178086e0e615562694b1
refs/heads/master
2023-04-28T22:49:34.604000
2021-05-18T03:22:23
2021-05-18T03:22:23
368,388,499
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.frostdev.todolist; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import java.util.List; public class ToDoAdapter extends RecyclerView.Adapter<ToDoAdapter.MyViewHolder> { Context context; List<ToDo> list; public ToDoAdapter(Context context, List< ToDo > list) { this.context = context; this.list = list; } @NonNull @Override public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { return new MyViewHolder(LayoutInflater.from(context) .inflate(R.layout.todo_item, parent, false)); } @Override public void onBindViewHolder(@NonNull MyViewHolder holder, int position) { holder.tvname.setText(list.get(position).getNamaToDo()); if(list.get(position).getStatusTodo().equals("0")){ holder.tvstatus.setText("Belum Selesai"); } else { holder.tvstatus.setText("Clear"); } } @Override public int getItemCount() { return list.size(); } public class MyViewHolder extends RecyclerView.ViewHolder { TextView tvname, tvstatus; public MyViewHolder(@NonNull View itemView) { super(itemView); tvname = (TextView)itemView.findViewById(R.id.tvName); tvstatus = (TextView)itemView.findViewById(R.id.tvstatus); } } }
UTF-8
Java
1,567
java
ToDoAdapter.java
Java
[]
null
[]
package com.frostdev.todolist; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import androidx.annotation.NonNull; import androidx.recyclerview.widget.RecyclerView; import java.util.List; public class ToDoAdapter extends RecyclerView.Adapter<ToDoAdapter.MyViewHolder> { Context context; List<ToDo> list; public ToDoAdapter(Context context, List< ToDo > list) { this.context = context; this.list = list; } @NonNull @Override public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { return new MyViewHolder(LayoutInflater.from(context) .inflate(R.layout.todo_item, parent, false)); } @Override public void onBindViewHolder(@NonNull MyViewHolder holder, int position) { holder.tvname.setText(list.get(position).getNamaToDo()); if(list.get(position).getStatusTodo().equals("0")){ holder.tvstatus.setText("Belum Selesai"); } else { holder.tvstatus.setText("Clear"); } } @Override public int getItemCount() { return list.size(); } public class MyViewHolder extends RecyclerView.ViewHolder { TextView tvname, tvstatus; public MyViewHolder(@NonNull View itemView) { super(itemView); tvname = (TextView)itemView.findViewById(R.id.tvName); tvstatus = (TextView)itemView.findViewById(R.id.tvstatus); } } }
1,567
0.673899
0.673261
54
28.018518
24.995178
85
false
false
0
0
0
0
0
0
0.518519
false
false
13
90f07e8f30e543e4d35fae0cb47160f049681068
27,247,272,561,576
60cc23a8e9af8b8ae4280b172da6939b84523bee
/src/controller/CrowdChangePasswordServlet.java
3805c9b7e9e8c9434922c612cde2d815a4281708
[]
no_license
Akshar17/Funding_Stack
https://github.com/Akshar17/Funding_Stack
cb1bd38621583f655e8d05a5aba5d06a3e0eb09e
f45321e6d57174c95859d57415424a74e3e1dd2d
refs/heads/master
2021-05-10T21:32:40.326000
2017-12-24T03:50:54
2017-12-24T03:50:54
118,230,074
1
0
null
true
2018-01-20T09:48:27
2018-01-20T09:48:27
2017-12-24T03:16:34
2017-12-24T03:50:56
12,327
0
0
0
null
false
null
package controller; import java.io.IOException; import java.sql.SQLException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import dao.Dao; import model.Model; public class CrowdChangePasswordServlet extends HttpServlet { private static final long serialVersionUID = 1L; public CrowdChangePasswordServlet() { super(); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String crow_opassword=request.getParameter("crow_opassword");//old password String crow_npassword=request.getParameter("crow_npassword");//new password String crow_cpassword=request.getParameter("crow_cpassword");//confirm password String page=""; HttpSession session=request.getSession(); String email=(String)session.getAttribute("cemail"); String password1=(String)session.getAttribute("cpassword"); String sql="update rcrowd set password='"+crow_npassword+"' where email='"+email+"'"; if(crow_opassword.equals(password1)) { if(!crow_npassword.equals(password1)) { if(!crow_npassword.contains(password1)) { if(crow_npassword.equals(crow_cpassword)) { Model m=new Model(); m.setEmail(email); m.setPassword(crow_npassword); try { int i= Dao.update(m,sql); if(i!=0) { page="login.jsp"; } else { page="error.jsp?msg=crowdpasswordupdatefailed"; } } catch (Exception e) { e.printStackTrace(); } } else { page="error.jsp?msg=crowdpasswordnotmatch"; } } else { page="error.jsp?msg=crowdpasswordoldcontains"; } } else { page="error.jsp?msg=crowdpasswordoldcontains"; } } else { page="error.jsp?msg=crowdoldpassword"; } response.sendRedirect(page); } }
UTF-8
Java
2,272
java
CrowdChangePasswordServlet.java
Java
[ { "context": "\r\n\t\t\r\n\t\tString sql=\"update rcrowd set password='\"+crow_npassword+\"' where email='\"+email+\"'\";\r\n\t\t\r\n\t\tif(crow_opass", "end": 1287, "score": 0.955219566822052, "start": 1273, "tag": "PASSWORD", "value": "crow_npassword" }, { "context": ");\r\n\t\t\t\...
null
[]
package controller; import java.io.IOException; import java.sql.SQLException; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import dao.Dao; import model.Model; public class CrowdChangePasswordServlet extends HttpServlet { private static final long serialVersionUID = 1L; public CrowdChangePasswordServlet() { super(); } protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { } protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { String crow_opassword=request.getParameter("crow_opassword");//old password String crow_npassword=request.getParameter("crow_npassword");//new password String crow_cpassword=request.getParameter("crow_cpassword");//confirm password String page=""; HttpSession session=request.getSession(); String email=(String)session.getAttribute("cemail"); String password1=(String)session.getAttribute("cpassword"); String sql="update rcrowd set password='"+<PASSWORD>+"' where email='"+email+"'"; if(crow_opassword.equals(password1)) { if(!crow_npassword.equals(password1)) { if(!crow_npassword.contains(password1)) { if(crow_npassword.equals(crow_cpassword)) { Model m=new Model(); m.setEmail(email); m.setPassword(<PASSWORD>); try { int i= Dao.update(m,sql); if(i!=0) { page="login.jsp"; } else { page="error.jsp?msg=crowdpasswordupdatefailed"; } } catch (Exception e) { e.printStackTrace(); } } else { page="error.jsp?msg=crowdpasswordnotmatch"; } } else { page="error.jsp?msg=crowdpasswordoldcontains"; } } else { page="error.jsp?msg=crowdpasswordoldcontains"; } } else { page="error.jsp?msg=crowdoldpassword"; } response.sendRedirect(page); } }
2,264
0.648768
0.646127
95
21.915789
25.915516
119
false
false
0
0
0
0
0
0
3.168421
false
false
13
ad8ed595f7e11276f91fe6037f4498682be0cc9e
4,707,284,188,123
5b74042251925f77d8e215088c231aa3f63a7fc0
/src/events/LlegadaAuto.java
b7eeca185f9b1b454fade9703916fb14087f82a5
[]
no_license
ekseiri/Tp1-AyP2
https://github.com/ekseiri/Tp1-AyP2
71a3d09a2cf15ac4e457b59486467aec449fca6c
769412b437e7cca5eed5f53df3fea7b106c305a4
refs/heads/master
2020-07-02T04:33:34.678000
2015-04-30T01:56:47
2015-04-30T01:56:47
33,574,328
0
3
null
null
null
null
null
null
null
null
null
null
null
null
null
package events; import main.Auto; /** * Evento que marca la llegada de un auto al lavadero */ public class LlegadaAuto extends Evento { /** * El evento se inicializa con un Auto * @param auto */ public LlegadaAuto(Auto auto) { super(auto); // TODO Auto-generated constructor stub } /** * Devuelve el horario de llegada del auto */ public double getHorario() { return this.getAuto().getTicket().getHorario(); } }
UTF-8
Java
499
java
LlegadaAuto.java
Java
[]
null
[]
package events; import main.Auto; /** * Evento que marca la llegada de un auto al lavadero */ public class LlegadaAuto extends Evento { /** * El evento se inicializa con un Auto * @param auto */ public LlegadaAuto(Auto auto) { super(auto); // TODO Auto-generated constructor stub } /** * Devuelve el horario de llegada del auto */ public double getHorario() { return this.getAuto().getTicket().getHorario(); } }
499
0.597194
0.597194
25
17.959999
17.603363
53
false
false
0
0
0
0
0
0
0.28
false
false
13
a3f89ae220083a57c526340964471a7c78a75e9b
4,707,284,187,962
c5f5fd8a85923508660c8d0cbaa7b84ce4ecb4a3
/src/GUILayer/Product/Storage/UpdateUI.java
87b252c9db665d6f150b56ddf434d30a2b877dd5
[]
no_license
KLIM8D/ucn-1semproject-dm79-group5
https://github.com/KLIM8D/ucn-1semproject-dm79-group5
06c73571806d4ccd4c111584bd95c69702cd4e76
1d8e9d3cc64d6dbc0c6db9417422c051c1c22ff1
refs/heads/master
2016-09-05T22:02:09.906000
2012-06-24T21:59:51
2012-06-24T21:59:51
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package GUILayer.Product.Storage; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JTextField; import javax.swing.JButton; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import ControlLayer.ProductLocationCtrl; import GUILayer.GlobalUI; import ModelLayer.ProductLocation; import javax.swing.JSeparator; public class UpdateUI { private static JFrame _frame; private static UpdateUI _instance; private JPanel contentPane; private JTextField txtStorageName; private JTextField txtStorageAddress; private JTextField txtStorageZipCode; private JTextField txtStorageCity; private ProductLocationCtrl _locController; private JTextField txtStorageId; private int storageId; public static JFrame createWindow() { if(_instance == null) _instance = new UpdateUI(); return _frame; } private UpdateUI() { _locController = new ProductLocationCtrl(); _frame = new JFrame(); _frame.setResizable(false); _frame.setTitle("Opdater lager information"); _frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); _frame.setBounds(0, 0, 450, 210); _frame.setVisible(true); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); _frame.setContentPane(contentPane); contentPane.setLayout(null); JLabel lblStorageName = new JLabel("Lager navn"); lblStorageName.setBounds(12, 61, 110, 15); contentPane.add(lblStorageName); txtStorageName = new JTextField(); txtStorageName.setBounds(119, 59, 317, 19); txtStorageName.setColumns(10); contentPane.add(txtStorageName); JLabel lblStorageAddress = new JLabel("Adresse"); lblStorageAddress.setBounds(12, 88, 70, 15); contentPane.add(lblStorageAddress); txtStorageAddress = new JTextField(); txtStorageAddress.setBounds(119, 88, 317, 19); txtStorageAddress.setColumns(10); contentPane.add(txtStorageAddress); JLabel lblStorageZipCode = new JLabel("Post nr."); lblStorageZipCode.setBounds(12, 117, 70, 15); contentPane.add(lblStorageZipCode); txtStorageZipCode = new JTextField(); txtStorageZipCode.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent e) { if(txtStorageZipCode.getText().length() > 0) { GlobalUI.checkIfLong(txtStorageZipCode); } } }); txtStorageZipCode.setBounds(119, 117, 114, 19); txtStorageZipCode.setColumns(10); contentPane.add(txtStorageZipCode); JLabel lblStorageCity = new JLabel("By"); lblStorageCity.setBounds(238, 117, 70, 15); contentPane.add(lblStorageCity); txtStorageCity = new JTextField(); txtStorageCity.setBounds(264, 115, 172, 19); txtStorageCity.setColumns(10); contentPane.add(txtStorageCity); JButton btnCancel = new JButton("Annuller"); btnCancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { _instance = null; _frame.dispose(); } }); btnCancel.setBounds(319, 148, 117, 25); contentPane.add(btnCancel); JButton btnCreate = new JButton("Opdater"); btnCreate.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if(isFormValid()) updateStorage(); else JOptionPane.showMessageDialog(null, "Alle felter skal udfyldes", "FEJL!", JOptionPane.WARNING_MESSAGE); } }); btnCreate.setBounds(193, 148, 117, 25); contentPane.add(btnCreate); JLabel lblStorageId = new JLabel("Lager ID"); lblStorageId.setBounds(12, 14, 110, 15); contentPane.add(lblStorageId); txtStorageId = new JTextField(); txtStorageId.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent e) { if(txtStorageId.getText().length() > 0) { GlobalUI.checkIfInt(txtStorageId); } } }); txtStorageId.setColumns(10); txtStorageId.setBounds(119, 12, 189, 19); contentPane.add(txtStorageId); JSeparator separator = new JSeparator(); separator.setBounds(22, 47, 400, 2); contentPane.add(separator); JButton btnGetData = new JButton("Hent data"); btnGetData.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if(txtStorageId.getText().length() > 0) { storageId = Integer.parseInt(txtStorageId.getText()); addData(storageId); } } }); btnGetData.setBounds(319, 9, 117, 25); contentPane.add(btnGetData); _frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { _instance = null; _frame.dispose(); } }); } private void updateStorage() { boolean succeeded = false; try { String storageName = txtStorageName.getText(); String storageAddress = txtStorageAddress.getText(); String storageCity = txtStorageCity.getText(); int storageZipCode = Integer.parseInt(txtStorageZipCode.getText()); succeeded = _locController.updateLocation(storageId, storageName, storageAddress, storageCity, storageZipCode); if(succeeded) { JOptionPane.showMessageDialog(null, "Lagerets information er nu opdateret", "INFORMATION!", JOptionPane.INFORMATION_MESSAGE); _instance = null; _frame.dispose(); } else JOptionPane.showMessageDialog(null, "Lagerets information kunne ikke opdateres", "FEJL!", JOptionPane.WARNING_MESSAGE); } catch (Exception e) { JOptionPane.showMessageDialog(null, GlobalUI.messageHandling(99), "FEJL!", JOptionPane.WARNING_MESSAGE); } } private void addData(int locId) { ProductLocation location = _locController.getLocation(locId); if(location != null) { txtStorageName.setText(location.getLocationName()); txtStorageAddress.setText(location.getAddress()); txtStorageCity.setText(location.getCity()); txtStorageZipCode.setText(location.getZipCode() + ""); } else JOptionPane.showMessageDialog(null, "Der blev ikke fundet et lager med det ID", "FEJL!", JOptionPane.WARNING_MESSAGE); } private boolean isFormValid() { if(txtStorageName.getText().length() > 0 && txtStorageAddress.getText().length() > 0 && txtStorageCity.getText().length() > 0 && txtStorageZipCode.getText().length() > 0) return true; return false; } }
UTF-8
Java
6,362
java
UpdateUI.java
Java
[]
null
[]
package GUILayer.Product.Storage; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JTextField; import javax.swing.JButton; import java.awt.event.ActionListener; import java.awt.event.ActionEvent; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import ControlLayer.ProductLocationCtrl; import GUILayer.GlobalUI; import ModelLayer.ProductLocation; import javax.swing.JSeparator; public class UpdateUI { private static JFrame _frame; private static UpdateUI _instance; private JPanel contentPane; private JTextField txtStorageName; private JTextField txtStorageAddress; private JTextField txtStorageZipCode; private JTextField txtStorageCity; private ProductLocationCtrl _locController; private JTextField txtStorageId; private int storageId; public static JFrame createWindow() { if(_instance == null) _instance = new UpdateUI(); return _frame; } private UpdateUI() { _locController = new ProductLocationCtrl(); _frame = new JFrame(); _frame.setResizable(false); _frame.setTitle("Opdater lager information"); _frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); _frame.setBounds(0, 0, 450, 210); _frame.setVisible(true); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); _frame.setContentPane(contentPane); contentPane.setLayout(null); JLabel lblStorageName = new JLabel("Lager navn"); lblStorageName.setBounds(12, 61, 110, 15); contentPane.add(lblStorageName); txtStorageName = new JTextField(); txtStorageName.setBounds(119, 59, 317, 19); txtStorageName.setColumns(10); contentPane.add(txtStorageName); JLabel lblStorageAddress = new JLabel("Adresse"); lblStorageAddress.setBounds(12, 88, 70, 15); contentPane.add(lblStorageAddress); txtStorageAddress = new JTextField(); txtStorageAddress.setBounds(119, 88, 317, 19); txtStorageAddress.setColumns(10); contentPane.add(txtStorageAddress); JLabel lblStorageZipCode = new JLabel("Post nr."); lblStorageZipCode.setBounds(12, 117, 70, 15); contentPane.add(lblStorageZipCode); txtStorageZipCode = new JTextField(); txtStorageZipCode.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent e) { if(txtStorageZipCode.getText().length() > 0) { GlobalUI.checkIfLong(txtStorageZipCode); } } }); txtStorageZipCode.setBounds(119, 117, 114, 19); txtStorageZipCode.setColumns(10); contentPane.add(txtStorageZipCode); JLabel lblStorageCity = new JLabel("By"); lblStorageCity.setBounds(238, 117, 70, 15); contentPane.add(lblStorageCity); txtStorageCity = new JTextField(); txtStorageCity.setBounds(264, 115, 172, 19); txtStorageCity.setColumns(10); contentPane.add(txtStorageCity); JButton btnCancel = new JButton("Annuller"); btnCancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { _instance = null; _frame.dispose(); } }); btnCancel.setBounds(319, 148, 117, 25); contentPane.add(btnCancel); JButton btnCreate = new JButton("Opdater"); btnCreate.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if(isFormValid()) updateStorage(); else JOptionPane.showMessageDialog(null, "Alle felter skal udfyldes", "FEJL!", JOptionPane.WARNING_MESSAGE); } }); btnCreate.setBounds(193, 148, 117, 25); contentPane.add(btnCreate); JLabel lblStorageId = new JLabel("Lager ID"); lblStorageId.setBounds(12, 14, 110, 15); contentPane.add(lblStorageId); txtStorageId = new JTextField(); txtStorageId.addKeyListener(new KeyAdapter() { public void keyReleased(KeyEvent e) { if(txtStorageId.getText().length() > 0) { GlobalUI.checkIfInt(txtStorageId); } } }); txtStorageId.setColumns(10); txtStorageId.setBounds(119, 12, 189, 19); contentPane.add(txtStorageId); JSeparator separator = new JSeparator(); separator.setBounds(22, 47, 400, 2); contentPane.add(separator); JButton btnGetData = new JButton("Hent data"); btnGetData.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if(txtStorageId.getText().length() > 0) { storageId = Integer.parseInt(txtStorageId.getText()); addData(storageId); } } }); btnGetData.setBounds(319, 9, 117, 25); contentPane.add(btnGetData); _frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { _instance = null; _frame.dispose(); } }); } private void updateStorage() { boolean succeeded = false; try { String storageName = txtStorageName.getText(); String storageAddress = txtStorageAddress.getText(); String storageCity = txtStorageCity.getText(); int storageZipCode = Integer.parseInt(txtStorageZipCode.getText()); succeeded = _locController.updateLocation(storageId, storageName, storageAddress, storageCity, storageZipCode); if(succeeded) { JOptionPane.showMessageDialog(null, "Lagerets information er nu opdateret", "INFORMATION!", JOptionPane.INFORMATION_MESSAGE); _instance = null; _frame.dispose(); } else JOptionPane.showMessageDialog(null, "Lagerets information kunne ikke opdateres", "FEJL!", JOptionPane.WARNING_MESSAGE); } catch (Exception e) { JOptionPane.showMessageDialog(null, GlobalUI.messageHandling(99), "FEJL!", JOptionPane.WARNING_MESSAGE); } } private void addData(int locId) { ProductLocation location = _locController.getLocation(locId); if(location != null) { txtStorageName.setText(location.getLocationName()); txtStorageAddress.setText(location.getAddress()); txtStorageCity.setText(location.getCity()); txtStorageZipCode.setText(location.getZipCode() + ""); } else JOptionPane.showMessageDialog(null, "Der blev ikke fundet et lager med det ID", "FEJL!", JOptionPane.WARNING_MESSAGE); } private boolean isFormValid() { if(txtStorageName.getText().length() > 0 && txtStorageAddress.getText().length() > 0 && txtStorageCity.getText().length() > 0 && txtStorageZipCode.getText().length() > 0) return true; return false; } }
6,362
0.72823
0.701981
212
29.009434
24.214449
129
false
false
0
0
0
0
0
0
2.962264
false
false
13
24982f07786fe76f4bd75545081260eb2154fa1b
21,552,145,920,613
986945810a3e495b709b66d9067faa74fdfe2980
/src/main/java/com/luohao/lhblog/biz/service/ITypedefService.java
cbabd2de449703e89baafc6b383220a53b32a38e
[]
no_license
lluohao/lhblog
https://github.com/lluohao/lhblog
be06019cb24cbae45d6ef1a982032452f8cd39b4
733198ece0e66a12f92668afc4bc112d794c45b4
refs/heads/master
2021-01-02T22:53:44.714000
2018-04-05T02:58:49
2018-04-05T02:58:49
99,413,345
0
0
null
false
2017-08-07T12:56:59
2017-08-05T09:35:58
2017-08-05T09:41:54
2017-08-07T12:56:59
1,774
0
0
1
JavaScript
null
null
package com.luohao.lhblog.biz.service; import com.luohao.lhblog.biz.domain.TypedefDomain; import com.luohao.lhblog.web.vo.BasicVO; import java.util.List; /** * Created by luohao on 2017/8/7. */ public interface ITypedefService { BasicVO addTypedef(String name); BasicVO rename(int id, String newName); List<TypedefDomain> allTypedef(); BasicVO delete(int id); }
UTF-8
Java
382
java
ITypedefService.java
Java
[ { "context": "BasicVO;\nimport java.util.List;\n\n/**\n * Created by luohao on 2017/8/7.\n */\npublic interface ITypedefService", "end": 180, "score": 0.9575314521789551, "start": 174, "tag": "USERNAME", "value": "luohao" } ]
null
[]
package com.luohao.lhblog.biz.service; import com.luohao.lhblog.biz.domain.TypedefDomain; import com.luohao.lhblog.web.vo.BasicVO; import java.util.List; /** * Created by luohao on 2017/8/7. */ public interface ITypedefService { BasicVO addTypedef(String name); BasicVO rename(int id, String newName); List<TypedefDomain> allTypedef(); BasicVO delete(int id); }
382
0.73822
0.722513
15
24.466667
17.427437
50
false
false
0
0
0
0
0
0
0.6
false
false
13
b1b0bc1a034d00d954cf2af1f0b85145be4d01c5
18,588,618,521,599
d396272adae7db6d97e5e93945a3850d12ba1005
/javaBasics/src/main/com/troylc/java/ds/TestDs2.java
f1b998a124f8b22edec5d49523f2b27c2af540dd
[]
no_license
troychn/javaStudySpace
https://github.com/troychn/javaStudySpace
40bb63961ac3fd6bfc2ba77a1fdfcac2ebadae8d
b13ddad0def8110a39d758fb9e242f2348e68b2e
refs/heads/master
2021-01-21T13:07:32.335000
2016-05-19T10:44:48
2016-05-19T10:44:48
54,435,192
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.troylc.java.ds; import org.junit.Test; import java.util.Scanner; /** * Created by Administrator on 2015/5/20. * //้‡‘้ข่ฝฌๆข๏ผŒ้˜ฟๆ‹‰ไผฏๆ•ฐๅญ—็š„้‡‘้ข่ฝฌๆขๆˆไธญๅ›ฝไผ ็ปŸ็š„ๅฝขๅผใ€‚ //ๅฆ‚๏ผš105600123 => ๅฃนไบฟ้›ถไปŸไผไฝฐ้™†ๆ‹พ้›ถไธ‡้›ถไปŸๅฃนไฝฐ่ดฐๆ‹พๅๅœ†ๆ•ด */ public class TestDs2 { private static final char[] units = new char[]{'ๅœ†', 'ๆ‹พ', 'ไฝฐ', 'ไปŸ', 'ไธ‡', 'ๆ‹พ', 'ไฝฐ', 'ไปŸ', 'ไบฟ', 'ๆ‹พ','ไฝฐ', 'ไปŸ', 'ไบฟ'}; private static final char[] data = new char[]{'้›ถ', 'ๅฃน', '่ดฐ', 'ๅ', '่‚†', 'ไผ', '้™†', 'ๆŸ’', 'ๆŒ', '็Ž–'}; public static void main(String[] args) { Scanner s = new Scanner(System.in); System.out.println("่ฏท่พ“ๅ…ฅ้‡‘้ข"); int money = s.nextInt(); String strMoney = convert(money); System.out.println(strMoney); } public static String convert(int money) { StringBuffer sb = new StringBuffer("ๆ•ด"); int init = 0; while (money != 0) { sb.insert(0, units[init++]); int number = money % 10; sb.insert(0, data[number]); money /= 10; } return sb.toString(); } /** * ๅˆ›ๅปบไธ€ไธช้•ฟๅบฆไธบ6็š„intๅž‹ๆ•ฐ็ป„๏ผŒ่ฆๆฑ‚ๅ–ๅ€ผไธบ1-30๏ผŒๅŒๆ—ถๅ…ƒ็ด ๅ€ผๅ„ไธ็›ธๅŒ [1,30] ๆ‹“ๅฑ•๏ผš34-102; * (ๆ•ฐๆฎ็ฑปๅž‹)(ๆœ€ๅฐๅ€ผ+Math.random()*(ๆœ€ๅคงๅ€ผ-ๆœ€ๅฐๅ€ผ+1)) * (int)(Math.random()*30) + 1; * While(true){...} */ @Test public void test(){ int[] num = new int[6]; int i = 0; while (true){ if (i >= 6) { break; } int temp =(int)(Math.random() * (102-34+1)) + 34; for (int j = 0; j <= i; j++) { if(temp == num[j]){ temp= (int) (Math.random() * (102 - 34 +1)) + 34; j = 0; } if(j == i){ num[i] = temp; } } System.out.println(num[i]); i++; } /* for (int j = 0; j < num.length; j++) { num[j] = random(num); System.out.println(num[j]); }*/ } /** * ๆ นๆฎๆ•ฐ็ป„ไบง็”ŸไธๅŒๆ•ฐ็ป„ไบŽไธญๅ…ƒ็ด ็š„้šๆœบๆ•ฐ * @param num * @return */ private int random(int[] num){ int i = 0; int resulet = 0; while (true){ int temp = (int) (Math.random() * (102 - 34)) + 34; if (i >= num.length) { resulet = temp; break; } if(temp == num[i]){ temp = (int) (Math.random() * (102 - 34)) + 34; } i++; } return resulet; } }
UTF-8
Java
2,748
java
TestDs2.java
Java
[ { "context": "est;\n\nimport java.util.Scanner;\n\n/**\n * Created by Administrator on 2015/5/20.\n * //้‡‘้ข่ฝฌๆข๏ผŒ้˜ฟๆ‹‰ไผฏๆ•ฐๅญ—็š„้‡‘้ข่ฝฌๆขๆˆไธญๅ›ฝไผ ็ปŸ็š„ๅฝขๅผใ€‚\n //ๅฆ‚๏ผš", "end": 111, "score": 0.5613503456115723, "start": 98, "tag": "USERNAME", "value": "Administrator" } ]
null
[]
package com.troylc.java.ds; import org.junit.Test; import java.util.Scanner; /** * Created by Administrator on 2015/5/20. * //้‡‘้ข่ฝฌๆข๏ผŒ้˜ฟๆ‹‰ไผฏๆ•ฐๅญ—็š„้‡‘้ข่ฝฌๆขๆˆไธญๅ›ฝไผ ็ปŸ็š„ๅฝขๅผใ€‚ //ๅฆ‚๏ผš105600123 => ๅฃนไบฟ้›ถไปŸไผไฝฐ้™†ๆ‹พ้›ถไธ‡้›ถไปŸๅฃนไฝฐ่ดฐๆ‹พๅๅœ†ๆ•ด */ public class TestDs2 { private static final char[] units = new char[]{'ๅœ†', 'ๆ‹พ', 'ไฝฐ', 'ไปŸ', 'ไธ‡', 'ๆ‹พ', 'ไฝฐ', 'ไปŸ', 'ไบฟ', 'ๆ‹พ','ไฝฐ', 'ไปŸ', 'ไบฟ'}; private static final char[] data = new char[]{'้›ถ', 'ๅฃน', '่ดฐ', 'ๅ', '่‚†', 'ไผ', '้™†', 'ๆŸ’', 'ๆŒ', '็Ž–'}; public static void main(String[] args) { Scanner s = new Scanner(System.in); System.out.println("่ฏท่พ“ๅ…ฅ้‡‘้ข"); int money = s.nextInt(); String strMoney = convert(money); System.out.println(strMoney); } public static String convert(int money) { StringBuffer sb = new StringBuffer("ๆ•ด"); int init = 0; while (money != 0) { sb.insert(0, units[init++]); int number = money % 10; sb.insert(0, data[number]); money /= 10; } return sb.toString(); } /** * ๅˆ›ๅปบไธ€ไธช้•ฟๅบฆไธบ6็š„intๅž‹ๆ•ฐ็ป„๏ผŒ่ฆๆฑ‚ๅ–ๅ€ผไธบ1-30๏ผŒๅŒๆ—ถๅ…ƒ็ด ๅ€ผๅ„ไธ็›ธๅŒ [1,30] ๆ‹“ๅฑ•๏ผš34-102; * (ๆ•ฐๆฎ็ฑปๅž‹)(ๆœ€ๅฐๅ€ผ+Math.random()*(ๆœ€ๅคงๅ€ผ-ๆœ€ๅฐๅ€ผ+1)) * (int)(Math.random()*30) + 1; * While(true){...} */ @Test public void test(){ int[] num = new int[6]; int i = 0; while (true){ if (i >= 6) { break; } int temp =(int)(Math.random() * (102-34+1)) + 34; for (int j = 0; j <= i; j++) { if(temp == num[j]){ temp= (int) (Math.random() * (102 - 34 +1)) + 34; j = 0; } if(j == i){ num[i] = temp; } } System.out.println(num[i]); i++; } /* for (int j = 0; j < num.length; j++) { num[j] = random(num); System.out.println(num[j]); }*/ } /** * ๆ นๆฎๆ•ฐ็ป„ไบง็”ŸไธๅŒๆ•ฐ็ป„ไบŽไธญๅ…ƒ็ด ็š„้šๆœบๆ•ฐ * @param num * @return */ private int random(int[] num){ int i = 0; int resulet = 0; while (true){ int temp = (int) (Math.random() * (102 - 34)) + 34; if (i >= num.length) { resulet = temp; break; } if(temp == num[i]){ temp = (int) (Math.random() * (102 - 34)) + 34; } i++; } return resulet; } }
2,748
0.419693
0.387813
97
24.546392
18.651453
80
false
false
0
0
0
0
0
0
0.680412
false
false
15
e50fe732abd6729d4d90e24713a4b33b533c2eb9
36,945,308,709,330
573a66e4f4753cc0f145de8d60340b4dd6206607
/JS-CS-Detection-byExample/Dataset (ALERT 5 GB)/410152/FileBot v2.5/filebot-code-3000-trunk/source/net/filebot/util/ui/ListView.java
3f6579af82416eddac5363f1e1ff57340597b19f
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
mkaouer/Code-Smells-Detection-in-JavaScript
https://github.com/mkaouer/Code-Smells-Detection-in-JavaScript
3919ec0d445637a7f7c5f570c724082d42248e1b
7130351703e19347884f95ce6d6ab1fb4f5cfbff
refs/heads/master
2023-03-09T18:04:26.971000
2022-03-23T22:04:28
2022-03-23T22:04:28
73,915,037
8
3
null
false
2023-02-28T23:00:07
2016-11-16T11:47:44
2022-07-16T19:55:53
2023-02-28T23:00:06
1,866,709
9
3
18
null
false
false
package net.filebot.util.ui; import static java.lang.Math.*; import java.awt.Component; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Rectangle; import java.awt.event.MouseEvent; import java.awt.geom.Rectangle2D; import java.awt.image.FilteredImageSource; import javax.swing.DefaultListCellRenderer; import javax.swing.DropMode; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JList; import javax.swing.ListModel; import javax.swing.ListSelectionModel; import javax.swing.SwingUtilities; import javax.swing.event.MouseInputAdapter; public class ListView extends JList { protected final BlockSelectionHandler blockSelectionHandler = new BlockSelectionHandler(); public ListView(ListModel dataModel) { super(dataModel); setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); // better selection behaviour putClientProperty("List.isFileList", Boolean.TRUE); setDropMode(DropMode.ON); setLayoutOrientation(JList.VERTICAL_WRAP); setVisibleRowCount(-1); setCellRenderer(new ListViewRenderer()); addMouseListener(blockSelectionHandler); addMouseMotionListener(blockSelectionHandler); } public void addSelectionInterval(Rectangle selection) { Point p1 = selection.getLocation(); Point p2 = new Point(p1.x + selection.width, p1.y + selection.height); int startIndex = locationToIndex(p1); int endIndex = locationToIndex(p2); for (int i = startIndex; i <= endIndex; i++) { Rectangle cell = getCellBounds(i, i); if (cell != null && selection.intersects(cell)) { addSelectionInterval(i, i); } } } @Override public void paintComponent(Graphics g) { super.paintComponent(g); Rectangle selection = blockSelectionHandler.getSelection(); // paint block selection if (selection != null) { paintBlockSelection((Graphics2D) g, selection); } } protected void paintBlockSelection(Graphics2D g2d, Rectangle selection) { g2d.setPaint(SwingUI.derive(getSelectionBackground(), 0.3f)); g2d.fill(selection); g2d.setPaint(getSelectionBackground()); g2d.draw(selection); } protected String convertValueToText(Object value) { return value.toString(); } protected Icon convertValueToIcon(Object value) { return null; } protected class ListViewRenderer extends DefaultListCellRenderer { public ListViewRenderer() { setOpaque(false); } @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { Icon icon = convertValueToIcon(value); if (isSelected && icon != null) { // apply selection color tint icon = new ImageIcon(createImage(new FilteredImageSource(SwingUI.getImage(icon).getSource(), new ColorTintImageFilter(list.getSelectionBackground(), 0.5f)))); } setText(convertValueToText(value)); setIcon(icon); if (isSelected) { setBackground(list.getSelectionBackground()); setForeground(list.getSelectionForeground()); } else { setBackground(list.getBackground()); setForeground(list.getForeground()); } return this; } @Override protected void paintComponent(Graphics g) { // paint selection background for the text area only, not the whole cell int iconWidth = (getIcon() == null ? 0 : getIcon().getIconHeight()); int startX = iconWidth + getIconTextGap(); Rectangle2D text = getFontMetrics(getFont()).getStringBounds(getText(), g); g.setColor(getBackground()); g.fillRect(startX - 2, 1, (int) (text.getWidth() + 6), getHeight() - 1); super.paintComponent(g); } }; protected class BlockSelectionHandler extends MouseInputAdapter { private Rectangle selection; private Point origin; public void mousePressed(MouseEvent e) { if (SwingUtilities.isLeftMouseButton(e) && !isSelectedIndex(locationToIndex(e.getPoint()))) { origin = e.getPoint(); } } @Override public void mouseDragged(MouseEvent e) { if (origin == null) return; // begin selection if (selection == null) selection = new Rectangle(); // keep point within component bounds Point p2 = e.getPoint(); p2.x = max(0, min(getWidth() - 1, p2.x)); p2.y = max(0, min(getHeight() - 1, p2.y)); // update selection bounds selection.setFrameFromDiagonal(origin, p2); // auto-scroll ensureIndexIsVisible(locationToIndex(p2)); // update list selection clearSelection(); addSelectionInterval(selection); // update view repaint(); } @Override public void mouseReleased(MouseEvent e) { origin = null; // end selection selection = null; // update view repaint(); } public Rectangle getSelection() { return selection; } }; }
UTF-8
Java
4,833
java
ListView.java
Java
[]
null
[]
package net.filebot.util.ui; import static java.lang.Math.*; import java.awt.Component; import java.awt.Graphics; import java.awt.Graphics2D; import java.awt.Point; import java.awt.Rectangle; import java.awt.event.MouseEvent; import java.awt.geom.Rectangle2D; import java.awt.image.FilteredImageSource; import javax.swing.DefaultListCellRenderer; import javax.swing.DropMode; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JList; import javax.swing.ListModel; import javax.swing.ListSelectionModel; import javax.swing.SwingUtilities; import javax.swing.event.MouseInputAdapter; public class ListView extends JList { protected final BlockSelectionHandler blockSelectionHandler = new BlockSelectionHandler(); public ListView(ListModel dataModel) { super(dataModel); setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); // better selection behaviour putClientProperty("List.isFileList", Boolean.TRUE); setDropMode(DropMode.ON); setLayoutOrientation(JList.VERTICAL_WRAP); setVisibleRowCount(-1); setCellRenderer(new ListViewRenderer()); addMouseListener(blockSelectionHandler); addMouseMotionListener(blockSelectionHandler); } public void addSelectionInterval(Rectangle selection) { Point p1 = selection.getLocation(); Point p2 = new Point(p1.x + selection.width, p1.y + selection.height); int startIndex = locationToIndex(p1); int endIndex = locationToIndex(p2); for (int i = startIndex; i <= endIndex; i++) { Rectangle cell = getCellBounds(i, i); if (cell != null && selection.intersects(cell)) { addSelectionInterval(i, i); } } } @Override public void paintComponent(Graphics g) { super.paintComponent(g); Rectangle selection = blockSelectionHandler.getSelection(); // paint block selection if (selection != null) { paintBlockSelection((Graphics2D) g, selection); } } protected void paintBlockSelection(Graphics2D g2d, Rectangle selection) { g2d.setPaint(SwingUI.derive(getSelectionBackground(), 0.3f)); g2d.fill(selection); g2d.setPaint(getSelectionBackground()); g2d.draw(selection); } protected String convertValueToText(Object value) { return value.toString(); } protected Icon convertValueToIcon(Object value) { return null; } protected class ListViewRenderer extends DefaultListCellRenderer { public ListViewRenderer() { setOpaque(false); } @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { Icon icon = convertValueToIcon(value); if (isSelected && icon != null) { // apply selection color tint icon = new ImageIcon(createImage(new FilteredImageSource(SwingUI.getImage(icon).getSource(), new ColorTintImageFilter(list.getSelectionBackground(), 0.5f)))); } setText(convertValueToText(value)); setIcon(icon); if (isSelected) { setBackground(list.getSelectionBackground()); setForeground(list.getSelectionForeground()); } else { setBackground(list.getBackground()); setForeground(list.getForeground()); } return this; } @Override protected void paintComponent(Graphics g) { // paint selection background for the text area only, not the whole cell int iconWidth = (getIcon() == null ? 0 : getIcon().getIconHeight()); int startX = iconWidth + getIconTextGap(); Rectangle2D text = getFontMetrics(getFont()).getStringBounds(getText(), g); g.setColor(getBackground()); g.fillRect(startX - 2, 1, (int) (text.getWidth() + 6), getHeight() - 1); super.paintComponent(g); } }; protected class BlockSelectionHandler extends MouseInputAdapter { private Rectangle selection; private Point origin; public void mousePressed(MouseEvent e) { if (SwingUtilities.isLeftMouseButton(e) && !isSelectedIndex(locationToIndex(e.getPoint()))) { origin = e.getPoint(); } } @Override public void mouseDragged(MouseEvent e) { if (origin == null) return; // begin selection if (selection == null) selection = new Rectangle(); // keep point within component bounds Point p2 = e.getPoint(); p2.x = max(0, min(getWidth() - 1, p2.x)); p2.y = max(0, min(getHeight() - 1, p2.y)); // update selection bounds selection.setFrameFromDiagonal(origin, p2); // auto-scroll ensureIndexIsVisible(locationToIndex(p2)); // update list selection clearSelection(); addSelectionInterval(selection); // update view repaint(); } @Override public void mouseReleased(MouseEvent e) { origin = null; // end selection selection = null; // update view repaint(); } public Rectangle getSelection() { return selection; } }; }
4,833
0.70929
0.701635
203
22.802956
24.68602
162
false
false
0
0
0
0
0
0
2.364532
false
false
15
e49ef8f49907b0f00d917945f3c8ecbc77790684
26,302,379,777,704
50e62690e05e61d9b54571fa4336e5ca227aed0b
/src/main/java/com/rajeev/thread/synchronization/RajeevVolatileTest.java
50b3e99dd7d8a29b9a123a1941c9a62b90c8fe58
[]
no_license
rajeev0739/JavaThreading
https://github.com/rajeev0739/JavaThreading
6af95c67f3d43b5420e1e63f6bab36877c0f49a9
83a56493c0ae75c93c336f664b31571ec457a98f
refs/heads/master
2021-09-09T14:55:22.072000
2018-03-17T05:34:45
2018-03-17T05:34:45
119,978,179
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.rajeev.thread.synchronization; public class RajeevVolatileTest { public static void main(String[] args) { SharedVariable sharedVariableObj=new SharedVariable(); ReaderThread reader=new ReaderThread(sharedVariableObj); WriterThread writer=new WriterThread(sharedVariableObj); reader.start(); writer.start(); } } class SharedVariable{ public volatile int count=0; public void reader() { int local_count_stale_value = count; while (true){ if( local_count_stale_value!= count){ System.out.println("Value of count Changed to "+ count+" from thread"+Thread.currentThread().getName()); local_count_stale_value = count; } } } public void writer() { int local_count_stale_value = count; while (true){ System.out.println("Value of count Incrementing to "+(local_count_stale_value+1)+" from thread"+Thread.currentThread().getName()); count = ++local_count_stale_value; try { Thread.sleep(500); }catch (InterruptedException e) { e.printStackTrace(); } } } } class ReaderThread extends Thread{ SharedVariable sharedVariable; public ReaderThread(SharedVariable sharedVariable) { this.sharedVariable=sharedVariable; } @Override public void run() { sharedVariable.reader(); } } class WriterThread extends Thread{ SharedVariable sharedVariable; public WriterThread(SharedVariable sharedVariable) { this.sharedVariable=sharedVariable; } @Override public void run() { sharedVariable.writer(); } }
UTF-8
Java
1,580
java
RajeevVolatileTest.java
Java
[]
null
[]
package com.rajeev.thread.synchronization; public class RajeevVolatileTest { public static void main(String[] args) { SharedVariable sharedVariableObj=new SharedVariable(); ReaderThread reader=new ReaderThread(sharedVariableObj); WriterThread writer=new WriterThread(sharedVariableObj); reader.start(); writer.start(); } } class SharedVariable{ public volatile int count=0; public void reader() { int local_count_stale_value = count; while (true){ if( local_count_stale_value!= count){ System.out.println("Value of count Changed to "+ count+" from thread"+Thread.currentThread().getName()); local_count_stale_value = count; } } } public void writer() { int local_count_stale_value = count; while (true){ System.out.println("Value of count Incrementing to "+(local_count_stale_value+1)+" from thread"+Thread.currentThread().getName()); count = ++local_count_stale_value; try { Thread.sleep(500); }catch (InterruptedException e) { e.printStackTrace(); } } } } class ReaderThread extends Thread{ SharedVariable sharedVariable; public ReaderThread(SharedVariable sharedVariable) { this.sharedVariable=sharedVariable; } @Override public void run() { sharedVariable.reader(); } } class WriterThread extends Thread{ SharedVariable sharedVariable; public WriterThread(SharedVariable sharedVariable) { this.sharedVariable=sharedVariable; } @Override public void run() { sharedVariable.writer(); } }
1,580
0.684177
0.681013
80
18.75
24.403637
140
false
false
0
0
0
0
0
0
1.2625
false
false
15
aa9f945abcb5b6aca4842ccca1e480f293f67a22
38,079,180,064,757
788c067b635e1215fed0d6f55c60f8bfcb9c93cd
/Appliances/src/Appliances/Coffee_maker.java
2140129cdc73ee8b0716cb151ad6337250c9f882
[]
no_license
v-rublova/multi-platform-technologies-4
https://github.com/v-rublova/multi-platform-technologies-4
ab10f11b672b835af53ebac39a082fa15070abb4
a46ee8e7ec36328fb11f32f8a5c2929025d24e73
refs/heads/master
2023-01-21T06:51:33.465000
2020-11-24T18:00:15
2020-11-24T18:00:15
312,366,964
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Appliances; /** * * @author v.rublova */ public class Coffee_maker extends BasicKitchenThing { String mode; public Coffee_maker(){ super(); this.mode = "espresso"; this.model = "Cofee maker"; } public boolean SetupMode(String m){ switch(m){ case "espresso": case "Espresso":{ this.mode = "Espresso"; return true; } case "mocca": case "Mocca":{ this.mode = "Mocca"; return true; } case "latte": case "Latte":{ this.mode = "Latte"; return true; } default: return false; } } public String ListModes(){ return "Espresso\nMocca\nLatte"; } @Override public String DisplayAll(){ return super.DisplayAll()+"\nMode: "+this.mode; } @Override public String DisplayAllOperations() { return super.DisplayAllOperations() + "dispm - dispay aviable modes;\nsmode - set preferable mode;"; } }
UTF-8
Java
1,209
java
Coffee_maker.java
Java
[ { "context": "package Appliances;\r\n\r\n/**\r\n *\r\n * @author v.rublova\r\n */\r\npublic class Coffee_maker extends BasicKitc", "end": 52, "score": 0.960771918296814, "start": 43, "tag": "NAME", "value": "v.rublova" } ]
null
[]
package Appliances; /** * * @author v.rublova */ public class Coffee_maker extends BasicKitchenThing { String mode; public Coffee_maker(){ super(); this.mode = "espresso"; this.model = "Cofee maker"; } public boolean SetupMode(String m){ switch(m){ case "espresso": case "Espresso":{ this.mode = "Espresso"; return true; } case "mocca": case "Mocca":{ this.mode = "Mocca"; return true; } case "latte": case "Latte":{ this.mode = "Latte"; return true; } default: return false; } } public String ListModes(){ return "Espresso\nMocca\nLatte"; } @Override public String DisplayAll(){ return super.DisplayAll()+"\nMode: "+this.mode; } @Override public String DisplayAllOperations() { return super.DisplayAllOperations() + "dispm - dispay aviable modes;\nsmode - set preferable mode;"; } }
1,209
0.461538
0.461538
51
21.705883
18.767195
109
false
false
0
0
0
0
0
0
0.333333
false
false
15
e49748c737fcf445ab0cd97fbb3370db9b4b93e5
11,587,821,834,800
178d665f6174b546287f19ba13f71bc0b4534926
/app/src/main/java/com/example/bagus/quiz/Question4.java
80b32d1ba3e8a6884187d045cb85998aaf313ede
[]
no_license
baguskto/Code-Challenge-Binar-Jungle-Phase-Android
https://github.com/baguskto/Code-Challenge-Binar-Jungle-Phase-Android
18a8093cd551f01c9437a5f423241cbe047574cf
4e468620a6547d047e3ddc3be36b06efe86a8d53
refs/heads/master
2020-05-22T07:27:40.678000
2019-05-12T15:01:41
2019-05-12T15:14:13
186,265,605
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.bagus.quiz; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.RadioButton; import android.widget.TextView; public class Question4 extends AppCompatActivity { private Handler handler = new Handler(); private TextView textView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_question4); textView = (TextView) findViewById(R.id.timeView); startTimer(); } int i = 4; Runnable runnable = new Runnable() { @Override public void run() { i--; textView.setText("00:" + i); startTimer(); if (i == 0) { pindah(); } } }; private void pindah() { Intent intent = new Intent(Question4.this, Question5.class); startActivity(intent); } public void startTimer() { handler.postDelayed(runnable, 1000); } public void cancelTimer() { handler.removeCallbacks(runnable); } @Override protected void onStop() { super.onStop(); handler.removeCallbacks(runnable); } public void onRadioButton(View view) { Boolean checked = ((RadioButton) view).isChecked(); } public void nextBtn(View view) { Intent intent = new Intent(Question4.this,Question5.class); startActivity(intent); } }
UTF-8
Java
1,591
java
Question4.java
Java
[]
null
[]
package com.example.bagus.quiz; import android.content.Intent; import android.os.Bundle; import android.os.Handler; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.RadioButton; import android.widget.TextView; public class Question4 extends AppCompatActivity { private Handler handler = new Handler(); private TextView textView; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_question4); textView = (TextView) findViewById(R.id.timeView); startTimer(); } int i = 4; Runnable runnable = new Runnable() { @Override public void run() { i--; textView.setText("00:" + i); startTimer(); if (i == 0) { pindah(); } } }; private void pindah() { Intent intent = new Intent(Question4.this, Question5.class); startActivity(intent); } public void startTimer() { handler.postDelayed(runnable, 1000); } public void cancelTimer() { handler.removeCallbacks(runnable); } @Override protected void onStop() { super.onStop(); handler.removeCallbacks(runnable); } public void onRadioButton(View view) { Boolean checked = ((RadioButton) view).isChecked(); } public void nextBtn(View view) { Intent intent = new Intent(Question4.this,Question5.class); startActivity(intent); } }
1,591
0.62225
0.612822
68
22.397058
19.231668
68
false
false
0
0
0
0
0
0
0.470588
false
false
15