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
4b072ff265396baf3a36851c462c38302c2583c5
17,721,035,064,652
003a6ee01d39c3d5e7d3e57f0bac56bc411d2bd5
/MGGolf2.0/MalengaGolfLibrary/src/main/java/com/boha/malengagolf/library/data/ClubCourseDTO.java
dfdff03fb486695f8ccb47c5698b61fb0335dfd4
[]
no_license
malengatiger/TigerGolf004
https://github.com/malengatiger/TigerGolf004
e9ee4c7b88f384907670971b7e21d5f66a22e096
16c7e5afa26711bf2aab70fc9685cca983d9a2c7
refs/heads/master
2021-01-18T23:43:35.285000
2016-06-08T13:07:47
2016-06-08T13:07:47
54,854,472
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.boha.malengagolf.library.data; import java.io.Serializable; /** * * @author aubreyM */ @SuppressWarnings(value = "unused") public class ClubCourseDTO implements Serializable { private int clubCourseID; private String courseName, clubName; private int holes; private int par; private int parHole1; private int parHole2; private int parHole3; private int parHole4; private int parHole5; private int parHole6; private int parHole7; private int parHole8; private int parHole9; private int parHole10; private int parHole11; private int parHole12; private int parHole13; private int parHole14; private int parHole15; private int parHole16; private int parHole17; private int parHole18; private int clubID; public int getClubCourseID() { return clubCourseID; } public void setClubCourseID(int clubCourseID) { this.clubCourseID = clubCourseID; } public String getCourseName() { return courseName; } public void setCourseName(String courseName) { this.courseName = courseName; } public String getClubName() { return clubName; } public void setClubName(String clubName) { this.clubName = clubName; } public int getHoles() { return holes; } public void setHoles(int holes) { this.holes = holes; } public int getPar() { return par; } public void setPar(int par) { this.par = par; } public int getParHole1() { return parHole1; } public void setParHole1(int parHole1) { this.parHole1 = parHole1; } public int getParHole2() { return parHole2; } public void setParHole2(int parHole2) { this.parHole2 = parHole2; } public int getParHole3() { return parHole3; } public void setParHole3(int parHole3) { this.parHole3 = parHole3; } public int getParHole4() { return parHole4; } public void setParHole4(int parHole4) { this.parHole4 = parHole4; } public int getParHole5() { return parHole5; } public void setParHole5(int parHole5) { this.parHole5 = parHole5; } public int getParHole6() { return parHole6; } public void setParHole6(int parHole6) { this.parHole6 = parHole6; } public int getParHole7() { return parHole7; } public void setParHole7(int parHole7) { this.parHole7 = parHole7; } public int getParHole8() { return parHole8; } public void setParHole8(int parHole8) { this.parHole8 = parHole8; } public int getParHole9() { return parHole9; } public void setParHole9(int parHole9) { this.parHole9 = parHole9; } public int getParHole10() { return parHole10; } public void setParHole10(int parHole10) { this.parHole10 = parHole10; } public int getParHole11() { return parHole11; } public void setParHole11(int parHole11) { this.parHole11 = parHole11; } public int getParHole12() { return parHole12; } public void setParHole12(int parHole12) { this.parHole12 = parHole12; } public int getParHole13() { return parHole13; } public void setParHole13(int parHole13) { this.parHole13 = parHole13; } public int getParHole14() { return parHole14; } public void setParHole14(int parHole14) { this.parHole14 = parHole14; } public int getParHole15() { return parHole15; } public void setParHole15(int parHole15) { this.parHole15 = parHole15; } public int getParHole16() { return parHole16; } public void setParHole16(int parHole16) { this.parHole16 = parHole16; } public int getParHole17() { return parHole17; } public void setParHole17(int parHole17) { this.parHole17 = parHole17; } public int getParHole18() { return parHole18; } public void setParHole18(int parHole18) { this.parHole18 = parHole18; } public int getClubID() { return clubID; } public void setClubID(int clubID) { this.clubID = clubID; } }
UTF-8
Java
4,507
java
ClubCourseDTO.java
Java
[ { "context": "\n\n\nimport java.io.Serializable;\n\n/**\n *\n * @author aubreyM\n */\n@SuppressWarnings(value = \"unused\")\npublic cl", "end": 200, "score": 0.9916635155677795, "start": 193, "tag": "USERNAME", "value": "aubreyM" } ]
null
[]
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package com.boha.malengagolf.library.data; import java.io.Serializable; /** * * @author aubreyM */ @SuppressWarnings(value = "unused") public class ClubCourseDTO implements Serializable { private int clubCourseID; private String courseName, clubName; private int holes; private int par; private int parHole1; private int parHole2; private int parHole3; private int parHole4; private int parHole5; private int parHole6; private int parHole7; private int parHole8; private int parHole9; private int parHole10; private int parHole11; private int parHole12; private int parHole13; private int parHole14; private int parHole15; private int parHole16; private int parHole17; private int parHole18; private int clubID; public int getClubCourseID() { return clubCourseID; } public void setClubCourseID(int clubCourseID) { this.clubCourseID = clubCourseID; } public String getCourseName() { return courseName; } public void setCourseName(String courseName) { this.courseName = courseName; } public String getClubName() { return clubName; } public void setClubName(String clubName) { this.clubName = clubName; } public int getHoles() { return holes; } public void setHoles(int holes) { this.holes = holes; } public int getPar() { return par; } public void setPar(int par) { this.par = par; } public int getParHole1() { return parHole1; } public void setParHole1(int parHole1) { this.parHole1 = parHole1; } public int getParHole2() { return parHole2; } public void setParHole2(int parHole2) { this.parHole2 = parHole2; } public int getParHole3() { return parHole3; } public void setParHole3(int parHole3) { this.parHole3 = parHole3; } public int getParHole4() { return parHole4; } public void setParHole4(int parHole4) { this.parHole4 = parHole4; } public int getParHole5() { return parHole5; } public void setParHole5(int parHole5) { this.parHole5 = parHole5; } public int getParHole6() { return parHole6; } public void setParHole6(int parHole6) { this.parHole6 = parHole6; } public int getParHole7() { return parHole7; } public void setParHole7(int parHole7) { this.parHole7 = parHole7; } public int getParHole8() { return parHole8; } public void setParHole8(int parHole8) { this.parHole8 = parHole8; } public int getParHole9() { return parHole9; } public void setParHole9(int parHole9) { this.parHole9 = parHole9; } public int getParHole10() { return parHole10; } public void setParHole10(int parHole10) { this.parHole10 = parHole10; } public int getParHole11() { return parHole11; } public void setParHole11(int parHole11) { this.parHole11 = parHole11; } public int getParHole12() { return parHole12; } public void setParHole12(int parHole12) { this.parHole12 = parHole12; } public int getParHole13() { return parHole13; } public void setParHole13(int parHole13) { this.parHole13 = parHole13; } public int getParHole14() { return parHole14; } public void setParHole14(int parHole14) { this.parHole14 = parHole14; } public int getParHole15() { return parHole15; } public void setParHole15(int parHole15) { this.parHole15 = parHole15; } public int getParHole16() { return parHole16; } public void setParHole16(int parHole16) { this.parHole16 = parHole16; } public int getParHole17() { return parHole17; } public void setParHole17(int parHole17) { this.parHole17 = parHole17; } public int getParHole18() { return parHole18; } public void setParHole18(int parHole18) { this.parHole18 = parHole18; } public int getClubID() { return clubID; } public void setClubID(int clubID) { this.clubID = clubID; } }
4,507
0.610384
0.568449
232
18.426723
15.901739
52
false
false
0
0
0
0
0
0
0.327586
false
false
3
9d99ae914cb8871f79ce9f9d4a0e0643543b8643
3,246,995,330,887
cbe7cedef93ccb931813abe82ef211495e25526d
/music_voice/src/main/java/com/codesaid_music/model/friend/FriendModel.java
5903edb6eed65c454686708f6f55d0251a6c7412
[]
no_license
CodeSaid/codesaid_music
https://github.com/CodeSaid/codesaid_music
bc3ca4b4884cb74878d1d7ea6ecdb57f4f1e9739
e609b0e66f2e98e3128e8f13da77a319cd25fb78
refs/heads/master
2020-08-30T19:26:26.310000
2019-12-14T15:44:55
2019-12-14T15:44:55
218,468,382
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.codesaid_music.model.friend; import com.codesaid_music.model.BaseModel; import java.util.ArrayList; /** * Created By codesaid * On :2019-11-15 * Package Name: com.codesaid_music.view.friend.model * desc: friend 实体 */ public class FriendModel extends BaseModel { public ArrayList<FriendBodyValue> list; }
UTF-8
Java
332
java
FriendModel.java
Java
[ { "context": "l;\n\nimport java.util.ArrayList;\n\n/**\n * Created By codesaid\n * On :2019-11-15\n * Package Name: com.codesaid_m", "end": 141, "score": 0.9997169971466064, "start": 133, "tag": "USERNAME", "value": "codesaid" } ]
null
[]
package com.codesaid_music.model.friend; import com.codesaid_music.model.BaseModel; import java.util.ArrayList; /** * Created By codesaid * On :2019-11-15 * Package Name: com.codesaid_music.view.friend.model * desc: friend 实体 */ public class FriendModel extends BaseModel { public ArrayList<FriendBodyValue> list; }
332
0.75
0.72561
15
20.866667
18.746969
53
false
false
0
0
0
0
0
0
0.266667
false
false
3
51b516f426d4965affebb759f739587557af512d
3,246,995,329,433
99ba87051f66ecd327228f3b098c929713871e06
/code/src/main/java/padc/dat18c/renoblvd/service/CategoriesService.java
0f27fc3d1a5aea1f4278a37a5e26134b00eacc44
[ "MIT" ]
permissive
Wajiddat18c/padc
https://github.com/Wajiddat18c/padc
52f3ab916124fef28e36a4258cf8a7e4bd2bae71
f78712f2d134b01d990793634ad6d80bc63c7f08
refs/heads/master
2022-09-14T15:32:49.567000
2020-06-03T08:30:53
2020-06-03T08:30:53
257,856,495
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * padc.dat18c.renoblvd.service */ package padc.dat18c.renoblvd.service; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import padc.dat18c.renoblvd.Repository.CategoriesRepo; import padc.dat18c.renoblvd.model.Categories; import java.util.List; import java.util.Optional; /** * This class handles all of the Crud-operations */ @Service public class CategoriesService { final CategoriesRepo categoriesRepo; @Autowired private CategoriesService(CategoriesRepo categoriesRepo){ this.categoriesRepo = categoriesRepo; } public void create(Categories categories){ categoriesRepo.save(categories); } public void delete(int idCategories){ categoriesRepo.deleteById(idCategories); } public void update(Categories categories){ categoriesRepo.save(categories); } public Categories findbyId(int idCategories){ Optional<Categories>find = categoriesRepo.findById(idCategories); if(find.isPresent()){ return find.get(); } return null; } public List<Categories>getAll(){ return (List<Categories>)categoriesRepo.findAll(); } }
UTF-8
Java
1,227
java
CategoriesService.java
Java
[]
null
[]
/** * padc.dat18c.renoblvd.service */ package padc.dat18c.renoblvd.service; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import padc.dat18c.renoblvd.Repository.CategoriesRepo; import padc.dat18c.renoblvd.model.Categories; import java.util.List; import java.util.Optional; /** * This class handles all of the Crud-operations */ @Service public class CategoriesService { final CategoriesRepo categoriesRepo; @Autowired private CategoriesService(CategoriesRepo categoriesRepo){ this.categoriesRepo = categoriesRepo; } public void create(Categories categories){ categoriesRepo.save(categories); } public void delete(int idCategories){ categoriesRepo.deleteById(idCategories); } public void update(Categories categories){ categoriesRepo.save(categories); } public Categories findbyId(int idCategories){ Optional<Categories>find = categoriesRepo.findById(idCategories); if(find.isPresent()){ return find.get(); } return null; } public List<Categories>getAll(){ return (List<Categories>)categoriesRepo.findAll(); } }
1,227
0.712306
0.705786
48
24.5625
21.689962
73
false
false
0
0
0
0
0
0
0.333333
false
false
3
a0777c3750dbe5e4ab704233b21c22a8bd49cb6e
28,870,770,185,470
a37e0cf7eeb5a7acf1f8042a51a5a4b92a851c26
/Mpoo_2019.1/estudo_1VA/sistemaLivraria/view/TelaConsulta.java
e4776093935cbb7a6637c17387a6237d08ce95c0
[]
no_license
ZoawBR/Mpoo
https://github.com/ZoawBR/Mpoo
243a683d1faf7f42bdbc0580da0c0db654e64bbd
8e9536a7529b64ad78a9d1d42842d47422519d37
refs/heads/master
2020-05-02T10:27:21.621000
2019-11-04T22:24:37
2019-11-04T22:24:37
177,897,392
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package view; import java.awt.FlowLayout; import javax.swing.JScrollPane; import javax.swing.JTextArea; public class TelaConsulta extends TelaAbstrata{ JTextArea infoArea; String entrada; public TelaConsulta() { super(); setSize(200, 160); setDefaultCloseOperation(DISPOSE_ON_CLOSE); setLayout(new FlowLayout()); infoArea = new JTextArea("Dados do Estoque: ", 6, 15); infoArea.setEditable(false); infoArea.setText(entrada); JScrollPane scroll = new JScrollPane(infoArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); add(scroll); } public JTextArea getInfoArea() { return infoArea; } public void setInfoArea(JTextArea infoArea) { this.infoArea = infoArea; } public String getEntrada() { return entrada; } public void setEntrada(String entrada) { this.entrada = entrada; } }
UTF-8
Java
852
java
TelaConsulta.java
Java
[]
null
[]
package view; import java.awt.FlowLayout; import javax.swing.JScrollPane; import javax.swing.JTextArea; public class TelaConsulta extends TelaAbstrata{ JTextArea infoArea; String entrada; public TelaConsulta() { super(); setSize(200, 160); setDefaultCloseOperation(DISPOSE_ON_CLOSE); setLayout(new FlowLayout()); infoArea = new JTextArea("Dados do Estoque: ", 6, 15); infoArea.setEditable(false); infoArea.setText(entrada); JScrollPane scroll = new JScrollPane(infoArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); add(scroll); } public JTextArea getInfoArea() { return infoArea; } public void setInfoArea(JTextArea infoArea) { this.infoArea = infoArea; } public String getEntrada() { return entrada; } public void setEntrada(String entrada) { this.entrada = entrada; } }
852
0.748826
0.738263
36
22.666666
23.679573
128
false
false
0
0
0
0
0
0
1.75
false
false
3
a58c81a0665cb466584437bb13540a33f12916fe
4,088,808,902,617
f9b270f8ce38103d0d797942a714fd152d2f6a9d
/src/main/java/com/bohdan/service/serviceImpl/TaskServiceImpl.java
3b2b48210ca5a5221739b803d14cbe52207cee9b
[]
no_license
Bohdan9/NerdySoftTask
https://github.com/Bohdan9/NerdySoftTask
30c8b86edb813d8ddd75eec392c903697d1b242b
73608afabf8effc3bc47bf24e0a29d951b8321ad
refs/heads/master
2020-05-22T16:52:17.094000
2019-05-14T00:22:58
2019-05-14T00:22:58
186,438,992
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.bohdan.service.serviceImpl; import com.bohdan.model.Task; import com.bohdan.repository.TaskRepository; import com.bohdan.service.TaskService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service public class TaskServiceImpl implements TaskService { @Autowired TaskRepository taskRepository; @Autowired UserServiceImpl userService; @Override public Task findById(int id) { return taskRepository.findById(id).get(); } @Override public Task update(Task task) { return taskRepository.save(task); } @Override public void addTask(Task task) { taskRepository.save(task); } @Override public List<Task> findAllTaskById(int id) { return taskRepository.findAllByUserId(id); } @Override public List<Task> findAll() { return taskRepository.findAll(); } @Override public void deleteTask(int id) { taskRepository.deleteById(id); } @Override public Task findBySendFrom(String sendFrom) { return taskRepository.findBySendFrom(sendFrom); } @Override public Task findByDescribeTask(String describe) { return (taskRepository.findByDescribeTask(describe)); } @Override public Task findByTextForTask(String text) { return taskRepository.findByTextForTask(text); } }
UTF-8
Java
1,456
java
TaskServiceImpl.java
Java
[]
null
[]
package com.bohdan.service.serviceImpl; import com.bohdan.model.Task; import com.bohdan.repository.TaskRepository; import com.bohdan.service.TaskService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.util.List; @Service public class TaskServiceImpl implements TaskService { @Autowired TaskRepository taskRepository; @Autowired UserServiceImpl userService; @Override public Task findById(int id) { return taskRepository.findById(id).get(); } @Override public Task update(Task task) { return taskRepository.save(task); } @Override public void addTask(Task task) { taskRepository.save(task); } @Override public List<Task> findAllTaskById(int id) { return taskRepository.findAllByUserId(id); } @Override public List<Task> findAll() { return taskRepository.findAll(); } @Override public void deleteTask(int id) { taskRepository.deleteById(id); } @Override public Task findBySendFrom(String sendFrom) { return taskRepository.findBySendFrom(sendFrom); } @Override public Task findByDescribeTask(String describe) { return (taskRepository.findByDescribeTask(describe)); } @Override public Task findByTextForTask(String text) { return taskRepository.findByTextForTask(text); } }
1,456
0.695742
0.695742
65
21.4
19.938211
62
false
false
0
0
0
0
0
0
0.276923
false
false
3
007a1d80594888324dfafba063860b9b3f263837
14,585,708,948,640
10378c580b62125a184f74f595d2c37be90a5769
/com/github/steveice10/netty/handler/ssl/JdkApplicationProtocolNegotiator.java
78f9a996a61fd6b41fc8452f677b2d1c2585f032
[]
no_license
ClientPlayground/Melon-Client
https://github.com/ClientPlayground/Melon-Client
4299d7f3e8f2446ae9f225c0d7fcc770d4d48ecb
afc9b11493e15745b78dec1c2b62bb9e01573c3d
refs/heads/beta-v2
2023-04-05T20:17:00.521000
2021-03-14T19:13:31
2021-03-14T19:13:31
347,509,882
33
19
null
false
2021-03-14T19:13:32
2021-03-14T00:27:40
2021-03-14T16:36:27
2021-03-14T19:13:31
4
2
1
0
null
false
false
package com.github.steveice10.netty.handler.ssl; import com.github.steveice10.netty.buffer.ByteBufAllocator; import java.util.List; import java.util.Set; import javax.net.ssl.SSLEngine; @Deprecated public interface JdkApplicationProtocolNegotiator extends ApplicationProtocolNegotiator { SslEngineWrapperFactory wrapperFactory(); ProtocolSelectorFactory protocolSelectorFactory(); ProtocolSelectionListenerFactory protocolListenerFactory(); public static interface ProtocolSelectionListenerFactory { JdkApplicationProtocolNegotiator.ProtocolSelectionListener newListener(SSLEngine param1SSLEngine, List<String> param1List); } public static interface ProtocolSelectorFactory { JdkApplicationProtocolNegotiator.ProtocolSelector newSelector(SSLEngine param1SSLEngine, Set<String> param1Set); } public static interface ProtocolSelectionListener { void unsupported(); void selected(String param1String) throws Exception; } public static interface ProtocolSelector { void unsupported(); String select(List<String> param1List) throws Exception; } public static abstract class AllocatorAwareSslEngineWrapperFactory implements SslEngineWrapperFactory { public final SSLEngine wrapSslEngine(SSLEngine engine, JdkApplicationProtocolNegotiator applicationNegotiator, boolean isServer) { return wrapSslEngine(engine, ByteBufAllocator.DEFAULT, applicationNegotiator, isServer); } abstract SSLEngine wrapSslEngine(SSLEngine param1SSLEngine, ByteBufAllocator param1ByteBufAllocator, JdkApplicationProtocolNegotiator param1JdkApplicationProtocolNegotiator, boolean param1Boolean); } public static interface SslEngineWrapperFactory { SSLEngine wrapSslEngine(SSLEngine param1SSLEngine, JdkApplicationProtocolNegotiator param1JdkApplicationProtocolNegotiator, boolean param1Boolean); } }
UTF-8
Java
1,885
java
JdkApplicationProtocolNegotiator.java
Java
[ { "context": "package com.github.steveice10.netty.handler.ssl;\n\nimport com.github.steveice10.", "end": 29, "score": 0.999546229839325, "start": 19, "tag": "USERNAME", "value": "steveice10" }, { "context": ".steveice10.netty.handler.ssl;\n\nimport com.github.steveice10.netty.buffer.ByteBufAllocator;\nimport java.util.L", "end": 78, "score": 0.9995337724685669, "start": 68, "tag": "USERNAME", "value": "steveice10" } ]
null
[]
package com.github.steveice10.netty.handler.ssl; import com.github.steveice10.netty.buffer.ByteBufAllocator; import java.util.List; import java.util.Set; import javax.net.ssl.SSLEngine; @Deprecated public interface JdkApplicationProtocolNegotiator extends ApplicationProtocolNegotiator { SslEngineWrapperFactory wrapperFactory(); ProtocolSelectorFactory protocolSelectorFactory(); ProtocolSelectionListenerFactory protocolListenerFactory(); public static interface ProtocolSelectionListenerFactory { JdkApplicationProtocolNegotiator.ProtocolSelectionListener newListener(SSLEngine param1SSLEngine, List<String> param1List); } public static interface ProtocolSelectorFactory { JdkApplicationProtocolNegotiator.ProtocolSelector newSelector(SSLEngine param1SSLEngine, Set<String> param1Set); } public static interface ProtocolSelectionListener { void unsupported(); void selected(String param1String) throws Exception; } public static interface ProtocolSelector { void unsupported(); String select(List<String> param1List) throws Exception; } public static abstract class AllocatorAwareSslEngineWrapperFactory implements SslEngineWrapperFactory { public final SSLEngine wrapSslEngine(SSLEngine engine, JdkApplicationProtocolNegotiator applicationNegotiator, boolean isServer) { return wrapSslEngine(engine, ByteBufAllocator.DEFAULT, applicationNegotiator, isServer); } abstract SSLEngine wrapSslEngine(SSLEngine param1SSLEngine, ByteBufAllocator param1ByteBufAllocator, JdkApplicationProtocolNegotiator param1JdkApplicationProtocolNegotiator, boolean param1Boolean); } public static interface SslEngineWrapperFactory { SSLEngine wrapSslEngine(SSLEngine param1SSLEngine, JdkApplicationProtocolNegotiator param1JdkApplicationProtocolNegotiator, boolean param1Boolean); } }
1,885
0.822281
0.813263
47
39.106384
47.088524
201
false
false
0
0
0
0
0
0
0.617021
false
false
3
6023afd79c7b108a86f74348bcb7d00b12a839de
24,575,802,935,033
6a2f63d971fd5ce988c10cdc2401aae3ba5e0fee
/hawk/ui/clickgui/PostmanTheme.java
a1f5e74ed45e20c9031055671889bda81023a25b
[ "MIT" ]
permissive
MikeWuang/hawk-client
https://github.com/MikeWuang/hawk-client
22d0d723b70826f74d91f0928384513a419592c1
7f62687c62709c595e2945d71678984ba1b832ea
refs/heads/main
2023-04-05T19:50:35.459000
2021-04-28T00:52:19
2021-04-28T00:52:19
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package hawk.ui.clickgui; import com.lukflug.panelstudio.Context; import com.lukflug.panelstudio.theme.ColorScheme; import com.lukflug.panelstudio.theme.Renderer; import com.lukflug.panelstudio.theme.RendererBase; import com.lukflug.panelstudio.theme.Theme; import hawk.util.JColor; import java.awt.Color; import java.awt.Dimension; import java.awt.Point; import java.awt.Rectangle; public class PostmanTheme implements Theme { protected Renderer containerRenderer; protected Renderer panelRenderer; protected ColorScheme scheme; protected Renderer componentRenderer; public Renderer getComponentRenderer() { return this.componentRenderer; } public Renderer getPanelRenderer() { return this.panelRenderer; } public Renderer getContainerRenderer() { return this.containerRenderer; } public PostmanTheme(ColorScheme var1, int var2, int var3) { this.scheme = var1; this.panelRenderer = new PostmanTheme.ComponentRenderer(this, 0, var2, var3); this.containerRenderer = new PostmanTheme.ComponentRenderer(this, 1, var2, var3); this.componentRenderer = new PostmanTheme.ComponentRenderer(this, 2, var2, var3); } protected class ComponentRenderer extends RendererBase { final PostmanTheme this$0; protected final int level; protected final int border; public Color getMainColor(boolean var1, boolean var2) { Color var3; if (var2 && this.level > 0) { var3 = this.getColorScheme().getActiveColor(); } else { var3 = this.getColorScheme().getBackgroundColor(); } if (!var2 && this.level < 2) { var3 = this.getColorScheme().getInactiveColor(); } if (var2 && this.level < 1) { var3 = this.getColorScheme().getOutlineColor(); } var3 = new Color(var3.getRed(), var3.getGreen(), var3.getBlue(), this.getColorScheme().getOpacity()); return var3; } public void renderBackground(Context var1, boolean var2) { Color var3 = this.getBackgroundColor(var2); var1.getInterface().fillRect(var1.getRect(), var3, var3, var3, var3); } public Color getBackgroundColor(boolean var1) { Color var2 = this.getColorScheme().getInactiveColor(); var2 = new Color(var2.getRed(), var2.getGreen(), var2.getBlue(), this.getColorScheme().getOpacity()); return var2; } public ColorScheme getDefaultColorScheme() { return this.this$0.scheme; } public void renderBorder(Context var1, boolean var2, boolean var3, boolean var4) { Color var5 = this.getDefaultColorScheme().getOutlineColor(); if (this.level == 1 && var4) { var1.getInterface().fillRect(new Rectangle(var1.getPos(), new Dimension(1, var1.getSize().height)), var5, var5, var5, var5); var1.getInterface().fillRect(new Rectangle(new Point(var1.getPos().x + var1.getSize().width - 1, var1.getPos().y), new Dimension(1, var1.getSize().height)), var5, var5, var5, var5); } } public void renderRect(Context var1, String var2, boolean var3, boolean var4, Rectangle var5, boolean var6) { Color var7 = this.getMainColor(var3, var4); var1.getInterface().fillRect(var5, var7, var7, var7, var7); if (var6) { Object var8; if (var1.isHovered()) { var8 = new JColor(114, 137, 218, 100); } else { var8 = new Color(255, 255, 255, 0); } var1.getInterface().fillRect(var1.getRect(), (Color)var8, (Color)var8, (Color)var8, (Color)var8); } Point var9 = new Point(var5.getLocation()); var9.translate(0, this.border); var1.getInterface().drawString(var9, var2, this.getFontColor(var3)); } public ComponentRenderer(PostmanTheme var1, int var2, int var3, int var4) { super(var3 + 1, 1, 1, 0, 0); this.this$0 = var1; this.level = var2; this.border = var4; } } }
UTF-8
Java
4,090
java
PostmanTheme.java
Java
[]
null
[]
package hawk.ui.clickgui; import com.lukflug.panelstudio.Context; import com.lukflug.panelstudio.theme.ColorScheme; import com.lukflug.panelstudio.theme.Renderer; import com.lukflug.panelstudio.theme.RendererBase; import com.lukflug.panelstudio.theme.Theme; import hawk.util.JColor; import java.awt.Color; import java.awt.Dimension; import java.awt.Point; import java.awt.Rectangle; public class PostmanTheme implements Theme { protected Renderer containerRenderer; protected Renderer panelRenderer; protected ColorScheme scheme; protected Renderer componentRenderer; public Renderer getComponentRenderer() { return this.componentRenderer; } public Renderer getPanelRenderer() { return this.panelRenderer; } public Renderer getContainerRenderer() { return this.containerRenderer; } public PostmanTheme(ColorScheme var1, int var2, int var3) { this.scheme = var1; this.panelRenderer = new PostmanTheme.ComponentRenderer(this, 0, var2, var3); this.containerRenderer = new PostmanTheme.ComponentRenderer(this, 1, var2, var3); this.componentRenderer = new PostmanTheme.ComponentRenderer(this, 2, var2, var3); } protected class ComponentRenderer extends RendererBase { final PostmanTheme this$0; protected final int level; protected final int border; public Color getMainColor(boolean var1, boolean var2) { Color var3; if (var2 && this.level > 0) { var3 = this.getColorScheme().getActiveColor(); } else { var3 = this.getColorScheme().getBackgroundColor(); } if (!var2 && this.level < 2) { var3 = this.getColorScheme().getInactiveColor(); } if (var2 && this.level < 1) { var3 = this.getColorScheme().getOutlineColor(); } var3 = new Color(var3.getRed(), var3.getGreen(), var3.getBlue(), this.getColorScheme().getOpacity()); return var3; } public void renderBackground(Context var1, boolean var2) { Color var3 = this.getBackgroundColor(var2); var1.getInterface().fillRect(var1.getRect(), var3, var3, var3, var3); } public Color getBackgroundColor(boolean var1) { Color var2 = this.getColorScheme().getInactiveColor(); var2 = new Color(var2.getRed(), var2.getGreen(), var2.getBlue(), this.getColorScheme().getOpacity()); return var2; } public ColorScheme getDefaultColorScheme() { return this.this$0.scheme; } public void renderBorder(Context var1, boolean var2, boolean var3, boolean var4) { Color var5 = this.getDefaultColorScheme().getOutlineColor(); if (this.level == 1 && var4) { var1.getInterface().fillRect(new Rectangle(var1.getPos(), new Dimension(1, var1.getSize().height)), var5, var5, var5, var5); var1.getInterface().fillRect(new Rectangle(new Point(var1.getPos().x + var1.getSize().width - 1, var1.getPos().y), new Dimension(1, var1.getSize().height)), var5, var5, var5, var5); } } public void renderRect(Context var1, String var2, boolean var3, boolean var4, Rectangle var5, boolean var6) { Color var7 = this.getMainColor(var3, var4); var1.getInterface().fillRect(var5, var7, var7, var7, var7); if (var6) { Object var8; if (var1.isHovered()) { var8 = new JColor(114, 137, 218, 100); } else { var8 = new Color(255, 255, 255, 0); } var1.getInterface().fillRect(var1.getRect(), (Color)var8, (Color)var8, (Color)var8, (Color)var8); } Point var9 = new Point(var5.getLocation()); var9.translate(0, this.border); var1.getInterface().drawString(var9, var2, this.getFontColor(var3)); } public ComponentRenderer(PostmanTheme var1, int var2, int var3, int var4) { super(var3 + 1, 1, 1, 0, 0); this.this$0 = var1; this.level = var2; this.border = var4; } } }
4,090
0.640587
0.60489
114
34.877193
33.493423
193
false
false
0
0
0
0
0
0
1.078947
false
false
3
7abc5722b82296efec00d17d8ac8d3a4bbfe4c1c
10,402,410,817,926
850a163f3d8d406f7fe750b0ff3e13781bd175ee
/eBFS/src/com/bfs/eBFS/HelloWorld.java
c73ac532b2da785f06302401c7bfb9e939042dd3
[]
no_license
Shiplu777/eBFS
https://github.com/Shiplu777/eBFS
87bb98d46085572332176356cb9128038dd76d47
ba50b0edd99976c5784fddb864ee5a8d74028ed1
refs/heads/master
2021-01-10T15:43:22.471000
2016-12-15T16:00:49
2016-12-15T16:00:49
50,382,520
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.bfs.eBFS; public class HelloWorld { public static void main(String[] args) { System.out.println("Hello BruteForce Solutions Inc."); System.out.println("We are learning Java"); } }
UTF-8
Java
213
java
HelloWorld.java
Java
[]
null
[]
package com.bfs.eBFS; public class HelloWorld { public static void main(String[] args) { System.out.println("Hello BruteForce Solutions Inc."); System.out.println("We are learning Java"); } }
213
0.676056
0.676056
11
17.363636
20.441814
56
false
false
0
0
0
0
0
0
0.818182
false
false
3
e8bd23c1a286454a3cfb1c92bb75de80f9f45066
8,684,423,924,183
b69665fcf2902744042fef110fae92fc7f3b7af0
/app/src/main/java/alex/moneymanager/db/DbFields.java
e36a5659265ea3656e5a10566c414477a2c5d11f
[]
no_license
marinovskiy/MoneyManager2
https://github.com/marinovskiy/MoneyManager2
f6f966a775bcf1518664a24754fec15fedc48292
dbaeb80737f142ec9c5f89db0a13f743056bbbbc
refs/heads/master
2021-01-25T04:09:33.778000
2017-06-14T20:11:50
2017-06-14T20:11:50
93,403,920
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package alex.moneymanager.db; public class DbFields { /** * General */ public static final String DB_NAME = "money_manager.realm"; public static final int DB_VERSION = 1; /** * Accounts */ public static final String ACCOUNT_ID = "id"; /** * Operations */ public static final String OPERATION_ID = "id"; /** * Organizations */ public static final String ORGANIZATION_ID = "id"; /** * News */ public static final String NEWS_ID = "id"; }
UTF-8
Java
535
java
DbFields.java
Java
[]
null
[]
package alex.moneymanager.db; public class DbFields { /** * General */ public static final String DB_NAME = "money_manager.realm"; public static final int DB_VERSION = 1; /** * Accounts */ public static final String ACCOUNT_ID = "id"; /** * Operations */ public static final String OPERATION_ID = "id"; /** * Organizations */ public static final String ORGANIZATION_ID = "id"; /** * News */ public static final String NEWS_ID = "id"; }
535
0.564486
0.562617
30
16.866667
18.627459
63
false
false
0
0
0
0
0
0
0.233333
false
false
3
c33dd31b700ea31857c1dbe147073920a63ece44
10,033,043,655,057
f3c0028d4138c69c4ce24b2fd01e4ca595a6af4d
/app/src/main/java/com/siweisoft/appthread/AppThread.java
fb6de72f3a116ac2768140dae1ad64b9fc8012bf
[]
no_license
canvaser/desktop
https://github.com/canvaser/desktop
83138fa37b36a02d4663d5e9cb136313f501a43e
7652ece27d050d627c95fe0934734bf05db2cb0e
refs/heads/master
2021-01-13T03:09:42.346000
2017-02-07T01:43:59
2017-02-07T01:43:59
77,433,645
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.siweisoft.appthread; import com.siweisoft.base.ui.interf.OnNetFinishWithObjInter; import com.siweisoft.util.LogUtil; /** * Created by ${viwmox} on 2016-07-22. */ public class AppThread extends Thread{ private static AppThread instance; public boolean stop = true; public boolean pause = true; public long sleepTime = 60000; private static OnNetFinishWithObjInter o; int count = 0; private AppThread(){ } public static AppThread getInstance(OnNetFinishWithObjInter o){ AppThread.o=o; if(instance==null){ instance = new AppThread(); } return instance; } public AppThread init(){ stop= false; pause = false; count = 0; return instance; } @Override public void run() { super.run(); while(!stop){ if(!pause){ doThing(count); try { Thread.sleep(sleepTime); count++; } catch (InterruptedException e) { e.printStackTrace(); } } } } public void doThing(int count){ if(o!=null){ o.onNetFinish(count); } } }
UTF-8
Java
1,271
java
AppThread.java
Java
[ { "context": " com.siweisoft.util.LogUtil;\n\n/**\n * Created by ${viwmox} on 2016-07-22.\n */\npublic class AppThread extend", "end": 157, "score": 0.9936413764953613, "start": 151, "tag": "USERNAME", "value": "viwmox" } ]
null
[]
package com.siweisoft.appthread; import com.siweisoft.base.ui.interf.OnNetFinishWithObjInter; import com.siweisoft.util.LogUtil; /** * Created by ${viwmox} on 2016-07-22. */ public class AppThread extends Thread{ private static AppThread instance; public boolean stop = true; public boolean pause = true; public long sleepTime = 60000; private static OnNetFinishWithObjInter o; int count = 0; private AppThread(){ } public static AppThread getInstance(OnNetFinishWithObjInter o){ AppThread.o=o; if(instance==null){ instance = new AppThread(); } return instance; } public AppThread init(){ stop= false; pause = false; count = 0; return instance; } @Override public void run() { super.run(); while(!stop){ if(!pause){ doThing(count); try { Thread.sleep(sleepTime); count++; } catch (InterruptedException e) { e.printStackTrace(); } } } } public void doThing(int count){ if(o!=null){ o.onNetFinish(count); } } }
1,271
0.531865
0.520063
65
18.553846
16.681664
68
false
false
0
0
0
0
0
0
0.338462
false
false
3
2cdb9cfd4dafbc011ff50d175297e4d182b76075
19,284,403,229,228
12843775ed6f28da781dd39cddd067f6b8715dca
/src/main/java/com/xz/service/atom/interfaces/ISysLogAtomSV.java
25604e0ae3e8c1c642fb358da744441fa7952900
[]
no_license
yuansic/xzlb
https://github.com/yuansic/xzlb
2aeddcdc0c6472407b431d078e38b77bff8a6056
887580658d1da66580287e9af600df1dacfe69ab
refs/heads/master
2022-11-18T20:47:58.195000
2019-05-30T05:57:36
2019-05-30T05:57:36
181,724,772
0
1
null
false
2022-11-16T11:44:54
2019-04-16T16:14:21
2019-05-30T07:11:52
2022-11-16T11:44:51
158
0
1
9
Java
false
false
package com.xz.service.atom.interfaces; import com.xz.entity.BopSysLog; import java.util.List; /** * 系统操作日志原子层接口 * * @author xuby * @version 2019/2/22 0022 */ public interface ISysLogAtomSV { /** * 新增系统操作日志 * * @param syslog */ void insert(BopSysLog syslog); /** * 查询所有日志信息 * * @param syslog {@link BopSysLog} * @return */ List<BopSysLog> findAllList(BopSysLog syslog); }
UTF-8
Java
498
java
ISysLogAtomSV.java
Java
[ { "context": " java.util.List;\n\n/**\n * 系统操作日志原子层接口\n *\n * @author xuby\n * @version 2019/2/22 0022\n */\npublic interface I", "end": 136, "score": 0.9995781779289246, "start": 132, "tag": "USERNAME", "value": "xuby" } ]
null
[]
package com.xz.service.atom.interfaces; import com.xz.entity.BopSysLog; import java.util.List; /** * 系统操作日志原子层接口 * * @author xuby * @version 2019/2/22 0022 */ public interface ISysLogAtomSV { /** * 新增系统操作日志 * * @param syslog */ void insert(BopSysLog syslog); /** * 查询所有日志信息 * * @param syslog {@link BopSysLog} * @return */ List<BopSysLog> findAllList(BopSysLog syslog); }
498
0.596847
0.572072
30
13.8
13.917376
50
false
false
0
0
0
0
0
0
0.166667
false
false
3
9e97103237ff43ca206434258af2cd6fb1292da0
15,006,615,739,584
1e04d9fca6e7412466409b23669831bab716ff2d
/Monaqsat/src/com/monaqsat/network/ArchiveSubSectorCall.java
304173b9e397dfe12d7d6e61948284f1ba67a623
[]
no_license
saurabhomi/Monaqsat_workspace_new
https://github.com/saurabhomi/Monaqsat_workspace_new
eeefbcef3ca96fb3d0e498e3d8dfb4362bb9bd8a
7d2eb0637efa210a87a34f6044d3b5ca31fee74f
refs/heads/master
2021-05-15T02:04:56.313000
2021-04-13T12:53:10
2021-04-13T12:53:10
250,197,493
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.monaqsat.network; import android.util.Log; import com.monaqsat.beans.ArchiveSubSectorBean; import com.monaqsat.beans.PagingBean; import com.monaqsat.callbacks.ArchiveSubSectorCallback; import com.monaqsat.exception.Err; import com.monaqsat.util.Base64Converter; import com.monaqsat.util.ConstantValues; import org.json.JSONArray; import org.json.JSONObject; import org.ksoap2.serialization.SoapObject; import java.util.ArrayList; public class ArchiveSubSectorCall extends Base64Converter implements Runnable { private static final String METHOD = "GetArchivesSubSectors"; private ArchiveSubSectorBean bean; private PagingBean pagingBean; private ArchiveSubSectorCallback listener; public ArchiveSubSectorCall(ArchiveSubSectorBean bean, PagingBean pagingBean, ArchiveSubSectorCallback listener) { this.bean = bean; this.pagingBean = pagingBean; this.listener = listener; } public void start() { Thread t = new Thread(this); t.start(); } @Override public void run() { try { SoapObject requestObject = new SoapObject(ConstantValues.NAMESPACE, METHOD); addProperty(requestObject, bean.getStrTokenId(), bean.getStrPasskey()); requestObject.addProperty("strSectorId", getBase64EncodedString(bean.getStrSectorId())); requestObject.addProperty("StartIndex", getBase64EncodedString(pagingBean.getStartIndex())); requestObject.addProperty("NumRows", getBase64EncodedString(pagingBean.getNumRows())); String response = NetworkUtil.hit(requestObject, ConstantValues.NAMESPACE + METHOD, ConstantValues.ARCHIVE_URL); parse(getBase64DecodedString(response)); } catch (Err e) { listener.onError(e.getLocalizedMessage()); } catch (Exception e) { listener.onError(e.getLocalizedMessage()); } } private void parse(String response) { Log.e("", "response = " + response); try { ArrayList<ArchiveSubSectorBean> beanList = new ArrayList<ArchiveSubSectorBean>(); JSONArray requestArray = new JSONArray(response); for (int i = 0; i < requestArray.length(); i++) { JSONObject requestObject = requestArray.getJSONObject(i); ArchiveSubSectorBean bean = new ArchiveSubSectorBean(); bean.setIntSubSectorId(requestObject.getInt("intSubSectorId")); bean.setStrSubSectorNameEn(requestObject.getString("SubSectorNameEn")); bean.setTotalRecords("" + requestObject.getInt("TotalRecords")); bean.setNewRecords(requestObject.getString("NewRecords")); bean.setStrSubSectorLogo(requestObject.getString("strSubSectorLogo")); bean.setIadsActive(requestObject.getString("IadsActive")); beanList.add(bean); } listener.onArchiveSubSectorCallBack(beanList); } catch (Exception e) { listener.onError(e.getLocalizedMessage()); } } }
UTF-8
Java
3,091
java
ArchiveSubSectorCall.java
Java
[]
null
[]
package com.monaqsat.network; import android.util.Log; import com.monaqsat.beans.ArchiveSubSectorBean; import com.monaqsat.beans.PagingBean; import com.monaqsat.callbacks.ArchiveSubSectorCallback; import com.monaqsat.exception.Err; import com.monaqsat.util.Base64Converter; import com.monaqsat.util.ConstantValues; import org.json.JSONArray; import org.json.JSONObject; import org.ksoap2.serialization.SoapObject; import java.util.ArrayList; public class ArchiveSubSectorCall extends Base64Converter implements Runnable { private static final String METHOD = "GetArchivesSubSectors"; private ArchiveSubSectorBean bean; private PagingBean pagingBean; private ArchiveSubSectorCallback listener; public ArchiveSubSectorCall(ArchiveSubSectorBean bean, PagingBean pagingBean, ArchiveSubSectorCallback listener) { this.bean = bean; this.pagingBean = pagingBean; this.listener = listener; } public void start() { Thread t = new Thread(this); t.start(); } @Override public void run() { try { SoapObject requestObject = new SoapObject(ConstantValues.NAMESPACE, METHOD); addProperty(requestObject, bean.getStrTokenId(), bean.getStrPasskey()); requestObject.addProperty("strSectorId", getBase64EncodedString(bean.getStrSectorId())); requestObject.addProperty("StartIndex", getBase64EncodedString(pagingBean.getStartIndex())); requestObject.addProperty("NumRows", getBase64EncodedString(pagingBean.getNumRows())); String response = NetworkUtil.hit(requestObject, ConstantValues.NAMESPACE + METHOD, ConstantValues.ARCHIVE_URL); parse(getBase64DecodedString(response)); } catch (Err e) { listener.onError(e.getLocalizedMessage()); } catch (Exception e) { listener.onError(e.getLocalizedMessage()); } } private void parse(String response) { Log.e("", "response = " + response); try { ArrayList<ArchiveSubSectorBean> beanList = new ArrayList<ArchiveSubSectorBean>(); JSONArray requestArray = new JSONArray(response); for (int i = 0; i < requestArray.length(); i++) { JSONObject requestObject = requestArray.getJSONObject(i); ArchiveSubSectorBean bean = new ArchiveSubSectorBean(); bean.setIntSubSectorId(requestObject.getInt("intSubSectorId")); bean.setStrSubSectorNameEn(requestObject.getString("SubSectorNameEn")); bean.setTotalRecords("" + requestObject.getInt("TotalRecords")); bean.setNewRecords(requestObject.getString("NewRecords")); bean.setStrSubSectorLogo(requestObject.getString("strSubSectorLogo")); bean.setIadsActive(requestObject.getString("IadsActive")); beanList.add(bean); } listener.onArchiveSubSectorCallBack(beanList); } catch (Exception e) { listener.onError(e.getLocalizedMessage()); } } }
3,091
0.682303
0.677774
78
38.628204
32.739887
124
false
false
0
0
0
0
0
0
0.730769
false
false
3
29b6734a62c078e4d20d2924e015b804a1bd4c37
24,678,882,087,603
9cdfc9d1ead948ea5afd79eec415d1f689f6cde2
/src/main/java/stringhandling/StringSplitReplace.java
9d992927cb392d08d9b8b770e2aeb79375a30d6c
[]
no_license
ssenthiv/FullStackAutomation
https://github.com/ssenthiv/FullStackAutomation
4d1ad2e2aa7faaca380eabe101ac7cac56d60e4b
c6e2a07a554c6cf5c6a1c0d0872d73a7b4ded3af
refs/heads/master
2020-04-06T20:11:06.876000
2018-11-15T19:54:18
2018-11-15T19:54:18
157,759,677
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package stringhandling; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Calendar; import java.util.regex.Matcher; import java.util.regex.Pattern; public class StringSplitReplace { public void splitStr(String str){ String[] strArray=null; strArray= str.split("\\s+"); // regexp for one or more space for (String s : strArray){ System.out.println( s); } } public void replaceStr(){ String str="This is the first linefirst release of 65 53333v and 633..12 also 72ve.rsion"; System.out.println("\nstr : "+str); System.out.println("Regex : ^[T|t] : "+str.replaceAll("^[T|t]", " ")); System.out.println("Regex : \\sfirst\\s : "+str.replaceAll("\\sfirst\\s", "REPLACED")); System.out.println("Regex : \\d+..(\\.\\d)? : "+str.replaceAll("\\d+([v]|\\.)?", "")); // ? -> 0 or 1 pattern str=Calendar.getInstance().getTime().toString(); System.out.println("str : "+ str); System.out.println("Regex : \\d{2}:\\d{2}:\\d{2}: "+str.replaceAll("\\d{2}:\\d{2}:\\d{2}", "XX:XX:XX")); } public void patternMatching(){ String str="SightLine Version Platinum release 53.0.04"; System.out.println("str : "+str); System.out.println("Regexp : ^[S|s](.+) : "+str.matches("^[S|s](.+)")); Pattern p=Pattern.compile("(.+)[V|v]ersion(.+)"); Matcher m=p.matcher(str); System.out.println("Regexp : (.+)[V|v]ersion(.+) : "+m.matches()); System.out.println("Regexp : ([A-Za-z0-9[\\s][.]])+ : "+Pattern.matches("([A-Za-z0-9[\\s][.]])+",str)); // allows A-Z a-z 0-9 ' ' . System.out.println("Regexp : (.+)\\d.\\d.\\d(.+) : "+str.matches("(.+)\\d{2}.\\d{1}.\\d{2}(.+)?")); // matches dd.d.dd System.out.println("------------------------"); String s=" Version 995 st"; System.out.println(s); System.out.println("Regexp : : "+s.matches("(.*)\\d{2}(.*)")); } public static void main(String args[]){ //System.out.println("Enter the line"); String str="Split the given line"; StringSplitReplace sr=new StringSplitReplace(); System.out.println("1.line splitting using str.split() "); sr.splitStr(str); System.out.println("\n2. Replace string using regexp"); sr.replaceStr(); System.out.println("\n3. Pattern matching using reqexp"); sr.patternMatching(); } }
UTF-8
Java
2,315
java
StringSplitReplace.java
Java
[]
null
[]
package stringhandling; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.Calendar; import java.util.regex.Matcher; import java.util.regex.Pattern; public class StringSplitReplace { public void splitStr(String str){ String[] strArray=null; strArray= str.split("\\s+"); // regexp for one or more space for (String s : strArray){ System.out.println( s); } } public void replaceStr(){ String str="This is the first linefirst release of 65 53333v and 633..12 also 72ve.rsion"; System.out.println("\nstr : "+str); System.out.println("Regex : ^[T|t] : "+str.replaceAll("^[T|t]", " ")); System.out.println("Regex : \\sfirst\\s : "+str.replaceAll("\\sfirst\\s", "REPLACED")); System.out.println("Regex : \\d+..(\\.\\d)? : "+str.replaceAll("\\d+([v]|\\.)?", "")); // ? -> 0 or 1 pattern str=Calendar.getInstance().getTime().toString(); System.out.println("str : "+ str); System.out.println("Regex : \\d{2}:\\d{2}:\\d{2}: "+str.replaceAll("\\d{2}:\\d{2}:\\d{2}", "XX:XX:XX")); } public void patternMatching(){ String str="SightLine Version Platinum release 53.0.04"; System.out.println("str : "+str); System.out.println("Regexp : ^[S|s](.+) : "+str.matches("^[S|s](.+)")); Pattern p=Pattern.compile("(.+)[V|v]ersion(.+)"); Matcher m=p.matcher(str); System.out.println("Regexp : (.+)[V|v]ersion(.+) : "+m.matches()); System.out.println("Regexp : ([A-Za-z0-9[\\s][.]])+ : "+Pattern.matches("([A-Za-z0-9[\\s][.]])+",str)); // allows A-Z a-z 0-9 ' ' . System.out.println("Regexp : (.+)\\d.\\d.\\d(.+) : "+str.matches("(.+)\\d{2}.\\d{1}.\\d{2}(.+)?")); // matches dd.d.dd System.out.println("------------------------"); String s=" Version 995 st"; System.out.println(s); System.out.println("Regexp : : "+s.matches("(.*)\\d{2}(.*)")); } public static void main(String args[]){ //System.out.println("Enter the line"); String str="Split the given line"; StringSplitReplace sr=new StringSplitReplace(); System.out.println("1.line splitting using str.split() "); sr.splitStr(str); System.out.println("\n2. Replace string using regexp"); sr.replaceStr(); System.out.println("\n3. Pattern matching using reqexp"); sr.patternMatching(); } }
2,315
0.605616
0.587041
69
32.550724
32.108753
134
false
false
0
0
0
0
0
0
2.608696
false
false
3
e20b56217d89ee5e9184e2fa7fda07743d1011c5
13,254,269,088,933
ac32c15c87406fb4d0f1b0b9c21e660b38adafad
/keywords.java
97435144a61db6b6df329241386f484edfd5003d
[]
no_license
SuchithSridhar/Java-Refresher
https://github.com/SuchithSridhar/Java-Refresher
8a13990cc3b6bdd5074e79c01a0df115fd1b24a1
54e1df62c8ed3222f394192b1b89fa8f157d3b1d
refs/heads/master
2023-03-20T11:33:04.791000
2021-03-18T13:48:03
2021-03-18T13:48:03
274,910,257
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
class MainClass { public static void main(String[] args){ System.out.println("This is keywords file"); Loops loop = new Loops(); loop.loopsDemo(); } } class Loops{ void loopsDemo(){ int[] array = {1,2,3,4,5}; for(int i=1; i<=12; i++){ } for(int item: array){ System.out.println(item); } while(true){ break; } do{ break; }while(true); if(false){ } else if(true){ } else { } } }
UTF-8
Java
481
java
keywords.java
Java
[]
null
[]
class MainClass { public static void main(String[] args){ System.out.println("This is keywords file"); Loops loop = new Loops(); loop.loopsDemo(); } } class Loops{ void loopsDemo(){ int[] array = {1,2,3,4,5}; for(int i=1; i<=12; i++){ } for(int item: array){ System.out.println(item); } while(true){ break; } do{ break; }while(true); if(false){ } else if(true){ } else { } } }
481
0.503119
0.486486
30
15.033334
13.884004
52
false
false
0
0
0
0
0
0
0.9
false
false
1
f606fa8c84e7bb0d785454452ca89927e6d4d1cb
13,254,269,089,300
09d87c2923ae367bd1e35314483a1d425377c9e4
/src/net/wentaochang/leetcode/BestTimetoBuyandSellStockII.java
47e6818c4de7f120391a77dad86fd8a7e6aac4b8
[]
no_license
changwiz/ProgrammingTest
https://github.com/changwiz/ProgrammingTest
96e23bc3fc6869c7157244572aacd9909c10d895
a7fed36ca93b85a0e6fa65a404d8d693e40af952
refs/heads/master
2021-01-22T11:36:51.579000
2014-04-06T05:15:50
2014-04-06T05:15:50
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package net.wentaochang.leetcode; public class BestTimetoBuyandSellStockII { /*public int maxProfit(int[] prices) { int totalProfit = 0; int start = prices[0]; for(int i=1;i<prices.length;++i){ if(prices[i] < prices[i-1]){ totalProfit += (prices[i-1] - start); start = prices[i]; } } totalProfit += (prices[prices.length-1] - start); return totalProfit; }*/ public int maxProfit(int[] prices) { int p = 0; for (int i = 1; i < prices.length; i++) { int delta = prices[i] - prices[i - 1]; if (delta > 0) p += delta; } return p; } }
UTF-8
Java
665
java
BestTimetoBuyandSellStockII.java
Java
[]
null
[]
package net.wentaochang.leetcode; public class BestTimetoBuyandSellStockII { /*public int maxProfit(int[] prices) { int totalProfit = 0; int start = prices[0]; for(int i=1;i<prices.length;++i){ if(prices[i] < prices[i-1]){ totalProfit += (prices[i-1] - start); start = prices[i]; } } totalProfit += (prices[prices.length-1] - start); return totalProfit; }*/ public int maxProfit(int[] prices) { int p = 0; for (int i = 1; i < prices.length; i++) { int delta = prices[i] - prices[i - 1]; if (delta > 0) p += delta; } return p; } }
665
0.524812
0.509774
27
23.629629
16.861414
57
false
false
0
0
0
0
0
0
1.444444
false
false
1
f90dca37d47ee1b2a6733299d2c177db3660b5f7
944,892,823,918
1f68f0808127b67974932fafaba9d3408a5a0c4f
/axondb-client-java/src/test/java/io/axoniq/axondb/client/axon/EventBufferTest.java
5d89e7483fb07d56ac0d8dcb46dcdaae200fca40
[]
no_license
AxonIQ/axoniq-eventstore-client
https://github.com/AxonIQ/axoniq-eventstore-client
4bb40a87b7b5a80fb475488b13a14dd1b4ea4c7f
59aad758e50eb0b34a699bfe83b60185e4309855
refs/heads/master
2021-07-12T11:40:54.989000
2018-12-04T12:38:05
2018-12-04T12:38:05
100,280,380
13
6
null
false
2018-12-04T07:06:21
2017-08-14T15:07:13
2018-11-15T08:50:31
2018-12-04T07:06:20
241
10
4
4
Java
false
null
/* * Copyright (c) 2017. AxonIQ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.axoniq.axondb.client.axon; import com.google.protobuf.ByteString; import io.axoniq.axondb.Event; import io.axoniq.axondb.client.ClientConnectionException; import io.axoniq.axondb.grpc.EventWithToken; import io.axoniq.platform.SerializedObject; import org.axonframework.eventhandling.TrackedEventMessage; import org.axonframework.eventsourcing.DomainEventMessage; import org.axonframework.eventsourcing.eventstore.GlobalSequenceTrackingToken; import org.axonframework.eventsourcing.eventstore.TrackedDomainEventData; import org.axonframework.eventsourcing.eventstore.TrackedEventData; import org.axonframework.serialization.upcasting.event.EventUpcaster; import org.axonframework.serialization.upcasting.event.IntermediateEventRepresentation; import org.axonframework.serialization.xml.XStreamSerializer; import org.junit.*; import org.mockito.stubbing.Answer; import java.util.UUID; import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Stream; import static org.junit.Assert.*; import static org.mockito.AdditionalMatchers.gt; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.*; public class EventBufferTest { private EventUpcaster stubUpcaster; private EventBuffer testSubject; private XStreamSerializer serializer; private org.axonframework.serialization.SerializedObject<byte[]> serializedObject; @Before public void setUp() throws Exception { stubUpcaster = mock(EventUpcaster.class); when(stubUpcaster.upcast(any())).thenAnswer((Answer<Stream<IntermediateEventRepresentation>>) invocationOnMock -> (Stream<IntermediateEventRepresentation>) invocationOnMock.getArguments()[0]); serializer = new XStreamSerializer(); serializedObject = serializer.serialize("some object", byte[].class); } @Test public void testDataUpcastAndDeserialized() throws InterruptedException { testSubject = new EventBuffer(stubUpcaster, serializer, 0); assertFalse(testSubject.hasNextAvailable()); testSubject.push(createEventData(1L)); assertTrue(testSubject.hasNextAvailable()); TrackedEventMessage<?> peeked = testSubject.peek().orElseThrow(() -> new AssertionError("Expected value to be available")); assertEquals(new GlobalSequenceTrackingToken(1L), peeked.trackingToken()); assertTrue(peeked instanceof DomainEventMessage<?>); assertTrue(testSubject.hasNextAvailable()); assertTrue(testSubject.hasNextAvailable(1, TimeUnit.SECONDS)); testSubject.nextAvailable(); assertFalse(testSubject.hasNextAvailable()); assertFalse(testSubject.hasNextAvailable(10, TimeUnit.MILLISECONDS)); verify(stubUpcaster).upcast(isA(Stream.class)); } @Test public void testConsumptionIsRecorded() { stubUpcaster = stream -> stream.filter(i -> false); testSubject = new EventBuffer(stubUpcaster, serializer, 0); testSubject.push(createEventData(1)); testSubject.push(createEventData(2)); testSubject.push(createEventData(3)); AtomicInteger consumed = new AtomicInteger(); testSubject.registerConsumeListener(consumed::addAndGet); testSubject.peek(); // this should consume 3 incoming messages assertEquals(3, consumed.get()); } @Test @Ignore("Testcase too sensitive") public void testPollTimeOnEventQueueLimitedToHeartbeatInterval() throws InterruptedException { stubUpcaster = stream -> stream.filter(i -> false); LinkedBlockingQueue<TrackedEventData<byte[]>> queue = new LinkedBlockingQueue<>(); BlockingQueue<TrackedEventData<byte[]>> spiedQueue = spy(queue); queue.offer(createTrackedEventData(1)); testSubject = new EventBuffer(stubUpcaster, serializer, 2, spiedQueue); testSubject.hasNextAvailable(10, TimeUnit.MILLISECONDS); // this should consume 3 incoming messages verify(spiedQueue).poll(eq(2L), eq(TimeUnit.MILLISECONDS)); } @Test public void testPollTimeOnEventQueueNotLimitedwWithZeroHeartbeatInterval() throws InterruptedException { stubUpcaster = stream -> stream.filter(i -> false); LinkedBlockingQueue<TrackedEventData<byte[]>> queue = new LinkedBlockingQueue<>(); BlockingQueue<TrackedEventData<byte[]>> spiedQueue = spy(queue); queue.offer(createTrackedEventData(1)); testSubject = new EventBuffer(stubUpcaster, serializer, 0, spiedQueue); testSubject.hasNextAvailable(10, TimeUnit.MILLISECONDS); verify(spiedQueue).poll(gt(8L), eq(TimeUnit.MILLISECONDS)); } @Test public void testAbsenceOfAMessageDuringTwiceTheHeartbeatIntervalRaisesException() throws InterruptedException { stubUpcaster = stream -> stream.filter(i -> false); BlockingQueue<TrackedEventData<byte[]>> blockingQueue = spy(new LinkedBlockingQueue<>()); testSubject = new EventBuffer(stubUpcaster, serializer, 4, blockingQueue); try { testSubject.hasNextAvailable(10, TimeUnit.MILLISECONDS); testSubject.peek(); fail("Expected ClientConnectionException"); } catch (ClientConnectionException e) { //expected } verify(blockingQueue, atLeastOnce()).poll(eq(4L), eq(TimeUnit.MILLISECONDS)); } private TrackedEventData<byte[]> createTrackedEventData(long sequence) { EventWithToken eventWithToken = createEventData(sequence); return new TrackedDomainEventData<>(new GlobalSequenceTrackingToken(eventWithToken.getToken()), new GrpcBackedDomainEventData(eventWithToken.getEvent())); } private EventWithToken createEventData(long sequence) { return EventWithToken.newBuilder() .setToken(sequence) .setEvent(Event.newBuilder() .setPayload(SerializedObject.newBuilder() .setData(ByteString.copyFrom(serializedObject.getData())) .setType(serializedObject.getType().getName())) .setMessageIdentifier(UUID.randomUUID().toString()) .setAggregateType("Test") .setAggregateSequenceNumber(sequence) .setTimestamp(System.currentTimeMillis()) .setAggregateIdentifier("1235")) .build(); } }
UTF-8
Java
7,475
java
EventBufferTest.java
Java
[]
null
[]
/* * Copyright (c) 2017. AxonIQ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package io.axoniq.axondb.client.axon; import com.google.protobuf.ByteString; import io.axoniq.axondb.Event; import io.axoniq.axondb.client.ClientConnectionException; import io.axoniq.axondb.grpc.EventWithToken; import io.axoniq.platform.SerializedObject; import org.axonframework.eventhandling.TrackedEventMessage; import org.axonframework.eventsourcing.DomainEventMessage; import org.axonframework.eventsourcing.eventstore.GlobalSequenceTrackingToken; import org.axonframework.eventsourcing.eventstore.TrackedDomainEventData; import org.axonframework.eventsourcing.eventstore.TrackedEventData; import org.axonframework.serialization.upcasting.event.EventUpcaster; import org.axonframework.serialization.upcasting.event.IntermediateEventRepresentation; import org.axonframework.serialization.xml.XStreamSerializer; import org.junit.*; import org.mockito.stubbing.Answer; import java.util.UUID; import java.util.concurrent.BlockingQueue; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Stream; import static org.junit.Assert.*; import static org.mockito.AdditionalMatchers.gt; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.isA; import static org.mockito.Mockito.*; public class EventBufferTest { private EventUpcaster stubUpcaster; private EventBuffer testSubject; private XStreamSerializer serializer; private org.axonframework.serialization.SerializedObject<byte[]> serializedObject; @Before public void setUp() throws Exception { stubUpcaster = mock(EventUpcaster.class); when(stubUpcaster.upcast(any())).thenAnswer((Answer<Stream<IntermediateEventRepresentation>>) invocationOnMock -> (Stream<IntermediateEventRepresentation>) invocationOnMock.getArguments()[0]); serializer = new XStreamSerializer(); serializedObject = serializer.serialize("some object", byte[].class); } @Test public void testDataUpcastAndDeserialized() throws InterruptedException { testSubject = new EventBuffer(stubUpcaster, serializer, 0); assertFalse(testSubject.hasNextAvailable()); testSubject.push(createEventData(1L)); assertTrue(testSubject.hasNextAvailable()); TrackedEventMessage<?> peeked = testSubject.peek().orElseThrow(() -> new AssertionError("Expected value to be available")); assertEquals(new GlobalSequenceTrackingToken(1L), peeked.trackingToken()); assertTrue(peeked instanceof DomainEventMessage<?>); assertTrue(testSubject.hasNextAvailable()); assertTrue(testSubject.hasNextAvailable(1, TimeUnit.SECONDS)); testSubject.nextAvailable(); assertFalse(testSubject.hasNextAvailable()); assertFalse(testSubject.hasNextAvailable(10, TimeUnit.MILLISECONDS)); verify(stubUpcaster).upcast(isA(Stream.class)); } @Test public void testConsumptionIsRecorded() { stubUpcaster = stream -> stream.filter(i -> false); testSubject = new EventBuffer(stubUpcaster, serializer, 0); testSubject.push(createEventData(1)); testSubject.push(createEventData(2)); testSubject.push(createEventData(3)); AtomicInteger consumed = new AtomicInteger(); testSubject.registerConsumeListener(consumed::addAndGet); testSubject.peek(); // this should consume 3 incoming messages assertEquals(3, consumed.get()); } @Test @Ignore("Testcase too sensitive") public void testPollTimeOnEventQueueLimitedToHeartbeatInterval() throws InterruptedException { stubUpcaster = stream -> stream.filter(i -> false); LinkedBlockingQueue<TrackedEventData<byte[]>> queue = new LinkedBlockingQueue<>(); BlockingQueue<TrackedEventData<byte[]>> spiedQueue = spy(queue); queue.offer(createTrackedEventData(1)); testSubject = new EventBuffer(stubUpcaster, serializer, 2, spiedQueue); testSubject.hasNextAvailable(10, TimeUnit.MILLISECONDS); // this should consume 3 incoming messages verify(spiedQueue).poll(eq(2L), eq(TimeUnit.MILLISECONDS)); } @Test public void testPollTimeOnEventQueueNotLimitedwWithZeroHeartbeatInterval() throws InterruptedException { stubUpcaster = stream -> stream.filter(i -> false); LinkedBlockingQueue<TrackedEventData<byte[]>> queue = new LinkedBlockingQueue<>(); BlockingQueue<TrackedEventData<byte[]>> spiedQueue = spy(queue); queue.offer(createTrackedEventData(1)); testSubject = new EventBuffer(stubUpcaster, serializer, 0, spiedQueue); testSubject.hasNextAvailable(10, TimeUnit.MILLISECONDS); verify(spiedQueue).poll(gt(8L), eq(TimeUnit.MILLISECONDS)); } @Test public void testAbsenceOfAMessageDuringTwiceTheHeartbeatIntervalRaisesException() throws InterruptedException { stubUpcaster = stream -> stream.filter(i -> false); BlockingQueue<TrackedEventData<byte[]>> blockingQueue = spy(new LinkedBlockingQueue<>()); testSubject = new EventBuffer(stubUpcaster, serializer, 4, blockingQueue); try { testSubject.hasNextAvailable(10, TimeUnit.MILLISECONDS); testSubject.peek(); fail("Expected ClientConnectionException"); } catch (ClientConnectionException e) { //expected } verify(blockingQueue, atLeastOnce()).poll(eq(4L), eq(TimeUnit.MILLISECONDS)); } private TrackedEventData<byte[]> createTrackedEventData(long sequence) { EventWithToken eventWithToken = createEventData(sequence); return new TrackedDomainEventData<>(new GlobalSequenceTrackingToken(eventWithToken.getToken()), new GrpcBackedDomainEventData(eventWithToken.getEvent())); } private EventWithToken createEventData(long sequence) { return EventWithToken.newBuilder() .setToken(sequence) .setEvent(Event.newBuilder() .setPayload(SerializedObject.newBuilder() .setData(ByteString.copyFrom(serializedObject.getData())) .setType(serializedObject.getType().getName())) .setMessageIdentifier(UUID.randomUUID().toString()) .setAggregateType("Test") .setAggregateSequenceNumber(sequence) .setTimestamp(System.currentTimeMillis()) .setAggregateIdentifier("1235")) .build(); } }
7,475
0.694047
0.688696
164
44.579269
35.234749
200
false
false
0
0
0
0
67
0.008963
0.682927
false
false
1
922ebdfaad4996561a6d656b010d1f87ae13a8b5
1,151,051,252,189
fdeed22c5ed4d28fd06f59992adf7fefba10433d
/spring-social-weibo/src/main/java/com/georges/social/weibo/api/impl/WeiboTemplate.java
3e0a4a69c054f1b53d515cc5291f3da3a572efc4
[ "Apache-2.0" ]
permissive
sstrangr6/spring-social-weibo
https://github.com/sstrangr6/spring-social-weibo
9decc47137a2d63e67b009984b14db99710fdd7a
a0860b17d5827fc1a95aba59dd85fa2269172f44
refs/heads/master
2021-01-15T17:50:58.954000
2012-09-10T08:06:43
2012-09-10T08:06:43
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * */ package com.georges.social.weibo.api.impl; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import org.codehaus.jackson.map.ObjectMapper; import org.springframework.http.MediaType; import org.springframework.http.client.ClientHttpRequestInterceptor; import org.springframework.http.converter.json.MappingJacksonHttpMessageConverter; import org.springframework.social.oauth2.AbstractOAuth2ApiBinding; import com.georges.social.weibo.api.UserOperations; import com.georges.social.weibo.api.Weibo; import com.georges.social.weibo.api.impl.json.WeiboModule; import com.georges.social.weibo.connect.WeiboRequestInterceptor; /** * @author alexzuo * */ public class WeiboTemplate extends AbstractOAuth2ApiBinding implements Weibo { private UserOperations userOperations; private ObjectMapper objectMapper; /** * */ public WeiboTemplate() { super(); initialize(); } /** * @param consumerKey * @param consumerSecret * @param accessToken * @param accessTokenSecret */ public WeiboTemplate(String accessToken) { super(accessToken); List<ClientHttpRequestInterceptor> interceptors = new LinkedList<ClientHttpRequestInterceptor>(); interceptors.add(new WeiboRequestInterceptor(accessToken)); getRestTemplate().setInterceptors(interceptors); initialize(); } private void initialize() { userOperations = new UserTemplate(this, getRestTemplate(), isAuthorized()); } /** * @return the userOperations */ public UserOperations userOperations() { return userOperations; } protected MappingJacksonHttpMessageConverter getJsonMessageConverter() { MappingJacksonHttpMessageConverter converter = super .getJsonMessageConverter(); List<MediaType> list = new ArrayList<MediaType>(); list.addAll(converter.getSupportedMediaTypes()); list.add(MediaType.TEXT_PLAIN); converter.setSupportedMediaTypes(list); objectMapper = new ObjectMapper(); objectMapper.registerModule(new WeiboModule()); converter.setObjectMapper(objectMapper); return converter; } }
UTF-8
Java
2,060
java
WeiboTemplate.java
Java
[ { "context": "o.connect.WeiboRequestInterceptor;\n\n/**\n * @author alexzuo\n * \n */\npublic class WeiboTemplate extends Abstra", "end": 688, "score": 0.9994943141937256, "start": 681, "tag": "USERNAME", "value": "alexzuo" } ]
null
[]
/** * */ package com.georges.social.weibo.api.impl; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import org.codehaus.jackson.map.ObjectMapper; import org.springframework.http.MediaType; import org.springframework.http.client.ClientHttpRequestInterceptor; import org.springframework.http.converter.json.MappingJacksonHttpMessageConverter; import org.springframework.social.oauth2.AbstractOAuth2ApiBinding; import com.georges.social.weibo.api.UserOperations; import com.georges.social.weibo.api.Weibo; import com.georges.social.weibo.api.impl.json.WeiboModule; import com.georges.social.weibo.connect.WeiboRequestInterceptor; /** * @author alexzuo * */ public class WeiboTemplate extends AbstractOAuth2ApiBinding implements Weibo { private UserOperations userOperations; private ObjectMapper objectMapper; /** * */ public WeiboTemplate() { super(); initialize(); } /** * @param consumerKey * @param consumerSecret * @param accessToken * @param accessTokenSecret */ public WeiboTemplate(String accessToken) { super(accessToken); List<ClientHttpRequestInterceptor> interceptors = new LinkedList<ClientHttpRequestInterceptor>(); interceptors.add(new WeiboRequestInterceptor(accessToken)); getRestTemplate().setInterceptors(interceptors); initialize(); } private void initialize() { userOperations = new UserTemplate(this, getRestTemplate(), isAuthorized()); } /** * @return the userOperations */ public UserOperations userOperations() { return userOperations; } protected MappingJacksonHttpMessageConverter getJsonMessageConverter() { MappingJacksonHttpMessageConverter converter = super .getJsonMessageConverter(); List<MediaType> list = new ArrayList<MediaType>(); list.addAll(converter.getSupportedMediaTypes()); list.add(MediaType.TEXT_PLAIN); converter.setSupportedMediaTypes(list); objectMapper = new ObjectMapper(); objectMapper.registerModule(new WeiboModule()); converter.setObjectMapper(objectMapper); return converter; } }
2,060
0.780097
0.778641
77
25.753246
24.483843
99
false
false
0
0
0
0
0
0
1.337662
false
false
1
ad0d464d95fd4df4e1114627c466498fd3395bd2
13,288,628,831,016
474c27f3f42aa5deffece3a4a8895e785f2adc93
/lang/java/reef-common/src/main/java/org/apache/reef/runtime/common/client/api/JobSubmissionEvent.java
10a8ba1c05e3aa3dd32f1e0a845503fb649759df
[ "Apache-2.0" ]
permissive
apache/reef
https://github.com/apache/reef
7a886e62b065bddc7271ea967ddec3984dc7f48e
b621659dbffc4e7826d618f0f0359c0a6e597b97
refs/heads/master
2023-08-26T04:58:03.787000
2021-05-26T15:06:07
2021-05-26T15:06:07
25,623,941
87
104
Apache-2.0
false
2022-07-06T19:58:15
2014-10-23T07:00:10
2022-06-28T02:13:38
2022-07-06T19:58:15
40,243
95
104
8
Java
false
false
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.reef.runtime.common.client.api; import org.apache.reef.annotations.audience.RuntimeAuthor; import org.apache.reef.runtime.common.files.FileResource; import org.apache.reef.tang.Configuration; import org.apache.reef.tang.annotations.DefaultImplementation; import org.apache.reef.util.Optional; import java.util.Set; /** * Event sent to Driver Runtime. * Submission of a Job to the Driver Runtime */ @RuntimeAuthor @DefaultImplementation(JobSubmissionEventImpl.class) public interface JobSubmissionEvent { /** * @return Id of the Job */ String getIdentifier(); /** * @return Remote Id for the error handler */ String getRemoteId(); /** * @return Driver configuration */ Configuration getConfiguration(); /** * @return Owner's username */ String getUserName(); /** * @return List of global files */ Set<FileResource> getGlobalFileSet(); /** * @return List of local files */ Set<FileResource> getLocalFileSet(); /** * @return Memory to be allocated to the Driver */ Optional<Integer> getDriverMemory(); /** * @return The number of CPU cores to be allocated for the Driver */ Optional<Integer> getDriverCPUCores(); /** * @return Priority to be given to the Job */ Optional<Integer> getPriority(); /** * @return True if evaluators are to be preserved across driver failures. */ Optional<Boolean> getPreserveEvaluators(); /** * Returns the number of time that the driver should be started by the resource manager * if it fails unexpectedly. */ Optional<Integer> getMaxApplicationSubmissions(); }
UTF-8
Java
2,446
java
JobSubmissionEvent.java
Java
[]
null
[]
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.reef.runtime.common.client.api; import org.apache.reef.annotations.audience.RuntimeAuthor; import org.apache.reef.runtime.common.files.FileResource; import org.apache.reef.tang.Configuration; import org.apache.reef.tang.annotations.DefaultImplementation; import org.apache.reef.util.Optional; import java.util.Set; /** * Event sent to Driver Runtime. * Submission of a Job to the Driver Runtime */ @RuntimeAuthor @DefaultImplementation(JobSubmissionEventImpl.class) public interface JobSubmissionEvent { /** * @return Id of the Job */ String getIdentifier(); /** * @return Remote Id for the error handler */ String getRemoteId(); /** * @return Driver configuration */ Configuration getConfiguration(); /** * @return Owner's username */ String getUserName(); /** * @return List of global files */ Set<FileResource> getGlobalFileSet(); /** * @return List of local files */ Set<FileResource> getLocalFileSet(); /** * @return Memory to be allocated to the Driver */ Optional<Integer> getDriverMemory(); /** * @return The number of CPU cores to be allocated for the Driver */ Optional<Integer> getDriverCPUCores(); /** * @return Priority to be given to the Job */ Optional<Integer> getPriority(); /** * @return True if evaluators are to be preserved across driver failures. */ Optional<Boolean> getPreserveEvaluators(); /** * Returns the number of time that the driver should be started by the resource manager * if it fails unexpectedly. */ Optional<Integer> getMaxApplicationSubmissions(); }
2,446
0.717089
0.715454
92
25.586956
24.176952
89
false
false
0
0
0
0
0
0
0.25
false
false
1
952a20df8a08667245b5f5b8e95de810b15c8290
21,766,894,272,980
9e156e2e0191544bba7be3fd46e91c13ccb1c389
/src/main/java/notifyportal/repository/PersonsRepository.java
f137bc4bb06ea154901bc3b081ec0187d8d25407
[]
no_license
vitalicher97/notifyportal
https://github.com/vitalicher97/notifyportal
69f6482c83e6d69baa71d481e141c1939cc0bd75
faf387f8ac4e745bbfac490733c582942baeb2b2
refs/heads/master
2020-11-30T16:11:05.022000
2019-12-27T12:16:45
2019-12-27T12:16:45
230,438,243
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package notifyportal.repository; import notifyportal.model.PersonsModel; import org.springframework.data.jpa.repository.JpaRepository; public interface PersonsRepository extends JpaRepository<PersonsModel, Integer> { }
UTF-8
Java
222
java
PersonsRepository.java
Java
[]
null
[]
package notifyportal.repository; import notifyportal.model.PersonsModel; import org.springframework.data.jpa.repository.JpaRepository; public interface PersonsRepository extends JpaRepository<PersonsModel, Integer> { }
222
0.851351
0.851351
8
26.75
29.798281
81
false
false
0
0
0
0
0
0
0.5
false
false
1
411f5a47460ce37849758241186d41c8af451eaa
32,091,995,655,621
8489cdf498cd390c0fb70352dc8df2e7aecc643b
/ServieclyApp/app/src/main/java/com/example/mohamedahmedgomaa/servieclyapp/view/TrafficViolationsAdapter.java
54a093f7fa2736370235cb7c51bda056fa8b0304
[]
no_license
MohaGomaa/GSE-android-application-Graduation-Project
https://github.com/MohaGomaa/GSE-android-application-Graduation-Project
f94f86e0e8e93463feabd89fc422cfd68b6ea24a
ee2cefca039fe9a79e1f93bb72495bed8b1c9e13
refs/heads/master
2022-11-29T12:33:23.634000
2020-08-07T11:16:56
2020-08-07T11:16:56
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.mohamedahmedgomaa.servieclyapp.view; import android.content.Context; import android.view.ContextMenu; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import androidx.recyclerview.widget.RecyclerView; import com.example.mohamedahmedgomaa.servieclyapp.Interface.ItemClickListener; import com.example.mohamedahmedgomaa.servieclyapp.R; import com.example.mohamedahmedgomaa.servieclyapp.model.TrafficViolation; import java.util.ArrayList; import java.util.List; public class TrafficViolationsAdapter extends RecyclerView.Adapter<TrafficViolationsAdapter.MyViewHolder> { private static Context mContext ; private static List<TrafficViolation> mData ; public TrafficViolationsAdapter(Context mContext, List<TrafficViolation> mData) { this.mContext = mContext; this.mData = mData; } @Override public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view ; LayoutInflater inflater = LayoutInflater.from(mContext); view = inflater.inflate(R.layout.trafficviolations_item,parent,false) ; final MyViewHolder viewHolder = new MyViewHolder(view) ; /*viewHolder.view_container.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(mContext, AnimeActivity.class); i.putExtra("anime_name",mData.get(viewHolder.getAdapterPosition()).getName()); i.putExtra("anime_description",mData.get(viewHolder.getAdapterPosition()).getDescription()); i.putExtra("anime_studio",mData.get(viewHolder.getAdapterPosition()).getStudio()); i.putExtra("anime_category",mData.get(viewHolder.getAdapterPosition()).getCategorie()); i.putExtra("anime_nb_episode",mData.get(viewHolder.getAdapterPosition()).getNb_episode()); i.putExtra("anime_rating",mData.get(viewHolder.getAdapterPosition()).getRating()); i.putExtra("anime_img",mData.get(viewHolder.getAdapterPosition()).getImage_url()); mContext.startActivity(i); } }); */ return viewHolder; } @Override public void onBindViewHolder(MyViewHolder holder, int position) { holder.TypeViolation.setText( mContext.getResources().getString(R.string.TypeViolation)+mData.get(position).getType_Violation()); holder.Car_code.setText( mContext.getResources().getString(R.string.CarCode)+mData.get(position).getCar_code()); holder.Date.setText( mContext.getResources().getString(R.string.Datee)+mData.get(position).getDate()); holder.price.setText( mContext.getResources().getString(R.string.price)+String.valueOf(mData.get(position).getPrice())); holder.IsPaid.setText( mContext.getResources().getString(R.string.IsPaid)+String.valueOf(mData.get(position).getIs_Paid())); // Load Image from the internet and set it into Imageview using Glide } @Override public int getItemCount() { return mData.size(); } public void setfilter(List<TrafficViolation> listitem) { mData=new ArrayList<>(); mData.addAll(listitem); notifyDataSetChanged(); } public static class MyViewHolder extends RecyclerView.ViewHolder implements com.example.mohamedahmedgomaa.servieclyapp.view.MyViewHolder, View.OnClickListener, View.OnCreateContextMenuListener { TextView TypeViolation ; TextView Car_code ; TextView price ; TextView Date; TextView IsPaid ; private ItemClickListener itemClickListener; public MyViewHolder(View itemView) { super(itemView); TypeViolation = itemView.findViewById(R.id.tvTypeofViolation); Car_code = itemView.findViewById(R.id.tvCarcode); price = itemView.findViewById(R.id.tvPrice); Date = itemView.findViewById(R.id.tvDate); IsPaid = itemView.findViewById(R.id.tvIsPaid); itemView.setOnClickListener(this); itemView.setOnCreateContextMenuListener(this); } public ItemClickListener getItemClickListener() { return itemClickListener; } public void setItemClickListener(ItemClickListener itemClickListener) { this.itemClickListener = itemClickListener; } @Override public void onClick(View v) { itemClickListener.onClick( v,getAdapterPosition(), false); //int itemPosition = mRecyclerView.getChildLayoutPosition(view); } @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { menu.setHeaderTitle(R.string.SelectAction); menu.add(0,0,getAdapterPosition(), R.string.Cancel); } } }
UTF-8
Java
4,967
java
TrafficViolationsAdapter.java
Java
[]
null
[]
package com.example.mohamedahmedgomaa.servieclyapp.view; import android.content.Context; import android.view.ContextMenu; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import androidx.recyclerview.widget.RecyclerView; import com.example.mohamedahmedgomaa.servieclyapp.Interface.ItemClickListener; import com.example.mohamedahmedgomaa.servieclyapp.R; import com.example.mohamedahmedgomaa.servieclyapp.model.TrafficViolation; import java.util.ArrayList; import java.util.List; public class TrafficViolationsAdapter extends RecyclerView.Adapter<TrafficViolationsAdapter.MyViewHolder> { private static Context mContext ; private static List<TrafficViolation> mData ; public TrafficViolationsAdapter(Context mContext, List<TrafficViolation> mData) { this.mContext = mContext; this.mData = mData; } @Override public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { View view ; LayoutInflater inflater = LayoutInflater.from(mContext); view = inflater.inflate(R.layout.trafficviolations_item,parent,false) ; final MyViewHolder viewHolder = new MyViewHolder(view) ; /*viewHolder.view_container.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent i = new Intent(mContext, AnimeActivity.class); i.putExtra("anime_name",mData.get(viewHolder.getAdapterPosition()).getName()); i.putExtra("anime_description",mData.get(viewHolder.getAdapterPosition()).getDescription()); i.putExtra("anime_studio",mData.get(viewHolder.getAdapterPosition()).getStudio()); i.putExtra("anime_category",mData.get(viewHolder.getAdapterPosition()).getCategorie()); i.putExtra("anime_nb_episode",mData.get(viewHolder.getAdapterPosition()).getNb_episode()); i.putExtra("anime_rating",mData.get(viewHolder.getAdapterPosition()).getRating()); i.putExtra("anime_img",mData.get(viewHolder.getAdapterPosition()).getImage_url()); mContext.startActivity(i); } }); */ return viewHolder; } @Override public void onBindViewHolder(MyViewHolder holder, int position) { holder.TypeViolation.setText( mContext.getResources().getString(R.string.TypeViolation)+mData.get(position).getType_Violation()); holder.Car_code.setText( mContext.getResources().getString(R.string.CarCode)+mData.get(position).getCar_code()); holder.Date.setText( mContext.getResources().getString(R.string.Datee)+mData.get(position).getDate()); holder.price.setText( mContext.getResources().getString(R.string.price)+String.valueOf(mData.get(position).getPrice())); holder.IsPaid.setText( mContext.getResources().getString(R.string.IsPaid)+String.valueOf(mData.get(position).getIs_Paid())); // Load Image from the internet and set it into Imageview using Glide } @Override public int getItemCount() { return mData.size(); } public void setfilter(List<TrafficViolation> listitem) { mData=new ArrayList<>(); mData.addAll(listitem); notifyDataSetChanged(); } public static class MyViewHolder extends RecyclerView.ViewHolder implements com.example.mohamedahmedgomaa.servieclyapp.view.MyViewHolder, View.OnClickListener, View.OnCreateContextMenuListener { TextView TypeViolation ; TextView Car_code ; TextView price ; TextView Date; TextView IsPaid ; private ItemClickListener itemClickListener; public MyViewHolder(View itemView) { super(itemView); TypeViolation = itemView.findViewById(R.id.tvTypeofViolation); Car_code = itemView.findViewById(R.id.tvCarcode); price = itemView.findViewById(R.id.tvPrice); Date = itemView.findViewById(R.id.tvDate); IsPaid = itemView.findViewById(R.id.tvIsPaid); itemView.setOnClickListener(this); itemView.setOnCreateContextMenuListener(this); } public ItemClickListener getItemClickListener() { return itemClickListener; } public void setItemClickListener(ItemClickListener itemClickListener) { this.itemClickListener = itemClickListener; } @Override public void onClick(View v) { itemClickListener.onClick( v,getAdapterPosition(), false); //int itemPosition = mRecyclerView.getChildLayoutPosition(view); } @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { menu.setHeaderTitle(R.string.SelectAction); menu.add(0,0,getAdapterPosition(), R.string.Cancel); } } }
4,967
0.689551
0.689148
141
34.226952
38.547451
198
false
false
0
0
0
0
0
0
0.588652
false
false
1
c96d9d9a395cc0aeefac9732f396b244e8ab6287
9,689,446,242,341
60cb71dcc6eb84257c18c7fe1750e0c2ce2388a0
/httpdns-sdk/src/main/java/com/alibaba/sdk/android/httpdns/interpret/InterpretHostRequestHandler.java
0de101c14c314d34fbeed01e2d6f9a63f7c3de1e
[ "MIT" ]
permissive
fengdaren/alibabacloud-httpdns-android-sdk
https://github.com/fengdaren/alibabacloud-httpdns-android-sdk
6ee06a2ab16d4ed11a278843254b03a238499624
2615254d9eea9d402c6263de3118557f5b8c4cd3
refs/heads/master
2023-06-03T12:00:15.588000
2021-06-21T04:00:15
2021-06-21T04:00:15
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.alibaba.sdk.android.httpdns.interpret; import com.alibaba.sdk.android.httpdns.RequestIpType; import com.alibaba.sdk.android.httpdns.impl.HttpDnsConfig; import com.alibaba.sdk.android.httpdns.impl.SignService; import com.alibaba.sdk.android.httpdns.log.HttpDnsLog; import com.alibaba.sdk.android.httpdns.report.ReportManager; import com.alibaba.sdk.android.httpdns.request.HttpRequest; import com.alibaba.sdk.android.httpdns.request.HttpRequestConfig; import com.alibaba.sdk.android.httpdns.request.HttpRequestFailWatcher; import com.alibaba.sdk.android.httpdns.request.HttpRequestTask; import com.alibaba.sdk.android.httpdns.request.HttpRequestWatcher; import com.alibaba.sdk.android.httpdns.request.RequestCallback; import com.alibaba.sdk.android.httpdns.request.RetryHttpRequest; import com.alibaba.sdk.android.httpdns.serverip.ScheduleService; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; /** * 发起域名解析请求 * * @author zonglin.nzl * @date 2020/12/11 */ public class InterpretHostRequestHandler { private HttpDnsConfig config; private ScheduleService scheduleService; private CategoryController categoryController; private HashMap<String, String> globalParams; private SignService signService; public InterpretHostRequestHandler(HttpDnsConfig config, ScheduleService scheduleService, SignService signService) { this.config = config; this.scheduleService = scheduleService; this.categoryController = new CategoryController(scheduleService); this.globalParams = new HashMap<>(); this.signService = signService; } public void requestInterpretHost(final String host, final RequestIpType type, Map<String, String> extras, final String cacheKey, RequestCallback<InterpretHostResponse> callback) { HttpRequestConfig requestConfig = InterpretHostHelper.getConfig(config, host, type, extras, cacheKey, globalParams, signService); HttpDnsLog.d("start async ip request for " + host + " " + type); categoryController.getCategory().interpret(config, requestConfig, callback); } public void requestResolveHost(final ArrayList<String> hostList, final RequestIpType type, RequestCallback<ResolveHostResponse> callback) { HttpRequestConfig requestConfig = InterpretHostHelper.getConfig(config, hostList, type, signService); HttpDnsLog.d("start resolve hosts async for " + hostList.toString() + " " + type); HttpRequest<ResolveHostResponse> request = new HttpRequest<ResolveHostResponse>(requestConfig, new ResolveHostResponseTranslator()); request = new HttpRequestWatcher<>(request, new HttpRequestFailWatcher(ReportManager.getReportManagerByAccount(config.getAccountId()))); // 切换服务IP,更新服务IP request = new HttpRequestWatcher<>(request, new ShiftServerWatcher(config, scheduleService, categoryController)); // 重试一次 request = new RetryHttpRequest<>(request, 1); config.getWorker().execute(new HttpRequestTask<ResolveHostResponse>(request, callback)); } /** * 重置状态 */ public void resetStatus() { categoryController.reset(); } /** * 设置嗅探模式的请求时间间隔 * * @param timeInterval */ public void setSniffTimeInterval(int timeInterval) { categoryController.setSniffTimeInterval(timeInterval); } /** * 设置sdns的全局参数 * * @param params */ public void setSdnsGlobalParams(Map<String, String> params) { this.globalParams.clear(); if (params != null) { this.globalParams.putAll(params); } } /** * 清除sdns的全局参数 */ public void clearSdnsGlobalParams() { this.globalParams.clear(); } }
UTF-8
Java
3,857
java
InterpretHostRequestHandler.java
Java
[ { "context": "port java.util.Map;\n\n/**\n * 发起域名解析请求\n *\n * @author zonglin.nzl\n * @date 2020/12/11\n */\npublic class InterpretHos", "end": 979, "score": 0.9935030937194824, "start": 968, "tag": "USERNAME", "value": "zonglin.nzl" } ]
null
[]
package com.alibaba.sdk.android.httpdns.interpret; import com.alibaba.sdk.android.httpdns.RequestIpType; import com.alibaba.sdk.android.httpdns.impl.HttpDnsConfig; import com.alibaba.sdk.android.httpdns.impl.SignService; import com.alibaba.sdk.android.httpdns.log.HttpDnsLog; import com.alibaba.sdk.android.httpdns.report.ReportManager; import com.alibaba.sdk.android.httpdns.request.HttpRequest; import com.alibaba.sdk.android.httpdns.request.HttpRequestConfig; import com.alibaba.sdk.android.httpdns.request.HttpRequestFailWatcher; import com.alibaba.sdk.android.httpdns.request.HttpRequestTask; import com.alibaba.sdk.android.httpdns.request.HttpRequestWatcher; import com.alibaba.sdk.android.httpdns.request.RequestCallback; import com.alibaba.sdk.android.httpdns.request.RetryHttpRequest; import com.alibaba.sdk.android.httpdns.serverip.ScheduleService; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; /** * 发起域名解析请求 * * @author zonglin.nzl * @date 2020/12/11 */ public class InterpretHostRequestHandler { private HttpDnsConfig config; private ScheduleService scheduleService; private CategoryController categoryController; private HashMap<String, String> globalParams; private SignService signService; public InterpretHostRequestHandler(HttpDnsConfig config, ScheduleService scheduleService, SignService signService) { this.config = config; this.scheduleService = scheduleService; this.categoryController = new CategoryController(scheduleService); this.globalParams = new HashMap<>(); this.signService = signService; } public void requestInterpretHost(final String host, final RequestIpType type, Map<String, String> extras, final String cacheKey, RequestCallback<InterpretHostResponse> callback) { HttpRequestConfig requestConfig = InterpretHostHelper.getConfig(config, host, type, extras, cacheKey, globalParams, signService); HttpDnsLog.d("start async ip request for " + host + " " + type); categoryController.getCategory().interpret(config, requestConfig, callback); } public void requestResolveHost(final ArrayList<String> hostList, final RequestIpType type, RequestCallback<ResolveHostResponse> callback) { HttpRequestConfig requestConfig = InterpretHostHelper.getConfig(config, hostList, type, signService); HttpDnsLog.d("start resolve hosts async for " + hostList.toString() + " " + type); HttpRequest<ResolveHostResponse> request = new HttpRequest<ResolveHostResponse>(requestConfig, new ResolveHostResponseTranslator()); request = new HttpRequestWatcher<>(request, new HttpRequestFailWatcher(ReportManager.getReportManagerByAccount(config.getAccountId()))); // 切换服务IP,更新服务IP request = new HttpRequestWatcher<>(request, new ShiftServerWatcher(config, scheduleService, categoryController)); // 重试一次 request = new RetryHttpRequest<>(request, 1); config.getWorker().execute(new HttpRequestTask<ResolveHostResponse>(request, callback)); } /** * 重置状态 */ public void resetStatus() { categoryController.reset(); } /** * 设置嗅探模式的请求时间间隔 * * @param timeInterval */ public void setSniffTimeInterval(int timeInterval) { categoryController.setSniffTimeInterval(timeInterval); } /** * 设置sdns的全局参数 * * @param params */ public void setSdnsGlobalParams(Map<String, String> params) { this.globalParams.clear(); if (params != null) { this.globalParams.putAll(params); } } /** * 清除sdns的全局参数 */ public void clearSdnsGlobalParams() { this.globalParams.clear(); } }
3,857
0.734079
0.731681
99
36.909092
39.267303
183
false
false
0
0
0
0
0
0
0.717172
false
false
1
b02464b4bedb6c6c9f9acccc02f3f6e48778882c
2,336,462,236,080
bcfbbf653380e66a3920fcad83b2f64248d6ee96
/LinkedListPolynomial/PolynomialDriver.java
49d29480675db2a71ce7ba5829b49e4535c68d61
[]
no_license
felixthe8/CECS-277
https://github.com/felixthe8/CECS-277
7e484ea4b5ca642ccf8c82f584140f33d77dc61b
dd655acac61e4a4bf5ffba7ff1b55e9882ed8b43
refs/heads/master
2018-01-09T03:21:01.526000
2016-05-05T17:28:31
2016-05-05T17:28:31
50,166,454
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package BigJava1511P; public class PolynomialDriver { public static void main(String[] args) { PolynomialLinkedList p1 = new PolynomialLinkedList( -4 , 3); PolynomialLinkedList p2 = new PolynomialLinkedList( 6 , 2); PolynomialLinkedList p3 = new PolynomialLinkedList( 2 , 1); //adds the values of p1, p2, p3 PolynomialLinkedList SumTest1 = p1.add(p2).add(p3); PolynomialLinkedList p4 = new PolynomialLinkedList( 1 , 3); PolynomialLinkedList p5 = new PolynomialLinkedList( -2, 1); //ad the values of p4 and p5 PolynomialLinkedList SumTest2 = p4.add(p5); //add the two sums together PolynomialLinkedList sum = SumTest1.add(SumTest2); System.out.println(SumTest1.printPolynomial()); System.out.println(SumTest2.printPolynomial()); System.out.println("-------------------------"); System.out.println(sum.printPolynomial()+"\n"+"\n"); //multiply p1 and p5 PolynomialLinkedList productTest = SumTest1.multiply(SumTest2); System.out.println(SumTest1.printPolynomial()+" * "+SumTest2.printPolynomial()+" = "+productTest.printPolynomial()); } }
UTF-8
Java
1,103
java
PolynomialDriver.java
Java
[]
null
[]
package BigJava1511P; public class PolynomialDriver { public static void main(String[] args) { PolynomialLinkedList p1 = new PolynomialLinkedList( -4 , 3); PolynomialLinkedList p2 = new PolynomialLinkedList( 6 , 2); PolynomialLinkedList p3 = new PolynomialLinkedList( 2 , 1); //adds the values of p1, p2, p3 PolynomialLinkedList SumTest1 = p1.add(p2).add(p3); PolynomialLinkedList p4 = new PolynomialLinkedList( 1 , 3); PolynomialLinkedList p5 = new PolynomialLinkedList( -2, 1); //ad the values of p4 and p5 PolynomialLinkedList SumTest2 = p4.add(p5); //add the two sums together PolynomialLinkedList sum = SumTest1.add(SumTest2); System.out.println(SumTest1.printPolynomial()); System.out.println(SumTest2.printPolynomial()); System.out.println("-------------------------"); System.out.println(sum.printPolynomial()+"\n"+"\n"); //multiply p1 and p5 PolynomialLinkedList productTest = SumTest1.multiply(SumTest2); System.out.println(SumTest1.printPolynomial()+" * "+SumTest2.printPolynomial()+" = "+productTest.printPolynomial()); } }
1,103
0.705349
0.668178
34
31.470589
28.687193
120
false
false
0
0
0
0
0
0
2.176471
false
false
1
aab9f15f6ea45a50dbda5661d263049b4c227473
2,800,318,699,837
372e3eb7d39b7c908dad57a5ff0e997696696ba8
/web/src/main/java/by/pvt/module3/filter/ServletSecurityFilter.java
3f4069ba77e0ecdd49cf1ad15d726a3200edac43
[]
no_license
faeruner/AirlineDombrovsky
https://github.com/faeruner/AirlineDombrovsky
b7bbf59841bfe6567908abe310534c283ba6206d
f3172063bcccc44e9670d63ef9bf25ac5827629f
refs/heads/master
2020-04-12T06:42:36.836000
2016-09-21T14:54:24
2016-09-21T14:54:24
65,222,039
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package by.pvt.module3.filter; import by.pvt.module3.service.common.ServiceUtil; import javax.servlet.*; import javax.servlet.annotation.WebFilter; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.io.IOException; @WebFilter(urlPatterns = { "/controller" }, servletNames = { "WorkController" }) public class ServletSecurityFilter implements Filter { public void destroy() { } public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; HttpServletResponse resp = (HttpServletResponse) response; HttpSession session = req.getSession(); UserType type = (UserType) session.getAttribute("userType"); if (type == null || UserType.GUEST.equals(type)) { ServiceUtil.closeSession(); type = UserType.GUEST; session.setAttribute("userType", type); RequestDispatcher dispatcher = request.getServletContext().getRequestDispatcher("/jsp/login.jsp"); dispatcher.forward(req, resp); return; } // pass the request along the by.pvt.module3.filter chain chain.doFilter(request, response); ServiceUtil.closeSession(); } public void init(FilterConfig fConfig) throws ServletException { } }
UTF-8
Java
1,366
java
ServletSecurityFilter.java
Java
[]
null
[]
package by.pvt.module3.filter; import by.pvt.module3.service.common.ServiceUtil; import javax.servlet.*; import javax.servlet.annotation.WebFilter; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpSession; import java.io.IOException; @WebFilter(urlPatterns = { "/controller" }, servletNames = { "WorkController" }) public class ServletSecurityFilter implements Filter { public void destroy() { } public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { HttpServletRequest req = (HttpServletRequest) request; HttpServletResponse resp = (HttpServletResponse) response; HttpSession session = req.getSession(); UserType type = (UserType) session.getAttribute("userType"); if (type == null || UserType.GUEST.equals(type)) { ServiceUtil.closeSession(); type = UserType.GUEST; session.setAttribute("userType", type); RequestDispatcher dispatcher = request.getServletContext().getRequestDispatcher("/jsp/login.jsp"); dispatcher.forward(req, resp); return; } // pass the request along the by.pvt.module3.filter chain chain.doFilter(request, response); ServiceUtil.closeSession(); } public void init(FilterConfig fConfig) throws ServletException { } }
1,366
0.75549
0.753294
39
34.025642
26.551825
101
false
false
0
0
0
0
0
0
1.666667
false
false
1
32945aa0c7c38d10fe61dba76c096f0518a5afcf
10,866,267,293,737
3b26acddd5d55b0cffa2f42db1412f14ff812475
/core/src/main/java/com/cloudbees/cloud_resource/types/CloudResourceApplication.java
a07080d74d2847177c4fe1be99dfa903217e9eb8
[]
no_license
CloudBees-community/cloud-resource-commons
https://github.com/CloudBees-community/cloud-resource-commons
ef4b3dc54671f0bd064f6621d32a21e9f14ab314
e46a36cc7792645d50e1ddd278f969f5d8ebcc2a
refs/heads/master
2020-04-25T10:30:35.329000
2014-06-12T00:50:39
2014-06-12T00:50:39
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.cloudbees.cloud_resource.types; import org.codehaus.jackson.annotate.JsonProperty; /** * Represents PaaS application CR * * @author Vivek Pandey */ @CloudResourceType("https://types.cloudbees.com/paas/application") public interface CloudResourceApplication extends CloudResource{ @JsonProperty("application") public Application application(); public class Application{ private String url; public Application(String url) { this.url = url; } public Application() { } @JsonProperty("url") public String getUrl(){ return url; } public void setUrl(String url) { this.url = url; } } }
UTF-8
Java
737
java
CloudResourceApplication.java
Java
[ { "context": "*\n * Represents PaaS application CR\n *\n * @author Vivek Pandey\n */\n@CloudResourceType(\"https://types.cloudbees.c", "end": 162, "score": 0.9998778700828552, "start": 150, "tag": "NAME", "value": "Vivek Pandey" } ]
null
[]
package com.cloudbees.cloud_resource.types; import org.codehaus.jackson.annotate.JsonProperty; /** * Represents PaaS application CR * * @author <NAME> */ @CloudResourceType("https://types.cloudbees.com/paas/application") public interface CloudResourceApplication extends CloudResource{ @JsonProperty("application") public Application application(); public class Application{ private String url; public Application(String url) { this.url = url; } public Application() { } @JsonProperty("url") public String getUrl(){ return url; } public void setUrl(String url) { this.url = url; } } }
731
0.620081
0.620081
36
19.472221
19.005096
66
false
false
0
0
0
0
0
0
0.194444
false
false
1
ced6e8efa6d7721e9fb7b43971cc91c1273d8cd7
3,539,053,083,832
aad82f53c79bb1b0fa0523ca0b9dd18d8f39ec6d
/Sarath E J/24-01-2020/ques6.java
d3f68de1d69ee7ca3a94509dd9ad276309559a72
[]
no_license
Cognizant-Training-Coimbatore/Lab-Excercise-Batch-2
https://github.com/Cognizant-Training-Coimbatore/Lab-Excercise-Batch-2
54b4d87238949f3ffa0b3f0209089a1beb93befe
58d65b309377b1b86a54d541c3d1ef5acb868381
refs/heads/master
2020-12-22T06:12:23.330000
2020-03-17T12:32:29
2020-03-17T12:32:29
236,676,704
1
0
null
false
2020-10-13T19:56:02
2020-01-28T07:00:34
2020-03-17T12:32:32
2020-10-13T19:56:00
166,778
0
0
1
Java
false
false
import java.util.Scanner; public class prog42 { public static void main(String[] args) { int i=0,n,sum=0,avg; Scanner sc = new Scanner(System.in); while((n = sc.nextInt())!=-999) { sum+=n; i++; } avg=sum/i; System.out.println("AVG="+avg); System.out.println("sum="+sum); } }
UTF-8
Java
329
java
ques6.java
Java
[]
null
[]
import java.util.Scanner; public class prog42 { public static void main(String[] args) { int i=0,n,sum=0,avg; Scanner sc = new Scanner(System.in); while((n = sc.nextInt())!=-999) { sum+=n; i++; } avg=sum/i; System.out.println("AVG="+avg); System.out.println("sum="+sum); } }
329
0.553191
0.531915
21
13.666667
14.24725
40
false
false
0
0
0
0
0
0
1.809524
false
false
1
e4bcd87a497d43dd802fc631483ec1d42c917bc4
20,478,404,089,371
0f2f488730fc2dfa994132bc8800452d8d8d01ea
/src/main/java/org/redalert1741/powerup/auto/move/TankDriveTankMove.java
3b6e8297775edeb17c3eaa52bf4dc3098352efd3
[ "MIT" ]
permissive
RAR1741/RA18_RobotCode
https://github.com/RAR1741/RA18_RobotCode
07dfe419431cb8489bf6e925aed3df3e4a00f046
5f0cd63d1dc8fa643edc2d0f346deea7bbaa1352
refs/heads/master
2021-05-14T18:12:38.784000
2018-12-13T23:14:56
2018-12-13T23:14:56
116,067,702
8
2
MIT
false
2019-01-26T19:12:39
2018-01-02T23:23:41
2018-12-13T23:14:59
2018-12-13T23:14:57
651
5
2
0
Java
false
null
package org.redalert1741.powerup.auto.move; import java.util.Map; import org.redalert1741.powerup.TankDrive; import org.redalert1741.robotbase.auto.core.AutoMoveMove; public class TankDriveTankMove implements AutoMoveMove { private TankDrive drive; private double leftdrive; private double rightdrive; private boolean stop; private String mode; public TankDriveTankMove(TankDrive drive) { this.drive = drive; } @Override public void setArgs(Map<String, String> args) { leftdrive = Double.parseDouble(args.get("leftDrive")); rightdrive = Double.parseDouble(args.get("rightDrive")); stop = Boolean.parseBoolean(args.getOrDefault("stop", "true")); mode = args.getOrDefault("mode", "speed"); } @Override public void start() { /* doesn't need init */ } @Override public void run() { if(mode.equals("speed")){ drive.driveMotorsSpeed(leftdrive, rightdrive); } else{ drive.driveMotorsPercentV(leftdrive, rightdrive); } } @Override public void stop() { if(stop) { drive.driveMotorsSpeed(0, 0); } } }
UTF-8
Java
1,175
java
TankDriveTankMove.java
Java
[]
null
[]
package org.redalert1741.powerup.auto.move; import java.util.Map; import org.redalert1741.powerup.TankDrive; import org.redalert1741.robotbase.auto.core.AutoMoveMove; public class TankDriveTankMove implements AutoMoveMove { private TankDrive drive; private double leftdrive; private double rightdrive; private boolean stop; private String mode; public TankDriveTankMove(TankDrive drive) { this.drive = drive; } @Override public void setArgs(Map<String, String> args) { leftdrive = Double.parseDouble(args.get("leftDrive")); rightdrive = Double.parseDouble(args.get("rightDrive")); stop = Boolean.parseBoolean(args.getOrDefault("stop", "true")); mode = args.getOrDefault("mode", "speed"); } @Override public void start() { /* doesn't need init */ } @Override public void run() { if(mode.equals("speed")){ drive.driveMotorsSpeed(leftdrive, rightdrive); } else{ drive.driveMotorsPercentV(leftdrive, rightdrive); } } @Override public void stop() { if(stop) { drive.driveMotorsSpeed(0, 0); } } }
1,175
0.648511
0.636596
45
25.111111
21.734991
71
false
false
0
0
0
0
0
0
0.6
false
false
1
109101e81fe8f736cad3a2c6cb758a451e794efa
31,817,117,751,972
19ef1745ed39f57839957a5d72a06dc38b0efae8
/Java/0814/하윤주/BOJ11728.java
be84ff2a7d504c290b7ee734879565f81f68cd3a
[]
no_license
Baemung/Algoritm-Study
https://github.com/Baemung/Algoritm-Study
41dd68ca64bb62254c39b785cc02bdcda1e1c150
847e95051210b692a9f56bd86f853ebb701c4895
refs/heads/main
2023-08-01T07:15:27.146000
2021-09-27T03:03:59
2021-09-27T03:03:59
391,371,555
0
0
null
true
2021-07-31T13:59:22
2021-07-31T13:59:22
2021-07-31T13:59:16
2021-07-31T13:51:59
0
0
0
0
null
false
false
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; /** * [0810] 백준 11728 배열 합치기 * * sol) * 각 배열의 맨 앞 원소를 비교하며 더 작은 원소를 선택 * 각 배열의 마지막에 최대값 삽입하여 인덱스 비교 * 배열 출력시에는 마지막 값 제거하고 출력 * * time_complex) * O(n) */ public class BOJ11728 { static int N, M; static int[] A; static int[] B; static StringBuilder sb = new StringBuilder(); public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); N = Integer.parseInt(st.nextToken()); M = Integer.parseInt(st.nextToken()); A = new int[N+1]; B = new int[M+1]; st = new StringTokenizer(br.readLine()); for (int i=0; i<N; i++) { A[i] = Integer.parseInt(st.nextToken()); } A[N] = Integer.MAX_VALUE; // 비교를 위해 배열의 마지막에 최대값 삽입 st = new StringTokenizer(br.readLine()); for (int i=0; i<M; i++) { B[i] = Integer.parseInt(st.nextToken()); } B[M] = Integer.MAX_VALUE; sortArrays(); // 인덱싱을 위해 삽입한 마지막 원소 제거하여 출력 sb.setLength(sb.length()-12); System.out.println(sb); } // 두 개의 배열의 앞부터 접근하여 크기가 더 작은 원소 선택 private static void sortArrays() { int a = 0; int b = 0; while(a<=N && b<=M) { if (A[a] <= B[b]) sb.append(A[a++]).append(" "); else sb.append(B[b++]).append(" "); } } }
UTF-8
Java
1,664
java
BOJ11728.java
Java
[]
null
[]
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.StringTokenizer; /** * [0810] 백준 11728 배열 합치기 * * sol) * 각 배열의 맨 앞 원소를 비교하며 더 작은 원소를 선택 * 각 배열의 마지막에 최대값 삽입하여 인덱스 비교 * 배열 출력시에는 마지막 값 제거하고 출력 * * time_complex) * O(n) */ public class BOJ11728 { static int N, M; static int[] A; static int[] B; static StringBuilder sb = new StringBuilder(); public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(br.readLine()); N = Integer.parseInt(st.nextToken()); M = Integer.parseInt(st.nextToken()); A = new int[N+1]; B = new int[M+1]; st = new StringTokenizer(br.readLine()); for (int i=0; i<N; i++) { A[i] = Integer.parseInt(st.nextToken()); } A[N] = Integer.MAX_VALUE; // 비교를 위해 배열의 마지막에 최대값 삽입 st = new StringTokenizer(br.readLine()); for (int i=0; i<M; i++) { B[i] = Integer.parseInt(st.nextToken()); } B[M] = Integer.MAX_VALUE; sortArrays(); // 인덱싱을 위해 삽입한 마지막 원소 제거하여 출력 sb.setLength(sb.length()-12); System.out.println(sb); } // 두 개의 배열의 앞부터 접근하여 크기가 더 작은 원소 선택 private static void sortArrays() { int a = 0; int b = 0; while(a<=N && b<=M) { if (A[a] <= B[b]) sb.append(A[a++]).append(" "); else sb.append(B[b++]).append(" "); } } }
1,664
0.620934
0.605375
64
21.09375
18.354767
75
false
false
0
0
0
0
0
0
1.75
false
false
1
65c0441149fc529b78b59d5fc7d0e21cadc945dc
31,817,117,753,538
dba72503a52d3cc8a94b21fe4ad7090229ee5d55
/patterns/src/main/java/com/examples/creational/factorymethod/Logistics.java
fcb772277d0ace3884bcef068cb4c86d36867f86
[]
no_license
leonx7/tutorials
https://github.com/leonx7/tutorials
ecba7f775055b29605ab353b7ae42cdf13d825ae
27d96339751995b98edd1425aa93b70a6fbd3a1c
refs/heads/master
2023-03-26T23:15:55.702000
2020-09-23T12:23:04
2020-09-23T12:23:04
277,179,043
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.examples.creational.factorymethod; //Creator public interface Logistics { Transport createTransport(); }
UTF-8
Java
122
java
Logistics.java
Java
[]
null
[]
package com.examples.creational.factorymethod; //Creator public interface Logistics { Transport createTransport(); }
122
0.786885
0.786885
6
19.333334
17.143188
46
false
false
0
0
0
0
0
0
0.333333
false
false
1
d49a926b93a53a77b73650fda09331f4d6b88284
14,302,241,128,039
ada512ea22c15f6fabce5428ced80f978fe756bb
/src/controller/DelDadosAdcController.java
0bdfdb5036fd161c9c9bcfcf4cb3c75c2fc22698
[]
no_license
Luiz1996/Trab2_POO
https://github.com/Luiz1996/Trab2_POO
61ccc561db7850435583ddef879a9e00efa7dcc0
0859a5249581a1ece8374b2035d82e202019eced
refs/heads/master
2020-06-28T15:41:53.284000
2019-08-02T17:10:56
2019-08-02T17:10:56
200,271,170
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package controller; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JOptionPane; import model.Medico; import model.MedicoExecucao; import model.Paciente; import service.FormataDatas; import view.DelDadosAdcView; /** * * @author Vini */ public class DelDadosAdcController { private Medico medM = new Medico(); private MedicoExecucao medME; private DelDadosAdcView delDadosAdcV = new DelDadosAdcView(); private Paciente pacM = new Paciente(); private ActionListener actionListener; public DelDadosAdcController(DelDadosAdcView delDadosAdcV, MedicoExecucao medME) { this.delDadosAdcV = delDadosAdcV; this.delDadosAdcV.setVisible(true); this.medME = medME; consultarPaciente(); deletarDadosAdc(); } private void consultarPaciente() { actionListener = (ActionEvent ae) -> { FormataDatas dtFormat = new FormataDatas(); //buscando dados do paciente desejado pacM = medME.buscarPacienteDao(delDadosAdcV.getTxtCpfConsulta().getText()); //caso não encontre registros então os campos são limpos if (pacM == null) { delDadosAdcV.getTxtNome().setText(""); delDadosAdcV.getTxtCpf().setText(""); delDadosAdcV.getTxtRg().setText(""); delDadosAdcV.getTxtEndereco().setText(""); delDadosAdcV.getTxtCelular().setText(""); delDadosAdcV.getTxtEmail().setText(""); delDadosAdcV.getTxtDtNasc().setText(""); delDadosAdcV.getTxtConvenio().setText(""); delDadosAdcV.getTxtCpfConsulta().setText(""); delDadosAdcV.getBtnRadFumaNao().setSelected(false); delDadosAdcV.getBtnRadFumaSim().setSelected(false); delDadosAdcV.getBtnRadBebeNao().setSelected(false); delDadosAdcV.getBtnRadBebeSim().setSelected(false); delDadosAdcV.getBtnRadColesterolNao().setSelected(false); delDadosAdcV.getBtnRadColesterolSim().setSelected(false); delDadosAdcV.getBtnRadDiabetesNao().setSelected(false); delDadosAdcV.getBtnRadDiabetesSim().setSelected(false); delDadosAdcV.getBtnRadAlergiaNao().setSelected(false); delDadosAdcV.getBtnRadAlergiaSim().setSelected(false); delDadosAdcV.getBtnRadProbCardiacoNao().setSelected(false); delDadosAdcV.getBtnRadProbCardiacoSim().setSelected(false); delDadosAdcV.getBtnRadCirurgiaNao().setSelected(false); delDadosAdcV.getBtnRadCirurgiaSim().setSelected(false); delDadosAdcV.getTxtCpfConsulta().requestFocus(); JOptionPane.showMessageDialog(null, "Nenhum paciente encontrado.", "Falha na consulta", JOptionPane.ERROR_MESSAGE); return; } //carregando os txtFields delDadosAdcV.getTxtNome().setText(pacM.getNome().trim()); delDadosAdcV.getTxtNome().setText(pacM.getNome().trim()); delDadosAdcV.getTxtCpf().setText(pacM.getCpf().trim()); delDadosAdcV.getTxtRg().setText(pacM.getRg().trim()); delDadosAdcV.getTxtEndereco().setText(pacM.getEndereco().trim()); delDadosAdcV.getTxtCelular().setText(pacM.getCelular().trim()); delDadosAdcV.getTxtEmail().setText(pacM.getEmail().trim()); //obtendo a data de nascimento formatada delDadosAdcV.getTxtDtNasc().setText(dtFormat.formataPadraoBrasil(pacM.getDtNasc(), "Data de Nascimento")); //obtendo o tipo de convenio do paciente if (pacM.getConvenio() == 0) { delDadosAdcV.getTxtConvenio().setText("Particular"); } else { delDadosAdcV.getTxtConvenio().setText("Plano de Saúde"); } //setando dados adicionais setandoDadosAdc(); delDadosAdcV.getTxtCpfConsulta().setText(""); }; delDadosAdcV.getBtnConsultar().addActionListener(actionListener); } public void setandoDadosAdc() { //setando dados adicionais if (pacM.getFuma() == 2) { delDadosAdcV.getBtnRadFumaSim().setSelected(true); } else { if (pacM.getFuma() == 1) { delDadosAdcV.getBtnRadFumaNao().setSelected(true); } else { delDadosAdcV.getBtnRadFumaNao().setSelected(false); delDadosAdcV.getBtnRadFumaSim().setSelected(false); } } if (pacM.getBebe() == 2) { delDadosAdcV.getBtnRadBebeSim().setSelected(true); } else { if (pacM.getBebe() == 1) { delDadosAdcV.getBtnRadBebeNao().setSelected(true); } else { delDadosAdcV.getBtnRadBebeNao().setSelected(false); delDadosAdcV.getBtnRadBebeSim().setSelected(false); } } if (pacM.getColesterol() == 2) { delDadosAdcV.getBtnRadColesterolSim().setSelected(true); } else { if (pacM.getColesterol() == 1) { delDadosAdcV.getBtnRadColesterolNao().setSelected(true); } else { delDadosAdcV.getBtnRadColesterolNao().setSelected(false); delDadosAdcV.getBtnRadColesterolSim().setSelected(false); } } if (pacM.getDiabetes() == 2) { delDadosAdcV.getBtnRadDiabetesSim().setSelected(true); } else { if (pacM.getDiabetes() == 1) { delDadosAdcV.getBtnRadDiabetesNao().setSelected(true); } else { delDadosAdcV.getBtnRadDiabetesNao().setSelected(false); delDadosAdcV.getBtnRadDiabetesSim().setSelected(false); } } if (pacM.getAlergias() == 2) { delDadosAdcV.getBtnRadAlergiaSim().setSelected(true); } else { if (pacM.getAlergias() == 1) { delDadosAdcV.getBtnRadAlergiaNao().setSelected(true); } else { delDadosAdcV.getBtnRadAlergiaNao().setSelected(false); delDadosAdcV.getBtnRadAlergiaSim().setSelected(false); } } if (pacM.getProbCardiaco() == 2) { delDadosAdcV.getBtnRadProbCardiacoSim().setSelected(true); } else { if (pacM.getProbCardiaco() == 1) { delDadosAdcV.getBtnRadProbCardiacoNao().setSelected(true); } else { delDadosAdcV.getBtnRadProbCardiacoNao().setSelected(false); delDadosAdcV.getBtnRadProbCardiacoSim().setSelected(false); } } if (pacM.getCirurgia() == 2) { delDadosAdcV.getBtnRadCirurgiaSim().setSelected(true); } else { if (pacM.getCirurgia() == 1) { delDadosAdcV.getBtnRadCirurgiaNao().setSelected(true); } else { delDadosAdcV.getBtnRadCirurgiaNao().setSelected(false); delDadosAdcV.getBtnRadCirurgiaSim().setSelected(false); } } } private void deletarDadosAdc() { actionListener = (ActionEvent ae) -> { if (pacM.getId() == null) { JOptionPane.showMessageDialog(null, "Nenhum paciente foi consultado/selecionado.", "Falha na deleção", JOptionPane.ERROR_MESSAGE); return; } if (JOptionPane.showConfirmDialog(null, "Tem certeza que deseja deletar os dados adicionais do paciente?", "Confirmação de deleção", JOptionPane.YES_NO_OPTION) == 0) { //resetando dados adicionais pacM.setFuma(0); pacM.setBebe(0); pacM.setColesterol(0); pacM.setDiabetes(0); pacM.setProbCardiaco(0); pacM.setAlergias(0); pacM.setCirurgia(0); //efetuando as alterações medME.alterarPacienteDao(pacM); delDadosAdcV.dispose(); JOptionPane.showMessageDialog(null, "Dados adicionais deletados com sucesso!", "Sucesso na deleção", JOptionPane.INFORMATION_MESSAGE); } }; delDadosAdcV.getBtnDeletar().addActionListener(actionListener); } }
UTF-8
Java
8,696
java
DelDadosAdcController.java
Java
[ { "context": "s;\nimport view.DelDadosAdcView;\n\n/**\n *\n * @author Vini\n */\npublic class DelDadosAdcController {\n priv", "end": 465, "score": 0.9905436038970947, "start": 461, "tag": "NAME", "value": "Vini" } ]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package controller; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.JOptionPane; import model.Medico; import model.MedicoExecucao; import model.Paciente; import service.FormataDatas; import view.DelDadosAdcView; /** * * @author Vini */ public class DelDadosAdcController { private Medico medM = new Medico(); private MedicoExecucao medME; private DelDadosAdcView delDadosAdcV = new DelDadosAdcView(); private Paciente pacM = new Paciente(); private ActionListener actionListener; public DelDadosAdcController(DelDadosAdcView delDadosAdcV, MedicoExecucao medME) { this.delDadosAdcV = delDadosAdcV; this.delDadosAdcV.setVisible(true); this.medME = medME; consultarPaciente(); deletarDadosAdc(); } private void consultarPaciente() { actionListener = (ActionEvent ae) -> { FormataDatas dtFormat = new FormataDatas(); //buscando dados do paciente desejado pacM = medME.buscarPacienteDao(delDadosAdcV.getTxtCpfConsulta().getText()); //caso não encontre registros então os campos são limpos if (pacM == null) { delDadosAdcV.getTxtNome().setText(""); delDadosAdcV.getTxtCpf().setText(""); delDadosAdcV.getTxtRg().setText(""); delDadosAdcV.getTxtEndereco().setText(""); delDadosAdcV.getTxtCelular().setText(""); delDadosAdcV.getTxtEmail().setText(""); delDadosAdcV.getTxtDtNasc().setText(""); delDadosAdcV.getTxtConvenio().setText(""); delDadosAdcV.getTxtCpfConsulta().setText(""); delDadosAdcV.getBtnRadFumaNao().setSelected(false); delDadosAdcV.getBtnRadFumaSim().setSelected(false); delDadosAdcV.getBtnRadBebeNao().setSelected(false); delDadosAdcV.getBtnRadBebeSim().setSelected(false); delDadosAdcV.getBtnRadColesterolNao().setSelected(false); delDadosAdcV.getBtnRadColesterolSim().setSelected(false); delDadosAdcV.getBtnRadDiabetesNao().setSelected(false); delDadosAdcV.getBtnRadDiabetesSim().setSelected(false); delDadosAdcV.getBtnRadAlergiaNao().setSelected(false); delDadosAdcV.getBtnRadAlergiaSim().setSelected(false); delDadosAdcV.getBtnRadProbCardiacoNao().setSelected(false); delDadosAdcV.getBtnRadProbCardiacoSim().setSelected(false); delDadosAdcV.getBtnRadCirurgiaNao().setSelected(false); delDadosAdcV.getBtnRadCirurgiaSim().setSelected(false); delDadosAdcV.getTxtCpfConsulta().requestFocus(); JOptionPane.showMessageDialog(null, "Nenhum paciente encontrado.", "Falha na consulta", JOptionPane.ERROR_MESSAGE); return; } //carregando os txtFields delDadosAdcV.getTxtNome().setText(pacM.getNome().trim()); delDadosAdcV.getTxtNome().setText(pacM.getNome().trim()); delDadosAdcV.getTxtCpf().setText(pacM.getCpf().trim()); delDadosAdcV.getTxtRg().setText(pacM.getRg().trim()); delDadosAdcV.getTxtEndereco().setText(pacM.getEndereco().trim()); delDadosAdcV.getTxtCelular().setText(pacM.getCelular().trim()); delDadosAdcV.getTxtEmail().setText(pacM.getEmail().trim()); //obtendo a data de nascimento formatada delDadosAdcV.getTxtDtNasc().setText(dtFormat.formataPadraoBrasil(pacM.getDtNasc(), "Data de Nascimento")); //obtendo o tipo de convenio do paciente if (pacM.getConvenio() == 0) { delDadosAdcV.getTxtConvenio().setText("Particular"); } else { delDadosAdcV.getTxtConvenio().setText("Plano de Saúde"); } //setando dados adicionais setandoDadosAdc(); delDadosAdcV.getTxtCpfConsulta().setText(""); }; delDadosAdcV.getBtnConsultar().addActionListener(actionListener); } public void setandoDadosAdc() { //setando dados adicionais if (pacM.getFuma() == 2) { delDadosAdcV.getBtnRadFumaSim().setSelected(true); } else { if (pacM.getFuma() == 1) { delDadosAdcV.getBtnRadFumaNao().setSelected(true); } else { delDadosAdcV.getBtnRadFumaNao().setSelected(false); delDadosAdcV.getBtnRadFumaSim().setSelected(false); } } if (pacM.getBebe() == 2) { delDadosAdcV.getBtnRadBebeSim().setSelected(true); } else { if (pacM.getBebe() == 1) { delDadosAdcV.getBtnRadBebeNao().setSelected(true); } else { delDadosAdcV.getBtnRadBebeNao().setSelected(false); delDadosAdcV.getBtnRadBebeSim().setSelected(false); } } if (pacM.getColesterol() == 2) { delDadosAdcV.getBtnRadColesterolSim().setSelected(true); } else { if (pacM.getColesterol() == 1) { delDadosAdcV.getBtnRadColesterolNao().setSelected(true); } else { delDadosAdcV.getBtnRadColesterolNao().setSelected(false); delDadosAdcV.getBtnRadColesterolSim().setSelected(false); } } if (pacM.getDiabetes() == 2) { delDadosAdcV.getBtnRadDiabetesSim().setSelected(true); } else { if (pacM.getDiabetes() == 1) { delDadosAdcV.getBtnRadDiabetesNao().setSelected(true); } else { delDadosAdcV.getBtnRadDiabetesNao().setSelected(false); delDadosAdcV.getBtnRadDiabetesSim().setSelected(false); } } if (pacM.getAlergias() == 2) { delDadosAdcV.getBtnRadAlergiaSim().setSelected(true); } else { if (pacM.getAlergias() == 1) { delDadosAdcV.getBtnRadAlergiaNao().setSelected(true); } else { delDadosAdcV.getBtnRadAlergiaNao().setSelected(false); delDadosAdcV.getBtnRadAlergiaSim().setSelected(false); } } if (pacM.getProbCardiaco() == 2) { delDadosAdcV.getBtnRadProbCardiacoSim().setSelected(true); } else { if (pacM.getProbCardiaco() == 1) { delDadosAdcV.getBtnRadProbCardiacoNao().setSelected(true); } else { delDadosAdcV.getBtnRadProbCardiacoNao().setSelected(false); delDadosAdcV.getBtnRadProbCardiacoSim().setSelected(false); } } if (pacM.getCirurgia() == 2) { delDadosAdcV.getBtnRadCirurgiaSim().setSelected(true); } else { if (pacM.getCirurgia() == 1) { delDadosAdcV.getBtnRadCirurgiaNao().setSelected(true); } else { delDadosAdcV.getBtnRadCirurgiaNao().setSelected(false); delDadosAdcV.getBtnRadCirurgiaSim().setSelected(false); } } } private void deletarDadosAdc() { actionListener = (ActionEvent ae) -> { if (pacM.getId() == null) { JOptionPane.showMessageDialog(null, "Nenhum paciente foi consultado/selecionado.", "Falha na deleção", JOptionPane.ERROR_MESSAGE); return; } if (JOptionPane.showConfirmDialog(null, "Tem certeza que deseja deletar os dados adicionais do paciente?", "Confirmação de deleção", JOptionPane.YES_NO_OPTION) == 0) { //resetando dados adicionais pacM.setFuma(0); pacM.setBebe(0); pacM.setColesterol(0); pacM.setDiabetes(0); pacM.setProbCardiaco(0); pacM.setAlergias(0); pacM.setCirurgia(0); //efetuando as alterações medME.alterarPacienteDao(pacM); delDadosAdcV.dispose(); JOptionPane.showMessageDialog(null, "Dados adicionais deletados com sucesso!", "Sucesso na deleção", JOptionPane.INFORMATION_MESSAGE); } }; delDadosAdcV.getBtnDeletar().addActionListener(actionListener); } }
8,696
0.592721
0.590071
206
41.14563
29.957546
179
false
false
0
0
0
0
0
0
0.582524
false
false
1
a57e01cbd3f14982dbf9b5961622714d6149d164
4,879,082,908,493
c399b90a8a650a1ca42139a646659f6532a7e250
/app/src/main/java/com/basu/data/db/model/User.java
a51255abc566e815a8fd49de7d357c1c4aaa006a
[]
no_license
anuragjksamanta92/mvpdemo
https://github.com/anuragjksamanta92/mvpdemo
561875b8339fd2a380bbc04bb8fdec077ccb6738
8f33c344e97c9111b255cb8a562d119396af596f
refs/heads/master
2020-07-29T12:37:15.722000
2019-09-20T14:09:29
2019-09-20T14:09:29
209,804,460
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright (C) 2017 MINDORKS NEXTGEN PRIVATE LIMITED * 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 * * https://mindorks.com/license/apache-v2 * * 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.basu.data.db.model; import org.greenrobot.greendao.annotation.Entity; import org.greenrobot.greendao.annotation.Generated; import org.greenrobot.greendao.annotation.Id; import org.greenrobot.greendao.annotation.Property; /** * Created by suhrit on 16/11/18. */ @Entity(nameInDb = "user") public class User { @Id(autoincrement = true) private Long id; @Property private int member_table_id; @Property(nameInDb = "memberId") private String memberId; @Property(nameInDb = "name") private String name; @Property(nameInDb = "email") private String email; @Property(nameInDb = "country_code") private String country_code; @Property(nameInDb = "phone_no") private String phone_no; @Property(nameInDb = "address_1") private String address_1; @Property(nameInDb = "address_2") private String address_2; @Property(nameInDb = "state") private String state; @Property(nameInDb = "city") private String city; @Property(nameInDb = "zip") private String zip; @Property(nameInDb = "country") private String country; @Property(nameInDb = "pin") private String pin; @Property(nameInDb = "car_make") private String car_make; @Property(nameInDb = "car_model") private String car_model; @Property(nameInDb = "license_plate_number") private String license_plate_number; public int getMember_table_id() { return member_table_id; } public void setMember_table_id(int member_table_id) { this.member_table_id = member_table_id; } @Property(nameInDb = "encodedImage") private String encodedImage; @Generated(hash = 1093098650) public User(Long id, int member_table_id, String memberId, String name, String email, String country_code, String phone_no, String address_1, String address_2, String state, String city, String zip, String country, String pin, String car_make, String car_model, String license_plate_number, String encodedImage) { this.id = id; this.member_table_id = member_table_id; this.memberId = memberId; this.name = name; this.email = email; this.country_code = country_code; this.phone_no = phone_no; this.address_1 = address_1; this.address_2 = address_2; this.state = state; this.city = city; this.zip = zip; this.country = country; this.pin = pin; this.car_make = car_make; this.car_model = car_model; this.license_plate_number = license_plate_number; this.encodedImage = encodedImage; } @Generated(hash = 586692638) public User() { } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPhone_no() { return phone_no; } public void setPhone_no(String phone_no) { this.phone_no = phone_no; } public String getAddress_1() { return address_1; } public void setAddress_1(String address_1) { this.address_1 = address_1; } public String getZip() { return zip; } public void setZip(String zip) { this.zip = zip; } public String getPin() { return pin; } public void setPin(String pin) { this.pin = pin; } public String getCountry_code() { return country_code; } public void setCountry_code(String country_code) { this.country_code = country_code; } public String getAddress_2() { return address_2; } public void setAddress_2(String address_2) { this.address_2 = address_2; } public String getState() { return state; } public String getMemberId() { return memberId; } public void setMemberId(String memberId) { this.memberId = memberId; } public void setState(String state) { this.state = state; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public String getCountry() { return country; } public void setCountry(String country) { this.country = country; } public String getCar_make() { return car_make; } public void setCar_make(String car_make) { this.car_make = car_make; } public String getCar_model() { return car_model; } public void setCar_model(String car_model) { this.car_model = car_model; } public String getLicense_plate_number() { return license_plate_number; } public void setLicense_plate_number(String license_plate_number) { this.license_plate_number = license_plate_number; } public String getEncodedImage() { return encodedImage; } public void setEncodedImage(String encodedImage) { this.encodedImage = encodedImage; } }
UTF-8
Java
5,940
java
User.java
Java
[ { "context": "t.greendao.annotation.Property;\n\n/**\n * Created by suhrit on 16/11/18.\n */\n\n@Entity(nameInDb = \"user\")\npubl", "end": 872, "score": 0.9994670748710632, "start": 866, "tag": "USERNAME", "value": "suhrit" }, { "context": " this.memberId = memberId;\n this.name = name;\n this.email = email;\n this.country", "end": 2825, "score": 0.9864814281463623, "start": 2821, "tag": "NAME", "value": "name" } ]
null
[]
/* * Copyright (C) 2017 MINDORKS NEXTGEN PRIVATE LIMITED * 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 * * https://mindorks.com/license/apache-v2 * * 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.basu.data.db.model; import org.greenrobot.greendao.annotation.Entity; import org.greenrobot.greendao.annotation.Generated; import org.greenrobot.greendao.annotation.Id; import org.greenrobot.greendao.annotation.Property; /** * Created by suhrit on 16/11/18. */ @Entity(nameInDb = "user") public class User { @Id(autoincrement = true) private Long id; @Property private int member_table_id; @Property(nameInDb = "memberId") private String memberId; @Property(nameInDb = "name") private String name; @Property(nameInDb = "email") private String email; @Property(nameInDb = "country_code") private String country_code; @Property(nameInDb = "phone_no") private String phone_no; @Property(nameInDb = "address_1") private String address_1; @Property(nameInDb = "address_2") private String address_2; @Property(nameInDb = "state") private String state; @Property(nameInDb = "city") private String city; @Property(nameInDb = "zip") private String zip; @Property(nameInDb = "country") private String country; @Property(nameInDb = "pin") private String pin; @Property(nameInDb = "car_make") private String car_make; @Property(nameInDb = "car_model") private String car_model; @Property(nameInDb = "license_plate_number") private String license_plate_number; public int getMember_table_id() { return member_table_id; } public void setMember_table_id(int member_table_id) { this.member_table_id = member_table_id; } @Property(nameInDb = "encodedImage") private String encodedImage; @Generated(hash = 1093098650) public User(Long id, int member_table_id, String memberId, String name, String email, String country_code, String phone_no, String address_1, String address_2, String state, String city, String zip, String country, String pin, String car_make, String car_model, String license_plate_number, String encodedImage) { this.id = id; this.member_table_id = member_table_id; this.memberId = memberId; this.name = name; this.email = email; this.country_code = country_code; this.phone_no = phone_no; this.address_1 = address_1; this.address_2 = address_2; this.state = state; this.city = city; this.zip = zip; this.country = country; this.pin = pin; this.car_make = car_make; this.car_model = car_model; this.license_plate_number = license_plate_number; this.encodedImage = encodedImage; } @Generated(hash = 586692638) public User() { } public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getEmail() { return email; } public void setEmail(String email) { this.email = email; } public String getPhone_no() { return phone_no; } public void setPhone_no(String phone_no) { this.phone_no = phone_no; } public String getAddress_1() { return address_1; } public void setAddress_1(String address_1) { this.address_1 = address_1; } public String getZip() { return zip; } public void setZip(String zip) { this.zip = zip; } public String getPin() { return pin; } public void setPin(String pin) { this.pin = pin; } public String getCountry_code() { return country_code; } public void setCountry_code(String country_code) { this.country_code = country_code; } public String getAddress_2() { return address_2; } public void setAddress_2(String address_2) { this.address_2 = address_2; } public String getState() { return state; } public String getMemberId() { return memberId; } public void setMemberId(String memberId) { this.memberId = memberId; } public void setState(String state) { this.state = state; } public String getCity() { return city; } public void setCity(String city) { this.city = city; } public String getCountry() { return country; } public void setCountry(String country) { this.country = country; } public String getCar_make() { return car_make; } public void setCar_make(String car_make) { this.car_make = car_make; } public String getCar_model() { return car_model; } public void setCar_model(String car_model) { this.car_model = car_model; } public String getLicense_plate_number() { return license_plate_number; } public void setLicense_plate_number(String license_plate_number) { this.license_plate_number = license_plate_number; } public String getEncodedImage() { return encodedImage; } public void setEncodedImage(String encodedImage) { this.encodedImage = encodedImage; } }
5,940
0.621717
0.612626
257
22.116732
19.80238
84
false
false
0
0
0
0
0
0
0.385214
false
false
1
a2c8bfac57a717591fea74282ed0496dc180afee
20,873,541,103,420
10b1add583b437135e8c689a5c2cb8a7162c85cf
/app/src/main/java/ee/shy/core/Commit.java
8dc2a657dc605713a4bdac9e9b5e93ad02099981
[ "MIT" ]
permissive
sim642/shy
https://github.com/sim642/shy
853c95bd7ee5b5351c10521a5a8d40c424c1bf79
92cb2f3105920e8ef32838257d9915058cdf9cb7
refs/heads/master
2021-01-15T09:10:32.620000
2016-05-19T13:06:40
2016-05-19T13:06:40
53,264,961
3
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ee.shy.core; import ee.shy.io.Jsonable; import ee.shy.io.Validated; import ee.shy.storage.Hash; import java.time.OffsetDateTime; import java.time.temporal.ChronoUnit; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Objects; /** * Class representing a commit. */ public class Commit implements Jsonable, Validated { /** * Commit's tree hash. */ private final Hash tree; /** * Commit's parent hashes. */ private final List<Hash> parents; /** * Commit's author. */ private final Author author; /** * Commit time. */ private final OffsetDateTime time; /** * Commit message. */ private final String message; /** * Constructs a commit from its builder. * @param builder commit builder */ public Commit(Builder builder) { this.tree = builder.tree; this.parents = new ArrayList<>(builder.parents); // defensive copy this.author = builder.author; this.time = builder.time; this.message = builder.message; assertValid(); } public Hash getTree() { return this.tree; } public List<Hash> getParents() { return Collections.unmodifiableList(this.parents); } public Author getAuthor() { return this.author; } public OffsetDateTime getTime() { return this.time; } public String getMessage() { return this.message; } @Override public void assertValid() { Objects.requireNonNull(tree, "commit has no tree"); Objects.requireNonNull(parents, "commit has no parents list"); if (parents.isEmpty()) throw new IllegalStateException("commit has no parents"); } /** * Builder class for {@link Commit}. */ public static class Builder implements ee.shy.Builder<Commit> { /** * @see Commit#tree */ private Hash tree; /** * @see Commit#parents */ private final List<Hash> parents; /** * @see Commit#author */ private Author author; /** * @see Commit#time */ private OffsetDateTime time; /** * @see Commit#message */ private String message; /** * Constructs a new commit builder. */ public Builder() { this.parents = new ArrayList<>(); } /** * Sets tree hash for commit being built. * @param tree tree hash * @return builder itself */ public Builder setTree(Hash tree) { this.tree = tree; return this; } /** * Adds a parent hash to commit being built. * @param parent parent hash * @return builder itself */ public Builder addParent(Hash parent) { this.parents.add(parent); return this; } /** * Sets author for commit being built. * @param author author * @return builder itself */ public Builder setAuthor(Author author) { this.author = author; return this; } /** * Sets time for commit being built. * @param time time * @return builder itself */ public Builder setTime(OffsetDateTime time) { this.time = time.truncatedTo(ChronoUnit.SECONDS); return this; } /** * Sets time to current time for commit being built. * @return builder itself */ public Builder setTimeCurrent() { return setTime(OffsetDateTime.now()); } /** * Sets message for commit being built. * @param message message * @return builder itself */ public Builder setMessage(String message) { this.message = message; return this; } @Override public Commit create() { return new Commit(this); } } }
UTF-8
Java
4,176
java
Commit.java
Java
[]
null
[]
package ee.shy.core; import ee.shy.io.Jsonable; import ee.shy.io.Validated; import ee.shy.storage.Hash; import java.time.OffsetDateTime; import java.time.temporal.ChronoUnit; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Objects; /** * Class representing a commit. */ public class Commit implements Jsonable, Validated { /** * Commit's tree hash. */ private final Hash tree; /** * Commit's parent hashes. */ private final List<Hash> parents; /** * Commit's author. */ private final Author author; /** * Commit time. */ private final OffsetDateTime time; /** * Commit message. */ private final String message; /** * Constructs a commit from its builder. * @param builder commit builder */ public Commit(Builder builder) { this.tree = builder.tree; this.parents = new ArrayList<>(builder.parents); // defensive copy this.author = builder.author; this.time = builder.time; this.message = builder.message; assertValid(); } public Hash getTree() { return this.tree; } public List<Hash> getParents() { return Collections.unmodifiableList(this.parents); } public Author getAuthor() { return this.author; } public OffsetDateTime getTime() { return this.time; } public String getMessage() { return this.message; } @Override public void assertValid() { Objects.requireNonNull(tree, "commit has no tree"); Objects.requireNonNull(parents, "commit has no parents list"); if (parents.isEmpty()) throw new IllegalStateException("commit has no parents"); } /** * Builder class for {@link Commit}. */ public static class Builder implements ee.shy.Builder<Commit> { /** * @see Commit#tree */ private Hash tree; /** * @see Commit#parents */ private final List<Hash> parents; /** * @see Commit#author */ private Author author; /** * @see Commit#time */ private OffsetDateTime time; /** * @see Commit#message */ private String message; /** * Constructs a new commit builder. */ public Builder() { this.parents = new ArrayList<>(); } /** * Sets tree hash for commit being built. * @param tree tree hash * @return builder itself */ public Builder setTree(Hash tree) { this.tree = tree; return this; } /** * Adds a parent hash to commit being built. * @param parent parent hash * @return builder itself */ public Builder addParent(Hash parent) { this.parents.add(parent); return this; } /** * Sets author for commit being built. * @param author author * @return builder itself */ public Builder setAuthor(Author author) { this.author = author; return this; } /** * Sets time for commit being built. * @param time time * @return builder itself */ public Builder setTime(OffsetDateTime time) { this.time = time.truncatedTo(ChronoUnit.SECONDS); return this; } /** * Sets time to current time for commit being built. * @return builder itself */ public Builder setTimeCurrent() { return setTime(OffsetDateTime.now()); } /** * Sets message for commit being built. * @param message message * @return builder itself */ public Builder setMessage(String message) { this.message = message; return this; } @Override public Commit create() { return new Commit(this); } } }
4,176
0.53999
0.53999
184
21.695652
17.530867
74
false
false
0
0
0
0
0
0
0.271739
false
false
1
982c111cf48a95fe4c9c5206197054fb7c2cf0df
36,189,394,456,391
16d9b69a9a17c584a200de03aad96fc5bd34f895
/src/test/java/MainTest.java
fd7045f960bf0400597bcdd59838a2e173eec647
[]
no_license
manosbatsis/agency
https://github.com/manosbatsis/agency
03fd08ee11e56433da66a7e2f15fbd1ca08c9b26
aef0480f64e78932f55a9dafefc3f94bd408dac8
refs/heads/master
2023-02-24T07:43:33.373000
2021-01-26T13:41:39
2021-01-26T13:41:39
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
//import com._3line.gravity.GravityApplication; //import com._3line.gravity.core.sms.service.SmsService; //import com._3line.gravity.freedom.agents.repository.AgentsRepository; //import org.apache.velocity.Template; //import org.apache.velocity.VelocityContext; //import org.apache.velocity.app.Velocity; //import org.junit.Test; //import org.junit.runner.RunWith; //import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.beans.factory.annotation.Qualifier; //import org.springframework.boot.test.context.SpringBootTest; //import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; //import org.springframework.security.crypto.password.PasswordEncoder; //import org.springframework.test.context.ContextConfiguration; //import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; // //import java.io.StringWriter; // //import static org.junit.Assert.assertNotNull; // // //@RunWith(SpringJUnit4ClassRunner.class) //@SpringBootTest(classes = GravityApplication.class) //public class MainTest { // // //// @Autowired //// private AgentsRepository agentsRepository; //// //// @Qualifier("IPIntgratedSMSImplementation") //// @Autowired //// SmsService smsService; // // @Autowired // BCryptPasswordEncoder passwordEncoder; // //// @Test //// public void checkAgent() { //// //// System.out.println("am searching"); //// Agents foundEntity = agentsRepository //// .findByUsername("funmilayo.olakunle"); //// //// System.out.println("here :: "+foundEntity.getWalletNumber()); //// assertNotNull(foundEntity); //// } // // // @Test // public void testSMS(){ // String res = passwordEncoder.encode("1111"); // System.out.println("encrypted pass is :: "+res); // System.out.println("here ::"+passwordEncoder.matches("1111",res)); // } // // @Test // public void testvm(){ //// Template template; //// StringWriter writer = new StringWriter(); //// VelocityContext context = new VelocityContext(); //// context.put("name","owolabi"); //// template = Velocity.getTemplate("agent_creation"); //// template.merge(context,writer); //// System.out.println("output :: "+writer); //// String vmstr = "Congratulations !! , welcome to Freedom network, find your credentials below, ensure to onboard your pos terminal !name : %s agentid : %s Pin : %s Password : %s"; //// String finalMessage = String.format(vmstr,"user.name","owiwo","1111","pass@123"); //// System.out.println("Final message :: "+finalMessage); // // String term = "2035"; //// Long myval = 57274943842; // System.out.println(term.substring(1,4)); // } // //}
UTF-8
Java
2,773
java
MainTest.java
Java
[ { "context": "tsRepository\n//// .findByUsername(\"funmilayo.olakunle\");\n////\n//// System.out.println(\"here :: \"", "end": 1512, "score": 0.9997367858886719, "start": 1494, "tag": "USERNAME", "value": "funmilayo.olakunle" }, { "context": "){\n// String res = passwordEncoder.encode(\"1111\");\n// System.out.println(\"encrypted pass i", "end": 1743, "score": 0.9749004244804382, "start": 1739, "tag": "PASSWORD", "value": "1111" }, { "context": "em.out.println(\"here ::\"+passwordEncoder.matches(\"1111\",res));\n// }\n//\n// @Test\n// public void ", "end": 1874, "score": 0.8783800005912781, "start": 1870, "tag": "PASSWORD", "value": "1111" }, { "context": "elocityContext();\n//// context.put(\"name\",\"owolabi\");\n//// template = Velocity.getTemplate(\"a", "end": 2119, "score": 0.9989762306213379, "start": 2112, "tag": "USERNAME", "value": "owolabi" }, { "context": "g finalMessage = String.format(vmstr,\"user.name\",\"owiwo\",\"1111\",\"pass@123\");\n//// System.out.print", "end": 2546, "score": 0.9995067715644836, "start": 2541, "tag": "USERNAME", "value": "owiwo" }, { "context": "essage = String.format(vmstr,\"user.name\",\"owiwo\",\"1111\",\"pass@123\");\n//// System.out.println(\"Fin", "end": 2553, "score": 0.9177098274230957, "start": 2549, "tag": "PASSWORD", "value": "1111" }, { "context": "= String.format(vmstr,\"user.name\",\"owiwo\",\"1111\",\"pass@123\");\n//// System.out.println(\"Final message ", "end": 2564, "score": 0.9989553689956665, "start": 2556, "tag": "PASSWORD", "value": "pass@123" } ]
null
[]
//import com._3line.gravity.GravityApplication; //import com._3line.gravity.core.sms.service.SmsService; //import com._3line.gravity.freedom.agents.repository.AgentsRepository; //import org.apache.velocity.Template; //import org.apache.velocity.VelocityContext; //import org.apache.velocity.app.Velocity; //import org.junit.Test; //import org.junit.runner.RunWith; //import org.springframework.beans.factory.annotation.Autowired; //import org.springframework.beans.factory.annotation.Qualifier; //import org.springframework.boot.test.context.SpringBootTest; //import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; //import org.springframework.security.crypto.password.PasswordEncoder; //import org.springframework.test.context.ContextConfiguration; //import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; // //import java.io.StringWriter; // //import static org.junit.Assert.assertNotNull; // // //@RunWith(SpringJUnit4ClassRunner.class) //@SpringBootTest(classes = GravityApplication.class) //public class MainTest { // // //// @Autowired //// private AgentsRepository agentsRepository; //// //// @Qualifier("IPIntgratedSMSImplementation") //// @Autowired //// SmsService smsService; // // @Autowired // BCryptPasswordEncoder passwordEncoder; // //// @Test //// public void checkAgent() { //// //// System.out.println("am searching"); //// Agents foundEntity = agentsRepository //// .findByUsername("funmilayo.olakunle"); //// //// System.out.println("here :: "+foundEntity.getWalletNumber()); //// assertNotNull(foundEntity); //// } // // // @Test // public void testSMS(){ // String res = passwordEncoder.encode("<PASSWORD>"); // System.out.println("encrypted pass is :: "+res); // System.out.println("here ::"+passwordEncoder.matches("<PASSWORD>",res)); // } // // @Test // public void testvm(){ //// Template template; //// StringWriter writer = new StringWriter(); //// VelocityContext context = new VelocityContext(); //// context.put("name","owolabi"); //// template = Velocity.getTemplate("agent_creation"); //// template.merge(context,writer); //// System.out.println("output :: "+writer); //// String vmstr = "Congratulations !! , welcome to Freedom network, find your credentials below, ensure to onboard your pos terminal !name : %s agentid : %s Pin : %s Password : %s"; //// String finalMessage = String.format(vmstr,"user.name","owiwo","<PASSWORD>","<PASSWORD>"); //// System.out.println("Final message :: "+finalMessage); // // String term = "2035"; //// Long myval = 57274943842; // System.out.println(term.substring(1,4)); // } // //}
2,793
0.670754
0.65705
74
36.472973
30.559301
190
false
false
0
0
0
0
0
0
0.689189
false
false
1
13e83785ffb3f9c4b868072be23b055cab9a701e
30,897,994,760,778
b6c6b318728bb5d13932ebcee1ffa849df838b9a
/CourseMakerAndroid/CMAuthor/src/main/java/com/boha/cmauthor/AbstractPagerActivity.java
613af5e3b670435cdf828306b0141528a3e73fb2
[]
no_license
malengatiger/CM-2014-08-28
https://github.com/malengatiger/CM-2014-08-28
63b414438757d43866bfc8eaf9a9730896ae07df
516ab6ce52e81dc1d53f570757262aeb1a093313
refs/heads/master
2016-09-10T20:16:03.965000
2014-08-31T08:50:00
2014-08-31T08:50:00
23,423,623
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.boha.cmauthor; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; import android.view.Menu; import android.view.View; import android.widget.TextView; import com.boha.coursemaker.dto.*; import com.boha.coursemaker.listeners.PageInterface; import java.util.ArrayList; import java.util.List; public abstract class AbstractPagerActivity extends FragmentActivity { public AbstractPagerActivity() { } static List<PageInterface> pageList; static int numberOfPages; MyAdapter mAdapter; ViewPager mPager; TextView txtPageNumber; View progressLayout; CategoryDTO category; CourseDTO course; ActivityDTO activity; LessonResourceDTO lessonResource; ResponseDTO response; public abstract void getData(); public void initializePager() { mAdapter = new MyAdapter(getSupportFragmentManager(), numberOfPages, this); mPager = (ViewPager) findViewById(R.id.pager); mPager.setAdapter(mAdapter); mPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageSelected(int arg0) { txtPageNumber.setText("" + (arg0 + 1)); } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { } @Override public void onPageScrollStateChanged(int arg0) { } }); } public void buildMasterPages(PageInterface page) { pageList = new ArrayList<PageInterface>(); pageList.add(page); numberOfPages = pageList.size(); } public void addPage(PageInterface page) { pageList.add(page); numberOfPages = pageList.size(); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.resource, menu); return true; } public static class MyAdapter extends FragmentPagerAdapter { AbstractPagerActivity pager; public MyAdapter(FragmentManager fm, int pages, AbstractPagerActivity pager) { super(fm); numberOfPages = pages; this.pager = pager; } @Override public int getCount() { // notifyDataSetChanged(); return numberOfPages; } @Override public Fragment getItem(int position) { return (Fragment) pageList.get(position); } } }
UTF-8
Java
2,294
java
AbstractPagerActivity.java
Java
[]
null
[]
package com.boha.cmauthor; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentPagerAdapter; import android.support.v4.view.ViewPager; import android.view.Menu; import android.view.View; import android.widget.TextView; import com.boha.coursemaker.dto.*; import com.boha.coursemaker.listeners.PageInterface; import java.util.ArrayList; import java.util.List; public abstract class AbstractPagerActivity extends FragmentActivity { public AbstractPagerActivity() { } static List<PageInterface> pageList; static int numberOfPages; MyAdapter mAdapter; ViewPager mPager; TextView txtPageNumber; View progressLayout; CategoryDTO category; CourseDTO course; ActivityDTO activity; LessonResourceDTO lessonResource; ResponseDTO response; public abstract void getData(); public void initializePager() { mAdapter = new MyAdapter(getSupportFragmentManager(), numberOfPages, this); mPager = (ViewPager) findViewById(R.id.pager); mPager.setAdapter(mAdapter); mPager.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { @Override public void onPageSelected(int arg0) { txtPageNumber.setText("" + (arg0 + 1)); } @Override public void onPageScrolled(int arg0, float arg1, int arg2) { } @Override public void onPageScrollStateChanged(int arg0) { } }); } public void buildMasterPages(PageInterface page) { pageList = new ArrayList<PageInterface>(); pageList.add(page); numberOfPages = pageList.size(); } public void addPage(PageInterface page) { pageList.add(page); numberOfPages = pageList.size(); } @Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.resource, menu); return true; } public static class MyAdapter extends FragmentPagerAdapter { AbstractPagerActivity pager; public MyAdapter(FragmentManager fm, int pages, AbstractPagerActivity pager) { super(fm); numberOfPages = pages; this.pager = pager; } @Override public int getCount() { // notifyDataSetChanged(); return numberOfPages; } @Override public Fragment getItem(int position) { return (Fragment) pageList.get(position); } } }
2,294
0.751526
0.746295
106
20.64151
19.818605
71
false
false
0
0
0
0
0
0
1.650943
false
false
1
3729348ad7f12de0f32f801595f8de765db176c2
22,316,650,128,151
79db2d6eef3002b17431b1497f073e4d2d16df93
/p2/p2_2/Vowel.java
b66897d360f1d8c7097d35febe0a998726eb9fbd
[]
no_license
deekeh/java
https://github.com/deekeh/java
1c7f5fad506d092b15eecf166906bc63d6f4c905
432774ea54ca04e5e6b6c68d29ed6973886b6b51
refs/heads/master
2020-08-06T05:29:28.998000
2019-10-28T11:06:40
2019-10-28T11:06:40
212,853,006
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
// CREATED BY 'DK' // DATE 20-07-2019 import java.util.Scanner; class Vowel { boolean isLetter(char c) { int charAscii = (int)(c); if ((c >= 65 && c <= 90) || (c >= 97 && c <= 122)) return true; return false; } public static void main(String[] args) { int consonants = 0, vowels = 0; Vowel v = new Vowel(); String s = "Vivekanand Education Society's Inititute of Technology."; for (int i=0; i<s.length(); i++) { if (v.isLetter(s.charAt(i))) { if (s.toLowerCase().charAt(i) == 'a' || s.toLowerCase().charAt(i) == 'e' || s.toLowerCase().charAt(i) == 'i' || s.toLowerCase().charAt(i) == 'o' || s.toLowerCase().charAt(i) == 'u') vowels++; else consonants++; } } System.out.println("Input String: " + "\"" + s + "\"" + "\n"); System.out.println(" Vowels: " + vowels); System.out.println(" Consonants: " + consonants); } }
UTF-8
Java
863
java
Vowel.java
Java
[ { "context": "// CREATED BY 'DK'\n// DATE 20-07-2019\n\nimport java.util.Scanner;\n\nc", "end": 17, "score": 0.7703812122344971, "start": 15, "tag": "USERNAME", "value": "DK" } ]
null
[]
// CREATED BY 'DK' // DATE 20-07-2019 import java.util.Scanner; class Vowel { boolean isLetter(char c) { int charAscii = (int)(c); if ((c >= 65 && c <= 90) || (c >= 97 && c <= 122)) return true; return false; } public static void main(String[] args) { int consonants = 0, vowels = 0; Vowel v = new Vowel(); String s = "Vivekanand Education Society's Inititute of Technology."; for (int i=0; i<s.length(); i++) { if (v.isLetter(s.charAt(i))) { if (s.toLowerCase().charAt(i) == 'a' || s.toLowerCase().charAt(i) == 'e' || s.toLowerCase().charAt(i) == 'i' || s.toLowerCase().charAt(i) == 'o' || s.toLowerCase().charAt(i) == 'u') vowels++; else consonants++; } } System.out.println("Input String: " + "\"" + s + "\"" + "\n"); System.out.println(" Vowels: " + vowels); System.out.println(" Consonants: " + consonants); } }
863
0.575898
0.552723
30
27.799999
37.447208
195
false
false
0
0
0
0
0
0
2.2
false
false
1
612d2b5ac3ca22d5a356ca075163c213119999e8
24,172,075,986,758
ca6616c0a9487b68941b181af8e60c76158f532b
/usci/modules/cr/src/main/java/kz/bsbnb/usci/cr/model/Creditor.java
d2b35ea52585e8c68b75a8598b82fa2c66e313b4
[]
no_license
smukashev/essp
https://github.com/smukashev/essp
a830fe9c9985d8149bf708bb6c82027cfbf6d6f2
78a278b1d4b9717d72ec7cdb2fc79ac348380387
refs/heads/master
2020-03-15T15:21:37.258000
2017-11-02T08:01:02
2017-11-02T08:01:02
132,210,321
0
1
null
false
2018-06-07T05:52:19
2018-05-05T03:13:35
2018-05-10T06:17:28
2018-06-05T06:40:12
80,960
0
1
2
CSS
false
null
package kz.bsbnb.usci.cr.model; import java.io.Serializable; import java.util.Date; import java.util.List; public class Creditor implements Serializable { private static final long serialVersionUID = 2115312865111267610L; private Long id; private String name; private String shortName; private String code; private Date shutdownDate; private Date changeDate; private String BIN; private String RNN; private String BIK; private Creditor mainOffice; private List<Creditor> branchList; private SubjectType subjectType; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getShortName() { return shortName; } public void setShortName(String shortName) { this.shortName = shortName; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public Date getShutdownDate() { return shutdownDate; } public void setShutdownDate(Date shutdownDate) { this.shutdownDate = shutdownDate; } public Date getChangeDate() { return changeDate; } public void setChangeDate(Date changeDate) { this.changeDate = changeDate; } public String getBIN() { return BIN; } public void setBIN(String BIN) { this.BIN = BIN; } public String getRNN() { return RNN; } public void setRNN(String RNN) { this.RNN = RNN; } public String getBIK() { return BIK; } public void setBIK(String BIK) { this.BIK = BIK; } public Creditor getMainOffice() { return mainOffice; } public void setMainOffice(Creditor mainOffice) { this.mainOffice = mainOffice; } public List<Creditor> getBranchList() { return branchList; } public void setBranchList(List<Creditor> branchList) { this.branchList = branchList; } public SubjectType getSubjectType() { return subjectType; } public void setSubjectType(SubjectType subjectType) { this.subjectType = subjectType; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Creditor creditor = (Creditor) o; return getId().equals(creditor.getId()); } @Override public int hashCode() { return getId().hashCode(); } }
UTF-8
Java
2,700
java
Creditor.java
Java
[]
null
[]
package kz.bsbnb.usci.cr.model; import java.io.Serializable; import java.util.Date; import java.util.List; public class Creditor implements Serializable { private static final long serialVersionUID = 2115312865111267610L; private Long id; private String name; private String shortName; private String code; private Date shutdownDate; private Date changeDate; private String BIN; private String RNN; private String BIK; private Creditor mainOffice; private List<Creditor> branchList; private SubjectType subjectType; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getShortName() { return shortName; } public void setShortName(String shortName) { this.shortName = shortName; } public String getCode() { return code; } public void setCode(String code) { this.code = code; } public Date getShutdownDate() { return shutdownDate; } public void setShutdownDate(Date shutdownDate) { this.shutdownDate = shutdownDate; } public Date getChangeDate() { return changeDate; } public void setChangeDate(Date changeDate) { this.changeDate = changeDate; } public String getBIN() { return BIN; } public void setBIN(String BIN) { this.BIN = BIN; } public String getRNN() { return RNN; } public void setRNN(String RNN) { this.RNN = RNN; } public String getBIK() { return BIK; } public void setBIK(String BIK) { this.BIK = BIK; } public Creditor getMainOffice() { return mainOffice; } public void setMainOffice(Creditor mainOffice) { this.mainOffice = mainOffice; } public List<Creditor> getBranchList() { return branchList; } public void setBranchList(List<Creditor> branchList) { this.branchList = branchList; } public SubjectType getSubjectType() { return subjectType; } public void setSubjectType(SubjectType subjectType) { this.subjectType = subjectType; } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; Creditor creditor = (Creditor) o; return getId().equals(creditor.getId()); } @Override public int hashCode() { return getId().hashCode(); } }
2,700
0.607778
0.600741
145
17.620689
17.356335
70
false
false
0
0
0
0
0
0
0.331034
false
false
1
8392a35eafe152ef290c93664136b03c1267486b
30,210,799,983,455
be7205bdaf11bcfbcf26962044d220cec4c9033a
/app/src/main/java/com/mobile/buttonusertransfer/view/UserListAdapter.java
f478ac353ca2a7e08f3deae2c20326903c015944
[]
no_license
iAutoparkCars/AndroidRESTDemoApp
https://github.com/iAutoparkCars/AndroidRESTDemoApp
98236d050798306355bf69221188297b7a345256
8da06157c04c2a3d4eca6645b2c08cc9e4814907
refs/heads/master
2021-09-12T09:39:27.394000
2018-04-15T22:19:35
2018-04-15T22:19:35
125,411,016
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mobile.buttonusertransfer.view; /** * Created by Steven on 11/12/2017. */ import android.content.Context; import android.databinding.DataBindingUtil; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.ViewGroup; import com.mobile.buttonusertransfer.R; import com.mobile.buttonusertransfer.data.model.User; import com.mobile.buttonusertransfer.databinding.ViewUserListItemBinding; import java.util.LinkedList; import java.util.List; public class UserListAdapter extends RecyclerView.Adapter<ViewHolder> { private String TAG = getClass().getName(); private List<User> mDataset; private LayoutInflater inflater; public int lastPosition = -1; private Context context; public String name; public UserListAdapter(){ mDataset = new LinkedList<User>(); } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { // inflate a new view for data binding context = parent.getContext(); inflater = LayoutInflater.from(context); ViewUserListItemBinding viewBinding = DataBindingUtil.inflate(inflater, R.layout.view_user_list_item, parent, false); // pass viewBinding into each item of the list return new ViewHolder(viewBinding, parent); } @Override public void onBindViewHolder(ViewHolder holder, final int position) { // one-way binding from POJO -> layout User vidItem = mDataset.get(position); holder.bind(vidItem, this.context); } @Override public int getItemCount() { return mDataset.size(); } public void addItems(List<User> list){ mDataset.clear(); if (mDataset == null) mDataset = new LinkedList<>(); for (User item : list){ mDataset.add(item); } } }
UTF-8
Java
1,871
java
UserListAdapter.java
Java
[ { "context": "mobile.buttonusertransfer.view;\n\n/**\n * Created by Steven on 11/12/2017.\n */\n\nimport android.content.Contex", "end": 69, "score": 0.999483585357666, "start": 63, "tag": "NAME", "value": "Steven" } ]
null
[]
package com.mobile.buttonusertransfer.view; /** * Created by Steven on 11/12/2017. */ import android.content.Context; import android.databinding.DataBindingUtil; import android.support.v7.widget.RecyclerView; import android.view.LayoutInflater; import android.view.ViewGroup; import com.mobile.buttonusertransfer.R; import com.mobile.buttonusertransfer.data.model.User; import com.mobile.buttonusertransfer.databinding.ViewUserListItemBinding; import java.util.LinkedList; import java.util.List; public class UserListAdapter extends RecyclerView.Adapter<ViewHolder> { private String TAG = getClass().getName(); private List<User> mDataset; private LayoutInflater inflater; public int lastPosition = -1; private Context context; public String name; public UserListAdapter(){ mDataset = new LinkedList<User>(); } @Override public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { // inflate a new view for data binding context = parent.getContext(); inflater = LayoutInflater.from(context); ViewUserListItemBinding viewBinding = DataBindingUtil.inflate(inflater, R.layout.view_user_list_item, parent, false); // pass viewBinding into each item of the list return new ViewHolder(viewBinding, parent); } @Override public void onBindViewHolder(ViewHolder holder, final int position) { // one-way binding from POJO -> layout User vidItem = mDataset.get(position); holder.bind(vidItem, this.context); } @Override public int getItemCount() { return mDataset.size(); } public void addItems(List<User> list){ mDataset.clear(); if (mDataset == null) mDataset = new LinkedList<>(); for (User item : list){ mDataset.add(item); } } }
1,871
0.691609
0.686264
67
26.925373
24.563238
125
false
false
0
0
0
0
0
0
0.522388
false
false
1
87b4330b2066e0541c58b752615aae8cc7fd16d1
12,592,844,138,495
3dbefeced9e213398319b82b9989f911617773fd
/src/com/scp/roundedbitmapdrawable/MainActivity.java
8ef15ab37e3a3dae5c6dc926d7bcc08f920c7a81
[ "Apache-2.0" ]
permissive
0359xiaodong/RoundedBitmapDrawable
https://github.com/0359xiaodong/RoundedBitmapDrawable
3bc21312114e828e1dfaf5e4cfec95f6df7c2b86
3f677b3f30165d1521b78c6d98c3973d9b853043
refs/heads/master
2020-05-29T11:07:48.603000
2015-06-28T10:50:57
2015-06-28T10:50:57
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.scp.roundedbitmapdrawable; import android.app.Activity; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.support.v4.graphics.drawable.RoundedBitmapDrawable; import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory; import android.view.Window; import android.widget.ImageView; public class MainActivity extends Activity { private ImageView image; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.layout_main); initView(); } private void initView() { image = (ImageView) findViewById(R.id.image); Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.hyomin); Drawable rbd = saveBitMap(bitmapToSquare(bitmap)); image.setImageDrawable(rbd); } /** * 生成圆角图像 * * @param bitmap * 原图像 * @return 圆角图像 */ private Drawable saveBitMap(Bitmap bitmap) { /** * 1.加载资源 2.创建RoundedBitmapDrawable 3.设置圆角半径 */ RoundedBitmapDrawable rbd = RoundedBitmapDrawableFactory.create( getResources(), bitmap); rbd.setCornerRadius(bitmap.getWidth() / 2);// 设置圆角半径为正方形边长的一半 rbd.setAntiAlias(true);// 设置抗锯齿 return rbd; } /** * 从中心生成一个生成正方形 * * @param bitmap * 原图像 * @return 正方形图像 */ private Bitmap bitmapToSquare(Bitmap bitmap) { if (bitmap.getWidth() >= bitmap.getHeight()) { bitmap = Bitmap.createBitmap(bitmap, bitmap.getWidth() / 2 - bitmap.getHeight() / 2, 0, bitmap.getHeight(), bitmap.getHeight()); } else { bitmap = Bitmap.createBitmap(bitmap, 0, bitmap.getHeight() / 2 - bitmap.getWidth() / 2, bitmap.getWidth(), bitmap.getWidth()); } return bitmap; } }
GB18030
Java
1,976
java
MainActivity.java
Java
[]
null
[]
package com.scp.roundedbitmapdrawable; import android.app.Activity; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.drawable.Drawable; import android.os.Bundle; import android.support.v4.graphics.drawable.RoundedBitmapDrawable; import android.support.v4.graphics.drawable.RoundedBitmapDrawableFactory; import android.view.Window; import android.widget.ImageView; public class MainActivity extends Activity { private ImageView image; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.layout_main); initView(); } private void initView() { image = (ImageView) findViewById(R.id.image); Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.hyomin); Drawable rbd = saveBitMap(bitmapToSquare(bitmap)); image.setImageDrawable(rbd); } /** * 生成圆角图像 * * @param bitmap * 原图像 * @return 圆角图像 */ private Drawable saveBitMap(Bitmap bitmap) { /** * 1.加载资源 2.创建RoundedBitmapDrawable 3.设置圆角半径 */ RoundedBitmapDrawable rbd = RoundedBitmapDrawableFactory.create( getResources(), bitmap); rbd.setCornerRadius(bitmap.getWidth() / 2);// 设置圆角半径为正方形边长的一半 rbd.setAntiAlias(true);// 设置抗锯齿 return rbd; } /** * 从中心生成一个生成正方形 * * @param bitmap * 原图像 * @return 正方形图像 */ private Bitmap bitmapToSquare(Bitmap bitmap) { if (bitmap.getWidth() >= bitmap.getHeight()) { bitmap = Bitmap.createBitmap(bitmap, bitmap.getWidth() / 2 - bitmap.getHeight() / 2, 0, bitmap.getHeight(), bitmap.getHeight()); } else { bitmap = Bitmap.createBitmap(bitmap, 0, bitmap.getHeight() / 2 - bitmap.getWidth() / 2, bitmap.getWidth(), bitmap.getWidth()); } return bitmap; } }
1,976
0.717226
0.710726
71
25
20.939888
73
false
false
0
0
0
0
0
0
1.859155
false
false
1
574dfc9143d42f4eee8eabc15e04c21efb35818c
16,441,134,828,482
8a3c70a0e7eed721da26044afc24a7858c21b135
/api/src/main/java/com/goeuro/api/model/RouteResponse.java
42707e7412b038d9f59817492c76305a02b95903
[]
no_license
Zenedith/challenges
https://github.com/Zenedith/challenges
c08d63dedbbaccde6e21fd75943730c26f424155
5c11af2450b73977d91a627045f69aa03b43ab4d
refs/heads/master
2020-12-24T07:47:48.868000
2016-11-21T14:24:06
2016-11-21T14:24:06
73,366,519
0
0
null
true
2016-11-18T01:28:32
2016-11-10T09:26:40
2016-11-10T09:26:41
2016-11-18T01:28:31
5
0
0
0
Shell
null
null
package com.goeuro.api.model; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; import java.util.Objects; @JsonIgnoreProperties(ignoreUnknown = true) @JsonDeserialize(builder = RouteResponse.RouteResponseBuilder.class) public class RouteResponse { private final String id; private final RouteType type; private RouteResponse(String id, RouteType type) { this.id = id; this.type = type; } public String getId() { return id; } public RouteType getType() { return type; } @Override public int hashCode() { return Objects.hash(id, type); } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } final RouteResponse other = (RouteResponse) obj; return Objects.equals(this.id, other.id) && Objects.equals(this.type, other.type); } @Override public String toString() { return "RouteResponse{" + "id='" + id + '\'' + ", type=" + type + '}'; } @JsonIgnoreProperties(ignoreUnknown = true) @JsonPOJOBuilder public static final class RouteResponseBuilder { private String id; private RouteType type; private RouteResponseBuilder() { } public static RouteResponseBuilder aRouteResponse() { return new RouteResponseBuilder(); } public RouteResponseBuilder withId(String id) { this.id = id; return this; } public RouteResponseBuilder withType(RouteType type) { this.type = type; return this; } public RouteResponse build() { return new RouteResponse(id, type); } } }
UTF-8
Java
2,040
java
RouteResponse.java
Java
[]
null
[]
package com.goeuro.api.model; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; import java.util.Objects; @JsonIgnoreProperties(ignoreUnknown = true) @JsonDeserialize(builder = RouteResponse.RouteResponseBuilder.class) public class RouteResponse { private final String id; private final RouteType type; private RouteResponse(String id, RouteType type) { this.id = id; this.type = type; } public String getId() { return id; } public RouteType getType() { return type; } @Override public int hashCode() { return Objects.hash(id, type); } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null || getClass() != obj.getClass()) { return false; } final RouteResponse other = (RouteResponse) obj; return Objects.equals(this.id, other.id) && Objects.equals(this.type, other.type); } @Override public String toString() { return "RouteResponse{" + "id='" + id + '\'' + ", type=" + type + '}'; } @JsonIgnoreProperties(ignoreUnknown = true) @JsonPOJOBuilder public static final class RouteResponseBuilder { private String id; private RouteType type; private RouteResponseBuilder() { } public static RouteResponseBuilder aRouteResponse() { return new RouteResponseBuilder(); } public RouteResponseBuilder withId(String id) { this.id = id; return this; } public RouteResponseBuilder withType(RouteType type) { this.type = type; return this; } public RouteResponse build() { return new RouteResponse(id, type); } } }
2,040
0.594118
0.594118
82
23.878048
20.276979
68
false
false
0
0
0
0
0
0
0.402439
false
false
1
9969bba25224f7cd806c3688c5c9e8da9f7fbb39
5,214,090,326,663
8edb83a303fb01977543ed7506a37e04c0cafa1f
/src/main/java/io/discloader/discloader/entity/Overwrite.java
a4f863314fca1c7b57d70a8a289c61d291f0f25d
[]
no_license
thvardhan/DiscLoader
https://github.com/thvardhan/DiscLoader
c28531d63506058df9e53f18d046846825f7b832
5bf08ee4547ea82cefd2934a726ece2803d579af
refs/heads/master
2017-05-09T00:41:15.187000
2017-03-12T06:04:03
2017-03-12T06:04:03
82,316,644
0
0
null
true
2017-03-12T06:04:04
2017-02-17T16:34:35
2017-02-17T16:34:38
2017-03-12T06:04:04
7,615
0
0
0
Java
null
null
package io.discloader.discloader.entity; import io.discloader.discloader.entity.channels.Channel; import io.discloader.discloader.entity.guild.GuildMember; import io.discloader.discloader.entity.guild.Role; import io.discloader.discloader.network.json.OverwriteJSON; /** * Permission Overwrite object * @author Perry Berman * */ public class Overwrite { /** * The id of the {@link Role} or {@link GuildMember} the overwrite applies to. */ public String id; /** * The 53bit integer of allowed permissions */ public int allow; /** * The 53bit integer of denied permissions */ public int deny; /** * either "role" or "member" */ public String type; /** * The {@link Role} the overwrite applies to. null if type is {@literal "member"} */ public final Role role; /** * The {@link GuildMember} the overwrite applies to. null if type is {@literal "role"} * @author cloud */ public final GuildMember member; /** * The {@link Channel} the overwrite belongs to */ public Channel channel; public Overwrite(Overwrite data, GuildMember member) { this.allow = data.allow; this.deny = data.deny; this.type = data.type; this.member = member; this.role = null; } public Overwrite(Overwrite data, Role role) { this.allow = data.allow; this.deny = data.deny; this.type = data.type; this.role = role; this.member = null; } public Overwrite(OverwriteJSON data) { this.allow = data.allow; this.deny = data.deny; if (data.id != null) this.id = data.id; if (data.type != null) this.type = data.type; this.role = null; this.member = null; } }
UTF-8
Java
1,634
java
Overwrite.java
Java
[ { "context": "ON;\n\n/**\n * Permission Overwrite object\n * @author Perry Berman\n *\n */\npublic class Overwrite {\n\n\t/**\n\t * The id ", "end": 327, "score": 0.9997729063034058, "start": 315, "tag": "NAME", "value": "Perry Berman" } ]
null
[]
package io.discloader.discloader.entity; import io.discloader.discloader.entity.channels.Channel; import io.discloader.discloader.entity.guild.GuildMember; import io.discloader.discloader.entity.guild.Role; import io.discloader.discloader.network.json.OverwriteJSON; /** * Permission Overwrite object * @author <NAME> * */ public class Overwrite { /** * The id of the {@link Role} or {@link GuildMember} the overwrite applies to. */ public String id; /** * The 53bit integer of allowed permissions */ public int allow; /** * The 53bit integer of denied permissions */ public int deny; /** * either "role" or "member" */ public String type; /** * The {@link Role} the overwrite applies to. null if type is {@literal "member"} */ public final Role role; /** * The {@link GuildMember} the overwrite applies to. null if type is {@literal "role"} * @author cloud */ public final GuildMember member; /** * The {@link Channel} the overwrite belongs to */ public Channel channel; public Overwrite(Overwrite data, GuildMember member) { this.allow = data.allow; this.deny = data.deny; this.type = data.type; this.member = member; this.role = null; } public Overwrite(Overwrite data, Role role) { this.allow = data.allow; this.deny = data.deny; this.type = data.type; this.role = role; this.member = null; } public Overwrite(OverwriteJSON data) { this.allow = data.allow; this.deny = data.deny; if (data.id != null) this.id = data.id; if (data.type != null) this.type = data.type; this.role = null; this.member = null; } }
1,628
0.675643
0.673195
81
19.17284
20.549723
87
false
false
0
0
0
0
0
0
1.358025
false
false
1
cf7b9873f6154074c5ec23479153e1f1a113c3f1
5,214,090,327,703
ee7af7fae5485e803ff2a999871b3f4eea9c748d
/src/main/java/ivorius/yegamolchattels/blocks/BlockPlanksRefinement.java
bdedee421467257b4b50edaec458143e784b0528
[]
no_license
HeetchPT/YeGamolChattels
https://github.com/HeetchPT/YeGamolChattels
e2d2d01c7adcde55f13a0a5cafd7479086aa913a
ed8f6d1a0ed4b2473249901769a44e28ca41b750
refs/heads/master
2020-11-26T21:08:50.526000
2014-08-03T20:52:52
2014-08-03T20:52:52
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ivorius.yegamolchattels.blocks; import ivorius.ivtoolkit.blocks.IvBlockMultiblock; import ivorius.ivtoolkit.blocks.IvTileEntityMultiBlock; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; /** * Created by lukas on 04.05.14. */ public class BlockPlanksRefinement extends IvBlockMultiblock { public BlockPlanksRefinement() { super(Material.wood); } @Override public int getRenderType() { return -1; } @Override public boolean isOpaqueCube() { return false; } @Override public boolean renderAsNormalBlock() { return false; } @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { IvTileEntityMultiBlock tileEntity = getValidatedTotalParent(this, world, x, y, z); if (tileEntity instanceof TileEntityPlanksRefinement) { TileEntityPlanksRefinement planksRefinement = (TileEntityPlanksRefinement) tileEntity; if (planksRefinement.tryStoringItem(player.getHeldItem(), player)) return true; else if (planksRefinement.tryUsingItem(player.getHeldItem(), player)) return true; else if (planksRefinement.tryEquippingItemOnPlayer(player)) return true; return false; } return false; } @Override public TileEntity createNewTileEntity(World var1, int var2) { return new TileEntityPlanksRefinement(); } }
UTF-8
Java
1,703
java
BlockPlanksRefinement.java
Java
[ { "context": "port net.minecraft.world.World;\n\n/**\n * Created by lukas on 04.05.14.\n */\npublic class BlockPlanksRefineme", "end": 345, "score": 0.9902734160423279, "start": 340, "tag": "USERNAME", "value": "lukas" } ]
null
[]
package ivorius.yegamolchattels.blocks; import ivorius.ivtoolkit.blocks.IvBlockMultiblock; import ivorius.ivtoolkit.blocks.IvTileEntityMultiBlock; import net.minecraft.block.material.Material; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; /** * Created by lukas on 04.05.14. */ public class BlockPlanksRefinement extends IvBlockMultiblock { public BlockPlanksRefinement() { super(Material.wood); } @Override public int getRenderType() { return -1; } @Override public boolean isOpaqueCube() { return false; } @Override public boolean renderAsNormalBlock() { return false; } @Override public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) { IvTileEntityMultiBlock tileEntity = getValidatedTotalParent(this, world, x, y, z); if (tileEntity instanceof TileEntityPlanksRefinement) { TileEntityPlanksRefinement planksRefinement = (TileEntityPlanksRefinement) tileEntity; if (planksRefinement.tryStoringItem(player.getHeldItem(), player)) return true; else if (planksRefinement.tryUsingItem(player.getHeldItem(), player)) return true; else if (planksRefinement.tryEquippingItemOnPlayer(player)) return true; return false; } return false; } @Override public TileEntity createNewTileEntity(World var1, int var2) { return new TileEntityPlanksRefinement(); } }
1,703
0.672343
0.667058
65
25.200001
28.575514
136
false
false
0
0
0
0
0
0
0.523077
false
false
1
697fb972ece42f3b51e608c26df4f171693de68d
6,992,206,818,928
5f57900d73af127fbd09e2156c165a5221da209c
/src/GST.java
e0e0cce27c64aa011343ae866b357971a752494f
[]
no_license
risingstar8030/GST-Calculator
https://github.com/risingstar8030/GST-Calculator
3665b6fe2ac1bbac299e7ba465f790adaffde9de
39685b187b8c4d90edd33a0f604c615ae8b43164
refs/heads/master
2022-12-06T09:19:10.643000
2020-08-16T10:41:46
2020-08-16T10:41:46
287,878,172
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public interface GST { // Method Overloading : Method is selected according to item public void calculateGST(FoodGrains foodItem); public void calculateGST(Furniture furnitureItem); public void calculateGST(Electronics electronicsItem); public void calculateGST(Cosmetics cosmeticsItem); }
UTF-8
Java
302
java
GST.java
Java
[]
null
[]
public interface GST { // Method Overloading : Method is selected according to item public void calculateGST(FoodGrains foodItem); public void calculateGST(Furniture furnitureItem); public void calculateGST(Electronics electronicsItem); public void calculateGST(Cosmetics cosmeticsItem); }
302
0.801324
0.801324
13
22.153847
25.209419
61
false
false
0
0
0
0
0
0
0.692308
false
false
1
d52c6f97bbcdcccbde07e06f3960d84a761b32f8
4,758,823,825,760
dba87418d2286ce141d81deb947305a0eaf9824f
/sources/org/apache/harmony/awt/p062gl/color/LUTColorConverter.java
30434bc29f0ef05713558433a16d5f9c884155b1
[]
no_license
Sluckson/copyOavct
https://github.com/Sluckson/copyOavct
1f73f47ce94bb08df44f2ba9f698f2e8589b5cf6
d20597e14411e8607d1d6e93b632d0cd2e8af8cb
refs/heads/main
2023-03-09T12:14:38.824000
2021-02-26T01:38:16
2021-02-26T01:38:16
341,292,450
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.apache.harmony.awt.p062gl.color; /* renamed from: org.apache.harmony.awt.gl.color.LUTColorConverter */ public class LUTColorConverter { private static byte[] from16lRGBtosRGB_LUT; private static byte[] from8lRGBtosRGB_LUT; private static short[] fromsRGBto16lRGB_LUT; private static byte[] fromsRGBto8lRGB_LUT; private static byte[][] fromsRGBto8sRGB_LUTs; public static byte[] getFrom8lRGBtosRGB_LUT() { float f; if (from8lRGBtosRGB_LUT == null) { from8lRGBtosRGB_LUT = new byte[256]; for (int i = 0; i < 256; i++) { float f2 = ((float) i) / 255.0f; if (f2 <= 0.04045f) { f = f2 / 12.92f; } else { f = (float) Math.pow((((double) f2) + 0.055d) / 1.055d, 2.4d); } from8lRGBtosRGB_LUT[i] = (byte) Math.round(f * 255.0f); } } return from8lRGBtosRGB_LUT; } public static byte[] getFrom16lRGBtosRGB_LUT() { float f; if (from16lRGBtosRGB_LUT == null) { from16lRGBtosRGB_LUT = new byte[65536]; for (int i = 0; i < 65536; i++) { float f2 = ((float) i) / 65535.0f; if (f2 <= 0.04045f) { f = f2 / 12.92f; } else { f = (float) Math.pow((((double) f2) + 0.055d) / 1.055d, 2.4d); } from16lRGBtosRGB_LUT[i] = (byte) Math.round(f * 255.0f); } } return from16lRGBtosRGB_LUT; } public static byte[] getFromsRGBto8lRGB_LUT() { float f; if (fromsRGBto8lRGB_LUT == null) { fromsRGBto8lRGB_LUT = new byte[256]; for (int i = 0; i < 256; i++) { float f2 = ((float) i) / 255.0f; if (f2 <= 0.0031308f) { f = f2 * 12.92f; } else { f = (((float) Math.pow((double) f2, 0.4166666666666667d)) * 1.055f) - 0.055f; } fromsRGBto8lRGB_LUT[i] = (byte) Math.round(f * 255.0f); } } return fromsRGBto8lRGB_LUT; } public static short[] getFromsRGBto16lRGB_LUT() { float f; if (fromsRGBto16lRGB_LUT == null) { fromsRGBto16lRGB_LUT = new short[256]; for (int i = 0; i < 256; i++) { float f2 = ((float) i) / 255.0f; if (f2 <= 0.0031308f) { f = f2 * 12.92f; } else { f = (((float) Math.pow((double) f2, 0.4166666666666667d)) * 1.055f) - 0.055f; } fromsRGBto16lRGB_LUT[i] = (short) Math.round(f * 65535.0f); } } return fromsRGBto16lRGB_LUT; } public static byte[] getsRGBLUT(int i) { if (i < 1) { return null; } int i2 = i - 1; if (fromsRGBto8sRGB_LUTs == null) { fromsRGBto8sRGB_LUTs = new byte[16][]; } byte[][] bArr = fromsRGBto8sRGB_LUTs; if (bArr[i2] == null) { bArr[i2] = createLUT(i); } return fromsRGBto8sRGB_LUTs[i2]; } private static byte[] createLUT(int i) { int i2 = 1 << i; byte[] bArr = new byte[i2]; for (int i3 = 0; i3 < i2; i3++) { bArr[i3] = (byte) ((int) ((255.0f / ((float) (i2 - 1))) + 0.5f)); } return bArr; } }
UTF-8
Java
3,490
java
LUTColorConverter.java
Java
[]
null
[]
package org.apache.harmony.awt.p062gl.color; /* renamed from: org.apache.harmony.awt.gl.color.LUTColorConverter */ public class LUTColorConverter { private static byte[] from16lRGBtosRGB_LUT; private static byte[] from8lRGBtosRGB_LUT; private static short[] fromsRGBto16lRGB_LUT; private static byte[] fromsRGBto8lRGB_LUT; private static byte[][] fromsRGBto8sRGB_LUTs; public static byte[] getFrom8lRGBtosRGB_LUT() { float f; if (from8lRGBtosRGB_LUT == null) { from8lRGBtosRGB_LUT = new byte[256]; for (int i = 0; i < 256; i++) { float f2 = ((float) i) / 255.0f; if (f2 <= 0.04045f) { f = f2 / 12.92f; } else { f = (float) Math.pow((((double) f2) + 0.055d) / 1.055d, 2.4d); } from8lRGBtosRGB_LUT[i] = (byte) Math.round(f * 255.0f); } } return from8lRGBtosRGB_LUT; } public static byte[] getFrom16lRGBtosRGB_LUT() { float f; if (from16lRGBtosRGB_LUT == null) { from16lRGBtosRGB_LUT = new byte[65536]; for (int i = 0; i < 65536; i++) { float f2 = ((float) i) / 65535.0f; if (f2 <= 0.04045f) { f = f2 / 12.92f; } else { f = (float) Math.pow((((double) f2) + 0.055d) / 1.055d, 2.4d); } from16lRGBtosRGB_LUT[i] = (byte) Math.round(f * 255.0f); } } return from16lRGBtosRGB_LUT; } public static byte[] getFromsRGBto8lRGB_LUT() { float f; if (fromsRGBto8lRGB_LUT == null) { fromsRGBto8lRGB_LUT = new byte[256]; for (int i = 0; i < 256; i++) { float f2 = ((float) i) / 255.0f; if (f2 <= 0.0031308f) { f = f2 * 12.92f; } else { f = (((float) Math.pow((double) f2, 0.4166666666666667d)) * 1.055f) - 0.055f; } fromsRGBto8lRGB_LUT[i] = (byte) Math.round(f * 255.0f); } } return fromsRGBto8lRGB_LUT; } public static short[] getFromsRGBto16lRGB_LUT() { float f; if (fromsRGBto16lRGB_LUT == null) { fromsRGBto16lRGB_LUT = new short[256]; for (int i = 0; i < 256; i++) { float f2 = ((float) i) / 255.0f; if (f2 <= 0.0031308f) { f = f2 * 12.92f; } else { f = (((float) Math.pow((double) f2, 0.4166666666666667d)) * 1.055f) - 0.055f; } fromsRGBto16lRGB_LUT[i] = (short) Math.round(f * 65535.0f); } } return fromsRGBto16lRGB_LUT; } public static byte[] getsRGBLUT(int i) { if (i < 1) { return null; } int i2 = i - 1; if (fromsRGBto8sRGB_LUTs == null) { fromsRGBto8sRGB_LUTs = new byte[16][]; } byte[][] bArr = fromsRGBto8sRGB_LUTs; if (bArr[i2] == null) { bArr[i2] = createLUT(i); } return fromsRGBto8sRGB_LUTs[i2]; } private static byte[] createLUT(int i) { int i2 = 1 << i; byte[] bArr = new byte[i2]; for (int i3 = 0; i3 < i2; i3++) { bArr[i3] = (byte) ((int) ((255.0f / ((float) (i2 - 1))) + 0.5f)); } return bArr; } }
3,490
0.466189
0.389685
102
33.215687
22.471605
97
false
false
0
0
0
0
0
0
0.568627
false
false
1
62cbcc5a8d8cd244da66f3a4dc5423f84ca1ad80
14,379,550,508,821
30a45b959fdaf0fa70fce20a02dca394e5612aae
/src/main/java/com/jxd/mybatis/dao/IEmployeeDao.java
aef67c5e8ff073b5560ce801417aabf30d1314f2
[]
no_license
r-cy/day01_mybatis_mvn
https://github.com/r-cy/day01_mybatis_mvn
89574c261974f69a79e143ba25259f262050829b
71087737f4f975581f60f33815b2e4c3283c4cad
refs/heads/master
2023-01-04T16:52:18.511000
2020-10-31T05:55:51
2020-10-31T05:55:51
308,814,567
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.jxd.mybatis.dao; import com.jxd.mybatis.model.Employee; import java.util.List; import java.util.Map; public interface IEmployeeDao { /** * 查询员工以及其所在部门信息 * @return */ List<Employee> selectWithDept(); List<Map<String,Object>> selectWithDeptByMap(); }
UTF-8
Java
319
java
IEmployeeDao.java
Java
[]
null
[]
package com.jxd.mybatis.dao; import com.jxd.mybatis.model.Employee; import java.util.List; import java.util.Map; public interface IEmployeeDao { /** * 查询员工以及其所在部门信息 * @return */ List<Employee> selectWithDept(); List<Map<String,Object>> selectWithDeptByMap(); }
319
0.682594
0.682594
17
16.235294
15.764925
51
false
false
0
0
0
0
0
0
0.411765
false
false
1
eba5946de7da1f85e5a9495e49dd0916a2a69ae8
16,681,653,023,923
3e52af4c6abd209ab24ee3a1d1c0043108ca2aa2
/inspector/an-inspector/ForgeModule/src/io/trigger/forge/android/modules/custombarcode/R.java
97109a0e264ab51aa3ecf08202b0e86e1bbf5027
[]
no_license
dkoch/custombarcode
https://github.com/dkoch/custombarcode
85035b7a2e695f8f3394f3bb902d878efc680274
5463b104ad2a2da956aa85f22484a7ba79b5bf28
refs/heads/master
2016-10-26T00:12:36.890000
2015-04-27T12:05:18
2015-04-27T12:05:18
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* This file was generated as part of a ForgeModule. * * You may move this file to another package if you require, however do not modify its contents. * To add more resources: rebuild the inspector project. */ package io.trigger.forge.android.modules.custombarcode; import java.lang.reflect.Field; import android.util.Log; public class R { public static class attr { static { try { Class<?> realRClass = Class.forName("io.trigger.forge.android.inspector.R$attr"); for (Field f : attr.class.getDeclaredFields()) { try { f.set(null, realRClass.getDeclaredField(f.getName()).get(null)); } catch (IllegalArgumentException e) { Log.e("Forge", e.toString()); } catch (IllegalAccessException e) { Log.e("Forge", e.toString()); } catch (NoSuchFieldException e) { Log.e("Forge", e.toString()); } } } catch (ClassNotFoundException e) { Log.e("Forge", e.toString()); } } } public static class drawable { public static int camera_capture=0x7f020000; static { try { Class<?> realRClass = Class.forName("io.trigger.forge.android.inspector.R$drawable"); for (Field f : drawable.class.getDeclaredFields()) { try { f.set(null, realRClass.getDeclaredField(f.getName()).get(null)); } catch (IllegalArgumentException e) { Log.e("Forge", e.toString()); } catch (IllegalAccessException e) { Log.e("Forge", e.toString()); } catch (NoSuchFieldException e) { Log.e("Forge", e.toString()); } } } catch (ClassNotFoundException e) { Log.e("Forge", e.toString()); } } } }
UTF-8
Java
2,008
java
R.java
Java
[]
null
[]
/* This file was generated as part of a ForgeModule. * * You may move this file to another package if you require, however do not modify its contents. * To add more resources: rebuild the inspector project. */ package io.trigger.forge.android.modules.custombarcode; import java.lang.reflect.Field; import android.util.Log; public class R { public static class attr { static { try { Class<?> realRClass = Class.forName("io.trigger.forge.android.inspector.R$attr"); for (Field f : attr.class.getDeclaredFields()) { try { f.set(null, realRClass.getDeclaredField(f.getName()).get(null)); } catch (IllegalArgumentException e) { Log.e("Forge", e.toString()); } catch (IllegalAccessException e) { Log.e("Forge", e.toString()); } catch (NoSuchFieldException e) { Log.e("Forge", e.toString()); } } } catch (ClassNotFoundException e) { Log.e("Forge", e.toString()); } } } public static class drawable { public static int camera_capture=0x7f020000; static { try { Class<?> realRClass = Class.forName("io.trigger.forge.android.inspector.R$drawable"); for (Field f : drawable.class.getDeclaredFields()) { try { f.set(null, realRClass.getDeclaredField(f.getName()).get(null)); } catch (IllegalArgumentException e) { Log.e("Forge", e.toString()); } catch (IllegalAccessException e) { Log.e("Forge", e.toString()); } catch (NoSuchFieldException e) { Log.e("Forge", e.toString()); } } } catch (ClassNotFoundException e) { Log.e("Forge", e.toString()); } } } }
2,008
0.518426
0.514442
54
36.185184
26.477156
101
false
false
0
0
0
0
0
0
1.055556
false
false
1
7085ca255c5f1cb7df6d231d8f9dac6262ec9541
38,689,065,416,437
667b269af1862a2d8e8d29a9246f32c832cfee02
/src/main/java/com/hyc/lark/service/search/SearchMailService.java
01468616a7b2927455bcc5ed70bec4d2e4e3b0bf
[]
no_license
dark-slayers/Lark
https://github.com/dark-slayers/Lark
347ca1e93385f92d0ef614d7488f529c1b0ef215
3c6b78716d3fc6fd259544dd75d2c71c961f4f46
refs/heads/master
2016-09-20T22:58:39.810000
2016-09-09T10:15:16
2016-09-09T10:15:16
67,099,322
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.hyc.lark.service.search; import java.util.List; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import com.hyc.lark.dao.MailInfoDao; import com.hyc.lark.dao.MailSendRuleDao; import com.hyc.lark.json.LarkResponse; import com.hyc.lark.vo.MailInfo; import com.hyc.lark.vo.MailSendRule; /** * @author liuxx * */ public class SearchMailService { private static Logger log = LogManager.getLogger(); public static String exec(String body) throws JSONException { String result = "查询失败!"; JSONObject param = new JSONObject(body); String target = param.getString("target"); log.info("查询目标为:" + target); switch (target) { case "mailList": return getMailList(); case "ruleList": return getRuleList(); default: log.info("没有为目标" + target + "定义搜索方法!"); break; } return result; } /** * 获得邮件发送规则列表,发送规则列表包含:规则列表(默认规则和项目规则)、全部的收件人邮件列表 * * @author liuxx * @param * @return */ private static String getRuleList() { JSONArray array = new JSONArray(); log.info("查询全部的规则列表..."); List<MailSendRule> ruleList = MailSendRuleDao.getRuleList(); log.info("规则列表查询完毕,规则总数为:" + ruleList.size()); for (MailSendRule r : ruleList) { array.put(r.getJSONObject()); } JSONObject body = new JSONObject(); body.put("target", "ruleList"); body.put("ruleList", array); body.put("mailList", getMailListArray()); return LarkResponse.createStringResponse("", body.toString()); } /** * 获取全部收件人邮件列表 * * @author liuxx * @param * @return */ private static String getMailList() { JSONObject body = new JSONObject(); body.put("target", "mailList"); body.put("list", getMailListArray()); return LarkResponse.createStringResponse("", body.toString()); } /** * 获得全部收件人列表(JSONArray格式) * * @author liuxx * @param * @return */ private static JSONArray getMailListArray() { log.info("查询全部收件人列表..."); List<MailInfo> list = MailInfoDao.getMailList(); log.info("获得的收件人列表长度为:" + list.size()); JSONArray array = new JSONArray(); for (MailInfo m : list) { JSONObject obj = m.getJSON(); array.put(obj); } log.debug("收件人列表:" + array.toString()); return array; } }
UTF-8
Java
2,577
java
SearchMailService.java
Java
[ { "context": "port com.hyc.lark.vo.MailSendRule;\n\n/**\n * @author liuxx\n *\n */\npublic class SearchMailService\n{\n\tprivate ", "end": 441, "score": 0.9996833801269531, "start": 436, "tag": "USERNAME", "value": "liuxx" }, { "context": "规则列表包含:规则列表(默认规则和项目规则)、全部的收件人邮件列表\n\t * \n\t * @author liuxx\n\t * @param\n\t * @return\n\t */\n\tprivate static Strin", "end": 1023, "score": 0.9996249079704285, "start": 1018, "tag": "USERNAME", "value": "liuxx" }, { "context": "ring());\n\t}\n\n\t/**\n\t * 获取全部收件人邮件列表\n\t * \n\t * @author liuxx\n\t * @param\n\t * @return\n\t */\n\tprivate static Strin", "end": 1603, "score": 0.999593198299408, "start": 1598, "tag": "USERNAME", "value": "liuxx" }, { "context": "\n\n\t/**\n\t * 获得全部收件人列表(JSONArray格式)\n\t * \n\t * @author liuxx\n\t * @param\n\t * @return\n\t */\n\tprivate static JSONA", "end": 1907, "score": 0.9996263980865479, "start": 1902, "tag": "USERNAME", "value": "liuxx" } ]
null
[]
package com.hyc.lark.service.search; import java.util.List; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import com.hyc.lark.dao.MailInfoDao; import com.hyc.lark.dao.MailSendRuleDao; import com.hyc.lark.json.LarkResponse; import com.hyc.lark.vo.MailInfo; import com.hyc.lark.vo.MailSendRule; /** * @author liuxx * */ public class SearchMailService { private static Logger log = LogManager.getLogger(); public static String exec(String body) throws JSONException { String result = "查询失败!"; JSONObject param = new JSONObject(body); String target = param.getString("target"); log.info("查询目标为:" + target); switch (target) { case "mailList": return getMailList(); case "ruleList": return getRuleList(); default: log.info("没有为目标" + target + "定义搜索方法!"); break; } return result; } /** * 获得邮件发送规则列表,发送规则列表包含:规则列表(默认规则和项目规则)、全部的收件人邮件列表 * * @author liuxx * @param * @return */ private static String getRuleList() { JSONArray array = new JSONArray(); log.info("查询全部的规则列表..."); List<MailSendRule> ruleList = MailSendRuleDao.getRuleList(); log.info("规则列表查询完毕,规则总数为:" + ruleList.size()); for (MailSendRule r : ruleList) { array.put(r.getJSONObject()); } JSONObject body = new JSONObject(); body.put("target", "ruleList"); body.put("ruleList", array); body.put("mailList", getMailListArray()); return LarkResponse.createStringResponse("", body.toString()); } /** * 获取全部收件人邮件列表 * * @author liuxx * @param * @return */ private static String getMailList() { JSONObject body = new JSONObject(); body.put("target", "mailList"); body.put("list", getMailListArray()); return LarkResponse.createStringResponse("", body.toString()); } /** * 获得全部收件人列表(JSONArray格式) * * @author liuxx * @param * @return */ private static JSONArray getMailListArray() { log.info("查询全部收件人列表..."); List<MailInfo> list = MailInfoDao.getMailList(); log.info("获得的收件人列表长度为:" + list.size()); JSONArray array = new JSONArray(); for (MailInfo m : list) { JSONObject obj = m.getJSON(); array.put(obj); } log.debug("收件人列表:" + array.toString()); return array; } }
2,577
0.680489
0.679616
104
21.028847
17.708351
64
false
false
0
0
0
0
0
0
1.711538
false
false
1
6d1562aedd937138797aa17f1d24027455c741ad
20,349,555,098,083
08ff28ccdcd96548719f344ab82fcdcd1ac6a378
/backend/src/test/java/de/adesso/kicker/user/persistence/StatisticDummy.java
cbce26f9ad322835672488785234723ed2349ed4
[ "MIT" ]
permissive
ccaylak/AdessoKicker
https://github.com/ccaylak/AdessoKicker
21778606910ee71484996d173dec45a676c519af
56dce868a7fdd06192b53771a20053f6fcbe8281
refs/heads/master
2020-03-30T19:12:57.600000
2020-03-11T12:49:14
2020-03-11T12:49:14
151,533,626
1
0
MIT
false
2020-07-12T15:20:17
2018-10-04T07:21:13
2020-07-12T15:19:59
2020-07-12T15:20:16
2,721
0
0
14
Java
false
false
package de.adesso.kicker.user.persistence; public class StatisticDummy { public static Statistic statistic() { return new Statistic(); } public static Statistic statisticHighRating() { var statistics = new Statistic(); statistics.setRating(1250); return statistics; } public static Statistic statisticVeryHighRating() { var statistics = new Statistic(); statistics.setRating(1500); return statistics; } }
UTF-8
Java
488
java
StatisticDummy.java
Java
[]
null
[]
package de.adesso.kicker.user.persistence; public class StatisticDummy { public static Statistic statistic() { return new Statistic(); } public static Statistic statisticHighRating() { var statistics = new Statistic(); statistics.setRating(1250); return statistics; } public static Statistic statisticVeryHighRating() { var statistics = new Statistic(); statistics.setRating(1500); return statistics; } }
488
0.657787
0.641393
19
24.68421
18.547386
55
false
false
0
0
0
0
0
0
0.421053
false
false
1
eae3c117f5a6568e95bcc321546384040170c82c
33,062,658,279,398
c8cf34588ac061b5a9313c0b976be9d6412c8a0e
/runelite-client/src/main/java/net/runelite/client/ui/overlay/worldmap/WorldMapOverlayMouseListener.java
ebca05deb9239a39481dcf2d745ca5e4e35805a0
[ "BSD-2-Clause" ]
permissive
boundl/runelite
https://github.com/boundl/runelite
eb296c66dcfbbb4f9b42eaf25a97bf7721a6959b
2d525e7c93e9658790be586b61867296661df4d1
refs/heads/master
2020-04-18T09:21:39.006000
2019-03-30T14:06:52
2019-03-30T14:06:52
167,431,476
13
6
BSD-2-Clause
false
2019-02-10T19:56:06
2019-01-24T20:19:41
2019-02-09T13:21:10
2019-02-10T19:56:05
24,567
0
1
0
Java
false
null
/* * Copyright (c) 2018, Morgan Lewis <https://github.com/MESLewis> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package net.runelite.client.ui.overlay.worldmap; import java.awt.Rectangle; import java.awt.event.MouseEvent; import java.util.List; import javax.inject.Inject; import javax.inject.Singleton; import javax.swing.SwingUtilities; import net.runelite.api.Client; import net.runelite.api.Point; import net.runelite.api.RenderOverview; import net.runelite.api.coords.WorldPoint; import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.WidgetInfo; import net.runelite.client.input.MouseAdapter; @Singleton public class WorldMapOverlayMouseListener extends MouseAdapter { private final Client client; private final WorldMapPointManager worldMapPointManager; private WorldMapPoint tooltipPoint = null; @Inject private WorldMapOverlayMouseListener(Client client, WorldMapPointManager worldMapPointManager) { this.client = client; this.worldMapPointManager = worldMapPointManager; } @Override public MouseEvent mousePressed(MouseEvent e) { final List<WorldMapPoint> worldMapPoints = worldMapPointManager.getWorldMapPoints(); if (SwingUtilities.isLeftMouseButton(e) && !worldMapPoints.isEmpty()) { Point mousePos = client.getMouseCanvasPosition(); for (WorldMapPoint worldMapPoint : worldMapPoints) { Rectangle clickbox = worldMapPoint.getClickbox(); if (clickbox != null && clickbox.contains(mousePos.getX(), mousePos.getY())) { if (worldMapPoint.isJumpOnClick()) { // jump map to position of point WorldPoint target = worldMapPoint.getWorldPoint(); RenderOverview renderOverview = client.getRenderOverview(); renderOverview.setWorldMapPositionTarget(target); } return worldMapPoint.onClick(e); } } } return e; } @Override public MouseEvent mouseMoved(MouseEvent mouseEvent) { final List<WorldMapPoint> worldMapPoints = worldMapPointManager.getWorldMapPoints(); if (worldMapPoints.isEmpty()) { return mouseEvent; } final Point mousePos = client.getMouseCanvasPosition(); final Widget view = client.getWidget(WidgetInfo.WORLD_MAP_VIEW); if (view == null) { return mouseEvent; } final Rectangle worldMapDisplay = view.getBounds(); if (worldMapDisplay == null || !worldMapDisplay.contains(mousePos.getX(), mousePos.getY())) { if (tooltipPoint != null) { tooltipPoint.setTooltipVisible(false); tooltipPoint = null; final Widget rsTooltip = client.getWidget(WidgetInfo.WORLD_MAP_TOOLTIP); if (rsTooltip != null) { rsTooltip.setHidden(false); } } return mouseEvent; } if (tooltipPoint != null) { if (tooltipPoint.getClickbox() != null && tooltipPoint.getClickbox().contains(mousePos.getX(), mousePos.getY())) { return mouseEvent; } else { tooltipPoint.setTooltipVisible(false); tooltipPoint = null; final Widget rsTooltip = client.getWidget(WidgetInfo.WORLD_MAP_TOOLTIP); if (rsTooltip != null) { rsTooltip.setHidden(false); } } } for (WorldMapPoint worldMapPoint : worldMapPointManager.getWorldMapPoints()) { if (worldMapPoint.getClickbox() != null && worldMapPoint.getClickbox().contains(mousePos.getX(), mousePos.getY()) && worldMapPoint.getTooltip() != null) { worldMapPoint.setTooltipVisible(true); tooltipPoint = worldMapPoint; final Widget rsTooltip = client.getWidget(WidgetInfo.WORLD_MAP_TOOLTIP); if (rsTooltip != null) { rsTooltip.setHidden(true); } return mouseEvent; } } return mouseEvent; } }
UTF-8
Java
4,911
java
WorldMapOverlayMouseListener.java
Java
[ { "context": "/*\n * Copyright (c) 2018, Morgan Lewis <https://github.com/MESLewis>\n * All rights reser", "end": 38, "score": 0.9998716115951538, "start": 26, "tag": "NAME", "value": "Morgan Lewis" }, { "context": "yright (c) 2018, Morgan Lewis <https://github.com/MESLewis>\n * All rights reserved.\n *\n * Redistribution and", "end": 67, "score": 0.9956789612770081, "start": 59, "tag": "USERNAME", "value": "MESLewis" } ]
null
[]
/* * Copyright (c) 2018, <NAME> <https://github.com/MESLewis> * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package net.runelite.client.ui.overlay.worldmap; import java.awt.Rectangle; import java.awt.event.MouseEvent; import java.util.List; import javax.inject.Inject; import javax.inject.Singleton; import javax.swing.SwingUtilities; import net.runelite.api.Client; import net.runelite.api.Point; import net.runelite.api.RenderOverview; import net.runelite.api.coords.WorldPoint; import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.WidgetInfo; import net.runelite.client.input.MouseAdapter; @Singleton public class WorldMapOverlayMouseListener extends MouseAdapter { private final Client client; private final WorldMapPointManager worldMapPointManager; private WorldMapPoint tooltipPoint = null; @Inject private WorldMapOverlayMouseListener(Client client, WorldMapPointManager worldMapPointManager) { this.client = client; this.worldMapPointManager = worldMapPointManager; } @Override public MouseEvent mousePressed(MouseEvent e) { final List<WorldMapPoint> worldMapPoints = worldMapPointManager.getWorldMapPoints(); if (SwingUtilities.isLeftMouseButton(e) && !worldMapPoints.isEmpty()) { Point mousePos = client.getMouseCanvasPosition(); for (WorldMapPoint worldMapPoint : worldMapPoints) { Rectangle clickbox = worldMapPoint.getClickbox(); if (clickbox != null && clickbox.contains(mousePos.getX(), mousePos.getY())) { if (worldMapPoint.isJumpOnClick()) { // jump map to position of point WorldPoint target = worldMapPoint.getWorldPoint(); RenderOverview renderOverview = client.getRenderOverview(); renderOverview.setWorldMapPositionTarget(target); } return worldMapPoint.onClick(e); } } } return e; } @Override public MouseEvent mouseMoved(MouseEvent mouseEvent) { final List<WorldMapPoint> worldMapPoints = worldMapPointManager.getWorldMapPoints(); if (worldMapPoints.isEmpty()) { return mouseEvent; } final Point mousePos = client.getMouseCanvasPosition(); final Widget view = client.getWidget(WidgetInfo.WORLD_MAP_VIEW); if (view == null) { return mouseEvent; } final Rectangle worldMapDisplay = view.getBounds(); if (worldMapDisplay == null || !worldMapDisplay.contains(mousePos.getX(), mousePos.getY())) { if (tooltipPoint != null) { tooltipPoint.setTooltipVisible(false); tooltipPoint = null; final Widget rsTooltip = client.getWidget(WidgetInfo.WORLD_MAP_TOOLTIP); if (rsTooltip != null) { rsTooltip.setHidden(false); } } return mouseEvent; } if (tooltipPoint != null) { if (tooltipPoint.getClickbox() != null && tooltipPoint.getClickbox().contains(mousePos.getX(), mousePos.getY())) { return mouseEvent; } else { tooltipPoint.setTooltipVisible(false); tooltipPoint = null; final Widget rsTooltip = client.getWidget(WidgetInfo.WORLD_MAP_TOOLTIP); if (rsTooltip != null) { rsTooltip.setHidden(false); } } } for (WorldMapPoint worldMapPoint : worldMapPointManager.getWorldMapPoints()) { if (worldMapPoint.getClickbox() != null && worldMapPoint.getClickbox().contains(mousePos.getX(), mousePos.getY()) && worldMapPoint.getTooltip() != null) { worldMapPoint.setTooltipVisible(true); tooltipPoint = worldMapPoint; final Widget rsTooltip = client.getWidget(WidgetInfo.WORLD_MAP_TOOLTIP); if (rsTooltip != null) { rsTooltip.setHidden(true); } return mouseEvent; } } return mouseEvent; } }
4,905
0.737732
0.73651
155
30.68387
28.76619
95
false
false
0
0
0
0
0
0
2.4
false
false
1
5f775568ef5e4dd1cacef1bc16dbb9847e72578b
6,253,472,426,914
5f6acebc50e7b1ff6753a8489f2c387be06a707d
/WORKSPACE/javaTutorial/src/javaTutorial/centralTraffic.java
a4b7884f4d805d469a066ec31ee552ea1ac60b3c
[]
no_license
VijayShankarDubey/OldBackup
https://github.com/VijayShankarDubey/OldBackup
65dc68ba79aaf040d7912ad45c0afe3071a08568
c6466ad337c4c6c5aab9643d3c0d6aca106003b8
refs/heads/main
2023-07-22T18:15:36.552000
2021-08-27T07:19:45
2021-08-27T07:19:45
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package javaTutorial; public interface centralTraffic { public void goGree(); public void redStop(); public void waitYellow(); }
UTF-8
Java
136
java
centralTraffic.java
Java
[]
null
[]
package javaTutorial; public interface centralTraffic { public void goGree(); public void redStop(); public void waitYellow(); }
136
0.742647
0.742647
9
14.111111
12.600216
33
false
false
0
0
0
0
0
0
0.888889
false
false
1
c2f60f9baf3ca22d747011e55d766f2f2111b203
36,051,955,510,276
b06acf556b750ac1fa5b28523db7188c05ead122
/IfcXML/src/org/tech/iai/ifc/xml/ifc/_2x3/final_/impl/IfcRelVoidsElementImpl.java
1912cc27b8a835a4ce5cc27f130a12b134f1405b
[]
no_license
christianharrington/MDD
https://github.com/christianharrington/MDD
3500afbe5e1b1d1a6f680254095bb8d5f63678ba
64beecdaed65ac22b0047276c616c269913afd7f
refs/heads/master
2021-01-10T21:42:53.686000
2012-12-17T03:27:05
2012-12-17T03:27:05
6,157,471
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** */ package org.tech.iai.ifc.xml.ifc._2x3.final_.impl; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.tech.iai.ifc.xml.ifc._2x3.final_.FinalPackage; import org.tech.iai.ifc.xml.ifc._2x3.final_.IfcElement; import org.tech.iai.ifc.xml.ifc._2x3.final_.IfcRelVoidsElement; import org.tech.iai.ifc.xml.ifc._2x3.final_.RelatedOpeningElementType; import org.tech.iai.ifc.xml.ifc._2x3.final_.RelatingBuildingElementType; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Ifc Rel Voids Element</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.tech.iai.ifc.xml.ifc._2x3.final_.impl.IfcRelVoidsElementImpl#getRelatingBuildingElement <em>Relating Building Element</em>}</li> * <li>{@link org.tech.iai.ifc.xml.ifc._2x3.final_.impl.IfcRelVoidsElementImpl#getRelatedOpeningElement <em>Related Opening Element</em>}</li> * </ul> * </p> * * @generated */ public class IfcRelVoidsElementImpl extends IfcRelConnectsImpl implements IfcRelVoidsElement { /** * The cached value of the '{@link #getRelatingBuildingElement() <em>Relating Building Element</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getRelatingBuildingElement() * @generated * @ordered */ protected RelatingBuildingElementType relatingBuildingElement; /** * The cached value of the '{@link #getRelatedOpeningElement() <em>Related Opening Element</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getRelatedOpeningElement() * @generated * @ordered */ protected RelatedOpeningElementType relatedOpeningElement; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected IfcRelVoidsElementImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return FinalPackage.eINSTANCE.getIfcRelVoidsElement(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public RelatingBuildingElementType getRelatingBuildingElement() { return relatingBuildingElement; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetRelatingBuildingElement(RelatingBuildingElementType newRelatingBuildingElement, NotificationChain msgs) { RelatingBuildingElementType oldRelatingBuildingElement = relatingBuildingElement; relatingBuildingElement = newRelatingBuildingElement; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FinalPackage.IFC_REL_VOIDS_ELEMENT__RELATING_BUILDING_ELEMENT, oldRelatingBuildingElement, newRelatingBuildingElement); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setRelatingBuildingElement(RelatingBuildingElementType newRelatingBuildingElement) { if (newRelatingBuildingElement != relatingBuildingElement) { NotificationChain msgs = null; if (relatingBuildingElement != null) msgs = ((InternalEObject)relatingBuildingElement).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FinalPackage.IFC_REL_VOIDS_ELEMENT__RELATING_BUILDING_ELEMENT, null, msgs); if (newRelatingBuildingElement != null) msgs = ((InternalEObject)newRelatingBuildingElement).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FinalPackage.IFC_REL_VOIDS_ELEMENT__RELATING_BUILDING_ELEMENT, null, msgs); msgs = basicSetRelatingBuildingElement(newRelatingBuildingElement, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, FinalPackage.IFC_REL_VOIDS_ELEMENT__RELATING_BUILDING_ELEMENT, newRelatingBuildingElement, newRelatingBuildingElement)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public RelatedOpeningElementType getRelatedOpeningElement() { return relatedOpeningElement; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetRelatedOpeningElement(RelatedOpeningElementType newRelatedOpeningElement, NotificationChain msgs) { RelatedOpeningElementType oldRelatedOpeningElement = relatedOpeningElement; relatedOpeningElement = newRelatedOpeningElement; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FinalPackage.IFC_REL_VOIDS_ELEMENT__RELATED_OPENING_ELEMENT, oldRelatedOpeningElement, newRelatedOpeningElement); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setRelatedOpeningElement(RelatedOpeningElementType newRelatedOpeningElement) { if (newRelatedOpeningElement != relatedOpeningElement) { NotificationChain msgs = null; if (relatedOpeningElement != null) msgs = ((InternalEObject)relatedOpeningElement).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FinalPackage.IFC_REL_VOIDS_ELEMENT__RELATED_OPENING_ELEMENT, null, msgs); if (newRelatedOpeningElement != null) msgs = ((InternalEObject)newRelatedOpeningElement).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FinalPackage.IFC_REL_VOIDS_ELEMENT__RELATED_OPENING_ELEMENT, null, msgs); msgs = basicSetRelatedOpeningElement(newRelatedOpeningElement, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, FinalPackage.IFC_REL_VOIDS_ELEMENT__RELATED_OPENING_ELEMENT, newRelatedOpeningElement, newRelatedOpeningElement)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case FinalPackage.IFC_REL_VOIDS_ELEMENT__RELATING_BUILDING_ELEMENT: return basicSetRelatingBuildingElement(null, msgs); case FinalPackage.IFC_REL_VOIDS_ELEMENT__RELATED_OPENING_ELEMENT: return basicSetRelatedOpeningElement(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case FinalPackage.IFC_REL_VOIDS_ELEMENT__RELATING_BUILDING_ELEMENT: return getRelatingBuildingElement(); case FinalPackage.IFC_REL_VOIDS_ELEMENT__RELATED_OPENING_ELEMENT: return getRelatedOpeningElement(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case FinalPackage.IFC_REL_VOIDS_ELEMENT__RELATING_BUILDING_ELEMENT: setRelatingBuildingElement((RelatingBuildingElementType)newValue); return; case FinalPackage.IFC_REL_VOIDS_ELEMENT__RELATED_OPENING_ELEMENT: setRelatedOpeningElement((RelatedOpeningElementType)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case FinalPackage.IFC_REL_VOIDS_ELEMENT__RELATING_BUILDING_ELEMENT: setRelatingBuildingElement((RelatingBuildingElementType)null); return; case FinalPackage.IFC_REL_VOIDS_ELEMENT__RELATED_OPENING_ELEMENT: setRelatedOpeningElement((RelatedOpeningElementType)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case FinalPackage.IFC_REL_VOIDS_ELEMENT__RELATING_BUILDING_ELEMENT: return relatingBuildingElement != null; case FinalPackage.IFC_REL_VOIDS_ELEMENT__RELATED_OPENING_ELEMENT: return relatedOpeningElement != null; } return super.eIsSet(featureID); } } //IfcRelVoidsElementImpl
UTF-8
Java
8,418
java
IfcRelVoidsElementImpl.java
Java
[]
null
[]
/** */ package org.tech.iai.ifc.xml.ifc._2x3.final_.impl; import org.eclipse.emf.common.notify.Notification; import org.eclipse.emf.common.notify.NotificationChain; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.InternalEObject; import org.eclipse.emf.ecore.impl.ENotificationImpl; import org.tech.iai.ifc.xml.ifc._2x3.final_.FinalPackage; import org.tech.iai.ifc.xml.ifc._2x3.final_.IfcElement; import org.tech.iai.ifc.xml.ifc._2x3.final_.IfcRelVoidsElement; import org.tech.iai.ifc.xml.ifc._2x3.final_.RelatedOpeningElementType; import org.tech.iai.ifc.xml.ifc._2x3.final_.RelatingBuildingElementType; /** * <!-- begin-user-doc --> * An implementation of the model object '<em><b>Ifc Rel Voids Element</b></em>'. * <!-- end-user-doc --> * <p> * The following features are implemented: * <ul> * <li>{@link org.tech.iai.ifc.xml.ifc._2x3.final_.impl.IfcRelVoidsElementImpl#getRelatingBuildingElement <em>Relating Building Element</em>}</li> * <li>{@link org.tech.iai.ifc.xml.ifc._2x3.final_.impl.IfcRelVoidsElementImpl#getRelatedOpeningElement <em>Related Opening Element</em>}</li> * </ul> * </p> * * @generated */ public class IfcRelVoidsElementImpl extends IfcRelConnectsImpl implements IfcRelVoidsElement { /** * The cached value of the '{@link #getRelatingBuildingElement() <em>Relating Building Element</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getRelatingBuildingElement() * @generated * @ordered */ protected RelatingBuildingElementType relatingBuildingElement; /** * The cached value of the '{@link #getRelatedOpeningElement() <em>Related Opening Element</em>}' containment reference. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @see #getRelatedOpeningElement() * @generated * @ordered */ protected RelatedOpeningElementType relatedOpeningElement; /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ protected IfcRelVoidsElementImpl() { super(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override protected EClass eStaticClass() { return FinalPackage.eINSTANCE.getIfcRelVoidsElement(); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public RelatingBuildingElementType getRelatingBuildingElement() { return relatingBuildingElement; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetRelatingBuildingElement(RelatingBuildingElementType newRelatingBuildingElement, NotificationChain msgs) { RelatingBuildingElementType oldRelatingBuildingElement = relatingBuildingElement; relatingBuildingElement = newRelatingBuildingElement; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FinalPackage.IFC_REL_VOIDS_ELEMENT__RELATING_BUILDING_ELEMENT, oldRelatingBuildingElement, newRelatingBuildingElement); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setRelatingBuildingElement(RelatingBuildingElementType newRelatingBuildingElement) { if (newRelatingBuildingElement != relatingBuildingElement) { NotificationChain msgs = null; if (relatingBuildingElement != null) msgs = ((InternalEObject)relatingBuildingElement).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FinalPackage.IFC_REL_VOIDS_ELEMENT__RELATING_BUILDING_ELEMENT, null, msgs); if (newRelatingBuildingElement != null) msgs = ((InternalEObject)newRelatingBuildingElement).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FinalPackage.IFC_REL_VOIDS_ELEMENT__RELATING_BUILDING_ELEMENT, null, msgs); msgs = basicSetRelatingBuildingElement(newRelatingBuildingElement, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, FinalPackage.IFC_REL_VOIDS_ELEMENT__RELATING_BUILDING_ELEMENT, newRelatingBuildingElement, newRelatingBuildingElement)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public RelatedOpeningElementType getRelatedOpeningElement() { return relatedOpeningElement; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public NotificationChain basicSetRelatedOpeningElement(RelatedOpeningElementType newRelatedOpeningElement, NotificationChain msgs) { RelatedOpeningElementType oldRelatedOpeningElement = relatedOpeningElement; relatedOpeningElement = newRelatedOpeningElement; if (eNotificationRequired()) { ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, FinalPackage.IFC_REL_VOIDS_ELEMENT__RELATED_OPENING_ELEMENT, oldRelatedOpeningElement, newRelatedOpeningElement); if (msgs == null) msgs = notification; else msgs.add(notification); } return msgs; } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public void setRelatedOpeningElement(RelatedOpeningElementType newRelatedOpeningElement) { if (newRelatedOpeningElement != relatedOpeningElement) { NotificationChain msgs = null; if (relatedOpeningElement != null) msgs = ((InternalEObject)relatedOpeningElement).eInverseRemove(this, EOPPOSITE_FEATURE_BASE - FinalPackage.IFC_REL_VOIDS_ELEMENT__RELATED_OPENING_ELEMENT, null, msgs); if (newRelatedOpeningElement != null) msgs = ((InternalEObject)newRelatedOpeningElement).eInverseAdd(this, EOPPOSITE_FEATURE_BASE - FinalPackage.IFC_REL_VOIDS_ELEMENT__RELATED_OPENING_ELEMENT, null, msgs); msgs = basicSetRelatedOpeningElement(newRelatedOpeningElement, msgs); if (msgs != null) msgs.dispatch(); } else if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.SET, FinalPackage.IFC_REL_VOIDS_ELEMENT__RELATED_OPENING_ELEMENT, newRelatedOpeningElement, newRelatedOpeningElement)); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) { switch (featureID) { case FinalPackage.IFC_REL_VOIDS_ELEMENT__RELATING_BUILDING_ELEMENT: return basicSetRelatingBuildingElement(null, msgs); case FinalPackage.IFC_REL_VOIDS_ELEMENT__RELATED_OPENING_ELEMENT: return basicSetRelatedOpeningElement(null, msgs); } return super.eInverseRemove(otherEnd, featureID, msgs); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { case FinalPackage.IFC_REL_VOIDS_ELEMENT__RELATING_BUILDING_ELEMENT: return getRelatingBuildingElement(); case FinalPackage.IFC_REL_VOIDS_ELEMENT__RELATED_OPENING_ELEMENT: return getRelatedOpeningElement(); } return super.eGet(featureID, resolve, coreType); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eSet(int featureID, Object newValue) { switch (featureID) { case FinalPackage.IFC_REL_VOIDS_ELEMENT__RELATING_BUILDING_ELEMENT: setRelatingBuildingElement((RelatingBuildingElementType)newValue); return; case FinalPackage.IFC_REL_VOIDS_ELEMENT__RELATED_OPENING_ELEMENT: setRelatedOpeningElement((RelatedOpeningElementType)newValue); return; } super.eSet(featureID, newValue); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public void eUnset(int featureID) { switch (featureID) { case FinalPackage.IFC_REL_VOIDS_ELEMENT__RELATING_BUILDING_ELEMENT: setRelatingBuildingElement((RelatingBuildingElementType)null); return; case FinalPackage.IFC_REL_VOIDS_ELEMENT__RELATED_OPENING_ELEMENT: setRelatedOpeningElement((RelatedOpeningElementType)null); return; } super.eUnset(featureID); } /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public boolean eIsSet(int featureID) { switch (featureID) { case FinalPackage.IFC_REL_VOIDS_ELEMENT__RELATING_BUILDING_ELEMENT: return relatingBuildingElement != null; case FinalPackage.IFC_REL_VOIDS_ELEMENT__RELATED_OPENING_ELEMENT: return relatedOpeningElement != null; } return super.eIsSet(featureID); } } //IfcRelVoidsElementImpl
8,418
0.729389
0.727489
243
33.641975
40.039787
201
false
false
0
0
0
0
0
0
1.806584
false
false
1
d7c9b6fd725a8dfa1c6042039fc439c41d8277bb
8,246,337,231,308
f67bf9dea959385876a054c39ab73d091b7c9f27
/data/key/insecure/Snippet35661789_17555.java
dfd1485492995895f16982f5233a1435b8840f8f
[]
no_license
fischerfel/TUM-Crypto
https://github.com/fischerfel/TUM-Crypto
157bdfb6930b9adfeb169e3c1d2f092862c33976
b6ced39b1f99fa3aa199314a948d937c779f1850
refs/heads/master
2023-08-31T07:04:56.056000
2023-08-20T11:38:04
2023-08-20T11:38:04
202,442,442
13
4
null
false
2020-08-19T15:14:54
2019-08-14T23:52:56
2020-02-22T11:46:00
2020-08-19T15:14:53
7,082
9
4
1
Java
false
false
if(dflag == 1) { //AES-128 bit key initialization. System.out.println("File completely received"); byte[] keyvalue = "AES128PeerBuLLet".getBytes(); Key key = new SecretKeySpec(keyvalue, "AES"); //Initialization Vector initialized IvParameterSpec ivParameterSpec = null; //Cipher Initialization. Cipher decCipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); try { decCipher.init(Cipher.DECRYPT_MODE, key, new IvParameterSpec(iv)); } catch (InvalidAlgorithmParameterException ex) { Logger.getLogger(PeersController.class.getName()).log(Level.SEVERE, null, ex); } System.out.println(decCipher.getProvider().getInfo()); //Decryption Mechanism. try (FileOutputStream stream = new FileOutputStream(decrypted)) { try (FileInputStream fis = new FileInputStream(encrypted)) { try (CipherInputStream cis = new CipherInputStream(fis, decCipher)) { int read, i = 0; byte[] buffer = new byte[(1024 * 1024) + 16]; while ((read = cis.read(buffer)) != -1) { stream.write(buffer, 0, read); i = i + read; double d = (double) i / len; double progress = new BigDecimal(d).setScale(3, BigDecimal.ROUND_HALF_UP).doubleValue(); Platform.runLater(() -> { pBar.setProgress(progress); progressText.setText("Decrypting.."); }); } } catch (Exception e) { System.out.println(e.getMessage()); } } } catch (Exception e) { System.out.println(e.getMessage()); } }
UTF-8
Java
2,071
java
Snippet35661789_17555.java
Java
[ { "context": "le completely received\");\n byte[] keyvalue = \"AES128PeerBuLLet\".getBytes();\n Key key = new SecretKeySpec(key", "end": 149, "score": 0.999177098274231, "start": 133, "tag": "KEY", "value": "AES128PeerBuLLet" }, { "context": "es();\n Key key = new SecretKeySpec(keyvalue, \"AES\");\n\n //Initialization Vector initialized\n ", "end": 210, "score": 0.9527835845947266, "start": 207, "tag": "KEY", "value": "AES" } ]
null
[]
if(dflag == 1) { //AES-128 bit key initialization. System.out.println("File completely received"); byte[] keyvalue = "AES128PeerBuLLet".getBytes(); Key key = new SecretKeySpec(keyvalue, "AES"); //Initialization Vector initialized IvParameterSpec ivParameterSpec = null; //Cipher Initialization. Cipher decCipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); try { decCipher.init(Cipher.DECRYPT_MODE, key, new IvParameterSpec(iv)); } catch (InvalidAlgorithmParameterException ex) { Logger.getLogger(PeersController.class.getName()).log(Level.SEVERE, null, ex); } System.out.println(decCipher.getProvider().getInfo()); //Decryption Mechanism. try (FileOutputStream stream = new FileOutputStream(decrypted)) { try (FileInputStream fis = new FileInputStream(encrypted)) { try (CipherInputStream cis = new CipherInputStream(fis, decCipher)) { int read, i = 0; byte[] buffer = new byte[(1024 * 1024) + 16]; while ((read = cis.read(buffer)) != -1) { stream.write(buffer, 0, read); i = i + read; double d = (double) i / len; double progress = new BigDecimal(d).setScale(3, BigDecimal.ROUND_HALF_UP).doubleValue(); Platform.runLater(() -> { pBar.setProgress(progress); progressText.setText("Decrypting.."); }); } } catch (Exception e) { System.out.println(e.getMessage()); } } } catch (Exception e) { System.out.println(e.getMessage()); } }
2,071
0.472236
0.461613
42
48.309525
27.495876
124
false
false
0
0
0
0
0
0
0.690476
false
false
1
363e036ab9adb118a63e8f43ac0ca10b99c98ee2
8,246,337,228,445
b5ff40fc5dd6844ec2abb23932524eae2f244210
/src/PalabraCantidad.java
31d751fe2f7d441aa61fa5f22cab06335c1629c2
[]
no_license
hectorcotelo/TextMining
https://github.com/hectorcotelo/TextMining
bb228dc59a495e3099f064172c19023f7dfbddd6
5941e7880a5c037b1d100c6cdf07a173e49ee5aa
refs/heads/master
2021-01-10T10:40:09.991000
2016-01-03T00:35:53
2016-01-03T00:35:53
48,919,996
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class PalabraCantidad { private String palabra; private int cantidad; public PalabraCantidad(){ palabra = ""; cantidad = 0; } public PalabraCantidad(String palabra, int cantidad){ this.palabra = palabra; this.cantidad = cantidad; } public String getPalabra() { return palabra; } public void setPalabra(String palabra) { this.palabra = palabra; } public int getCantidad() { return cantidad; } public void setCantidad(int cantidad) { this.cantidad = cantidad; } }
UTF-8
Java
554
java
PalabraCantidad.java
Java
[]
null
[]
public class PalabraCantidad { private String palabra; private int cantidad; public PalabraCantidad(){ palabra = ""; cantidad = 0; } public PalabraCantidad(String palabra, int cantidad){ this.palabra = palabra; this.cantidad = cantidad; } public String getPalabra() { return palabra; } public void setPalabra(String palabra) { this.palabra = palabra; } public int getCantidad() { return cantidad; } public void setCantidad(int cantidad) { this.cantidad = cantidad; } }
554
0.642599
0.640794
34
14.235294
14.671018
54
false
false
0
0
0
0
0
0
1.470588
false
false
1
1580c03da325a251e543c333b04cf53816e24b6f
13,357,348,314,617
17b0878369add493ae9b05e02b49b960e1b72597
/src/com/calvin/combat/crash/CrashApplication.java
8d4e560480baca7700aaf818cb9f2124e0b84150
[]
no_license
Calvin-wang/Combat
https://github.com/Calvin-wang/Combat
a572574d071c317154899a9d945790307c1a600b
d47228a8909cbced2c176d8d426be28b503d66be
refs/heads/master
2020-02-29T16:53:31.212000
2015-01-04T08:32:13
2015-01-04T08:32:13
27,289,997
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.calvin.combat.crash; import com.calvin.combat.MainActivity; import android.app.Application; import android.content.Intent; import android.util.Log; public class CrashApplication extends Application { @Override public void onCreate() { // TODO Auto-generated method stub super.onCreate(); CrashHandler crashHandler = CrashHandler.getInstance(); crashHandler.init(getApplicationContext()); // Thread.setDefaultUncaughtExceptionHandler(new // Thread.UncaughtExceptionHandler() { // // @Override // public void uncaughtException(Thread thread, Throwable ex) { // Log.e("CrashApplication", // "---Uncaught Exception detected in thread {}" + thread.getName() + // ex.getMessage()); // for (StackTraceElement s : ex.getStackTrace()) { // Log.e("CrashApplication", "---"+s.toString()); // } // handleCaughtException(thread, ex); // } // }); } public void handleCaughtException(Thread thread, Throwable e) { // not all Android versions will print the stack trace automatically e.printStackTrace(); Intent intent = new Intent(this, MainActivity.class); // intent.setAction(SystemConst.LOG_SYSTEN_EXCEPTION); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);// required when starting // from Application startActivity(intent); System.out.println("--->><<"); // System.exit(1);//kill the crashed app } }
UTF-8
Java
1,377
java
CrashApplication.java
Java
[]
null
[]
package com.calvin.combat.crash; import com.calvin.combat.MainActivity; import android.app.Application; import android.content.Intent; import android.util.Log; public class CrashApplication extends Application { @Override public void onCreate() { // TODO Auto-generated method stub super.onCreate(); CrashHandler crashHandler = CrashHandler.getInstance(); crashHandler.init(getApplicationContext()); // Thread.setDefaultUncaughtExceptionHandler(new // Thread.UncaughtExceptionHandler() { // // @Override // public void uncaughtException(Thread thread, Throwable ex) { // Log.e("CrashApplication", // "---Uncaught Exception detected in thread {}" + thread.getName() + // ex.getMessage()); // for (StackTraceElement s : ex.getStackTrace()) { // Log.e("CrashApplication", "---"+s.toString()); // } // handleCaughtException(thread, ex); // } // }); } public void handleCaughtException(Thread thread, Throwable e) { // not all Android versions will print the stack trace automatically e.printStackTrace(); Intent intent = new Intent(this, MainActivity.class); // intent.setAction(SystemConst.LOG_SYSTEN_EXCEPTION); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);// required when starting // from Application startActivity(intent); System.out.println("--->><<"); // System.exit(1);//kill the crashed app } }
1,377
0.710966
0.71024
43
31.023256
22.300785
74
false
false
0
0
0
0
0
0
2.232558
false
false
1
b7f8bb6bf715a0a8138300410acf35d9deff5301
36,438,502,571,428
8a7050d0b110f2dbe99f6a238cdbf2d77d1e7e42
/src/main/java/hyt/designpattern/proxy/v07/Tank.java
b27003c423c40102c6b975d661614cb42a117817
[]
no_license
lovelydolphin/javastudy
https://github.com/lovelydolphin/javastudy
b8a02bdbc5288a6f47eb4d3042956ebe5718fd79
29ce01fac7260e5b4a563351f2ae8d0189c936f4
refs/heads/master
2023-04-13T10:23:51.865000
2021-04-21T09:02:48
2021-04-21T09:02:48
342,194,670
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package hyt.designpattern.proxy.v07; /** * @Author huyouting * @Date 2021/2/23 9:48 * @Description: */ import java.util.Random; /** * 问题:我想记录坦克的移动时间 * 最简单的办法:修改代码,记录时间 * 问题2:如果无法改变方法源码呢? benchmark * 用继承? * 使用代理 */ public class Tank implements Movable { /** * 模拟坦克移动了一段时间 */ @Override public void move() { System.out.println("tank moving claclacla..."); try { Thread.sleep(new Random().nextInt(10000)); } catch (InterruptedException e) { e.printStackTrace(); } } public static void main(String[] args) { new TankTimeProxy(new TankLogProxy(new Tank())).move(); } } class TankTimeProxy implements Movable { Movable m; public TankTimeProxy(Movable m) { this.m = m; } @Override public void move() { long start = System.currentTimeMillis(); m.move(); long end = System.currentTimeMillis(); System.out.println(end - start); } } class TankLogProxy implements Movable { Movable m; public TankLogProxy(Movable m) { this.m = m; } @Override public void move() { System.out.println("start moving..."); m.move(); System.out.println("stopped!"); } } interface Movable { void move(); }
UTF-8
Java
1,448
java
Tank.java
Java
[ { "context": "kage hyt.designpattern.proxy.v07;\n\n\n/**\n * @Author huyouting\n * @Date 2021/2/23 9:48\n * @Description:\n */\n\n\nim", "end": 63, "score": 0.999424934387207, "start": 54, "tag": "USERNAME", "value": "huyouting" } ]
null
[]
package hyt.designpattern.proxy.v07; /** * @Author huyouting * @Date 2021/2/23 9:48 * @Description: */ import java.util.Random; /** * 问题:我想记录坦克的移动时间 * 最简单的办法:修改代码,记录时间 * 问题2:如果无法改变方法源码呢? benchmark * 用继承? * 使用代理 */ public class Tank implements Movable { /** * 模拟坦克移动了一段时间 */ @Override public void move() { System.out.println("tank moving claclacla..."); try { Thread.sleep(new Random().nextInt(10000)); } catch (InterruptedException e) { e.printStackTrace(); } } public static void main(String[] args) { new TankTimeProxy(new TankLogProxy(new Tank())).move(); } } class TankTimeProxy implements Movable { Movable m; public TankTimeProxy(Movable m) { this.m = m; } @Override public void move() { long start = System.currentTimeMillis(); m.move(); long end = System.currentTimeMillis(); System.out.println(end - start); } } class TankLogProxy implements Movable { Movable m; public TankLogProxy(Movable m) { this.m = m; } @Override public void move() { System.out.println("start moving..."); m.move(); System.out.println("stopped!"); } } interface Movable { void move(); }
1,448
0.576515
0.562879
77
16.142857
16.712788
63
false
false
0
0
0
0
0
0
0.233766
false
false
1
859f3f8ac772cf514daeb7dd641a75477d6de703
19,756,849,587,566
48a9c51353bd5fdb3031431f6238a40ccb53ad72
/src/main/java/com/youlun/baseframework/core/LoginInfo.java
7d0883d3d589586ba6157306a675f4c8f423171d
[ "Apache-2.0" ]
permissive
qinsky/yl
https://github.com/qinsky/yl
bb387780a163fcc7378085a1e439dc040c0defa6
84bbfe6f0151c487d98d87a2806e6ea5937b7d3a
refs/heads/master
2018-11-26T08:15:00.697000
2018-09-05T14:28:01
2018-09-05T14:28:01
110,793,216
0
0
Apache-2.0
false
2018-03-26T02:37:47
2017-11-15T06:31:22
2018-03-26T02:25:05
2018-03-26T02:37:47
601
0
0
0
JavaScript
false
null
package com.youlun.baseframework.core; import org.json.JSONObject; import com.youlun.baseframework.dao.DBOperator; import com.youlun.baseframework.util.MD5; import com.youlun.baseframework.util.StringUtils; public class LoginInfo { private JSONObject loginInfo = new JSONObject(); public LoginInfo() { loginInfo.put("isLogined", false); } public boolean hasAttr(String attName) { return loginInfo.has(attName); } public boolean isLogined() { return loginInfo.getBoolean("isLogined"); } public boolean login(String code,String password) { if(loginInfo.getBoolean("isLogined")) { RunContext.getInstance().setExeInfo("000001", "The user has the login!"); return false; } if(StringUtils.isEmpty(code)||StringUtils.isEmpty(password)) { return false; } /**校验用户密码*/ JSONObject qpara = new JSONObject(); qpara.put("code", code); JSONObject user = DBOperator.queryByWhereForSingle("ul_bsf_user", qpara); if(user==null) { RunContext.getInstance().setExeInfo("000002", "用户不存在!"); return false; } if(user.has("locked") && "Y".equalsIgnoreCase(user.getString("locked"))) { RunContext.getInstance().setExeInfo("000003", "账户已被锁定,请联系管理员解锁!"); return false; } password = MD5.encrypt(password); if(!password.equals(user.get("password"))) { /**如果有error_num字段,则记录密码错误次数,默认超过三次锁定账户*/ if(user.has("error_num")) { int errNum =user.getInt("error_num"); errNum++; qpara.put("error_num", errNum); if(errNum>=3) { qpara.put("locked", "Y"); } qpara.remove("code"); qpara.put("id", user.get("id")); DBOperator.updateByPk("ul_bsf_user", qpara); } RunContext.getInstance().setExeInfo("000004", "密码错误!"); return false; } loginInfo.put("isLogined", true); loginInfo.put("userInfo", user); RequestContext.getSession().setAttribute("loginInfo", this); return true; } public String getDsName() { if(loginInfo.has("dsName")) { return loginInfo.getString("dsName"); }else { return null; } } public void setDsName(String value) { if(!loginInfo.has("dsName")) { loginInfo.put("dsName",value); } } public String getUserId() { if(loginInfo.has("userInfo")) { return loginInfo.getJSONObject("userInfo").getString("id"); }else { return null; } } // public void setUserId(String value) // { // if(!loginInfo.has("userInfo")) // { // loginInfo.getJSONObject("userInfo").put("id", value); // } // } public String getUserName() { if(loginInfo.has("userInfo")) { return loginInfo.getJSONObject("userInfo").getString("name"); }else { return null; } } public JSONObject getUserInfo() { if(loginInfo.has("userInfo")) { return loginInfo.getJSONObject("userInfo"); }else { return null; } } // public void setUserName(String value) // { // if(!loginInfo.has("userInfo")) // { // loginInfo.getJSONObject("userInfo").put("name", value); // } // } }
UTF-8
Java
3,128
java
LoginInfo.java
Java
[ { "context": "系管理员解锁!\"); \n\t\t\treturn false;\n\t\t} \n\t\t\n\t\tpassword = MD5.encrypt(password);\n\t\tif(!password.equals(user.ge", "end": 1269, "score": 0.7273092269897461, "start": 1267, "tag": "PASSWORD", "value": "MD" } ]
null
[]
package com.youlun.baseframework.core; import org.json.JSONObject; import com.youlun.baseframework.dao.DBOperator; import com.youlun.baseframework.util.MD5; import com.youlun.baseframework.util.StringUtils; public class LoginInfo { private JSONObject loginInfo = new JSONObject(); public LoginInfo() { loginInfo.put("isLogined", false); } public boolean hasAttr(String attName) { return loginInfo.has(attName); } public boolean isLogined() { return loginInfo.getBoolean("isLogined"); } public boolean login(String code,String password) { if(loginInfo.getBoolean("isLogined")) { RunContext.getInstance().setExeInfo("000001", "The user has the login!"); return false; } if(StringUtils.isEmpty(code)||StringUtils.isEmpty(password)) { return false; } /**校验用户密码*/ JSONObject qpara = new JSONObject(); qpara.put("code", code); JSONObject user = DBOperator.queryByWhereForSingle("ul_bsf_user", qpara); if(user==null) { RunContext.getInstance().setExeInfo("000002", "用户不存在!"); return false; } if(user.has("locked") && "Y".equalsIgnoreCase(user.getString("locked"))) { RunContext.getInstance().setExeInfo("000003", "账户已被锁定,请联系管理员解锁!"); return false; } password = MD5.encrypt(password); if(!password.equals(user.get("password"))) { /**如果有error_num字段,则记录密码错误次数,默认超过三次锁定账户*/ if(user.has("error_num")) { int errNum =user.getInt("error_num"); errNum++; qpara.put("error_num", errNum); if(errNum>=3) { qpara.put("locked", "Y"); } qpara.remove("code"); qpara.put("id", user.get("id")); DBOperator.updateByPk("ul_bsf_user", qpara); } RunContext.getInstance().setExeInfo("000004", "密码错误!"); return false; } loginInfo.put("isLogined", true); loginInfo.put("userInfo", user); RequestContext.getSession().setAttribute("loginInfo", this); return true; } public String getDsName() { if(loginInfo.has("dsName")) { return loginInfo.getString("dsName"); }else { return null; } } public void setDsName(String value) { if(!loginInfo.has("dsName")) { loginInfo.put("dsName",value); } } public String getUserId() { if(loginInfo.has("userInfo")) { return loginInfo.getJSONObject("userInfo").getString("id"); }else { return null; } } // public void setUserId(String value) // { // if(!loginInfo.has("userInfo")) // { // loginInfo.getJSONObject("userInfo").put("id", value); // } // } public String getUserName() { if(loginInfo.has("userInfo")) { return loginInfo.getJSONObject("userInfo").getString("name"); }else { return null; } } public JSONObject getUserInfo() { if(loginInfo.has("userInfo")) { return loginInfo.getJSONObject("userInfo"); }else { return null; } } // public void setUserName(String value) // { // if(!loginInfo.has("userInfo")) // { // loginInfo.getJSONObject("userInfo").put("name", value); // } // } }
3,128
0.644231
0.635279
156
18.333334
20.181654
77
false
false
0
0
0
0
0
0
2.26282
false
false
1
4a8d139ccb93b3dbed952f20dcb554da1d52999b
33,672,543,602,712
6268a1632cd7386f6d2bda5f823d5a81ea33ff61
/HAS Desktop/src/ca/mcgill/ecse321/HASDesktop/model/Song.java
1079676f45366f549736cde07617247d9fc1c405
[]
no_license
ecepidik/ApolloHAS_mirrored
https://github.com/ecepidik/ApolloHAS_mirrored
ba9ad17b7b06459b270ca2b62ac1ff17148bce52
3977282e5b42b359ab67aad66da6afde2e3a5691
refs/heads/master
2020-04-17T05:09:35.342000
2019-01-17T17:22:47
2019-01-17T17:22:47
166,265,590
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/*PLEASE DO NOT EDIT THIS CODE*/ /*This code was generated using the UMPLE 1.22.0.5146 modeling language!*/ package ca.mcgill.ecse321.HASDesktop.model; import java.io.Serializable; // line 3 "../../../../../HAS_model.ump" // line 66 "../../../../../HAS_model.ump" public class Song implements Serializable { //------------------------ // MEMBER VARIABLES //------------------------ //Song Attributes private String name; private int duration; private int trackNum; //Song Associations private Genre genre; //------------------------ // CONSTRUCTOR //------------------------ public Song(String aName, int aDuration, int aTrackNum, Genre aGenre) { name = aName; duration = aDuration; trackNum = aTrackNum; if (!setGenre(aGenre)) { throw new RuntimeException("Unable to create Song due to aGenre"); } } //------------------------ // INTERFACE //------------------------ public boolean setName(String aName) { boolean wasSet = false; name = aName; wasSet = true; return wasSet; } public boolean setDuration(int aDuration) { boolean wasSet = false; duration = aDuration; wasSet = true; return wasSet; } public boolean setTrackNum(int aTrackNum) { boolean wasSet = false; trackNum = aTrackNum; wasSet = true; return wasSet; } public String getName() { return name; } public int getDuration() { return duration; } public int getTrackNum() { return trackNum; } public Genre getGenre() { return genre; } public boolean setGenre(Genre aNewGenre) { boolean wasSet = false; if (aNewGenre != null) { genre = aNewGenre; wasSet = true; } return wasSet; } public void delete() { genre = null; } // line 9 "../../../../../HAS_model.ump" public void updateInfo(){ } public String toString() { String outputString = ""; return this.getName(); } }
UTF-8
Java
1,994
java
Song.java
Java
[]
null
[]
/*PLEASE DO NOT EDIT THIS CODE*/ /*This code was generated using the UMPLE 1.22.0.5146 modeling language!*/ package ca.mcgill.ecse321.HASDesktop.model; import java.io.Serializable; // line 3 "../../../../../HAS_model.ump" // line 66 "../../../../../HAS_model.ump" public class Song implements Serializable { //------------------------ // MEMBER VARIABLES //------------------------ //Song Attributes private String name; private int duration; private int trackNum; //Song Associations private Genre genre; //------------------------ // CONSTRUCTOR //------------------------ public Song(String aName, int aDuration, int aTrackNum, Genre aGenre) { name = aName; duration = aDuration; trackNum = aTrackNum; if (!setGenre(aGenre)) { throw new RuntimeException("Unable to create Song due to aGenre"); } } //------------------------ // INTERFACE //------------------------ public boolean setName(String aName) { boolean wasSet = false; name = aName; wasSet = true; return wasSet; } public boolean setDuration(int aDuration) { boolean wasSet = false; duration = aDuration; wasSet = true; return wasSet; } public boolean setTrackNum(int aTrackNum) { boolean wasSet = false; trackNum = aTrackNum; wasSet = true; return wasSet; } public String getName() { return name; } public int getDuration() { return duration; } public int getTrackNum() { return trackNum; } public Genre getGenre() { return genre; } public boolean setGenre(Genre aNewGenre) { boolean wasSet = false; if (aNewGenre != null) { genre = aNewGenre; wasSet = true; } return wasSet; } public void delete() { genre = null; } // line 9 "../../../../../HAS_model.ump" public void updateInfo(){ } public String toString() { String outputString = ""; return this.getName(); } }
1,994
0.565196
0.557673
115
16.347826
15.944492
74
false
false
0
0
0
0
0
0
0.321739
false
false
1
898309aef8c70118927f4f6dbf0e545ecfbb2043
29,068,338,694,809
d1a425a859d725257b4de3652a618445b3d59625
/app/src/main/java/com/carrey/recycleviewset/view/recycleview/adapter/DefaultTypeToDelegateManager.java
92bc3152577234e43d70a12366a845513179f074
[]
no_license
CarreyTsai/RecycleViewSet-todo
https://github.com/CarreyTsai/RecycleViewSet-todo
1e8a97f4ed61742ac6d0079babc82e4ed00b3161
5bfa60bb6eec5d9eb9042cc0add16ba09ee78386
refs/heads/master
2021-09-07T14:50:23.152000
2018-02-24T08:48:20
2018-02-24T08:48:20
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright 2016 drakeet. https://github.com/drakeet * * 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.carrey.recycleviewset.view.recycleview.adapter; import android.support.annotation.NonNull; import java.util.ArrayList; import java.util.List; /** * 类型到delegate映射管理类。 具有类型 代理类 和偏移管理。 具有获取类型 获取代理 获取偏移等操作 */ public class DefaultTypeToDelegateManager implements TypeToDelegateManager { /** * 类型 class 容器 */ @NonNull private final List<Class<?>> mClasses; /** * delegate 容器 */ @NonNull private final List<ItemViewDelegate<?, ?>> mDelegates; /** * 类型和delegate 偏移量容器 */ @NonNull private final List<TypeOffset<?>> mTypeOffsets; public DefaultTypeToDelegateManager() { this.mClasses = new ArrayList<>(); this.mDelegates = new ArrayList<>(); this.mTypeOffsets = new ArrayList<>(); } public DefaultTypeToDelegateManager(int initialCapacity) { this.mClasses = new ArrayList<>(initialCapacity); this.mDelegates = new ArrayList<>(initialCapacity); this.mTypeOffsets = new ArrayList<>(initialCapacity); } /** * 这个方法可能导致 class delegate offset 容器大小不一致 * * @param classes * @param delegates * @param typeOffsets */ private DefaultTypeToDelegateManager(@NonNull List<Class<?>> classes, @NonNull List<ItemViewDelegate<?, ?>> delegates, @NonNull List<TypeOffset<?>> typeOffsets) { this.mClasses = classes; this.mDelegates = delegates; this.mTypeOffsets = typeOffsets; } /** * 注册类型到delegate * * @param clazz 类型class * @param delegate itemView delegate * @param typeOffset 类型和 delegate 之间偏移量 默认是0 * @param <T> 数据类型 */ @Override public <T> void register( @NonNull Class<? extends T> clazz, @NonNull ItemViewDelegate<T, ?> delegate, @NonNull TypeOffset<T> typeOffset) { mClasses.add(clazz); mDelegates.add(delegate); mTypeOffsets.add(typeOffset); } /** * 取消注册 * * @param clazz 类型class * @return true 返回是否取消注册成功 */ @Override public boolean unregister(@NonNull Class<?> clazz) { boolean removed = false; while (true) { int index = mClasses.indexOf(clazz); if (index != NO_INDEX) { mClasses.remove(index); mDelegates.remove(index); mTypeOffsets.remove(index); removed = true; } else { break; } } return removed; } @Override public int size() { return mClasses.size(); } /** * 获取该类型class 对应的位置。 如果类型没有注册返回-1 * * @param clazz 类型class * @return 获取容器总第一次出现 类型class 位置 如果类型没有注册,返回-1 {@link #NO_INDEX} */ @Override public int firstIndexOf(@NonNull final Class<?> clazz) { int index = mClasses.indexOf(clazz); if (index != NO_INDEX) { return index; } for (int i = 0; i < mClasses.size(); i++) { if (mClasses.get(i).isAssignableFrom(clazz)) { return i; } } return NO_INDEX; } @Override public @NonNull Class<?> getClass(int index) { return mClasses.get(index); } @Override public @NonNull ItemViewDelegate<?, ?> getItemViewDelegate(int index) { return mDelegates.get(index); } @Override public @NonNull TypeOffset<?> getTypeOffset(int index) { return mTypeOffsets.get(index); } }
UTF-8
Java
4,546
java
DefaultTypeToDelegateManager.java
Java
[ { "context": "/*\n * Copyright 2016 drakeet. https://github.com/drakeet\n *\n * Licensed under ", "end": 28, "score": 0.9997038841247559, "start": 21, "tag": "USERNAME", "value": "drakeet" }, { "context": "/*\n * Copyright 2016 drakeet. https://github.com/drakeet\n *\n * Licensed under the Apache License, Version ", "end": 56, "score": 0.9996402263641357, "start": 49, "tag": "USERNAME", "value": "drakeet" } ]
null
[]
/* * Copyright 2016 drakeet. https://github.com/drakeet * * 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.carrey.recycleviewset.view.recycleview.adapter; import android.support.annotation.NonNull; import java.util.ArrayList; import java.util.List; /** * 类型到delegate映射管理类。 具有类型 代理类 和偏移管理。 具有获取类型 获取代理 获取偏移等操作 */ public class DefaultTypeToDelegateManager implements TypeToDelegateManager { /** * 类型 class 容器 */ @NonNull private final List<Class<?>> mClasses; /** * delegate 容器 */ @NonNull private final List<ItemViewDelegate<?, ?>> mDelegates; /** * 类型和delegate 偏移量容器 */ @NonNull private final List<TypeOffset<?>> mTypeOffsets; public DefaultTypeToDelegateManager() { this.mClasses = new ArrayList<>(); this.mDelegates = new ArrayList<>(); this.mTypeOffsets = new ArrayList<>(); } public DefaultTypeToDelegateManager(int initialCapacity) { this.mClasses = new ArrayList<>(initialCapacity); this.mDelegates = new ArrayList<>(initialCapacity); this.mTypeOffsets = new ArrayList<>(initialCapacity); } /** * 这个方法可能导致 class delegate offset 容器大小不一致 * * @param classes * @param delegates * @param typeOffsets */ private DefaultTypeToDelegateManager(@NonNull List<Class<?>> classes, @NonNull List<ItemViewDelegate<?, ?>> delegates, @NonNull List<TypeOffset<?>> typeOffsets) { this.mClasses = classes; this.mDelegates = delegates; this.mTypeOffsets = typeOffsets; } /** * 注册类型到delegate * * @param clazz 类型class * @param delegate itemView delegate * @param typeOffset 类型和 delegate 之间偏移量 默认是0 * @param <T> 数据类型 */ @Override public <T> void register( @NonNull Class<? extends T> clazz, @NonNull ItemViewDelegate<T, ?> delegate, @NonNull TypeOffset<T> typeOffset) { mClasses.add(clazz); mDelegates.add(delegate); mTypeOffsets.add(typeOffset); } /** * 取消注册 * * @param clazz 类型class * @return true 返回是否取消注册成功 */ @Override public boolean unregister(@NonNull Class<?> clazz) { boolean removed = false; while (true) { int index = mClasses.indexOf(clazz); if (index != NO_INDEX) { mClasses.remove(index); mDelegates.remove(index); mTypeOffsets.remove(index); removed = true; } else { break; } } return removed; } @Override public int size() { return mClasses.size(); } /** * 获取该类型class 对应的位置。 如果类型没有注册返回-1 * * @param clazz 类型class * @return 获取容器总第一次出现 类型class 位置 如果类型没有注册,返回-1 {@link #NO_INDEX} */ @Override public int firstIndexOf(@NonNull final Class<?> clazz) { int index = mClasses.indexOf(clazz); if (index != NO_INDEX) { return index; } for (int i = 0; i < mClasses.size(); i++) { if (mClasses.get(i).isAssignableFrom(clazz)) { return i; } } return NO_INDEX; } @Override public @NonNull Class<?> getClass(int index) { return mClasses.get(index); } @Override public @NonNull ItemViewDelegate<?, ?> getItemViewDelegate(int index) { return mDelegates.get(index); } @Override public @NonNull TypeOffset<?> getTypeOffset(int index) { return mTypeOffsets.get(index); } }
4,546
0.589429
0.586597
164
24.841463
22.444494
89
false
false
0
0
0
0
0
0
0.304878
false
false
1
b26ed6599e2f81e9d03bee96884eabd8d64e01fa
34,110,630,311,448
1487017fb1fefb79b2106eddd0efbaa15c56baa3
/amazon-watcher-model/src/main/java/de/nosebrain/amazon/watcher/services/InformationService.java
bd12dd9a4402d23162d2d1df37162efefe1c6bf2
[]
no_license
nosebrain/amazon-watcher
https://github.com/nosebrain/amazon-watcher
743dd7770a5ae171ef52a355e80a30976e8f2714
50780cdb3882c0167b45ac7346b6ea7222515cd9
refs/heads/master
2022-12-20T22:40:06.095000
2012-12-17T13:18:12
2012-12-17T13:18:12
236,223,557
0
0
null
false
2022-12-16T00:39:17
2020-01-25T20:09:52
2020-01-25T20:12:08
2022-12-16T00:39:14
412
0
0
9
Java
false
false
package de.nosebrain.amazon.watcher.services; import java.util.List; import java.util.Locale; import de.nosebrain.amazon.watcher.model.Observation; /** * * @author nosebrain */ public interface InformationService { /** * @param observations inform the user about the changes */ public void inform(final List<Observation> observations, final Locale language) throws Exception; public void testService(final Locale language) throws Exception; }
UTF-8
Java
459
java
InformationService.java
Java
[ { "context": "zon.watcher.model.Observation;\n\n/**\n * \n * @author nosebrain\n */\npublic interface InformationService {\n\n\t/**\n\t", "end": 179, "score": 0.9994613528251648, "start": 170, "tag": "USERNAME", "value": "nosebrain" } ]
null
[]
package de.nosebrain.amazon.watcher.services; import java.util.List; import java.util.Locale; import de.nosebrain.amazon.watcher.model.Observation; /** * * @author nosebrain */ public interface InformationService { /** * @param observations inform the user about the changes */ public void inform(final List<Observation> observations, final Locale language) throws Exception; public void testService(final Locale language) throws Exception; }
459
0.769063
0.769063
20
21.950001
27.536295
98
false
false
0
0
0
0
0
0
0.6
false
false
1
55cc0f80a43e7ebb65be85d7558a6f27bd37a599
34,110,630,309,755
1673d39e23b9639e81c6ae4790bd27bc6acd1647
/src/test/java/sg/edu/ntu/sce/sands/crypto/dcpabe/CiphertextTest.java
f64545b17611ea1cd0bc683a242e838553c44410
[ "MIT" ]
permissive
stefano81/dcpabe
https://github.com/stefano81/dcpabe
00aef1a0395776731c323ff12a950fe15aa15cec
32e51a5416be5c11597fc46cc8b6f691ea11ce53
refs/heads/master
2023-04-15T05:19:21.930000
2022-11-09T07:47:51
2022-12-16T11:36:59
6,607,238
96
47
MIT
false
2023-03-31T15:19:14
2012-11-09T02:02:27
2023-03-10T02:42:21
2023-03-31T15:19:14
163
83
43
5
Java
false
false
package sg.edu.ntu.sce.sands.crypto.dcpabe; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import sg.edu.ntu.sce.sands.crypto.dcpabe.ac.AccessStructure; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; public class CiphertextTest { private static GlobalParameters gp; private static AuthorityKeys authority; private AccessStructure arho; private PublicKeys pks; @BeforeClass public static void init() { gp = DCPABE.globalSetup(160); authority = DCPABE.authoritySetup("authority", gp, "A", "B", "C", "D"); } @Before public void setUp() { arho = AccessStructure.buildFromPolicy("and A or D and C B"); pks = new PublicKeys(); pks.subscribeAuthority(authority.getPublicKeys()); } @Test public void testSerialization() throws Exception { Ciphertext ct = DCPABE.encrypt(DCPABE.generateRandomMessage(gp), arho, gp, pks); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(ct); oos.close(); ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray())); Ciphertext ct1 = (Ciphertext) ois.readObject(); assertArrayEquals("C0", ct.getC0(), ct1.getC0()); assertEquals("access structure differ", ct.getAccessStructure(), ct1.getAccessStructure()); assertEquals("differ on l", ct.getAccessStructure().getL(), ct1.getAccessStructure().getL()); assertEquals("differ on n", ct.getAccessStructure().getN(), ct1.getAccessStructure().getN()); for (int i = 0; i < ct.getAccessStructure().getL(); i++) { assertArrayEquals("differ on C1" + i, ct.getC1(i), ct1.getC1(i)); assertArrayEquals("differ on C2" + i, ct.getC2(i), ct1.getC2(i)); assertArrayEquals("differ on C3" + i, ct.getC3(i), ct1.getC3(i)); } } }
UTF-8
Java
2,163
java
CiphertextTest.java
Java
[]
null
[]
package sg.edu.ntu.sce.sands.crypto.dcpabe; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; import sg.edu.ntu.sce.sands.crypto.dcpabe.ac.AccessStructure; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; public class CiphertextTest { private static GlobalParameters gp; private static AuthorityKeys authority; private AccessStructure arho; private PublicKeys pks; @BeforeClass public static void init() { gp = DCPABE.globalSetup(160); authority = DCPABE.authoritySetup("authority", gp, "A", "B", "C", "D"); } @Before public void setUp() { arho = AccessStructure.buildFromPolicy("and A or D and C B"); pks = new PublicKeys(); pks.subscribeAuthority(authority.getPublicKeys()); } @Test public void testSerialization() throws Exception { Ciphertext ct = DCPABE.encrypt(DCPABE.generateRandomMessage(gp), arho, gp, pks); ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(ct); oos.close(); ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(baos.toByteArray())); Ciphertext ct1 = (Ciphertext) ois.readObject(); assertArrayEquals("C0", ct.getC0(), ct1.getC0()); assertEquals("access structure differ", ct.getAccessStructure(), ct1.getAccessStructure()); assertEquals("differ on l", ct.getAccessStructure().getL(), ct1.getAccessStructure().getL()); assertEquals("differ on n", ct.getAccessStructure().getN(), ct1.getAccessStructure().getN()); for (int i = 0; i < ct.getAccessStructure().getL(); i++) { assertArrayEquals("differ on C1" + i, ct.getC1(i), ct1.getC1(i)); assertArrayEquals("differ on C2" + i, ct.getC2(i), ct1.getC2(i)); assertArrayEquals("differ on C3" + i, ct.getC3(i), ct1.getC3(i)); } } }
2,163
0.680999
0.669903
62
33.887096
30.84305
101
false
false
0
0
0
0
0
0
0.935484
false
false
1
0f6fa6c7de286a4b8754c04413160709eed9f0dd
31,241,592,134,772
4add5c7acb7f8832c7e01c9bf12743a9a689ba49
/src/main/java/ec/com/todocompu/ShrimpSoftUtils/contabilidad/entity/ConCuentas.java
d2b24e100687342d27ed6ba644d94a6647878a86
[]
no_license
todocompu/ShrimpSoftUtils
https://github.com/todocompu/ShrimpSoftUtils
42172ac5e5b70e1ec6d99124e046c31c2372dbe7
9310a442cf40a77cce76ea42a260f955f937bfad
refs/heads/master
2017-02-10T14:24:20.961000
2017-02-06T22:34:59
2017-02-06T22:35:04
45,747,546
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package ec.com.todocompu.ShrimpSoftUtils.contabilidad.entity; import java.io.Serializable; import java.util.Date; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.EmbeddedId; import javax.persistence.Entity; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import com.fasterxml.jackson.annotation.JsonIgnore; @Entity @Table(name = "con_cuentas", schema = "contabilidad") public class ConCuentas implements Serializable { private static final long serialVersionUID = 1L; @EmbeddedId protected ConCuentasPK conCuentasPK; @Column(name = "cta_detalle") private String ctaDetalle; @Column(name = "cta_activo") private Boolean ctaActivo; @Column(name = "usr_empresa") private String usrEmpresa; @Column(name = "usr_codigo") private String usrCodigo; @Column(name = "usr_fecha_inserta") @Temporal(TemporalType.TIMESTAMP) private Date usrFechaInserta; @OneToMany(cascade = CascadeType.ALL, mappedBy = "conCuentas") @JsonIgnore private List<ConCuentasFlujoDetalle> conCuentasFlujoDetalleList; @OneToMany(cascade = CascadeType.ALL, mappedBy = "conCuentas") @JsonIgnore private List<ConDetalle> conDetalleList; public ConCuentas() { } public ConCuentas(ConCuentasPK conCuentasPK) { this.conCuentasPK = conCuentasPK; } public ConCuentas(ConCuentasPK conCuentasPK, String ctaDetalle, String usrEmpresa) { this.conCuentasPK = conCuentasPK; this.ctaDetalle = ctaDetalle; this.usrEmpresa = usrEmpresa; } public ConCuentas(String ctaEmpresa, String ctaCodigo) { this.conCuentasPK = new ConCuentasPK(ctaEmpresa, ctaCodigo); } public ConCuentasPK getConCuentasPK() { return conCuentasPK; } public void setConCuentasPK(ConCuentasPK conCuentasPK) { this.conCuentasPK = conCuentasPK; } public String getCtaDetalle() { return ctaDetalle; } public void setCtaDetalle(String ctaDetalle) { this.ctaDetalle = ctaDetalle; } public Boolean getCtaActivo() { return ctaActivo; } public void setCtaActivo(Boolean ctaActivo) { this.ctaActivo = ctaActivo; } public String getUsrEmpresa() { return usrEmpresa; } public void setUsrEmpresa(String usrEmpresa) { this.usrEmpresa = usrEmpresa; } public String getUsrCodigo() { return usrCodigo; } public void setUsrCodigo(String usrCodigo) { this.usrCodigo = usrCodigo; } public Date getUsrFechaInserta() { return usrFechaInserta; } public void setUsrFechaInserta(Date usrFechaInserta) { this.usrFechaInserta = usrFechaInserta; } public List<ConCuentasFlujoDetalle> getConCuentasFlujoDetalleList() { return conCuentasFlujoDetalleList; } public void setConCuentasFlujoDetalleList(List<ConCuentasFlujoDetalle> conCuentasFlujoDetalleList) { this.conCuentasFlujoDetalleList = conCuentasFlujoDetalleList; } public List<ConDetalle> getConDetalleList() { return conDetalleList; } public void setConDetalleList(List<ConDetalle> conDetalleList) { this.conDetalleList = conDetalleList; } @Override public int hashCode() { int hash = 0; hash += (conCuentasPK != null ? conCuentasPK.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { if (!(object instanceof ConCuentas)) { return false; } ConCuentas other = (ConCuentas) object; if ((this.conCuentasPK == null && other.conCuentasPK != null) || (this.conCuentasPK != null && !this.conCuentasPK.equals(other.conCuentasPK))) { return false; } return true; } @Override public String toString() { return "contabilidad.entity.ConCuentas[ conCuentasPK=" + conCuentasPK + " ]"; } }
UTF-8
Java
3,686
java
ConCuentas.java
Java
[]
null
[]
package ec.com.todocompu.ShrimpSoftUtils.contabilidad.entity; import java.io.Serializable; import java.util.Date; import java.util.List; import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.EmbeddedId; import javax.persistence.Entity; import javax.persistence.OneToMany; import javax.persistence.Table; import javax.persistence.Temporal; import javax.persistence.TemporalType; import com.fasterxml.jackson.annotation.JsonIgnore; @Entity @Table(name = "con_cuentas", schema = "contabilidad") public class ConCuentas implements Serializable { private static final long serialVersionUID = 1L; @EmbeddedId protected ConCuentasPK conCuentasPK; @Column(name = "cta_detalle") private String ctaDetalle; @Column(name = "cta_activo") private Boolean ctaActivo; @Column(name = "usr_empresa") private String usrEmpresa; @Column(name = "usr_codigo") private String usrCodigo; @Column(name = "usr_fecha_inserta") @Temporal(TemporalType.TIMESTAMP) private Date usrFechaInserta; @OneToMany(cascade = CascadeType.ALL, mappedBy = "conCuentas") @JsonIgnore private List<ConCuentasFlujoDetalle> conCuentasFlujoDetalleList; @OneToMany(cascade = CascadeType.ALL, mappedBy = "conCuentas") @JsonIgnore private List<ConDetalle> conDetalleList; public ConCuentas() { } public ConCuentas(ConCuentasPK conCuentasPK) { this.conCuentasPK = conCuentasPK; } public ConCuentas(ConCuentasPK conCuentasPK, String ctaDetalle, String usrEmpresa) { this.conCuentasPK = conCuentasPK; this.ctaDetalle = ctaDetalle; this.usrEmpresa = usrEmpresa; } public ConCuentas(String ctaEmpresa, String ctaCodigo) { this.conCuentasPK = new ConCuentasPK(ctaEmpresa, ctaCodigo); } public ConCuentasPK getConCuentasPK() { return conCuentasPK; } public void setConCuentasPK(ConCuentasPK conCuentasPK) { this.conCuentasPK = conCuentasPK; } public String getCtaDetalle() { return ctaDetalle; } public void setCtaDetalle(String ctaDetalle) { this.ctaDetalle = ctaDetalle; } public Boolean getCtaActivo() { return ctaActivo; } public void setCtaActivo(Boolean ctaActivo) { this.ctaActivo = ctaActivo; } public String getUsrEmpresa() { return usrEmpresa; } public void setUsrEmpresa(String usrEmpresa) { this.usrEmpresa = usrEmpresa; } public String getUsrCodigo() { return usrCodigo; } public void setUsrCodigo(String usrCodigo) { this.usrCodigo = usrCodigo; } public Date getUsrFechaInserta() { return usrFechaInserta; } public void setUsrFechaInserta(Date usrFechaInserta) { this.usrFechaInserta = usrFechaInserta; } public List<ConCuentasFlujoDetalle> getConCuentasFlujoDetalleList() { return conCuentasFlujoDetalleList; } public void setConCuentasFlujoDetalleList(List<ConCuentasFlujoDetalle> conCuentasFlujoDetalleList) { this.conCuentasFlujoDetalleList = conCuentasFlujoDetalleList; } public List<ConDetalle> getConDetalleList() { return conDetalleList; } public void setConDetalleList(List<ConDetalle> conDetalleList) { this.conDetalleList = conDetalleList; } @Override public int hashCode() { int hash = 0; hash += (conCuentasPK != null ? conCuentasPK.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { if (!(object instanceof ConCuentas)) { return false; } ConCuentas other = (ConCuentas) object; if ((this.conCuentasPK == null && other.conCuentasPK != null) || (this.conCuentasPK != null && !this.conCuentasPK.equals(other.conCuentasPK))) { return false; } return true; } @Override public String toString() { return "contabilidad.entity.ConCuentas[ conCuentasPK=" + conCuentasPK + " ]"; } }
3,686
0.762073
0.761259
150
23.573334
22.724539
101
false
false
0
0
0
0
0
0
1.34
false
false
1
14babacaeb8f43d3a6cba08ca97b910d97eb25d2
36,172,214,599,391
d8ed228ea439f904cd7d24e542979f1555e03e4b
/src/main/java/com/douzi/xueyou/controller/loginController.java
e0db5b5d3cdb23681542a3a14d4a4120802d60ee
[]
no_license
lc275/springmvc_demo
https://github.com/lc275/springmvc_demo
12466b9892efac31741801b492ccff45baae6575
907b370fe97d5bc4eb5d184d6a26cff7a88efd79
refs/heads/master
2018-12-12T06:18:30.580000
2018-09-28T03:11:33
2018-09-28T03:11:33
115,263,110
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.douzi.xueyou.controller; import java.io.File; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.commons.io.FileUtils; import org.apache.log4j.Logger; 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.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.multipart.MultipartFile; import com.alibaba.fastjson.JSONObject; import com.douzi.xueyou.dao.Impl.MemberDaoImpl; import com.douzi.xueyou.model.Member; import com.douzi.xueyou.model.Student; import com.douzi.xueyou.model.Teacher; import com.douzi.xueyou.model.User; import com.douzi.xueyou.response.Response; import com.douzi.xueyou.response.ResponseFactory; import com.douzi.xueyou.service.Impl.StudentServiceImpl; import com.douzi.xueyou.service.Impl.TeacherServiceImpl; import com.douzi.xueyou.service.Impl.UserServiceImpl; import com.douzi.xueyou.tools.utils.FileUtil; import com.douzi.xueyou.tools.utils.MyConfiguration; import com.douzi.xueyou.tools.utils.StringTools; @Controller public class loginController { @Autowired private UserServiceImpl userService; @Autowired private StudentServiceImpl studentServiceImpl; @Autowired private TeacherServiceImpl teacherServiceImpl; private static final Logger log = Logger.getLogger(loginController.class); @Autowired private MyConfiguration Config; // 引用统一的参数配置类 @Autowired private MemberDaoImpl memberDaoImpl; @RequestMapping(value="/register", method = RequestMethod.POST) public @ResponseBody Response register(@RequestParam("userName")String userName,@RequestParam("password")String password,@RequestParam("role")String role){ //LoginResponse res= new LoginResponse(); Response res = new Response(); boolean isRegister = userService.isRegisted(userName); if(!isRegister)//没有注册,注册 { String appKey=StringTools.getRandomString(8); User user = new User(userName,password,appKey,Integer.parseInt(role),0); int userId = userService.save(user); System.out.println("register success: " + userName +" "+ password+" "+ role); //res.setDate(0); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String time = formatter.format(new Date()); //res.setData(appKey,time,role); res.getData().put("userId", userId); res.getData().put("appKey", appKey); res.getData().put("timeStamp", time); res.getData().put("role", role); if(role.equals("1"))//teacher { Teacher tmpTeacher = new Teacher( userId, userName); int id = teacherServiceImpl.save(tmpTeacher); tmpTeacher.setId(id); res.getData().put("teacher", tmpTeacher); } else if(role.equals("0"))//stu { Student tmpstu = new Student(userId); int id = studentServiceImpl.save(tmpstu); tmpstu.setId(id); res.getData().put("student", tmpstu); } SimpleDateFormat sdFormat=new SimpleDateFormat("yyyy年MM月dd日"); Calendar calendar=Calendar.getInstance(); java.util.Date d = null; try { d = sdFormat.parse(sdFormat.format(calendar.getTime())); } catch (Exception e) { e.printStackTrace(); } java.sql.Date date = new java.sql.Date(d.getTime()); Member f = new Member( userId,date); memberDaoImpl.insert(f); } else { res.getHead().setMessage("already registed"); res.getHead().setCode("1"); } res.getHead().setMethod("register"); return res; } @RequestMapping(value="seticon") public @ResponseBody Response seticon(@RequestParam("userId")int userId,@RequestParam("icon")MultipartFile pic,@RequestParam("appKey") String appKey) throws IOException { Response res = new Response("resetpass"); String imgDirectory = ""; String basePath = Config.filePath; String returnImgUrl = ""; long time = System.currentTimeMillis(); List<User> luser = userService.getById(userId); if(luser.size()==0) { res.getHead().setCode("1"); res.getHead().setMessage("error userId"); return res; } User user = luser.get(0); if(!pic.isEmpty()) { String picName = pic.getOriginalFilename(); String picNewName = time+picName; int schoolId = 0;//getSchoolId(String.valueOf(userId)); imgDirectory = FileUtil.getIconPath(String.valueOf(schoolId)); FileUtil.createDirectory(basePath + imgDirectory); log.info("Process file: " + basePath+imgDirectory+picName); String fullPath = basePath + imgDirectory + picNewName; FileUtils.copyInputStreamToFile(pic.getInputStream(), new File(fullPath)); // 生成返回的图片URL String tmpImgPath = FileUtil.getIconUrlPath(String.valueOf(schoolId)) + picNewName; returnImgUrl = FileUtil.getUrlPath(tmpImgPath); log.info(returnImgUrl); } user.setIcon(returnImgUrl); userService.update(user); res.getData().put("user",user); return res; } @RequestMapping(value="resetpass") public @ResponseBody Response resetPass(@RequestParam("userName")String userName,@RequestParam("newPass")String newpass) { User user = userService.getByName(userName); Response res = new Response("resetpass"); if(user!=null) { if(user.getUserName().equals(userName) ) { user.setPassword(newpass); userService.update(user); } else { res.getHead().setCode("1"); res.getHead().setMessage("resetpass failed"); } } else { res.getHead().setCode("1"); res.getHead().setMessage("userName wrong"); } return res; } @RequestMapping(value="resetpassold") public @ResponseBody Response resetPassold(@RequestParam("userName")String userName,@RequestParam("appKey") String appKey,@RequestParam("role") String role,@RequestParam("newPass")String newpass) { User user = userService.getByName(userName); Response res = new Response("resetpass"); if(user!=null) { if(user.getUserName().equals(userName) && Integer.parseInt(role) == user.getRole()) { user.setPassword(newpass); userService.update(user); } else { res.getHead().setCode("1"); res.getHead().setMessage("resetpass failed"); } } else { res.getHead().setCode("1"); res.getHead().setMessage("userName wrong"); } return res; } @RequestMapping(value="/logout") public @ResponseBody Response logout(@RequestParam("userName")String userName,@RequestParam("appKey") String appKey) { User user = userService.getByName(userName); Response res = new Response(); if(user!=null) { user.setUserState(0); user.setAppKey("@#^#&&#&!@#*&*^"); userService.update(user); } else { res.getHead().setCode("1"); res.getHead().setMessage("logout Failed"); } res.getHead().setMethod("logout"); return res; } @RequestMapping(value="/login", method = RequestMethod.POST) public @ResponseBody Response login(@RequestParam("userName")String userName,@RequestParam("password")String password){ log.info("log4j print test......"); User user = userService.getByName(userName); Response res = new Response(); if (user!=null) { log.info(user.toString()); System.out.println(user.toString()); if (user.getUserName().equals(userName) && user.getPassword().equals(password)) { //生成随机APP KEY String appKey=StringTools.getRandomString(8); //更新数据库 user.setAppKey(appKey); user.setUserState(1); userService.update(user); int role=user.getRole(); //返回resp System.out.println("login success: " + userName +" "+ password+" "+ role); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String time = formatter.format(new Date()); res.getData().put("userId", user.getId()); res.getData().put("appKey", appKey); res.getData().put("timeStamp", time); res.getData().put("role", role); //查找此用户的默认学校。 if(role>0){ //教师查教师表teacher List<Teacher> s= teacherServiceImpl.getAll(user.getId()+""); if(s.size()<1){ res.getData().put("schoolId", ""); res.getData().put("classId", ""); }else{ res.getData().put("schoolId", s.get(0).getSchoolId()); res.getData().put("classId", s.get(0).getClassId()); } }else{ List<Student> s= studentServiceImpl.getAllByUserId(user.getId()+""); if(s.size()<1){ res.getData().put("schoolId", ""); }else{ res.getData().put("schoolId", s.get(0).getSchoolId()); } } } else { res.getHead().setCode("1"); res.getHead().setMessage("wrong name or password"); System.out.println("login failed, login info : " + userName +" "+ password+" "); } } else { res.getHead().setCode("0"); res.getHead().setMessage("nouser"); System.out.println("login failed, login info : " + userName +" "+ password+" "); } res.getHead().setMethod("login"); //log.debug(res.toString()); return res; } @RequestMapping(value="updateRegId",method = RequestMethod.POST) @ResponseBody public Response updateRegId(String appKey,String regId){ int result=userService.updateRegId(appKey,regId); return result>0?ResponseFactory.newSuccessResponse():ResponseFactory.newErrorResponse("用户不存在或更新失败"); } @ResponseBody @RequestMapping("v1/commercial/getCommercialInfo") public Response getCommercialInfo(){ Map<String,Object> map = new HashMap<String,Object>(); map.put("postion", 1); map.put("photo","xy/imgs/schoolPage/3/151607598956791CC1EA2C382143D0B1892EEEDDAF869.jpg"); map.put("vendorName", "启迪学园"); map.put("vendorId", 153); List<Map<String,Object>> list = new ArrayList<Map<String,Object>>(); list.add(map); Response resp = ResponseFactory.newSuccessResponse(); resp.getData().put("commercialInfo", list); return resp; } }
UTF-8
Java
10,494
java
loginController.java
Java
[ { "context": "ic @ResponseBody Response register(@RequestParam(\"userName\")String userName,@RequestParam(\"password\")String ", "end": 1996, "score": 0.9970544576644897, "start": 1988, "tag": "USERNAME", "value": "userName" }, { "context": " Response register(@RequestParam(\"userName\")String userName,@RequestParam(\"password\")String password,@Request", "end": 2013, "score": 0.9908146262168884, "start": 2005, "tag": "USERNAME", "value": "userName" }, { "context": "stParam(\"userName\")String userName,@RequestParam(\"password\")String password,@RequestParam(\"role\")String role", "end": 2037, "score": 0.5438440442085266, "start": 2029, "tag": "PASSWORD", "value": "password" }, { "context": "e\")String userName,@RequestParam(\"password\")String password,@RequestParam(\"role\")String role){\r\n\t\t//LoginResp", "end": 2054, "score": 0.661176860332489, "start": 2046, "tag": "PASSWORD", "value": "password" }, { "context": "\t\tif(!isRegister)//没有注册,注册\r\n\t\t{\r\n\t\t\tString appKey=StringTools.getRandomString(8);\r\n\t\t\tUser user = new User(userName,password,ap", "end": 2305, "score": 0.9766003489494324, "start": 2278, "tag": "KEY", "value": "StringTools.getRandomString" }, { "context": "ools.getRandomString(8);\r\n\t\t\tUser user = new User(userName,password,appKey,Integer.parseInt(role),0);\r\n\t\t\tin", "end": 2343, "score": 0.9922647476196289, "start": 2335, "tag": "USERNAME", "value": "userName" }, { "context": "er);\r\n\t\t\tSystem.out.println(\"register success: \" + userName +\" \"+ password+\" \"+ role);\r\n\t\t\t//res.setDate(0);", "end": 2482, "score": 0.9746467471122742, "start": 2474, "tag": "USERNAME", "value": "userName" }, { "context": "c @ResponseBody Response resetPass(@RequestParam(\"userName\")String userName,@RequestParam(\"newPass\")String n", "end": 5409, "score": 0.994684636592865, "start": 5401, "tag": "USERNAME", "value": "userName" }, { "context": "Response resetPass(@RequestParam(\"userName\")String userName,@RequestParam(\"newPass\")String newpass)\r\n\t{\r\n\t\tUs", "end": 5426, "score": 0.9912132024765015, "start": 5418, "tag": "USERNAME", "value": "userName" }, { "context": "user!=null)\r\n\t\t{\r\n\t\t\tif(user.getUserName().equals(userName) )\r\n\t\t\t{\r\n\t\t\t\tuser.setPassword(newpass);\r\n\t\t\t\tuse", "end": 5628, "score": 0.8453531861305237, "start": 5620, "tag": "USERNAME", "value": "userName" }, { "context": "().equals(userName) )\r\n\t\t\t{\r\n\t\t\t\tuser.setPassword(newpass);\r\n\t\t\t\tuserService.update(user);\r\n\t\t\t}\r\n\t\t\telse\r\n", "end": 5667, "score": 0.5449384450912476, "start": 5660, "tag": "PASSWORD", "value": "newpass" }, { "context": "ResponseBody Response resetPassold(@RequestParam(\"userName\")String userName,@RequestParam(\"appKey\") String a", "end": 6065, "score": 0.9961677193641663, "start": 6057, "tag": "USERNAME", "value": "userName" }, { "context": "ponse resetPassold(@RequestParam(\"userName\")String userName,@RequestParam(\"appKey\") String appKey,@RequestPar", "end": 6082, "score": 0.9889150261878967, "start": 6074, "tag": "USERNAME", "value": "userName" }, { "context": "newpass)\r\n\t{\r\n\t\tUser user = userService.getByName(userName);\r\n\t\tResponse res = new Response(\"resetpass\");\r\n\t", "end": 6244, "score": 0.6187218427658081, "start": 6236, "tag": "USERNAME", "value": "userName" }, { "context": "user!=null)\r\n\t\t{\r\n\t\t\tif(user.getUserName().equals(userName) && Integer.parseInt(role) == user.getRole())\r\n", "end": 6356, "score": 0.9817196130752563, "start": 6348, "tag": "USERNAME", "value": "userName" }, { "context": "e) == user.getRole())\r\n\t\t\t{\r\n\t\t\t\tuser.setPassword(newpass);\r\n\t\t\t\tuserService.update(user);\r\n\t\t\t}\r\n\t\t\telse\r\n", "end": 6440, "score": 0.944560706615448, "start": 6433, "tag": "PASSWORD", "value": "newpass" }, { "context": "blic @ResponseBody Response logout(@RequestParam(\"userName\")String userName,@RequestParam(\"appKey\") String a", "end": 6830, "score": 0.9960273504257202, "start": 6822, "tag": "USERNAME", "value": "userName" }, { "context": "dy Response logout(@RequestParam(\"userName\")String userName,@RequestParam(\"appKey\") String appKey)\r\n\t{\r\n\t\tUse", "end": 6847, "score": 0.9880379438400269, "start": 6839, "tag": "USERNAME", "value": "userName" }, { "context": " appKey)\r\n\t{\r\n\t\tUser user = userService.getByName(userName);\r\n\t\tResponse res = new Response();\r\n\t\tif(user!=n", "end": 6936, "score": 0.7138732671737671, "start": 6928, "tag": "USERNAME", "value": "userName" }, { "context": "ublic @ResponseBody Response login(@RequestParam(\"userName\")String userName,@RequestParam(\"password\")String ", "end": 7387, "score": 0.996080219745636, "start": 7379, "tag": "USERNAME", "value": "userName" }, { "context": "ody Response login(@RequestParam(\"userName\")String userName,@RequestParam(\"password\")String password){\r\n\t\tlog", "end": 7404, "score": 0.9858046174049377, "start": 7396, "tag": "USERNAME", "value": "userName" }, { "context": "est......\");\r\n\t\tUser user = userService.getByName(userName);\r\n\t\tResponse res = new Response();\r\n\t\t\r\n\t\t\r\n\t\tif", "end": 7532, "score": 0.9087687730789185, "start": 7524, "tag": "USERNAME", "value": "userName" }, { "context": "er.toString());\r\n\t\t\tif (user.getUserName().equals(userName) && user.getPassword().equals(password))\r\n\t\t\t{\r\n\t", "end": 7715, "score": 0.9852010607719421, "start": 7707, "tag": "USERNAME", "value": "userName" }, { "context": "返回resp\r\n\t\t\t\tSystem.out.println(\"login success: \" + userName +\" \"+ password+\" \"+ role);\r\n\t\t\t\t\r\n\t\t\t SimpleD", "end": 8029, "score": 0.9522374272346497, "start": 8021, "tag": "USERNAME", "value": "userName" }, { "context": "System.out.println(\"login failed, login info : \" + userName +\" \"+ password+\" \");\r\n\t\t\t}\r\n\t\t}\r\n\t\telse \r\n\t\t{\r\n\t", "end": 9183, "score": 0.9991457462310791, "start": 9175, "tag": "USERNAME", "value": "userName" }, { "context": "System.out.println(\"login failed, login info : \" + userName +\" \"+ password+\" \");\r\n\t\t}\r\n\t\tres.getHead().setMe", "end": 9366, "score": 0.9990265369415283, "start": 9358, "tag": "USERNAME", "value": "userName" } ]
null
[]
package com.douzi.xueyou.controller; import java.io.File; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Date; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.commons.io.FileUtils; import org.apache.log4j.Logger; 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.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.multipart.MultipartFile; import com.alibaba.fastjson.JSONObject; import com.douzi.xueyou.dao.Impl.MemberDaoImpl; import com.douzi.xueyou.model.Member; import com.douzi.xueyou.model.Student; import com.douzi.xueyou.model.Teacher; import com.douzi.xueyou.model.User; import com.douzi.xueyou.response.Response; import com.douzi.xueyou.response.ResponseFactory; import com.douzi.xueyou.service.Impl.StudentServiceImpl; import com.douzi.xueyou.service.Impl.TeacherServiceImpl; import com.douzi.xueyou.service.Impl.UserServiceImpl; import com.douzi.xueyou.tools.utils.FileUtil; import com.douzi.xueyou.tools.utils.MyConfiguration; import com.douzi.xueyou.tools.utils.StringTools; @Controller public class loginController { @Autowired private UserServiceImpl userService; @Autowired private StudentServiceImpl studentServiceImpl; @Autowired private TeacherServiceImpl teacherServiceImpl; private static final Logger log = Logger.getLogger(loginController.class); @Autowired private MyConfiguration Config; // 引用统一的参数配置类 @Autowired private MemberDaoImpl memberDaoImpl; @RequestMapping(value="/register", method = RequestMethod.POST) public @ResponseBody Response register(@RequestParam("userName")String userName,@RequestParam("<PASSWORD>")String <PASSWORD>,@RequestParam("role")String role){ //LoginResponse res= new LoginResponse(); Response res = new Response(); boolean isRegister = userService.isRegisted(userName); if(!isRegister)//没有注册,注册 { String appKey=StringTools.getRandomString(8); User user = new User(userName,password,appKey,Integer.parseInt(role),0); int userId = userService.save(user); System.out.println("register success: " + userName +" "+ password+" "+ role); //res.setDate(0); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String time = formatter.format(new Date()); //res.setData(appKey,time,role); res.getData().put("userId", userId); res.getData().put("appKey", appKey); res.getData().put("timeStamp", time); res.getData().put("role", role); if(role.equals("1"))//teacher { Teacher tmpTeacher = new Teacher( userId, userName); int id = teacherServiceImpl.save(tmpTeacher); tmpTeacher.setId(id); res.getData().put("teacher", tmpTeacher); } else if(role.equals("0"))//stu { Student tmpstu = new Student(userId); int id = studentServiceImpl.save(tmpstu); tmpstu.setId(id); res.getData().put("student", tmpstu); } SimpleDateFormat sdFormat=new SimpleDateFormat("yyyy年MM月dd日"); Calendar calendar=Calendar.getInstance(); java.util.Date d = null; try { d = sdFormat.parse(sdFormat.format(calendar.getTime())); } catch (Exception e) { e.printStackTrace(); } java.sql.Date date = new java.sql.Date(d.getTime()); Member f = new Member( userId,date); memberDaoImpl.insert(f); } else { res.getHead().setMessage("already registed"); res.getHead().setCode("1"); } res.getHead().setMethod("register"); return res; } @RequestMapping(value="seticon") public @ResponseBody Response seticon(@RequestParam("userId")int userId,@RequestParam("icon")MultipartFile pic,@RequestParam("appKey") String appKey) throws IOException { Response res = new Response("resetpass"); String imgDirectory = ""; String basePath = Config.filePath; String returnImgUrl = ""; long time = System.currentTimeMillis(); List<User> luser = userService.getById(userId); if(luser.size()==0) { res.getHead().setCode("1"); res.getHead().setMessage("error userId"); return res; } User user = luser.get(0); if(!pic.isEmpty()) { String picName = pic.getOriginalFilename(); String picNewName = time+picName; int schoolId = 0;//getSchoolId(String.valueOf(userId)); imgDirectory = FileUtil.getIconPath(String.valueOf(schoolId)); FileUtil.createDirectory(basePath + imgDirectory); log.info("Process file: " + basePath+imgDirectory+picName); String fullPath = basePath + imgDirectory + picNewName; FileUtils.copyInputStreamToFile(pic.getInputStream(), new File(fullPath)); // 生成返回的图片URL String tmpImgPath = FileUtil.getIconUrlPath(String.valueOf(schoolId)) + picNewName; returnImgUrl = FileUtil.getUrlPath(tmpImgPath); log.info(returnImgUrl); } user.setIcon(returnImgUrl); userService.update(user); res.getData().put("user",user); return res; } @RequestMapping(value="resetpass") public @ResponseBody Response resetPass(@RequestParam("userName")String userName,@RequestParam("newPass")String newpass) { User user = userService.getByName(userName); Response res = new Response("resetpass"); if(user!=null) { if(user.getUserName().equals(userName) ) { user.setPassword(<PASSWORD>); userService.update(user); } else { res.getHead().setCode("1"); res.getHead().setMessage("resetpass failed"); } } else { res.getHead().setCode("1"); res.getHead().setMessage("userName wrong"); } return res; } @RequestMapping(value="resetpassold") public @ResponseBody Response resetPassold(@RequestParam("userName")String userName,@RequestParam("appKey") String appKey,@RequestParam("role") String role,@RequestParam("newPass")String newpass) { User user = userService.getByName(userName); Response res = new Response("resetpass"); if(user!=null) { if(user.getUserName().equals(userName) && Integer.parseInt(role) == user.getRole()) { user.setPassword(<PASSWORD>); userService.update(user); } else { res.getHead().setCode("1"); res.getHead().setMessage("resetpass failed"); } } else { res.getHead().setCode("1"); res.getHead().setMessage("userName wrong"); } return res; } @RequestMapping(value="/logout") public @ResponseBody Response logout(@RequestParam("userName")String userName,@RequestParam("appKey") String appKey) { User user = userService.getByName(userName); Response res = new Response(); if(user!=null) { user.setUserState(0); user.setAppKey("@#^#&&#&!@#*&*^"); userService.update(user); } else { res.getHead().setCode("1"); res.getHead().setMessage("logout Failed"); } res.getHead().setMethod("logout"); return res; } @RequestMapping(value="/login", method = RequestMethod.POST) public @ResponseBody Response login(@RequestParam("userName")String userName,@RequestParam("password")String password){ log.info("log4j print test......"); User user = userService.getByName(userName); Response res = new Response(); if (user!=null) { log.info(user.toString()); System.out.println(user.toString()); if (user.getUserName().equals(userName) && user.getPassword().equals(password)) { //生成随机APP KEY String appKey=StringTools.getRandomString(8); //更新数据库 user.setAppKey(appKey); user.setUserState(1); userService.update(user); int role=user.getRole(); //返回resp System.out.println("login success: " + userName +" "+ password+" "+ role); SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); String time = formatter.format(new Date()); res.getData().put("userId", user.getId()); res.getData().put("appKey", appKey); res.getData().put("timeStamp", time); res.getData().put("role", role); //查找此用户的默认学校。 if(role>0){ //教师查教师表teacher List<Teacher> s= teacherServiceImpl.getAll(user.getId()+""); if(s.size()<1){ res.getData().put("schoolId", ""); res.getData().put("classId", ""); }else{ res.getData().put("schoolId", s.get(0).getSchoolId()); res.getData().put("classId", s.get(0).getClassId()); } }else{ List<Student> s= studentServiceImpl.getAllByUserId(user.getId()+""); if(s.size()<1){ res.getData().put("schoolId", ""); }else{ res.getData().put("schoolId", s.get(0).getSchoolId()); } } } else { res.getHead().setCode("1"); res.getHead().setMessage("wrong name or password"); System.out.println("login failed, login info : " + userName +" "+ password+" "); } } else { res.getHead().setCode("0"); res.getHead().setMessage("nouser"); System.out.println("login failed, login info : " + userName +" "+ password+" "); } res.getHead().setMethod("login"); //log.debug(res.toString()); return res; } @RequestMapping(value="updateRegId",method = RequestMethod.POST) @ResponseBody public Response updateRegId(String appKey,String regId){ int result=userService.updateRegId(appKey,regId); return result>0?ResponseFactory.newSuccessResponse():ResponseFactory.newErrorResponse("用户不存在或更新失败"); } @ResponseBody @RequestMapping("v1/commercial/getCommercialInfo") public Response getCommercialInfo(){ Map<String,Object> map = new HashMap<String,Object>(); map.put("postion", 1); map.put("photo","xy/imgs/schoolPage/3/151607598956791CC1EA2C382143D0B1892EEEDDAF869.jpg"); map.put("vendorName", "启迪学园"); map.put("vendorId", 153); List<Map<String,Object>> list = new ArrayList<Map<String,Object>>(); list.add(map); Response resp = ResponseFactory.newSuccessResponse(); resp.getData().put("commercialInfo", list); return resp; } }
10,504
0.675647
0.669274
315
30.87619
28.088984
196
false
false
0
0
0
0
66
0.006373
2.95873
false
false
1
1a198f0b77519524440b9582e351d6ab47343f10
38,963,943,314,444
5e73bca9757aa05ede9e53812fa3f873a3e1bd25
/dz11/src/main/java/ru/akozlovskiy/springdz11/domain/dto/BookDTO.java
d9b1ed1240f67f73cc07f75b344d7a22d39d315a
[]
no_license
ankiycoder/2019-08-otus-spring-akozlovskiy
https://github.com/ankiycoder/2019-08-otus-spring-akozlovskiy
e9efdfe1e871d3bc886a6cacacd62d54ea53bba9
c46fec2fc9d657fe228965b827b5a598e9b0dbc0
refs/heads/master
2021-06-22T04:40:05.942000
2020-05-31T18:37:25
2020-05-31T18:37:25
216,811,326
0
0
null
false
2021-04-26T19:39:01
2019-10-22T12:42:25
2020-06-16T15:23:55
2021-04-26T19:39:01
708
0
0
2
Java
false
false
package ru.akozlovskiy.springdz11.domain.dto; import javax.validation.constraints.NotBlank; import ru.akozlovskiy.springdz11.domain.Book; public class BookDTO { private String id; @NotBlank (message = "Поле Название обязательное") private String title; private String authorName; private String authorId; private String genre; public BookDTO(Book book) { this.id = book.getId(); this.title = book.getTitle(); if (book.getAuthor() != null) { this.authorName = book.getAuthor().getName(); this.authorId = book.getAuthor().getId(); } if (book.getGenre() != null) { this.genre = book.getGenre().getDescription(); } } public BookDTO() { } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getAuthorName() { return authorName; } public void setAuthorName(String authorName) { this.authorName = authorName; } public String getGenre() { return genre; } public void setGenre(String genre) { this.genre = genre; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getAuthorId() { return authorId; } public void setAuthorId(String authorId) { this.authorId = authorId; } }
UTF-8
Java
1,292
java
BookDTO.java
Java
[]
null
[]
package ru.akozlovskiy.springdz11.domain.dto; import javax.validation.constraints.NotBlank; import ru.akozlovskiy.springdz11.domain.Book; public class BookDTO { private String id; @NotBlank (message = "Поле Название обязательное") private String title; private String authorName; private String authorId; private String genre; public BookDTO(Book book) { this.id = book.getId(); this.title = book.getTitle(); if (book.getAuthor() != null) { this.authorName = book.getAuthor().getName(); this.authorId = book.getAuthor().getId(); } if (book.getGenre() != null) { this.genre = book.getGenre().getDescription(); } } public BookDTO() { } public String getTitle() { return title; } public void setTitle(String title) { this.title = title; } public String getAuthorName() { return authorName; } public void setAuthorName(String authorName) { this.authorName = authorName; } public String getGenre() { return genre; } public void setGenre(String genre) { this.genre = genre; } public String getId() { return id; } public void setId(String id) { this.id = id; } public String getAuthorId() { return authorId; } public void setAuthorId(String authorId) { this.authorId = authorId; } }
1,292
0.690852
0.687697
74
16.148649
16.473305
52
false
false
0
0
0
0
0
0
1.283784
false
false
1
debc4518c72083b1b82cc8e213b4f677f2a4580e
9,483,287,817,237
e203333d3972bc108272d996164dca678603cdf8
/src/test/java/com/exfantasy/template/test/TestCustomSQLProvider.java
6c38789429f800d9c57350a1fd1969905b3df6e2
[]
no_license
TommyYehCool/WebTemplate
https://github.com/TommyYehCool/WebTemplate
2c8521ec0532e2b4abb05402b11e274223511eb8
31f97fb8d0f3426923e4ca856c5d684db8909630
refs/heads/master
2020-05-22T02:44:23.765000
2017-04-14T01:31:09
2017-04-14T01:31:09
65,777,561
0
1
null
false
2016-08-23T08:56:05
2016-08-16T01:36:18
2016-08-16T02:10:44
2016-08-23T08:56:04
1,463
0
1
0
Java
null
null
package com.exfantasy.template.test; import org.junit.Ignore; import org.junit.Test; import com.exfantasy.template.mybatis.custom.CustomNBAGameSqlProvider; public class TestCustomSQLProvider { private CustomNBAGameSqlProvider sqlProvider = new CustomNBAGameSqlProvider(); @Test @Ignore public void testSelectNBAGameResps() { System.out.println(sqlProvider.selectNBAGameResps()); } @Test public void test() { System.out.println(sqlProvider.selectNBAGameRespByGameId()); } }
UTF-8
Java
512
java
TestCustomSQLProvider.java
Java
[]
null
[]
package com.exfantasy.template.test; import org.junit.Ignore; import org.junit.Test; import com.exfantasy.template.mybatis.custom.CustomNBAGameSqlProvider; public class TestCustomSQLProvider { private CustomNBAGameSqlProvider sqlProvider = new CustomNBAGameSqlProvider(); @Test @Ignore public void testSelectNBAGameResps() { System.out.println(sqlProvider.selectNBAGameResps()); } @Test public void test() { System.out.println(sqlProvider.selectNBAGameRespByGameId()); } }
512
0.761719
0.761719
21
22.380953
25.119669
79
false
false
0
0
0
0
0
0
0.952381
false
false
1
fe590fc740ff259563a82bb70a4b21d341a589e2
20,564,303,436,650
1ae1ed2b94a72696c86c9e1001dc94808374316c
/src/Vista/frmVentas.java
fdf75e0337af163eca460f2819a1794344fb348a
[]
no_license
DGOrganization/Sist_Farmacia
https://github.com/DGOrganization/Sist_Farmacia
8c0b7c73e5707afc436c5de3fdfd1a28df087ac9
4740d3fd13751003ab84a3b5f3064232bf12d72d
refs/heads/master
2021-01-23T02:11:09.741000
2017-07-06T15:37:10
2017-07-06T15:37:10
85,971,812
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package Vista; import configuracion.Gestionar; import controlador.Venta_controlador; import entidades.Cliente; import entidades.DetalleVenta; import entidades.Inventario; import entidades.Precio; import entidades.Venta; import java.awt.Frame; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.math.BigDecimal; import java.math.RoundingMode; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Locale; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JOptionPane; import javax.swing.Timer; import javax.swing.table.DefaultTableModel; /** * * @author Gerard */ public class frmVentas extends javax.swing.JInternalFrame { private Cliente clienteActual; private final Venta_controlador controlador; /** * Creates new form frmVentas */ public frmVentas() { initComponents(); jTableDetalleVenta.setDefaultRenderer(Object.class, new RenderizadorBoton()); jTableDetalleVenta.setRowHeight(25); Object[] columnas = {"Producto", "Cantidad", "Descuento (%)", "Precio ($)", "Importe", "¿Quitar?"}; DefaultTableModel modelo = new DefaultTableModelImpl(); modelo.setColumnIdentifiers(columnas); jTableDetalleVenta.setModel(modelo); txtEmpleado.setText(frmMenu.usuarioActual.getEmpleado().toString()); controlador = new Venta_controlador(); clienteActual = new Cliente(); ActionListener updateClockAction = (ActionEvent e) -> { Locale local = new Locale("es", "SV"); SimpleDateFormat formateador = new SimpleDateFormat("dd 'de' MMMM 'de' yyyy - hh:mm:ss a", local); lblReloj.setText(formateador.format(new Date()).trim()); }; Timer t = new Timer(100, updateClockAction); t.start(); } private void addDetalle(Inventario inventarioActual) { DefaultTableModel modelo = (DefaultTableModel) jTableDetalleVenta.getModel(); if (inventarioActual.getId() != 0) { boolean encontrado = false; for (int i = 0; i < modelo.getRowCount(); i++) { Inventario comparador = (Inventario) (modelo.getValueAt(i, 0)); if (comparador.getId() == inventarioActual.getId()) { encontrado = true; break; } } if (encontrado) { JOptionPane.showMessageDialog(this, "Ya se agrego este producto", "Sistemas de Compras y Ventas - Compras", JOptionPane.WARNING_MESSAGE); } else { Object[] nuevaFila = { inventarioActual, 1, 0, inventarioActual.getPrecio().get(0).getCantidad(), new BigDecimal("1").multiply(inventarioActual.getPrecio().get(0).getCantidad()), new JButton("¿Quitar?") }; modelo.addRow(nuevaFila); jTableDetalleVenta.setModel(modelo); /*for (int i = 0; i < modelo.getRowCount(); i++) { BigDecimal cantidad = new BigDecimal(JOptionPane.showInputDialog(this, "Digita la nueva cantidad a vender")); modelo.setValueAt(cantidad, fila, 1); BigDecimal importe = new BigDecimal(0); BigDecimal descuento = new BigDecimal(modelo.getValueAt(fila, 2).toString()); BigDecimal precio = new BigDecimal(modelo.getValueAt(fila, 3).toString()); BigDecimal subtotal = precio.multiply(cantidad); descuento = descuento.divide(new BigDecimal(100)); importe = importe.add(subtotal); descuento = descuento.multiply(importe); importe = importe.subtract(descuento).setScale(2, BigDecimal.ROUND_HALF_UP); modelo.setValueAt(importe, fila, 4); }*/ jTableDetalleVenta.setModel(modelo); lblProducto.setText("<Producto>"); calcularTotal(); } } } private void calcularTotal() { BigDecimal subtotal = BigDecimal.ZERO; BigDecimal iva = BigDecimal.ZERO; BigDecimal total = BigDecimal.ZERO; BigDecimal descuentoTotal = BigDecimal.ZERO; for (int i = 0; i < jTableDetalleVenta.getRowCount(); i++) { double cantidad = Double.parseDouble(jTableDetalleVenta.getValueAt(i, 1).toString()); double precio = Double.parseDouble(jTableDetalleVenta.getValueAt(i, 3).toString()); double descuento = Double.parseDouble(jTableDetalleVenta.getValueAt(i, 2).toString()); subtotal = subtotal.add(new BigDecimal(jTableDetalleVenta.getValueAt(i, 4).toString())); descuentoTotal = descuentoTotal.add(new BigDecimal(((cantidad * precio) * (descuento/100)))); } lblSubTotal.setText(subtotal.setScale(2, RoundingMode.HALF_UP).toString()); if(cboTipoVenta.getSelectedItem().toString().equals("Crédito Fiscal")){ iva = subtotal.multiply(new BigDecimal(0.13)); txtIVA.setText(iva.setScale(2, RoundingMode.HALF_UP).toString()); total = subtotal.add(iva); lblTotal.setText(total.setScale(2, RoundingMode.HALF_UP).toString()); txtDescuento.setText(descuentoTotal.setScale(2, RoundingMode.HALF_UP).toString()); } else { total = subtotal; txtIVA.setText("0.00"); lblTotal.setText(total.setScale(2, RoundingMode.HALF_UP).toString()); txtDescuento.setText(descuentoTotal.setScale(2, RoundingMode.HALF_UP).toString()); } } private void setImagen(String url) { File f = new File(url); if(f.exists() && !f.isDirectory()){ ImageIcon imagen = new ImageIcon(url); ImageIcon icono = new ImageIcon(imagen.getImage().getScaledInstance(lblImagen.getWidth(), lblImagen.getHeight(), 0)); lblImagen.setText(""); lblImagen.setIcon(icono); } else { lblImagen.setIcon(null); lblImagen.setText("El producto no tiene imagen"); } } private void cambiarCantidad(){ int fila = jTableDetalleVenta.getSelectedRow(); if (fila > -1) { DefaultTableModel modelo = (DefaultTableModel) jTableDetalleVenta.getModel(); BigDecimal cantidad = new BigDecimal(JOptionPane.showInputDialog(this, "Digita la nueva cantidad a vender")); modelo.setValueAt(cantidad, fila, 1); BigDecimal importe = new BigDecimal(0); BigDecimal descuento = new BigDecimal(modelo.getValueAt(fila, 2).toString()); BigDecimal precio = new BigDecimal(modelo.getValueAt(fila, 3).toString()); BigDecimal subtotal = precio.multiply(cantidad); descuento = descuento.divide(new BigDecimal(100)); importe = importe.add(subtotal); descuento = descuento.multiply(importe); importe = importe.subtract(descuento).setScale(2, BigDecimal.ROUND_HALF_UP); modelo.setValueAt(importe, fila, 4); jTableDetalleVenta.setModel(modelo); calcularTotal(); } } private void cambiarPrecio(){ int fila = jTableDetalleVenta.getSelectedRow(); if (fila > -1) { DefaultTableModel modelo = (DefaultTableModel) jTableDetalleVenta.getModel(); BigDecimal cantidad = new BigDecimal(modelo.getValueAt(fila, 1).toString()); BigDecimal importe = new BigDecimal(0); BigDecimal descuento = new BigDecimal(modelo.getValueAt(fila, 2).toString()); Inventario inv = (Inventario) modelo.getValueAt(fila, 0); JComboBox jcboDialog = new JComboBox(inv.getPrecio().toArray()); JOptionPane.showMessageDialog(this, jcboDialog, "Selecciona el precio con el cual se vendera", JOptionPane.INFORMATION_MESSAGE); BigDecimal precio = ((Precio) jcboDialog.getSelectedItem()).getCantidad(); modelo.setValueAt(precio, fila, 3); BigDecimal subtotal = precio.multiply(cantidad); descuento = descuento.divide(new BigDecimal(100)); importe = importe.add(subtotal); descuento = descuento.multiply(importe); importe = importe.subtract(descuento).setScale(2, BigDecimal.ROUND_HALF_UP); modelo.setValueAt(importe, fila, 4); jTableDetalleVenta.setModel(modelo); calcularTotal(); } } private void cambiarDescuento(){ int fila = jTableDetalleVenta.getSelectedRow(); if (fila > -1) { DefaultTableModel modelo = (DefaultTableModel) jTableDetalleVenta.getModel(); BigDecimal cantidad = new BigDecimal(modelo.getValueAt(fila, 1).toString()); BigDecimal importe = new BigDecimal(0); BigDecimal descuento = new BigDecimal(JOptionPane.showInputDialog(this, "Digita el descuento a otorgar en el producto \n Usa cantidades entre 0 y 100")); modelo.setValueAt(descuento, fila, 2); BigDecimal precio = new BigDecimal(modelo.getValueAt(fila, 3).toString()); BigDecimal subtotal = precio.multiply(cantidad); descuento = descuento.divide(new BigDecimal(100)); importe = importe.add(subtotal); descuento = descuento.multiply(importe); importe = importe.subtract(descuento).setScale(2, BigDecimal.ROUND_HALF_UP); modelo.setValueAt(importe, fila, 4); jTableDetalleVenta.setModel(modelo); calcularTotal(); } } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel2 = new javax.swing.JPanel(); jLabel20 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); lblReloj = new javax.swing.JLabel(); txtNFactura = new javax.swing.JTextField(); jPanel3 = new javax.swing.JPanel(); btnBuscarProducto = new javax.swing.JButton(); btnGuardarVenta = new javax.swing.JButton(); btnSeleccionarPrecio = new javax.swing.JButton(); btnCambiarCant = new javax.swing.JButton(); btnHacerDescuento = new javax.swing.JButton(); btnQuitarProducto = new javax.swing.JButton(); btnBuscarCliente = new javax.swing.JButton(); jPanel4 = new javax.swing.JPanel(); jPanel5 = new javax.swing.JPanel(); lblImagen = new javax.swing.JLabel(); jSeparator1 = new javax.swing.JSeparator(); jLabel2 = new javax.swing.JLabel(); cboTipoVenta = new javax.swing.JComboBox<>(); jLabel7 = new javax.swing.JLabel(); txtCliente = new javax.swing.JTextField(); lblProducto = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); lblCodigo = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); jSeparator2 = new javax.swing.JSeparator(); jScrollPane1 = new javax.swing.JScrollPane(); jTableDetalleVenta = new javax.swing.JTable(); jLabel10 = new javax.swing.JLabel(); txtEmpleado = new javax.swing.JTextField(); jLabel11 = new javax.swing.JLabel(); jLabel12 = new javax.swing.JLabel(); jLabel13 = new javax.swing.JLabel(); txtDescuento = new javax.swing.JTextField(); txtComentarios = new javax.swing.JTextField(); jSeparator3 = new javax.swing.JSeparator(); lblTotal = new javax.swing.JLabel(); jLabel14 = new javax.swing.JLabel(); txtIVA = new javax.swing.JTextField(); jSeparator4 = new javax.swing.JSeparator(); lblSubTotal = new javax.swing.JLabel(); jLabel15 = new javax.swing.JLabel(); setClosable(true); setMaximizable(true); setTitle("Punto de Venta"); setFrameIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos/inventario16.png"))); // NOI18N addInternalFrameListener(new javax.swing.event.InternalFrameListener() { public void internalFrameActivated(javax.swing.event.InternalFrameEvent evt) { } public void internalFrameClosed(javax.swing.event.InternalFrameEvent evt) { } public void internalFrameClosing(javax.swing.event.InternalFrameEvent evt) { } public void internalFrameDeactivated(javax.swing.event.InternalFrameEvent evt) { } public void internalFrameDeiconified(javax.swing.event.InternalFrameEvent evt) { } public void internalFrameIconified(javax.swing.event.InternalFrameEvent evt) { } public void internalFrameOpened(javax.swing.event.InternalFrameEvent evt) { formInternalFrameOpened(evt); } }); jPanel2.setBackground(new java.awt.Color(0, 153, 204)); jPanel2.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 2, true)); jLabel20.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N jLabel20.setText("N° de Factura:"); jLabel4.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos/compras16.png"))); // NOI18N jLabel4.setText("REGISTRRO DE VENTAS"); lblReloj.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N lblReloj.setText("<Hora y Fecha>"); txtNFactura.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N txtNFactura.setForeground(new java.awt.Color(0, 102, 153)); txtNFactura.setAlignmentX(1.0F); txtNFactura.setAlignmentY(1.0F); txtNFactura.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(51, 51, 51))); txtNFactura.setMargin(new java.awt.Insets(2, 3, 2, 3)); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(txtNFactura, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(82, 82, 82) .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(75, 75, 75) .addComponent(lblReloj, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap()) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(txtNFactura, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 23, Short.MAX_VALUE) .addComponent(jLabel20, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(1, 1, 1) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblReloj, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, 20, Short.MAX_VALUE)))) .addContainerGap()) ); jPanel3.setBackground(new java.awt.Color(153, 153, 153)); btnBuscarProducto.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N btnBuscarProducto.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos/search24.png"))); // NOI18N btnBuscarProducto.setText("Buscar"); btnBuscarProducto.setToolTipText("Buscar Producto"); btnBuscarProducto.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnBuscarProductoActionPerformed(evt); } }); btnGuardarVenta.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N btnGuardarVenta.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos/cerrarventa24.png"))); // NOI18N btnGuardarVenta.setText("Guardar"); btnGuardarVenta.setToolTipText("Cerrar Venta"); btnGuardarVenta.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnGuardarVentaActionPerformed(evt); } }); btnSeleccionarPrecio.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N btnSeleccionarPrecio.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos/numberp24.png"))); // NOI18N btnSeleccionarPrecio.setText("Precio"); btnSeleccionarPrecio.setToolTipText("Cambiar el Numero de Precio"); btnSeleccionarPrecio.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnSeleccionarPrecioActionPerformed(evt); } }); btnCambiarCant.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N btnCambiarCant.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos/cantidad24.png"))); // NOI18N btnCambiarCant.setText("Cantidad"); btnCambiarCant.setToolTipText("Modificar Cantidad"); btnCambiarCant.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnCambiarCantActionPerformed(evt); } }); btnHacerDescuento.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N btnHacerDescuento.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos/percent24.png"))); // NOI18N btnHacerDescuento.setText("Descuento"); btnHacerDescuento.setToolTipText("Aplicar Descuento"); btnHacerDescuento.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnHacerDescuentoActionPerformed(evt); } }); btnQuitarProducto.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N btnQuitarProducto.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos/del24.png"))); // NOI18N btnQuitarProducto.setText("Quitar"); btnQuitarProducto.setToolTipText("Remover Producto Seleccionado"); btnQuitarProducto.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnQuitarProductoActionPerformed(evt); } }); btnBuscarCliente.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N btnBuscarCliente.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos/client24.png"))); // NOI18N btnBuscarCliente.setText("Cliente"); btnBuscarCliente.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnBuscarClienteActionPerformed(evt); } }); javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addGap(14, 14, 14) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(btnHacerDescuento, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btnBuscarProducto, javax.swing.GroupLayout.DEFAULT_SIZE, 116, Short.MAX_VALUE) .addComponent(btnGuardarVenta, javax.swing.GroupLayout.DEFAULT_SIZE, 116, Short.MAX_VALUE) .addComponent(btnSeleccionarPrecio, javax.swing.GroupLayout.DEFAULT_SIZE, 116, Short.MAX_VALUE) .addComponent(btnCambiarCant, javax.swing.GroupLayout.DEFAULT_SIZE, 116, Short.MAX_VALUE) .addComponent(btnQuitarProducto, javax.swing.GroupLayout.DEFAULT_SIZE, 116, Short.MAX_VALUE) .addComponent(btnBuscarCliente, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(14, 14, 14)) ); jPanel3Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {btnBuscarProducto, btnCambiarCant, btnGuardarVenta, btnQuitarProducto, btnSeleccionarPrecio}); jPanel3Layout.setVerticalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addContainerGap(25, Short.MAX_VALUE) .addComponent(btnBuscarProducto, javax.swing.GroupLayout.DEFAULT_SIZE, 47, Short.MAX_VALUE) .addGap(20, 20, 20) .addComponent(btnGuardarVenta, javax.swing.GroupLayout.DEFAULT_SIZE, 47, Short.MAX_VALUE) .addGap(20, 20, 20) .addComponent(btnSeleccionarPrecio, javax.swing.GroupLayout.DEFAULT_SIZE, 47, Short.MAX_VALUE) .addGap(20, 20, 20) .addComponent(btnCambiarCant, javax.swing.GroupLayout.DEFAULT_SIZE, 47, Short.MAX_VALUE) .addGap(20, 20, 20) .addComponent(btnQuitarProducto, javax.swing.GroupLayout.DEFAULT_SIZE, 47, Short.MAX_VALUE) .addGap(20, 20, 20) .addComponent(btnHacerDescuento, javax.swing.GroupLayout.DEFAULT_SIZE, 47, Short.MAX_VALUE) .addGap(20, 20, 20) .addComponent(btnBuscarCliente, javax.swing.GroupLayout.DEFAULT_SIZE, 47, Short.MAX_VALUE) .addGap(43, 43, 43)) ); jPanel5.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(153, 153, 153))); lblImagen.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); lblImagen.setText("Selecciona un producto"); lblImagen.setToolTipText("Imagen del Producto"); javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); jPanel5.setLayout(jPanel5Layout); jPanel5Layout.setHorizontalGroup( jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel5Layout.createSequentialGroup() .addContainerGap() .addComponent(lblImagen) .addContainerGap()) ); jPanel5Layout.setVerticalGroup( jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel5Layout.createSequentialGroup() .addContainerGap() .addComponent(lblImagen, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) ); jLabel2.setText("Documento:"); cboTipoVenta.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N cboTipoVenta.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Ticket", "Factura", "Crédito Fiscal" })); cboTipoVenta.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { cboTipoVentaItemStateChanged(evt); } }); jLabel7.setText("Cliente:"); txtCliente.setEditable(false); txtCliente.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N txtCliente.setText("-"); txtCliente.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { txtClienteMouseClicked(evt); } }); txtCliente.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtClienteActionPerformed(evt); } }); lblProducto.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N lblProducto.setForeground(new java.awt.Color(0, 102, 255)); lblProducto.setText("<Producto>"); jLabel8.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N jLabel8.setText("Descripcion: "); lblCodigo.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N lblCodigo.setForeground(new java.awt.Color(0, 102, 255)); lblCodigo.setText("<codigo>"); jLabel9.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N jLabel9.setText("Código"); jTableDetalleVenta.setFont(new java.awt.Font("Lucida Sans", 1, 20)); // NOI18N jTableDetalleVenta.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null, null, null} }, new String [] { "Descripcion", "Cant", "Desc", "PrecioU", "Importe" } )); jTableDetalleVenta.setGridColor(new java.awt.Color(102, 153, 255)); jTableDetalleVenta.setSelectionBackground(new java.awt.Color(102, 102, 102)); jTableDetalleVenta.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jTableDetalleVentaMouseClicked(evt); } public void mouseEntered(java.awt.event.MouseEvent evt) { jTableDetalleVentaMouseEntered(evt); } }); jScrollPane1.setViewportView(jTableDetalleVenta); jLabel10.setText("Empleado:"); txtEmpleado.setEditable(false); txtEmpleado.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N txtEmpleado.setText("-"); txtEmpleado.setEnabled(false); jLabel11.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jLabel11.setText("I.V.A:"); jLabel12.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N jLabel12.setForeground(new java.awt.Color(0, 102, 153)); jLabel12.setText("Total:"); jLabel13.setText("Comentarios:"); txtDescuento.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N txtDescuento.setText("0.00"); txtDescuento.setToolTipText("Total Descontado"); txtDescuento.setEnabled(false); txtComentarios.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N lblTotal.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N lblTotal.setText("0.00"); jLabel14.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jLabel14.setText("Descuento:"); txtIVA.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N txtIVA.setText("0.00"); txtIVA.setToolTipText("Total Descontado"); txtIVA.setEnabled(false); jSeparator4.setOrientation(javax.swing.SwingConstants.VERTICAL); lblSubTotal.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N lblSubTotal.setText("0.00"); jLabel15.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N jLabel15.setForeground(new java.awt.Color(0, 102, 153)); jLabel15.setText("Subtotal:"); javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); jPanel4.setLayout(jPanel4Layout); jPanel4Layout.setHorizontalGroup( jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup() .addContainerGap(147, Short.MAX_VALUE) .addComponent(jLabel15) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(lblSubTotal, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jLabel12) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(lblTotal, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) .addGroup(jPanel4Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup() .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup() .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup() .addComponent(cboTipoVenta, javax.swing.GroupLayout.PREFERRED_SIZE, 144, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(jPanel4Layout.createSequentialGroup() .addComponent(txtCliente) .addGap(12, 12, 12)))) .addGroup(jPanel4Layout.createSequentialGroup() .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup() .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(lblCodigo, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(34, 34, 34) .addComponent(jLabel8) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(lblProducto, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addComponent(jSeparator2)) .addGap(12, 12, 12)) .addGroup(jPanel4Layout.createSequentialGroup() .addComponent(jSeparator1) .addContainerGap()))) .addGroup(jPanel4Layout.createSequentialGroup() .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jSeparator3) .addComponent(jScrollPane1) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup() .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel13, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(txtComentarios) .addComponent(txtEmpleado)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jSeparator4, javax.swing.GroupLayout.PREFERRED_SIZE, 13, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel14) .addComponent(jLabel11)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(txtIVA, javax.swing.GroupLayout.DEFAULT_SIZE, 123, Short.MAX_VALUE) .addComponent(txtDescuento)))) .addGap(12, 12, 12)))) ); jPanel4Layout.setVerticalGroup( jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup() .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel4Layout.createSequentialGroup() .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(cboTipoVenta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel7) .addComponent(txtCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(7, 7, 7) .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(1, 1, 1) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel9) .addComponent(lblCodigo) .addComponent(lblProducto) .addComponent(jLabel8)))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 283, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup() .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txtEmpleado, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txtDescuento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(7, 7, 7) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txtComentarios) .addComponent(jLabel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(txtIVA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jLabel13, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addComponent(jSeparator4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(6, 6, 6) .addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lblTotal)) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel15, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lblSubTotal))) .addContainerGap()) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(0, 0, 0)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void btnBuscarProductoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarProductoActionPerformed // TODO add your handling code here: Frame f = JOptionPane.getFrameForComponent(this); frmAgregarProducto frm = new frmAgregarProducto(f, true); frm.setLocationRelativeTo(null); frm.setVisible(true); if (frm.isVisible() == false) { if (frm.getInv_seleccion().getStock().compareTo(BigDecimal.ZERO) > 0) { addDetalle(frm.getInv_seleccion()); } else { JOptionPane.showMessageDialog( this, "No hay existencias del producto " + frm.getInv_seleccion() + " para vender", this.getTitle(), JOptionPane.WARNING_MESSAGE ); } frm.dispose(); } }//GEN-LAST:event_btnBuscarProductoActionPerformed private void btnSeleccionarPrecioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSeleccionarPrecioActionPerformed // TODO add your handling code here: cambiarPrecio(); }//GEN-LAST:event_btnSeleccionarPrecioActionPerformed private void btnGuardarVentaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGuardarVentaActionPerformed // TODO add your handling code here: Frame f = JOptionPane.getFrameForComponent(this); frmPagoVenta frm = new frmPagoVenta(f, true); Venta venta = new Venta(); venta.setCliente(clienteActual); venta.setEmpleado(frmMenu.usuarioActual.getEmpleado()); venta.setObservacion(txtComentarios.getText()); venta.setFecha(new Date()); venta.setTotal(new BigDecimal(lblTotal.getText())); venta.setLetras(new Validaciones().Convertir(lblTotal.getText(), true)); venta.setSubtotal(new BigDecimal(lblSubTotal.getText())); venta.setIva(new BigDecimal(txtIVA.getText())); List<DetalleVenta> detalles = new ArrayList<>(); for (int i = 0; i < jTableDetalleVenta.getRowCount(); i++) { DetalleVenta detalle = new DetalleVenta(); Inventario extraer = (Inventario) jTableDetalleVenta.getValueAt(i, 0); detalle.setInventario(extraer); detalle.setCantidad(new BigDecimal(jTableDetalleVenta.getValueAt(i, 1).toString())); detalle.setDescuento(Integer.parseInt(jTableDetalleVenta.getValueAt(i, 2).toString())); detalle.setPrecio(new BigDecimal(jTableDetalleVenta.getValueAt(i, 3).toString())); detalle.setImporte(new BigDecimal(jTableDetalleVenta.getValueAt(i, 4).toString())); detalles.add(detalle); } venta.setDetalle(detalles); if (txtNFactura.getText().isEmpty()) { JOptionPane.showMessageDialog(this, "La venta es por Credito Fiscal o Factura de consumidor final y es obligatorio poner numero de factura", new Gestionar().Leer("Empresa", "nombre"), JOptionPane.WARNING_MESSAGE); } else { venta.setNFactura(txtNFactura.getText()); if (jTableDetalleVenta.getRowCount() > 0 || clienteActual.getId() > 0) { frm.setVentaActual(venta); frm.setLocationRelativeTo(null); frm.setVisible(true); if (frm.isVisible() == false) { if(frm.getVentaActual().getCambio().compareTo(BigDecimal.ZERO) > -1){ venta.setCambio(frm.getVentaActual().getCambio()); if (controlador.Registrar(venta)) { JOptionPane.showMessageDialog(this, "Venta registrada", this.title, JOptionPane.INFORMATION_MESSAGE); Validaciones.reiniciarJTable(jTableDetalleVenta); txtCliente.setText(""); txtComentarios.setText(""); lblTotal.setText("0.00"); lblImagen.setIcon(null); lblImagen.setText("Selecciona un producto"); txtNFactura.setText(""); lblCodigo.setText(""); } } } } else if (clienteActual.getId() == 0) { JOptionPane.showMessageDialog(this, "Agrega al cliente", new Gestionar().Leer("Empresa", "nombre"), JOptionPane.WARNING_MESSAGE); System.out.println("El Cliente"); } else { JOptionPane.showMessageDialog(this, "Agrega Productos primero", new Gestionar().Leer("Empresa", "nombre"), JOptionPane.WARNING_MESSAGE); }System.out.println("El Productos"); } }//GEN-LAST:event_btnGuardarVentaActionPerformed private void jTableDetalleVentaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTableDetalleVentaMouseClicked // TODO add your handling code here: int fila = jTableDetalleVenta.getSelectedRow(); if (fila > -1) { Inventario inv = (Inventario) jTableDetalleVenta.getValueAt(fila, 0); if(inv.getImagen().getId() == 0){ setImagen(""); } else { setImagen(inv.getImagen().getUrl()); } lblProducto.setText(inv.getArticulo().toString()); lblCodigo.setText(inv.getCodigoInterno()); int columna = jTableDetalleVenta.getSelectedColumn(); if (jTableDetalleVenta.getValueAt(fila, columna) instanceof JButton) { int respuesta = JOptionPane.showConfirmDialog(this, "¿Estas seguro de eliminar estos datos?", new Gestionar().Leer("Empresa", "nombre"), JOptionPane.YES_NO_OPTION); if (respuesta == JOptionPane.YES_OPTION) { DefaultTableModel modelo = (DefaultTableModel) jTableDetalleVenta.getModel(); modelo.removeRow(fila); jTableDetalleVenta.setModel(modelo); calcularTotal(); } } else if(columna == 1){ cambiarCantidad(); } else if(columna == 2){ cambiarDescuento(); } else if(columna == 3){ cambiarPrecio(); } } else { JOptionPane.showMessageDialog(this, "Selecciona primero", new Gestionar().Leer("Empresa", "nombre"), JOptionPane.WARNING_MESSAGE); } }//GEN-LAST:event_jTableDetalleVentaMouseClicked private void btnCambiarCantActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCambiarCantActionPerformed // TODO add your handling code here: cambiarCantidad(); }//GEN-LAST:event_btnCambiarCantActionPerformed private void btnHacerDescuentoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnHacerDescuentoActionPerformed // TODO add your handling code here: cambiarDescuento(); }//GEN-LAST:event_btnHacerDescuentoActionPerformed private void btnBuscarClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarClienteActionPerformed // TODO add your handling code here: Frame f = JOptionPane.getFrameForComponent(this); frmAgregarCliente frm = new frmAgregarCliente(f, true); frm.setVisible(true); if (frm.isVisible() == false) { if(frm.getCliente().getId() != 0){ clienteActual = frm.getCliente(); txtCliente.setText(clienteActual.toString()); } frm.dispose(); } }//GEN-LAST:event_btnBuscarClienteActionPerformed private void formInternalFrameOpened(javax.swing.event.InternalFrameEvent evt) {//GEN-FIRST:event_formInternalFrameOpened // TODO add your handling code here: }//GEN-LAST:event_formInternalFrameOpened private void txtClienteMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_txtClienteMouseClicked // TODO add your handling code here: Frame f = JOptionPane.getFrameForComponent(this); frmAgregarCliente frm = new frmAgregarCliente(f, true); frm.setVisible(true); if (frm.isVisible() == false) { clienteActual = frm.getCliente(); txtCliente.setText(clienteActual.toString()); frm.dispose(); } }//GEN-LAST:event_txtClienteMouseClicked private void cboTipoVentaItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cboTipoVentaItemStateChanged // TODO add your handling code here: if(cboTipoVenta.getSelectedItem().toString().equals("Ticket")){ jLabel20.setText("N° Correlativo"); } else { jLabel20.setText("N° Factura"); } calcularTotal(); }//GEN-LAST:event_cboTipoVentaItemStateChanged private void txtClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtClienteActionPerformed // TODO add your handling code here: Frame f = JOptionPane.getFrameForComponent(this); frmAgregarCliente frm = new frmAgregarCliente(f, true); frm.setVisible(true); if (frm.isVisible() == false) { clienteActual = frm.getCliente(); txtCliente.setText(clienteActual.toString()); frm.dispose(); } }//GEN-LAST:event_txtClienteActionPerformed private void btnQuitarProductoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnQuitarProductoActionPerformed // TODO add your handling code here: }//GEN-LAST:event_btnQuitarProductoActionPerformed private void jTableDetalleVentaMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTableDetalleVentaMouseEntered // TODO add your handling code here: }//GEN-LAST:event_jTableDetalleVentaMouseEntered // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnBuscarCliente; private javax.swing.JButton btnBuscarProducto; private javax.swing.JButton btnCambiarCant; private javax.swing.JButton btnGuardarVenta; private javax.swing.JButton btnHacerDescuento; private javax.swing.JButton btnQuitarProducto; private javax.swing.JButton btnSeleccionarPrecio; private javax.swing.JComboBox<String> cboTipoVenta; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; private javax.swing.JLabel jLabel12; private javax.swing.JLabel jLabel13; private javax.swing.JLabel jLabel14; private javax.swing.JLabel jLabel15; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel20; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; private javax.swing.JPanel jPanel4; private javax.swing.JPanel jPanel5; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JSeparator jSeparator1; private javax.swing.JSeparator jSeparator2; private javax.swing.JSeparator jSeparator3; private javax.swing.JSeparator jSeparator4; private javax.swing.JTable jTableDetalleVenta; private javax.swing.JLabel lblCodigo; private javax.swing.JLabel lblImagen; private javax.swing.JLabel lblProducto; private javax.swing.JLabel lblReloj; private javax.swing.JLabel lblSubTotal; private javax.swing.JLabel lblTotal; private javax.swing.JTextField txtCliente; private javax.swing.JTextField txtComentarios; private javax.swing.JTextField txtDescuento; private javax.swing.JTextField txtEmpleado; private javax.swing.JTextField txtIVA; private javax.swing.JTextField txtNFactura; // End of variables declaration//GEN-END:variables }
UTF-8
Java
54,885
java
frmVentas.java
Java
[ { "context": ".swing.table.DefaultTableModel;\n\n/**\n *\n * @author Gerard\n */\npublic class frmVentas extends javax.swing.JI", "end": 932, "score": 0.999657392501831, "start": 926, "tag": "NAME", "value": "Gerard" } ]
null
[]
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package Vista; import configuracion.Gestionar; import controlador.Venta_controlador; import entidades.Cliente; import entidades.DetalleVenta; import entidades.Inventario; import entidades.Precio; import entidades.Venta; import java.awt.Frame; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.io.File; import java.math.BigDecimal; import java.math.RoundingMode; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; import java.util.Locale; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JOptionPane; import javax.swing.Timer; import javax.swing.table.DefaultTableModel; /** * * @author Gerard */ public class frmVentas extends javax.swing.JInternalFrame { private Cliente clienteActual; private final Venta_controlador controlador; /** * Creates new form frmVentas */ public frmVentas() { initComponents(); jTableDetalleVenta.setDefaultRenderer(Object.class, new RenderizadorBoton()); jTableDetalleVenta.setRowHeight(25); Object[] columnas = {"Producto", "Cantidad", "Descuento (%)", "Precio ($)", "Importe", "¿Quitar?"}; DefaultTableModel modelo = new DefaultTableModelImpl(); modelo.setColumnIdentifiers(columnas); jTableDetalleVenta.setModel(modelo); txtEmpleado.setText(frmMenu.usuarioActual.getEmpleado().toString()); controlador = new Venta_controlador(); clienteActual = new Cliente(); ActionListener updateClockAction = (ActionEvent e) -> { Locale local = new Locale("es", "SV"); SimpleDateFormat formateador = new SimpleDateFormat("dd 'de' MMMM 'de' yyyy - hh:mm:ss a", local); lblReloj.setText(formateador.format(new Date()).trim()); }; Timer t = new Timer(100, updateClockAction); t.start(); } private void addDetalle(Inventario inventarioActual) { DefaultTableModel modelo = (DefaultTableModel) jTableDetalleVenta.getModel(); if (inventarioActual.getId() != 0) { boolean encontrado = false; for (int i = 0; i < modelo.getRowCount(); i++) { Inventario comparador = (Inventario) (modelo.getValueAt(i, 0)); if (comparador.getId() == inventarioActual.getId()) { encontrado = true; break; } } if (encontrado) { JOptionPane.showMessageDialog(this, "Ya se agrego este producto", "Sistemas de Compras y Ventas - Compras", JOptionPane.WARNING_MESSAGE); } else { Object[] nuevaFila = { inventarioActual, 1, 0, inventarioActual.getPrecio().get(0).getCantidad(), new BigDecimal("1").multiply(inventarioActual.getPrecio().get(0).getCantidad()), new JButton("¿Quitar?") }; modelo.addRow(nuevaFila); jTableDetalleVenta.setModel(modelo); /*for (int i = 0; i < modelo.getRowCount(); i++) { BigDecimal cantidad = new BigDecimal(JOptionPane.showInputDialog(this, "Digita la nueva cantidad a vender")); modelo.setValueAt(cantidad, fila, 1); BigDecimal importe = new BigDecimal(0); BigDecimal descuento = new BigDecimal(modelo.getValueAt(fila, 2).toString()); BigDecimal precio = new BigDecimal(modelo.getValueAt(fila, 3).toString()); BigDecimal subtotal = precio.multiply(cantidad); descuento = descuento.divide(new BigDecimal(100)); importe = importe.add(subtotal); descuento = descuento.multiply(importe); importe = importe.subtract(descuento).setScale(2, BigDecimal.ROUND_HALF_UP); modelo.setValueAt(importe, fila, 4); }*/ jTableDetalleVenta.setModel(modelo); lblProducto.setText("<Producto>"); calcularTotal(); } } } private void calcularTotal() { BigDecimal subtotal = BigDecimal.ZERO; BigDecimal iva = BigDecimal.ZERO; BigDecimal total = BigDecimal.ZERO; BigDecimal descuentoTotal = BigDecimal.ZERO; for (int i = 0; i < jTableDetalleVenta.getRowCount(); i++) { double cantidad = Double.parseDouble(jTableDetalleVenta.getValueAt(i, 1).toString()); double precio = Double.parseDouble(jTableDetalleVenta.getValueAt(i, 3).toString()); double descuento = Double.parseDouble(jTableDetalleVenta.getValueAt(i, 2).toString()); subtotal = subtotal.add(new BigDecimal(jTableDetalleVenta.getValueAt(i, 4).toString())); descuentoTotal = descuentoTotal.add(new BigDecimal(((cantidad * precio) * (descuento/100)))); } lblSubTotal.setText(subtotal.setScale(2, RoundingMode.HALF_UP).toString()); if(cboTipoVenta.getSelectedItem().toString().equals("Crédito Fiscal")){ iva = subtotal.multiply(new BigDecimal(0.13)); txtIVA.setText(iva.setScale(2, RoundingMode.HALF_UP).toString()); total = subtotal.add(iva); lblTotal.setText(total.setScale(2, RoundingMode.HALF_UP).toString()); txtDescuento.setText(descuentoTotal.setScale(2, RoundingMode.HALF_UP).toString()); } else { total = subtotal; txtIVA.setText("0.00"); lblTotal.setText(total.setScale(2, RoundingMode.HALF_UP).toString()); txtDescuento.setText(descuentoTotal.setScale(2, RoundingMode.HALF_UP).toString()); } } private void setImagen(String url) { File f = new File(url); if(f.exists() && !f.isDirectory()){ ImageIcon imagen = new ImageIcon(url); ImageIcon icono = new ImageIcon(imagen.getImage().getScaledInstance(lblImagen.getWidth(), lblImagen.getHeight(), 0)); lblImagen.setText(""); lblImagen.setIcon(icono); } else { lblImagen.setIcon(null); lblImagen.setText("El producto no tiene imagen"); } } private void cambiarCantidad(){ int fila = jTableDetalleVenta.getSelectedRow(); if (fila > -1) { DefaultTableModel modelo = (DefaultTableModel) jTableDetalleVenta.getModel(); BigDecimal cantidad = new BigDecimal(JOptionPane.showInputDialog(this, "Digita la nueva cantidad a vender")); modelo.setValueAt(cantidad, fila, 1); BigDecimal importe = new BigDecimal(0); BigDecimal descuento = new BigDecimal(modelo.getValueAt(fila, 2).toString()); BigDecimal precio = new BigDecimal(modelo.getValueAt(fila, 3).toString()); BigDecimal subtotal = precio.multiply(cantidad); descuento = descuento.divide(new BigDecimal(100)); importe = importe.add(subtotal); descuento = descuento.multiply(importe); importe = importe.subtract(descuento).setScale(2, BigDecimal.ROUND_HALF_UP); modelo.setValueAt(importe, fila, 4); jTableDetalleVenta.setModel(modelo); calcularTotal(); } } private void cambiarPrecio(){ int fila = jTableDetalleVenta.getSelectedRow(); if (fila > -1) { DefaultTableModel modelo = (DefaultTableModel) jTableDetalleVenta.getModel(); BigDecimal cantidad = new BigDecimal(modelo.getValueAt(fila, 1).toString()); BigDecimal importe = new BigDecimal(0); BigDecimal descuento = new BigDecimal(modelo.getValueAt(fila, 2).toString()); Inventario inv = (Inventario) modelo.getValueAt(fila, 0); JComboBox jcboDialog = new JComboBox(inv.getPrecio().toArray()); JOptionPane.showMessageDialog(this, jcboDialog, "Selecciona el precio con el cual se vendera", JOptionPane.INFORMATION_MESSAGE); BigDecimal precio = ((Precio) jcboDialog.getSelectedItem()).getCantidad(); modelo.setValueAt(precio, fila, 3); BigDecimal subtotal = precio.multiply(cantidad); descuento = descuento.divide(new BigDecimal(100)); importe = importe.add(subtotal); descuento = descuento.multiply(importe); importe = importe.subtract(descuento).setScale(2, BigDecimal.ROUND_HALF_UP); modelo.setValueAt(importe, fila, 4); jTableDetalleVenta.setModel(modelo); calcularTotal(); } } private void cambiarDescuento(){ int fila = jTableDetalleVenta.getSelectedRow(); if (fila > -1) { DefaultTableModel modelo = (DefaultTableModel) jTableDetalleVenta.getModel(); BigDecimal cantidad = new BigDecimal(modelo.getValueAt(fila, 1).toString()); BigDecimal importe = new BigDecimal(0); BigDecimal descuento = new BigDecimal(JOptionPane.showInputDialog(this, "Digita el descuento a otorgar en el producto \n Usa cantidades entre 0 y 100")); modelo.setValueAt(descuento, fila, 2); BigDecimal precio = new BigDecimal(modelo.getValueAt(fila, 3).toString()); BigDecimal subtotal = precio.multiply(cantidad); descuento = descuento.divide(new BigDecimal(100)); importe = importe.add(subtotal); descuento = descuento.multiply(importe); importe = importe.subtract(descuento).setScale(2, BigDecimal.ROUND_HALF_UP); modelo.setValueAt(importe, fila, 4); jTableDetalleVenta.setModel(modelo); calcularTotal(); } } /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanel2 = new javax.swing.JPanel(); jLabel20 = new javax.swing.JLabel(); jLabel4 = new javax.swing.JLabel(); lblReloj = new javax.swing.JLabel(); txtNFactura = new javax.swing.JTextField(); jPanel3 = new javax.swing.JPanel(); btnBuscarProducto = new javax.swing.JButton(); btnGuardarVenta = new javax.swing.JButton(); btnSeleccionarPrecio = new javax.swing.JButton(); btnCambiarCant = new javax.swing.JButton(); btnHacerDescuento = new javax.swing.JButton(); btnQuitarProducto = new javax.swing.JButton(); btnBuscarCliente = new javax.swing.JButton(); jPanel4 = new javax.swing.JPanel(); jPanel5 = new javax.swing.JPanel(); lblImagen = new javax.swing.JLabel(); jSeparator1 = new javax.swing.JSeparator(); jLabel2 = new javax.swing.JLabel(); cboTipoVenta = new javax.swing.JComboBox<>(); jLabel7 = new javax.swing.JLabel(); txtCliente = new javax.swing.JTextField(); lblProducto = new javax.swing.JLabel(); jLabel8 = new javax.swing.JLabel(); lblCodigo = new javax.swing.JLabel(); jLabel9 = new javax.swing.JLabel(); jSeparator2 = new javax.swing.JSeparator(); jScrollPane1 = new javax.swing.JScrollPane(); jTableDetalleVenta = new javax.swing.JTable(); jLabel10 = new javax.swing.JLabel(); txtEmpleado = new javax.swing.JTextField(); jLabel11 = new javax.swing.JLabel(); jLabel12 = new javax.swing.JLabel(); jLabel13 = new javax.swing.JLabel(); txtDescuento = new javax.swing.JTextField(); txtComentarios = new javax.swing.JTextField(); jSeparator3 = new javax.swing.JSeparator(); lblTotal = new javax.swing.JLabel(); jLabel14 = new javax.swing.JLabel(); txtIVA = new javax.swing.JTextField(); jSeparator4 = new javax.swing.JSeparator(); lblSubTotal = new javax.swing.JLabel(); jLabel15 = new javax.swing.JLabel(); setClosable(true); setMaximizable(true); setTitle("Punto de Venta"); setFrameIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos/inventario16.png"))); // NOI18N addInternalFrameListener(new javax.swing.event.InternalFrameListener() { public void internalFrameActivated(javax.swing.event.InternalFrameEvent evt) { } public void internalFrameClosed(javax.swing.event.InternalFrameEvent evt) { } public void internalFrameClosing(javax.swing.event.InternalFrameEvent evt) { } public void internalFrameDeactivated(javax.swing.event.InternalFrameEvent evt) { } public void internalFrameDeiconified(javax.swing.event.InternalFrameEvent evt) { } public void internalFrameIconified(javax.swing.event.InternalFrameEvent evt) { } public void internalFrameOpened(javax.swing.event.InternalFrameEvent evt) { formInternalFrameOpened(evt); } }); jPanel2.setBackground(new java.awt.Color(0, 153, 204)); jPanel2.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(0, 0, 0), 2, true)); jLabel20.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N jLabel20.setText("N° de Factura:"); jLabel4.setFont(new java.awt.Font("Tahoma", 1, 14)); // NOI18N jLabel4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos/compras16.png"))); // NOI18N jLabel4.setText("REGISTRRO DE VENTAS"); lblReloj.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N lblReloj.setText("<Hora y Fecha>"); txtNFactura.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N txtNFactura.setForeground(new java.awt.Color(0, 102, 153)); txtNFactura.setAlignmentX(1.0F); txtNFactura.setAlignmentY(1.0F); txtNFactura.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(51, 51, 51))); txtNFactura.setMargin(new java.awt.Insets(2, 3, 2, 3)); javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2); jPanel2.setLayout(jPanel2Layout); jPanel2Layout.setHorizontalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() .addComponent(jLabel20, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(txtNFactura, javax.swing.GroupLayout.PREFERRED_SIZE, 175, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(82, 82, 82) .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 200, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(75, 75, 75) .addComponent(lblReloj, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addContainerGap()) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(txtNFactura, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 23, Short.MAX_VALUE) .addComponent(jLabel20, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(jPanel2Layout.createSequentialGroup() .addGap(1, 1, 1) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(lblReloj, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, 20, Short.MAX_VALUE)))) .addContainerGap()) ); jPanel3.setBackground(new java.awt.Color(153, 153, 153)); btnBuscarProducto.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N btnBuscarProducto.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos/search24.png"))); // NOI18N btnBuscarProducto.setText("Buscar"); btnBuscarProducto.setToolTipText("Buscar Producto"); btnBuscarProducto.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnBuscarProductoActionPerformed(evt); } }); btnGuardarVenta.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N btnGuardarVenta.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos/cerrarventa24.png"))); // NOI18N btnGuardarVenta.setText("Guardar"); btnGuardarVenta.setToolTipText("Cerrar Venta"); btnGuardarVenta.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnGuardarVentaActionPerformed(evt); } }); btnSeleccionarPrecio.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N btnSeleccionarPrecio.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos/numberp24.png"))); // NOI18N btnSeleccionarPrecio.setText("Precio"); btnSeleccionarPrecio.setToolTipText("Cambiar el Numero de Precio"); btnSeleccionarPrecio.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnSeleccionarPrecioActionPerformed(evt); } }); btnCambiarCant.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N btnCambiarCant.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos/cantidad24.png"))); // NOI18N btnCambiarCant.setText("Cantidad"); btnCambiarCant.setToolTipText("Modificar Cantidad"); btnCambiarCant.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnCambiarCantActionPerformed(evt); } }); btnHacerDescuento.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N btnHacerDescuento.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos/percent24.png"))); // NOI18N btnHacerDescuento.setText("Descuento"); btnHacerDescuento.setToolTipText("Aplicar Descuento"); btnHacerDescuento.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnHacerDescuentoActionPerformed(evt); } }); btnQuitarProducto.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N btnQuitarProducto.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos/del24.png"))); // NOI18N btnQuitarProducto.setText("Quitar"); btnQuitarProducto.setToolTipText("Remover Producto Seleccionado"); btnQuitarProducto.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnQuitarProductoActionPerformed(evt); } }); btnBuscarCliente.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N btnBuscarCliente.setIcon(new javax.swing.ImageIcon(getClass().getResource("/Iconos/client24.png"))); // NOI18N btnBuscarCliente.setText("Cliente"); btnBuscarCliente.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnBuscarClienteActionPerformed(evt); } }); javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3); jPanel3.setLayout(jPanel3Layout); jPanel3Layout.setHorizontalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addGap(14, 14, 14) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(btnHacerDescuento, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btnBuscarProducto, javax.swing.GroupLayout.DEFAULT_SIZE, 116, Short.MAX_VALUE) .addComponent(btnGuardarVenta, javax.swing.GroupLayout.DEFAULT_SIZE, 116, Short.MAX_VALUE) .addComponent(btnSeleccionarPrecio, javax.swing.GroupLayout.DEFAULT_SIZE, 116, Short.MAX_VALUE) .addComponent(btnCambiarCant, javax.swing.GroupLayout.DEFAULT_SIZE, 116, Short.MAX_VALUE) .addComponent(btnQuitarProducto, javax.swing.GroupLayout.DEFAULT_SIZE, 116, Short.MAX_VALUE) .addComponent(btnBuscarCliente, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(14, 14, 14)) ); jPanel3Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {btnBuscarProducto, btnCambiarCant, btnGuardarVenta, btnQuitarProducto, btnSeleccionarPrecio}); jPanel3Layout.setVerticalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addContainerGap(25, Short.MAX_VALUE) .addComponent(btnBuscarProducto, javax.swing.GroupLayout.DEFAULT_SIZE, 47, Short.MAX_VALUE) .addGap(20, 20, 20) .addComponent(btnGuardarVenta, javax.swing.GroupLayout.DEFAULT_SIZE, 47, Short.MAX_VALUE) .addGap(20, 20, 20) .addComponent(btnSeleccionarPrecio, javax.swing.GroupLayout.DEFAULT_SIZE, 47, Short.MAX_VALUE) .addGap(20, 20, 20) .addComponent(btnCambiarCant, javax.swing.GroupLayout.DEFAULT_SIZE, 47, Short.MAX_VALUE) .addGap(20, 20, 20) .addComponent(btnQuitarProducto, javax.swing.GroupLayout.DEFAULT_SIZE, 47, Short.MAX_VALUE) .addGap(20, 20, 20) .addComponent(btnHacerDescuento, javax.swing.GroupLayout.DEFAULT_SIZE, 47, Short.MAX_VALUE) .addGap(20, 20, 20) .addComponent(btnBuscarCliente, javax.swing.GroupLayout.DEFAULT_SIZE, 47, Short.MAX_VALUE) .addGap(43, 43, 43)) ); jPanel5.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(153, 153, 153))); lblImagen.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); lblImagen.setText("Selecciona un producto"); lblImagen.setToolTipText("Imagen del Producto"); javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5); jPanel5.setLayout(jPanel5Layout); jPanel5Layout.setHorizontalGroup( jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel5Layout.createSequentialGroup() .addContainerGap() .addComponent(lblImagen) .addContainerGap()) ); jPanel5Layout.setVerticalGroup( jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel5Layout.createSequentialGroup() .addContainerGap() .addComponent(lblImagen, javax.swing.GroupLayout.PREFERRED_SIZE, 84, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) ); jLabel2.setText("Documento:"); cboTipoVenta.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N cboTipoVenta.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "Ticket", "Factura", "Crédito Fiscal" })); cboTipoVenta.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { cboTipoVentaItemStateChanged(evt); } }); jLabel7.setText("Cliente:"); txtCliente.setEditable(false); txtCliente.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N txtCliente.setText("-"); txtCliente.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { txtClienteMouseClicked(evt); } }); txtCliente.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtClienteActionPerformed(evt); } }); lblProducto.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N lblProducto.setForeground(new java.awt.Color(0, 102, 255)); lblProducto.setText("<Producto>"); jLabel8.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N jLabel8.setText("Descripcion: "); lblCodigo.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N lblCodigo.setForeground(new java.awt.Color(0, 102, 255)); lblCodigo.setText("<codigo>"); jLabel9.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N jLabel9.setText("Código"); jTableDetalleVenta.setFont(new java.awt.Font("Lucida Sans", 1, 20)); // NOI18N jTableDetalleVenta.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { {null, null, null, null, null} }, new String [] { "Descripcion", "Cant", "Desc", "PrecioU", "Importe" } )); jTableDetalleVenta.setGridColor(new java.awt.Color(102, 153, 255)); jTableDetalleVenta.setSelectionBackground(new java.awt.Color(102, 102, 102)); jTableDetalleVenta.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseClicked(java.awt.event.MouseEvent evt) { jTableDetalleVentaMouseClicked(evt); } public void mouseEntered(java.awt.event.MouseEvent evt) { jTableDetalleVentaMouseEntered(evt); } }); jScrollPane1.setViewportView(jTableDetalleVenta); jLabel10.setText("Empleado:"); txtEmpleado.setEditable(false); txtEmpleado.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N txtEmpleado.setText("-"); txtEmpleado.setEnabled(false); jLabel11.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jLabel11.setText("I.V.A:"); jLabel12.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N jLabel12.setForeground(new java.awt.Color(0, 102, 153)); jLabel12.setText("Total:"); jLabel13.setText("Comentarios:"); txtDescuento.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N txtDescuento.setText("0.00"); txtDescuento.setToolTipText("Total Descontado"); txtDescuento.setEnabled(false); txtComentarios.setFont(new java.awt.Font("Tahoma", 0, 12)); // NOI18N lblTotal.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N lblTotal.setText("0.00"); jLabel14.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N jLabel14.setText("Descuento:"); txtIVA.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N txtIVA.setText("0.00"); txtIVA.setToolTipText("Total Descontado"); txtIVA.setEnabled(false); jSeparator4.setOrientation(javax.swing.SwingConstants.VERTICAL); lblSubTotal.setFont(new java.awt.Font("Tahoma", 0, 24)); // NOI18N lblSubTotal.setText("0.00"); jLabel15.setFont(new java.awt.Font("Tahoma", 1, 24)); // NOI18N jLabel15.setForeground(new java.awt.Color(0, 102, 153)); jLabel15.setText("Subtotal:"); javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); jPanel4.setLayout(jPanel4Layout); jPanel4Layout.setHorizontalGroup( jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup() .addContainerGap(147, Short.MAX_VALUE) .addComponent(jLabel15) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(lblSubTotal, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jLabel12) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(lblTotal, javax.swing.GroupLayout.PREFERRED_SIZE, 180, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) .addGroup(jPanel4Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup() .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup() .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel7, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup() .addComponent(cboTipoVenta, javax.swing.GroupLayout.PREFERRED_SIZE, 144, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(jPanel4Layout.createSequentialGroup() .addComponent(txtCliente) .addGap(12, 12, 12)))) .addGroup(jPanel4Layout.createSequentialGroup() .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup() .addComponent(jLabel9, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(lblCodigo, javax.swing.GroupLayout.PREFERRED_SIZE, 82, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(34, 34, 34) .addComponent(jLabel8) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(lblProducto, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addComponent(jSeparator2)) .addGap(12, 12, 12)) .addGroup(jPanel4Layout.createSequentialGroup() .addComponent(jSeparator1) .addContainerGap()))) .addGroup(jPanel4Layout.createSequentialGroup() .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jSeparator3) .addComponent(jScrollPane1) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup() .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel13, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(txtComentarios) .addComponent(txtEmpleado)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jSeparator4, javax.swing.GroupLayout.PREFERRED_SIZE, 13, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jLabel14) .addComponent(jLabel11)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(txtIVA, javax.swing.GroupLayout.DEFAULT_SIZE, 123, Short.MAX_VALUE) .addComponent(txtDescuento)))) .addGap(12, 12, 12)))) ); jPanel4Layout.setVerticalGroup( jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup() .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel4Layout.createSequentialGroup() .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(cboTipoVenta, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel7) .addComponent(txtCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(7, 7, 7) .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(1, 1, 1) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel9) .addComponent(lblCodigo) .addComponent(lblProducto) .addComponent(jLabel8)))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 283, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup() .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txtEmpleado, javax.swing.GroupLayout.PREFERRED_SIZE, 24, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel10, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txtDescuento, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel14, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(7, 7, 7) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txtComentarios) .addComponent(jLabel11, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(txtIVA, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jLabel13, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addComponent(jSeparator4, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(6, 6, 6) .addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel12, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lblTotal)) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel15, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(lblSubTotal))) .addContainerGap()) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(0, 0, 0)) ); pack(); }// </editor-fold>//GEN-END:initComponents private void btnBuscarProductoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarProductoActionPerformed // TODO add your handling code here: Frame f = JOptionPane.getFrameForComponent(this); frmAgregarProducto frm = new frmAgregarProducto(f, true); frm.setLocationRelativeTo(null); frm.setVisible(true); if (frm.isVisible() == false) { if (frm.getInv_seleccion().getStock().compareTo(BigDecimal.ZERO) > 0) { addDetalle(frm.getInv_seleccion()); } else { JOptionPane.showMessageDialog( this, "No hay existencias del producto " + frm.getInv_seleccion() + " para vender", this.getTitle(), JOptionPane.WARNING_MESSAGE ); } frm.dispose(); } }//GEN-LAST:event_btnBuscarProductoActionPerformed private void btnSeleccionarPrecioActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSeleccionarPrecioActionPerformed // TODO add your handling code here: cambiarPrecio(); }//GEN-LAST:event_btnSeleccionarPrecioActionPerformed private void btnGuardarVentaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGuardarVentaActionPerformed // TODO add your handling code here: Frame f = JOptionPane.getFrameForComponent(this); frmPagoVenta frm = new frmPagoVenta(f, true); Venta venta = new Venta(); venta.setCliente(clienteActual); venta.setEmpleado(frmMenu.usuarioActual.getEmpleado()); venta.setObservacion(txtComentarios.getText()); venta.setFecha(new Date()); venta.setTotal(new BigDecimal(lblTotal.getText())); venta.setLetras(new Validaciones().Convertir(lblTotal.getText(), true)); venta.setSubtotal(new BigDecimal(lblSubTotal.getText())); venta.setIva(new BigDecimal(txtIVA.getText())); List<DetalleVenta> detalles = new ArrayList<>(); for (int i = 0; i < jTableDetalleVenta.getRowCount(); i++) { DetalleVenta detalle = new DetalleVenta(); Inventario extraer = (Inventario) jTableDetalleVenta.getValueAt(i, 0); detalle.setInventario(extraer); detalle.setCantidad(new BigDecimal(jTableDetalleVenta.getValueAt(i, 1).toString())); detalle.setDescuento(Integer.parseInt(jTableDetalleVenta.getValueAt(i, 2).toString())); detalle.setPrecio(new BigDecimal(jTableDetalleVenta.getValueAt(i, 3).toString())); detalle.setImporte(new BigDecimal(jTableDetalleVenta.getValueAt(i, 4).toString())); detalles.add(detalle); } venta.setDetalle(detalles); if (txtNFactura.getText().isEmpty()) { JOptionPane.showMessageDialog(this, "La venta es por Credito Fiscal o Factura de consumidor final y es obligatorio poner numero de factura", new Gestionar().Leer("Empresa", "nombre"), JOptionPane.WARNING_MESSAGE); } else { venta.setNFactura(txtNFactura.getText()); if (jTableDetalleVenta.getRowCount() > 0 || clienteActual.getId() > 0) { frm.setVentaActual(venta); frm.setLocationRelativeTo(null); frm.setVisible(true); if (frm.isVisible() == false) { if(frm.getVentaActual().getCambio().compareTo(BigDecimal.ZERO) > -1){ venta.setCambio(frm.getVentaActual().getCambio()); if (controlador.Registrar(venta)) { JOptionPane.showMessageDialog(this, "Venta registrada", this.title, JOptionPane.INFORMATION_MESSAGE); Validaciones.reiniciarJTable(jTableDetalleVenta); txtCliente.setText(""); txtComentarios.setText(""); lblTotal.setText("0.00"); lblImagen.setIcon(null); lblImagen.setText("Selecciona un producto"); txtNFactura.setText(""); lblCodigo.setText(""); } } } } else if (clienteActual.getId() == 0) { JOptionPane.showMessageDialog(this, "Agrega al cliente", new Gestionar().Leer("Empresa", "nombre"), JOptionPane.WARNING_MESSAGE); System.out.println("El Cliente"); } else { JOptionPane.showMessageDialog(this, "Agrega Productos primero", new Gestionar().Leer("Empresa", "nombre"), JOptionPane.WARNING_MESSAGE); }System.out.println("El Productos"); } }//GEN-LAST:event_btnGuardarVentaActionPerformed private void jTableDetalleVentaMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTableDetalleVentaMouseClicked // TODO add your handling code here: int fila = jTableDetalleVenta.getSelectedRow(); if (fila > -1) { Inventario inv = (Inventario) jTableDetalleVenta.getValueAt(fila, 0); if(inv.getImagen().getId() == 0){ setImagen(""); } else { setImagen(inv.getImagen().getUrl()); } lblProducto.setText(inv.getArticulo().toString()); lblCodigo.setText(inv.getCodigoInterno()); int columna = jTableDetalleVenta.getSelectedColumn(); if (jTableDetalleVenta.getValueAt(fila, columna) instanceof JButton) { int respuesta = JOptionPane.showConfirmDialog(this, "¿Estas seguro de eliminar estos datos?", new Gestionar().Leer("Empresa", "nombre"), JOptionPane.YES_NO_OPTION); if (respuesta == JOptionPane.YES_OPTION) { DefaultTableModel modelo = (DefaultTableModel) jTableDetalleVenta.getModel(); modelo.removeRow(fila); jTableDetalleVenta.setModel(modelo); calcularTotal(); } } else if(columna == 1){ cambiarCantidad(); } else if(columna == 2){ cambiarDescuento(); } else if(columna == 3){ cambiarPrecio(); } } else { JOptionPane.showMessageDialog(this, "Selecciona primero", new Gestionar().Leer("Empresa", "nombre"), JOptionPane.WARNING_MESSAGE); } }//GEN-LAST:event_jTableDetalleVentaMouseClicked private void btnCambiarCantActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCambiarCantActionPerformed // TODO add your handling code here: cambiarCantidad(); }//GEN-LAST:event_btnCambiarCantActionPerformed private void btnHacerDescuentoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnHacerDescuentoActionPerformed // TODO add your handling code here: cambiarDescuento(); }//GEN-LAST:event_btnHacerDescuentoActionPerformed private void btnBuscarClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarClienteActionPerformed // TODO add your handling code here: Frame f = JOptionPane.getFrameForComponent(this); frmAgregarCliente frm = new frmAgregarCliente(f, true); frm.setVisible(true); if (frm.isVisible() == false) { if(frm.getCliente().getId() != 0){ clienteActual = frm.getCliente(); txtCliente.setText(clienteActual.toString()); } frm.dispose(); } }//GEN-LAST:event_btnBuscarClienteActionPerformed private void formInternalFrameOpened(javax.swing.event.InternalFrameEvent evt) {//GEN-FIRST:event_formInternalFrameOpened // TODO add your handling code here: }//GEN-LAST:event_formInternalFrameOpened private void txtClienteMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_txtClienteMouseClicked // TODO add your handling code here: Frame f = JOptionPane.getFrameForComponent(this); frmAgregarCliente frm = new frmAgregarCliente(f, true); frm.setVisible(true); if (frm.isVisible() == false) { clienteActual = frm.getCliente(); txtCliente.setText(clienteActual.toString()); frm.dispose(); } }//GEN-LAST:event_txtClienteMouseClicked private void cboTipoVentaItemStateChanged(java.awt.event.ItemEvent evt) {//GEN-FIRST:event_cboTipoVentaItemStateChanged // TODO add your handling code here: if(cboTipoVenta.getSelectedItem().toString().equals("Ticket")){ jLabel20.setText("N° Correlativo"); } else { jLabel20.setText("N° Factura"); } calcularTotal(); }//GEN-LAST:event_cboTipoVentaItemStateChanged private void txtClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtClienteActionPerformed // TODO add your handling code here: Frame f = JOptionPane.getFrameForComponent(this); frmAgregarCliente frm = new frmAgregarCliente(f, true); frm.setVisible(true); if (frm.isVisible() == false) { clienteActual = frm.getCliente(); txtCliente.setText(clienteActual.toString()); frm.dispose(); } }//GEN-LAST:event_txtClienteActionPerformed private void btnQuitarProductoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnQuitarProductoActionPerformed // TODO add your handling code here: }//GEN-LAST:event_btnQuitarProductoActionPerformed private void jTableDetalleVentaMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jTableDetalleVentaMouseEntered // TODO add your handling code here: }//GEN-LAST:event_jTableDetalleVentaMouseEntered // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton btnBuscarCliente; private javax.swing.JButton btnBuscarProducto; private javax.swing.JButton btnCambiarCant; private javax.swing.JButton btnGuardarVenta; private javax.swing.JButton btnHacerDescuento; private javax.swing.JButton btnQuitarProducto; private javax.swing.JButton btnSeleccionarPrecio; private javax.swing.JComboBox<String> cboTipoVenta; private javax.swing.JLabel jLabel10; private javax.swing.JLabel jLabel11; private javax.swing.JLabel jLabel12; private javax.swing.JLabel jLabel13; private javax.swing.JLabel jLabel14; private javax.swing.JLabel jLabel15; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel20; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JPanel jPanel2; private javax.swing.JPanel jPanel3; private javax.swing.JPanel jPanel4; private javax.swing.JPanel jPanel5; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JSeparator jSeparator1; private javax.swing.JSeparator jSeparator2; private javax.swing.JSeparator jSeparator3; private javax.swing.JSeparator jSeparator4; private javax.swing.JTable jTableDetalleVenta; private javax.swing.JLabel lblCodigo; private javax.swing.JLabel lblImagen; private javax.swing.JLabel lblProducto; private javax.swing.JLabel lblReloj; private javax.swing.JLabel lblSubTotal; private javax.swing.JLabel lblTotal; private javax.swing.JTextField txtCliente; private javax.swing.JTextField txtComentarios; private javax.swing.JTextField txtDescuento; private javax.swing.JTextField txtEmpleado; private javax.swing.JTextField txtIVA; private javax.swing.JTextField txtNFactura; // End of variables declaration//GEN-END:variables }
54,885
0.636872
0.621929
973
55.398766
37.880692
190
false
false
0
0
0
0
0
0
0.941418
false
false
1
59039bb5172e68ce052dbd267e433a3b9b41d5e9
18,562,848,673,922
36441b128a41db3cd0e5e56ed9a73f0ff0700309
/src/main/java/micronaut/fallback/issue/controller/StubController.java
d3ae9eb647e7761a254d810de4f1cce9effc0942
[]
no_license
tardisoft/micronaut-fallback-issue
https://github.com/tardisoft/micronaut-fallback-issue
cec015dd5e71c45c8fdb89f7f61fcc580f6ddc3c
2bc77d5870c2eac8d2c4fae262f16f62315724a8
refs/heads/master
2021-05-22T19:20:24.436000
2020-04-04T17:17:57
2020-04-04T17:17:57
253,056,309
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package micronaut.fallback.issue.controller; import io.micronaut.context.annotation.Parameter; import io.micronaut.http.HttpResponse; import io.micronaut.http.annotation.Controller; import io.micronaut.http.annotation.Get; import java.util.HashMap; import java.util.Map; @Controller public class StubController { @Get("/members/{memberID}") public HttpResponse<Map<String, String>> getMemberFlattened(@Parameter long memberID) { Map<String, String> map = new HashMap<>(); map.put("hello", "world " + memberID); return HttpResponse.ok(map); } @Get("/memgroups/{memGroupID}") public HttpResponse<Map<String, String>> getMemGroupFlattened(@Parameter long memGroupID) { Map<String, String> map = new HashMap<>(); map.put("hello", "world " + memGroupID); return HttpResponse.ok(map); } }
UTF-8
Java
860
java
StubController.java
Java
[]
null
[]
package micronaut.fallback.issue.controller; import io.micronaut.context.annotation.Parameter; import io.micronaut.http.HttpResponse; import io.micronaut.http.annotation.Controller; import io.micronaut.http.annotation.Get; import java.util.HashMap; import java.util.Map; @Controller public class StubController { @Get("/members/{memberID}") public HttpResponse<Map<String, String>> getMemberFlattened(@Parameter long memberID) { Map<String, String> map = new HashMap<>(); map.put("hello", "world " + memberID); return HttpResponse.ok(map); } @Get("/memgroups/{memGroupID}") public HttpResponse<Map<String, String>> getMemGroupFlattened(@Parameter long memGroupID) { Map<String, String> map = new HashMap<>(); map.put("hello", "world " + memGroupID); return HttpResponse.ok(map); } }
860
0.701163
0.701163
27
30.851852
25.439404
95
false
false
0
0
0
0
0
0
0.703704
false
false
1
909841c3096806b7c6e65c69f52ec7310793e9c6
33,174,327,405,631
b22c5b51934300548b3733a3642e25b89d5e5269
/src/cn/way/wandroid/imageloader/loader/ImageLoader.java
c02b4dd66f9dd825d34610c232114d0beeac5fbe
[ "Apache-2.0" ]
permissive
wayhap/WASample
https://github.com/wayhap/WASample
f403437cd13c8368292ed9ee0ae94d1e1ccb277e
aa0f3cac39819bef84f77e41063ff84b8767be8c
refs/heads/master
2021-03-12T23:42:19.823000
2015-06-05T05:16:26
2015-06-05T05:16:26
33,224,828
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.way.wandroid.imageloader.loader; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.widget.ImageView; /** * e.g. * imageLoader = new ImageLoader(); * imageLoader.init(this,width,height);//传入FragmentActivity实例,和图片宽高(也可以只传一个值,即宽高相同) * imageLoader.setLoadingImage(R.drawable.empty_photo);//可选 * imageLoader.loadImage(urlStr, aImageView); * @author Wayne * */ public class ImageLoader extends Fragment { // private FragmentActivity activity; private final String DirCache = "ImageCache"; private ImageFetcher imageFetcher; public ImageLoader() { super(); } public void init(FragmentActivity activity, int imageSize) { init(activity, imageSize, -1); } public void init(FragmentActivity activity, int imageWidth, int imageHeight) { // this.activity = activity; try { if(activity!=null){ if (imageHeight == -1) { imageFetcher = new ImageFetcher(activity, imageWidth); } else { imageFetcher = new ImageFetcher(activity, imageWidth, imageHeight); } addDefaultCache(activity, imageFetcher); appendToParentActivity(activity); } } catch (Exception e) { } } private void appendToParentActivity(FragmentActivity activity) { if(activity!=null){ try { activity.getSupportFragmentManager().beginTransaction() .add(this, this.toString()).commit(); } catch (Exception e) { } } } private void addDefaultCache(FragmentActivity activity, ImageFetcher imageFecher) { // ImageCache.ImageCacheParams cacheParams = new // ImageCache.ImageCacheParams( // activity, DirCache); // cacheParams.setMemCacheSizePercent(0.25f); // imageFecher.addImageCache(getFragmentManager(), cacheParams); imageFecher.addImageCache(activity, DirCache); } /** * setOnScrollListener(new AbsListView.OnScrollListener() { * * @Override public void onScrollStateChanged(AbsListView absListView, int * scrollState) { // Pause fetcher to ensure smoother scrolling * when flinging <br> * if (scrollState == * AbsListView.OnScrollListener.SCROLL_STATE_FLING) { // Before * Honeycomb pause image loading on scroll to help with * performance<br> * if (!Utils.hasHoneycomb()) {<br> * mImageFetcher.setPauseWork(true); } <br> * else {<br> * mImageFetcher.setPauseWork(false); <br> * <br> * @Override public void onScroll(AbsListView absListView, int * firstVisibleItem, int visibleItemCount, int totalItemCount) { } * }); * @param pauseWork */ public void setPauseWork(boolean pauseWork) { if(imageFetcher!=null)imageFetcher.setPauseWork(pauseWork); } public void setLoadingImage(int resId) { if(imageFetcher!=null)imageFetcher.setLoadingImage(resId); } @Override public void onResume() { super.onResume(); if(imageFetcher!=null)imageFetcher.setExitTasksEarly(false); } @Override public void onPause() { super.onPause(); if(imageFetcher!=null){ imageFetcher.setPauseWork(false); imageFetcher.setExitTasksEarly(true); imageFetcher.flushCache(); } } @Override public void onDestroy() { super.onDestroy(); if(imageFetcher!=null)imageFetcher.closeCache(); } public void clearCache() { if(imageFetcher!=null)imageFetcher.clearCache(); } public void loadImage(String urlStr, ImageView imageView) { if(imageFetcher!=null)imageFetcher.loadImage(urlStr, imageView); } public void deleteImage(String urlStr){ if(imageFetcher!=null) { imageFetcher.getImageCache().deleteBitmapFromDiskCache(urlStr); } } }
UTF-8
Java
3,694
java
ImageLoader.java
Java
[ { "context": "geLoader.loadImage(urlStr, aImageView);\n * @author Wayne\n * \n */\npublic class ImageLoader extends Fragment", "end": 422, "score": 0.9971317052841187, "start": 417, "tag": "NAME", "value": "Wayne" } ]
null
[]
package cn.way.wandroid.imageloader.loader; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentActivity; import android.widget.ImageView; /** * e.g. * imageLoader = new ImageLoader(); * imageLoader.init(this,width,height);//传入FragmentActivity实例,和图片宽高(也可以只传一个值,即宽高相同) * imageLoader.setLoadingImage(R.drawable.empty_photo);//可选 * imageLoader.loadImage(urlStr, aImageView); * @author Wayne * */ public class ImageLoader extends Fragment { // private FragmentActivity activity; private final String DirCache = "ImageCache"; private ImageFetcher imageFetcher; public ImageLoader() { super(); } public void init(FragmentActivity activity, int imageSize) { init(activity, imageSize, -1); } public void init(FragmentActivity activity, int imageWidth, int imageHeight) { // this.activity = activity; try { if(activity!=null){ if (imageHeight == -1) { imageFetcher = new ImageFetcher(activity, imageWidth); } else { imageFetcher = new ImageFetcher(activity, imageWidth, imageHeight); } addDefaultCache(activity, imageFetcher); appendToParentActivity(activity); } } catch (Exception e) { } } private void appendToParentActivity(FragmentActivity activity) { if(activity!=null){ try { activity.getSupportFragmentManager().beginTransaction() .add(this, this.toString()).commit(); } catch (Exception e) { } } } private void addDefaultCache(FragmentActivity activity, ImageFetcher imageFecher) { // ImageCache.ImageCacheParams cacheParams = new // ImageCache.ImageCacheParams( // activity, DirCache); // cacheParams.setMemCacheSizePercent(0.25f); // imageFecher.addImageCache(getFragmentManager(), cacheParams); imageFecher.addImageCache(activity, DirCache); } /** * setOnScrollListener(new AbsListView.OnScrollListener() { * * @Override public void onScrollStateChanged(AbsListView absListView, int * scrollState) { // Pause fetcher to ensure smoother scrolling * when flinging <br> * if (scrollState == * AbsListView.OnScrollListener.SCROLL_STATE_FLING) { // Before * Honeycomb pause image loading on scroll to help with * performance<br> * if (!Utils.hasHoneycomb()) {<br> * mImageFetcher.setPauseWork(true); } <br> * else {<br> * mImageFetcher.setPauseWork(false); <br> * <br> * @Override public void onScroll(AbsListView absListView, int * firstVisibleItem, int visibleItemCount, int totalItemCount) { } * }); * @param pauseWork */ public void setPauseWork(boolean pauseWork) { if(imageFetcher!=null)imageFetcher.setPauseWork(pauseWork); } public void setLoadingImage(int resId) { if(imageFetcher!=null)imageFetcher.setLoadingImage(resId); } @Override public void onResume() { super.onResume(); if(imageFetcher!=null)imageFetcher.setExitTasksEarly(false); } @Override public void onPause() { super.onPause(); if(imageFetcher!=null){ imageFetcher.setPauseWork(false); imageFetcher.setExitTasksEarly(true); imageFetcher.flushCache(); } } @Override public void onDestroy() { super.onDestroy(); if(imageFetcher!=null)imageFetcher.closeCache(); } public void clearCache() { if(imageFetcher!=null)imageFetcher.clearCache(); } public void loadImage(String urlStr, ImageView imageView) { if(imageFetcher!=null)imageFetcher.loadImage(urlStr, imageView); } public void deleteImage(String urlStr){ if(imageFetcher!=null) { imageFetcher.getImageCache().deleteBitmapFromDiskCache(urlStr); } } }
3,694
0.703571
0.701648
128
27.4375
24.192183
83
false
false
0
0
0
0
0
0
1.875
false
false
1
464d0eaef4f7dc804ecda669c7d9b53ddabf89a2
6,236,292,533,488
e8fc7fb5ed0c1045c59e8fe762fd6f37a0d21773
/mytestproject/src/main/java/com/example/szhh/mainapplication/view/ShareScreenShotN.java
124255fef8230c3bc6815064ff62488f5929a4d6
[]
no_license
pgyszhh/MainApplication
https://github.com/pgyszhh/MainApplication
d13d8d513d675306605b5267ba593396fe730f03
7505d15ff1622712d09dae848adccda69cb19412
refs/heads/master
2021-01-16T21:05:36.513000
2016-08-17T07:49:16
2016-08-17T07:49:16
65,887,268
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.szhh.mainapplication.view; import java.io.File; import java.io.FileOutputStream; import java.lang.reflect.Field; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; import android.os.Environment; import android.util.DisplayMetrics; import android.util.Log; import android.view.Gravity; import android.view.KeyEvent; import android.view.View; import android.view.WindowManager; import android.widget.Button; import android.widget.FrameLayout; import android.widget.FrameLayout.LayoutParams; import android.widget.ImageView; import android.widget.RelativeLayout; import com.example.szhh.mainapplication.R; public class ShareScreenShotN extends BaseActivity { Context context; ImageView img; Bitmap bitmap; Bitmap bitmap_bg; LayoutParams param; MyViewN my; Button ok, cancel; private WindowManager windowManager; int height = 0; int width = 0; FrameLayout layout; String imagePath; int flag = 0;// 是否点击确定,0是剪切状态,1是分享状态 @Override protected void onCreate(Bundle savedInstanceState) { try { super.onCreate(savedInstanceState); setContentView(R.layout.imags); context = this; init(); } catch (Exception e) { } } private void init() { DisplayMetrics dm = new DisplayMetrics(); windowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE); windowManager.getDefaultDisplay().getMetrics(dm); img = (ImageView) findViewById(R.id.sharescreenshot_img); /*imagePath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/data/" + this.getString(R.string.app_name) + "/database/" + "screen.jpg";*/ imagePath=Environment.getExternalStorageDirectory().getAbsolutePath()+"/1.png"; if (bitmap_bg == null) { bitmap_bg = BitmapFactory.decodeFile(imagePath); } setTitleText("裁剪图片"); RelativeLayout title = (RelativeLayout) findViewById(R.id.title); title.setBackgroundResource(R.drawable.sharescreenshot_banner); bitmap = BitmapFactory.decodeFile(imagePath); initAll(dm); } private void initAll(DisplayMetrics dm) { layout = (FrameLayout) findViewById(R.id.sharescreenshot_layout); BitmapFactory.Options opts = new BitmapFactory.Options(); opts.inJustDecodeBounds = true; BitmapFactory.decodeFile(imagePath, opts); opts.inSampleSize = 1; opts.inJustDecodeBounds = false; int widthold = opts.outWidth; int heightold = opts.outHeight; float density = (float) dm.widthPixels / (float) 640;// 屏幕比例,实际宽度/默认宽度,见SGCCWindowManager72 float density2 = dm.density; Log.e("majun9550", "++++++++++++++++++++++++++++++++++++++++++++++"); Log.e("majun9550", "1080+widthold" + widthold); Log.e("majun9550", "1800+heightold" + heightold); Log.e("majun9550", "++++++++++++++++++++++++++++++++++++++++++++++"); height =heightold - (int) (context.getResources().getDimension(R.dimen.px88) * density) - (int) (viewInited() * density) - (int) (40 * density2); width = widthold * height / heightold;// 图片的高度和宽度 int height2 = heightold - (int) (context.getResources().getDimension(R.dimen.px88) * density) - (int) (viewInited() * density); int width2 = widthold * height2 / heightold;// 除去状态栏和标题栏的高度和宽度 my = new MyViewN(this, bitmap, width, height, width2, height2); Log.e("majun9550", "---------------------------------------------"); Log.e("majun9550", "width2" + width2); Log.e("majun9550", "height2" + height2); Log.e("majun9550", "---------------------------------------------"); param = new LayoutParams(width2, height2); param.gravity = Gravity.CENTER; layout.addView(my, param); bitmap = Bitmap.createScaledBitmap(bitmap, width, height, true); img.setImageBitmap(bitmap); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.b_more_action: if (flag == 0) {// 剪切 img.setImageBitmap(my.getBitmap()); //editRightButtonBg(R.drawable.main_share); flag = 1; layout.removeView(my); } else {// 分享 } break; case R.id.b_back: if (flag == 1) {// 剪切 flag = 0; // onCreate(null); } finish(); break; default: break; } } private int viewInited() { Class<?> c = null; Object obj = null; Field field = null; int x = 0, sbar = 0; try { c = Class.forName("com.android.internal.R$dimen"); obj = c.newInstance(); field = c.getField("status_bar_height"); x = Integer.parseInt(field.get(obj).toString()); sbar = getResources().getDimensionPixelSize(x); } catch (Exception e1) { e1.printStackTrace(); } return sbar; } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { if (flag == 0) {// 剪切 finish(); } else { flag = 0; onCreate(null); } } return super.onKeyDown(keyCode, event); } @Override protected void onResume() { // TODO Auto-generated method stub super.onResume(); } }
UTF-8
Java
5,052
java
ShareScreenShotN.java
Java
[ { "context": "itmap, width, height, width2, height2);\n\n\t\tLog.e(\"majun9550\", \"-------------------------------------------", "end": 3296, "score": 0.7218751311302185, "start": 3290, "tag": "USERNAME", "value": "majun9" }, { "context": "idth, height, width2, height2);\n\n\t\tLog.e(\"majun9550\", \"---------------------------------------------\"", "end": 3299, "score": 0.5148177146911621, "start": 3298, "tag": "USERNAME", "value": "0" } ]
null
[]
package com.example.szhh.mainapplication.view; import java.io.File; import java.io.FileOutputStream; import java.lang.reflect.Field; import android.content.Context; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.os.Bundle; import android.os.Environment; import android.util.DisplayMetrics; import android.util.Log; import android.view.Gravity; import android.view.KeyEvent; import android.view.View; import android.view.WindowManager; import android.widget.Button; import android.widget.FrameLayout; import android.widget.FrameLayout.LayoutParams; import android.widget.ImageView; import android.widget.RelativeLayout; import com.example.szhh.mainapplication.R; public class ShareScreenShotN extends BaseActivity { Context context; ImageView img; Bitmap bitmap; Bitmap bitmap_bg; LayoutParams param; MyViewN my; Button ok, cancel; private WindowManager windowManager; int height = 0; int width = 0; FrameLayout layout; String imagePath; int flag = 0;// 是否点击确定,0是剪切状态,1是分享状态 @Override protected void onCreate(Bundle savedInstanceState) { try { super.onCreate(savedInstanceState); setContentView(R.layout.imags); context = this; init(); } catch (Exception e) { } } private void init() { DisplayMetrics dm = new DisplayMetrics(); windowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE); windowManager.getDefaultDisplay().getMetrics(dm); img = (ImageView) findViewById(R.id.sharescreenshot_img); /*imagePath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/data/" + this.getString(R.string.app_name) + "/database/" + "screen.jpg";*/ imagePath=Environment.getExternalStorageDirectory().getAbsolutePath()+"/1.png"; if (bitmap_bg == null) { bitmap_bg = BitmapFactory.decodeFile(imagePath); } setTitleText("裁剪图片"); RelativeLayout title = (RelativeLayout) findViewById(R.id.title); title.setBackgroundResource(R.drawable.sharescreenshot_banner); bitmap = BitmapFactory.decodeFile(imagePath); initAll(dm); } private void initAll(DisplayMetrics dm) { layout = (FrameLayout) findViewById(R.id.sharescreenshot_layout); BitmapFactory.Options opts = new BitmapFactory.Options(); opts.inJustDecodeBounds = true; BitmapFactory.decodeFile(imagePath, opts); opts.inSampleSize = 1; opts.inJustDecodeBounds = false; int widthold = opts.outWidth; int heightold = opts.outHeight; float density = (float) dm.widthPixels / (float) 640;// 屏幕比例,实际宽度/默认宽度,见SGCCWindowManager72 float density2 = dm.density; Log.e("majun9550", "++++++++++++++++++++++++++++++++++++++++++++++"); Log.e("majun9550", "1080+widthold" + widthold); Log.e("majun9550", "1800+heightold" + heightold); Log.e("majun9550", "++++++++++++++++++++++++++++++++++++++++++++++"); height =heightold - (int) (context.getResources().getDimension(R.dimen.px88) * density) - (int) (viewInited() * density) - (int) (40 * density2); width = widthold * height / heightold;// 图片的高度和宽度 int height2 = heightold - (int) (context.getResources().getDimension(R.dimen.px88) * density) - (int) (viewInited() * density); int width2 = widthold * height2 / heightold;// 除去状态栏和标题栏的高度和宽度 my = new MyViewN(this, bitmap, width, height, width2, height2); Log.e("majun9550", "---------------------------------------------"); Log.e("majun9550", "width2" + width2); Log.e("majun9550", "height2" + height2); Log.e("majun9550", "---------------------------------------------"); param = new LayoutParams(width2, height2); param.gravity = Gravity.CENTER; layout.addView(my, param); bitmap = Bitmap.createScaledBitmap(bitmap, width, height, true); img.setImageBitmap(bitmap); } @Override public void onClick(View v) { switch (v.getId()) { case R.id.b_more_action: if (flag == 0) {// 剪切 img.setImageBitmap(my.getBitmap()); //editRightButtonBg(R.drawable.main_share); flag = 1; layout.removeView(my); } else {// 分享 } break; case R.id.b_back: if (flag == 1) {// 剪切 flag = 0; // onCreate(null); } finish(); break; default: break; } } private int viewInited() { Class<?> c = null; Object obj = null; Field field = null; int x = 0, sbar = 0; try { c = Class.forName("com.android.internal.R$dimen"); obj = c.newInstance(); field = c.getField("status_bar_height"); x = Integer.parseInt(field.get(obj).toString()); sbar = getResources().getDimensionPixelSize(x); } catch (Exception e1) { e1.printStackTrace(); } return sbar; } @Override public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_BACK) { if (flag == 0) {// 剪切 finish(); } else { flag = 0; onCreate(null); } } return super.onKeyDown(keyCode, event); } @Override protected void onResume() { // TODO Auto-generated method stub super.onResume(); } }
5,052
0.674329
0.657852
178
26.617977
21.655891
93
false
false
0
0
0
0
0
0
2.308989
false
false
1
5113c3d9d84df8d5720a34597c0469d0fc8d52e7
30,133,490,612,398
e27362bd5a5ae59dd024e95b5ae47a95ec138d21
/src/aljs4j/sort/SelectionSort.java
38c2adde296b833f7353d4255dd1a006746ead88
[]
no_license
Grandexing/leetcode-java
https://github.com/Grandexing/leetcode-java
9457cb1b5ef7eed67d4e17654e41bd94123f40bc
2351f6f602206bfd59db5b1705bb7eb92d6cb6dc
refs/heads/master
2021-01-21T18:38:30.183000
2018-04-17T08:39:26
2018-04-17T08:39:26
92,064,671
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package aljs4j.sort; import static aljs4j.sort.Sort.swap; /** * Created by grande on 2018/1/29. */ public class SelectionSort { public static void sort(int[] a) { int N = a.length; for (int i = 0; i < N; i++) { int min = i; for (int j = i + 1; j < N; j++) { if (a[j] < a[min]) { min = j; } } swap(a, i, min); } } }
UTF-8
Java
421
java
SelectionSort.java
Java
[ { "context": "t static aljs4j.sort.Sort.swap;\n\n/**\n * Created by grande on 2018/1/29.\n */\npublic class SelectionSort {\n ", "end": 84, "score": 0.9993213415145874, "start": 78, "tag": "USERNAME", "value": "grande" } ]
null
[]
package aljs4j.sort; import static aljs4j.sort.Sort.swap; /** * Created by grande on 2018/1/29. */ public class SelectionSort { public static void sort(int[] a) { int N = a.length; for (int i = 0; i < N; i++) { int min = i; for (int j = i + 1; j < N; j++) { if (a[j] < a[min]) { min = j; } } swap(a, i, min); } } }
421
0.429929
0.4038
21
19.047619
13.827083
42
false
false
0
0
0
0
0
0
1.047619
false
false
1
2e00f4e0ed5746c3ae0fc00b95e6fdf0cc0a0996
1,949,915,211,212
b201663e28c455069f5b57939e05f73c39ac5c26
/src/courseOrganizer/views/ScheduleView.java
f93d36be696564efc34d40fc33d0f636fcbbcf1b
[]
no_license
jdoukas21/CourseOrganizer
https://github.com/jdoukas21/CourseOrganizer
e6d18ec96a64aef1f24889c95df27f2045cb142b
0d857cd2d94375f8addbead802507e6963224060
refs/heads/master
2020-04-10T18:51:16.001000
2013-06-04T19:44:45
2013-06-04T19:44:45
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package courseOrganizer.views; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTable; public class ScheduleView extends JFrame { private JTable table; public ScheduleView() { createTable(); this.add(createScrollPane()); this.setDefaultCloseOperation(EXIT_ON_CLOSE); this.pack(); this.setLocationRelativeTo(null); this.setVisible(true); } public void createTable() { String[] columnNames = {"Class", //declare columnNames "Day(s)", "Time", "Classroom"}; Object[][] data = //declare column data.. in your program, you will want this to work automatically { {"Computer Organization 1", "Mon/Wed", "12:00 - 1:50", "SC 1011"}, {"Calculus 2", "Tue/Thu", "12:00 - 1:50", "NC 3112"}, {"Physics Lab", "Thu", "4:00 - 5:50", "NC 3606"}, {"General Physics 1", "Tue/Thu", "6:00 - 7:50", "NC 1608"} }; table = new JTable(data, columnNames); } public JScrollPane createScrollPane() //for the JScrollPane that holds the JTable { JScrollPane scrollPane = new JScrollPane(table); table.setFillsViewportHeight(true); //self-explanatory... return scrollPane; } }
UTF-8
Java
1,302
java
ScheduleView.java
Java
[]
null
[]
package courseOrganizer.views; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTable; public class ScheduleView extends JFrame { private JTable table; public ScheduleView() { createTable(); this.add(createScrollPane()); this.setDefaultCloseOperation(EXIT_ON_CLOSE); this.pack(); this.setLocationRelativeTo(null); this.setVisible(true); } public void createTable() { String[] columnNames = {"Class", //declare columnNames "Day(s)", "Time", "Classroom"}; Object[][] data = //declare column data.. in your program, you will want this to work automatically { {"Computer Organization 1", "Mon/Wed", "12:00 - 1:50", "SC 1011"}, {"Calculus 2", "Tue/Thu", "12:00 - 1:50", "NC 3112"}, {"Physics Lab", "Thu", "4:00 - 5:50", "NC 3606"}, {"General Physics 1", "Tue/Thu", "6:00 - 7:50", "NC 1608"} }; table = new JTable(data, columnNames); } public JScrollPane createScrollPane() //for the JScrollPane that holds the JTable { JScrollPane scrollPane = new JScrollPane(table); table.setFillsViewportHeight(true); //self-explanatory... return scrollPane; } }
1,302
0.595238
0.560676
50
24.040001
21.737488
101
false
false
0
0
0
0
0
0
1.96
false
false
1
0b003f63362903eef08b049b6cf2fd01cdefb5ee
1,520,418,452,429
926ad938654a22bf5569352683cb50c91ce9d34a
/src/main/java/com/jay/ca/easylife/repository/RoleRepository.java
dcf8ee59810d4ea3cf5ca08baf208ed1e4b4799a
[]
no_license
Geniussss/CALife
https://github.com/Geniussss/CALife
7a1c4fc9d46103c7c1c998acfc4f41f681387bb2
a00de12abb695ea1e26375bc4d2b737b5b405254
refs/heads/development
2022-01-05T20:13:58.422000
2019-06-27T14:30:45
2019-06-27T14:30:45
125,129,386
1
0
null
false
2019-06-27T14:24:42
2018-03-13T23:52:00
2019-06-27T14:22:12
2019-06-27T14:24:41
6,112
1
0
0
CSS
false
false
package com.jay.ca.easylife.repository; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import com.jay.ca.easylife.model.Role; @Repository("roleRepository") public interface RoleRepository extends JpaRepository<Role,Integer>{ Role findByRole(String role); }
UTF-8
Java
327
java
RoleRepository.java
Java
[]
null
[]
package com.jay.ca.easylife.repository; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; import com.jay.ca.easylife.model.Role; @Repository("roleRepository") public interface RoleRepository extends JpaRepository<Role,Integer>{ Role findByRole(String role); }
327
0.825688
0.825688
11
28.727272
24.188993
68
false
false
0
0
0
0
0
0
0.727273
false
false
1
e7ab1cea99ff76c6cf02a27c78a31a12b6ea4d3d
31,808,527,854,871
5c99173b8da54374e7dc8dc0c5d97c9567a3e95a
/demo2/Sapling/Sapling/app/src/main/java/com/icarus/sapling/ui/recommendation/RecommendationFragment.java
ec1940fa03e7cdeea7254348711e750418bbb764
[]
no_license
JunyongLee1217/demo
https://github.com/JunyongLee1217/demo
51b802e532733b3551afa8ca8453ed862f17ffb1
5a7029cda1b8a96ac70b9b3b8a4e989eae1f5c97
refs/heads/master
2020-09-04T04:34:39.503000
2019-12-16T08:22:05
2019-12-16T08:22:05
219,658,677
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.icarus.sapling.ui.recommendation; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.ScrollView; import android.widget.Toast; import androidx.annotation.Nullable; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; import androidx.lifecycle.Observer; import androidx.lifecycle.ViewModelProviders; import com.icarus.sapling.MainActivity; import com.icarus.sapling.Plant; import com.icarus.sapling.R; import java.util.ArrayList; public class RecommendationFragment extends Fragment { private RecommendationViewModel recommendationViewModel; ArrayList<Plant> recommendedPlants; ArrayList<Plant> recommendedPlants2; RadioGroup radioGroup1, radioGroup2, radioGroup3; Button button; RadioButton radioButton1, radioButton2, radioButton3; public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { //recommendationViewModel = ViewModelProviders.of(this).get(RecommendationViewModel.class); View root = inflater.inflate(R.layout.fragment_recommendation, container, false); //View root = MainActivity.loadList(this.getActivity(), MainActivity.gardenPlants, 1, inflater, container, savedInstanceState); button = (Button) root.findViewById(R.id.button); radioGroup1 = root.findViewById(R.id.radiogr1); radioGroup2 = root.findViewById(R.id.radiogr2); radioGroup3 = root.findViewById(R.id.radiogr3); // Onclick = search the correspoding radio data from the arraylist button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // get radio group ids // int radioid1 = radioGroup1.getCheckedRadioButtonId(); // int radioid2 = radioGroup2.getCheckedRadioButtonId(); // int radioid3 = radioGroup3.getCheckedRadioButtonId(); // define radioButtons radioButton1 = getActivity().findViewById(radioGroup1.getCheckedRadioButtonId()); radioButton2 = getActivity().findViewById(radioGroup2.getCheckedRadioButtonId()); radioButton3 = getActivity().findViewById(radioGroup3.getCheckedRadioButtonId()); String str1 = radioButton1.getText().toString(); //tree String str2 = radioButton2.getText().toString(); //>3 String str3 = radioButton3.getText().toString(); //>14 //Toast.makeText(getActivity(), "Selected Radio Button is:" + str1+str2+str3 , Toast.LENGTH_LONG).show(); recommendedPlants = new ArrayList<>(); // Plant Type for(int i = 0; i < MainActivity.library.size(); i++) { try { if (MainActivity.library.get(i).getType().equals(str1)) { recommendedPlants.add( MainActivity.library.get(i) ); } } catch (NullPointerException e) { Log.e("Failed Plant", ""); } } // Plant space recommendedPlants2 = new ArrayList<>(); int space = 0; switch (str2){ case "3":space = 3; break; case "3-7": space = 7; break; case "8-11": space = 11; break; case "12-15": space = 15; break; case "15+": space = 16; break; default: space = 16; break; } for(int i = 0; i < recommendedPlants.size(); i++) { if(recommendedPlants.get(i).getSpace() < space) { recommendedPlants2.add(recommendedPlants.get(i)); } } //Toast.makeText(getActivity(), "Selected Radio Button is:" + recommendedPlants2.get(1), Toast.LENGTH_LONG).show(); //Toast.makeText(getActivity(), "Selected Radio Button is:" + recommendedPlants.get(1)+recommendedPlants.get(2)+recommendedPlants1.get(3) , Toast.LENGTH_LONG).show(); ArrayList<String> ar = new ArrayList<>(); for(int i = 0; i < recommendedPlants.size(); i++) { ar.add(i, recommendedPlants.get(i).getName()); } Intent intent = new Intent(getActivity(), SubActivity.class); intent.putExtra("PLANTARR", ar); startActivity((intent)); } }); return root; } }
UTF-8
Java
4,975
java
RecommendationFragment.java
Java
[]
null
[]
package com.icarus.sapling.ui.recommendation; import android.content.Context; import android.content.Intent; import android.os.Bundle; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.RadioButton; import android.widget.RadioGroup; import android.widget.ScrollView; import android.widget.Toast; import androidx.annotation.Nullable; import androidx.annotation.NonNull; import androidx.fragment.app.Fragment; import androidx.lifecycle.Observer; import androidx.lifecycle.ViewModelProviders; import com.icarus.sapling.MainActivity; import com.icarus.sapling.Plant; import com.icarus.sapling.R; import java.util.ArrayList; public class RecommendationFragment extends Fragment { private RecommendationViewModel recommendationViewModel; ArrayList<Plant> recommendedPlants; ArrayList<Plant> recommendedPlants2; RadioGroup radioGroup1, radioGroup2, radioGroup3; Button button; RadioButton radioButton1, radioButton2, radioButton3; public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { //recommendationViewModel = ViewModelProviders.of(this).get(RecommendationViewModel.class); View root = inflater.inflate(R.layout.fragment_recommendation, container, false); //View root = MainActivity.loadList(this.getActivity(), MainActivity.gardenPlants, 1, inflater, container, savedInstanceState); button = (Button) root.findViewById(R.id.button); radioGroup1 = root.findViewById(R.id.radiogr1); radioGroup2 = root.findViewById(R.id.radiogr2); radioGroup3 = root.findViewById(R.id.radiogr3); // Onclick = search the correspoding radio data from the arraylist button.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // get radio group ids // int radioid1 = radioGroup1.getCheckedRadioButtonId(); // int radioid2 = radioGroup2.getCheckedRadioButtonId(); // int radioid3 = radioGroup3.getCheckedRadioButtonId(); // define radioButtons radioButton1 = getActivity().findViewById(radioGroup1.getCheckedRadioButtonId()); radioButton2 = getActivity().findViewById(radioGroup2.getCheckedRadioButtonId()); radioButton3 = getActivity().findViewById(radioGroup3.getCheckedRadioButtonId()); String str1 = radioButton1.getText().toString(); //tree String str2 = radioButton2.getText().toString(); //>3 String str3 = radioButton3.getText().toString(); //>14 //Toast.makeText(getActivity(), "Selected Radio Button is:" + str1+str2+str3 , Toast.LENGTH_LONG).show(); recommendedPlants = new ArrayList<>(); // Plant Type for(int i = 0; i < MainActivity.library.size(); i++) { try { if (MainActivity.library.get(i).getType().equals(str1)) { recommendedPlants.add( MainActivity.library.get(i) ); } } catch (NullPointerException e) { Log.e("Failed Plant", ""); } } // Plant space recommendedPlants2 = new ArrayList<>(); int space = 0; switch (str2){ case "3":space = 3; break; case "3-7": space = 7; break; case "8-11": space = 11; break; case "12-15": space = 15; break; case "15+": space = 16; break; default: space = 16; break; } for(int i = 0; i < recommendedPlants.size(); i++) { if(recommendedPlants.get(i).getSpace() < space) { recommendedPlants2.add(recommendedPlants.get(i)); } } //Toast.makeText(getActivity(), "Selected Radio Button is:" + recommendedPlants2.get(1), Toast.LENGTH_LONG).show(); //Toast.makeText(getActivity(), "Selected Radio Button is:" + recommendedPlants.get(1)+recommendedPlants.get(2)+recommendedPlants1.get(3) , Toast.LENGTH_LONG).show(); ArrayList<String> ar = new ArrayList<>(); for(int i = 0; i < recommendedPlants.size(); i++) { ar.add(i, recommendedPlants.get(i).getName()); } Intent intent = new Intent(getActivity(), SubActivity.class); intent.putExtra("PLANTARR", ar); startActivity((intent)); } }); return root; } }
4,975
0.602211
0.587337
139
34.798561
33.808216
182
false
false
0
0
0
0
0
0
0.733813
false
false
1
f79322ab7ddcb0b2f72dff890a0aee89c12d0f76
16,707,422,783,134
55232f855cc0dbeb5c478c16465ef45878250105
/Cambio/app/src/main/java/com/example/cambio/MainActivity.java
6a0c7292aba51b4a01a6560c093e12a63cf0667c
[]
no_license
HiagoW/DS151-Desenvolvimento-para-dispositivos-moveis
https://github.com/HiagoW/DS151-Desenvolvimento-para-dispositivos-moveis
d37d21c020946eb6daec84653517b0c9ca813214
dc92e5e22d313170c19f99c9c0327ab685ffb86f
refs/heads/main
2023-01-30T00:02:58.729000
2020-12-16T17:52:33
2020-12-16T17:52:33
312,029,821
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.cambio; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } public void calcular(View view){ EditText dolarView = findViewById(R.id.editTextNumberDecimal); TextView realView = findViewById(R.id.textView); double dolar; try{ dolar = Double.parseDouble(dolarView.getText().toString()); }catch (Exception e){ Toast.makeText(this, "Forneça um número real",Toast.LENGTH_SHORT).show(); return ; } double real = dolar * 5.41; realView.setText(String.valueOf(real)); } }
UTF-8
Java
962
java
MainActivity.java
Java
[]
null
[]
package com.example.cambio; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.EditText; import android.widget.TextView; import android.widget.Toast; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); } public void calcular(View view){ EditText dolarView = findViewById(R.id.editTextNumberDecimal); TextView realView = findViewById(R.id.textView); double dolar; try{ dolar = Double.parseDouble(dolarView.getText().toString()); }catch (Exception e){ Toast.makeText(this, "Forneça um número real",Toast.LENGTH_SHORT).show(); return ; } double real = dolar * 5.41; realView.setText(String.valueOf(real)); } }
962
0.682292
0.679167
32
29.03125
23.171217
85
false
false
0
0
0
0
0
0
0.59375
false
false
1
42550a00bfe03e1580437c3161737af09cc54b09
1,958,505,147,182
a911f926261b82ec8a2ade2d0af1a973280ceab6
/qipai_game/src/main/java/com/anbang/qipai/game/msg/channel/sink/GameServerManagerSink.java
a4cb6e23a48f94c7f28439488941efd5b63291c3
[]
no_license
791837060/qipai_huainanmajiang
https://github.com/791837060/qipai_huainanmajiang
31325550c9db1fcb139c6f5a89d84f7deac0e3a2
b4f17b26484bbe2840a0852156117faee9996bbb
refs/heads/master
2023-06-26T22:31:40.822000
2021-07-30T07:20:49
2021-07-30T07:20:49
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.anbang.qipai.game.msg.channel.sink; import org.springframework.cloud.stream.annotation.Input; import org.springframework.messaging.SubscribableChannel; public interface GameServerManagerSink { String GAME_SERVER_MANAGER="gameServerManager"; @Input SubscribableChannel gameServerManager(); }
UTF-8
Java
320
java
GameServerManagerSink.java
Java
[]
null
[]
package com.anbang.qipai.game.msg.channel.sink; import org.springframework.cloud.stream.annotation.Input; import org.springframework.messaging.SubscribableChannel; public interface GameServerManagerSink { String GAME_SERVER_MANAGER="gameServerManager"; @Input SubscribableChannel gameServerManager(); }
320
0.80625
0.80625
13
23.615385
24.329592
57
false
false
0
0
0
0
0
0
0.384615
false
false
1
b3a2c6c6e2f049fd3a4c7f49fef41a8031f272e1
1,958,505,149,216
00dd62ea2f5ca12575ebfc3ce9710f3b5d9f92c7
/src/main/java/org/ares/app/demo/entities/sand/Sbusstation.java
ca08223fc571c9274a0a10e1155a2350027a539a
[]
no_license
ares-app/simu_trans
https://github.com/ares-app/simu_trans
3c6f61b18edfeca45e6bb22aa9f3369982bfe42d
2324082816e778da6508f73a3fe46a243c802c16
refs/heads/master
2020-03-25T18:23:02.980000
2018-08-08T14:39:20
2018-08-08T14:39:20
144,027,952
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.ares.app.demo.entities.sand; import java.io.Serializable; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.IdClass; import javax.persistence.NamedQuery; @Entity @IdClass(SbusstationId.class) @NamedQuery(name="Sbusstation.findAll", query="SELECT s FROM Sbusstation s") public class Sbusstation implements Serializable { private static final long serialVersionUID = 1L; @Id private int busid; @Id private int busstationid; private int distance; public Sbusstation() { } public int getBusid() { return this.busid; } public void setBusid(int busid) { this.busid = busid; } public int getBusstationid() { return this.busstationid; } public void setBusstationid(int busstationid) { this.busstationid = busstationid; } public int getDistance() { return this.distance; } public void setDistance(int distance) { this.distance = distance; } }
UTF-8
Java
970
java
Sbusstation.java
Java
[]
null
[]
package org.ares.app.demo.entities.sand; import java.io.Serializable; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.IdClass; import javax.persistence.NamedQuery; @Entity @IdClass(SbusstationId.class) @NamedQuery(name="Sbusstation.findAll", query="SELECT s FROM Sbusstation s") public class Sbusstation implements Serializable { private static final long serialVersionUID = 1L; @Id private int busid; @Id private int busstationid; private int distance; public Sbusstation() { } public int getBusid() { return this.busid; } public void setBusid(int busid) { this.busid = busid; } public int getBusstationid() { return this.busstationid; } public void setBusstationid(int busstationid) { this.busstationid = busstationid; } public int getDistance() { return this.distance; } public void setDistance(int distance) { this.distance = distance; } }
970
0.718557
0.717526
47
18.680851
18.213984
76
false
false
0
0
0
0
0
0
1
false
false
1
4db127128a238446170c63b775a7b2d7bff58f23
31,155,692,805,013
c069002e499e6c0e79239911e136301727493a8a
/Eskey/app/src/main/java/com/wolfie/eskey/model/IoHelper.java
4682af83a99ba3c37994d26307dfd4770d1a70d6
[]
no_license
manangatangy/eskey
https://github.com/manangatangy/eskey
3dab28c4a75a67e3d99f85b266a4523d106aae20
dd1084d7624ef5ee667df51eacc15fd67b094759
refs/heads/master
2020-09-21T12:56:47.469000
2018-03-07T11:38:03
2018-03-07T11:38:03
66,764,868
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.wolfie.eskey.model; import android.support.annotation.Nullable; import android.util.Log; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonIOException; import com.google.gson.JsonSyntaxException; import com.google.gson.annotations.Expose; import com.wolfie.eskey.util.crypto.Crypter; import com.wolfie.eskey.util.crypto.SpongyCrypter; import java.io.InputStreamReader; import java.util.List; /** * Support for passing data between the database form and the file form. * This class also is the structure used for json serialisation. */ public class IoHelper { private Crypter mMediumCrypter; // Current session entry crypter, not serialised. @Expose private MasterData masterData; @Expose private List<Entry> entries; public IoHelper() { // No arg ctor for deserialiser. } public IoHelper(Crypter mediumCrypter) { mMediumCrypter = mediumCrypter; } /** * The entries are expected to be encrypted, straight from the database. * A non-null MasterData (which is also serialised) means serialise the * entries un-decrypted. */ public String export(List<Entry> encryptedEntries, @Nullable MasterData masterData) { boolean dontDecrypt = (masterData != null); for (int i = 0; i < encryptedEntries.size(); i++) { encryptedEntries.get(i).decrypt(dontDecrypt ? null : mMediumCrypter); } this.masterData = masterData; // Will be null for exporting cleartext this.entries = encryptedEntries; // Will be decrypted for exporting cleartext DataSet.sort(this.entries); // Do the sort, now that text is decrypted. Gson gson = new GsonBuilder().setPrettyPrinting().excludeFieldsWithoutExposeAnnotation().create(); return gson.toJson(this); } /** * Returns encrypted entries, ready to be placed straight into the database. * A non-null password means that the stream is to be decrypted, otherwise * it is read as cleartext. * To prevent inadvertent loading into the model of cipher text, interpreted as * cleartext, check the presence of the masterData in the input stream. If it is * present (meaning the stream is ciphertext) but no password is suplied, then * throw error. */ public List<Entry> inport(InputStreamReader isr, @Nullable String password) throws JsonSyntaxException, JsonIOException, WrongPasswordException, MissingPasswordException, UnexpectedClearTextInputException { Gson gson = new Gson(); IoHelper ioHelper = gson.fromJson(isr, IoHelper.class); boolean dontDecrypt = (password == null); if (ioHelper.masterData == null) { // Stream is clear text, was user expecting cipher ? if (!dontDecrypt) { throw new UnexpectedClearTextInputException(); } } else { // Stream is cipher text, must be decrypted. if (dontDecrypt) { throw new MissingPasswordException(); } else { // Decrypt the input stream entries. // Fetch the salt and encrypted master-key from the stream/masterData. // Set the user-supplied password and attempt to decrypt the master-key. SpongyCrypter strongCrypter = SpongyCrypter.makeStrong(ioHelper.masterData.getSalt(), password); String decryptedKey = strongCrypter.decrypt(ioHelper.masterData.getKey()); Log.d("IoHelper", "inport, attempt is " + (decryptedKey == null)); if (decryptedKey == null) { throw new WrongPasswordException(); } else { // Now decrypt the stream/entries using the key they were encrypted with. Crypter crypter = SpongyCrypter.makeMedium(ioHelper.masterData.getSalt(), decryptedKey); for (int i = 0; i < ioHelper.entries.size(); i++) { ioHelper.entries.get(i).decrypt(crypter); } } } } // Stream entries have either been decrypted or they were already clear text // in the stream, so now encrypt them with the current session entry crypter. for (int i = 0; i < ioHelper.entries.size(); i++) { ioHelper.entries.get(i).encrypt(mMediumCrypter); } return ioHelper.entries; } public List<Entry> getEntries() { return entries; } public class WrongPasswordException extends Exception { } public class MissingPasswordException extends Exception { } public class UnexpectedClearTextInputException extends Exception { } }
UTF-8
Java
4,792
java
IoHelper.java
Java
[]
null
[]
package com.wolfie.eskey.model; import android.support.annotation.Nullable; import android.util.Log; import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.JsonIOException; import com.google.gson.JsonSyntaxException; import com.google.gson.annotations.Expose; import com.wolfie.eskey.util.crypto.Crypter; import com.wolfie.eskey.util.crypto.SpongyCrypter; import java.io.InputStreamReader; import java.util.List; /** * Support for passing data between the database form and the file form. * This class also is the structure used for json serialisation. */ public class IoHelper { private Crypter mMediumCrypter; // Current session entry crypter, not serialised. @Expose private MasterData masterData; @Expose private List<Entry> entries; public IoHelper() { // No arg ctor for deserialiser. } public IoHelper(Crypter mediumCrypter) { mMediumCrypter = mediumCrypter; } /** * The entries are expected to be encrypted, straight from the database. * A non-null MasterData (which is also serialised) means serialise the * entries un-decrypted. */ public String export(List<Entry> encryptedEntries, @Nullable MasterData masterData) { boolean dontDecrypt = (masterData != null); for (int i = 0; i < encryptedEntries.size(); i++) { encryptedEntries.get(i).decrypt(dontDecrypt ? null : mMediumCrypter); } this.masterData = masterData; // Will be null for exporting cleartext this.entries = encryptedEntries; // Will be decrypted for exporting cleartext DataSet.sort(this.entries); // Do the sort, now that text is decrypted. Gson gson = new GsonBuilder().setPrettyPrinting().excludeFieldsWithoutExposeAnnotation().create(); return gson.toJson(this); } /** * Returns encrypted entries, ready to be placed straight into the database. * A non-null password means that the stream is to be decrypted, otherwise * it is read as cleartext. * To prevent inadvertent loading into the model of cipher text, interpreted as * cleartext, check the presence of the masterData in the input stream. If it is * present (meaning the stream is ciphertext) but no password is suplied, then * throw error. */ public List<Entry> inport(InputStreamReader isr, @Nullable String password) throws JsonSyntaxException, JsonIOException, WrongPasswordException, MissingPasswordException, UnexpectedClearTextInputException { Gson gson = new Gson(); IoHelper ioHelper = gson.fromJson(isr, IoHelper.class); boolean dontDecrypt = (password == null); if (ioHelper.masterData == null) { // Stream is clear text, was user expecting cipher ? if (!dontDecrypt) { throw new UnexpectedClearTextInputException(); } } else { // Stream is cipher text, must be decrypted. if (dontDecrypt) { throw new MissingPasswordException(); } else { // Decrypt the input stream entries. // Fetch the salt and encrypted master-key from the stream/masterData. // Set the user-supplied password and attempt to decrypt the master-key. SpongyCrypter strongCrypter = SpongyCrypter.makeStrong(ioHelper.masterData.getSalt(), password); String decryptedKey = strongCrypter.decrypt(ioHelper.masterData.getKey()); Log.d("IoHelper", "inport, attempt is " + (decryptedKey == null)); if (decryptedKey == null) { throw new WrongPasswordException(); } else { // Now decrypt the stream/entries using the key they were encrypted with. Crypter crypter = SpongyCrypter.makeMedium(ioHelper.masterData.getSalt(), decryptedKey); for (int i = 0; i < ioHelper.entries.size(); i++) { ioHelper.entries.get(i).decrypt(crypter); } } } } // Stream entries have either been decrypted or they were already clear text // in the stream, so now encrypt them with the current session entry crypter. for (int i = 0; i < ioHelper.entries.size(); i++) { ioHelper.entries.get(i).encrypt(mMediumCrypter); } return ioHelper.entries; } public List<Entry> getEntries() { return entries; } public class WrongPasswordException extends Exception { } public class MissingPasswordException extends Exception { } public class UnexpectedClearTextInputException extends Exception { } }
4,792
0.649416
0.64879
113
41.407078
31.703728
112
false
false
0
0
0
0
0
0
0.575221
false
false
1
5d9e554c107eb46de14ce86a3340de7a0c86769f
7,284,264,564,392
5d5c2688698a2d6689c1d635724b550b31224c86
/extlib/lwp/product/runtime/eclipse/plugins/com.ibm.xsp.extlib.core/src/com/ibm/xsp/extlib/builder/ControlBuilder.java
d4a3553adcab42ca5ff535b63849331fe945b1e3
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0", "BSD-3-Clause", "LicenseRef-scancode-generic-cla", "LicenseRef-scancode-other-permissive", "MIT", "CDDL-1.1", "LicenseRef-scancode-public-domain" ]
permissive
OpenNTF/XPagesExtensionLibrary
https://github.com/OpenNTF/XPagesExtensionLibrary
6bffba4bd5eab5b148a3b4d700da244aab053743
25b3b1df7fafb7ceb131e07ade93de5c9ff733d5
refs/heads/master
2020-04-15T16:12:15.910000
2020-03-11T11:49:17
2020-03-11T11:49:17
26,643,618
21
35
Apache-2.0
false
2019-03-25T12:55:44
2014-11-14T15:08:35
2019-03-20T13:27:56
2019-03-25T12:39:25
31,266
18
32
24
Java
false
null
/* * © Copyright IBM Corp. 2010, 2013 * * 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.ibm.xsp.extlib.builder; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.faces.FacesException; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import com.ibm.xsp.component.FacesComponent; import com.ibm.xsp.context.FacesContextEx; import com.ibm.xsp.page.FacesComponentBuilder; import com.ibm.xsp.page.FacesPageException; import com.ibm.xsp.util.TypedUtil; public class ControlBuilder { public static UIComponent buildControl(FacesContext context, IControl control, boolean applyTheme) throws FacesException { return buildControl(context, null, null, control, applyTheme); } public static UIComponent buildControl(FacesContext context, DynamicComponentFactory factory, UIComponent parent, IControl control, boolean applyTheme) throws FacesException { // We create the component ad we add it to the parent *before* actually constructing it // This is required by some component, like UIIncludeCompiste, which look for the viewroot in // the control hierarchy. UIComponent component = control.getComponent(); if(component.getParent()==null && parent!=null) { TypedUtil.getChildren(parent).add(component); } // Ok, now we build it MainBuilder builder = new MainBuilder(factory, control, component); UIComponent c = build(context, builder); if(c!=null) { if(applyTheme) { ((FacesContextEx)context).getStyleKit().applyStyles(context, c); } } return c; } protected static UIComponent build(FacesContext context, Builder builder) throws FacesException { // Should we manage includes here, as in CompiledComponentBuilder?? UIComponent component = builder.getUIComponent(); if (component instanceof FacesComponent) { FacesComponent facesComp = (FacesComponent)component; facesComp.initBeforeContents(context); facesComp.buildContents(context, builder); facesComp.initAfterContents(context); } else { builder.buildAll(context, component, true); } return component; } /** * Wraps a JSF control. */ public static interface IControl { public String getId(); public UIComponent getComponent(); public List<IControl> getChildren(); public Map<String,IControl> getFacets(); } /** * Basic control implementation. * This implement the IControl interface. */ public static class ControlImpl<T extends UIComponent> implements IControl { private T component; private List<IControl> children; private Map<String,IControl> facets; public ControlImpl(T component) { this.component = component; } public T getComponent() { return component; } public String getId() { if(component!=null) { return component.getId(); } return null; } public List<IControl> getChildren() { return children; } public void addChild(IControl c) { if(children==null) { children = new ArrayList<IControl>(); } children.add(c); } public Map<String,IControl> getFacets() { return facets; } public void putFacet(String name, IControl c) { if(facets==null) { facets = new HashMap<String,IControl>(); } facets.put(name,c); } } /** * Custom JSF tree builder, using an hierarchy of Control objects. */ public static class Builder implements FacesComponentBuilder, DynamicComponentBuilder { private Builder parent; private IControl control; private UIComponent component; public Builder(Builder parent, IControl control, UIComponent component) { this.parent = parent; this.control = control; this.component = component; } public String getSourceComponentRef() { return parent.getSourceComponentRef(); } public Builder getParent() { return parent; } public IControl getControl() { return control; } public UIComponent getUIComponent() { return component; } public void buildAll(FacesContext context, UIComponent parent, boolean includeFacets) throws FacesPageException { // build the children of this component buildChildren(context, parent); // optionally build the facets if (includeFacets) { buildFacets(context, parent); } } public void buildChildren(FacesContext context, UIComponent parent) throws FacesPageException { List<IControl> children = control.getChildren(); if(children!=null) { UIComponent parentComponent = getUIComponent(); List<UIComponent> siblings = TypedUtil.getChildren(parentComponent); for(IControl e: children) { UIComponent childControl = e.getComponent(); if(childControl!=null) { siblings.add(childControl); Builder builder = new Builder(this,e,childControl); build(context,builder); } } } } public boolean buildFacet(FacesContext context, UIComponent parent, String facetName) throws FacesPageException { Map<String,IControl> facets = control.getFacets(); if(facets!=null) { IControl ic = facets.get(facetName); if(ic!=null) { UIComponent parentComponent = getUIComponent(); Map<String, UIComponent> siblingFacets = TypedUtil.getFacets(parentComponent); UIComponent facetComponent = ic.getComponent(); if(facetComponent!=null) { siblingFacets.put(facetName, facetComponent); Builder builder = new Builder(this,ic,facetComponent); build(context,builder); return true; } } } return false; } public void buildFacets(FacesContext context, UIComponent parent) throws FacesPageException { Map<String,IControl> facets = control.getFacets(); if(facets!=null) { UIComponent parentComponent = getUIComponent(); Map<String, UIComponent> siblingFacets = TypedUtil.getFacets(parentComponent); for(Map.Entry<String, IControl> e: facets.entrySet()) { String facetName = e.getKey(); IControl ic = e.getValue(); UIComponent facetComponent = ic.getComponent(); if(facetComponent!=null) { siblingFacets.put(facetName, facetComponent); Builder builder = new Builder(this,ic,facetComponent); build(context,builder); } } } } public boolean isFacetAvailable(FacesContext context, UIComponent parent, String facetName) { Map<String,IControl> facets = control.getFacets(); if(facets!=null) { return facets.containsKey(facetName); } return false; } } public static class MainBuilder extends Builder { private DynamicComponentFactory factory; public MainBuilder(DynamicComponentFactory factory, IControl control, UIComponent component) { super(null, control, component); this.factory = factory; } public String getSourceComponentRef() { return factory!=null ? factory.getSourceComponentRef() : null; } } }
WINDOWS-1252
Java
7,935
java
ControlBuilder.java
Java
[]
null
[]
/* * © Copyright IBM Corp. 2010, 2013 * * 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.ibm.xsp.extlib.builder; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import javax.faces.FacesException; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import com.ibm.xsp.component.FacesComponent; import com.ibm.xsp.context.FacesContextEx; import com.ibm.xsp.page.FacesComponentBuilder; import com.ibm.xsp.page.FacesPageException; import com.ibm.xsp.util.TypedUtil; public class ControlBuilder { public static UIComponent buildControl(FacesContext context, IControl control, boolean applyTheme) throws FacesException { return buildControl(context, null, null, control, applyTheme); } public static UIComponent buildControl(FacesContext context, DynamicComponentFactory factory, UIComponent parent, IControl control, boolean applyTheme) throws FacesException { // We create the component ad we add it to the parent *before* actually constructing it // This is required by some component, like UIIncludeCompiste, which look for the viewroot in // the control hierarchy. UIComponent component = control.getComponent(); if(component.getParent()==null && parent!=null) { TypedUtil.getChildren(parent).add(component); } // Ok, now we build it MainBuilder builder = new MainBuilder(factory, control, component); UIComponent c = build(context, builder); if(c!=null) { if(applyTheme) { ((FacesContextEx)context).getStyleKit().applyStyles(context, c); } } return c; } protected static UIComponent build(FacesContext context, Builder builder) throws FacesException { // Should we manage includes here, as in CompiledComponentBuilder?? UIComponent component = builder.getUIComponent(); if (component instanceof FacesComponent) { FacesComponent facesComp = (FacesComponent)component; facesComp.initBeforeContents(context); facesComp.buildContents(context, builder); facesComp.initAfterContents(context); } else { builder.buildAll(context, component, true); } return component; } /** * Wraps a JSF control. */ public static interface IControl { public String getId(); public UIComponent getComponent(); public List<IControl> getChildren(); public Map<String,IControl> getFacets(); } /** * Basic control implementation. * This implement the IControl interface. */ public static class ControlImpl<T extends UIComponent> implements IControl { private T component; private List<IControl> children; private Map<String,IControl> facets; public ControlImpl(T component) { this.component = component; } public T getComponent() { return component; } public String getId() { if(component!=null) { return component.getId(); } return null; } public List<IControl> getChildren() { return children; } public void addChild(IControl c) { if(children==null) { children = new ArrayList<IControl>(); } children.add(c); } public Map<String,IControl> getFacets() { return facets; } public void putFacet(String name, IControl c) { if(facets==null) { facets = new HashMap<String,IControl>(); } facets.put(name,c); } } /** * Custom JSF tree builder, using an hierarchy of Control objects. */ public static class Builder implements FacesComponentBuilder, DynamicComponentBuilder { private Builder parent; private IControl control; private UIComponent component; public Builder(Builder parent, IControl control, UIComponent component) { this.parent = parent; this.control = control; this.component = component; } public String getSourceComponentRef() { return parent.getSourceComponentRef(); } public Builder getParent() { return parent; } public IControl getControl() { return control; } public UIComponent getUIComponent() { return component; } public void buildAll(FacesContext context, UIComponent parent, boolean includeFacets) throws FacesPageException { // build the children of this component buildChildren(context, parent); // optionally build the facets if (includeFacets) { buildFacets(context, parent); } } public void buildChildren(FacesContext context, UIComponent parent) throws FacesPageException { List<IControl> children = control.getChildren(); if(children!=null) { UIComponent parentComponent = getUIComponent(); List<UIComponent> siblings = TypedUtil.getChildren(parentComponent); for(IControl e: children) { UIComponent childControl = e.getComponent(); if(childControl!=null) { siblings.add(childControl); Builder builder = new Builder(this,e,childControl); build(context,builder); } } } } public boolean buildFacet(FacesContext context, UIComponent parent, String facetName) throws FacesPageException { Map<String,IControl> facets = control.getFacets(); if(facets!=null) { IControl ic = facets.get(facetName); if(ic!=null) { UIComponent parentComponent = getUIComponent(); Map<String, UIComponent> siblingFacets = TypedUtil.getFacets(parentComponent); UIComponent facetComponent = ic.getComponent(); if(facetComponent!=null) { siblingFacets.put(facetName, facetComponent); Builder builder = new Builder(this,ic,facetComponent); build(context,builder); return true; } } } return false; } public void buildFacets(FacesContext context, UIComponent parent) throws FacesPageException { Map<String,IControl> facets = control.getFacets(); if(facets!=null) { UIComponent parentComponent = getUIComponent(); Map<String, UIComponent> siblingFacets = TypedUtil.getFacets(parentComponent); for(Map.Entry<String, IControl> e: facets.entrySet()) { String facetName = e.getKey(); IControl ic = e.getValue(); UIComponent facetComponent = ic.getComponent(); if(facetComponent!=null) { siblingFacets.put(facetName, facetComponent); Builder builder = new Builder(this,ic,facetComponent); build(context,builder); } } } } public boolean isFacetAvailable(FacesContext context, UIComponent parent, String facetName) { Map<String,IControl> facets = control.getFacets(); if(facets!=null) { return facets.containsKey(facetName); } return false; } } public static class MainBuilder extends Builder { private DynamicComponentFactory factory; public MainBuilder(DynamicComponentFactory factory, IControl control, UIComponent component) { super(null, control, component); this.factory = factory; } public String getSourceComponentRef() { return factory!=null ? factory.getSourceComponentRef() : null; } } }
7,935
0.668641
0.667129
252
30.484127
29.07045
176
false
false
0
0
0
0
0
0
2.051587
false
false
1
45c90fe82fd8fc839d7f5a6ca048a8815a8cefcf
9,552,007,332,676
a037a2a38bc2b6577a2a3e25f7207516081be639
/src/Assignment1/LowestCommonAncestorTest.java
0497443c097bb2a0d8c6d5767a85de4e916a7e49
[]
no_license
ofarreco/CSU33012
https://github.com/ofarreco/CSU33012
e8c602e40c5db314745ef4ecdd1d4de563fd25a4
ead3e3c43d7c2e5a113860f9affac63465371708
refs/heads/master
2020-08-03T07:46:24.312000
2019-10-18T16:57:54
2019-10-18T16:57:54
211,667,780
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Assignment1; import static org.junit.Assert.*; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @RunWith(JUnit4.class) class LowestCommonAncestorTest { public void testIsTreeEmpty() { LowestCommonAncestor<Integer, Integer> test = new LowestCommonAncestor<Integer, Integer>(); boolean isEmpty = test.isEmpty(); assertEquals(isEmpty, true); test.put(3, 6); test.put(6, 12); test.put(9, 15); test.put(12, 18); isEmpty = test.isEmpty(); assertEquals(isEmpty, false); } @Test public void testTreeSize() { LowestCommonAncestor<Integer, Integer> test = new LowestCommonAncestor<Integer, Integer>(); assertEquals(test.size(), 0); test.put(1, 1); assertEquals(test.size(), 1); test.put(2, 4); test.put(3, 6); assertEquals(test.size(), 3); test.put(1, 8); assertEquals(test.size(), 3); //Size doesn't change as element already exists } @Test public void testGet() { LowestCommonAncestor<Integer, Integer> test = new LowestCommonAncestor<Integer, Integer>(); assertNull(test.get(3)); test.put(3, 1); assertSame(test.get(3), 1); test.put(4,2); test.put(5, 3); test.put(6, 4); assertSame(test.get(5), 3); assertNull(test.get(3)); } @Test public void testFullTree() { LowestCommonAncestor<Integer, Integer> test = new LowestCommonAncestor<Integer, Integer>(); test.put(1, 11); test.put(2, 10); test.put(3, 9); test.put(4, 8); test.put(5, 7); test.put(6, 6); test.put(7, 5); test.put(8, 4); test.put(9, 3); test.put(10, 2); test.put(11, 1); assertSame(test.search(test.root,18,1).key,8); assertSame(test.search(test.root,18,7).key,8); assertSame(test.search(test.root,12,16).key,14); } @Test public void testTwoNodes() { LowestCommonAncestor<Integer, Integer> test = new LowestCommonAncestor<Integer, Integer>(); test.put(7, 1); test.put(8, 2); assertSame(test.search(test.root, 7, 8).key, 7); assertNull(test.search(test.root, 7, 1)); //Test to see if one node doesn't exist } @Test public void testForNonExistingNodes() { LowestCommonAncestor<Integer, Integer> test = new LowestCommonAncestor<Integer, Integer>(); test.put(1, 6); test.put(2, 5); test.put(3, 4); test.put(4, 3); test.put(5, 2); test.put(6, 1); assertNull(test.search(test.root, 7, 10)); assertNull(test.search(test.root, 8, 9)); assertNull(test.search(test.root, 9, 8)); assertNull(test.search(test.root, 10, 7)); } @Test public void testSameValue() { LowestCommonAncestor<Integer, Integer> test = new LowestCommonAncestor<Integer, Integer>(); test.put(1, 6); test.put(2, 5); test.put(3, 4); test.put(4, 3); test.put(5, 2); test.put(6, 1); assertSame(test.search(test.root, 1,1).key, 1); assertSame(test.search(test.root, 4, 4).key, 4); } }
UTF-8
Java
2,810
java
LowestCommonAncestorTest.java
Java
[]
null
[]
package Assignment1; import static org.junit.Assert.*; import org.junit.Test; import org.junit.runner.RunWith; import org.junit.runners.JUnit4; @RunWith(JUnit4.class) class LowestCommonAncestorTest { public void testIsTreeEmpty() { LowestCommonAncestor<Integer, Integer> test = new LowestCommonAncestor<Integer, Integer>(); boolean isEmpty = test.isEmpty(); assertEquals(isEmpty, true); test.put(3, 6); test.put(6, 12); test.put(9, 15); test.put(12, 18); isEmpty = test.isEmpty(); assertEquals(isEmpty, false); } @Test public void testTreeSize() { LowestCommonAncestor<Integer, Integer> test = new LowestCommonAncestor<Integer, Integer>(); assertEquals(test.size(), 0); test.put(1, 1); assertEquals(test.size(), 1); test.put(2, 4); test.put(3, 6); assertEquals(test.size(), 3); test.put(1, 8); assertEquals(test.size(), 3); //Size doesn't change as element already exists } @Test public void testGet() { LowestCommonAncestor<Integer, Integer> test = new LowestCommonAncestor<Integer, Integer>(); assertNull(test.get(3)); test.put(3, 1); assertSame(test.get(3), 1); test.put(4,2); test.put(5, 3); test.put(6, 4); assertSame(test.get(5), 3); assertNull(test.get(3)); } @Test public void testFullTree() { LowestCommonAncestor<Integer, Integer> test = new LowestCommonAncestor<Integer, Integer>(); test.put(1, 11); test.put(2, 10); test.put(3, 9); test.put(4, 8); test.put(5, 7); test.put(6, 6); test.put(7, 5); test.put(8, 4); test.put(9, 3); test.put(10, 2); test.put(11, 1); assertSame(test.search(test.root,18,1).key,8); assertSame(test.search(test.root,18,7).key,8); assertSame(test.search(test.root,12,16).key,14); } @Test public void testTwoNodes() { LowestCommonAncestor<Integer, Integer> test = new LowestCommonAncestor<Integer, Integer>(); test.put(7, 1); test.put(8, 2); assertSame(test.search(test.root, 7, 8).key, 7); assertNull(test.search(test.root, 7, 1)); //Test to see if one node doesn't exist } @Test public void testForNonExistingNodes() { LowestCommonAncestor<Integer, Integer> test = new LowestCommonAncestor<Integer, Integer>(); test.put(1, 6); test.put(2, 5); test.put(3, 4); test.put(4, 3); test.put(5, 2); test.put(6, 1); assertNull(test.search(test.root, 7, 10)); assertNull(test.search(test.root, 8, 9)); assertNull(test.search(test.root, 9, 8)); assertNull(test.search(test.root, 10, 7)); } @Test public void testSameValue() { LowestCommonAncestor<Integer, Integer> test = new LowestCommonAncestor<Integer, Integer>(); test.put(1, 6); test.put(2, 5); test.put(3, 4); test.put(4, 3); test.put(5, 2); test.put(6, 1); assertSame(test.search(test.root, 1,1).key, 1); assertSame(test.search(test.root, 4, 4).key, 4); } }
2,810
0.673665
0.627402
112
24.089285
23.634703
93
false
false
0
0
0
0
0
0
2.821429
false
false
1
0fe0f6601576041c77698b7a119e3c3e01c40a74
12,300,786,394,312
3b64b06c7c7a200419cb58d2398699238737e8c6
/NoFallEnd/src/me/bgorman/NoFallEnd.java
a582535b04d28508f7440fb3bd50e076f0aa0ef7
[]
no_license
bgorman87/NoFallEnd
https://github.com/bgorman87/NoFallEnd
bddeae2019fea72036dc6496c340846c0aeddac3
d2c1d275af8373668a5d72b9262386b913c84c5e
refs/heads/master
2022-05-31T00:31:23.398000
2017-03-25T01:58:17
2017-03-25T01:58:17
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package me.bgorman; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.plugin.java.JavaPlugin; public class NoFallEnd extends JavaPlugin implements Listener { public void onEnable() { Bukkit.getPluginManager().registerEvents(this, this); getLogger().info("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); getLogger().info("~ NoFallEnd has been enabled ~"); getLogger().info("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); } @EventHandler public void onEntityDamage(EntityDamageEvent e) { if ((e.getEntity() instanceof Player)) { Player p = (Player)e.getEntity(); if (e.getCause().equals(EntityDamageEvent.DamageCause.FALL) && p.getWorld().getName().equals("world_the_end")) { e.setCancelled(true); } } } }
UTF-8
Java
911
java
NoFallEnd.java
Java
[]
null
[]
package me.bgorman; import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.plugin.java.JavaPlugin; public class NoFallEnd extends JavaPlugin implements Listener { public void onEnable() { Bukkit.getPluginManager().registerEvents(this, this); getLogger().info("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); getLogger().info("~ NoFallEnd has been enabled ~"); getLogger().info("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); } @EventHandler public void onEntityDamage(EntityDamageEvent e) { if ((e.getEntity() instanceof Player)) { Player p = (Player)e.getEntity(); if (e.getCause().equals(EntityDamageEvent.DamageCause.FALL) && p.getWorld().getName().equals("world_the_end")) { e.setCancelled(true); } } } }
911
0.642151
0.642151
30
29.4
26.644073
119
false
false
0
0
0
0
0
0
0.466667
false
false
1
8a7adfaae18073e7f99f96300d4d4b21189f00e2
23,433,341,583,695
aa26b17314fac6f8eb68ec1f3301392445aecfc6
/harp-tutorial-app/src/main/java/edu/iu/rf/RFMapper.java
4276b95f06edc7194963eddccbf19d173c47f89d
[ "Apache-2.0" ]
permissive
DSC-SPIDAL/Harp
https://github.com/DSC-SPIDAL/Harp
748d9bfb468cf7819762152cd08c06a2783fa3a4
419fc2fb06407ed7facb0a05d2d2206ef9b21b3b
refs/heads/master
2018-02-09T02:24:05.503000
2018-01-21T18:12:03
2018-01-21T18:12:03
81,340,825
2
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package edu.iu.rf; import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStreamWriter; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.Random; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FSDataOutputStream; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.mapred.CollectiveMapper; import edu.iu.harp.example.IntArrPlus; import edu.iu.harp.partition.Partition; import edu.iu.harp.partition.Table; import edu.iu.harp.resource.IntArray; import edu.iu.harp.schdynamic.DynamicScheduler; import net.sf.javaml.classification.Classifier; import net.sf.javaml.core.Dataset; import net.sf.javaml.core.DefaultDataset; import net.sf.javaml.core.Instance; public class RFMapper extends CollectiveMapper<String, String, Object, Object> { private int numTrees; private int numMapTasks; private int numThreads; private int numFeatures; private String trainPath; private String testPath; private String outputPath; private Configuration configuration; private List<RFTask> rfThreads; private DynamicScheduler<Dataset, Classifier, RFTask> rfScheduler; @Override protected void setup(Context context) throws IOException, InterruptedException { configuration = context.getConfiguration(); numTrees = configuration.getInt("numTrees", 100); numMapTasks = configuration.getInt("numMapTasks", 4); numThreads = configuration.getInt("numThreads", 5); trainPath = configuration.get("trainPath"); testPath = configuration.get("testPath"); outputPath = configuration.get("outputPath"); } protected void mapCollective( KeyValReader reader, Context context) throws IOException, InterruptedException { Dataset trainDataset = new DefaultDataset(); Dataset testDataset = new DefaultDataset(); ArrayList<Classifier> rfClassifier = new ArrayList<Classifier>(); while (reader.nextKeyValue()) { String value = reader.getCurrentValue(); Util.loadDataset(value, trainDataset, configuration); } Util.loadDataset(testPath, testDataset, configuration); initialThreads(context); numFeatures = trainDataset.noAttributes(); rfScheduler.start(); for (int i = 0; i < numTrees / numMapTasks; i++) { Dataset baggingDataset = Util.doBagging(trainDataset); rfScheduler.submit(trainDataset); } while (rfScheduler.hasOutput()) { rfClassifier .add(rfScheduler.waitForOutput()); } context.progress(); rfScheduler.stop(); Table<IntArray> predictTable = new Table<>(0, new IntArrPlus()); int partitionId = 0; for (Instance testData : testDataset) { IntArray votes = IntArray.create(2, false); for (Classifier rf : rfClassifier) { Object classValue = rf.classify(testData); if (classValue.toString().equals("0")) { votes.get()[0] += 1; } else { votes.get()[1] += 1; } } Partition<IntArray> partition = new Partition<IntArray>(partitionId, votes); predictTable.addPartition(partition); partitionId += 1; } reduce("main", "reduce", predictTable, 0); if (this.isMaster()) { printResults(predictTable, testDataset); } predictTable.release(); } private void initialThreads(Context context) { rfThreads = new LinkedList<>(); for (int i = 0; i < numThreads; i++) { rfThreads .add(new RFTask(numFeatures, context)); } rfScheduler = new DynamicScheduler<>(rfThreads); } private void printResults( Table<IntArray> predictTable, Dataset testDataset) throws IOException { int correct = 0; int total = 0; for (Partition<IntArray> partition : predictTable .getPartitions()) { Object label = testDataset .get(partition.id()).classValue(); int predictLabel; IntArray votes = partition.get(); int label0 = votes.get()[0]; int label1 = votes.get()[1]; if (label0 > label1) { predictLabel = 0; } else if (label0 < label1) { predictLabel = 1; } else { Random random = new Random(); if (random.nextDouble() < 0.5) { predictLabel = 0; } else { predictLabel = 1; } } if (label.toString() .equals(Integer.toString(predictLabel))) { correct += 1; } total += 1; } Path path = new Path(outputPath); FileSystem fs = path.getFileSystem(configuration); FSDataOutputStream out = fs.create(path, true); BufferedWriter writer = new BufferedWriter( new OutputStreamWriter(out)); writer.write( Double.toString(correct * 1.0 / total)); writer.close(); } }
UTF-8
Java
4,897
java
RFMapper.java
Java
[]
null
[]
package edu.iu.rf; import java.io.BufferedWriter; import java.io.IOException; import java.io.OutputStreamWriter; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; import java.util.Random; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FSDataOutputStream; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.mapred.CollectiveMapper; import edu.iu.harp.example.IntArrPlus; import edu.iu.harp.partition.Partition; import edu.iu.harp.partition.Table; import edu.iu.harp.resource.IntArray; import edu.iu.harp.schdynamic.DynamicScheduler; import net.sf.javaml.classification.Classifier; import net.sf.javaml.core.Dataset; import net.sf.javaml.core.DefaultDataset; import net.sf.javaml.core.Instance; public class RFMapper extends CollectiveMapper<String, String, Object, Object> { private int numTrees; private int numMapTasks; private int numThreads; private int numFeatures; private String trainPath; private String testPath; private String outputPath; private Configuration configuration; private List<RFTask> rfThreads; private DynamicScheduler<Dataset, Classifier, RFTask> rfScheduler; @Override protected void setup(Context context) throws IOException, InterruptedException { configuration = context.getConfiguration(); numTrees = configuration.getInt("numTrees", 100); numMapTasks = configuration.getInt("numMapTasks", 4); numThreads = configuration.getInt("numThreads", 5); trainPath = configuration.get("trainPath"); testPath = configuration.get("testPath"); outputPath = configuration.get("outputPath"); } protected void mapCollective( KeyValReader reader, Context context) throws IOException, InterruptedException { Dataset trainDataset = new DefaultDataset(); Dataset testDataset = new DefaultDataset(); ArrayList<Classifier> rfClassifier = new ArrayList<Classifier>(); while (reader.nextKeyValue()) { String value = reader.getCurrentValue(); Util.loadDataset(value, trainDataset, configuration); } Util.loadDataset(testPath, testDataset, configuration); initialThreads(context); numFeatures = trainDataset.noAttributes(); rfScheduler.start(); for (int i = 0; i < numTrees / numMapTasks; i++) { Dataset baggingDataset = Util.doBagging(trainDataset); rfScheduler.submit(trainDataset); } while (rfScheduler.hasOutput()) { rfClassifier .add(rfScheduler.waitForOutput()); } context.progress(); rfScheduler.stop(); Table<IntArray> predictTable = new Table<>(0, new IntArrPlus()); int partitionId = 0; for (Instance testData : testDataset) { IntArray votes = IntArray.create(2, false); for (Classifier rf : rfClassifier) { Object classValue = rf.classify(testData); if (classValue.toString().equals("0")) { votes.get()[0] += 1; } else { votes.get()[1] += 1; } } Partition<IntArray> partition = new Partition<IntArray>(partitionId, votes); predictTable.addPartition(partition); partitionId += 1; } reduce("main", "reduce", predictTable, 0); if (this.isMaster()) { printResults(predictTable, testDataset); } predictTable.release(); } private void initialThreads(Context context) { rfThreads = new LinkedList<>(); for (int i = 0; i < numThreads; i++) { rfThreads .add(new RFTask(numFeatures, context)); } rfScheduler = new DynamicScheduler<>(rfThreads); } private void printResults( Table<IntArray> predictTable, Dataset testDataset) throws IOException { int correct = 0; int total = 0; for (Partition<IntArray> partition : predictTable .getPartitions()) { Object label = testDataset .get(partition.id()).classValue(); int predictLabel; IntArray votes = partition.get(); int label0 = votes.get()[0]; int label1 = votes.get()[1]; if (label0 > label1) { predictLabel = 0; } else if (label0 < label1) { predictLabel = 1; } else { Random random = new Random(); if (random.nextDouble() < 0.5) { predictLabel = 0; } else { predictLabel = 1; } } if (label.toString() .equals(Integer.toString(predictLabel))) { correct += 1; } total += 1; } Path path = new Path(outputPath); FileSystem fs = path.getFileSystem(configuration); FSDataOutputStream out = fs.create(path, true); BufferedWriter writer = new BufferedWriter( new OutputStreamWriter(out)); writer.write( Double.toString(correct * 1.0 / total)); writer.close(); } }
4,897
0.663059
0.655503
178
26.511236
16.455332
68
false
false
0
0
0
0
0
0
0.657303
false
false
1
40d1a7a0ddea5162c8c0bc1e5e46d555f25a0726
14,242,111,599,054
afcf30b45709234c8bf6a53a97ccdbe2be1556e0
/src/Main/Java/com/stackroute/javeexercise2/MemberVariable.java
c90d15255006b24863f7ff9d058eae4b6b208fa1
[]
no_license
mrudulabomma/exercise3
https://github.com/mrudulabomma/exercise3
f8dc8ce8d9e4288345d5cd6d6d93c6c48c925d16
736e2690665875fe8dc0cde2205d030103c28c63
refs/heads/master
2020-06-13T04:13:02.677000
2019-07-03T06:59:02
2019-07-03T06:59:02
194,530,797
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.stackroute.javeexercise2; public class MemberVariable { Member member=new Member(); public String printValues(String name,int age,double salary) { member.name=name; member.age=age; member.salary=salary; return "Members name:"+member.name+"\n"+"Members age:"+member.age+"\n"+"members salary:"+member.salary; } }
UTF-8
Java
373
java
MemberVariable.java
Java
[]
null
[]
package com.stackroute.javeexercise2; public class MemberVariable { Member member=new Member(); public String printValues(String name,int age,double salary) { member.name=name; member.age=age; member.salary=salary; return "Members name:"+member.name+"\n"+"Members age:"+member.age+"\n"+"members salary:"+member.salary; } }
373
0.662198
0.659517
13
27.692308
29.954798
111
false
false
0
0
0
0
0
0
0.615385
false
false
1
1fa968c48e539ed311f55496f4a0b9f7e4317887
4,664,334,503,603
1ae381b7b8c904451db8742abdfcc320af1315eb
/GreenAssociationRelationship/src/edu/buffalo/cse/green/relationship/association/AssociationRemover.java
659d5fd3d12a71e242204419c2288d73515c07c7
[]
no_license
fmjrey/Green-UML
https://github.com/fmjrey/Green-UML
af01b10653f4901dd9336bb86ae2b7cd2f152373
b4afec8aad5378e02cb0bfb3b2a44aebc2972276
HEAD
2016-09-11T11:19:17.594000
2011-03-22T07:34:13
2011-03-22T07:34:13
1,376,568
0
3
null
null
null
null
null
null
null
null
null
null
null
null
null
/* This file is part of Green. * * Copyright (C) 2005 The Research Foundation of State University of New York * All Rights Under Copyright Reserved, The Research Foundation of S.U.N.Y. * * Green is free software, licensed under the terms of the Eclipse * Public License, version 1.0. The license is available at * http://www.eclipse.org/legal/epl-v10.html */ package edu.buffalo.cse.green.relationship.association; import static org.eclipse.jdt.core.dom.ASTNode.FIELD_DECLARATION; import java.util.AbstractList; import java.util.ArrayList; import java.util.List; import org.eclipse.jdt.core.IField; import org.eclipse.jdt.core.ILocalVariable; import org.eclipse.jdt.core.dom.Assignment; import org.eclipse.jdt.core.dom.Block; import org.eclipse.jdt.core.dom.BodyDeclaration; import org.eclipse.jdt.core.dom.ExpressionStatement; import org.eclipse.jdt.core.dom.FieldDeclaration; import org.eclipse.jdt.core.dom.IBinding; import org.eclipse.jdt.core.dom.MethodDeclaration; import org.eclipse.jdt.core.dom.Name; import org.eclipse.jdt.core.dom.SingleVariableDeclaration; import org.eclipse.jdt.core.dom.VariableDeclarationFragment; import edu.buffalo.cse.green.relationships.RelationshipRemover; import edu.buffalo.cse.green.relationships.DeclarationInfoProvider; /** * @see edu.buffalo.cse.green.relationship.RelationshipRemover * * @author bcmartin */ public class AssociationRemover extends RelationshipRemover { private List<ExpressionStatement> lEXP; private List<IField> lFIE; private List<ILocalVariable> lPAR; private DeclarationInfoProvider _typeInfo; /** * @see edu.buffalo.cse.green.relationships.RelationshipRemover#init() */ protected void init() { lEXP = new ArrayList<ExpressionStatement>(); lFIE = new ArrayList<IField>(); lPAR = new ArrayList<ILocalVariable>(); } /** * @see edu.buffalo.cse.green.relationships.RelationshipRemover#finish() */ protected void finish() { for (ExpressionStatement exp : lEXP) { Block block = (Block) exp.getParent(); exp.delete(); MethodDeclaration mdc = (MethodDeclaration) block.getParent(); processAddInvocations(block); for (SingleVariableDeclaration varDec : (AbstractList<SingleVariableDeclaration>) mdc .parameters()) { IBinding binding = varDec.getName().resolveBinding(); if (binding.getJavaElement().equals( lPAR.get(0))) { varDec.delete(); break; } } lPAR.remove(0); } for (IField field : lFIE) { for (Object element : _typeInfo.bodyDeclarations()) { BodyDeclaration dec = (BodyDeclaration) element; if (dec.getNodeType() == FIELD_DECLARATION) { FieldDeclaration fieldDec = (FieldDeclaration) dec; List<VariableDeclarationFragment> fragments = (AbstractList<VariableDeclarationFragment>) fieldDec.fragments(); for (VariableDeclarationFragment fragment : fragments) { IField dField = (IField) fragment.getName() .resolveBinding().getJavaElement(); if (field.equals(dField)) { fieldDec.delete(); break; } } } } } } /** * @see edu.buffalo.cse.green.relationships.RelationshipVisitor#process(org.eclipse.jdt.core.dom.TypeDeclaration) */ protected boolean process(DeclarationInfoProvider node) { return true; } /** * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.ExpressionStatement) */ public boolean visit(ExpressionStatement node) { if (getMatcher().match(node, getRelationship().getFeatures().get(0))) { _typeInfo = getCurrentTypeInfo(); lEXP.add(node); Assignment ass = (Assignment) node.getExpression(); Name lName = (Name) ass.getLeftHandSide(); Name rName = (Name) ass.getRightHandSide(); lFIE.add((IField) lName.resolveBinding().getJavaElement()); lPAR.add((ILocalVariable) rName.resolveBinding().getJavaElement()); } return true; } }
UTF-8
Java
3,891
java
AssociationRemover.java
Java
[ { "context": "en.relationship.RelationshipRemover\n * \n * @author bcmartin\n */\npublic class AssociationRemover extends Relat", "end": 1367, "score": 0.7890427112579346, "start": 1359, "tag": "USERNAME", "value": "bcmartin" } ]
null
[]
/* This file is part of Green. * * Copyright (C) 2005 The Research Foundation of State University of New York * All Rights Under Copyright Reserved, The Research Foundation of S.U.N.Y. * * Green is free software, licensed under the terms of the Eclipse * Public License, version 1.0. The license is available at * http://www.eclipse.org/legal/epl-v10.html */ package edu.buffalo.cse.green.relationship.association; import static org.eclipse.jdt.core.dom.ASTNode.FIELD_DECLARATION; import java.util.AbstractList; import java.util.ArrayList; import java.util.List; import org.eclipse.jdt.core.IField; import org.eclipse.jdt.core.ILocalVariable; import org.eclipse.jdt.core.dom.Assignment; import org.eclipse.jdt.core.dom.Block; import org.eclipse.jdt.core.dom.BodyDeclaration; import org.eclipse.jdt.core.dom.ExpressionStatement; import org.eclipse.jdt.core.dom.FieldDeclaration; import org.eclipse.jdt.core.dom.IBinding; import org.eclipse.jdt.core.dom.MethodDeclaration; import org.eclipse.jdt.core.dom.Name; import org.eclipse.jdt.core.dom.SingleVariableDeclaration; import org.eclipse.jdt.core.dom.VariableDeclarationFragment; import edu.buffalo.cse.green.relationships.RelationshipRemover; import edu.buffalo.cse.green.relationships.DeclarationInfoProvider; /** * @see edu.buffalo.cse.green.relationship.RelationshipRemover * * @author bcmartin */ public class AssociationRemover extends RelationshipRemover { private List<ExpressionStatement> lEXP; private List<IField> lFIE; private List<ILocalVariable> lPAR; private DeclarationInfoProvider _typeInfo; /** * @see edu.buffalo.cse.green.relationships.RelationshipRemover#init() */ protected void init() { lEXP = new ArrayList<ExpressionStatement>(); lFIE = new ArrayList<IField>(); lPAR = new ArrayList<ILocalVariable>(); } /** * @see edu.buffalo.cse.green.relationships.RelationshipRemover#finish() */ protected void finish() { for (ExpressionStatement exp : lEXP) { Block block = (Block) exp.getParent(); exp.delete(); MethodDeclaration mdc = (MethodDeclaration) block.getParent(); processAddInvocations(block); for (SingleVariableDeclaration varDec : (AbstractList<SingleVariableDeclaration>) mdc .parameters()) { IBinding binding = varDec.getName().resolveBinding(); if (binding.getJavaElement().equals( lPAR.get(0))) { varDec.delete(); break; } } lPAR.remove(0); } for (IField field : lFIE) { for (Object element : _typeInfo.bodyDeclarations()) { BodyDeclaration dec = (BodyDeclaration) element; if (dec.getNodeType() == FIELD_DECLARATION) { FieldDeclaration fieldDec = (FieldDeclaration) dec; List<VariableDeclarationFragment> fragments = (AbstractList<VariableDeclarationFragment>) fieldDec.fragments(); for (VariableDeclarationFragment fragment : fragments) { IField dField = (IField) fragment.getName() .resolveBinding().getJavaElement(); if (field.equals(dField)) { fieldDec.delete(); break; } } } } } } /** * @see edu.buffalo.cse.green.relationships.RelationshipVisitor#process(org.eclipse.jdt.core.dom.TypeDeclaration) */ protected boolean process(DeclarationInfoProvider node) { return true; } /** * @see org.eclipse.jdt.core.dom.ASTVisitor#visit(org.eclipse.jdt.core.dom.ExpressionStatement) */ public boolean visit(ExpressionStatement node) { if (getMatcher().match(node, getRelationship().getFeatures().get(0))) { _typeInfo = getCurrentTypeInfo(); lEXP.add(node); Assignment ass = (Assignment) node.getExpression(); Name lName = (Name) ass.getLeftHandSide(); Name rName = (Name) ass.getRightHandSide(); lFIE.add((IField) lName.resolveBinding().getJavaElement()); lPAR.add((ILocalVariable) rName.resolveBinding().getJavaElement()); } return true; } }
3,891
0.727576
0.724749
131
28.70229
26.302322
114
false
false
0
0
0
0
0
0
2.122137
false
false
1
48d1ae64f225ccac2f4c2ca6503ed5b53d2f5101
15,006,615,780,380
8afb72ffbb1d96c6100b0172d3f947b249c130ff
/src/assignment1/Armstrong.java
5931dd86367c6452b44f3891f7628a1f2505b1e9
[]
no_license
poudel123/day1
https://github.com/poudel123/day1
fc9ea83e11f66231fb4f451dafabe3fd249ad2e5
de73706ffc1371784610331e534fd76990edbd88
refs/heads/master
2020-03-27T17:52:13.588000
2018-08-31T11:00:46
2018-08-31T11:00:46
145,119,416
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package assignment1; import java.util.Scanner; public class Armstrong { public static void main(String Args[]) { int num,number,temp,total=0; System.out.println("enter the number"); Scanner scanner=new Scanner(System.in); num = scanner.nextInt(); scanner.close(); number = num; for( ;number!=0;number /= 10) { temp=number % 10; total =total+temp*temp*temp; } if(total==num) System.out.println(num +" is an Armstrong number"); else System.out.println(num +" is not an Armstrong number"); } }
UTF-8
Java
587
java
Armstrong.java
Java
[]
null
[]
package assignment1; import java.util.Scanner; public class Armstrong { public static void main(String Args[]) { int num,number,temp,total=0; System.out.println("enter the number"); Scanner scanner=new Scanner(System.in); num = scanner.nextInt(); scanner.close(); number = num; for( ;number!=0;number /= 10) { temp=number % 10; total =total+temp*temp*temp; } if(total==num) System.out.println(num +" is an Armstrong number"); else System.out.println(num +" is not an Armstrong number"); } }
587
0.606474
0.594549
24
23.458334
17.342094
62
false
false
0
0
0
0
0
0
1.083333
false
false
1
50389e63a18c7e68a7593d0ca0e9a4c078b4673f
11,278,584,182,644
ec7b10b5329a2c386eb08a501ae46cff348be19d
/RootSchool/src/com/rootmind/wrapper/DataArrayWrapper.java
6c21a6f1f69e311a9f675d101dfea5ecf7660b42
[]
no_license
rootmindtech/RootSchool
https://github.com/rootmindtech/RootSchool
365ca98a9f33b4256242909662e559546f3e03d4
9efdd4f9c6097ce23dcc444f38403aec06879f07
refs/heads/master
2022-12-02T05:04:59.621000
2020-08-17T02:53:13
2020-08-17T02:53:13
288,069,478
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.rootmind.wrapper; public class DataArrayWrapper extends AbstractWrapper { public UsersWrapper[] userProfileWrapper=null; public UsersWrapper[] usersWrapper=null; public SchoolWrapper [] schoolWrapper=null; public StudentProfileWrapper[] studentProfileWrapper=null; public StudentAcademicsWrapper[] studentAcademicsWrapper=null; public StudentMessageWrapper[] studentMessageWrapper=null; public StudentDiaryWrapper[] studentDiaryWrapper=null; public SchoolMessageWrapper[] schoolMessageWrapper=null; public ExamCalendarWrapper[] examCalendarWrapper=null; public GradeSubjectsWrapper[] gradeSubjectsWrapper=null; public ImageDetailsWrapper[] imageDetailsWrapper=null; public StudentAttendanceWrapper[] studentAttendanceWrapper=null; public SchoolFeeWrapper[] schoolFeeWrapper=null; public TeachersProfileWrapper[] teachersProfileWrapper=null; public ParentMessageWrapper[] parentMessageWrapper=null; public UserStudentMapWrapper[] userStudentMapWrapper=null; public UserMenuWrapper[] userMenuWrapper=null; public GroupMenuWrapper[] groupMenuWrapper=null; public TeacherSubjectsWrapper[] teacherSubjectsWrapper=null; public TeacherReportsWrapper[] teacherReportsWrapper=null; public ErrorWrapper[] errorWrapper=null; public StudentAttendanceWrapper[] morningStatusPresentWrapper=null; public StudentAttendanceWrapper[] eveningStatusPresentWrapper=null; public StudentAttendanceWrapper[] morningStatusAbsentWrapper=null; public StudentAttendanceWrapper[] eveningStatusAbsentWrapper=null; public SchoolAttendanceWrapper[] morningAttendancePresentWrapper=null; public SchoolAttendanceWrapper[] eveningAttendancePresentWrapper=null; public SchoolAcademicsWrapper[] schoolAcademicsWrapper=null; public PasswordWrapper[] passwordWrapper=null; public PopoverWrapper[] popoverWrapper = null; public FileUploadWrapper[] fileUploadWrapper =null; public BookCatalogueWrapper[] bookCatalogueWrapper =null; public BookIssueWrapper[] bookIssueWrapper =null; public OnlinePaymentWrapper[] onlinePaymentWrapper =null; public ParameterWrapper[] parameterWrapper =null; public HostelWrapper[] hostelWrapper =null; public CalendarActivitiesWrapper[] calendarActivitiesWrapper=null; public DashboardWrapper[] dashboardWrapper=null; public DashboardWebWrapper[] dashboardWebWrapper=null; public UserGroupWrapper[] userGroupWrapper=null; public SupervisorWrapper[] supervisorWrapper=null; public HostelInOutWrapper[] hostelInOutWrapper=null; public NewsWrapper[] newsWrapper=null; public ServiceTicketsWrapper[] serviceTicketsWrapper=null; public TransportWrapper[] transportWrapper=null; public WeekdaySetupWrapper[] weekdaySetupWrapper=null; public MessengerServiceWrapper[] messengerServiceWrapper=null; public String methodAction=null; public String schoolID=null; public String errorCode = null; public String errorDescription = null; public boolean validSession = false; public boolean recordFound = false; }
UTF-8
Java
3,067
java
DataArrayWrapper.java
Java
[]
null
[]
package com.rootmind.wrapper; public class DataArrayWrapper extends AbstractWrapper { public UsersWrapper[] userProfileWrapper=null; public UsersWrapper[] usersWrapper=null; public SchoolWrapper [] schoolWrapper=null; public StudentProfileWrapper[] studentProfileWrapper=null; public StudentAcademicsWrapper[] studentAcademicsWrapper=null; public StudentMessageWrapper[] studentMessageWrapper=null; public StudentDiaryWrapper[] studentDiaryWrapper=null; public SchoolMessageWrapper[] schoolMessageWrapper=null; public ExamCalendarWrapper[] examCalendarWrapper=null; public GradeSubjectsWrapper[] gradeSubjectsWrapper=null; public ImageDetailsWrapper[] imageDetailsWrapper=null; public StudentAttendanceWrapper[] studentAttendanceWrapper=null; public SchoolFeeWrapper[] schoolFeeWrapper=null; public TeachersProfileWrapper[] teachersProfileWrapper=null; public ParentMessageWrapper[] parentMessageWrapper=null; public UserStudentMapWrapper[] userStudentMapWrapper=null; public UserMenuWrapper[] userMenuWrapper=null; public GroupMenuWrapper[] groupMenuWrapper=null; public TeacherSubjectsWrapper[] teacherSubjectsWrapper=null; public TeacherReportsWrapper[] teacherReportsWrapper=null; public ErrorWrapper[] errorWrapper=null; public StudentAttendanceWrapper[] morningStatusPresentWrapper=null; public StudentAttendanceWrapper[] eveningStatusPresentWrapper=null; public StudentAttendanceWrapper[] morningStatusAbsentWrapper=null; public StudentAttendanceWrapper[] eveningStatusAbsentWrapper=null; public SchoolAttendanceWrapper[] morningAttendancePresentWrapper=null; public SchoolAttendanceWrapper[] eveningAttendancePresentWrapper=null; public SchoolAcademicsWrapper[] schoolAcademicsWrapper=null; public PasswordWrapper[] passwordWrapper=null; public PopoverWrapper[] popoverWrapper = null; public FileUploadWrapper[] fileUploadWrapper =null; public BookCatalogueWrapper[] bookCatalogueWrapper =null; public BookIssueWrapper[] bookIssueWrapper =null; public OnlinePaymentWrapper[] onlinePaymentWrapper =null; public ParameterWrapper[] parameterWrapper =null; public HostelWrapper[] hostelWrapper =null; public CalendarActivitiesWrapper[] calendarActivitiesWrapper=null; public DashboardWrapper[] dashboardWrapper=null; public DashboardWebWrapper[] dashboardWebWrapper=null; public UserGroupWrapper[] userGroupWrapper=null; public SupervisorWrapper[] supervisorWrapper=null; public HostelInOutWrapper[] hostelInOutWrapper=null; public NewsWrapper[] newsWrapper=null; public ServiceTicketsWrapper[] serviceTicketsWrapper=null; public TransportWrapper[] transportWrapper=null; public WeekdaySetupWrapper[] weekdaySetupWrapper=null; public MessengerServiceWrapper[] messengerServiceWrapper=null; public String methodAction=null; public String schoolID=null; public String errorCode = null; public String errorDescription = null; public boolean validSession = false; public boolean recordFound = false; }
3,067
0.819041
0.819041
76
38.355263
24.882727
71
false
false
0
0
0
0
0
0
1.618421
false
false
1
91e7904280b484c553a26172da1a2004b8c43e61
9,766,755,650,614
4046c93003cf285bda284261477ef9b6fc314669
/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/robots/icarus/Game_6832.java
deecf19588e3811aa3e57505e96b48062bf39a33
[ "BSD-3-Clause" ]
permissive
IronReign/SkyStone
https://github.com/IronReign/SkyStone
83076bb9ee0a1306421e39fdc9794b8526d8e20c
30c8642ad432cb77bd07a64531ab33877ee4a2d2
refs/heads/master
2020-06-16T14:07:43.150000
2020-05-14T02:53:14
2020-05-14T02:53:14
195,602,439
0
3
null
true
2020-04-09T17:24:57
2019-07-07T02:41:59
2020-03-29T04:06:02
2020-04-09T17:20:54
295,884
0
2
1
Java
false
false
/* Copyright (c) 2016 Robert Atkinson All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of Robert Atkinson nor the names of his contributors may be used to endorse or promote products derived from this software without specific prior written permission. NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESSFOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.firstinspires.ftc.teamcode.robots.icarus; import com.acmerobotics.dashboard.FtcDashboard; import com.acmerobotics.dashboard.telemetry.TelemetryPacket; import com.qualcomm.ftccommon.SoundPlayer; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; import com.qualcomm.robotcore.util.ElapsedTime; import org.firstinspires.ftc.robotcore.external.navigation.AxesOrder; import org.firstinspires.ftc.robotcore.external.navigation.AxesReference; import org.firstinspires.ftc.robotcore.external.navigation.DistanceUnit; import org.firstinspires.ftc.robotcore.external.navigation.Orientation; import org.firstinspires.ftc.teamcode.vision.GoldPos; import static org.firstinspires.ftc.teamcode.PoseBigWheel.servoNormalize; /** * This file contains the code for Iron Reign's main OpMode, used for both TeleOp and Autonomous. */ @TeleOp(name = "Icarus_6832", group = "Demo") // @Autonomous(...) is the other common choice // @Autonomous public class Game_6832 extends LinearOpMode { /* Declare OpMode members. */ private ElapsedTime runtime = new ElapsedTime(); private PoseBigWheel.RobotType currentBot = PoseBigWheel.RobotType.Icarus; private PoseBigWheel robot; private Autonomous auto; private boolean active = true; private boolean joystickDriveStarted = false; private int state = 0; private boolean isBlue = false; //loop time profile long lastLoopClockTime; double loopAvg = 0; private static final double loopWeight = .1; //drive train control variables private double pwrDamper = 1; private double pwrFwd = 0; private double pwrStf = 0; private double pwrRot = 0; private double pwrFwdL = 0; private double pwrStfL = 0; private double pwrFwdR = 0; private double pwrStfR = 0; private double beaterDamper = .75; private boolean enableTank = false; private boolean bypassJoysticks = false; private long damperTimer = 0; private int direction = 1; //-1 to reverse direction private int currTarget = 0; //sensors/sensing-related variables private Orientation angles; //these are meant as short term testing variables, don't expect their usage //to be consistent across development sessions //private double testableDouble = robot.kpDrive; private double testableHeading = 0; private boolean testableDirection = true; //values associated with the buttons in the toggleAllowed method private boolean[] buttonSavedStates = new boolean[16]; private int a = 0; //lower glyph lift private int b = 1; //toggle grip/release on glyph private int x = 2; //no function private int y = 3; //raise glyph lift private int dpad_down = 4; //enable/disable ftcdash telemetry private int dpad_up = 5; //vision init/de-init private int dpad_left = 6; //vision provider switch private int dpad_right = 7; //switch viewpoint private int left_bumper = 8; //increment state down (always) private int right_bumper = 9; //increment state up (always) private int startBtn = 10; //toggle active (always) private int left_trigger = 11; //vision detection private int right_trigger = 12; private int back_button = 13; private int left_stick_button = 14; private int right_stick_button = 15; //sound player int stateLatched = -1; int stateIntake = -1; int stateDelatch = -1; boolean isIntakeClosed = true; boolean isHooked = false; boolean enableHookSensors = false; //game mode configuration private int gameMode = 0; private static final int NUM_MODES = 4; private static final String[] GAME_MODES = {"REVERSE", "ENDGAME", "PRE-GAME", "REGULAR"}; //sound related configuration private int soundState = 0; private int soundID = -1; //auto stuff private GoldPos initGoldPosTest; private double pCoeff = 0.14; private double dCoeff = 1.31; private double targetAngle = 287.25; @Override public void runOpMode() throws InterruptedException { telemetry.addData("Status", "Initializing "+currentBot+"..."); telemetry.addData("Status", "Hold right_trigger to enable debug mode"); telemetry.update(); robot = new PoseBigWheel(currentBot); robot.init(this.hardwareMap, isBlue); auto = new Autonomous(robot, telemetry, gamepad1); if (gamepad1.right_trigger < 0.3) { telemetry.addData("Status", "Initialized " + currentBot+" (debug mode)"); telemetry.update(); configureDashboard(); } else { telemetry.addData("Status", "Initialized " + currentBot); telemetry.update(); configureDashboardMatch(); } // waitForStart(); // this is commented out but left here to document that we are still doing the // functions that waitForStart() normally does, but needed to customize it. robot.resetMotors(true); robot.collector.hookOn(); robot.collector.closeGate(); auto.visionProviderFinalized = false; while (!isStarted()) { // Wait for the game to start (driver presses PLAY) synchronized (this) { try { this.wait(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); return; } } stateSwitch(); //reset the elbow, lift and supermanLeft motors - operator must make sure robot is in the stowed position, flat on the ground if (toggleAllowed(gamepad1.b, b)) { if (gamepad1.right_trigger < 0.8) { //unless right trigger is being held very hard, encoders and heading are reset robot.resetEncoders(); robot.setZeroHeading(); robot.setAutonomousIMUOffset(0); //against lander } robot.articulate(PoseBigWheel.Articulation.hanging); robot.collector.extendToMin(); } if (toggleAllowed(gamepad1.x, x)) { isHooked = !isHooked; if (isHooked) robot.collector.hookOff(); else robot.collector.hookOn(); } if (toggleAllowed(gamepad1.y, y)) { auto.autoDelay++; if (auto.autoDelay > 20) auto.autoDelay = 0; } if (toggleAllowed(gamepad1.left_stick_button, left_stick_button)) enableHookSensors = !enableHookSensors; if (enableHookSensors && robot.distLeft.getDistance(DistanceUnit.METER) < .08) robot.collector.hookOn(); if (enableHookSensors && robot.distRight.getDistance(DistanceUnit.METER) < .08) robot.collector.hookOff(); if (!auto.visionProviderFinalized && toggleAllowed(gamepad1.dpad_left, dpad_left)) { auto.visionProviderState = (auto.visionProviderState + 1) % auto.visionProviders.length; //switch vision provider } if (!auto.visionProviderFinalized && toggleAllowed(gamepad1.dpad_up, dpad_up)) { auto.initVisionProvider(); //this is blocking } else if (auto.visionProviderFinalized && toggleAllowed(gamepad1.dpad_up, dpad_up)) { auto.deinitVisionProvider(); //also blocking, but should be very quick } if (!auto.visionProviderFinalized && toggleAllowed(gamepad1.dpad_down, dpad_down)) { auto.enableTelemetry = !auto.enableTelemetry; //enable/disable FtcDashboard telemetry // CenterOfGravityCalculator.drawRobotDiagram = !CenterOfGravityCalculator.drawRobotDiagram; } if (auto.visionProviderFinalized && gamepad1.left_trigger > 0.3) { GoldPos gp = auto.vp.detect(); if (gp != GoldPos.HOLD_STATE) initGoldPosTest = gp; telemetry.addData("Vision", "Prep detection: %s%s", initGoldPosTest, gp == GoldPos.HOLD_STATE ? " (HOLD_STATE)" : ""); } if (soundState == 0 && toggleAllowed(gamepad1.right_stick_button, right_stick_button)) { initialization_initSound(); } telemetry.addData("Vision", "Backend: %s (%s)", auto.visionProviders[auto.visionProviderState].getSimpleName(), auto.visionProviderFinalized ? "finalized" : System.currentTimeMillis() / 500 % 2 == 0 ? "**NOT FINALIZED**" : " NOT FINALIZED "); telemetry.addData("Vision", "FtcDashboard Telemetry: %s", auto.enableTelemetry ? "Enabled" : "Disabled"); telemetry.addData("Vision", "Viewpoint: %s", auto.viewpoint); telemetry.addData("Sound", soundState == 0 ? "off" : soundState == 1 ? "on" : soundState == 2 ? "file not found" : "other"); telemetry.addData("Status", "Initialized"); telemetry.addData("Status", "Auto Delay: " + Integer.toString((int) auto.autoDelay) + "seconds"); telemetry.addData("Status", "Side: " + getAlliance()); telemetry.addData("Status", "Hook sensors: " + enableHookSensors); telemetry.update(); robot.ledSystem.setColor(LEDSystem.Color.GAME_OVER); robot.updateSensors(); idle(); // Always call idle() at the bottom of your while(opModeIsActive()) loop } if (auto.vp == null) { auto.initDummyVisionProvider(); //this is blocking } auto.vp.reset(); robot.superman.restart(.75); robot.collector.restart(.4, .5); lastLoopClockTime = System.nanoTime(); // run until the end of the match (driver presses STOP) while (opModeIsActive()) { telemetry.update(); stateSwitch(); if (active) { switch (state) { case 0: //code for tele-op control joystickDrive(); break; case 1: //autonomous that goes to opponent's crater if (auto.depotSide_worlds.execute()) active = false; break; case 2: //autonomous that only samples if (auto.craterSide_worlds.execute()) active = false; break; case 3: //autonomous that starts in our crater if (auto.depotSample_worlds.execute()) active = false; break; case 4: if (auto.craterSide_cycle.execute()) active = false; break; case 5: if (auto.depotSide_deposit.execute()) active = false; break; case 6: // if(driveStraight()) active = false; // if(toggleAllowed(gamepad1.right_bumper,right_bumper)){ // robot.setForwardTPM(robot.getForwardTPM()+10); // }else if(toggleAllowed(gamepad1.left_bumper,left_bumper)){ // robot.setForwardTPM(robot.getForwardTPM()-10); // } turnTest(); break; case 7: balance(); break; case 8: //turn to IMU robot.setAutonSingleStep(true); demo(); break; case 9: // if (auto.craterSide_extend_reverse.execute()) active = false; ledTest(); break; case 10: // if (auto.depotSide_worlds.execute()) active = false; servoTest(); break; default: robot.stopAll(); break; } robot.updateSensors(); } else { robot.stopAll(); } long loopClockTime = System.nanoTime(); long loopTime = loopClockTime - lastLoopClockTime; if (loopAvg == 0) loopAvg = loopTime; else loopAvg = loopWeight*loopTime + (1-loopWeight)*loopAvg; lastLoopClockTime = loopClockTime; idle(); // Always call idle() at the bottom of your while(opModeIsActive()) loop } } public boolean driveStraight(){ return robot.driveForward(true,1,.5); } public void balance(){ robot.collector.extendToMax(); robot.collector.setElbowTargetPos(3734); if (toggleAllowed(gamepad1.y,y)) pCoeff+=.01; else if (toggleAllowed(gamepad1.a, a)) pCoeff-=.01; if (toggleAllowed(gamepad1.dpad_down, dpad_down)) dCoeff-=.005; else if (toggleAllowed(gamepad1.dpad_up, dpad_down)) dCoeff+=.005; if (toggleAllowed(gamepad1.right_bumper,right_bumper)) targetAngle+=.25; else if (toggleAllowed(gamepad1.left_bumper, left_bumper)) targetAngle-=.25; robot.balanceP = pCoeff; robot.balanceD = dCoeff; telemetry.addData("P Coeff: ", pCoeff); telemetry.addData("D Coeff: ", dCoeff); telemetry.addData("Target Angle: ", targetAngle); telemetry.update(); TelemetryPacket tp = new TelemetryPacket(); tp.put("Current Angle", robot.getRoll()); tp.put("Target Angle", targetAngle); FtcDashboard.getInstance().sendTelemetryPacket(tp); robot.balance(targetAngle); } int tpmtuningstage = 0; public void tpmtuning(){ switch (tpmtuningstage){ case 0: if(robot.goToPosition(robot.superman.pos_reverseIntake-100,robot.collector.pos_reverseSafeDrive,.75,.3)){ } if(toggleAllowed(gamepad1.y,y)){ robot.resetMotors(true); } if(toggleAllowed(gamepad1.a,a)){ tpmtuningstage++; } break; case 1: if(robot.driveForward(true,.2,1)){ tpmtuningstage = 0; } break; } } private void initialization_initSound() { telemetry.addData("Please wait", "Initializing Sound"); //telemetry.update(); robot.ledSystem.setColor(LEDSystem.Color.CALM); soundID = hardwareMap.appContext.getResources().getIdentifier("gracious", "raw", hardwareMap.appContext.getPackageName()); boolean success = SoundPlayer.getInstance().preload(hardwareMap.appContext, soundID); if (success) soundState = 1; else soundState = 2; } private void demo() { if (gamepad1.x) robot.maintainHeading(gamepad1.x); if (gamepad1.dpad_down) { robot.articulate(PoseBigWheel.Articulation.manual); robot.superman.lower(); } if (gamepad1.dpad_up) { robot.articulate(PoseBigWheel.Articulation.manual); robot.superman.raise(); } if (gamepad1.dpad_right) { robot.articulate(PoseBigWheel.Articulation.manual); robot.collector.increaseElbowAngle(); } if (gamepad1.dpad_left) { robot.articulate(PoseBigWheel.Articulation.manual); robot.collector.retractBelt(); } } int reverse = 1; private void joystickDrive() { if (!joystickDriveStarted) { robot.resetMotors(true); robot.setAutonSingleStep(true); isHooked = false; joystickDriveStarted = true; } if(robot.getArticulation() == PoseBigWheel.Articulation.intake){ reverse = -1; }else if(robot.getArticulation() != PoseBigWheel.Articulation.intake && robot.getArticulation() != PoseBigWheel.Articulation.manual){ reverse = 1; } pwrFwd = reverse*direction * pwrDamper * gamepad1.left_stick_y; pwrRot = -pwrDamper * .75 * gamepad1.right_stick_x; pwrFwdL = direction * pwrDamper * gamepad1.left_stick_y; pwrStfL = direction * pwrDamper * gamepad1.left_stick_x; pwrFwdR = direction * pwrDamper * gamepad1.right_stick_y; pwrStfR = direction * pwrDamper * gamepad1.right_stick_x; /* if ((robot.getRoll() > 300) && robot.getRoll() < 350) //todo - needs improvement - should be enabling slowmo mode, not setting the damper directly //at least we are looking at the correct axis now - it was super janky - toggling the damper as the axis fluttered across 0 to 365 pwrDamper = .33; else*/ pwrDamper = .65; switch (gameMode) { case 0: //regular (reverse) mode joystickDriveRegularModeReverse(); break; case 1: //endgame mode joystickDriveEndgameMode(); break; case 2: //pre-game = testing auton deploying functions joystickDrivePregameMode(); break; case 3: //regular mode joystickDriveRegularMode(); break; } //manual control if (gamepad1.dpad_down) { robot.articulate(PoseBigWheel.Articulation.manual); robot.superman.lower(); } if (gamepad1.dpad_up) { robot.articulate(PoseBigWheel.Articulation.manual); robot.superman.raise(); } if (gamepad1.right_stick_y > 0.5) { robot.articulate(PoseBigWheel.Articulation.manual); robot.collector.decreaseElbowAngle(); } if (gamepad1.right_stick_y < -0.5) { robot.articulate(PoseBigWheel.Articulation.manual); robot.collector.extendBelt(); } if (gamepad1.dpad_right) { robot.articulate(PoseBigWheel.Articulation.manual); robot.collector.increaseElbowAngle(); } if (gamepad1.dpad_left) { robot.articulate(PoseBigWheel.Articulation.manual); robot.collector.retractBelt(); } //elbow control currTarget = robot.collector.getExtendABobTargetPos(); if (toggleAllowed(gamepad1.left_bumper, left_bumper)) { if (currTarget == robot.collector.extendMid) { currTarget = robot.collector.extendMax; //robot.collector.setElbowTargetPos(robot.beltToElbow(robot.collector.getExtendABobCurrentPos(),0)); } else { currTarget = robot.collector.extendMid; //robot.collector.setElbowTargetPos(robot.beltToElbow(robot.collector.getExtendABobCurrentPos(),0)); } } if (currTarget >= 10) { robot.collector.setExtendABobTargetPos(currTarget); } //endgame mode if (toggleAllowed(gamepad1.right_bumper, right_bumper)) { gameMode = (gameMode + 1) % NUM_MODES; } //intake code double triggers = gamepad1.left_trigger - gamepad1.right_trigger; if(false){//robot.getArticulation() == PoseBigWheel.Articulation.reverseIntake || robot.getArticulation() == PoseBigWheel.Articulation.reverseDeposit){ // robot.collector.collect(); }else { if (triggers > 0.1) robot.collector.collect(); else if (triggers < -0.1) robot.collector.eject(); else robot.collector.stopIntake(); } //Gracious Professionalism! if (soundState == 1 && toggleAllowed(gamepad1.right_stick_button, right_stick_button)) { SoundPlayer.getInstance().startPlaying(hardwareMap.appContext, soundID); } } private void joystickDrivePregameMode() { robot.setAutonSingleStep(true); //single step through articulations having to do with deploying robot.ledSystem.setColor(LEDSystem.Color.CALM); boolean doDelatch = false; if (toggleAllowed(gamepad1.b, b)) { stateDelatch++; if (stateDelatch > 2) stateDelatch = 0; doDelatch = true; } if (toggleAllowed(gamepad1.x, x)) { stateDelatch--; if (stateDelatch < 0) stateDelatch = 2; doDelatch = true; } if (doDelatch) { switch (stateDelatch) { case 0: robot.articulate(PoseBigWheel.Articulation.hanging); break; case 1: robot.articulate(PoseBigWheel.Articulation.deploying); break; case 2: robot.articulate(PoseBigWheel.Articulation.deployed); break; default: break; } } } private void logTurns(double target) { telemetry.addData("Error: ", target - robot.getHeading()); //telemetry.update(); } private void joystickDriveEndgameMode() { robot.ledSystem.setColor(LEDSystem.Color.SHOT); boolean doLatchStage = false; robot.driveMixerTank(pwrFwd, pwrRot); if (toggleAllowed(gamepad1.b, b)) { //b advances us through latching stages - todo: we should really be calling a pose.nextLatchStage function stateLatched++; if (stateLatched > 2) stateLatched = 0; doLatchStage = true; } if (toggleAllowed(gamepad1.x, x)) { //x allows us to back out of latching stages stateLatched--; if (stateLatched < 0) stateLatched = 0; doLatchStage = true; } if (doLatchStage) { switch (stateLatched) { case 0: robot.articulate(PoseBigWheel.Articulation.latchApproach); break; case 1: robot.articulate(PoseBigWheel.Articulation.latchPrep); break; case 2: robot.articulate(PoseBigWheel.Articulation.latchSet); break; } } if (toggleAllowed(gamepad1.a, a)) { isHooked = !isHooked; } if (isHooked) { robot.collector.hookOn(); } else { robot.collector.hookOff(); } } private void turnTest() { if (robot.rotatePIDIMU(90, 3)) { telemetry.addData("Angle Error: ", 90 - robot.getHeading()); telemetry.addData("Final Test Heading: ", robot.getHeading()); robot.setZeroHeading(); active = false; } telemetry.addData("Current Angle: ", robot.getHeading()); telemetry.addData("Angle Error: ", 90 - robot.getHeading()); } private void joystickDriveRegularMode() { robot.ledSystem.setColor(LEDSystem.Color.CALM); robot.collector.hookOff(); boolean doIntake = false; robot.driveMixerTank(pwrFwd, pwrRot); if (gamepad1.y) { robot.goToSafeDrive(); isIntakeClosed = true; } if (toggleAllowed(gamepad1.a, a)) { isIntakeClosed = !isIntakeClosed; } if (toggleAllowed(gamepad1.b, b)) { stateIntake++; if (stateIntake > 3) stateIntake = 0; doIntake = true; } if (toggleAllowed(gamepad1.x, x)) { stateIntake--; if (stateIntake < 0) stateIntake = 3; doIntake = true; } if (doIntake) { switch (stateIntake) { case 0: robot.articulate(PoseBigWheel.Articulation.preIntake); isIntakeClosed = true; break; case 1: robot.articulate(PoseBigWheel.Articulation.intake); isIntakeClosed = true; break; case 2: robot.articulate(PoseBigWheel.Articulation.deposit); break; case 3: robot.articulate(PoseBigWheel.Articulation.driving); isIntakeClosed = true; } } if (isIntakeClosed) { robot.collector.closeGate(); } else { robot.collector.openGate(); } } private void joystickDriveRegularModeReverse() { robot.ledSystem.setColor(LEDSystem.Color.PARTY_MODE_SMOOTH); robot.collector.hookOff(); boolean doIntake = false; if (gamepad1.y) { robot.articulate(PoseBigWheel.Articulation.reverseDriving); isIntakeClosed = true; } if (toggleAllowed(gamepad1.a, a)) { isIntakeClosed = !isIntakeClosed; } if (toggleAllowed(gamepad1.b, b)) { stateIntake++; if (stateIntake > 3) stateIntake = 0; doIntake = true; } if (toggleAllowed(gamepad1.x, x)) { stateIntake--; if (stateIntake < 0) stateIntake = 3; doIntake = true; } if (doIntake) { switch (stateIntake) { case 0: robot.articulate(PoseBigWheel.Articulation.reverseIntake); pwrRot-=.25; //robot.collector.setBeltToElbowModeEnabled(); isIntakeClosed = true; break; case 1: robot.articulate(PoseBigWheel.Articulation.prereversedeposit); //robot.collector.setBeltToElbowModeDisabled(); isIntakeClosed = true; break; case 2: robot.articulate(PoseBigWheel.Articulation.reverseDeposit); //robot.collector.setBeltToElbowModeDisabled(); break; case 3: robot.articulate(PoseBigWheel.Articulation.reverseDriving); //robot.collector.setBeltToElbowModeDisabled(); isIntakeClosed = true; break; } } robot.driveMixerTank(pwrFwd, pwrRot); if (isIntakeClosed) { robot.collector.closeGate(); } else { robot.collector.openGate(); } } //the method that controls the main state of the robot; must be called in the main loop outside of the main switch private void stateSwitch() { if (!active) { if (toggleAllowed(gamepad1.left_bumper, left_bumper)) { state--; if (state < 0) { state = 10; } robot.resetMotors(true); active = false; } if (toggleAllowed(gamepad1.right_bumper, right_bumper)) { state++; if (state > 10) { state = 0; } robot.resetMotors(true); active = false; } } if (toggleAllowed(gamepad1.start, startBtn)) { robot.resetMotors(true); active = !active; } } //checks to see if a specific button should allow a toggle at any given time; needs a rework private boolean toggleAllowed(boolean button, int buttonIndex) { if (button) { if (!buttonSavedStates[buttonIndex]) { //we just pushed the button, and when we last looked at it, it was not pressed buttonSavedStates[buttonIndex] = true; return true; } else { //the button is pressed, but it was last time too - so ignore return false; } } buttonSavedStates[buttonIndex] = false; //not pressed, so remember that it is not return false; //not pressed } private String getAlliance() { if (isBlue) return "Blue"; return "Red"; } private void configureDashboard() { // Configure the dashboard. // At the beginning of each telemetry update, grab a bunch of data // from the IMU that we will then display in separate lines. telemetry.addAction(() -> // Acquiring the angles is relatively expensive; we don't want // to do that in each of the three items that need that info, as that's // three times the necessary expense. angles = robot.imu.getAngularOrientation().toAxesReference(AxesReference.INTRINSIC).toAxesOrder(AxesOrder.ZYX) ); telemetry.addLine() .addData("active", () -> active) .addData("state", () -> state) .addData("autoStage", () -> auto.autoStage) .addData("Game Mode", () -> GAME_MODES[gameMode]) .addData("Articulation", () -> robot.getArticulation()); telemetry.addLine() .addData("elbowA", () -> robot.collector.isActive()) .addData("elbowC", () -> robot.collector.getElbowCurrentPos()) .addData("elbowC2", () -> robot.collector.getElbowCurrentPos2()) .addData("elbowDiff", () -> robot.collector.getElbowCurrentPos() - robot.collector.getElbowCurrentPos2()) .addData("elbowT", () -> robot.collector.getElbowTargetPos()); telemetry.addLine() .addData("supermanPos", () -> robot.superman.getCurrentPosition()) .addData("supermanRight", () -> robot.superman.getCurrentPosition2()) .addData("liftPos", () -> robot.collector.getExtendABobCurrentPos()); telemetry.addLine() .addData("COG theta", () -> robot.getRoll() + robot.cog.pitchOffset) .addData("COG phi", () -> robot.superman.getCurrentAngle() + robot.cog.supermanoffset) .addData("COG beta", () -> robot.collector.getCurrentAngle()+robot.cog.elbowoffset) .addData("COG arm length", 38.2) .addData("COG", () -> robot.cog.getCenterOfGravity(-robot.getRoll() + robot.cog.pitchOffset,robot.superman.getCurrentAngle() + robot.cog.supermanoffset, robot.collector.getCurrentAngle()+robot.cog.elbowoffset, robot.collector.getCurrentLength()).toString()); telemetry.addLine() .addData("roll", () -> robot.getRoll()) .addData("pitch", () -> robot.getPitch()) .addData("yaw", () -> robot.getHeading()); telemetry.addLine() .addData("calib", () -> robot.imu.getCalibrationStatus().toString()); telemetry.addLine() .addData("drivedistance", () -> robot.driveLeft.getCurrentPosition()); telemetry.addLine() .addData("status", () -> robot.imu.getSystemStatus().toShortString()) .addData("Pos", () -> robot.intakeGate.getPosition()) .addData("mineralState", () -> auto.mineralState) .addData("distForward", () -> robot.distForward.getDistance(DistanceUnit.METER)) .addData("distLeft", () -> robot.distLeft.getDistance(DistanceUnit.METER)) .addData("distRight", () -> robot.distRight.getDistance(DistanceUnit.METER)) .addData("depositDriveDistance", () -> robot.depositDriveDistance); telemetry.addLine() .addData("Loop time", "%.0fms", () -> loopAvg/1000000) .addData("Loop time", "%.0fHz", () -> 1000000000/loopAvg); } private void configureDashboardMatch() { // Configure the dashboard. telemetry.addLine() .addData("active", () -> active) .addData("state", () -> state) .addData("Game Mode", () -> GAME_MODES[gameMode]) .addData("Articulation", () -> robot.getArticulation()); telemetry.addAction(() -> robot.cog.getCenterOfGravity(-robot.getRoll() + robot.cog.pitchOffset,robot.superman.getCurrentAngle() + robot.cog.supermanoffset, robot.collector.getCurrentAngle()+robot.cog.elbowoffset, robot.collector.getCurrentLength())); telemetry.addLine() .addData("Loop time", "%.0fms", () -> loopAvg/1000000) .addData("Loop time", "%.0fHz", () -> 1000000000/loopAvg); } int testDeLatch = 0; public boolean delatch() { switch (testDeLatch) { case 0: robot.collector.setElbowTargetPos(robot.collector.pos_prelatch, .9); if (robot.collector.nearTargetElbow()) { testDeLatch++; } break; case 1: robot.superman.setTargetPosition(robot.superman.pos_prelatch); if (robot.superman.nearTarget()) { robot.collector.hookOff(); testDeLatch++; } break; default: testDeLatch = 0; return true; } return false; } private int servoTest = 1005; private void servoTest() { robot.ledSystem.movement.setPosition(servoNormalize(servoTest)); if (toggleAllowed(gamepad1.a, a)) servoTest -= 10; else if (toggleAllowed(gamepad1.y, y)) servoTest += 10; telemetry.addData("Pulse width", servoTest); } private void ledTest() { int idx = (int) ((System.currentTimeMillis() / 2000) % LEDSystem.Color.values().length); robot.ledSystem.setColor(LEDSystem.Color.values()[idx]); telemetry.addData("Color", LEDSystem.Color.values()[idx].name()); } }
UTF-8
Java
35,765
java
Game_6832.java
Java
[ { "context": "/*\nCopyright (c) 2016 Robert Atkinson\n\nAll rights reserved.\n\nRedistribution and use in ", "end": 37, "score": 0.9998522996902466, "start": 22, "tag": "NAME", "value": "Robert Atkinson" } ]
null
[]
/* Copyright (c) 2016 <NAME> All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted (subject to the limitations in the disclaimer below) provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. Neither the name of Robert Atkinson nor the names of his contributors may be used to endorse or promote products derived from this software without specific prior written permission. NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE GRANTED BY THIS LICENSE. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESSFOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ package org.firstinspires.ftc.teamcode.robots.icarus; import com.acmerobotics.dashboard.FtcDashboard; import com.acmerobotics.dashboard.telemetry.TelemetryPacket; import com.qualcomm.ftccommon.SoundPlayer; import com.qualcomm.robotcore.eventloop.opmode.LinearOpMode; import com.qualcomm.robotcore.eventloop.opmode.TeleOp; import com.qualcomm.robotcore.util.ElapsedTime; import org.firstinspires.ftc.robotcore.external.navigation.AxesOrder; import org.firstinspires.ftc.robotcore.external.navigation.AxesReference; import org.firstinspires.ftc.robotcore.external.navigation.DistanceUnit; import org.firstinspires.ftc.robotcore.external.navigation.Orientation; import org.firstinspires.ftc.teamcode.vision.GoldPos; import static org.firstinspires.ftc.teamcode.PoseBigWheel.servoNormalize; /** * This file contains the code for Iron Reign's main OpMode, used for both TeleOp and Autonomous. */ @TeleOp(name = "Icarus_6832", group = "Demo") // @Autonomous(...) is the other common choice // @Autonomous public class Game_6832 extends LinearOpMode { /* Declare OpMode members. */ private ElapsedTime runtime = new ElapsedTime(); private PoseBigWheel.RobotType currentBot = PoseBigWheel.RobotType.Icarus; private PoseBigWheel robot; private Autonomous auto; private boolean active = true; private boolean joystickDriveStarted = false; private int state = 0; private boolean isBlue = false; //loop time profile long lastLoopClockTime; double loopAvg = 0; private static final double loopWeight = .1; //drive train control variables private double pwrDamper = 1; private double pwrFwd = 0; private double pwrStf = 0; private double pwrRot = 0; private double pwrFwdL = 0; private double pwrStfL = 0; private double pwrFwdR = 0; private double pwrStfR = 0; private double beaterDamper = .75; private boolean enableTank = false; private boolean bypassJoysticks = false; private long damperTimer = 0; private int direction = 1; //-1 to reverse direction private int currTarget = 0; //sensors/sensing-related variables private Orientation angles; //these are meant as short term testing variables, don't expect their usage //to be consistent across development sessions //private double testableDouble = robot.kpDrive; private double testableHeading = 0; private boolean testableDirection = true; //values associated with the buttons in the toggleAllowed method private boolean[] buttonSavedStates = new boolean[16]; private int a = 0; //lower glyph lift private int b = 1; //toggle grip/release on glyph private int x = 2; //no function private int y = 3; //raise glyph lift private int dpad_down = 4; //enable/disable ftcdash telemetry private int dpad_up = 5; //vision init/de-init private int dpad_left = 6; //vision provider switch private int dpad_right = 7; //switch viewpoint private int left_bumper = 8; //increment state down (always) private int right_bumper = 9; //increment state up (always) private int startBtn = 10; //toggle active (always) private int left_trigger = 11; //vision detection private int right_trigger = 12; private int back_button = 13; private int left_stick_button = 14; private int right_stick_button = 15; //sound player int stateLatched = -1; int stateIntake = -1; int stateDelatch = -1; boolean isIntakeClosed = true; boolean isHooked = false; boolean enableHookSensors = false; //game mode configuration private int gameMode = 0; private static final int NUM_MODES = 4; private static final String[] GAME_MODES = {"REVERSE", "ENDGAME", "PRE-GAME", "REGULAR"}; //sound related configuration private int soundState = 0; private int soundID = -1; //auto stuff private GoldPos initGoldPosTest; private double pCoeff = 0.14; private double dCoeff = 1.31; private double targetAngle = 287.25; @Override public void runOpMode() throws InterruptedException { telemetry.addData("Status", "Initializing "+currentBot+"..."); telemetry.addData("Status", "Hold right_trigger to enable debug mode"); telemetry.update(); robot = new PoseBigWheel(currentBot); robot.init(this.hardwareMap, isBlue); auto = new Autonomous(robot, telemetry, gamepad1); if (gamepad1.right_trigger < 0.3) { telemetry.addData("Status", "Initialized " + currentBot+" (debug mode)"); telemetry.update(); configureDashboard(); } else { telemetry.addData("Status", "Initialized " + currentBot); telemetry.update(); configureDashboardMatch(); } // waitForStart(); // this is commented out but left here to document that we are still doing the // functions that waitForStart() normally does, but needed to customize it. robot.resetMotors(true); robot.collector.hookOn(); robot.collector.closeGate(); auto.visionProviderFinalized = false; while (!isStarted()) { // Wait for the game to start (driver presses PLAY) synchronized (this) { try { this.wait(); } catch (InterruptedException e) { Thread.currentThread().interrupt(); return; } } stateSwitch(); //reset the elbow, lift and supermanLeft motors - operator must make sure robot is in the stowed position, flat on the ground if (toggleAllowed(gamepad1.b, b)) { if (gamepad1.right_trigger < 0.8) { //unless right trigger is being held very hard, encoders and heading are reset robot.resetEncoders(); robot.setZeroHeading(); robot.setAutonomousIMUOffset(0); //against lander } robot.articulate(PoseBigWheel.Articulation.hanging); robot.collector.extendToMin(); } if (toggleAllowed(gamepad1.x, x)) { isHooked = !isHooked; if (isHooked) robot.collector.hookOff(); else robot.collector.hookOn(); } if (toggleAllowed(gamepad1.y, y)) { auto.autoDelay++; if (auto.autoDelay > 20) auto.autoDelay = 0; } if (toggleAllowed(gamepad1.left_stick_button, left_stick_button)) enableHookSensors = !enableHookSensors; if (enableHookSensors && robot.distLeft.getDistance(DistanceUnit.METER) < .08) robot.collector.hookOn(); if (enableHookSensors && robot.distRight.getDistance(DistanceUnit.METER) < .08) robot.collector.hookOff(); if (!auto.visionProviderFinalized && toggleAllowed(gamepad1.dpad_left, dpad_left)) { auto.visionProviderState = (auto.visionProviderState + 1) % auto.visionProviders.length; //switch vision provider } if (!auto.visionProviderFinalized && toggleAllowed(gamepad1.dpad_up, dpad_up)) { auto.initVisionProvider(); //this is blocking } else if (auto.visionProviderFinalized && toggleAllowed(gamepad1.dpad_up, dpad_up)) { auto.deinitVisionProvider(); //also blocking, but should be very quick } if (!auto.visionProviderFinalized && toggleAllowed(gamepad1.dpad_down, dpad_down)) { auto.enableTelemetry = !auto.enableTelemetry; //enable/disable FtcDashboard telemetry // CenterOfGravityCalculator.drawRobotDiagram = !CenterOfGravityCalculator.drawRobotDiagram; } if (auto.visionProviderFinalized && gamepad1.left_trigger > 0.3) { GoldPos gp = auto.vp.detect(); if (gp != GoldPos.HOLD_STATE) initGoldPosTest = gp; telemetry.addData("Vision", "Prep detection: %s%s", initGoldPosTest, gp == GoldPos.HOLD_STATE ? " (HOLD_STATE)" : ""); } if (soundState == 0 && toggleAllowed(gamepad1.right_stick_button, right_stick_button)) { initialization_initSound(); } telemetry.addData("Vision", "Backend: %s (%s)", auto.visionProviders[auto.visionProviderState].getSimpleName(), auto.visionProviderFinalized ? "finalized" : System.currentTimeMillis() / 500 % 2 == 0 ? "**NOT FINALIZED**" : " NOT FINALIZED "); telemetry.addData("Vision", "FtcDashboard Telemetry: %s", auto.enableTelemetry ? "Enabled" : "Disabled"); telemetry.addData("Vision", "Viewpoint: %s", auto.viewpoint); telemetry.addData("Sound", soundState == 0 ? "off" : soundState == 1 ? "on" : soundState == 2 ? "file not found" : "other"); telemetry.addData("Status", "Initialized"); telemetry.addData("Status", "Auto Delay: " + Integer.toString((int) auto.autoDelay) + "seconds"); telemetry.addData("Status", "Side: " + getAlliance()); telemetry.addData("Status", "Hook sensors: " + enableHookSensors); telemetry.update(); robot.ledSystem.setColor(LEDSystem.Color.GAME_OVER); robot.updateSensors(); idle(); // Always call idle() at the bottom of your while(opModeIsActive()) loop } if (auto.vp == null) { auto.initDummyVisionProvider(); //this is blocking } auto.vp.reset(); robot.superman.restart(.75); robot.collector.restart(.4, .5); lastLoopClockTime = System.nanoTime(); // run until the end of the match (driver presses STOP) while (opModeIsActive()) { telemetry.update(); stateSwitch(); if (active) { switch (state) { case 0: //code for tele-op control joystickDrive(); break; case 1: //autonomous that goes to opponent's crater if (auto.depotSide_worlds.execute()) active = false; break; case 2: //autonomous that only samples if (auto.craterSide_worlds.execute()) active = false; break; case 3: //autonomous that starts in our crater if (auto.depotSample_worlds.execute()) active = false; break; case 4: if (auto.craterSide_cycle.execute()) active = false; break; case 5: if (auto.depotSide_deposit.execute()) active = false; break; case 6: // if(driveStraight()) active = false; // if(toggleAllowed(gamepad1.right_bumper,right_bumper)){ // robot.setForwardTPM(robot.getForwardTPM()+10); // }else if(toggleAllowed(gamepad1.left_bumper,left_bumper)){ // robot.setForwardTPM(robot.getForwardTPM()-10); // } turnTest(); break; case 7: balance(); break; case 8: //turn to IMU robot.setAutonSingleStep(true); demo(); break; case 9: // if (auto.craterSide_extend_reverse.execute()) active = false; ledTest(); break; case 10: // if (auto.depotSide_worlds.execute()) active = false; servoTest(); break; default: robot.stopAll(); break; } robot.updateSensors(); } else { robot.stopAll(); } long loopClockTime = System.nanoTime(); long loopTime = loopClockTime - lastLoopClockTime; if (loopAvg == 0) loopAvg = loopTime; else loopAvg = loopWeight*loopTime + (1-loopWeight)*loopAvg; lastLoopClockTime = loopClockTime; idle(); // Always call idle() at the bottom of your while(opModeIsActive()) loop } } public boolean driveStraight(){ return robot.driveForward(true,1,.5); } public void balance(){ robot.collector.extendToMax(); robot.collector.setElbowTargetPos(3734); if (toggleAllowed(gamepad1.y,y)) pCoeff+=.01; else if (toggleAllowed(gamepad1.a, a)) pCoeff-=.01; if (toggleAllowed(gamepad1.dpad_down, dpad_down)) dCoeff-=.005; else if (toggleAllowed(gamepad1.dpad_up, dpad_down)) dCoeff+=.005; if (toggleAllowed(gamepad1.right_bumper,right_bumper)) targetAngle+=.25; else if (toggleAllowed(gamepad1.left_bumper, left_bumper)) targetAngle-=.25; robot.balanceP = pCoeff; robot.balanceD = dCoeff; telemetry.addData("P Coeff: ", pCoeff); telemetry.addData("D Coeff: ", dCoeff); telemetry.addData("Target Angle: ", targetAngle); telemetry.update(); TelemetryPacket tp = new TelemetryPacket(); tp.put("Current Angle", robot.getRoll()); tp.put("Target Angle", targetAngle); FtcDashboard.getInstance().sendTelemetryPacket(tp); robot.balance(targetAngle); } int tpmtuningstage = 0; public void tpmtuning(){ switch (tpmtuningstage){ case 0: if(robot.goToPosition(robot.superman.pos_reverseIntake-100,robot.collector.pos_reverseSafeDrive,.75,.3)){ } if(toggleAllowed(gamepad1.y,y)){ robot.resetMotors(true); } if(toggleAllowed(gamepad1.a,a)){ tpmtuningstage++; } break; case 1: if(robot.driveForward(true,.2,1)){ tpmtuningstage = 0; } break; } } private void initialization_initSound() { telemetry.addData("Please wait", "Initializing Sound"); //telemetry.update(); robot.ledSystem.setColor(LEDSystem.Color.CALM); soundID = hardwareMap.appContext.getResources().getIdentifier("gracious", "raw", hardwareMap.appContext.getPackageName()); boolean success = SoundPlayer.getInstance().preload(hardwareMap.appContext, soundID); if (success) soundState = 1; else soundState = 2; } private void demo() { if (gamepad1.x) robot.maintainHeading(gamepad1.x); if (gamepad1.dpad_down) { robot.articulate(PoseBigWheel.Articulation.manual); robot.superman.lower(); } if (gamepad1.dpad_up) { robot.articulate(PoseBigWheel.Articulation.manual); robot.superman.raise(); } if (gamepad1.dpad_right) { robot.articulate(PoseBigWheel.Articulation.manual); robot.collector.increaseElbowAngle(); } if (gamepad1.dpad_left) { robot.articulate(PoseBigWheel.Articulation.manual); robot.collector.retractBelt(); } } int reverse = 1; private void joystickDrive() { if (!joystickDriveStarted) { robot.resetMotors(true); robot.setAutonSingleStep(true); isHooked = false; joystickDriveStarted = true; } if(robot.getArticulation() == PoseBigWheel.Articulation.intake){ reverse = -1; }else if(robot.getArticulation() != PoseBigWheel.Articulation.intake && robot.getArticulation() != PoseBigWheel.Articulation.manual){ reverse = 1; } pwrFwd = reverse*direction * pwrDamper * gamepad1.left_stick_y; pwrRot = -pwrDamper * .75 * gamepad1.right_stick_x; pwrFwdL = direction * pwrDamper * gamepad1.left_stick_y; pwrStfL = direction * pwrDamper * gamepad1.left_stick_x; pwrFwdR = direction * pwrDamper * gamepad1.right_stick_y; pwrStfR = direction * pwrDamper * gamepad1.right_stick_x; /* if ((robot.getRoll() > 300) && robot.getRoll() < 350) //todo - needs improvement - should be enabling slowmo mode, not setting the damper directly //at least we are looking at the correct axis now - it was super janky - toggling the damper as the axis fluttered across 0 to 365 pwrDamper = .33; else*/ pwrDamper = .65; switch (gameMode) { case 0: //regular (reverse) mode joystickDriveRegularModeReverse(); break; case 1: //endgame mode joystickDriveEndgameMode(); break; case 2: //pre-game = testing auton deploying functions joystickDrivePregameMode(); break; case 3: //regular mode joystickDriveRegularMode(); break; } //manual control if (gamepad1.dpad_down) { robot.articulate(PoseBigWheel.Articulation.manual); robot.superman.lower(); } if (gamepad1.dpad_up) { robot.articulate(PoseBigWheel.Articulation.manual); robot.superman.raise(); } if (gamepad1.right_stick_y > 0.5) { robot.articulate(PoseBigWheel.Articulation.manual); robot.collector.decreaseElbowAngle(); } if (gamepad1.right_stick_y < -0.5) { robot.articulate(PoseBigWheel.Articulation.manual); robot.collector.extendBelt(); } if (gamepad1.dpad_right) { robot.articulate(PoseBigWheel.Articulation.manual); robot.collector.increaseElbowAngle(); } if (gamepad1.dpad_left) { robot.articulate(PoseBigWheel.Articulation.manual); robot.collector.retractBelt(); } //elbow control currTarget = robot.collector.getExtendABobTargetPos(); if (toggleAllowed(gamepad1.left_bumper, left_bumper)) { if (currTarget == robot.collector.extendMid) { currTarget = robot.collector.extendMax; //robot.collector.setElbowTargetPos(robot.beltToElbow(robot.collector.getExtendABobCurrentPos(),0)); } else { currTarget = robot.collector.extendMid; //robot.collector.setElbowTargetPos(robot.beltToElbow(robot.collector.getExtendABobCurrentPos(),0)); } } if (currTarget >= 10) { robot.collector.setExtendABobTargetPos(currTarget); } //endgame mode if (toggleAllowed(gamepad1.right_bumper, right_bumper)) { gameMode = (gameMode + 1) % NUM_MODES; } //intake code double triggers = gamepad1.left_trigger - gamepad1.right_trigger; if(false){//robot.getArticulation() == PoseBigWheel.Articulation.reverseIntake || robot.getArticulation() == PoseBigWheel.Articulation.reverseDeposit){ // robot.collector.collect(); }else { if (triggers > 0.1) robot.collector.collect(); else if (triggers < -0.1) robot.collector.eject(); else robot.collector.stopIntake(); } //Gracious Professionalism! if (soundState == 1 && toggleAllowed(gamepad1.right_stick_button, right_stick_button)) { SoundPlayer.getInstance().startPlaying(hardwareMap.appContext, soundID); } } private void joystickDrivePregameMode() { robot.setAutonSingleStep(true); //single step through articulations having to do with deploying robot.ledSystem.setColor(LEDSystem.Color.CALM); boolean doDelatch = false; if (toggleAllowed(gamepad1.b, b)) { stateDelatch++; if (stateDelatch > 2) stateDelatch = 0; doDelatch = true; } if (toggleAllowed(gamepad1.x, x)) { stateDelatch--; if (stateDelatch < 0) stateDelatch = 2; doDelatch = true; } if (doDelatch) { switch (stateDelatch) { case 0: robot.articulate(PoseBigWheel.Articulation.hanging); break; case 1: robot.articulate(PoseBigWheel.Articulation.deploying); break; case 2: robot.articulate(PoseBigWheel.Articulation.deployed); break; default: break; } } } private void logTurns(double target) { telemetry.addData("Error: ", target - robot.getHeading()); //telemetry.update(); } private void joystickDriveEndgameMode() { robot.ledSystem.setColor(LEDSystem.Color.SHOT); boolean doLatchStage = false; robot.driveMixerTank(pwrFwd, pwrRot); if (toggleAllowed(gamepad1.b, b)) { //b advances us through latching stages - todo: we should really be calling a pose.nextLatchStage function stateLatched++; if (stateLatched > 2) stateLatched = 0; doLatchStage = true; } if (toggleAllowed(gamepad1.x, x)) { //x allows us to back out of latching stages stateLatched--; if (stateLatched < 0) stateLatched = 0; doLatchStage = true; } if (doLatchStage) { switch (stateLatched) { case 0: robot.articulate(PoseBigWheel.Articulation.latchApproach); break; case 1: robot.articulate(PoseBigWheel.Articulation.latchPrep); break; case 2: robot.articulate(PoseBigWheel.Articulation.latchSet); break; } } if (toggleAllowed(gamepad1.a, a)) { isHooked = !isHooked; } if (isHooked) { robot.collector.hookOn(); } else { robot.collector.hookOff(); } } private void turnTest() { if (robot.rotatePIDIMU(90, 3)) { telemetry.addData("Angle Error: ", 90 - robot.getHeading()); telemetry.addData("Final Test Heading: ", robot.getHeading()); robot.setZeroHeading(); active = false; } telemetry.addData("Current Angle: ", robot.getHeading()); telemetry.addData("Angle Error: ", 90 - robot.getHeading()); } private void joystickDriveRegularMode() { robot.ledSystem.setColor(LEDSystem.Color.CALM); robot.collector.hookOff(); boolean doIntake = false; robot.driveMixerTank(pwrFwd, pwrRot); if (gamepad1.y) { robot.goToSafeDrive(); isIntakeClosed = true; } if (toggleAllowed(gamepad1.a, a)) { isIntakeClosed = !isIntakeClosed; } if (toggleAllowed(gamepad1.b, b)) { stateIntake++; if (stateIntake > 3) stateIntake = 0; doIntake = true; } if (toggleAllowed(gamepad1.x, x)) { stateIntake--; if (stateIntake < 0) stateIntake = 3; doIntake = true; } if (doIntake) { switch (stateIntake) { case 0: robot.articulate(PoseBigWheel.Articulation.preIntake); isIntakeClosed = true; break; case 1: robot.articulate(PoseBigWheel.Articulation.intake); isIntakeClosed = true; break; case 2: robot.articulate(PoseBigWheel.Articulation.deposit); break; case 3: robot.articulate(PoseBigWheel.Articulation.driving); isIntakeClosed = true; } } if (isIntakeClosed) { robot.collector.closeGate(); } else { robot.collector.openGate(); } } private void joystickDriveRegularModeReverse() { robot.ledSystem.setColor(LEDSystem.Color.PARTY_MODE_SMOOTH); robot.collector.hookOff(); boolean doIntake = false; if (gamepad1.y) { robot.articulate(PoseBigWheel.Articulation.reverseDriving); isIntakeClosed = true; } if (toggleAllowed(gamepad1.a, a)) { isIntakeClosed = !isIntakeClosed; } if (toggleAllowed(gamepad1.b, b)) { stateIntake++; if (stateIntake > 3) stateIntake = 0; doIntake = true; } if (toggleAllowed(gamepad1.x, x)) { stateIntake--; if (stateIntake < 0) stateIntake = 3; doIntake = true; } if (doIntake) { switch (stateIntake) { case 0: robot.articulate(PoseBigWheel.Articulation.reverseIntake); pwrRot-=.25; //robot.collector.setBeltToElbowModeEnabled(); isIntakeClosed = true; break; case 1: robot.articulate(PoseBigWheel.Articulation.prereversedeposit); //robot.collector.setBeltToElbowModeDisabled(); isIntakeClosed = true; break; case 2: robot.articulate(PoseBigWheel.Articulation.reverseDeposit); //robot.collector.setBeltToElbowModeDisabled(); break; case 3: robot.articulate(PoseBigWheel.Articulation.reverseDriving); //robot.collector.setBeltToElbowModeDisabled(); isIntakeClosed = true; break; } } robot.driveMixerTank(pwrFwd, pwrRot); if (isIntakeClosed) { robot.collector.closeGate(); } else { robot.collector.openGate(); } } //the method that controls the main state of the robot; must be called in the main loop outside of the main switch private void stateSwitch() { if (!active) { if (toggleAllowed(gamepad1.left_bumper, left_bumper)) { state--; if (state < 0) { state = 10; } robot.resetMotors(true); active = false; } if (toggleAllowed(gamepad1.right_bumper, right_bumper)) { state++; if (state > 10) { state = 0; } robot.resetMotors(true); active = false; } } if (toggleAllowed(gamepad1.start, startBtn)) { robot.resetMotors(true); active = !active; } } //checks to see if a specific button should allow a toggle at any given time; needs a rework private boolean toggleAllowed(boolean button, int buttonIndex) { if (button) { if (!buttonSavedStates[buttonIndex]) { //we just pushed the button, and when we last looked at it, it was not pressed buttonSavedStates[buttonIndex] = true; return true; } else { //the button is pressed, but it was last time too - so ignore return false; } } buttonSavedStates[buttonIndex] = false; //not pressed, so remember that it is not return false; //not pressed } private String getAlliance() { if (isBlue) return "Blue"; return "Red"; } private void configureDashboard() { // Configure the dashboard. // At the beginning of each telemetry update, grab a bunch of data // from the IMU that we will then display in separate lines. telemetry.addAction(() -> // Acquiring the angles is relatively expensive; we don't want // to do that in each of the three items that need that info, as that's // three times the necessary expense. angles = robot.imu.getAngularOrientation().toAxesReference(AxesReference.INTRINSIC).toAxesOrder(AxesOrder.ZYX) ); telemetry.addLine() .addData("active", () -> active) .addData("state", () -> state) .addData("autoStage", () -> auto.autoStage) .addData("Game Mode", () -> GAME_MODES[gameMode]) .addData("Articulation", () -> robot.getArticulation()); telemetry.addLine() .addData("elbowA", () -> robot.collector.isActive()) .addData("elbowC", () -> robot.collector.getElbowCurrentPos()) .addData("elbowC2", () -> robot.collector.getElbowCurrentPos2()) .addData("elbowDiff", () -> robot.collector.getElbowCurrentPos() - robot.collector.getElbowCurrentPos2()) .addData("elbowT", () -> robot.collector.getElbowTargetPos()); telemetry.addLine() .addData("supermanPos", () -> robot.superman.getCurrentPosition()) .addData("supermanRight", () -> robot.superman.getCurrentPosition2()) .addData("liftPos", () -> robot.collector.getExtendABobCurrentPos()); telemetry.addLine() .addData("COG theta", () -> robot.getRoll() + robot.cog.pitchOffset) .addData("COG phi", () -> robot.superman.getCurrentAngle() + robot.cog.supermanoffset) .addData("COG beta", () -> robot.collector.getCurrentAngle()+robot.cog.elbowoffset) .addData("COG arm length", 38.2) .addData("COG", () -> robot.cog.getCenterOfGravity(-robot.getRoll() + robot.cog.pitchOffset,robot.superman.getCurrentAngle() + robot.cog.supermanoffset, robot.collector.getCurrentAngle()+robot.cog.elbowoffset, robot.collector.getCurrentLength()).toString()); telemetry.addLine() .addData("roll", () -> robot.getRoll()) .addData("pitch", () -> robot.getPitch()) .addData("yaw", () -> robot.getHeading()); telemetry.addLine() .addData("calib", () -> robot.imu.getCalibrationStatus().toString()); telemetry.addLine() .addData("drivedistance", () -> robot.driveLeft.getCurrentPosition()); telemetry.addLine() .addData("status", () -> robot.imu.getSystemStatus().toShortString()) .addData("Pos", () -> robot.intakeGate.getPosition()) .addData("mineralState", () -> auto.mineralState) .addData("distForward", () -> robot.distForward.getDistance(DistanceUnit.METER)) .addData("distLeft", () -> robot.distLeft.getDistance(DistanceUnit.METER)) .addData("distRight", () -> robot.distRight.getDistance(DistanceUnit.METER)) .addData("depositDriveDistance", () -> robot.depositDriveDistance); telemetry.addLine() .addData("Loop time", "%.0fms", () -> loopAvg/1000000) .addData("Loop time", "%.0fHz", () -> 1000000000/loopAvg); } private void configureDashboardMatch() { // Configure the dashboard. telemetry.addLine() .addData("active", () -> active) .addData("state", () -> state) .addData("Game Mode", () -> GAME_MODES[gameMode]) .addData("Articulation", () -> robot.getArticulation()); telemetry.addAction(() -> robot.cog.getCenterOfGravity(-robot.getRoll() + robot.cog.pitchOffset,robot.superman.getCurrentAngle() + robot.cog.supermanoffset, robot.collector.getCurrentAngle()+robot.cog.elbowoffset, robot.collector.getCurrentLength())); telemetry.addLine() .addData("Loop time", "%.0fms", () -> loopAvg/1000000) .addData("Loop time", "%.0fHz", () -> 1000000000/loopAvg); } int testDeLatch = 0; public boolean delatch() { switch (testDeLatch) { case 0: robot.collector.setElbowTargetPos(robot.collector.pos_prelatch, .9); if (robot.collector.nearTargetElbow()) { testDeLatch++; } break; case 1: robot.superman.setTargetPosition(robot.superman.pos_prelatch); if (robot.superman.nearTarget()) { robot.collector.hookOff(); testDeLatch++; } break; default: testDeLatch = 0; return true; } return false; } private int servoTest = 1005; private void servoTest() { robot.ledSystem.movement.setPosition(servoNormalize(servoTest)); if (toggleAllowed(gamepad1.a, a)) servoTest -= 10; else if (toggleAllowed(gamepad1.y, y)) servoTest += 10; telemetry.addData("Pulse width", servoTest); } private void ledTest() { int idx = (int) ((System.currentTimeMillis() / 2000) % LEDSystem.Color.values().length); robot.ledSystem.setColor(LEDSystem.Color.values()[idx]); telemetry.addData("Color", LEDSystem.Color.values()[idx].name()); } }
35,756
0.573046
0.562981
957
36.371994
32.044601
274
false
false
0
0
0
0
0
0
0.623824
false
false
1
17c6fab5330f8aa02292269b871aff0db7308e2d
7,619,271,983,183
5984d0b15d9e50318a1e2ae97728878a84e64796
/app/src/main/java/booking/sp/clbooking/ViewActivity.java
8a6129f0d90dbc67ee15b2e5ff7098bf1433392b
[]
no_license
gordonb2/gordon-12-5-Booking-Create-Event
https://github.com/gordonb2/gordon-12-5-Booking-Create-Event
aeaba374addbd00e62501278eb4cd5780d28eb90
02f8b384eb90c65086c379f75d10c727b5f4dca8
refs/heads/master
2021-05-06T13:10:48.497000
2017-12-06T00:37:59
2017-12-06T00:37:59
113,249,134
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package booking.sp.clbooking; import android.app.Activity; import android.app.AlertDialog; import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.support.constraint.ConstraintSet; import android.support.v7.app.AppCompatActivity; import android.text.method.ScrollingMovementMethod; import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.LinearLayout; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.TextView; import android.widget.SimpleCursorAdapter; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.List; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.clover.sdk.util.CloverAccount; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.GoogleApiAvailability; import com.google.api.client.extensions.android.http.AndroidHttp; import com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential; import com.google.api.client.googleapis.extensions.android.gms.auth.GooglePlayServicesAvailabilityIOException; import com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException; import com.google.api.client.http.HttpTransport; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.jackson2.JacksonFactory; import com.google.api.client.util.ExponentialBackOff; import com.google.api.services.calendar.CalendarScopes; import com.google.api.client.util.DateTime; import com.google.api.services.calendar.model.*; /** * Created by Ty on 11/5/2017. */ public class ViewActivity extends AppCompatActivity { private Context mContext; private Activity mActivity; public List<Event> events; SimpleArrayAdapter adapter; ListView listview; static Event currentItem; GoogleAccountCredential mCredential = MainActivity.mCredential; SimpleDateFormat sdf = new SimpleDateFormat("MMMM-dd KK:mm a"); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_view); mContext = getApplicationContext(); mActivity = ViewActivity.this; listview = findViewById(R.id.listView); events = MainActivity.events; if (events != null) { adapter = new SimpleArrayAdapter(this, events); listview.setAdapter(adapter); } final Button backButton = findViewById(R.id.backButton); backButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent intent = new Intent(); setResult(RESULT_OK, intent); finish(); } }); final Button createButton = findViewById(R.id.createButton); createButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent myIntent = new Intent(mContext, CreateActivity.class); startActivityForResult(myIntent, 0); } }); } @Override protected void onResume() { Log.i("test", "...Resumed."); super.onResume(); //MainActivity.getResultsFromApi(); } public class SimpleArrayAdapter extends ArrayAdapter<Event> { private final Context context; private final List<Event> values; public SimpleArrayAdapter(Context context, List<Event> values) { super(context, -1, values); this.context = context; this.values = values; } @Override public View getView(int position, View convertView, ViewGroup parent) { final int mPosition = position; final View view = convertView; final AdapterView<?> mParent = (AdapterView<?>) parent; LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View rowView = null; if (inflater != null) { rowView = inflater.inflate(R.layout.daylayout, parent, false); } TextView dayText = rowView.findViewById(R.id.dayText); TextView timeText = rowView.findViewById(R.id.timeText); TextView descriptionText = rowView.findViewById(R.id.descriptionText); Button entryButton = rowView.findViewById(R.id.entryButton); Button reminderButton = rowView.findViewById(R.id.reminderButton); Button deleteButton = rowView.findViewById(R.id.deleteButton); Event e = values.get(position); DateTime start = e.getStart().getDateTime(); if (start == null) { // All-day events don't have start times, so just use // the start date. start = e.getStart().getDate(); } Date sd = new Date(start.getValue()); Date ed = new Date(e.getEnd().getDateTime().getValue()); //Title of Event. dayText.setText(e.getSummary()); //Date and Time of Event. timeText.setText("" + sdf.format(sd) + " - " + sdf.format(ed)); //Get the description of the event. descriptionText.setText(e.getDescription()); entryButton.setText("Edit Entry"); entryButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { currentItem = (Event) mParent.getItemAtPosition(mPosition); Intent myIntent = new Intent(mContext, EditActivity.class); startActivityForResult(myIntent, 0); } }); reminderButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent i = new Intent(Intent.ACTION_SEND); i.setType("text/plain"); i.putExtra(Intent.EXTRA_EMAIL, new String[]{"recipient@example.com"}); i.putExtra(Intent.EXTRA_SUBJECT, "subject of email"); i.putExtra(Intent.EXTRA_TEXT, "body of email"); try { startActivity(Intent.createChooser(i, "Send mail...")); } catch (android.content.ActivityNotFoundException ex) { Toast.makeText(ViewActivity.this, "There are no email clients installed.", Toast.LENGTH_SHORT).show(); } } }); deleteButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { final Event item = (Event) mParent.getItemAtPosition(mPosition); final String itemLabel = item.getSummary(); new AlertDialog.Builder(ViewActivity.this) .setTitle("Title") .setMessage("Do you really want to delete " + itemLabel +"?") .setIcon(android.R.drawable.ic_dialog_alert) .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { new ViewActivity.DeleteEntryTask(mCredential, item).execute(); values.remove(item); adapter.notifyDataSetChanged(); Toast.makeText(ViewActivity.this, itemLabel + " Successfully Deleted", Toast.LENGTH_SHORT).show(); }}) .setNegativeButton(android.R.string.no, null).show(); } }); return rowView; } } private class DeleteEntryTask extends AsyncTask<Void, Void, Event> { private com.google.api.services.calendar.Calendar mService = null; private Event mEvent; DeleteEntryTask(GoogleAccountCredential credential, Event event) { mEvent = event; HttpTransport transport = AndroidHttp.newCompatibleTransport(); JsonFactory jsonFactory = JacksonFactory.getDefaultInstance(); mService = new com.google.api.services.calendar.Calendar.Builder( transport, jsonFactory, credential) .setApplicationName("Google Calendar API Android Quickstart") .build(); } public Event DeleteEntry() throws IOException { String calendarId = "primary"; mService.events().delete(calendarId, mEvent.getId()).execute(); return mEvent; } /** * Background task to call Google Calendar API. * * @param params no parameters needed for this task. */ @Override protected Event doInBackground(Void... params) { try { return DeleteEntry(); } catch (Exception e) { cancel(true); return null; } } @Override protected void onPreExecute() { } @Override protected void onCancelled() { } } }
UTF-8
Java
9,892
java
ViewActivity.java
Java
[ { "context": " i.putExtra(Intent.EXTRA_EMAIL, new String[]{\"recipient@example.com\"});\n i.putExtra(Intent.EXTRA_S", "end": 6630, "score": 0.9998933672904968, "start": 6609, "tag": "EMAIL", "value": "recipient@example.com" } ]
null
[]
package booking.sp.clbooking; import android.app.Activity; import android.app.AlertDialog; import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.support.constraint.ConstraintSet; import android.support.v7.app.AppCompatActivity; import android.text.method.ScrollingMovementMethod; import android.util.Log; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.Button; import android.widget.LinearLayout; import android.widget.ListAdapter; import android.widget.ListView; import android.widget.TextView; import android.widget.SimpleCursorAdapter; import java.io.IOException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Arrays; import java.util.Date; import java.util.HashMap; import java.util.List; import android.content.Context; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.clover.sdk.util.CloverAccount; import com.google.android.gms.common.ConnectionResult; import com.google.android.gms.common.GoogleApiAvailability; import com.google.api.client.extensions.android.http.AndroidHttp; import com.google.api.client.googleapis.extensions.android.gms.auth.GoogleAccountCredential; import com.google.api.client.googleapis.extensions.android.gms.auth.GooglePlayServicesAvailabilityIOException; import com.google.api.client.googleapis.extensions.android.gms.auth.UserRecoverableAuthIOException; import com.google.api.client.http.HttpTransport; import com.google.api.client.json.JsonFactory; import com.google.api.client.json.jackson2.JacksonFactory; import com.google.api.client.util.ExponentialBackOff; import com.google.api.services.calendar.CalendarScopes; import com.google.api.client.util.DateTime; import com.google.api.services.calendar.model.*; /** * Created by Ty on 11/5/2017. */ public class ViewActivity extends AppCompatActivity { private Context mContext; private Activity mActivity; public List<Event> events; SimpleArrayAdapter adapter; ListView listview; static Event currentItem; GoogleAccountCredential mCredential = MainActivity.mCredential; SimpleDateFormat sdf = new SimpleDateFormat("MMMM-dd KK:mm a"); @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_view); mContext = getApplicationContext(); mActivity = ViewActivity.this; listview = findViewById(R.id.listView); events = MainActivity.events; if (events != null) { adapter = new SimpleArrayAdapter(this, events); listview.setAdapter(adapter); } final Button backButton = findViewById(R.id.backButton); backButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent intent = new Intent(); setResult(RESULT_OK, intent); finish(); } }); final Button createButton = findViewById(R.id.createButton); createButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent myIntent = new Intent(mContext, CreateActivity.class); startActivityForResult(myIntent, 0); } }); } @Override protected void onResume() { Log.i("test", "...Resumed."); super.onResume(); //MainActivity.getResultsFromApi(); } public class SimpleArrayAdapter extends ArrayAdapter<Event> { private final Context context; private final List<Event> values; public SimpleArrayAdapter(Context context, List<Event> values) { super(context, -1, values); this.context = context; this.values = values; } @Override public View getView(int position, View convertView, ViewGroup parent) { final int mPosition = position; final View view = convertView; final AdapterView<?> mParent = (AdapterView<?>) parent; LayoutInflater inflater = (LayoutInflater) context .getSystemService(Context.LAYOUT_INFLATER_SERVICE); View rowView = null; if (inflater != null) { rowView = inflater.inflate(R.layout.daylayout, parent, false); } TextView dayText = rowView.findViewById(R.id.dayText); TextView timeText = rowView.findViewById(R.id.timeText); TextView descriptionText = rowView.findViewById(R.id.descriptionText); Button entryButton = rowView.findViewById(R.id.entryButton); Button reminderButton = rowView.findViewById(R.id.reminderButton); Button deleteButton = rowView.findViewById(R.id.deleteButton); Event e = values.get(position); DateTime start = e.getStart().getDateTime(); if (start == null) { // All-day events don't have start times, so just use // the start date. start = e.getStart().getDate(); } Date sd = new Date(start.getValue()); Date ed = new Date(e.getEnd().getDateTime().getValue()); //Title of Event. dayText.setText(e.getSummary()); //Date and Time of Event. timeText.setText("" + sdf.format(sd) + " - " + sdf.format(ed)); //Get the description of the event. descriptionText.setText(e.getDescription()); entryButton.setText("Edit Entry"); entryButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { currentItem = (Event) mParent.getItemAtPosition(mPosition); Intent myIntent = new Intent(mContext, EditActivity.class); startActivityForResult(myIntent, 0); } }); reminderButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { Intent i = new Intent(Intent.ACTION_SEND); i.setType("text/plain"); i.putExtra(Intent.EXTRA_EMAIL, new String[]{"<EMAIL>"}); i.putExtra(Intent.EXTRA_SUBJECT, "subject of email"); i.putExtra(Intent.EXTRA_TEXT, "body of email"); try { startActivity(Intent.createChooser(i, "Send mail...")); } catch (android.content.ActivityNotFoundException ex) { Toast.makeText(ViewActivity.this, "There are no email clients installed.", Toast.LENGTH_SHORT).show(); } } }); deleteButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { final Event item = (Event) mParent.getItemAtPosition(mPosition); final String itemLabel = item.getSummary(); new AlertDialog.Builder(ViewActivity.this) .setTitle("Title") .setMessage("Do you really want to delete " + itemLabel +"?") .setIcon(android.R.drawable.ic_dialog_alert) .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int whichButton) { new ViewActivity.DeleteEntryTask(mCredential, item).execute(); values.remove(item); adapter.notifyDataSetChanged(); Toast.makeText(ViewActivity.this, itemLabel + " Successfully Deleted", Toast.LENGTH_SHORT).show(); }}) .setNegativeButton(android.R.string.no, null).show(); } }); return rowView; } } private class DeleteEntryTask extends AsyncTask<Void, Void, Event> { private com.google.api.services.calendar.Calendar mService = null; private Event mEvent; DeleteEntryTask(GoogleAccountCredential credential, Event event) { mEvent = event; HttpTransport transport = AndroidHttp.newCompatibleTransport(); JsonFactory jsonFactory = JacksonFactory.getDefaultInstance(); mService = new com.google.api.services.calendar.Calendar.Builder( transport, jsonFactory, credential) .setApplicationName("Google Calendar API Android Quickstart") .build(); } public Event DeleteEntry() throws IOException { String calendarId = "primary"; mService.events().delete(calendarId, mEvent.getId()).execute(); return mEvent; } /** * Background task to call Google Calendar API. * * @param params no parameters needed for this task. */ @Override protected Event doInBackground(Void... params) { try { return DeleteEntry(); } catch (Exception e) { cancel(true); return null; } } @Override protected void onPreExecute() { } @Override protected void onCancelled() { } } }
9,878
0.622928
0.621715
254
37.940945
27.587521
134
false
false
0
0
0
0
0
0
0.677165
false
false
1
592ea6bc168eeef6e1af9588b33d0c92128ebac5
26,121,991,157,332
d06b6c047044157b48e25a28a3402be523b49093
/Happy_birthday_mailer/Happy_birthday_mailer/Producer.java
998c254586d0de3068256c6e9280c3be1f672f5a
[]
no_license
krishna6991/JAVA
https://github.com/krishna6991/JAVA
47a390adb7d9e76d5b3d86a425f38f85641d727e
e3c790fa321f0ebf510024274dc7a589f96205b3
refs/heads/master
2020-04-07T20:00:01.979000
2018-12-16T17:07:45
2018-12-16T17:07:45
158,671,252
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class Producer { public static Connectivity now_start() { return new Connectivity(); } }
UTF-8
Java
107
java
Producer.java
Java
[]
null
[]
public class Producer { public static Connectivity now_start() { return new Connectivity(); } }
107
0.672897
0.672897
5
19
15.453155
41
false
false
0
0
0
0
0
0
1
false
false
1
c408332a5b4a292399655506ab119a7353a2faa8
8,443,905,757,397
b25b5150a551d528cf4b08113f0cf4e37ccdff01
/src/gcf/settings/GcfLexer.java
eb50a261ca482f4971f6271b4daa236f37410cc4
[ "Apache-2.0" ]
permissive
luciusvorenus/Settings
https://github.com/luciusvorenus/Settings
25e0845ae74841b5c8b3229f6175b5aaa5e2335d
877642beae8aaa83184ae491afd3ae07462a7425
refs/heads/master
2021-01-10T07:40:59.817000
2019-04-10T18:34:29
2019-04-10T18:34:29
43,018,346
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* Settings Copyright 2015 micama 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 gcf.settings; import java.io.File; /** * Lexer implementation class. * This class extends the abstract <code>Lexer</code> class and * implements its <code>nextToken</code> method, to * tokenize the string gcf file format. */ class GcfLexer extends Lexer { /* flag when token is a global key */ private boolean parsingGlobalKeys = true; /* flag when value is a global var */ private boolean parsingGlobalVar = false; /* flag when token is the group name */ private boolean parsingGroupName = false; /* flag when token is a key */ private boolean parsingKey = false; /* flag when token is a value */ private boolean parsingValue = false; /** * Create a Lexer to tokenize the gcf file format. * @param file the file whose content shall be tokenizied */ GcfLexer(final File file) { super(file); } /** * Gets the next token from the stream of characters. * Comments and spaces are ignored.<br> * The boolean flags are intended to help the lexer * recognize with tokentype it is handling * at a given moment. For example a groupname and a key * are both simply text but have different tokentypes. * @return the next token */ @Override Token nextToken() { while(c != EOF) { switch(c) { case ' ': case '\t': case '\n': case '\r': ws(); // skip all whitespaces continue; case '#': comment(); // skip all characters until end of line (\n) continue; case '[': consume(); parsingGlobalKeys = false; // global keys must come before any group parsingGroupName = true; parsingKey = false; parsingValue = false; return new Token(TokenType.GROUP_LBRACE, "[", lineNumber); case ']': consume(); parsingGroupName = false; parsingKey = true; parsingValue = false; return new Token(TokenType.GROUP_RBRACE, "]", lineNumber); case '/': consume(); return new Token(TokenType.GROUP_FSLASH, "/", lineNumber); case '=': consume(); parsingKey = false; parsingValue = true; return new Token(TokenType.EQUAL_SIGN, "=", lineNumber); case '$': consume(); return new Token(TokenType.GLOBAR_VAR_SYMBOL, "$", lineNumber); case '{': consume(); parsingGlobalVar = true; return new Token(TokenType.GLOBAL_VAR_LBRACE, "{", lineNumber); case '}': consume(); parsingKey = true; parsingValue = false; parsingGlobalVar = false; return new Token(TokenType.GLOBAL_VAR_RBRACE, "}", lineNumber); default: // Check if it is a letter, start of string or start of number if (Character.isLetter(c) || c =='"' || isNumber(c) || c == '-' || c == '+') { if (parsingGroupName) return new Token(TokenType.GROUP_NAME,groupnameText(), lineNumber); else if (parsingKey) return new Token(TokenType.KEY, keyText(), lineNumber); else if (parsingGlobalVar) return new Token(TokenType.GLOBAL_VAR_NAME, keyText(), lineNumber); else if (parsingValue) { parsingKey = true; parsingValue = false; return value(c); } else if (parsingGlobalKeys) return new Token(TokenType.KEY, keyText(), lineNumber); } throw new GcfException("invalid character while parsing: \'"+c+"\' at line "+lineNumber); } } return new Token(TokenType.EOF, "EOF", lineNumber); } /** * Consumes all subsquent whitespaces. */ private void ws() { while(isWhitespace(c)) { consume(); } } /** * Consumes all text that is part of a comment. * A comment cannot be multiline, so this method * consumes everthing right of the comment character until * the end of the line. */ private void comment() { while(c != '\n') { consume(); } } /** * Constructs the text for name of a group. * This method only gets used when the appropriate groupname flag * has been set to true. * @return the groupname text */ private String groupnameText() { final StringBuilder sb = new StringBuilder(); do { sb.append(c); consume(); } while(Character.isLetter(c) || isNumber(c) || c=='_' || c=='-' || c=='.'); return sb.toString(); } /** * Constructs the text for a key. * This method only gets used when the appropriate key flag * is set to true. * @return the key text */ private String keyText() { if (Character.isLetter(c) == false) { throw new GcfException("key must start with a letter, found \'"+c+"\' at line "+lineNumber); } final StringBuilder sb = new StringBuilder(); do { sb.append(c); consume(); } while(Character.isLetter(c) || isNumber(c) || c=='_' || c=='-' || c=='.'); return sb.toString(); } /** * Checks if a specific character is a number. * @param ch the character to be checked. * @return true if character is a number, false otherwise. */ private boolean isNumber(final char ch) { return ch >= '0' && ch <= '9'; } /** * Gets the token for a key value. * The value can a number, a boolean or a string. * For each one of these possibilities, there is * a separate method to parse the respective text. * @param ch current char in the input stream * @return the token representing the value. */ private Token value(final char ch) { String valueStr = ""; if (isNumber(ch) || ch=='-' || ch=='+') { valueStr = numberValue(ch); } else if (c == '\"') { valueStr = stringValue(ch); } else { valueStr = booleanValue(); } return new Token(TokenType.VALUE,valueStr,lineNumber); } /** * Parses the text for a numeric value. * Number can be an integer or a floating point, i.e. * containing a dot. * @param ch current char in the input stream * @return text of the numeric value */ private String numberValue(final char ch) { final StringBuilder sb = new StringBuilder(); sb.append(ch); consume(); while(isNumber(c) || c=='.') { sb.append(c); consume(); } return sb.toString(); } /** * Parses the text of a string value. * A string must be enclosed in double quotes. * Otherwise an exception is thrown. * The string text is parsed containing the double quotes * because those are important later when parsing the file, i.e. * to distinguish which class represents the value. * @param ch current char in the input stream * @return text of the string value with double quotes */ private String stringValue(final char ch) { final StringBuilder sb = new StringBuilder(); sb.append(ch); consume(); while(c != '\"') { sb.append(c); if (c == '\n') { throw new GcfException("string not correctly closed at line "+lineNumber); } consume(); } sb.append(c); consume(); return sb.toString(); } /** * Parses the text for a boolean value. * A boolean value can only be "true" or "false". * In this application we also accept "True", "TRUE" and * "False", "FALSE". * Here the value is parsed without checking the correct * content of the text value. It just accepts letters. * The check wether the value is correct or not occurs * during the parsing of the file. * @return text of a boolean value */ private String booleanValue() { final StringBuilder sb = new StringBuilder(); do { sb.append(c); consume(); } while(Character.isLetter(c)); return sb.toString(); } }
UTF-8
Java
9,632
java
GcfLexer.java
Java
[ { "context": "/*\n Settings \n Copyright 2015 micama\n\n Licensed under the Apache License, Version 2.", "end": 38, "score": 0.999509334564209, "start": 32, "tag": "USERNAME", "value": "micama" } ]
null
[]
/* Settings Copyright 2015 micama 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 gcf.settings; import java.io.File; /** * Lexer implementation class. * This class extends the abstract <code>Lexer</code> class and * implements its <code>nextToken</code> method, to * tokenize the string gcf file format. */ class GcfLexer extends Lexer { /* flag when token is a global key */ private boolean parsingGlobalKeys = true; /* flag when value is a global var */ private boolean parsingGlobalVar = false; /* flag when token is the group name */ private boolean parsingGroupName = false; /* flag when token is a key */ private boolean parsingKey = false; /* flag when token is a value */ private boolean parsingValue = false; /** * Create a Lexer to tokenize the gcf file format. * @param file the file whose content shall be tokenizied */ GcfLexer(final File file) { super(file); } /** * Gets the next token from the stream of characters. * Comments and spaces are ignored.<br> * The boolean flags are intended to help the lexer * recognize with tokentype it is handling * at a given moment. For example a groupname and a key * are both simply text but have different tokentypes. * @return the next token */ @Override Token nextToken() { while(c != EOF) { switch(c) { case ' ': case '\t': case '\n': case '\r': ws(); // skip all whitespaces continue; case '#': comment(); // skip all characters until end of line (\n) continue; case '[': consume(); parsingGlobalKeys = false; // global keys must come before any group parsingGroupName = true; parsingKey = false; parsingValue = false; return new Token(TokenType.GROUP_LBRACE, "[", lineNumber); case ']': consume(); parsingGroupName = false; parsingKey = true; parsingValue = false; return new Token(TokenType.GROUP_RBRACE, "]", lineNumber); case '/': consume(); return new Token(TokenType.GROUP_FSLASH, "/", lineNumber); case '=': consume(); parsingKey = false; parsingValue = true; return new Token(TokenType.EQUAL_SIGN, "=", lineNumber); case '$': consume(); return new Token(TokenType.GLOBAR_VAR_SYMBOL, "$", lineNumber); case '{': consume(); parsingGlobalVar = true; return new Token(TokenType.GLOBAL_VAR_LBRACE, "{", lineNumber); case '}': consume(); parsingKey = true; parsingValue = false; parsingGlobalVar = false; return new Token(TokenType.GLOBAL_VAR_RBRACE, "}", lineNumber); default: // Check if it is a letter, start of string or start of number if (Character.isLetter(c) || c =='"' || isNumber(c) || c == '-' || c == '+') { if (parsingGroupName) return new Token(TokenType.GROUP_NAME,groupnameText(), lineNumber); else if (parsingKey) return new Token(TokenType.KEY, keyText(), lineNumber); else if (parsingGlobalVar) return new Token(TokenType.GLOBAL_VAR_NAME, keyText(), lineNumber); else if (parsingValue) { parsingKey = true; parsingValue = false; return value(c); } else if (parsingGlobalKeys) return new Token(TokenType.KEY, keyText(), lineNumber); } throw new GcfException("invalid character while parsing: \'"+c+"\' at line "+lineNumber); } } return new Token(TokenType.EOF, "EOF", lineNumber); } /** * Consumes all subsquent whitespaces. */ private void ws() { while(isWhitespace(c)) { consume(); } } /** * Consumes all text that is part of a comment. * A comment cannot be multiline, so this method * consumes everthing right of the comment character until * the end of the line. */ private void comment() { while(c != '\n') { consume(); } } /** * Constructs the text for name of a group. * This method only gets used when the appropriate groupname flag * has been set to true. * @return the groupname text */ private String groupnameText() { final StringBuilder sb = new StringBuilder(); do { sb.append(c); consume(); } while(Character.isLetter(c) || isNumber(c) || c=='_' || c=='-' || c=='.'); return sb.toString(); } /** * Constructs the text for a key. * This method only gets used when the appropriate key flag * is set to true. * @return the key text */ private String keyText() { if (Character.isLetter(c) == false) { throw new GcfException("key must start with a letter, found \'"+c+"\' at line "+lineNumber); } final StringBuilder sb = new StringBuilder(); do { sb.append(c); consume(); } while(Character.isLetter(c) || isNumber(c) || c=='_' || c=='-' || c=='.'); return sb.toString(); } /** * Checks if a specific character is a number. * @param ch the character to be checked. * @return true if character is a number, false otherwise. */ private boolean isNumber(final char ch) { return ch >= '0' && ch <= '9'; } /** * Gets the token for a key value. * The value can a number, a boolean or a string. * For each one of these possibilities, there is * a separate method to parse the respective text. * @param ch current char in the input stream * @return the token representing the value. */ private Token value(final char ch) { String valueStr = ""; if (isNumber(ch) || ch=='-' || ch=='+') { valueStr = numberValue(ch); } else if (c == '\"') { valueStr = stringValue(ch); } else { valueStr = booleanValue(); } return new Token(TokenType.VALUE,valueStr,lineNumber); } /** * Parses the text for a numeric value. * Number can be an integer or a floating point, i.e. * containing a dot. * @param ch current char in the input stream * @return text of the numeric value */ private String numberValue(final char ch) { final StringBuilder sb = new StringBuilder(); sb.append(ch); consume(); while(isNumber(c) || c=='.') { sb.append(c); consume(); } return sb.toString(); } /** * Parses the text of a string value. * A string must be enclosed in double quotes. * Otherwise an exception is thrown. * The string text is parsed containing the double quotes * because those are important later when parsing the file, i.e. * to distinguish which class represents the value. * @param ch current char in the input stream * @return text of the string value with double quotes */ private String stringValue(final char ch) { final StringBuilder sb = new StringBuilder(); sb.append(ch); consume(); while(c != '\"') { sb.append(c); if (c == '\n') { throw new GcfException("string not correctly closed at line "+lineNumber); } consume(); } sb.append(c); consume(); return sb.toString(); } /** * Parses the text for a boolean value. * A boolean value can only be "true" or "false". * In this application we also accept "True", "TRUE" and * "False", "FALSE". * Here the value is parsed without checking the correct * content of the text value. It just accepts letters. * The check wether the value is correct or not occurs * during the parsing of the file. * @return text of a boolean value */ private String booleanValue() { final StringBuilder sb = new StringBuilder(); do { sb.append(c); consume(); } while(Character.isLetter(c)); return sb.toString(); } }
9,632
0.532392
0.531354
280
33.400002
24.700579
118
false
false
0
0
0
0
0
0
0.567857
false
false
1
d0f0bc5be8f74951cbc8f15a477a989f96a3bacf
35,287,451,342,230
da61cef8243647efab17ddeddb6d3f211f53cfd7
/app/src/main/java/com/example/usuario/calllogproviderclase/CallLogAdapter.java
ad775a3b6d7c63c5a7694b626ffa7ebd92864dd8
[]
no_license
JuanFranCrater/CallLogsProvider
https://github.com/JuanFranCrater/CallLogsProvider
07ce0f7101cdc21db7e3351b7d8377a5fe7fd2de
04be313fdc0206b7eb11e1756be02535677bcc2c
refs/heads/master
2021-05-02T03:52:42.693000
2018-02-12T11:52:48
2018-02-12T11:52:48
120,905,915
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.usuario.calllogproviderclase; import android.content.Context; import android.database.Cursor; import android.provider.CallLog; import android.support.v4.widget.CursorAdapter; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import java.util.Calendar; /** * Created by usuario on 9/02/18. */ class CallLogAdapter extends CursorAdapter{ private class CallLogHolder{ private TextView txvNumber,txvDate,txvDuration,txvType; } public CallLogAdapter(Context context) { super(context, null, CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER); } @Override public View newView(Context context, Cursor cursor, ViewGroup parent) { View view=LayoutInflater.from(context).inflate(R.layout.item_llamada,parent,false); CallLogHolder callLogHolder= new CallLogHolder(); callLogHolder.txvNumber=view.findViewById(R.id.txvNumber); callLogHolder.txvDate= view.findViewById(R.id.txvDate); callLogHolder.txvDuration=view.findViewById(R.id.txvDuration); callLogHolder.txvType=view.findViewById(R.id.txtType); view.setTag(callLogHolder); return view; } @Override public void bindView(View view, Context context, Cursor cursor) { CallLogHolder callLogHolder= (CallLogHolder) view.getTag(); callLogHolder.txvNumber.setText(cursor.getString(1)); Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(Long.parseLong(cursor.getString(2))); int mYear = calendar.get(Calendar.YEAR); int mMonth = calendar.get(Calendar.MONTH); int mDay = calendar.get(Calendar.DAY_OF_MONTH); int hora =calendar.get(Calendar.HOUR); int minute = calendar.get(Calendar.MINUTE); int seconds= calendar.get(Calendar.SECOND); callLogHolder.txvDate.setText(mDay+"/"+ mMonth +"/"+mYear+" "+hora+":"+minute+":"+seconds); callLogHolder.txvDuration.setText(cursor.getString(3)+" seconds"); callLogHolder.txvType.setText(getCallTypeText(Integer.parseInt(cursor.getString(4)))); } public String getCallTypeText(int callType) { switch (callType) { case CallLog.Calls.INCOMING_TYPE: return "Llamada entrante"; case CallLog.Calls.OUTGOING_TYPE: return "Llamada realizada"; case CallLog.Calls.MISSED_TYPE: return "Llamada perdida"; default: return "No se que tipo de llamada es esta"; } } }
UTF-8
Java
2,604
java
CallLogAdapter.java
Java
[ { "context": "ew;\n\nimport java.util.Calendar;\n\n/**\n * Created by usuario on 9/02/18.\n */\n\nclass CallLogAdapter extends Cur", "end": 375, "score": 0.9959325194358826, "start": 368, "tag": "USERNAME", "value": "usuario" } ]
null
[]
package com.example.usuario.calllogproviderclase; import android.content.Context; import android.database.Cursor; import android.provider.CallLog; import android.support.v4.widget.CursorAdapter; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; import java.util.Calendar; /** * Created by usuario on 9/02/18. */ class CallLogAdapter extends CursorAdapter{ private class CallLogHolder{ private TextView txvNumber,txvDate,txvDuration,txvType; } public CallLogAdapter(Context context) { super(context, null, CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER); } @Override public View newView(Context context, Cursor cursor, ViewGroup parent) { View view=LayoutInflater.from(context).inflate(R.layout.item_llamada,parent,false); CallLogHolder callLogHolder= new CallLogHolder(); callLogHolder.txvNumber=view.findViewById(R.id.txvNumber); callLogHolder.txvDate= view.findViewById(R.id.txvDate); callLogHolder.txvDuration=view.findViewById(R.id.txvDuration); callLogHolder.txvType=view.findViewById(R.id.txtType); view.setTag(callLogHolder); return view; } @Override public void bindView(View view, Context context, Cursor cursor) { CallLogHolder callLogHolder= (CallLogHolder) view.getTag(); callLogHolder.txvNumber.setText(cursor.getString(1)); Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(Long.parseLong(cursor.getString(2))); int mYear = calendar.get(Calendar.YEAR); int mMonth = calendar.get(Calendar.MONTH); int mDay = calendar.get(Calendar.DAY_OF_MONTH); int hora =calendar.get(Calendar.HOUR); int minute = calendar.get(Calendar.MINUTE); int seconds= calendar.get(Calendar.SECOND); callLogHolder.txvDate.setText(mDay+"/"+ mMonth +"/"+mYear+" "+hora+":"+minute+":"+seconds); callLogHolder.txvDuration.setText(cursor.getString(3)+" seconds"); callLogHolder.txvType.setText(getCallTypeText(Integer.parseInt(cursor.getString(4)))); } public String getCallTypeText(int callType) { switch (callType) { case CallLog.Calls.INCOMING_TYPE: return "Llamada entrante"; case CallLog.Calls.OUTGOING_TYPE: return "Llamada realizada"; case CallLog.Calls.MISSED_TYPE: return "Llamada perdida"; default: return "No se que tipo de llamada es esta"; } } }
2,604
0.686636
0.682796
77
32.81818
27.486822
101
false
false
0
0
0
0
0
0
0.623377
false
false
1
830ba7d346a3db83ad03144bacf5ae31f43b4b99
38,757,784,912,477
72e57ddf08987634e327147c08286e2859c4578c
/language-java/src/main/java/com/example/lang/ClassGetInterfacesExample.java
1bdfcf4e48e1ee84c46e984287c84eb8a65ae934
[ "MIT" ]
permissive
yuweijun/learning-programming
https://github.com/yuweijun/learning-programming
b0cc638a4684d8dedc9b8cc38e87c22646a3a2d6
626737797a622202b2bec4084897713d26247263
refs/heads/master
2018-09-09T08:07:08.541000
2018-09-05T07:14:48
2018-09-05T07:14:48
48,033,864
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.lang; import java.util.Arrays; /** * @author yuweijun 2016-09-20 */ public class ClassGetInterfacesExample { public static void main(String[] args) { show(Thread.class); } public static void show(Class cls) { System.out.println("Class = " + cls.getName()); Class[] cs = cls.getClasses(); System.out.println("Classes = " + Arrays.asList(cs)); // returns an array of interfaces Class[] is = cls.getInterfaces(); System.out.println("Interfaces = " + Arrays.asList(is)); } }
UTF-8
Java
568
java
ClassGetInterfacesExample.java
Java
[ { "context": "le.lang;\n\nimport java.util.Arrays;\n\n/**\n * @author yuweijun 2016-09-20\n */\npublic class ClassGetInterfacesExa", "end": 76, "score": 0.9972290992736816, "start": 68, "tag": "USERNAME", "value": "yuweijun" } ]
null
[]
package com.example.lang; import java.util.Arrays; /** * @author yuweijun 2016-09-20 */ public class ClassGetInterfacesExample { public static void main(String[] args) { show(Thread.class); } public static void show(Class cls) { System.out.println("Class = " + cls.getName()); Class[] cs = cls.getClasses(); System.out.println("Classes = " + Arrays.asList(cs)); // returns an array of interfaces Class[] is = cls.getInterfaces(); System.out.println("Interfaces = " + Arrays.asList(is)); } }
568
0.614437
0.600352
21
26.047619
21.196308
64
false
false
0
0
0
0
0
0
0.380952
false
false
1
642395b5a2e941b7b7d90d8cc0ffdd5a6a55f28c
36,421,322,699,505
5345ad8f6b69fa1431a32895d9ac3ba07c31e607
/src/main/java/com/ruoyi/project/system/spNotice/service/ISpNoticeService.java
2fb7c46a65128158e63e965c3f521c425ad68bc8
[ "MIT" ]
permissive
heavypig/di_xjk
https://github.com/heavypig/di_xjk
35f9c0dbdfaa844d41296917ce632df9df5e611d
e46c50e608639bc0aaf7636a1a51d3c5b3181f97
refs/heads/master
2023-01-14T07:21:03.415000
2020-11-25T08:34:27
2020-11-25T08:34:27
298,728,547
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ruoyi.project.system.spNotice.service; import com.ruoyi.project.system.spNotice.domain.SpNotice; import java.util.List; import java.util.Map; /** * 新街口公告Service接口 * * @author xingmc * @date 2020-11-09 */ public interface ISpNoticeService { /** * 查询新街口公告 * * @param noticeId 新街口公告ID * @return 新街口公告 */ public SpNotice selectSpNoticeById(String noticeId); /** * 查询新街口公告列表 * * @param spNotice 新街口公告 * @return 新街口公告集合 */ public List<SpNotice> selectSpNoticeList(SpNotice spNotice); /** * 新增新街口公告 * * @param spNotice 新街口公告 * @return 结果 */ public int insertSpNotice(SpNotice spNotice); /** * 修改新街口公告 * * @param spNotice 新街口公告 * @return 结果 */ public int updateSpNotice(SpNotice spNotice); /** * 批量删除新街口公告 * * @param ids 需要删除的数据ID * @return 结果 */ public int deleteSpNoticeByIds(String ids); /** * 删除新街口公告信息 * * @param noticeId 新街口公告ID * @return 结果 */ public int deleteSpNoticeById(String noticeId); /** * 查询新街口公告列表 * @param spNotice * @return */ Map<String, Object> getSpNoticeList(SpNotice spNotice); }
UTF-8
Java
1,487
java
ISpNoticeService.java
Java
[ { "context": "va.util.Map;\n\n/**\n * 新街口公告Service接口\n * \n * @author xingmc\n * @date 2020-11-09\n */\npublic interface ISpNotic", "end": 199, "score": 0.999641478061676, "start": 193, "tag": "USERNAME", "value": "xingmc" } ]
null
[]
package com.ruoyi.project.system.spNotice.service; import com.ruoyi.project.system.spNotice.domain.SpNotice; import java.util.List; import java.util.Map; /** * 新街口公告Service接口 * * @author xingmc * @date 2020-11-09 */ public interface ISpNoticeService { /** * 查询新街口公告 * * @param noticeId 新街口公告ID * @return 新街口公告 */ public SpNotice selectSpNoticeById(String noticeId); /** * 查询新街口公告列表 * * @param spNotice 新街口公告 * @return 新街口公告集合 */ public List<SpNotice> selectSpNoticeList(SpNotice spNotice); /** * 新增新街口公告 * * @param spNotice 新街口公告 * @return 结果 */ public int insertSpNotice(SpNotice spNotice); /** * 修改新街口公告 * * @param spNotice 新街口公告 * @return 结果 */ public int updateSpNotice(SpNotice spNotice); /** * 批量删除新街口公告 * * @param ids 需要删除的数据ID * @return 结果 */ public int deleteSpNoticeByIds(String ids); /** * 删除新街口公告信息 * * @param noticeId 新街口公告ID * @return 结果 */ public int deleteSpNoticeById(String noticeId); /** * 查询新街口公告列表 * @param spNotice * @return */ Map<String, Object> getSpNoticeList(SpNotice spNotice); }
1,487
0.588845
0.58247
69
17.188406
16.56369
64
false
false
0
0
0
0
0
0
0.173913
false
false
1
dc9d4f59635e8e95ac3f84a7c32d49da33fd77df
3,410,204,084,789
5c03f6a11a7b78e1a643e969e89eff81e9bbfc66
/src/test/java/Pages/PasarelaPagosFlowPage.java
98f63ce895a14fe742154485d86639ee862dee72
[]
no_license
drubilard/RefundFlow
https://github.com/drubilard/RefundFlow
b7eec350b9b51b99b7cbaff741bece971c5dfe43
9c4f041d534d9be4bbc8cfc245c7af58a648b08c
refs/heads/master
2023-06-30T21:57:48.984000
2021-08-06T15:22:06
2021-08-06T15:22:06
386,327,483
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Pages; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.PageFactory; import org.openqa.selenium.support.ui.LoadableComponent; import org.openqa.selenium.support.ui.Select; import commons.Configuration; import commons.WebAutomator; public class PasarelaPagosFlowPage extends LoadableComponent<PasarelaPagosFlowPage> { WebAutomator automator; // WebElement buttonPagarFlowLocator; // WebElement parrafoPagoLocator; @FindBy(id = "pagar") private WebElement buttonPagarFlowLocator; //servipag @FindBy(css = "input[value='Pagar']") private WebElement buttonPagarServipagLocator; //multicaja @FindBy(css = "input[value='Continuar']") private WebElement buttonPagarMultiCajaLocator; @FindBy(css = "input[value='Pagar']") private WebElement buttonPagarCryptoLocator; @FindBy(id = "credito") private WebElement buttonCreditoWebpayLocator; @FindBy(id = "card-number") private WebElement inputCardNumberWebpayLocator; @FindBy(id = "card-exp") private WebElement inputCardExpWebpayLocator; @FindBy(id = "card-cvv") private WebElement inputCardCvvWebpayLocator; @FindBy(css = "button.submit") private WebElement buttonWebpayContinuarLocator; @FindBy(id = "rutClient") private WebElement inputRutTransbankLocator; @FindBy(id = "passwordClient") private WebElement inputPassTransbankLocator; @FindBy(css = "input[type='submit'][value='Aceptar']") private WebElement buttonAceptarTransbankLocator; @FindBy(id = "vci") private WebElement selectOptionTransbankLocator; @FindBy(css = "input[type='submit'][value='Continuar']") private WebElement buttonContinuarTransbankLocator; @FindBy(css = "div.col-md-6.col-md-offset-3.box-pay > h3") private WebElement parrafoPagoLocator; public PasarelaPagosFlowPage(WebAutomator automator) { this.automator = automator; PageFactory.initElements(automator.getDriver(), this); } public boolean pagoTransaccionServipag(WebElement elementMedio) { automator.click(elementMedio, 10); automator.click(buttonPagarFlowLocator, 10); automator.click(buttonPagarServipagLocator, 10); automator.waitUntilPresent(parrafoPagoLocator, 10); if (automator.isDisplayed(parrafoPagoLocator)) { return true; } else { return false; } } public boolean pagoTransaccionMultiCaja(WebElement elementMedio) { automator.click(elementMedio, 10); automator.click(buttonPagarFlowLocator, 10); automator.click(buttonPagarMultiCajaLocator, 10); automator.waitUntilPresent(parrafoPagoLocator, 10); if (automator.isDisplayed(parrafoPagoLocator)) { return true; } else { return false; } } public boolean pagoTransaccionMach(WebElement elementMedio) { automator.click(elementMedio, 10); automator.click(buttonPagarFlowLocator, 10); if (automator.isDisplayed(parrafoPagoLocator)) { return true; } else { return false; } } public boolean pagoTransaccionWebpay(WebElement elementMedio) { automator.click(elementMedio, 10); automator.click(buttonPagarFlowLocator, 10); automator.click(buttonCreditoWebpayLocator, 10); automator.waitUntilPresent(inputCardCvvWebpayLocator, 10); automator.type(inputCardNumberWebpayLocator, Configuration.CREDITCARD_NUM); automator.type(inputCardExpWebpayLocator, Configuration.CREDITCARD_EXP); automator.type(inputCardCvvWebpayLocator, Configuration.CREDITCARD_CVV); automator.waitUntilClickable(buttonWebpayContinuarLocator, 10); automator.click(buttonWebpayContinuarLocator); automator.waitUntilClickable(buttonAceptarTransbankLocator, 10); automator.type(inputRutTransbankLocator, Configuration.RUT_TRANSBANK); automator.type(inputPassTransbankLocator, Configuration.CLAVE_TRANSBANK); automator.click(buttonAceptarTransbankLocator); automator.waitUntilClickable(selectOptionTransbankLocator, 10); Select selectOSelect = new Select(selectOptionTransbankLocator); selectOSelect.selectByValue("TSY"); automator.click(buttonContinuarTransbankLocator, 10); automator.waitUntilPresent(parrafoPagoLocator, 30); if (automator.isDisplayed(parrafoPagoLocator)) { return true; } else { return false; } } public boolean pagoTransaccionCrypto(WebElement elementMedio) { automator.click(elementMedio, 10); automator.click(buttonPagarFlowLocator, 10); automator.click(buttonPagarCryptoLocator, 10); automator.waitUntilPresent(parrafoPagoLocator, 10); if (automator.isDisplayed(parrafoPagoLocator)) { return true; } else { return false; } } @Override protected void load() { // TODO Auto-generated method stub } @Override protected void isLoaded() throws Error { // TODO Auto-generated method stub } }
UTF-8
Java
4,882
java
PasarelaPagosFlowPage.java
Java
[]
null
[]
package Pages; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.PageFactory; import org.openqa.selenium.support.ui.LoadableComponent; import org.openqa.selenium.support.ui.Select; import commons.Configuration; import commons.WebAutomator; public class PasarelaPagosFlowPage extends LoadableComponent<PasarelaPagosFlowPage> { WebAutomator automator; // WebElement buttonPagarFlowLocator; // WebElement parrafoPagoLocator; @FindBy(id = "pagar") private WebElement buttonPagarFlowLocator; //servipag @FindBy(css = "input[value='Pagar']") private WebElement buttonPagarServipagLocator; //multicaja @FindBy(css = "input[value='Continuar']") private WebElement buttonPagarMultiCajaLocator; @FindBy(css = "input[value='Pagar']") private WebElement buttonPagarCryptoLocator; @FindBy(id = "credito") private WebElement buttonCreditoWebpayLocator; @FindBy(id = "card-number") private WebElement inputCardNumberWebpayLocator; @FindBy(id = "card-exp") private WebElement inputCardExpWebpayLocator; @FindBy(id = "card-cvv") private WebElement inputCardCvvWebpayLocator; @FindBy(css = "button.submit") private WebElement buttonWebpayContinuarLocator; @FindBy(id = "rutClient") private WebElement inputRutTransbankLocator; @FindBy(id = "passwordClient") private WebElement inputPassTransbankLocator; @FindBy(css = "input[type='submit'][value='Aceptar']") private WebElement buttonAceptarTransbankLocator; @FindBy(id = "vci") private WebElement selectOptionTransbankLocator; @FindBy(css = "input[type='submit'][value='Continuar']") private WebElement buttonContinuarTransbankLocator; @FindBy(css = "div.col-md-6.col-md-offset-3.box-pay > h3") private WebElement parrafoPagoLocator; public PasarelaPagosFlowPage(WebAutomator automator) { this.automator = automator; PageFactory.initElements(automator.getDriver(), this); } public boolean pagoTransaccionServipag(WebElement elementMedio) { automator.click(elementMedio, 10); automator.click(buttonPagarFlowLocator, 10); automator.click(buttonPagarServipagLocator, 10); automator.waitUntilPresent(parrafoPagoLocator, 10); if (automator.isDisplayed(parrafoPagoLocator)) { return true; } else { return false; } } public boolean pagoTransaccionMultiCaja(WebElement elementMedio) { automator.click(elementMedio, 10); automator.click(buttonPagarFlowLocator, 10); automator.click(buttonPagarMultiCajaLocator, 10); automator.waitUntilPresent(parrafoPagoLocator, 10); if (automator.isDisplayed(parrafoPagoLocator)) { return true; } else { return false; } } public boolean pagoTransaccionMach(WebElement elementMedio) { automator.click(elementMedio, 10); automator.click(buttonPagarFlowLocator, 10); if (automator.isDisplayed(parrafoPagoLocator)) { return true; } else { return false; } } public boolean pagoTransaccionWebpay(WebElement elementMedio) { automator.click(elementMedio, 10); automator.click(buttonPagarFlowLocator, 10); automator.click(buttonCreditoWebpayLocator, 10); automator.waitUntilPresent(inputCardCvvWebpayLocator, 10); automator.type(inputCardNumberWebpayLocator, Configuration.CREDITCARD_NUM); automator.type(inputCardExpWebpayLocator, Configuration.CREDITCARD_EXP); automator.type(inputCardCvvWebpayLocator, Configuration.CREDITCARD_CVV); automator.waitUntilClickable(buttonWebpayContinuarLocator, 10); automator.click(buttonWebpayContinuarLocator); automator.waitUntilClickable(buttonAceptarTransbankLocator, 10); automator.type(inputRutTransbankLocator, Configuration.RUT_TRANSBANK); automator.type(inputPassTransbankLocator, Configuration.CLAVE_TRANSBANK); automator.click(buttonAceptarTransbankLocator); automator.waitUntilClickable(selectOptionTransbankLocator, 10); Select selectOSelect = new Select(selectOptionTransbankLocator); selectOSelect.selectByValue("TSY"); automator.click(buttonContinuarTransbankLocator, 10); automator.waitUntilPresent(parrafoPagoLocator, 30); if (automator.isDisplayed(parrafoPagoLocator)) { return true; } else { return false; } } public boolean pagoTransaccionCrypto(WebElement elementMedio) { automator.click(elementMedio, 10); automator.click(buttonPagarFlowLocator, 10); automator.click(buttonPagarCryptoLocator, 10); automator.waitUntilPresent(parrafoPagoLocator, 10); if (automator.isDisplayed(parrafoPagoLocator)) { return true; } else { return false; } } @Override protected void load() { // TODO Auto-generated method stub } @Override protected void isLoaded() throws Error { // TODO Auto-generated method stub } }
4,882
0.756452
0.746415
163
27.95092
23.925447
85
false
false
0
0
0
0
0
0
1.865031
false
false
1
e7ac55c88031a5f7d7e5c8717af891d671846e40
20,246,475,885,040
2f5cd5ba8a78edcddf99c7e3c9c19829f9dbd214
/java/playgrounds/.svn/pristine/e7/e7ac55c88031a5f7d7e5c8717af891d671846e40.svn-base
edc7bc40e6e42404b46419f33741eebc2ac8e3a9
[]
no_license
HTplex/Storage
https://github.com/HTplex/Storage
5ff1f23dfe8c05a0a8fe5354bb6bbc57cfcd5789
e94faac57b42d6f39c311f84bd4ccb32c52c2d30
refs/heads/master
2021-01-10T17:43:20.686000
2016-04-05T08:56:57
2016-04-05T08:56:57
55,478,274
1
1
null
false
2020-10-28T20:35:29
2016-04-05T07:43:17
2020-04-10T09:46:06
2016-04-05T09:54:51
107,783
1
1
1
Java
false
false
/* *********************************************************************** * * project: org.matsim.* * MatsimWorldReader.java * * * *********************************************************************** * * * * copyright : (C) 2007 by the members listed in the COPYING, * * LICENSE and WARRANTY file. * * email : info at matsim dot org * * * * *********************************************************************** * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * See also COPYING, LICENSE and WARRANTY file * * * * *********************************************************************** */ package playground.balmermi.world; import java.util.Stack; import org.apache.log4j.Logger; import org.matsim.core.scenario.ScenarioImpl; import org.matsim.core.utils.io.MatsimXmlParser; import org.matsim.core.utils.io.UncheckedIOException; import org.xml.sax.Attributes; /** * A reader for world-files of MATSim. This reader recognizes the format of the world-file and uses * the correct reader for the specific version, without manual setting. * * @author mrieser */ public class MatsimWorldReader extends MatsimXmlParser { private final static Logger log = Logger.getLogger(MatsimWorldReader.class); private final static String WORLD_V0 = "world_v0.dtd"; private final static String WORLD_V1 = "world_v1.dtd"; private final static String WORLD_V2 = "world_v2.dtd"; private final ScenarioImpl scenario; private MatsimXmlParser delegate = null; private World world; /** * Creates a new reader for MATSim world files. * * @param scenario The Scenario-object to store the world in. */ public MatsimWorldReader(final ScenarioImpl scenario, final World world) { this.scenario = scenario; this.world = world; } @Override public void startTag(final String name, final Attributes atts, final Stack<String> context) { this.delegate.startTag(name, atts, context); } @Override public void endTag(final String name, final String content, final Stack<String> context) { this.delegate.endTag(name, content, context); } /** * Parses the specified matrices file. This method calls {@link #parse(String)}. * * @param filename The name of the file to parse. */ public void readFile(final String filename) throws UncheckedIOException { parse(filename); } @Override protected void setDoctype(final String doctype) { super.setDoctype(doctype); if (WORLD_V2.equals(doctype)) { this.delegate = new WorldReaderMatsimV2(this.scenario, world); log.info("using world_v2-reader."); } else if (WORLD_V0.equals(doctype)) { throw new IllegalArgumentException("world_v0.dtd is no longer supported.."); } else if (WORLD_V1.equals(doctype)) { throw new IllegalArgumentException("world_v1.dtd is no longer supported.."); } else { throw new IllegalArgumentException("Doctype \"" + doctype + "\" not known."); } } }
UTF-8
Java
3,635
e7ac55c88031a5f7d7e5c8717af891d671846e40.svn-base
Java
[ { "context": "fic version, without manual setting.\n *\n * @author mrieser\n */\npublic class MatsimWorldReader extends Matsim", "end": 1833, "score": 0.9973182678222656, "start": 1826, "tag": "USERNAME", "value": "mrieser" } ]
null
[]
/* *********************************************************************** * * project: org.matsim.* * MatsimWorldReader.java * * * *********************************************************************** * * * * copyright : (C) 2007 by the members listed in the COPYING, * * LICENSE and WARRANTY file. * * email : info at matsim dot org * * * * *********************************************************************** * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * See also COPYING, LICENSE and WARRANTY file * * * * *********************************************************************** */ package playground.balmermi.world; import java.util.Stack; import org.apache.log4j.Logger; import org.matsim.core.scenario.ScenarioImpl; import org.matsim.core.utils.io.MatsimXmlParser; import org.matsim.core.utils.io.UncheckedIOException; import org.xml.sax.Attributes; /** * A reader for world-files of MATSim. This reader recognizes the format of the world-file and uses * the correct reader for the specific version, without manual setting. * * @author mrieser */ public class MatsimWorldReader extends MatsimXmlParser { private final static Logger log = Logger.getLogger(MatsimWorldReader.class); private final static String WORLD_V0 = "world_v0.dtd"; private final static String WORLD_V1 = "world_v1.dtd"; private final static String WORLD_V2 = "world_v2.dtd"; private final ScenarioImpl scenario; private MatsimXmlParser delegate = null; private World world; /** * Creates a new reader for MATSim world files. * * @param scenario The Scenario-object to store the world in. */ public MatsimWorldReader(final ScenarioImpl scenario, final World world) { this.scenario = scenario; this.world = world; } @Override public void startTag(final String name, final Attributes atts, final Stack<String> context) { this.delegate.startTag(name, atts, context); } @Override public void endTag(final String name, final String content, final Stack<String> context) { this.delegate.endTag(name, content, context); } /** * Parses the specified matrices file. This method calls {@link #parse(String)}. * * @param filename The name of the file to parse. */ public void readFile(final String filename) throws UncheckedIOException { parse(filename); } @Override protected void setDoctype(final String doctype) { super.setDoctype(doctype); if (WORLD_V2.equals(doctype)) { this.delegate = new WorldReaderMatsimV2(this.scenario, world); log.info("using world_v2-reader."); } else if (WORLD_V0.equals(doctype)) { throw new IllegalArgumentException("world_v0.dtd is no longer supported.."); } else if (WORLD_V1.equals(doctype)) { throw new IllegalArgumentException("world_v1.dtd is no longer supported.."); } else { throw new IllegalArgumentException("Doctype \"" + doctype + "\" not known."); } } }
3,635
0.559835
0.554608
94
37.670212
31.880892
99
false
false
0
0
0
0
0
0
1.148936
false
false
1
d3de26b1d70134fbe9fc48c5a51f36fe929bd511
36,163,624,665,333
2cd64269df4137e0a39e8e67063ff3bd44d72f1b
/commercetools/commercetools-sdk-java-api/src/main/java-generated/com/commercetools/api/models/standalone_price/StandalonePriceApplyStagedChangesAction.java
830172236ac4159b608aef9e57bafd8bc524a9c9
[ "Apache-2.0", "GPL-2.0-only", "EPL-2.0", "CDDL-1.0", "MIT", "BSD-3-Clause", "Classpath-exception-2.0" ]
permissive
commercetools/commercetools-sdk-java-v2
https://github.com/commercetools/commercetools-sdk-java-v2
a8703f5f8c5dde6cc3ebe4619c892cccfcf71cb8
76d5065566ff37d365c28829b8137cbc48f14df1
refs/heads/main
2023-08-14T16:16:38.709000
2023-08-14T11:58:19
2023-08-14T11:58:19
206,558,937
29
13
Apache-2.0
false
2023-09-14T12:30:00
2019-09-05T12:30:27
2023-08-25T13:41:43
2023-09-14T12:29:59
549,563
27
13
16
Java
false
false
package com.commercetools.api.models.standalone_price; import java.time.*; import java.util.*; import java.util.function.Function; import javax.annotation.Nullable; import com.fasterxml.jackson.annotation.*; import com.fasterxml.jackson.databind.annotation.*; import io.vrap.rmf.base.client.utils.Generated; /** * <p>Applies all staged changes to the StandalonePrice by overwriting all current values with the values in the StagedStandalonePrice. After successfully applied, the StagedStandalonePrice will be removed from the StandalonePrice. An <code>applyStagedChanges</code> update action on a StandalonePrice that does not contain any staged changes will return a <code>400 Bad Request</code> error. Applying staged changes successfully will produce the StandalonePriceStagedChangesApplied Message.</p> * * <hr> * Example to create an instance using the builder pattern * <div class=code-example> * <pre><code class='java'> * StandalonePriceApplyStagedChangesAction standalonePriceApplyStagedChangesAction = StandalonePriceApplyStagedChangesAction.builder() * .build() * </code></pre> * </div> */ @Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") @JsonDeserialize(as = StandalonePriceApplyStagedChangesActionImpl.class) public interface StandalonePriceApplyStagedChangesAction extends StandalonePriceUpdateAction { /** * discriminator value for StandalonePriceApplyStagedChangesAction */ String APPLY_STAGED_CHANGES = "applyStagedChanges"; /** * factory method * @return instance of StandalonePriceApplyStagedChangesAction */ public static StandalonePriceApplyStagedChangesAction of() { return new StandalonePriceApplyStagedChangesActionImpl(); } /** * factory method to create a shallow copy StandalonePriceApplyStagedChangesAction * @param template instance to be copied * @return copy instance */ public static StandalonePriceApplyStagedChangesAction of(final StandalonePriceApplyStagedChangesAction template) { StandalonePriceApplyStagedChangesActionImpl instance = new StandalonePriceApplyStagedChangesActionImpl(); return instance; } /** * factory method to create a deep copy of StandalonePriceApplyStagedChangesAction * @param template instance to be copied * @return copy instance */ @Nullable public static StandalonePriceApplyStagedChangesAction deepCopy( @Nullable final StandalonePriceApplyStagedChangesAction template) { if (template == null) { return null; } StandalonePriceApplyStagedChangesActionImpl instance = new StandalonePriceApplyStagedChangesActionImpl(); return instance; } /** * builder factory method for StandalonePriceApplyStagedChangesAction * @return builder */ public static StandalonePriceApplyStagedChangesActionBuilder builder() { return StandalonePriceApplyStagedChangesActionBuilder.of(); } /** * create builder for StandalonePriceApplyStagedChangesAction instance * @param template instance with prefilled values for the builder * @return builder */ public static StandalonePriceApplyStagedChangesActionBuilder builder( final StandalonePriceApplyStagedChangesAction template) { return StandalonePriceApplyStagedChangesActionBuilder.of(template); } /** * accessor map function * @param <T> mapped type * @param helper function to map the object * @return mapped value */ default <T> T withStandalonePriceApplyStagedChangesAction( Function<StandalonePriceApplyStagedChangesAction, T> helper) { return helper.apply(this); } /** * gives a TypeReference for usage with Jackson DataBind * @return TypeReference */ public static com.fasterxml.jackson.core.type.TypeReference<StandalonePriceApplyStagedChangesAction> typeReference() { return new com.fasterxml.jackson.core.type.TypeReference<StandalonePriceApplyStagedChangesAction>() { @Override public String toString() { return "TypeReference<StandalonePriceApplyStagedChangesAction>"; } }; } }
UTF-8
Java
4,335
java
StandalonePriceApplyStagedChangesAction.java
Java
[]
null
[]
package com.commercetools.api.models.standalone_price; import java.time.*; import java.util.*; import java.util.function.Function; import javax.annotation.Nullable; import com.fasterxml.jackson.annotation.*; import com.fasterxml.jackson.databind.annotation.*; import io.vrap.rmf.base.client.utils.Generated; /** * <p>Applies all staged changes to the StandalonePrice by overwriting all current values with the values in the StagedStandalonePrice. After successfully applied, the StagedStandalonePrice will be removed from the StandalonePrice. An <code>applyStagedChanges</code> update action on a StandalonePrice that does not contain any staged changes will return a <code>400 Bad Request</code> error. Applying staged changes successfully will produce the StandalonePriceStagedChangesApplied Message.</p> * * <hr> * Example to create an instance using the builder pattern * <div class=code-example> * <pre><code class='java'> * StandalonePriceApplyStagedChangesAction standalonePriceApplyStagedChangesAction = StandalonePriceApplyStagedChangesAction.builder() * .build() * </code></pre> * </div> */ @Generated(value = "io.vrap.rmf.codegen.rendering.CoreCodeGenerator", comments = "https://github.com/commercetools/rmf-codegen") @JsonDeserialize(as = StandalonePriceApplyStagedChangesActionImpl.class) public interface StandalonePriceApplyStagedChangesAction extends StandalonePriceUpdateAction { /** * discriminator value for StandalonePriceApplyStagedChangesAction */ String APPLY_STAGED_CHANGES = "applyStagedChanges"; /** * factory method * @return instance of StandalonePriceApplyStagedChangesAction */ public static StandalonePriceApplyStagedChangesAction of() { return new StandalonePriceApplyStagedChangesActionImpl(); } /** * factory method to create a shallow copy StandalonePriceApplyStagedChangesAction * @param template instance to be copied * @return copy instance */ public static StandalonePriceApplyStagedChangesAction of(final StandalonePriceApplyStagedChangesAction template) { StandalonePriceApplyStagedChangesActionImpl instance = new StandalonePriceApplyStagedChangesActionImpl(); return instance; } /** * factory method to create a deep copy of StandalonePriceApplyStagedChangesAction * @param template instance to be copied * @return copy instance */ @Nullable public static StandalonePriceApplyStagedChangesAction deepCopy( @Nullable final StandalonePriceApplyStagedChangesAction template) { if (template == null) { return null; } StandalonePriceApplyStagedChangesActionImpl instance = new StandalonePriceApplyStagedChangesActionImpl(); return instance; } /** * builder factory method for StandalonePriceApplyStagedChangesAction * @return builder */ public static StandalonePriceApplyStagedChangesActionBuilder builder() { return StandalonePriceApplyStagedChangesActionBuilder.of(); } /** * create builder for StandalonePriceApplyStagedChangesAction instance * @param template instance with prefilled values for the builder * @return builder */ public static StandalonePriceApplyStagedChangesActionBuilder builder( final StandalonePriceApplyStagedChangesAction template) { return StandalonePriceApplyStagedChangesActionBuilder.of(template); } /** * accessor map function * @param <T> mapped type * @param helper function to map the object * @return mapped value */ default <T> T withStandalonePriceApplyStagedChangesAction( Function<StandalonePriceApplyStagedChangesAction, T> helper) { return helper.apply(this); } /** * gives a TypeReference for usage with Jackson DataBind * @return TypeReference */ public static com.fasterxml.jackson.core.type.TypeReference<StandalonePriceApplyStagedChangesAction> typeReference() { return new com.fasterxml.jackson.core.type.TypeReference<StandalonePriceApplyStagedChangesAction>() { @Override public String toString() { return "TypeReference<StandalonePriceApplyStagedChangesAction>"; } }; } }
4,335
0.736563
0.735871
109
38.761467
56.063839
496
false
false
0
0
0
0
0
0
0.211009
false
false
1
94e8f12f7a2eb1c22727537048fef54ad3974016
37,881,611,564,032
05ecb324d698fce8690355fb163632f5cc831940
/LambdasAndFrills/src/main/java/com/sumit/lambda/frill/samples/stream/operations/StreamOperations.java
ea25ac3d1709c74264c77583ca811b050f97b486
[]
no_license
techiesumit/CollabrativeEffort
https://github.com/techiesumit/CollabrativeEffort
56c360fe1f1d8b3ee53b7d950f79f7b10f95342e
0ce76e96c7e116df2b2abd92f160eb7a8f514c96
refs/heads/master
2022-11-12T03:58:23.288000
2020-07-05T19:24:10
2020-07-05T19:24:10
265,109,326
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.sumit.lambda.frill.samples.stream.operations; import com.sumit.lambda.frill.samples.model.Employee; import com.sumit.lambda.frill.samples.predicate.PredicateCollections; import java.util.List; import java.util.stream.Collectors; public class StreamOperations { public void printDistinctEmployeeName(List<Employee> employees){ // How to pass the dynamic parameter for search As ther are String , double and Interger?? Is there a Generic premetive type List<Employee> list = employees.stream() .filter(PredicateCollections.distinctByKey(Employee::getFirstName)) .collect(Collectors.toList()); System.out.println("\n Distinct Employee by name \n"); list.stream().forEach(System.out::println); //Although this is an example from Web and works but need to know the logic behind that. } }
UTF-8
Java
883
java
StreamOperations.java
Java
[]
null
[]
package com.sumit.lambda.frill.samples.stream.operations; import com.sumit.lambda.frill.samples.model.Employee; import com.sumit.lambda.frill.samples.predicate.PredicateCollections; import java.util.List; import java.util.stream.Collectors; public class StreamOperations { public void printDistinctEmployeeName(List<Employee> employees){ // How to pass the dynamic parameter for search As ther are String , double and Interger?? Is there a Generic premetive type List<Employee> list = employees.stream() .filter(PredicateCollections.distinctByKey(Employee::getFirstName)) .collect(Collectors.toList()); System.out.println("\n Distinct Employee by name \n"); list.stream().forEach(System.out::println); //Although this is an example from Web and works but need to know the logic behind that. } }
883
0.722537
0.722537
20
43.049999
35.956188
133
false
false
0
0
0
0
0
0
0.45
false
false
1
38fb5a73ed458a0c0a0e18f9fadffbd74e6d3deb
38,482,906,978,554
b5951b9af4b542224309a4d9e898453ed215f8a5
/d_pro/src/main/java/com/mycom/notice/NoticeService.java
d9e610b0013c16f0b24c17b6473ff2e25b567b1a
[]
no_license
pullsoyu/test
https://github.com/pullsoyu/test
96825889ae44fe35d5dae0a435b6dcee77e7fe7a
aa867bd0d77db3e9110802be931a7b9d8d90eb44
refs/heads/master
2023-02-21T21:22:00.453000
2021-01-27T06:03:05
2021-01-27T06:03:05
333,286,764
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.mycom.notice; import java.util.List; import javax.annotation.Resource; import org.mybatis.spring.SqlSessionTemplate; import org.springframework.stereotype.Service; import com.mycom.notice.NoticeDAO; import com.mycom.notice.NoticeModel; @Service public class NoticeService implements NoticeDAO{ @Resource private SqlSessionTemplate sqlSessionTemplate; //글목록 @Override public List<NoticeModel> noticeList() { return sqlSessionTemplate.selectList("notice.noticeList"); } //글쓰기 @Override public int noticeWrite(NoticeModel noticeModel) { return sqlSessionTemplate.insert("notice.noticeWrite", noticeModel); } //글 하나 불러오기 @Override public NoticeModel noticeView(int no) { return sqlSessionTemplate.selectOne("notice.noticeView",no); } //조회수 증가 @Override public int noticeUpdateReadcount(int no) { return sqlSessionTemplate.update("notice.noticeUpdateReadcount",no); } //제목으로 검색 @Override public List<NoticeModel> noticeSearch0(String search) { return sqlSessionTemplate.selectList("notice.noticeSearch0", "%"+search+"%"); } //내용으로 검색 @Override public List<NoticeModel> noticeSearch1(String search) { return sqlSessionTemplate.selectList("notice.noticeSearch1", "%"+search+"%"); } //작성자로 검색 @Override public List<NoticeModel> noticeSearch2(String search) { return sqlSessionTemplate.selectList("notice.noticeSearch2", "%"+search+"%"); } //글수정 @Override public int noticeModify(NoticeModel noticeModel) { return sqlSessionTemplate.update("notice.noticeModify",noticeModel); } //글삭제 @Override public int noticeDelete(int no) { return sqlSessionTemplate.update("notice.noticeDelete",no); } }
UHC
Java
1,832
java
NoticeService.java
Java
[]
null
[]
package com.mycom.notice; import java.util.List; import javax.annotation.Resource; import org.mybatis.spring.SqlSessionTemplate; import org.springframework.stereotype.Service; import com.mycom.notice.NoticeDAO; import com.mycom.notice.NoticeModel; @Service public class NoticeService implements NoticeDAO{ @Resource private SqlSessionTemplate sqlSessionTemplate; //글목록 @Override public List<NoticeModel> noticeList() { return sqlSessionTemplate.selectList("notice.noticeList"); } //글쓰기 @Override public int noticeWrite(NoticeModel noticeModel) { return sqlSessionTemplate.insert("notice.noticeWrite", noticeModel); } //글 하나 불러오기 @Override public NoticeModel noticeView(int no) { return sqlSessionTemplate.selectOne("notice.noticeView",no); } //조회수 증가 @Override public int noticeUpdateReadcount(int no) { return sqlSessionTemplate.update("notice.noticeUpdateReadcount",no); } //제목으로 검색 @Override public List<NoticeModel> noticeSearch0(String search) { return sqlSessionTemplate.selectList("notice.noticeSearch0", "%"+search+"%"); } //내용으로 검색 @Override public List<NoticeModel> noticeSearch1(String search) { return sqlSessionTemplate.selectList("notice.noticeSearch1", "%"+search+"%"); } //작성자로 검색 @Override public List<NoticeModel> noticeSearch2(String search) { return sqlSessionTemplate.selectList("notice.noticeSearch2", "%"+search+"%"); } //글수정 @Override public int noticeModify(NoticeModel noticeModel) { return sqlSessionTemplate.update("notice.noticeModify",noticeModel); } //글삭제 @Override public int noticeDelete(int no) { return sqlSessionTemplate.update("notice.noticeDelete",no); } }
1,832
0.729405
0.725973
71
22.647888
25.201218
80
false
false
0
0
0
0
0
0
1.225352
false
false
1
43529185059024565178f5a82e63b8f565ba1b12
35,407,710,423,635
133c6de985adfaa510c95ab03a3528ab53443e27
/app/src/main/java/com/example/hp/moviesnearyou/ReviewsActivity.java
9c0f8aad4d48d3e77ff70ce61f9a67ff2f2bf49c
[]
no_license
Sriram-S/Android-App--Trending-Movies
https://github.com/Sriram-S/Android-App--Trending-Movies
7c0914f462fcab728c4fff6b573f3fcc9a48922b
173e72856890c2026c4c7a2aec062d69d318948b
refs/heads/master
2021-01-01T17:33:56.805000
2017-07-23T12:47:45
2017-07-23T12:47:45
98,097,351
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.hp.moviesnearyou; import android.content.Intent; import android.os.AsyncTask; import android.provider.Settings; import android.support.design.widget.CoordinatorLayout; import android.support.design.widget.Snackbar; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.MenuItem; import android.view.View; import android.widget.ProgressBar; import android.widget.TextView; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import org.w3c.dom.Text; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; import java.nio.charset.Charset; import java.util.ArrayList; public class ReviewsActivity extends AppCompatActivity { private ProgressBar progressBar; private RecyclerView recyclerView; private ReviewAdapter arrayAdapter; private CoordinatorLayout coordinatorLayout; private TextView noreview; private int idvalue; private static final int READTIMEOUT = 10000; private static final int CONNECTIONTIMEOUT = 15000; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setTitle(getResources().getString(R.string.reviewtitle)); setContentView(R.layout.activity_reviews); Intent intent = getIntent(); ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); idvalue = intent.getIntExtra(getResources().getString(R.string.iddetail), 0); progressBar = (ProgressBar) findViewById(R.id.load); coordinatorLayout = (CoordinatorLayout) findViewById(R.id.parent); recyclerView = (RecyclerView) findViewById(R.id.recyclerview); noreview = (TextView) findViewById(R.id.noreview); RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this); recyclerView.setLayoutManager(layoutManager); NetworkConnection_Test networkConnectionTest = new NetworkConnection_Test(this); boolean check = networkConnectionTest.isNetworkAvailable(); if (check) { ReviewAsync reviewAsync = new ReviewAsync(); reviewAsync.execute(); } else { Snackbar.make(coordinatorLayout, getResources().getString(R.string.Network_Error), Snackbar.LENGTH_LONG).setAction(getResources().getString(R.string.NetworkAction), new View.OnClickListener() { @Override public void onClick(View view) { startActivity(new Intent(Settings.ACTION_SETTINGS)); } }).show(); if (progressBar.getVisibility() == View.VISIBLE) { progressBar.setVisibility(View.INVISIBLE); } } } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: super.onBackPressed(); return true; } return super.onOptionsItemSelected(item); } private class ReviewAsync extends AsyncTask<Void, Void, ReviewAttributes> implements MovieAdapter.ListIemListener { private ArrayList<ReviewAttributes> reviewattr = new ArrayList<>(); ReviewAsync() { } @Override protected void onPreExecute() { super.onPreExecute(); progressBar.setVisibility(View.VISIBLE); } @Override protected ReviewAttributes doInBackground(Void... voids) { ReviewAttributes current = null; StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(getResources().getString(R.string.URL_GETKEY)); stringBuilder.append(idvalue); stringBuilder.append(getResources().getString(R.string.reviewscall)); stringBuilder.append(getResources().getString(R.string.API_KEY)); String url = stringBuilder.toString(); try { URL finalurl = new URL(url); String json = ""; HttpURLConnection urlConnection = null; InputStream inputStream = null; try { StringBuilder out = new StringBuilder(); urlConnection = (HttpURLConnection) finalurl.openConnection(); urlConnection.setRequestMethod(getResources().getString(R.string.reqmethod)); urlConnection.setReadTimeout(READTIMEOUT); urlConnection.setConnectTimeout(CONNECTIONTIMEOUT); urlConnection.connect(); inputStream = urlConnection.getInputStream(); if (inputStream != null) { InputStreamReader inputStreamReader = new InputStreamReader(inputStream, Charset.forName("UTF-8")); BufferedReader reader = new BufferedReader(inputStreamReader); String line = reader.readLine(); while (line != null) { out.append(line); line = reader.readLine(); } } json = out.toString(); JSONObject jsonObject = new JSONObject(json); JSONArray jsonArray = jsonObject.getJSONArray(getResources().getString(R.string.jsonresults)); if (jsonArray.length() == 0) { runOnUiThread(new Runnable() { @Override public void run() { noreview.setVisibility(View.VISIBLE); progressBar.setVisibility(View.INVISIBLE); recyclerView.setVisibility(View.INVISIBLE); return; } }); } for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject1 = jsonArray.getJSONObject(i); String author = jsonObject1.getString(getResources().getString(R.string.jsonauthorreview)); String content = jsonObject1.getString(getResources().getString(R.string.jsoncontentreview)); current = new ReviewAttributes(author, content); reviewattr.add(current); } } catch (IOException e) { } catch (JSONException e) { e.printStackTrace(); } finally { if (urlConnection != null) { urlConnection.disconnect(); } if (inputStream != null) { inputStream.close(); } } } catch (IOException e) { e.printStackTrace(); } return current; } protected void onPostExecute(ReviewAttributes review) { progressBar.setVisibility(View.INVISIBLE); if (reviewattr == null) { return; } else { arrayAdapter = new ReviewAdapter(getBaseContext(), reviewattr); recyclerView.setAdapter(arrayAdapter); arrayAdapter.notifyDataSetChanged(); } } @Override public void onListItem(int position) { } } }
UTF-8
Java
7,822
java
ReviewsActivity.java
Java
[]
null
[]
package com.example.hp.moviesnearyou; import android.content.Intent; import android.os.AsyncTask; import android.provider.Settings; import android.support.design.widget.CoordinatorLayout; import android.support.design.widget.Snackbar; import android.support.v7.app.ActionBar; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.MenuItem; import android.view.View; import android.widget.ProgressBar; import android.widget.TextView; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import org.w3c.dom.Text; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; import java.nio.charset.Charset; import java.util.ArrayList; public class ReviewsActivity extends AppCompatActivity { private ProgressBar progressBar; private RecyclerView recyclerView; private ReviewAdapter arrayAdapter; private CoordinatorLayout coordinatorLayout; private TextView noreview; private int idvalue; private static final int READTIMEOUT = 10000; private static final int CONNECTIONTIMEOUT = 15000; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setTitle(getResources().getString(R.string.reviewtitle)); setContentView(R.layout.activity_reviews); Intent intent = getIntent(); ActionBar actionBar = getSupportActionBar(); actionBar.setDisplayHomeAsUpEnabled(true); idvalue = intent.getIntExtra(getResources().getString(R.string.iddetail), 0); progressBar = (ProgressBar) findViewById(R.id.load); coordinatorLayout = (CoordinatorLayout) findViewById(R.id.parent); recyclerView = (RecyclerView) findViewById(R.id.recyclerview); noreview = (TextView) findViewById(R.id.noreview); RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this); recyclerView.setLayoutManager(layoutManager); NetworkConnection_Test networkConnectionTest = new NetworkConnection_Test(this); boolean check = networkConnectionTest.isNetworkAvailable(); if (check) { ReviewAsync reviewAsync = new ReviewAsync(); reviewAsync.execute(); } else { Snackbar.make(coordinatorLayout, getResources().getString(R.string.Network_Error), Snackbar.LENGTH_LONG).setAction(getResources().getString(R.string.NetworkAction), new View.OnClickListener() { @Override public void onClick(View view) { startActivity(new Intent(Settings.ACTION_SETTINGS)); } }).show(); if (progressBar.getVisibility() == View.VISIBLE) { progressBar.setVisibility(View.INVISIBLE); } } } @Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: super.onBackPressed(); return true; } return super.onOptionsItemSelected(item); } private class ReviewAsync extends AsyncTask<Void, Void, ReviewAttributes> implements MovieAdapter.ListIemListener { private ArrayList<ReviewAttributes> reviewattr = new ArrayList<>(); ReviewAsync() { } @Override protected void onPreExecute() { super.onPreExecute(); progressBar.setVisibility(View.VISIBLE); } @Override protected ReviewAttributes doInBackground(Void... voids) { ReviewAttributes current = null; StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(getResources().getString(R.string.URL_GETKEY)); stringBuilder.append(idvalue); stringBuilder.append(getResources().getString(R.string.reviewscall)); stringBuilder.append(getResources().getString(R.string.API_KEY)); String url = stringBuilder.toString(); try { URL finalurl = new URL(url); String json = ""; HttpURLConnection urlConnection = null; InputStream inputStream = null; try { StringBuilder out = new StringBuilder(); urlConnection = (HttpURLConnection) finalurl.openConnection(); urlConnection.setRequestMethod(getResources().getString(R.string.reqmethod)); urlConnection.setReadTimeout(READTIMEOUT); urlConnection.setConnectTimeout(CONNECTIONTIMEOUT); urlConnection.connect(); inputStream = urlConnection.getInputStream(); if (inputStream != null) { InputStreamReader inputStreamReader = new InputStreamReader(inputStream, Charset.forName("UTF-8")); BufferedReader reader = new BufferedReader(inputStreamReader); String line = reader.readLine(); while (line != null) { out.append(line); line = reader.readLine(); } } json = out.toString(); JSONObject jsonObject = new JSONObject(json); JSONArray jsonArray = jsonObject.getJSONArray(getResources().getString(R.string.jsonresults)); if (jsonArray.length() == 0) { runOnUiThread(new Runnable() { @Override public void run() { noreview.setVisibility(View.VISIBLE); progressBar.setVisibility(View.INVISIBLE); recyclerView.setVisibility(View.INVISIBLE); return; } }); } for (int i = 0; i < jsonArray.length(); i++) { JSONObject jsonObject1 = jsonArray.getJSONObject(i); String author = jsonObject1.getString(getResources().getString(R.string.jsonauthorreview)); String content = jsonObject1.getString(getResources().getString(R.string.jsoncontentreview)); current = new ReviewAttributes(author, content); reviewattr.add(current); } } catch (IOException e) { } catch (JSONException e) { e.printStackTrace(); } finally { if (urlConnection != null) { urlConnection.disconnect(); } if (inputStream != null) { inputStream.close(); } } } catch (IOException e) { e.printStackTrace(); } return current; } protected void onPostExecute(ReviewAttributes review) { progressBar.setVisibility(View.INVISIBLE); if (reviewattr == null) { return; } else { arrayAdapter = new ReviewAdapter(getBaseContext(), reviewattr); recyclerView.setAdapter(arrayAdapter); arrayAdapter.notifyDataSetChanged(); } } @Override public void onListItem(int position) { } } }
7,822
0.5955
0.592559
187
40.81818
28.659332
205
false
false
0
0
0
0
0
0
0.641711
false
false
1
f38bb76b9858df776e46ca9e913917da11256a40
24,146,306,174,494
d872f30aa795f74806316c7c2136461dfcff5189
/Programmers_JAVA/src/level2/ex카펫/Solution.java
496f12334e76d12a50f75a9072357007a4589fbd
[]
no_license
Sword-Is-Cat/Programmers_JAVA
https://github.com/Sword-Is-Cat/Programmers_JAVA
e803196349a5afc6e352b066d0433afd9c705a65
dfd5bee8aa1663995af8c3874f8ec380904cd12b
refs/heads/master
2023-09-04T10:55:28.391000
2023-09-02T07:40:35
2023-09-02T07:40:35
253,808,035
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package level2.ex카펫; /** * https://programmers.co.kr/learn/courses/30/lessons/42842 */ class Solution { public int[] solution(int brown, int yellow) { for (int y_height = 1; y_height < brown /4; y_height++) { int y_width = brown / 2 - 2 - y_height; if (y_height * y_width == yellow) { return new int[]{ yellow / y_height + 2, y_height + 2 }; } } return null; } }
UTF-8
Java
407
java
Solution.java
Java
[]
null
[]
package level2.ex카펫; /** * https://programmers.co.kr/learn/courses/30/lessons/42842 */ class Solution { public int[] solution(int brown, int yellow) { for (int y_height = 1; y_height < brown /4; y_height++) { int y_width = brown / 2 - 2 - y_height; if (y_height * y_width == yellow) { return new int[]{ yellow / y_height + 2, y_height + 2 }; } } return null; } }
407
0.575682
0.540943
17
21.82353
22.729187
60
false
false
0
0
0
0
0
0
1.705882
false
false
7
32b2f7d84db44a9ea701b77212247f7b56270763
32,186,484,954,802
4d134ede9b413f233756de6b2c8c520ab1cb13be
/app/src/main/java/com/example/cityparcel/MainActivity.java
1ab33b4688e6862161174feef8ee31c0da6878fa
[]
no_license
ror3665/CityParcelProject
https://github.com/ror3665/CityParcelProject
d394ea2497a378a8eba9381f989c3115dd21993d
8ecfbf250949faaff123d01bdeb4f59807edfbe4
refs/heads/master
2022-11-09T17:27:00.928000
2020-06-25T13:05:59
2020-06-25T13:05:59
268,427,662
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.cityparcel; // import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import com.example.cityparcel.login.LoginWindowActivity; import com.example.cityparcel.memberRegister.RegisterTermsActivity; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final Button registerButton = (Button)findViewById(R.id.button_register); final Button loginButton = (Button)findViewById(R.id.button_login); registerButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent registerIntent = new Intent(MainActivity.this, RegisterTermsActivity.class); MainActivity.this.startActivity(registerIntent); } }); loginButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent loginIntent = new Intent(MainActivity.this, LoginWindowActivity.class); MainActivity.this.startActivity(loginIntent); } }); } }
UTF-8
Java
1,353
java
MainActivity.java
Java
[]
null
[]
package com.example.cityparcel; // import androidx.appcompat.app.AppCompatActivity; import android.content.Intent; import android.os.Bundle; import android.view.View; import android.widget.Button; import com.example.cityparcel.login.LoginWindowActivity; import com.example.cityparcel.memberRegister.RegisterTermsActivity; public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final Button registerButton = (Button)findViewById(R.id.button_register); final Button loginButton = (Button)findViewById(R.id.button_login); registerButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent registerIntent = new Intent(MainActivity.this, RegisterTermsActivity.class); MainActivity.this.startActivity(registerIntent); } }); loginButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent loginIntent = new Intent(MainActivity.this, LoginWindowActivity.class); MainActivity.this.startActivity(loginIntent); } }); } }
1,353
0.692535
0.692535
40
32.849998
29.056454
99
false
false
0
0
0
0
0
0
0.5
false
false
7
570cf1a183f3e1eef4d87dbaccc2bb7847d25e98
32,315,333,976,369
74d6a2e3f793e746185e3efde399a7336b40e0c0
/src/main/resources/MyProjectFramework/src/main/java/core/async_http/MyRequestParams.java
758721a93f4686f74bbbc5cdb9e6f865b5743e4e
[ "MIT" ]
permissive
dusunboy/MyAndroidMVPTemplates
https://github.com/dusunboy/MyAndroidMVPTemplates
c76d9490a44b9bf7660ea850117e14744f458d08
059d2077e6105a8ab0e3899e6ca5fc261b81bcba
refs/heads/master
2021-01-11T10:05:22.547000
2019-05-14T16:52:04
2019-05-14T16:52:04
78,094,173
2
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package $Package.core.async_http; import com.loopj.android.http.RequestParams; /** * AsyncHttp请求参数集合 * Created by Vincent on 2019-05-10 11:33:28. */ public class MyRequestParams extends RequestParams { public static final String GET = "get"; private String json; private String downloadSavePath; private String downLoadMethod; /** * 参数与实体json传递 * @param json */ public void putJsonParams(String json) { this.json = json; } public String getJsonParams() { return json; } /** * 设置下载保存路径 * @param downloadSavePath */ public void setDownloadSavePath(String downloadSavePath){ this.downloadSavePath = downloadSavePath; } public String getDownloadSavePath() { return downloadSavePath; } /** * 添加Header标识头 * @param key * @param value */ public void addHeader(String key, String value) { AsyncHttpReq.addHeader(key, value); } /** * 清除所有标识头 */ public void removeAllHeaders() { AsyncHttpReq.removeAllHeaders(); } /** * 清除指定标识头 * @param key */ public void removeHeader(String key) { AsyncHttpReq.removeHeader(key); } /** * 获取下载请求方式 * @return */ public String getDownLoadMethod() { return downLoadMethod; } /** * 设置下载请求方式 * @param downLoadMethod */ public void setDownLoadMethod(String downLoadMethod) { this.downLoadMethod = downLoadMethod; } }
UTF-8
Java
1,654
java
MyRequestParams.java
Java
[ { "context": "questParams;\n\n/**\n * AsyncHttp请求参数集合\n * Created by Vincent on 2019-05-10 11:33:28.\n */\npublic class MyReques", "end": 125, "score": 0.9927783012390137, "start": 118, "tag": "NAME", "value": "Vincent" } ]
null
[]
package $Package.core.async_http; import com.loopj.android.http.RequestParams; /** * AsyncHttp请求参数集合 * Created by Vincent on 2019-05-10 11:33:28. */ public class MyRequestParams extends RequestParams { public static final String GET = "get"; private String json; private String downloadSavePath; private String downLoadMethod; /** * 参数与实体json传递 * @param json */ public void putJsonParams(String json) { this.json = json; } public String getJsonParams() { return json; } /** * 设置下载保存路径 * @param downloadSavePath */ public void setDownloadSavePath(String downloadSavePath){ this.downloadSavePath = downloadSavePath; } public String getDownloadSavePath() { return downloadSavePath; } /** * 添加Header标识头 * @param key * @param value */ public void addHeader(String key, String value) { AsyncHttpReq.addHeader(key, value); } /** * 清除所有标识头 */ public void removeAllHeaders() { AsyncHttpReq.removeAllHeaders(); } /** * 清除指定标识头 * @param key */ public void removeHeader(String key) { AsyncHttpReq.removeHeader(key); } /** * 获取下载请求方式 * @return */ public String getDownLoadMethod() { return downLoadMethod; } /** * 设置下载请求方式 * @param downLoadMethod */ public void setDownLoadMethod(String downLoadMethod) { this.downLoadMethod = downLoadMethod; } }
1,654
0.602464
0.593385
78
18.76923
17.183716
61
false
false
0
0
0
0
0
0
0.217949
false
false
7
fdbc6b94a9fd09b3aecb90d95dd8f73b01bdfd3c
35,373,350,676,815
f4a79951604f98c0492e5fd606cc407bb7c4a180
/app/src/main/java/com/example/melanis/creacionrubrica/Evaluacion.java
575424f071d7ce6bb11271743fec106c46a7cb47
[]
no_license
mfalcop/CrearCurso
https://github.com/mfalcop/CrearCurso
963786701cbea50e02fcbafc275b2adb2cb4de57
1c3862ceaa6686b98706b15371357f3c065d59bf
refs/heads/master
2021-01-19T16:48:33.774000
2017-04-17T12:59:46
2017-04-17T12:59:46
88,288,454
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.melanis.creacionrubrica; import com.example.melanis.creacionrubrica.Calificaciones.CalCategoria; import com.orm.SugarRecord; import java.util.ArrayList; import java.util.List; /** * Created by Melanis on 13/04/2017. */ public class Evaluacion extends SugarRecord{ Rubrica rubric; Float nota; ArrayList<CalCategoria> calCategoriaArray; Curso curso; Estudiante estudiante; List<CalCategoria> getCalCategorias(){ return CalCategoria.find(CalCategoria.class, "evaluacion = ?", String.valueOf(this.getId())); } //creacion de calcategoria FALTA public Evaluacion() { } public Evaluacion(Rubrica rubric) { this.rubric = rubric; } }
UTF-8
Java
719
java
Evaluacion.java
Java
[ { "context": "rayList;\nimport java.util.List;\n\n/**\n * Created by Melanis on 13/04/2017.\n */\n\npublic class Evaluacion exte", "end": 224, "score": 0.9943965077400208, "start": 217, "tag": "NAME", "value": "Melanis" } ]
null
[]
package com.example.melanis.creacionrubrica; import com.example.melanis.creacionrubrica.Calificaciones.CalCategoria; import com.orm.SugarRecord; import java.util.ArrayList; import java.util.List; /** * Created by Melanis on 13/04/2017. */ public class Evaluacion extends SugarRecord{ Rubrica rubric; Float nota; ArrayList<CalCategoria> calCategoriaArray; Curso curso; Estudiante estudiante; List<CalCategoria> getCalCategorias(){ return CalCategoria.find(CalCategoria.class, "evaluacion = ?", String.valueOf(this.getId())); } //creacion de calcategoria FALTA public Evaluacion() { } public Evaluacion(Rubrica rubric) { this.rubric = rubric; } }
719
0.713491
0.702364
31
22.193548
23.381023
101
false
false
0
0
0
0
0
0
0.451613
false
false
7
eec220e2a880117073fb7ad5a6253cd660fb9887
36,764,920,066,266
554fc45582ff4e7183f6368e99f13f5f841a7144
/mobile/src/entity/microcredit/src/main/java/mobile/entity/microcredit/SolicitudeStatusId.java
8599be8119824446fb79d4628db696f0b55cb8f3
[ "Apache-2.0" ]
permissive
diemontufar/microxt
https://github.com/diemontufar/microxt
55e029b3559f9da042415379756e844da3b20474
f381629d5abd3e8ae524e54cc3baf1a8abb51f92
refs/heads/master
2021-05-28T22:39:30.419000
2015-03-20T07:35:52
2015-03-20T07:35:52
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package mobile.entity.microcredit; import javax.persistence.*; import mobile.entity.schema.AbstractEntityId; import mobile.entity.schema.GeneralEntityId; /** * The persistent class for the SOLICITUDE_STATUS_ID database table. */ @Entity @Table(name = "SOLICITUDE_STATUS_ID") public class SolicitudeStatusId extends AbstractEntityId implements GeneralEntityId { private static final long serialVersionUID = 1L; /** * Status */ @Id @Column(name = "STATUS_ID", nullable = false) private String statusId; public SolicitudeStatusId() { } public SolicitudeStatusId(String statusId) { this.statusId = statusId; } public String getStatusId() { return this.statusId; } public void setStatusId(String statusId) { this.statusId = statusId; } @Override public Object getPk() { return this.statusId; } @Override public void setPk(Object pk) { this.statusId = (String) pk; } @Override public String toString() { return "SOLICITUDE_STATUS_ID:[" + this.getPk().toString() + "]"; } }
UTF-8
Java
1,018
java
SolicitudeStatusId.java
Java
[]
null
[]
package mobile.entity.microcredit; import javax.persistence.*; import mobile.entity.schema.AbstractEntityId; import mobile.entity.schema.GeneralEntityId; /** * The persistent class for the SOLICITUDE_STATUS_ID database table. */ @Entity @Table(name = "SOLICITUDE_STATUS_ID") public class SolicitudeStatusId extends AbstractEntityId implements GeneralEntityId { private static final long serialVersionUID = 1L; /** * Status */ @Id @Column(name = "STATUS_ID", nullable = false) private String statusId; public SolicitudeStatusId() { } public SolicitudeStatusId(String statusId) { this.statusId = statusId; } public String getStatusId() { return this.statusId; } public void setStatusId(String statusId) { this.statusId = statusId; } @Override public Object getPk() { return this.statusId; } @Override public void setPk(Object pk) { this.statusId = (String) pk; } @Override public String toString() { return "SOLICITUDE_STATUS_ID:[" + this.getPk().toString() + "]"; } }
1,018
0.723969
0.722986
52
18.576923
20.808971
85
false
false
0
0
0
0
0
0
0.942308
false
false
7