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
087efb7d5ad7dc66894a22fb3ac0d7334456a4c2
29,798,483,117,729
1db706455927f4ed1f3219fd99072d309b45c68c
/app/src/main/java/estimeet/meetup/di/components/BackgroundServiceComponent.java
6911cf501af5005f9ec4ab84dddd6127d7ac0d78
[]
no_license
chrisduan001/Estimeet_Android
https://github.com/chrisduan001/Estimeet_Android
e308bcc29489940e36eadcf030d2d288d9343f96
b7cf608862c7fbb05b419adf0d5bea1b746aa9bc
refs/heads/master
2021-01-25T17:11:22.756000
2016-09-06T12:07:56
2016-09-06T12:07:56
122,899,688
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package estimeet.meetup.di.components; import android.content.Context; import javax.inject.Singleton; import dagger.Component; import estimeet.meetup.di.Modules.BackgroundServiceModule; import estimeet.meetup.di.Modules.ServiceModule; import estimeet.meetup.model.MeetUpSharedPreference; import estimeet.meetup.network.ServiceHelper; /** * Created by AmyDuan on 9/04/16. */ @Singleton @Component(modules = {ServiceModule.class, BackgroundServiceModule.class}) public interface BackgroundServiceComponent { void inject(Context context); ServiceHelper serviceHelper(); MeetUpSharedPreference meetUpSharedPreference(); }
UTF-8
Java
637
java
BackgroundServiceComponent.java
Java
[ { "context": "t.meetup.network.ServiceHelper;\n\n/**\n * Created by AmyDuan on 9/04/16.\n */\n@Singleton\n@Component(modules = {", "end": 363, "score": 0.9915142059326172, "start": 356, "tag": "USERNAME", "value": "AmyDuan" } ]
null
[]
package estimeet.meetup.di.components; import android.content.Context; import javax.inject.Singleton; import dagger.Component; import estimeet.meetup.di.Modules.BackgroundServiceModule; import estimeet.meetup.di.Modules.ServiceModule; import estimeet.meetup.model.MeetUpSharedPreference; import estimeet.meetup.network.ServiceHelper; /** * Created by AmyDuan on 9/04/16. */ @Singleton @Component(modules = {ServiceModule.class, BackgroundServiceModule.class}) public interface BackgroundServiceComponent { void inject(Context context); ServiceHelper serviceHelper(); MeetUpSharedPreference meetUpSharedPreference(); }
637
0.811617
0.803768
23
26.695652
22.404259
74
false
false
0
0
0
0
0
0
0.521739
false
false
7
592c8010dd225892894124b99137da90c12f3b51
22,797,686,414,992
6aaf7ab0dba3f073f8c5f840658d7e8c4175b770
/src/day24/DataStreamDemo.java
a060ed38cb74d95ca64c70dffda871913439933c
[]
no_license
Cyan-King/BiLaoShiJavaSE2
https://github.com/Cyan-King/BiLaoShiJavaSE2
5c1b9fac3e9c40bd81076a592c623947c6587d34
5564f5142972ff328eccaba2a333c90bce74e620
refs/heads/master
2021-09-10T09:06:04.437000
2018-03-23T08:30:49
2018-03-23T08:30:49
111,490,460
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package day24; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.Writer; public class DataStreamDemo { public static void main(String[] args) throws IOException { // TODO Auto-generated method stub // write(); read(); } private static void read() throws IOException { // TODO Auto-generated method stub DataInputStream dis = new DataInputStream(new FileInputStream("G:\\DataStream\\data.txt")); //现在我们使用readUTF() String len = dis.readUTF(); System.out.println(len); } private static void write() throws IOException { // TODO Auto-generated method stub File dir = new File("G:\\DataStream"); dir.mkdirs(); DataOutputStream dos = new DataOutputStream(new FileOutputStream("G:\\DataStream\\data.txt")); // dos.write("你好".getBytes()); dos.writeUTF("你好"); } }
UTF-8
Java
1,032
java
DataStreamDemo.java
Java
[]
null
[]
package day24; import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.Writer; public class DataStreamDemo { public static void main(String[] args) throws IOException { // TODO Auto-generated method stub // write(); read(); } private static void read() throws IOException { // TODO Auto-generated method stub DataInputStream dis = new DataInputStream(new FileInputStream("G:\\DataStream\\data.txt")); //现在我们使用readUTF() String len = dis.readUTF(); System.out.println(len); } private static void write() throws IOException { // TODO Auto-generated method stub File dir = new File("G:\\DataStream"); dir.mkdirs(); DataOutputStream dos = new DataOutputStream(new FileOutputStream("G:\\DataStream\\data.txt")); // dos.write("你好".getBytes()); dos.writeUTF("你好"); } }
1,032
0.705534
0.703557
50
19.24
22.328959
96
false
false
0
0
0
0
0
0
1.54
false
false
7
337189beb90eb9cc8b909b50343ad639f0c137ce
30,399,778,578,075
36b2fc098d469277816f2b791c748669894fd6cd
/app/src/main/java/com/taosx/one/View/Home/Model/EssayListModelInterface.java
7fab5f7635a244c6bbb03788ecb33a20ab382f85
[]
no_license
taoshixiong/One
https://github.com/taoshixiong/One
6bb09a584c19ff5e6a799acdc3a26325ad43f225
89c821e0555e9a800543bc0494742fadcf082377
refs/heads/master
2021-01-20T07:24:04.775000
2017-05-03T06:19:04
2017-05-03T06:19:04
89,995,689
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.taosx.one.View.Home.Model; import com.taosx.one.View.Home.Presenter.OnEssayListPresenterListener; /** * Created by TAO_SX on 2017/4/27/027. */ public interface EssayListModelInterface { void getdata(String date,OnEssayListPresenterListener listener); }
UTF-8
Java
274
java
EssayListModelInterface.java
Java
[ { "context": "r.OnEssayListPresenterListener;\n\n/**\n * Created by TAO_SX on 2017/4/27/027.\n */\n\npublic interface EssayList", "end": 136, "score": 0.9996322393417358, "start": 130, "tag": "USERNAME", "value": "TAO_SX" } ]
null
[]
package com.taosx.one.View.Home.Model; import com.taosx.one.View.Home.Presenter.OnEssayListPresenterListener; /** * Created by TAO_SX on 2017/4/27/027. */ public interface EssayListModelInterface { void getdata(String date,OnEssayListPresenterListener listener); }
274
0.781022
0.744526
11
23.90909
26.810631
70
false
false
0
0
0
0
0
0
0.363636
false
false
7
2d575874a8ba57b9b7c071916147377de3d07d6b
8,220,567,415,133
82ecd67664fca0f8e705cf32526dcac0b26ea759
/src/src/com/newlecture/app/console/NoticeConsole.java
de5d9fdc06e2dceed7454b1dfbf1776c210ad969
[]
no_license
kingchan223/JDBcConsoleProgram
https://github.com/kingchan223/JDBcConsoleProgram
01a4fcb19e2f99dd18c823e9353d155019aba0a0
49f4707b614b7be55c10d8b7f1ff65733fd4ce5c
refs/heads/master
2023-04-01T22:02:46.103000
2021-03-30T05:00:35
2021-03-30T05:00:35
352,874,688
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package src.com.newlecture.app.console; import java.sql.SQLException; import java.util.List; import java.util.Scanner; import src.com.newlecture.app.entity.Notice; import src.com.newlecture.app.service.NoticeService; public class NoticeConsole { private NoticeService service; private int page; private String searchWord; private String searchFeild; public NoticeConsole() { service = new NoticeService(); page = 1; searchWord = ""; searchFeild = "TITLE"; } public void printNoticeList() throws ClassNotFoundException, SQLException { List<Notice> list = service.getList( page, searchFeild, searchWord); int count = service.getCount(); int lastPage = (count/10); lastPage = count%10 == 0 ? lastPage:lastPage+1; System.out.println("-------------------------------------"); System.out.printf("<공지사항> 총 %d개 게시글\n",count); System.out.println("-------------------------------------"); for(Notice n: list) { System.out.printf("%d. %s / %s / %s \n", n.getId(), n.getTitle(), n.getWriterId(), n.getRegDate()); } System.out.println("-------------------------------------"); System.out.printf(" %d/%d pages\n",page,lastPage); } public int inputNoticeMenu() { Scanner scan = new Scanner(System.in); System.out.print(" 1.상세조회/ 2.이전 / 3.다음 / 4.글쓰기 / 5.검색 / 6.종료 / >숫자를 정수형으로 입력.>>>"); System.out.println(); System.out.println(); System.out.println(); String menu_ = scan.nextLine(); int menu = Integer.parseInt(menu_); return menu; } public void movePrevList() { if(page == 1) { System.out.println("!!!!!이미 첫 페이지 입니다!!!!!"); return; } page--; } public void moveNextList() throws ClassNotFoundException, SQLException { int count = service.getCount(); int lastPage = (count/10); lastPage = count%10 == 0 ? lastPage:lastPage+1; if(page == lastPage) { System.out.println("!!!!!이미 마지막 페이지 입니다!!!!!"); return; } page++; } public void inputSearchWord() { Scanner scan = new Scanner(System.in); System.out.println("검색 범주(글 제목, 내용, 작성자)중 하나를 입력하세요."); System.out.println(">>>"); searchFeild = scan.nextLine(); System.out.println("검색어를 입력하세요."); searchWord = scan.nextLine(); } public void insertPost() throws ClassNotFoundException, SQLException { String writerId = ""; String title = ""; String content = ""; Scanner scan = new Scanner(System.in); System.out.println("작성자ID를 입력하세요:"); writerId = scan.nextLine(); System.out.println("글 제목을 입력하세요:"); title = scan.nextLine(); System.out.println("내용을 입력하세요:"); content = scan.nextLine(); Notice insertNotice = new Notice(); insertNotice.setWriterId(writerId); insertNotice.setTitle(title); insertNotice.setContent(content); if(1==service.insert(insertNotice)) System.out.println("글이 성공적으로 등록되었습니다."); else System.out.println("글 등록에 실패하였습니다."); } public void seeDetail() throws ClassNotFoundException, SQLException { int postId = 0; @SuppressWarnings("resource") Scanner scan = new Scanner(System.in); System.out.println("상세조회하고 싶은 글의 번호를 입력하세요:"); postId = scan.nextInt(); Notice post = service.getPost(postId); System.out.println("---------------------------"); // id, // title, // writerId, // regDate, // content, // hit, // files System.out.println("글 번호:"+post.getId()); System.out.println("글 제목:"+post.getTitle()); System.out.println("작성자:"+post.getWriterId()); System.out.println("작성일:"+post.getRegDate()); System.out.println("조회수:"+post.getHit()); System.out.println("내용:"); System.out.println(post.getContent()); service.upHit(postId, post.getHit()); } }
UTF-8
Java
3,993
java
NoticeConsole.java
Java
[]
null
[]
package src.com.newlecture.app.console; import java.sql.SQLException; import java.util.List; import java.util.Scanner; import src.com.newlecture.app.entity.Notice; import src.com.newlecture.app.service.NoticeService; public class NoticeConsole { private NoticeService service; private int page; private String searchWord; private String searchFeild; public NoticeConsole() { service = new NoticeService(); page = 1; searchWord = ""; searchFeild = "TITLE"; } public void printNoticeList() throws ClassNotFoundException, SQLException { List<Notice> list = service.getList( page, searchFeild, searchWord); int count = service.getCount(); int lastPage = (count/10); lastPage = count%10 == 0 ? lastPage:lastPage+1; System.out.println("-------------------------------------"); System.out.printf("<공지사항> 총 %d개 게시글\n",count); System.out.println("-------------------------------------"); for(Notice n: list) { System.out.printf("%d. %s / %s / %s \n", n.getId(), n.getTitle(), n.getWriterId(), n.getRegDate()); } System.out.println("-------------------------------------"); System.out.printf(" %d/%d pages\n",page,lastPage); } public int inputNoticeMenu() { Scanner scan = new Scanner(System.in); System.out.print(" 1.상세조회/ 2.이전 / 3.다음 / 4.글쓰기 / 5.검색 / 6.종료 / >숫자를 정수형으로 입력.>>>"); System.out.println(); System.out.println(); System.out.println(); String menu_ = scan.nextLine(); int menu = Integer.parseInt(menu_); return menu; } public void movePrevList() { if(page == 1) { System.out.println("!!!!!이미 첫 페이지 입니다!!!!!"); return; } page--; } public void moveNextList() throws ClassNotFoundException, SQLException { int count = service.getCount(); int lastPage = (count/10); lastPage = count%10 == 0 ? lastPage:lastPage+1; if(page == lastPage) { System.out.println("!!!!!이미 마지막 페이지 입니다!!!!!"); return; } page++; } public void inputSearchWord() { Scanner scan = new Scanner(System.in); System.out.println("검색 범주(글 제목, 내용, 작성자)중 하나를 입력하세요."); System.out.println(">>>"); searchFeild = scan.nextLine(); System.out.println("검색어를 입력하세요."); searchWord = scan.nextLine(); } public void insertPost() throws ClassNotFoundException, SQLException { String writerId = ""; String title = ""; String content = ""; Scanner scan = new Scanner(System.in); System.out.println("작성자ID를 입력하세요:"); writerId = scan.nextLine(); System.out.println("글 제목을 입력하세요:"); title = scan.nextLine(); System.out.println("내용을 입력하세요:"); content = scan.nextLine(); Notice insertNotice = new Notice(); insertNotice.setWriterId(writerId); insertNotice.setTitle(title); insertNotice.setContent(content); if(1==service.insert(insertNotice)) System.out.println("글이 성공적으로 등록되었습니다."); else System.out.println("글 등록에 실패하였습니다."); } public void seeDetail() throws ClassNotFoundException, SQLException { int postId = 0; @SuppressWarnings("resource") Scanner scan = new Scanner(System.in); System.out.println("상세조회하고 싶은 글의 번호를 입력하세요:"); postId = scan.nextInt(); Notice post = service.getPost(postId); System.out.println("---------------------------"); // id, // title, // writerId, // regDate, // content, // hit, // files System.out.println("글 번호:"+post.getId()); System.out.println("글 제목:"+post.getTitle()); System.out.println("작성자:"+post.getWriterId()); System.out.println("작성일:"+post.getRegDate()); System.out.println("조회수:"+post.getHit()); System.out.println("내용:"); System.out.println(post.getContent()); service.upHit(postId, post.getHit()); } }
3,993
0.635368
0.629346
139
25.287769
20.240015
86
false
false
0
0
0
0
0
0
2.410072
false
false
7
5f80b4865c11ae879cc16cb89ad8ce0fc63f4809
25,632,364,858,651
32a7cd8753d6324a391760324480ca36acb43d77
/sessionbean/pg/gestionTypePieceIdentite/GestionTypePieceIdentite.java
e29edb9035f1747135758b783b7c60eb94eed151
[]
no_license
aymenlaadhari/boardcontroller
https://github.com/aymenlaadhari/boardcontroller
4e0faedfa80ace637c013e384fde490d81df0df2
ab88c019974a034965cb09ac07d74d25369c5dd3
refs/heads/master
2021-01-10T14:03:56.368000
2016-01-24T19:38:23
2016-01-24T19:38:23
50,304,062
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.yesserp.sessionbean.pg.gestionTypePieceIdentite; import java.util.List; import javax.ejb.LocalBean; import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.Query; import com.yesserp.domain.pg.TypePieceIdentite; import com.yesserp.sessionbean.pg.gestionTypePieceIdentite.GestionTypePieceIdentiteLocal; @Stateless @LocalBean public class GestionTypePieceIdentite implements GestionTypePieceIdentiteLocal{ public GestionTypePieceIdentite() { } @PersistenceContext(unitName="yessclever") private EntityManager em; public void ajouterTypePieceIdentite(TypePieceIdentite i) { em.persist(i); } public void supprimerTypePieceIdentite(TypePieceIdentite i) { i = em.merge(i); em.remove(i); } public void modifierTypePieceIdentite(TypePieceIdentite i) { em.merge(i); } @Override public List<TypePieceIdentite> findAll() { Query query = em.createQuery("SELECT c FROM TypePieceIdentite c"); return query.getResultList(); } }
UTF-8
Java
1,088
java
GestionTypePieceIdentite.java
Java
[]
null
[]
package com.yesserp.sessionbean.pg.gestionTypePieceIdentite; import java.util.List; import javax.ejb.LocalBean; import javax.ejb.Stateless; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; import javax.persistence.Query; import com.yesserp.domain.pg.TypePieceIdentite; import com.yesserp.sessionbean.pg.gestionTypePieceIdentite.GestionTypePieceIdentiteLocal; @Stateless @LocalBean public class GestionTypePieceIdentite implements GestionTypePieceIdentiteLocal{ public GestionTypePieceIdentite() { } @PersistenceContext(unitName="yessclever") private EntityManager em; public void ajouterTypePieceIdentite(TypePieceIdentite i) { em.persist(i); } public void supprimerTypePieceIdentite(TypePieceIdentite i) { i = em.merge(i); em.remove(i); } public void modifierTypePieceIdentite(TypePieceIdentite i) { em.merge(i); } @Override public List<TypePieceIdentite> findAll() { Query query = em.createQuery("SELECT c FROM TypePieceIdentite c"); return query.getResultList(); } }
1,088
0.768382
0.768382
53
19.528301
24.264738
89
false
false
0
0
0
0
0
0
0.886792
false
false
7
ff0a7cf6a81120dcf02aacd1c8db02f009f0e19d
20,641,612,886,705
826bd0d1b81da8f9a6f8f104ab95fac2ddc534ca
/src/com/lsht/ml/Layer.java
1d93764166c9a056645db917043d3e89d587fa5a
[]
no_license
pikejun/ai
https://github.com/pikejun/ai
cfffa29f97f08411e48dff5a538d5176a9636960
d2662144bd1ff6c3b6076d718f68bba1fe0ad9f7
refs/heads/master
2020-05-30T02:11:13.139000
2019-05-30T23:14:40
2019-05-30T23:14:40
189,494,162
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.lsht.ml; import java.util.ArrayList; import java.util.List; /** * Layer对象,负责初始化一层。此外,作为Node的集合对象,提供对Node集合的操作。 * Created by Junson on 2017/8/20. */ public class Layer { protected int layerIndex; protected List<Node> nodes=new ArrayList<>(); public Layer(int layer_index, int node_count) { this.layerIndex=layer_index; for(int i=0;i<node_count;i++) { nodes.add(new Node(layer_index, i)); } nodes.add(new ConstNode(layer_index,node_count)); } public void setOutPut(double[] data) { for(int i=0;i<nodes.size();i++) { nodes.get(i).setOutput(data[i]); } } public void calcOutput() { for(int i=0;i<nodes.size();i++) { nodes.get(i).calcOutput(); } } public int getLayerIndex() { return layerIndex; } public void setLayerIndex(int layerIndex) { this.layerIndex = layerIndex; } public List<Node> getNodes() { return nodes; } public Node getNode(int i) { return nodes.get(i); } public void setNodes(List<Node> nodes) { this.nodes = nodes; } public String toString() { StringBuilder sb=new StringBuilder(); sb.append("layerIndex:").append(layerIndex).append(",nodeCount:").append(nodes.size()); sb.append("\n").append(nodes); return sb.toString(); } public void setOutputs(double[] data) { for(int i=0;i<data.length;i++) { nodes.get(i).setOutput(data[i]); } } public double[] getOutputs() { double[] ret=new double[nodes.size()]; for(int i=0;i<nodes.size();i++) { ret[i]=nodes.get(i).getOutput(); } return ret; } }
UTF-8
Java
1,908
java
Layer.java
Java
[ { "context": "负责初始化一层。此外,作为Node的集合对象,提供对Node集合的操作。\n * Created by Junson on 2017/8/20.\n */\npublic class Layer {\n\n prote", "end": 146, "score": 0.9867023825645447, "start": 140, "tag": "NAME", "value": "Junson" } ]
null
[]
package com.lsht.ml; import java.util.ArrayList; import java.util.List; /** * Layer对象,负责初始化一层。此外,作为Node的集合对象,提供对Node集合的操作。 * Created by Junson on 2017/8/20. */ public class Layer { protected int layerIndex; protected List<Node> nodes=new ArrayList<>(); public Layer(int layer_index, int node_count) { this.layerIndex=layer_index; for(int i=0;i<node_count;i++) { nodes.add(new Node(layer_index, i)); } nodes.add(new ConstNode(layer_index,node_count)); } public void setOutPut(double[] data) { for(int i=0;i<nodes.size();i++) { nodes.get(i).setOutput(data[i]); } } public void calcOutput() { for(int i=0;i<nodes.size();i++) { nodes.get(i).calcOutput(); } } public int getLayerIndex() { return layerIndex; } public void setLayerIndex(int layerIndex) { this.layerIndex = layerIndex; } public List<Node> getNodes() { return nodes; } public Node getNode(int i) { return nodes.get(i); } public void setNodes(List<Node> nodes) { this.nodes = nodes; } public String toString() { StringBuilder sb=new StringBuilder(); sb.append("layerIndex:").append(layerIndex).append(",nodeCount:").append(nodes.size()); sb.append("\n").append(nodes); return sb.toString(); } public void setOutputs(double[] data) { for(int i=0;i<data.length;i++) { nodes.get(i).setOutput(data[i]); } } public double[] getOutputs() { double[] ret=new double[nodes.size()]; for(int i=0;i<nodes.size();i++) { ret[i]=nodes.get(i).getOutput(); } return ret; } }
1,908
0.541712
0.535211
91
19.285715
19.007971
95
false
false
0
0
0
0
0
0
0.406593
false
false
7
7d9c0dafe3c088967151c406915e4226fd18050a
18,854,906,446,472
bfe1a9d5ce1a5b4e1ba41bf652ab227d09f2d8ef
/src/vista/frmRegistrarReserva.java
30da7e4ad9c62848b61f019dbe0b999a6fdd6796
[]
no_license
CarlosDevlp/Sistema-Hotel
https://github.com/CarlosDevlp/Sistema-Hotel
35de1eb34c129d2461d1f290f33c247bc8a06ec2
d07a4d7a394d1aeae8be1de407ca46a5b6a19cb9
refs/heads/master
2021-01-22T11:28:49.138000
2017-07-08T02:40:54
2017-07-08T02:40:54
92,700,946
2
2
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 controlador.ctrRegistrarReserva; import dao.BasicDao; import java.awt.event.ActionListener; import java.beans.PropertyChangeListener; /** * * @author Propietario */ public class frmRegistrarReserva extends StandardForm { private ctrRegistrarReserva mCtrGenerarReserva; public frmRegistrarReserva() { initComponents(); } /** * 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() { jLabel17 = new javax.swing.JLabel(); txtCodEmpleado = new javax.swing.JTextField(); jPanel4 = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(); tblDetalleReserva = new javax.swing.JTable(); btnAgregar = new javax.swing.JButton(); btnQuitar = new javax.swing.JButton(); jPanel3 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); txtTipoHab = new javax.swing.JTextField(); jLabel15 = new javax.swing.JLabel(); txtCodHab = new javax.swing.JTextField(); jLabel16 = new javax.swing.JLabel(); txtCostoHab = new javax.swing.JTextField(); btnBuscarHabitacion = new javax.swing.JButton(); jLabel3 = new javax.swing.JLabel(); txtCantHabit = new javax.swing.JTextField(); jPanel2 = new javax.swing.JPanel(); jLabel5 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jLabel11 = new javax.swing.JLabel(); txtCantDias = new javax.swing.JTextField(); jdcSalida = new com.toedter.calendar.JDateChooser(); jdcLlegada = new com.toedter.calendar.JDateChooser(); jPanel5 = new javax.swing.JPanel(); jLabel12 = new javax.swing.JLabel(); txtNomHuesped = new javax.swing.JTextField(); jLabel13 = new javax.swing.JLabel(); txtDniHuesped = new javax.swing.JTextField(); jLabel14 = new javax.swing.JLabel(); btnBuscarHuesped = new javax.swing.JButton(); txtCodHuesped = new javax.swing.JTextField(); btnNuevoHuesped = new javax.swing.JButton(); jLabel18 = new javax.swing.JLabel(); jspCantHuesped = new javax.swing.JSpinner(); btnCancelar = new javax.swing.JButton(); jLabel4 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); txtCotizacion = new javax.swing.JTextField(); txtFechaReserva = new javax.swing.JTextField(); btnGrabarReserva = new javax.swing.JButton(); jPanel1 = new javax.swing.JPanel(); jLabel8 = new javax.swing.JLabel(); txtCodCliente = new javax.swing.JTextField(); btnBuscarCliente = new javax.swing.JButton(); btnNuevoCliente = new javax.swing.JButton(); txtNomCliente = new javax.swing.JTextField(); txtDocCliente = new javax.swing.JTextField(); jLabel9 = new javax.swing.JLabel(); jLabel10 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); setTitle("Registrar Reserva"); setResizable(false); jLabel17.setText("Cod. Empleado"); txtCodEmpleado.setEditable(false); txtCodEmpleado.setBackground(new java.awt.Color(51, 51, 51)); txtCodEmpleado.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N txtCodEmpleado.setForeground(new java.awt.Color(255, 255, 255)); jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("Detalle de la Reserva")); tblDetalleReserva = new javax.swing.JTable(){ public boolean isCellEditable(int rowIndex, int colIndex){ return false; } }; tblDetalleReserva.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { }, new String [] { "Nombre", "Habitacion", "Huesped", "Costo x Dia", "Cant. Dias", "F. Llegada", "F. Salida" } ) { boolean[] canEdit = new boolean [] { false, false, false, false, false, false, false }; public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit [columnIndex]; } }); jScrollPane1.setViewportView(tblDetalleReserva); btnAgregar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/agregar.png"))); // NOI18N btnAgregar.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1)); btnAgregar.setName("btnAgregar"); // NOI18N btnAgregar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnAgregarActionPerformed(evt); } }); btnQuitar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/eliminar.png"))); // NOI18N btnQuitar.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1)); btnQuitar.setName("btnQuitar"); // NOI18N btnQuitar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnQuitarActionPerformed(evt); } }); javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); jPanel4.setLayout(jPanel4Layout); jPanel4Layout.setHorizontalGroup( jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup() .addContainerGap() .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 557, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(btnAgregar, javax.swing.GroupLayout.DEFAULT_SIZE, 47, Short.MAX_VALUE) .addComponent(btnQuitar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(10, 10, 10)) ); jPanel4Layout.setVerticalGroup( jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup() .addGap(15, 15, 15) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup() .addComponent(btnAgregar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(11, 11, 11) .addComponent(btnQuitar, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(10, 10, 10)) ); jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos de la Habitación")); jLabel1.setText("T. Habitacion"); txtTipoHab.setEditable(false); txtTipoHab.setBackground(new java.awt.Color(255, 255, 255)); jLabel15.setText("Codigo"); txtCodHab.setEditable(false); txtCodHab.setBackground(new java.awt.Color(255, 255, 255)); txtCodHab.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtCodHabActionPerformed(evt); } }); jLabel16.setText("Costo x Dia"); txtCostoHab.setEditable(false); txtCostoHab.setBackground(new java.awt.Color(255, 255, 255)); txtCostoHab.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtCostoHabActionPerformed(evt); } }); btnBuscarHabitacion.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/buscar.png"))); // NOI18N btnBuscarHabitacion.setName("btnBuscarHabitacion"); // NOI18N btnBuscarHabitacion.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnBuscarHabitacionActionPerformed(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() .addContainerGap() .addComponent(jLabel15) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(txtCodHab, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(btnBuscarHabitacion, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jLabel1) .addGap(18, 18, 18) .addComponent(txtTipoHab, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(33, 33, 33) .addComponent(jLabel16) .addGap(18, 18, 18) .addComponent(txtCostoHab, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) ); jPanel3Layout.setVerticalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addGap(19, 19, 19) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txtCodHab, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel15)) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) .addComponent(txtTipoHab, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel16) .addComponent(txtCostoHab, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(21, 21, 21)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup() .addComponent(btnBuscarHabitacion) .addContainerGap()) ); jLabel3.setText("Cantidad Habit."); txtCantHabit.setEditable(false); txtCantHabit.setBackground(new java.awt.Color(255, 255, 255)); txtCantHabit.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtCantHabitActionPerformed(evt); } }); jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos de la Reserva")); jLabel5.setText("F. Llegada"); jLabel6.setText("F. Salida"); jLabel11.setText("Cantidad Dias"); txtCantDias.setEditable(false); txtCantDias.setBackground(new java.awt.Color(255, 255, 255)); jdcSalida.setBackground(new java.awt.Color(255, 255, 153)); jdcSalida.setToolTipText("jdcSalida"); jdcSalida.addPropertyChangeListener(new java.beans.PropertyChangeListener() { public void propertyChange(java.beans.PropertyChangeEvent evt) { jdcSalidaPropertyChange(evt); } }); jdcLlegada.setBackground(new java.awt.Color(204, 255, 204)); jdcLlegada.setToolTipText("jdcLlegada"); jdcLlegada.addPropertyChangeListener(new java.beans.PropertyChangeListener() { public void propertyChange(java.beans.PropertyChangeEvent evt) { jdcLlegadaPropertyChange(evt); } }); 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(jLabel5) .addGap(18, 18, 18) .addComponent(jdcLlegada, javax.swing.GroupLayout.PREFERRED_SIZE, 131, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 45, Short.MAX_VALUE) .addComponent(jLabel6) .addGap(18, 18, 18) .addComponent(jdcSalida, javax.swing.GroupLayout.PREFERRED_SIZE, 131, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(25, 25, 25) .addComponent(jLabel11) .addGap(18, 18, 18) .addComponent(txtCantDias, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jdcLlegada, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jdcSalida, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel5) .addComponent(jLabel11) .addComponent(txtCantDias, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jLabel6, javax.swing.GroupLayout.Alignment.TRAILING)) .addGap(10, 10, 10)) ); jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos del Huésped")); jLabel12.setText("Nombres"); txtNomHuesped.setEditable(false); txtNomHuesped.setBackground(new java.awt.Color(255, 255, 255)); txtNomHuesped.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtNomHuespedActionPerformed(evt); } }); jLabel13.setText("DNI"); txtDniHuesped.setEditable(false); txtDniHuesped.setBackground(new java.awt.Color(255, 255, 255)); txtDniHuesped.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtDniHuespedActionPerformed(evt); } }); jLabel14.setText("Codigo"); btnBuscarHuesped.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/buscar.png"))); // NOI18N btnBuscarHuesped.setName("btnBuscarHuesped"); // NOI18N btnBuscarHuesped.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnBuscarHuespedActionPerformed(evt); } }); txtCodHuesped.setEditable(false); txtCodHuesped.setBackground(new java.awt.Color(255, 255, 255)); txtCodHuesped.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtCodHuespedActionPerformed(evt); } }); btnNuevoHuesped.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/nuevo.png"))); // NOI18N btnNuevoHuesped.setName("btnNuevoHuesped"); // NOI18N btnNuevoHuesped.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnNuevoHuespedActionPerformed(evt); } }); jLabel18.setText("Cantidad"); jspCantHuesped.setModel(new javax.swing.SpinnerNumberModel(1, 1, 2, 1)); 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() .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel14) .addComponent(jLabel18)) .addGap(32, 32, 32) .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(txtCodHuesped, javax.swing.GroupLayout.DEFAULT_SIZE, 70, Short.MAX_VALUE) .addComponent(jspCantHuesped)) .addGap(18, 18, 18) .addComponent(btnBuscarHuesped, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel5Layout.createSequentialGroup() .addGap(17, 17, 17) .addComponent(jLabel12) .addGap(18, 18, 18) .addComponent(txtNomHuesped, javax.swing.GroupLayout.PREFERRED_SIZE, 136, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel13) .addGap(18, 18, 18) .addComponent(txtDniHuesped, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel5Layout.createSequentialGroup() .addComponent(btnNuevoHuesped, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE))) .addContainerGap()) ); jPanel5Layout.setVerticalGroup( jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel5Layout.createSequentialGroup() .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(btnBuscarHuesped) .addComponent(btnNuevoHuesped))) .addGroup(jPanel5Layout.createSequentialGroup() .addGap(21, 21, 21) .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txtCodHuesped, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel14)))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel12) .addComponent(txtNomHuesped, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txtDniHuesped, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel13) .addComponent(jLabel18) .addComponent(jspCantHuesped, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(10, 10, 10)) ); btnCancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/cancelar.png"))); // NOI18N btnCancelar.setName("btnCancelar"); // NOI18N btnCancelar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnCancelarActionPerformed(evt); } }); jLabel4.setText("Fecha Reserva"); jLabel7.setText("Cotización S/"); txtCotizacion.setEditable(false); txtCotizacion.setBackground(new java.awt.Color(255, 255, 255)); txtFechaReserva.setEditable(false); txtFechaReserva.setBackground(new java.awt.Color(51, 51, 51)); txtFechaReserva.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N txtFechaReserva.setForeground(new java.awt.Color(255, 255, 255)); btnGrabarReserva.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/guardar.png"))); // NOI18N btnGrabarReserva.setName("btnGrabarReserva"); // NOI18N btnGrabarReserva.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnGrabarReservaActionPerformed(evt); } }); jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos del Cliente")); jLabel8.setText("Codigo"); txtCodCliente.setEditable(false); txtCodCliente.setBackground(new java.awt.Color(255, 255, 255)); btnBuscarCliente.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/buscar.png"))); // NOI18N btnBuscarCliente.setName("btnBuscarCliente"); // NOI18N btnBuscarCliente.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnBuscarClienteActionPerformed(evt); } }); btnNuevoCliente.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/nuevo.png"))); // NOI18N btnNuevoCliente.setName("btnNuevoCliente"); // NOI18N btnNuevoCliente.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnNuevoClienteActionPerformed(evt); } }); txtNomCliente.setEditable(false); txtNomCliente.setBackground(new java.awt.Color(255, 255, 255)); txtDocCliente.setEditable(false); txtDocCliente.setBackground(new java.awt.Color(255, 255, 255)); txtDocCliente.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtDocClienteActionPerformed(evt); } }); jLabel9.setText("Nombre o Razon Social"); jLabel10.setText("DNI o RUC"); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel8) .addGap(37, 37, 37) .addComponent(txtCodCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(btnBuscarCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(19, 19, 19) .addComponent(btnNuevoCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel9) .addGap(18, 18, 18) .addComponent(txtNomCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 255, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel10) .addGap(18, 18, 18) .addComponent(txtDocCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap()) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addGap(9, 9, 9) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel8) .addComponent(txtCodCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(15, 15, 15)) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(btnNuevoCliente) .addComponent(btnBuscarCliente)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel9) .addComponent(txtNomCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txtDocCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel10))) .addGap(10, 10, 10)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(20, 20, 20) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(layout.createSequentialGroup() .addGap(12, 12, 12) .addComponent(jLabel7) .addGap(11, 11, 11) .addComponent(txtCotizacion, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(101, 101, 101) .addComponent(btnGrabarReserva, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(btnCancelar, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel3) .addGap(18, 18, 18) .addComponent(txtCantHabit, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addComponent(jLabel4) .addGap(18, 18, 18) .addComponent(txtFechaReserva, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel17) .addGap(18, 18, 18) .addComponent(txtCodEmpleado, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(20, 20, 20)) .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel1, 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)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGap(10, 10, 10) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel4) .addComponent(txtFechaReserva, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel17) .addComponent(txtCodEmpleado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(5, 5, 5) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(1, 1, 1) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(1, 1, 1) .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(1, 1, 1) .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(1, 1, 1) .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txtCantHabit, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3)) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txtCotizacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel7))) .addGap(33, 33, 33)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(btnCancelar) .addContainerGap()))) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btnGrabarReserva) .addContainerGap()) ); pack(); }// </editor-fold>//GEN-END:initComponents private void txtCodHabActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtCodHabActionPerformed // TODO add your handling code here: }//GEN-LAST:event_txtCodHabActionPerformed private void txtCostoHabActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtCostoHabActionPerformed // TODO add your handling code here: }//GEN-LAST:event_txtCostoHabActionPerformed private void btnBuscarHabitacionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarHabitacionActionPerformed // TODO add your handling code here: }//GEN-LAST:event_btnBuscarHabitacionActionPerformed private void txtCantHabitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtCantHabitActionPerformed // TODO add your handling code here: }//GEN-LAST:event_txtCantHabitActionPerformed private void txtNomHuespedActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtNomHuespedActionPerformed // TODO add your handling code here: }//GEN-LAST:event_txtNomHuespedActionPerformed private void txtDniHuespedActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtDniHuespedActionPerformed // TODO add your handling code here: }//GEN-LAST:event_txtDniHuespedActionPerformed private void txtCodHuespedActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtCodHuespedActionPerformed // TODO add your handling code here: }//GEN-LAST:event_txtCodHuespedActionPerformed private void btnGrabarReservaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGrabarReservaActionPerformed // TODO add your handling code here: }//GEN-LAST:event_btnGrabarReservaActionPerformed private void btnBuscarClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarClienteActionPerformed // TODO add your handling code here: }//GEN-LAST:event_btnBuscarClienteActionPerformed private void txtDocClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtDocClienteActionPerformed // TODO add your handling code here: }//GEN-LAST:event_txtDocClienteActionPerformed private void btnBuscarHuespedActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarHuespedActionPerformed // TODO add your handling code here: }//GEN-LAST:event_btnBuscarHuespedActionPerformed private void btnNuevoClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNuevoClienteActionPerformed // TODO add your handling code here: }//GEN-LAST:event_btnNuevoClienteActionPerformed private void btnNuevoHuespedActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNuevoHuespedActionPerformed // TODO add your handling code here: }//GEN-LAST:event_btnNuevoHuespedActionPerformed private void btnAgregarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAgregarActionPerformed // TODO add your handling code here: }//GEN-LAST:event_btnAgregarActionPerformed private void btnQuitarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnQuitarActionPerformed // TODO add your handling code here: }//GEN-LAST:event_btnQuitarActionPerformed private void btnCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelarActionPerformed // TODO add your handling code here: }//GEN-LAST:event_btnCancelarActionPerformed private void jdcLlegadaPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jdcLlegadaPropertyChange // TODO add your handling code here: }//GEN-LAST:event_jdcLlegadaPropertyChange private void jdcSalidaPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jdcSalidaPropertyChange // TODO add your handling code here: }//GEN-LAST:event_jdcSalidaPropertyChange /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(frmRegistrarReserva.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(frmRegistrarReserva.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(frmRegistrarReserva.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(frmRegistrarReserva.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { final frmRegistrarReserva mFrmGenerarReserva= new frmRegistrarReserva(); mFrmGenerarReserva.setVisible(true); mFrmGenerarReserva.createController(); Thread thread=new Thread(new Runnable(){ @Override public void run() { BasicDao.init(); mFrmGenerarReserva.loadControllerData(); } }); thread.start(); System.out.println("FrmGenerarReserva"); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables public static javax.swing.JButton btnAgregar; public static javax.swing.JButton btnBuscarCliente; public static javax.swing.JButton btnBuscarHabitacion; public static javax.swing.JButton btnBuscarHuesped; public javax.swing.JButton btnCancelar; public javax.swing.JButton btnGrabarReserva; public static javax.swing.JButton btnNuevoCliente; public static javax.swing.JButton btnNuevoHuesped; public static javax.swing.JButton btnQuitar; private javax.swing.JLabel jLabel1; 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 jLabel16; private javax.swing.JLabel jLabel17; private javax.swing.JLabel jLabel18; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JPanel jPanel1; 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; public com.toedter.calendar.JDateChooser jdcLlegada; public com.toedter.calendar.JDateChooser jdcSalida; public javax.swing.JSpinner jspCantHuesped; public javax.swing.JTable tblDetalleReserva; public static javax.swing.JTextField txtCantDias; public static javax.swing.JTextField txtCantHabit; public static javax.swing.JTextField txtCodCliente; public static javax.swing.JTextField txtCodEmpleado; public static javax.swing.JTextField txtCodHab; public static javax.swing.JTextField txtCodHuesped; public static javax.swing.JTextField txtCostoHab; public static javax.swing.JTextField txtCotizacion; public static javax.swing.JTextField txtDniHuesped; public static javax.swing.JTextField txtDocCliente; public static javax.swing.JTextField txtFechaReserva; public static javax.swing.JTextField txtNomCliente; public static javax.swing.JTextField txtNomHuesped; public static javax.swing.JTextField txtTipoHab; // End of variables declaration//GEN-END:variables public void loadControllerData(){ mCtrGenerarReserva.loadData(); } @Override public void createController() { mCtrGenerarReserva=new ctrRegistrarReserva(this); } @Override public Object getViewController() { return mCtrGenerarReserva; } public void addPropertyChangeLlegada(PropertyChangeListener event ){ jdcLlegada.addPropertyChangeListener(event); } public void addPropertyChangeSalida(PropertyChangeListener event ){ jdcSalida.addPropertyChangeListener(event); } public void addALbtnAgregar(ActionListener actionListener) { btnAgregar.addActionListener(actionListener); } public void addALbtnQuitar(ActionListener actionListener) { btnQuitar.addActionListener(actionListener); } }
UTF-8
Java
45,035
java
frmRegistrarReserva.java
Java
[ { "context": "a.beans.PropertyChangeListener;\n\n/**\n *\n * @author Propietario\n */\npublic class frmRegistrarReserva extend", "end": 366, "score": 0.8185852766036987, "start": 361, "tag": "USERNAME", "value": "Propi" }, { "context": "s.PropertyChangeListener;\n\n/**\n *\n * @author Propietario\n */\npublic class frmRegistrarReserva extends Stan", "end": 372, "score": 0.6374172568321228, "start": 366, "tag": "NAME", "value": "etario" }, { "context": "ing [] {\n \"Nombre\", \"Habitacion\", \"Huesped\", \"Costo x Dia\", \"Cant. Dias\", \"F. Llegada\", \"F. ", "end": 4355, "score": 0.9996914863586426, "start": 4348, "tag": "NAME", "value": "Huesped" }, { "context": " \"Nombre\", \"Habitacion\", \"Huesped\", \"Costo x Dia\", \"Cant. Dias\", \"F. Llegada\", \"F. Salida\"\n ", "end": 4370, "score": 0.9995375871658325, "start": 4359, "tag": "NAME", "value": "Costo x Dia" }, { "context": "Nombre\", \"Habitacion\", \"Huesped\", \"Costo x Dia\", \"Cant. Dias\", \"F. Llegada\", \"F. Salida\"\n }\n ", "end": 4384, "score": 0.9995792508125305, "start": 4374, "tag": "NAME", "value": "Cant. Dias" }, { "context": "tacion\", \"Huesped\", \"Costo x Dia\", \"Cant. Dias\", \"F. Llegada\", \"F. Salida\"\n }\n ) {\n ", "end": 4398, "score": 0.9967855215072632, "start": 4388, "tag": "NAME", "value": "F. Llegada" }, { "context": "ped\", \"Costo x Dia\", \"Cant. Dias\", \"F. Llegada\", \"F. Salida\"\n }\n ) {\n boolean[] ", "end": 4411, "score": 0.9938927888870239, "start": 4402, "tag": "NAME", "value": "F. Salida" }, { "context": "Datos de la Reserva\"));\n\n jLabel5.setText(\"F. Llegada\");\n\n jLabel6.setText(\"F. Salida\");\n\n ", "end": 12321, "score": 0.9978018999099731, "start": 12311, "tag": "NAME", "value": "F. Llegada" }, { "context": "setText(\"F. Llegada\");\n\n jLabel6.setText(\"F. Salida\");\n\n jLabel11.setText(\"Cantidad Dias\");\n\n ", "end": 12360, "score": 0.9827089309692383, "start": 12354, "tag": "NAME", "value": "Salida" }, { "context": "\"Datos del Huésped\"));\n\n jLabel12.setText(\"Nombres\");\n\n txtNomHuesped.setEditable(false);\n ", "end": 15668, "score": 0.97977614402771, "start": 15661, "tag": "NAME", "value": "Nombres" } ]
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 controlador.ctrRegistrarReserva; import dao.BasicDao; import java.awt.event.ActionListener; import java.beans.PropertyChangeListener; /** * * @author Propietario */ public class frmRegistrarReserva extends StandardForm { private ctrRegistrarReserva mCtrGenerarReserva; public frmRegistrarReserva() { initComponents(); } /** * 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() { jLabel17 = new javax.swing.JLabel(); txtCodEmpleado = new javax.swing.JTextField(); jPanel4 = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(); tblDetalleReserva = new javax.swing.JTable(); btnAgregar = new javax.swing.JButton(); btnQuitar = new javax.swing.JButton(); jPanel3 = new javax.swing.JPanel(); jLabel1 = new javax.swing.JLabel(); txtTipoHab = new javax.swing.JTextField(); jLabel15 = new javax.swing.JLabel(); txtCodHab = new javax.swing.JTextField(); jLabel16 = new javax.swing.JLabel(); txtCostoHab = new javax.swing.JTextField(); btnBuscarHabitacion = new javax.swing.JButton(); jLabel3 = new javax.swing.JLabel(); txtCantHabit = new javax.swing.JTextField(); jPanel2 = new javax.swing.JPanel(); jLabel5 = new javax.swing.JLabel(); jLabel6 = new javax.swing.JLabel(); jLabel11 = new javax.swing.JLabel(); txtCantDias = new javax.swing.JTextField(); jdcSalida = new com.toedter.calendar.JDateChooser(); jdcLlegada = new com.toedter.calendar.JDateChooser(); jPanel5 = new javax.swing.JPanel(); jLabel12 = new javax.swing.JLabel(); txtNomHuesped = new javax.swing.JTextField(); jLabel13 = new javax.swing.JLabel(); txtDniHuesped = new javax.swing.JTextField(); jLabel14 = new javax.swing.JLabel(); btnBuscarHuesped = new javax.swing.JButton(); txtCodHuesped = new javax.swing.JTextField(); btnNuevoHuesped = new javax.swing.JButton(); jLabel18 = new javax.swing.JLabel(); jspCantHuesped = new javax.swing.JSpinner(); btnCancelar = new javax.swing.JButton(); jLabel4 = new javax.swing.JLabel(); jLabel7 = new javax.swing.JLabel(); txtCotizacion = new javax.swing.JTextField(); txtFechaReserva = new javax.swing.JTextField(); btnGrabarReserva = new javax.swing.JButton(); jPanel1 = new javax.swing.JPanel(); jLabel8 = new javax.swing.JLabel(); txtCodCliente = new javax.swing.JTextField(); btnBuscarCliente = new javax.swing.JButton(); btnNuevoCliente = new javax.swing.JButton(); txtNomCliente = new javax.swing.JTextField(); txtDocCliente = new javax.swing.JTextField(); jLabel9 = new javax.swing.JLabel(); jLabel10 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); setTitle("Registrar Reserva"); setResizable(false); jLabel17.setText("Cod. Empleado"); txtCodEmpleado.setEditable(false); txtCodEmpleado.setBackground(new java.awt.Color(51, 51, 51)); txtCodEmpleado.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N txtCodEmpleado.setForeground(new java.awt.Color(255, 255, 255)); jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder("Detalle de la Reserva")); tblDetalleReserva = new javax.swing.JTable(){ public boolean isCellEditable(int rowIndex, int colIndex){ return false; } }; tblDetalleReserva.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { }, new String [] { "Nombre", "Habitacion", "Huesped", "<NAME>", "<NAME>", "<NAME>", "<NAME>" } ) { boolean[] canEdit = new boolean [] { false, false, false, false, false, false, false }; public boolean isCellEditable(int rowIndex, int columnIndex) { return canEdit [columnIndex]; } }); jScrollPane1.setViewportView(tblDetalleReserva); btnAgregar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/agregar.png"))); // NOI18N btnAgregar.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1)); btnAgregar.setName("btnAgregar"); // NOI18N btnAgregar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnAgregarActionPerformed(evt); } }); btnQuitar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/eliminar.png"))); // NOI18N btnQuitar.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1)); btnQuitar.setName("btnQuitar"); // NOI18N btnQuitar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnQuitarActionPerformed(evt); } }); javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4); jPanel4.setLayout(jPanel4Layout); jPanel4Layout.setHorizontalGroup( jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup() .addContainerGap() .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 557, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(btnAgregar, javax.swing.GroupLayout.DEFAULT_SIZE, 47, Short.MAX_VALUE) .addComponent(btnQuitar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(10, 10, 10)) ); jPanel4Layout.setVerticalGroup( jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel4Layout.createSequentialGroup() .addGap(15, 15, 15) .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel4Layout.createSequentialGroup() .addComponent(btnAgregar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(11, 11, 11) .addComponent(btnQuitar, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(10, 10, 10)) ); jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos de la Habitación")); jLabel1.setText("T. Habitacion"); txtTipoHab.setEditable(false); txtTipoHab.setBackground(new java.awt.Color(255, 255, 255)); jLabel15.setText("Codigo"); txtCodHab.setEditable(false); txtCodHab.setBackground(new java.awt.Color(255, 255, 255)); txtCodHab.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtCodHabActionPerformed(evt); } }); jLabel16.setText("Costo x Dia"); txtCostoHab.setEditable(false); txtCostoHab.setBackground(new java.awt.Color(255, 255, 255)); txtCostoHab.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtCostoHabActionPerformed(evt); } }); btnBuscarHabitacion.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/buscar.png"))); // NOI18N btnBuscarHabitacion.setName("btnBuscarHabitacion"); // NOI18N btnBuscarHabitacion.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnBuscarHabitacionActionPerformed(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() .addContainerGap() .addComponent(jLabel15) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(txtCodHab, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(btnBuscarHabitacion, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(jLabel1) .addGap(18, 18, 18) .addComponent(txtTipoHab, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(33, 33, 33) .addComponent(jLabel16) .addGap(18, 18, 18) .addComponent(txtCostoHab, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) ); jPanel3Layout.setVerticalGroup( jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createSequentialGroup() .addGap(19, 19, 19) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txtCodHab, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel15)) .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) .addComponent(txtTipoHab, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel16) .addComponent(txtCostoHab, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(21, 21, 21)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel3Layout.createSequentialGroup() .addComponent(btnBuscarHabitacion) .addContainerGap()) ); jLabel3.setText("Cantidad Habit."); txtCantHabit.setEditable(false); txtCantHabit.setBackground(new java.awt.Color(255, 255, 255)); txtCantHabit.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtCantHabitActionPerformed(evt); } }); jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos de la Reserva")); jLabel5.setText("<NAME>"); jLabel6.setText("F. Salida"); jLabel11.setText("Cantidad Dias"); txtCantDias.setEditable(false); txtCantDias.setBackground(new java.awt.Color(255, 255, 255)); jdcSalida.setBackground(new java.awt.Color(255, 255, 153)); jdcSalida.setToolTipText("jdcSalida"); jdcSalida.addPropertyChangeListener(new java.beans.PropertyChangeListener() { public void propertyChange(java.beans.PropertyChangeEvent evt) { jdcSalidaPropertyChange(evt); } }); jdcLlegada.setBackground(new java.awt.Color(204, 255, 204)); jdcLlegada.setToolTipText("jdcLlegada"); jdcLlegada.addPropertyChangeListener(new java.beans.PropertyChangeListener() { public void propertyChange(java.beans.PropertyChangeEvent evt) { jdcLlegadaPropertyChange(evt); } }); 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(jLabel5) .addGap(18, 18, 18) .addComponent(jdcLlegada, javax.swing.GroupLayout.PREFERRED_SIZE, 131, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 45, Short.MAX_VALUE) .addComponent(jLabel6) .addGap(18, 18, 18) .addComponent(jdcSalida, javax.swing.GroupLayout.PREFERRED_SIZE, 131, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(25, 25, 25) .addComponent(jLabel11) .addGap(18, 18, 18) .addComponent(txtCantDias, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE) .addContainerGap()) ); jPanel2Layout.setVerticalGroup( jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel2Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jdcLlegada, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jdcSalida, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel5) .addComponent(jLabel11) .addComponent(txtCantDias, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jLabel6, javax.swing.GroupLayout.Alignment.TRAILING)) .addGap(10, 10, 10)) ); jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos del Huésped")); jLabel12.setText("Nombres"); txtNomHuesped.setEditable(false); txtNomHuesped.setBackground(new java.awt.Color(255, 255, 255)); txtNomHuesped.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtNomHuespedActionPerformed(evt); } }); jLabel13.setText("DNI"); txtDniHuesped.setEditable(false); txtDniHuesped.setBackground(new java.awt.Color(255, 255, 255)); txtDniHuesped.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtDniHuespedActionPerformed(evt); } }); jLabel14.setText("Codigo"); btnBuscarHuesped.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/buscar.png"))); // NOI18N btnBuscarHuesped.setName("btnBuscarHuesped"); // NOI18N btnBuscarHuesped.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnBuscarHuespedActionPerformed(evt); } }); txtCodHuesped.setEditable(false); txtCodHuesped.setBackground(new java.awt.Color(255, 255, 255)); txtCodHuesped.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtCodHuespedActionPerformed(evt); } }); btnNuevoHuesped.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/nuevo.png"))); // NOI18N btnNuevoHuesped.setName("btnNuevoHuesped"); // NOI18N btnNuevoHuesped.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnNuevoHuespedActionPerformed(evt); } }); jLabel18.setText("Cantidad"); jspCantHuesped.setModel(new javax.swing.SpinnerNumberModel(1, 1, 2, 1)); 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() .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel14) .addComponent(jLabel18)) .addGap(32, 32, 32) .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(txtCodHuesped, javax.swing.GroupLayout.DEFAULT_SIZE, 70, Short.MAX_VALUE) .addComponent(jspCantHuesped)) .addGap(18, 18, 18) .addComponent(btnBuscarHuesped, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel5Layout.createSequentialGroup() .addGap(17, 17, 17) .addComponent(jLabel12) .addGap(18, 18, 18) .addComponent(txtNomHuesped, javax.swing.GroupLayout.PREFERRED_SIZE, 136, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel13) .addGap(18, 18, 18) .addComponent(txtDniHuesped, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel5Layout.createSequentialGroup() .addComponent(btnNuevoHuesped, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE))) .addContainerGap()) ); jPanel5Layout.setVerticalGroup( jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel5Layout.createSequentialGroup() .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(btnBuscarHuesped) .addComponent(btnNuevoHuesped))) .addGroup(jPanel5Layout.createSequentialGroup() .addGap(21, 21, 21) .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txtCodHuesped, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel14)))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel12) .addComponent(txtNomHuesped, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txtDniHuesped, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel13) .addComponent(jLabel18) .addComponent(jspCantHuesped, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(10, 10, 10)) ); btnCancelar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/cancelar.png"))); // NOI18N btnCancelar.setName("btnCancelar"); // NOI18N btnCancelar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnCancelarActionPerformed(evt); } }); jLabel4.setText("Fecha Reserva"); jLabel7.setText("Cotización S/"); txtCotizacion.setEditable(false); txtCotizacion.setBackground(new java.awt.Color(255, 255, 255)); txtFechaReserva.setEditable(false); txtFechaReserva.setBackground(new java.awt.Color(51, 51, 51)); txtFechaReserva.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N txtFechaReserva.setForeground(new java.awt.Color(255, 255, 255)); btnGrabarReserva.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/guardar.png"))); // NOI18N btnGrabarReserva.setName("btnGrabarReserva"); // NOI18N btnGrabarReserva.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnGrabarReservaActionPerformed(evt); } }); jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Datos del Cliente")); jLabel8.setText("Codigo"); txtCodCliente.setEditable(false); txtCodCliente.setBackground(new java.awt.Color(255, 255, 255)); btnBuscarCliente.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/buscar.png"))); // NOI18N btnBuscarCliente.setName("btnBuscarCliente"); // NOI18N btnBuscarCliente.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnBuscarClienteActionPerformed(evt); } }); btnNuevoCliente.setIcon(new javax.swing.ImageIcon(getClass().getResource("/imagenes/nuevo.png"))); // NOI18N btnNuevoCliente.setName("btnNuevoCliente"); // NOI18N btnNuevoCliente.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { btnNuevoClienteActionPerformed(evt); } }); txtNomCliente.setEditable(false); txtNomCliente.setBackground(new java.awt.Color(255, 255, 255)); txtDocCliente.setEditable(false); txtDocCliente.setBackground(new java.awt.Color(255, 255, 255)); txtDocCliente.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { txtDocClienteActionPerformed(evt); } }); jLabel9.setText("Nombre o Razon Social"); jLabel10.setText("DNI o RUC"); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel8) .addGap(37, 37, 37) .addComponent(txtCodCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(btnBuscarCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(19, 19, 19) .addComponent(btnNuevoCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(0, 0, Short.MAX_VALUE)) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jLabel9) .addGap(18, 18, 18) .addComponent(txtNomCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 255, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel10) .addGap(18, 18, 18) .addComponent(txtDocCliente, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap()) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addGap(9, 9, 9) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel8) .addComponent(txtCodCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(15, 15, 15)) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(btnNuevoCliente) .addComponent(btnBuscarCliente)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel9) .addComponent(txtNomCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txtDocCliente, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel10))) .addGap(10, 10, 10)) ); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGap(20, 20, 20) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(layout.createSequentialGroup() .addGap(12, 12, 12) .addComponent(jLabel7) .addGap(11, 11, 11) .addComponent(txtCotizacion, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(101, 101, 101) .addComponent(btnGrabarReserva, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(btnCancelar, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel3) .addGap(18, 18, 18) .addComponent(txtCantHabit, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addComponent(jLabel4) .addGap(18, 18, 18) .addComponent(txtFechaReserva, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jLabel17) .addGap(18, 18, 18) .addComponent(txtCodEmpleado, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(20, 20, 20)) .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jPanel1, 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)) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGap(10, 10, 10) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel4) .addComponent(txtFechaReserva, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel17) .addComponent(txtCodEmpleado, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(5, 5, 5) .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(1, 1, 1) .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(1, 1, 1) .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(1, 1, 1) .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(1, 1, 1) .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txtCantHabit, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3)) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(txtCotizacion, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel7))) .addGap(33, 33, 33)) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(btnCancelar) .addContainerGap()))) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btnGrabarReserva) .addContainerGap()) ); pack(); }// </editor-fold>//GEN-END:initComponents private void txtCodHabActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtCodHabActionPerformed // TODO add your handling code here: }//GEN-LAST:event_txtCodHabActionPerformed private void txtCostoHabActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtCostoHabActionPerformed // TODO add your handling code here: }//GEN-LAST:event_txtCostoHabActionPerformed private void btnBuscarHabitacionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarHabitacionActionPerformed // TODO add your handling code here: }//GEN-LAST:event_btnBuscarHabitacionActionPerformed private void txtCantHabitActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtCantHabitActionPerformed // TODO add your handling code here: }//GEN-LAST:event_txtCantHabitActionPerformed private void txtNomHuespedActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtNomHuespedActionPerformed // TODO add your handling code here: }//GEN-LAST:event_txtNomHuespedActionPerformed private void txtDniHuespedActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtDniHuespedActionPerformed // TODO add your handling code here: }//GEN-LAST:event_txtDniHuespedActionPerformed private void txtCodHuespedActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtCodHuespedActionPerformed // TODO add your handling code here: }//GEN-LAST:event_txtCodHuespedActionPerformed private void btnGrabarReservaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnGrabarReservaActionPerformed // TODO add your handling code here: }//GEN-LAST:event_btnGrabarReservaActionPerformed private void btnBuscarClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarClienteActionPerformed // TODO add your handling code here: }//GEN-LAST:event_btnBuscarClienteActionPerformed private void txtDocClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_txtDocClienteActionPerformed // TODO add your handling code here: }//GEN-LAST:event_txtDocClienteActionPerformed private void btnBuscarHuespedActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnBuscarHuespedActionPerformed // TODO add your handling code here: }//GEN-LAST:event_btnBuscarHuespedActionPerformed private void btnNuevoClienteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNuevoClienteActionPerformed // TODO add your handling code here: }//GEN-LAST:event_btnNuevoClienteActionPerformed private void btnNuevoHuespedActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNuevoHuespedActionPerformed // TODO add your handling code here: }//GEN-LAST:event_btnNuevoHuespedActionPerformed private void btnAgregarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAgregarActionPerformed // TODO add your handling code here: }//GEN-LAST:event_btnAgregarActionPerformed private void btnQuitarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnQuitarActionPerformed // TODO add your handling code here: }//GEN-LAST:event_btnQuitarActionPerformed private void btnCancelarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCancelarActionPerformed // TODO add your handling code here: }//GEN-LAST:event_btnCancelarActionPerformed private void jdcLlegadaPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jdcLlegadaPropertyChange // TODO add your handling code here: }//GEN-LAST:event_jdcLlegadaPropertyChange private void jdcSalidaPropertyChange(java.beans.PropertyChangeEvent evt) {//GEN-FIRST:event_jdcSalidaPropertyChange // TODO add your handling code here: }//GEN-LAST:event_jdcSalidaPropertyChange /** * @param args the command line arguments */ public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(frmRegistrarReserva.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(frmRegistrarReserva.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(frmRegistrarReserva.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(frmRegistrarReserva.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> //</editor-fold> //</editor-fold> //</editor-fold> /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { final frmRegistrarReserva mFrmGenerarReserva= new frmRegistrarReserva(); mFrmGenerarReserva.setVisible(true); mFrmGenerarReserva.createController(); Thread thread=new Thread(new Runnable(){ @Override public void run() { BasicDao.init(); mFrmGenerarReserva.loadControllerData(); } }); thread.start(); System.out.println("FrmGenerarReserva"); } }); } // Variables declaration - do not modify//GEN-BEGIN:variables public static javax.swing.JButton btnAgregar; public static javax.swing.JButton btnBuscarCliente; public static javax.swing.JButton btnBuscarHabitacion; public static javax.swing.JButton btnBuscarHuesped; public javax.swing.JButton btnCancelar; public javax.swing.JButton btnGrabarReserva; public static javax.swing.JButton btnNuevoCliente; public static javax.swing.JButton btnNuevoHuesped; public static javax.swing.JButton btnQuitar; private javax.swing.JLabel jLabel1; 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 jLabel16; private javax.swing.JLabel jLabel17; private javax.swing.JLabel jLabel18; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; private javax.swing.JLabel jLabel5; private javax.swing.JLabel jLabel6; private javax.swing.JLabel jLabel7; private javax.swing.JLabel jLabel8; private javax.swing.JLabel jLabel9; private javax.swing.JPanel jPanel1; 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; public com.toedter.calendar.JDateChooser jdcLlegada; public com.toedter.calendar.JDateChooser jdcSalida; public javax.swing.JSpinner jspCantHuesped; public javax.swing.JTable tblDetalleReserva; public static javax.swing.JTextField txtCantDias; public static javax.swing.JTextField txtCantHabit; public static javax.swing.JTextField txtCodCliente; public static javax.swing.JTextField txtCodEmpleado; public static javax.swing.JTextField txtCodHab; public static javax.swing.JTextField txtCodHuesped; public static javax.swing.JTextField txtCostoHab; public static javax.swing.JTextField txtCotizacion; public static javax.swing.JTextField txtDniHuesped; public static javax.swing.JTextField txtDocCliente; public static javax.swing.JTextField txtFechaReserva; public static javax.swing.JTextField txtNomCliente; public static javax.swing.JTextField txtNomHuesped; public static javax.swing.JTextField txtTipoHab; // End of variables declaration//GEN-END:variables public void loadControllerData(){ mCtrGenerarReserva.loadData(); } @Override public void createController() { mCtrGenerarReserva=new ctrRegistrarReserva(this); } @Override public Object getViewController() { return mCtrGenerarReserva; } public void addPropertyChangeLlegada(PropertyChangeListener event ){ jdcLlegada.addPropertyChangeListener(event); } public void addPropertyChangeSalida(PropertyChangeListener event ){ jdcSalida.addPropertyChangeListener(event); } public void addALbtnAgregar(ActionListener actionListener) { btnAgregar.addActionListener(actionListener); } public void addALbtnQuitar(ActionListener actionListener) { btnQuitar.addActionListener(actionListener); } }
45,015
0.660686
0.643009
816
54.186275
40.73175
178
false
false
0
0
0
0
0
0
0.796569
false
false
7
aa5547f1a3b4e38d7be82e031323a87336797033
2,078,764,214,336
e0727dcc068a612704effb49c649f417c8fc61da
/jori/src/main/java/com/jori/menu/indexMenu/IndexMenuServiceImpl.java
276b1b87d9ce1a27076e300e07d2937de2057bbb
[]
no_license
joriful/prj_jori
https://github.com/joriful/prj_jori
aded61f173ab7a14807605f6d898f8a1888207f2
4d4ea701c6358f11eba3efa62293dbbf3fea9865
refs/heads/master
2018-12-23T04:39:05.507000
2018-10-29T13:19:56
2018-10-29T13:19:56
114,120,852
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.jori.menu.indexMenu; import java.util.List; import javax.annotation.Resource; import org.apache.log4j.Logger; import org.springframework.stereotype.Service; import com.jori.menu.menuMain.ProductsMainBean; @Service("IndexMenuService") public class IndexMenuServiceImpl implements IndexMenuService { Logger log = Logger.getLogger(this.getClass()); @Resource(name="idxMenuDao") private IndexMenuDAO idxMenuDao; @Override public List<ProductsMainBean> idxSiMenuList() throws Exception{ return idxMenuDao.idxSiMenuList(); } }//
UTF-8
Java
578
java
IndexMenuServiceImpl.java
Java
[]
null
[]
package com.jori.menu.indexMenu; import java.util.List; import javax.annotation.Resource; import org.apache.log4j.Logger; import org.springframework.stereotype.Service; import com.jori.menu.menuMain.ProductsMainBean; @Service("IndexMenuService") public class IndexMenuServiceImpl implements IndexMenuService { Logger log = Logger.getLogger(this.getClass()); @Resource(name="idxMenuDao") private IndexMenuDAO idxMenuDao; @Override public List<ProductsMainBean> idxSiMenuList() throws Exception{ return idxMenuDao.idxSiMenuList(); } }//
578
0.761246
0.759516
24
22.083334
21.088932
64
false
false
0
0
0
0
0
0
0.833333
false
false
7
731346ebdb1cde00c87fc03af979bb9bddfbde77
11,776,800,389,834
57c51f5d694a2452b7ca0234b894c4cc0c14bf89
/com.gcplot.web/src/main/java/com/gcplot/messages/MemoryStatus.java
2897858fae561019077419c311e567ce4b2a027b
[ "Apache-2.0" ]
permissive
bubble501/gcplot
https://github.com/bubble501/gcplot
bce65054dd0a3d32ab30f056b6d8cd664743c9c9
9f0896c63fcb74f1ba1e3f411fa45b20074b8487
refs/heads/master
2021-01-27T19:30:42.074000
2020-03-02T05:41:12
2020-03-02T05:41:12
243,486,372
0
0
Apache-2.0
true
2020-02-27T09:57:09
2020-02-27T09:57:09
2020-02-27T09:19:11
2018-01-10T17:12:05
10,988
0
0
0
null
false
false
package com.gcplot.messages; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.gcplot.model.gc.MemoryDetails; import com.google.common.base.MoreObjects; /** * @author <a href="mailto:art.dm.ser@gmail.com">Artem Dmitriev</a> * 8/28/16 */ public class MemoryStatus { @JsonProperty(value = "ps") public long pageSize; @JsonProperty(value = "pt") public long physicalTotal; @JsonProperty(value = "pf") public long physicalFree; @JsonProperty(value = "st") public long swapTotal; @JsonProperty(value = "sf") public long swapFree; @JsonCreator public MemoryStatus(@JsonProperty(value = "ps") long pageSize, @JsonProperty(value = "pt") long physicalTotal, @JsonProperty(value = "pf") long physicalFree, @JsonProperty(value = "st") long swapTotal, @JsonProperty(value = "sf") long swapFree) { this.pageSize = pageSize; this.physicalTotal = physicalTotal; this.physicalFree = physicalFree; this.swapTotal = swapTotal; this.swapFree = swapFree; } public MemoryStatus(MemoryDetails details) { this.pageSize = details.pageSize(); this.physicalTotal = details.physicalTotal(); this.physicalFree = details.physicalFree(); this.swapTotal = details.swapTotal(); this.swapFree = details.swapFree(); } public MemoryDetails toDetails() { return new MemoryDetails(pageSize, physicalTotal, physicalFree, swapTotal, swapFree); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; MemoryStatus that = (MemoryStatus) o; if (pageSize != that.pageSize) return false; if (physicalTotal != that.physicalTotal) return false; if (physicalFree != that.physicalFree) return false; if (swapTotal != that.swapTotal) return false; return swapFree == that.swapFree; } @Override public int hashCode() { int result = (int) (pageSize ^ (pageSize >>> 32)); result = 31 * result + (int) (physicalTotal ^ (physicalTotal >>> 32)); result = 31 * result + (int) (physicalFree ^ (physicalFree >>> 32)); result = 31 * result + (int) (swapTotal ^ (swapTotal >>> 32)); result = 31 * result + (int) (swapFree ^ (swapFree >>> 32)); return result; } @Override public String toString() { return MoreObjects.toStringHelper(this) .add("pageSize", pageSize) .add("physicalTotal", physicalTotal) .add("physicalFree", physicalFree) .add("swapTotal", swapTotal) .add("swapFree", swapFree) .toString(); } }
UTF-8
Java
2,921
java
MemoryStatus.java
Java
[ { "context": "base.MoreObjects;\n\n/**\n * @author <a href=\"mailto:art.dm.ser@gmail.com\">Artem Dmitriev</a>\n * 8/28/16\n */\npublic", "end": 274, "score": 0.9999268054962158, "start": 254, "tag": "EMAIL", "value": "art.dm.ser@gmail.com" }, { "context": "\n * @author <a href=\"mailto:art.dm.ser@gmail.com\">Artem Dmitriev</a>\n * 8/28/16\n */\npublic class MemorySta", "end": 290, "score": 0.9998674392700195, "start": 276, "tag": "NAME", "value": "Artem Dmitriev" } ]
null
[]
package com.gcplot.messages; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.gcplot.model.gc.MemoryDetails; import com.google.common.base.MoreObjects; /** * @author <a href="mailto:<EMAIL>"><NAME></a> * 8/28/16 */ public class MemoryStatus { @JsonProperty(value = "ps") public long pageSize; @JsonProperty(value = "pt") public long physicalTotal; @JsonProperty(value = "pf") public long physicalFree; @JsonProperty(value = "st") public long swapTotal; @JsonProperty(value = "sf") public long swapFree; @JsonCreator public MemoryStatus(@JsonProperty(value = "ps") long pageSize, @JsonProperty(value = "pt") long physicalTotal, @JsonProperty(value = "pf") long physicalFree, @JsonProperty(value = "st") long swapTotal, @JsonProperty(value = "sf") long swapFree) { this.pageSize = pageSize; this.physicalTotal = physicalTotal; this.physicalFree = physicalFree; this.swapTotal = swapTotal; this.swapFree = swapFree; } public MemoryStatus(MemoryDetails details) { this.pageSize = details.pageSize(); this.physicalTotal = details.physicalTotal(); this.physicalFree = details.physicalFree(); this.swapTotal = details.swapTotal(); this.swapFree = details.swapFree(); } public MemoryDetails toDetails() { return new MemoryDetails(pageSize, physicalTotal, physicalFree, swapTotal, swapFree); } @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; MemoryStatus that = (MemoryStatus) o; if (pageSize != that.pageSize) return false; if (physicalTotal != that.physicalTotal) return false; if (physicalFree != that.physicalFree) return false; if (swapTotal != that.swapTotal) return false; return swapFree == that.swapFree; } @Override public int hashCode() { int result = (int) (pageSize ^ (pageSize >>> 32)); result = 31 * result + (int) (physicalTotal ^ (physicalTotal >>> 32)); result = 31 * result + (int) (physicalFree ^ (physicalFree >>> 32)); result = 31 * result + (int) (swapTotal ^ (swapTotal >>> 32)); result = 31 * result + (int) (swapFree ^ (swapFree >>> 32)); return result; } @Override public String toString() { return MoreObjects.toStringHelper(this) .add("pageSize", pageSize) .add("physicalTotal", physicalTotal) .add("physicalFree", physicalFree) .add("swapTotal", swapTotal) .add("swapFree", swapFree) .toString(); } }
2,900
0.606299
0.598425
84
33.773811
23.650909
93
false
false
0
0
0
0
0
0
0.607143
false
false
7
ae1e925f0bc662790c52cdb1f417c0a67cb71ceb
8,856,222,597,734
c26304a54824faa7c1b34bb7882ee7a335a8e7fb
/flink-python/src/main/java/org/apache/flink/table/runtime/operators/python/aggregate/AbstractPythonStreamGroupAggregateOperator.java
c72f2d51836f26ddfb1c861fd332674f9d075102
[ "BSD-3-Clause", "OFL-1.1", "ISC", "MIT", "Apache-2.0" ]
permissive
apache/flink
https://github.com/apache/flink
905e0709de6389fc9212a7c48a82669706c70b4a
fbef3c22757a2352145599487beb84e02aaeb389
refs/heads/master
2023-09-04T08:11:07.253000
2023-09-04T01:33:25
2023-09-04T01:33:25
20,587,599
23,573
14,781
Apache-2.0
false
2023-09-14T21:49:04
2014-06-07T07:00:10
2023-09-14T11:23:39
2023-09-14T21:49:03
509,428
21,946
12,627
1,090
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.flink.table.runtime.operators.python.aggregate; import org.apache.flink.annotation.Internal; import org.apache.flink.api.common.state.ValueState; import org.apache.flink.api.common.state.ValueStateDescriptor; import org.apache.flink.api.common.typeinfo.Types; import org.apache.flink.api.java.tuple.Tuple3; import org.apache.flink.configuration.Configuration; import org.apache.flink.fnexecution.v1.FlinkFnApi; import org.apache.flink.runtime.state.VoidNamespace; import org.apache.flink.runtime.state.VoidNamespaceSerializer; import org.apache.flink.streaming.api.SimpleTimerService; import org.apache.flink.streaming.api.TimerService; import org.apache.flink.streaming.api.operators.InternalTimer; import org.apache.flink.streaming.api.operators.Triggerable; import org.apache.flink.table.data.GenericRowData; import org.apache.flink.table.data.RowData; import org.apache.flink.table.data.UpdatableRowData; import org.apache.flink.table.functions.python.PythonAggregateFunctionInfo; import org.apache.flink.table.runtime.dataview.DataViewSpec; import org.apache.flink.table.runtime.functions.CleanupState; import org.apache.flink.table.types.logical.BigIntType; import org.apache.flink.table.types.logical.RowType; import org.apache.flink.table.types.logical.TinyIntType; import java.util.ArrayList; import java.util.List; /** * Base class for {@link PythonStreamGroupAggregateOperator} and {@link * PythonStreamGroupTableAggregateOperator}. */ @Internal public abstract class AbstractPythonStreamGroupAggregateOperator extends AbstractPythonStreamAggregateOperator implements Triggerable<RowData, VoidNamespace>, CleanupState { private static final long serialVersionUID = 1L; /** The minimum time in milliseconds until state which was not updated will be retained. */ private final long minRetentionTime; /** The maximum time in milliseconds until state which was not updated will be retained. */ private final long maxRetentionTime; /** * Indicates whether state cleaning is enabled. Can be calculated from the `minRetentionTime`. */ private final boolean stateCleaningEnabled; private transient TimerService timerService; // holds the latest registered cleanup timer private transient ValueState<Long> cleanupTimeState; private transient UpdatableRowData reuseRowData; private transient UpdatableRowData reuseTimerRowData; public AbstractPythonStreamGroupAggregateOperator( Configuration config, RowType inputType, RowType outputType, PythonAggregateFunctionInfo[] aggregateFunctions, DataViewSpec[][] dataViewSpecs, int[] grouping, int indexOfCountStar, boolean generateUpdateBefore, long minRetentionTime, long maxRetentionTime) { super( config, inputType, outputType, aggregateFunctions, dataViewSpecs, grouping, indexOfCountStar, generateUpdateBefore); this.minRetentionTime = minRetentionTime; this.maxRetentionTime = maxRetentionTime; this.stateCleaningEnabled = minRetentionTime > 1; } @Override public void open() throws Exception { // The structure is: [type]|[normal record]|[timestamp of timer]|[row key] // If the type is 'NORMAL_RECORD', store the RowData object in the 2nd column. // If the type is 'TRIGGER_TIMER', store the timestamp in 3rd column and the row key reuseRowData = new UpdatableRowData(GenericRowData.of(NORMAL_RECORD, null, null, null), 4); reuseTimerRowData = new UpdatableRowData(GenericRowData.of(TRIGGER_TIMER, null, null, null), 4); timerService = new SimpleTimerService( getInternalTimerService( "state-clean-timer", VoidNamespaceSerializer.INSTANCE, this)); initCleanupTimeState(); super.open(); } /** Invoked when an event-time timer fires. */ @Override public void onEventTime(InternalTimer<RowData, VoidNamespace> timer) {} /** Invoked when a processing-time timer fires. */ @Override public void onProcessingTime(InternalTimer<RowData, VoidNamespace> timer) throws Exception { if (stateCleaningEnabled) { RowData key = timer.getKey(); long timestamp = timer.getTimestamp(); reuseTimerRowData.setLong(2, timestamp); reuseTimerRowData.setField(3, key); udfInputTypeSerializer.serialize(reuseTimerRowData, baosWrapper); pythonFunctionRunner.process(baos.toByteArray()); baos.reset(); elementCount++; } } @Override public void processElementInternal(RowData value) throws Exception { long currentTime = timerService.currentProcessingTime(); registerProcessingCleanupTimer(currentTime); reuseRowData.setField(1, value); udfInputTypeSerializer.serialize(reuseRowData, baosWrapper); pythonFunctionRunner.process(baos.toByteArray()); baos.reset(); } @Override public void emitResult(Tuple3<String, byte[], Integer> resultTuple) throws Exception { byte[] rawUdfResult = resultTuple.f1; int length = resultTuple.f2; bais.setBuffer(rawUdfResult, 0, length); RowData udfResult = udfOutputTypeSerializer.deserialize(baisWrapper); rowDataWrapper.collect(udfResult); } @Override public RowType createUserDefinedFunctionInputType() { List<RowType.RowField> fields = new ArrayList<>(); fields.add(new RowType.RowField("record_type", new TinyIntType())); fields.add(new RowType.RowField("row", inputType)); fields.add(new RowType.RowField("timestamp", new BigIntType())); fields.add(new RowType.RowField("key", getKeyType())); return new RowType(fields); } @Override public RowType createUserDefinedFunctionOutputType() { return outputType; } @Override protected FlinkFnApi.UserDefinedAggregateFunctions getUserDefinedFunctionsProto() { FlinkFnApi.UserDefinedAggregateFunctions.Builder builder = super.getUserDefinedFunctionsProto().toBuilder(); builder.setStateCleaningEnabled(stateCleaningEnabled); return builder.build(); } private void initCleanupTimeState() { if (stateCleaningEnabled) { ValueStateDescriptor<Long> inputCntDescriptor = new ValueStateDescriptor<>("PythonAggregateCleanupTime", Types.LONG); cleanupTimeState = getRuntimeContext().getState(inputCntDescriptor); } } private void registerProcessingCleanupTimer(long currentTime) throws Exception { if (stateCleaningEnabled) { synchronized (getKeyedStateBackend()) { getKeyedStateBackend().setCurrentKey(getCurrentKey()); registerProcessingCleanupTimer( cleanupTimeState, currentTime, minRetentionTime, maxRetentionTime, timerService); } } } }
UTF-8
Java
8,170
java
AbstractPythonStreamGroupAggregateOperator.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.flink.table.runtime.operators.python.aggregate; import org.apache.flink.annotation.Internal; import org.apache.flink.api.common.state.ValueState; import org.apache.flink.api.common.state.ValueStateDescriptor; import org.apache.flink.api.common.typeinfo.Types; import org.apache.flink.api.java.tuple.Tuple3; import org.apache.flink.configuration.Configuration; import org.apache.flink.fnexecution.v1.FlinkFnApi; import org.apache.flink.runtime.state.VoidNamespace; import org.apache.flink.runtime.state.VoidNamespaceSerializer; import org.apache.flink.streaming.api.SimpleTimerService; import org.apache.flink.streaming.api.TimerService; import org.apache.flink.streaming.api.operators.InternalTimer; import org.apache.flink.streaming.api.operators.Triggerable; import org.apache.flink.table.data.GenericRowData; import org.apache.flink.table.data.RowData; import org.apache.flink.table.data.UpdatableRowData; import org.apache.flink.table.functions.python.PythonAggregateFunctionInfo; import org.apache.flink.table.runtime.dataview.DataViewSpec; import org.apache.flink.table.runtime.functions.CleanupState; import org.apache.flink.table.types.logical.BigIntType; import org.apache.flink.table.types.logical.RowType; import org.apache.flink.table.types.logical.TinyIntType; import java.util.ArrayList; import java.util.List; /** * Base class for {@link PythonStreamGroupAggregateOperator} and {@link * PythonStreamGroupTableAggregateOperator}. */ @Internal public abstract class AbstractPythonStreamGroupAggregateOperator extends AbstractPythonStreamAggregateOperator implements Triggerable<RowData, VoidNamespace>, CleanupState { private static final long serialVersionUID = 1L; /** The minimum time in milliseconds until state which was not updated will be retained. */ private final long minRetentionTime; /** The maximum time in milliseconds until state which was not updated will be retained. */ private final long maxRetentionTime; /** * Indicates whether state cleaning is enabled. Can be calculated from the `minRetentionTime`. */ private final boolean stateCleaningEnabled; private transient TimerService timerService; // holds the latest registered cleanup timer private transient ValueState<Long> cleanupTimeState; private transient UpdatableRowData reuseRowData; private transient UpdatableRowData reuseTimerRowData; public AbstractPythonStreamGroupAggregateOperator( Configuration config, RowType inputType, RowType outputType, PythonAggregateFunctionInfo[] aggregateFunctions, DataViewSpec[][] dataViewSpecs, int[] grouping, int indexOfCountStar, boolean generateUpdateBefore, long minRetentionTime, long maxRetentionTime) { super( config, inputType, outputType, aggregateFunctions, dataViewSpecs, grouping, indexOfCountStar, generateUpdateBefore); this.minRetentionTime = minRetentionTime; this.maxRetentionTime = maxRetentionTime; this.stateCleaningEnabled = minRetentionTime > 1; } @Override public void open() throws Exception { // The structure is: [type]|[normal record]|[timestamp of timer]|[row key] // If the type is 'NORMAL_RECORD', store the RowData object in the 2nd column. // If the type is 'TRIGGER_TIMER', store the timestamp in 3rd column and the row key reuseRowData = new UpdatableRowData(GenericRowData.of(NORMAL_RECORD, null, null, null), 4); reuseTimerRowData = new UpdatableRowData(GenericRowData.of(TRIGGER_TIMER, null, null, null), 4); timerService = new SimpleTimerService( getInternalTimerService( "state-clean-timer", VoidNamespaceSerializer.INSTANCE, this)); initCleanupTimeState(); super.open(); } /** Invoked when an event-time timer fires. */ @Override public void onEventTime(InternalTimer<RowData, VoidNamespace> timer) {} /** Invoked when a processing-time timer fires. */ @Override public void onProcessingTime(InternalTimer<RowData, VoidNamespace> timer) throws Exception { if (stateCleaningEnabled) { RowData key = timer.getKey(); long timestamp = timer.getTimestamp(); reuseTimerRowData.setLong(2, timestamp); reuseTimerRowData.setField(3, key); udfInputTypeSerializer.serialize(reuseTimerRowData, baosWrapper); pythonFunctionRunner.process(baos.toByteArray()); baos.reset(); elementCount++; } } @Override public void processElementInternal(RowData value) throws Exception { long currentTime = timerService.currentProcessingTime(); registerProcessingCleanupTimer(currentTime); reuseRowData.setField(1, value); udfInputTypeSerializer.serialize(reuseRowData, baosWrapper); pythonFunctionRunner.process(baos.toByteArray()); baos.reset(); } @Override public void emitResult(Tuple3<String, byte[], Integer> resultTuple) throws Exception { byte[] rawUdfResult = resultTuple.f1; int length = resultTuple.f2; bais.setBuffer(rawUdfResult, 0, length); RowData udfResult = udfOutputTypeSerializer.deserialize(baisWrapper); rowDataWrapper.collect(udfResult); } @Override public RowType createUserDefinedFunctionInputType() { List<RowType.RowField> fields = new ArrayList<>(); fields.add(new RowType.RowField("record_type", new TinyIntType())); fields.add(new RowType.RowField("row", inputType)); fields.add(new RowType.RowField("timestamp", new BigIntType())); fields.add(new RowType.RowField("key", getKeyType())); return new RowType(fields); } @Override public RowType createUserDefinedFunctionOutputType() { return outputType; } @Override protected FlinkFnApi.UserDefinedAggregateFunctions getUserDefinedFunctionsProto() { FlinkFnApi.UserDefinedAggregateFunctions.Builder builder = super.getUserDefinedFunctionsProto().toBuilder(); builder.setStateCleaningEnabled(stateCleaningEnabled); return builder.build(); } private void initCleanupTimeState() { if (stateCleaningEnabled) { ValueStateDescriptor<Long> inputCntDescriptor = new ValueStateDescriptor<>("PythonAggregateCleanupTime", Types.LONG); cleanupTimeState = getRuntimeContext().getState(inputCntDescriptor); } } private void registerProcessingCleanupTimer(long currentTime) throws Exception { if (stateCleaningEnabled) { synchronized (getKeyedStateBackend()) { getKeyedStateBackend().setCurrentKey(getCurrentKey()); registerProcessingCleanupTimer( cleanupTimeState, currentTime, minRetentionTime, maxRetentionTime, timerService); } } } }
8,170
0.694492
0.692166
201
39.646767
27.182076
99
false
false
0
0
0
0
0
0
0.661692
false
false
7
de5bf1e553d42d701f97b6ce0efe19c7cba65e68
25,099,788,900,738
3bad5ecbdf2e72c4d7bc3316fa5854732f63fe1f
/src/ca/wlu/gisql/ast/util/VariableInformation.java
df6bfaac1da34e09ef084069d63a62699c9624ba
[]
no_license
apmasell/gisql
https://github.com/apmasell/gisql
73b3afe3e049cd443dee3bc029e05a7d5eca20f8
b27d68c45c2fb6078b4d53a89251c3e3249ce08d
refs/heads/master
2021-01-10T20:47:18.989000
2010-11-12T23:15:44
2010-11-12T23:15:44
2,296,700
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ca.wlu.gisql.ast.util; import ca.wlu.gisql.ast.type.Type; public class VariableInformation { private final String name; private final Type type; public VariableInformation(String name, Type type) { super(); this.name = name; this.type = type; } public String getInternalName() { return org.objectweb.asm.Type.getInternalName(type.getRootJavaType()); } public String getName() { return name; } public Type getType() { return type; } }
UTF-8
Java
472
java
VariableInformation.java
Java
[]
null
[]
package ca.wlu.gisql.ast.util; import ca.wlu.gisql.ast.type.Type; public class VariableInformation { private final String name; private final Type type; public VariableInformation(String name, Type type) { super(); this.name = name; this.type = type; } public String getInternalName() { return org.objectweb.asm.Type.getInternalName(type.getRootJavaType()); } public String getName() { return name; } public Type getType() { return type; } }
472
0.713983
0.713983
28
15.857142
18.084553
72
false
false
0
0
0
0
0
0
1.178571
false
false
7
34cf4bb77f9888f2c7a2abc92039b96d1ed2aca6
29,360,396,459,872
526642a223d397d03974831e671eb035bf7d249e
/app/src/main/java/com/ameer/messages/services/NotificationService.java
68bcf604f53ccaac6b00cef0bfd85b59d1240c1f
[]
no_license
k0d3x/Messages
https://github.com/k0d3x/Messages
6afae3a962201b8d559ca1396c470171491d4f76
106af59468703be4a33daa274d2e2583f566f10e
refs/heads/master
2020-04-16T15:22:17.991000
2019-01-18T12:51:09
2019-01-18T12:51:09
165,698,280
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ameer.messages.services; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.Service; import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; import android.content.Intent; import android.os.IBinder; import android.support.v4.app.NotificationCompat; import android.util.Log; import android.widget.RemoteViews; import android.widget.Toast; import com.ameer.messages.R; import com.ameer.messages.activities.MainActivity; import com.ameer.messages.utils.NotificationHelper; public class NotificationService extends Service { Intent mIntent; NotificationHelper mNotificationHelper; @Override public IBinder onBind(Intent intent) { return null; } @Override public void onDestroy() { super.onDestroy(); } @Override public int onStartCommand(Intent intent, int flags, int startId) { if (intent.getAction().equals("copy.OTP")) { ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE); ClipData clip = ClipData.newPlainText("otp", intent.getStringExtra("message")); clipboard.setPrimaryClip(clip); Toast.makeText(this, "OTP Copied"+intent.getStringExtra("message"), Toast.LENGTH_SHORT).show(); } else if (intent.getAction().equals("start.service")) { Toast.makeText(this, "Service started", Toast.LENGTH_SHORT).show(); mIntent = intent; } else if(intent.getAction().equals("show_notification")) { mNotificationHelper = new NotificationHelper(this); Log.d("mia", "onReceive: show_notification"); String message = intent.getStringExtra("message"); String address = intent.getStringExtra("contact"); int type = intent.getIntExtra("type",0); showNotification(type,message,address); Toast.makeText(this,"Showing Notification",Toast.LENGTH_SHORT).show(); } return START_STICKY; } public void showNotification(int type,String message, String address){ if(type == 1){ RemoteViews views = new RemoteViews(getPackageName(), R.layout.otp_notification); views.setTextViewText(R.id.otp_text,message); Intent copyIntent = new Intent(this, NotificationService.class); copyIntent.setAction("copy.OTP"); copyIntent.putExtra("message",message); PendingIntent copyPendingIntent = PendingIntent.getService(this, 1, copyIntent, 0); views.setOnClickPendingIntent(R.id.copy_otp, copyPendingIntent); views.setImageViewResource(R.id.contact,R.drawable.icon_contact); NotificationCompat.Builder b = new NotificationCompat.Builder(getApplicationContext(),NotificationHelper.channel1ID); b.setContent(views); b.setSmallIcon(R.drawable.icon_contact); NotificationManager notificationManager = mNotificationHelper.getManager(); notificationManager.notify(1, b.build()); }else if(type == 2){ RemoteViews views = new RemoteViews(getPackageName(), R.layout.default_notificatiion); views.setImageViewResource(R.id.contact,R.drawable.icon_contact); views.setTextViewText(R.id.title,"Message from: "+address); views.setTextViewText(R.id.notification_message,message); Intent homeIntent = new Intent(getApplicationContext(),MainActivity.class); PendingIntent intent = PendingIntent.getService(this,1, homeIntent,PendingIntent.FLAG_UPDATE_CURRENT); NotificationCompat.Builder b = new NotificationCompat.Builder(getApplicationContext(),NotificationHelper.channel2ID); b.setSmallIcon(R.drawable.icon_contact); b.setContent(views); b.setAutoCancel(true); b.setContentIntent(intent); Notification notification = b.build(); notification.flags |= Notification.FLAG_AUTO_CANCEL; notification.defaults |= Notification.DEFAULT_SOUND; notification.defaults |= Notification.DEFAULT_VIBRATE; NotificationManager notificationManager = mNotificationHelper.getManager(); notificationManager.notify(2, notification); } } }
UTF-8
Java
4,467
java
NotificationService.java
Java
[]
null
[]
package com.ameer.messages.services; import android.app.Notification; import android.app.NotificationManager; import android.app.PendingIntent; import android.app.Service; import android.content.ClipData; import android.content.ClipboardManager; import android.content.Context; import android.content.Intent; import android.os.IBinder; import android.support.v4.app.NotificationCompat; import android.util.Log; import android.widget.RemoteViews; import android.widget.Toast; import com.ameer.messages.R; import com.ameer.messages.activities.MainActivity; import com.ameer.messages.utils.NotificationHelper; public class NotificationService extends Service { Intent mIntent; NotificationHelper mNotificationHelper; @Override public IBinder onBind(Intent intent) { return null; } @Override public void onDestroy() { super.onDestroy(); } @Override public int onStartCommand(Intent intent, int flags, int startId) { if (intent.getAction().equals("copy.OTP")) { ClipboardManager clipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE); ClipData clip = ClipData.newPlainText("otp", intent.getStringExtra("message")); clipboard.setPrimaryClip(clip); Toast.makeText(this, "OTP Copied"+intent.getStringExtra("message"), Toast.LENGTH_SHORT).show(); } else if (intent.getAction().equals("start.service")) { Toast.makeText(this, "Service started", Toast.LENGTH_SHORT).show(); mIntent = intent; } else if(intent.getAction().equals("show_notification")) { mNotificationHelper = new NotificationHelper(this); Log.d("mia", "onReceive: show_notification"); String message = intent.getStringExtra("message"); String address = intent.getStringExtra("contact"); int type = intent.getIntExtra("type",0); showNotification(type,message,address); Toast.makeText(this,"Showing Notification",Toast.LENGTH_SHORT).show(); } return START_STICKY; } public void showNotification(int type,String message, String address){ if(type == 1){ RemoteViews views = new RemoteViews(getPackageName(), R.layout.otp_notification); views.setTextViewText(R.id.otp_text,message); Intent copyIntent = new Intent(this, NotificationService.class); copyIntent.setAction("copy.OTP"); copyIntent.putExtra("message",message); PendingIntent copyPendingIntent = PendingIntent.getService(this, 1, copyIntent, 0); views.setOnClickPendingIntent(R.id.copy_otp, copyPendingIntent); views.setImageViewResource(R.id.contact,R.drawable.icon_contact); NotificationCompat.Builder b = new NotificationCompat.Builder(getApplicationContext(),NotificationHelper.channel1ID); b.setContent(views); b.setSmallIcon(R.drawable.icon_contact); NotificationManager notificationManager = mNotificationHelper.getManager(); notificationManager.notify(1, b.build()); }else if(type == 2){ RemoteViews views = new RemoteViews(getPackageName(), R.layout.default_notificatiion); views.setImageViewResource(R.id.contact,R.drawable.icon_contact); views.setTextViewText(R.id.title,"Message from: "+address); views.setTextViewText(R.id.notification_message,message); Intent homeIntent = new Intent(getApplicationContext(),MainActivity.class); PendingIntent intent = PendingIntent.getService(this,1, homeIntent,PendingIntent.FLAG_UPDATE_CURRENT); NotificationCompat.Builder b = new NotificationCompat.Builder(getApplicationContext(),NotificationHelper.channel2ID); b.setSmallIcon(R.drawable.icon_contact); b.setContent(views); b.setAutoCancel(true); b.setContentIntent(intent); Notification notification = b.build(); notification.flags |= Notification.FLAG_AUTO_CANCEL; notification.defaults |= Notification.DEFAULT_SOUND; notification.defaults |= Notification.DEFAULT_VIBRATE; NotificationManager notificationManager = mNotificationHelper.getManager(); notificationManager.notify(2, notification); } } }
4,467
0.67495
0.672487
103
42.368931
29.93358
129
false
false
0
0
0
0
0
0
1.009709
false
false
7
08b39cd795dbfabee911b255f913cda3c42995ea
8,452,495,638,682
80de7fb416a0560f4ca978d3a1785587010849c4
/SifemCore/src/main/java/eu/sifem/simulation/configuration/PakSolverControlerService.java
3cceb2e88c259b40d56823c55bffdd738fdb0f17
[]
no_license
phasapis/sfmmain
https://github.com/phasapis/sfmmain
333ded7e0ae0428cb27c3a1565b0f693f0c12904
5e14a770c868a3c03e19de2626eeacf01e68b762
refs/heads/master
2016-08-09T13:48:36.819000
2016-03-04T14:49:24
2016-03-04T14:49:24
46,035,878
1
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package eu.sifem.simulation.configuration; import java.io.InputStream; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import eu.sifem.model.to.AsyncTripleStoreInsertMessageTO; import eu.sifem.model.to.CenterlineTO; import eu.sifem.model.to.DatAndUnvSolverTO; import eu.sifem.model.to.PAKCRestServiceTO; import eu.sifem.model.to.PimagTO; import eu.sifem.model.to.PrealTO; import eu.sifem.model.to.ProcessTO; import eu.sifem.model.to.Simple2DGraphTO; import eu.sifem.model.to.SimulationInstanceTO; import eu.sifem.model.to.SolverResultFilesTO; import eu.sifem.model.to.SolverResultXYGraphTO; import eu.sifem.model.to.VmagnTO; import eu.sifem.model.to.VphaseTO; import eu.sifem.service.IPakRDFMapperService; import eu.sifem.service.IPakSolverControlerService; import eu.sifem.service.IResourceInjectionService; import eu.sifem.service.dao.IConfigFileDAOService; import eu.sifem.service.dao.IDatAndUnvSolverDAOService; import eu.sifem.service.dao.IProcessDAOService; import eu.sifem.service.dao.ISolverResultFilesDAO; import eu.sifem.utils.BasicFileTools; /** * * @author jbjares * */ @Service(value = "pakSolverControlerService") public class PakSolverControlerService implements IPakSolverControlerService { @Autowired private IPakRDFMapperService pakRDFMapper; @Autowired private IResourceInjectionService resourceInjectionService; @Autowired private IConfigFileDAOService configFileDAO; @Autowired private IDatAndUnvSolverDAOService datAndUnvSolverDAOService; @Autowired private IProcessDAOService processDAOService; @Autowired private IDatAndUnvSolverDAOService datAndUnvSolverDAO; @Autowired private ISolverResultFilesDAO solverResultFilesDAO; //TODO Deprecating.. // @Override // public void runPakcSolverService(SimulationInstanceTO simulationInstanceTO, SessionIndexTO sessionIndexTO) throws Exception { // // int instanceNumbers = new Util().getInstacesNumberByConfigSessionID(sessionIndexTO.getCfgSessionIdList().get(0)); // for(int i=0;i<instanceNumbers;i++){ // String instanceName = "instance_"+i; // simulationInstanceTO.setInstanceName(instanceName); // configFileDAO.updateInstanceName(simulationInstanceTO.getProjectName(),simulationInstanceTO.getSimulationName(),instanceName); // List<InputStream> cfgIs = configFileDAO.findCFGFile(simulationInstanceTO.getProjectName(),simulationInstanceTO.getSimulationName(),instanceName); // if(cfgIs==null){ // cfgIs = configFileDAO.findCFGFile(simulationInstanceTO.getProjectName(),simulationInstanceTO.getSimulationName()); // } // if(cfgIs==null){ // return; // } // for(InputStream is: cfgIs){ // PAKCRestServiceTO result = callService(is); // DatAndUnvSolverTO datAndUnvSolverTO = new DatAndUnvSolverTO(); // datAndUnvSolverTO.setProjectName(simulationInstanceTO.getProjectName()); // datAndUnvSolverTO.setSimulationName(simulationInstanceTO.getSimulationName()); // datAndUnvSolverTO.setInstanceName(instanceName); // // InputStream datIs = new ByteArrayInputStream(result.getDatFile()); // datAndUnvSolverTO.setDatFile(datIs); // // InputStream unvIs = new ByteArrayInputStream(result.getUnvFile()); // datAndUnvSolverTO.setUnvFile(unvIs); // datAndUnvSolverDAOService.insert(datAndUnvSolverTO); // } // } // // // } // // // // // private PAKCRestServiceTO callService(InputStream cfgFileIs) throws Exception { // byte[] cfgFileByteArr = IOUtils.toByteArray(cfgFileIs); // return callService(cfgFileByteArr); // } public IPakRDFMapperService getPakRDFMapper() { return pakRDFMapper; } public void setPakRDFMapper(IPakRDFMapperService pakRDFMapper) { this.pakRDFMapper = pakRDFMapper; } @Override public List<AsyncTripleStoreInsertMessageTO> semantifyOutputService(SimulationInstanceTO simulationInstanceTO,List<DatAndUnvSolverTO> datAndUnvSolverTOList) throws Exception { List<AsyncTripleStoreInsertMessageTO> asyncTripleStoreInsertMessageTOList = new ArrayList<AsyncTripleStoreInsertMessageTO>(); AsyncTripleStoreInsertMessageTO asyncTripleStoreInsertMessageTO = new AsyncTripleStoreInsertMessageTO(); List<InputStream> semantificationFiles = new ArrayList<InputStream>(); for(DatAndUnvSolverTO datAndUnvSolverTO:datAndUnvSolverTOList){ InputStream datIs = datAndUnvSolverDAO.findDatFileByProjectName(datAndUnvSolverTO.getProjectName(),datAndUnvSolverTO.getSimulationName(),datAndUnvSolverTO.getInstanceName()); InputStream unvIs = datAndUnvSolverDAO.findUnvFileByProjectName(datAndUnvSolverTO.getProjectName(),datAndUnvSolverTO.getSimulationName(),datAndUnvSolverTO.getInstanceName()); System.err.println(" --- " + datAndUnvSolverTO.getProjectName() + " " + datAndUnvSolverTO.getSimulationName() + " " + datAndUnvSolverTO.getInstanceName()); //dat InputStream datTTLFile = pakRDFMapper.datToRDFService(simulationInstanceTO,datIs); semantificationFiles.add(datTTLFile); asyncTripleStoreInsertMessageTO.getTripleFiles().put("dat", datTTLFile); //unv InputStream unvTTLFile = pakRDFMapper.unvToRDFService(simulationInstanceTO,unvIs); semantificationFiles.add(unvTTLFile); asyncTripleStoreInsertMessageTO.getTripleFiles().put("unv", unvTTLFile); asyncTripleStoreInsertMessageTO.getSemantificationFiles().addAll(semantificationFiles); asyncTripleStoreInsertMessageTOList.add(asyncTripleStoreInsertMessageTO); } return asyncTripleStoreInsertMessageTOList; } @Override public void saveOrUpdateProcessStatus(ProcessTO sifemProcess) { processDAOService.saveOrUpdate(sifemProcess); } @Override public SolverResultXYGraphTO showResultGraphs(String projectID,String simulationID,Boolean isInsert) throws Exception { //SolverResultFilesTO solverResultFilesTO = solverResultFilesDAO.findByProjectID(projectID); SolverResultFilesTO solverResultFilesTO = solverResultFilesDAO.findByProjectAndSimulationID(projectID,simulationID); SolverResultXYGraphTO solverResultXYGraphTO = parseStreamsToWrapperObjects(solverResultFilesTO,isInsert,projectID,simulationID); return solverResultXYGraphTO; } @Override public SolverResultXYGraphTO parseStreamsToWrapperObjects(SolverResultFilesTO solverResultFilesTO,Boolean isInsert, String projectID, String simulationID) throws Exception { solverResultFilesTO = solverResultFilesDAO.findByProjectAndSimulationID(projectID, simulationID); // if(solverResultFilesTO==null || solverResultFilesTO.get_id()==null || // solverResultFilesTO.getDcenterlineFile()==null || // solverResultFilesTO.getPimagFile()==null || // solverResultFilesTO.getPrealFile()==null || // solverResultFilesTO.getVmagnFile()==null || // solverResultFilesTO.getVphaseFile()==null){ // solverResultFilesTO = new SolverResultFilesTO(); // // InputStream dcenterlineIS = dCenterLineFile(null); // InputStream pImagIS = pImagFile(null); // InputStream pRealIS = pRealFile(null); // InputStream vMagnIS = vMagnFile(null); // InputStream vPhaseIS = vPhaseFile(null); // // solverResultFilesTO.setDcenterlineFile(dcenterlineIS); // solverResultFilesTO.setPimagFile(pImagIS); // solverResultFilesTO.setPrealFile(pRealIS); // solverResultFilesTO.setVmagnFile(vMagnIS); // solverResultFilesTO.setVphaseFile(vPhaseIS); // // if(isInsert){ // solverResultFilesTO.setProjectID(projectID); // solverResultFilesTO.setSimulationID(simulationID); // solverResultFilesDAO.insert(solverResultFilesTO); // } // } //solverResultFilesTO = solverResultFilesDAO.findByProjectID(projectID); //String dcenterStr = IOUtils.toString(solverResultFilesTO.getDcenterlineFile(),"UTF-8"); String dcenterStr = BasicFileTools.extractText(solverResultFilesTO.getDcenterlineFile()); String pimagStr = BasicFileTools.extractText(solverResultFilesTO.getPimagFile()); String prealStr = BasicFileTools.extractText(solverResultFilesTO.getPrealFile()); String vmagnStr = BasicFileTools.extractText(solverResultFilesTO.getVmagnFile()); String vphaseStr = BasicFileTools.extractText(solverResultFilesTO.getVphaseFile()); CenterlineTO centerlineTO = (CenterlineTO) graphWrapper(dcenterStr.trim(),CenterlineTO.class.getCanonicalName()); PimagTO pimagTO = (PimagTO) graphWrapper(pimagStr.trim(),PimagTO.class.getCanonicalName()); PrealTO prealTO = (PrealTO) graphWrapper(prealStr.trim(),PrealTO.class.getCanonicalName()); VmagnTO vmagnTO = (VmagnTO) graphWrapper(vmagnStr.trim(),VmagnTO.class.getCanonicalName()); VphaseTO vphaseTO = (VphaseTO) graphWrapper(vphaseStr.trim(),VphaseTO.class.getCanonicalName()); SolverResultXYGraphTO solverResultXYGraphTO = new SolverResultXYGraphTO(); solverResultXYGraphTO.setProjectID(solverResultFilesTO.getProjectID()); solverResultXYGraphTO.setCenterlineTO(centerlineTO); solverResultXYGraphTO.setPimagTO(pimagTO); solverResultXYGraphTO.setPrealTO(prealTO); solverResultXYGraphTO.setVmagnTO(vmagnTO); solverResultXYGraphTO.setVphaseTO(vphaseTO); return solverResultXYGraphTO; } private Object graphWrapper(String graphStr,String clazz) throws InstantiationException, IllegalAccessException, ClassNotFoundException { Object obj = Class.forName(clazz).newInstance(); graphStr = graphStr.trim(); int count = 1; List<String> items = Arrays.asList(graphStr.split("\\s*,\\s*")); HashMap<Double, Double> xyMap = new HashMap<Double, Double>(); Double previousKey = null; for(String value:items){ if(!isNum(value)){ continue; } Boolean isX = (count%2)==0; if(!isX){ previousKey = Double.parseDouble(value); xyMap.put(Double.parseDouble(value),null); }else{ Double previousValue = xyMap.get(previousKey); if(previousKey!=null || previousValue==null){ xyMap.put(previousKey,Double.parseDouble(value)); } } count++; } ((Simple2DGraphTO)obj).getXyMap().putAll(xyMap); return obj; } public static boolean isNum(String strNum) { boolean ret = true; try { Double.parseDouble(strNum); }catch (NumberFormatException e) { ret = false; } return ret; } //TODO could be removed after Panos' service is ready public InputStream pImagFile(PAKCRestServiceTO simulationInstance) throws Exception{ InputStream in = this.getClass().getClassLoader().getResourceAsStream(PIMAG_LOCAL_FILE); return BasicFileTools.getFileAsMock(null,in); } public InputStream dCenterLineFile(PAKCRestServiceTO simulationInstance) throws Exception{ InputStream in = this.getClass().getClassLoader().getResourceAsStream(DCENTERLINE_LOCAL_FILE); return BasicFileTools.getFileAsMock(null,in); } public InputStream pRealFile(PAKCRestServiceTO simulationInstance) throws Exception{ InputStream in = this.getClass().getClassLoader().getResourceAsStream(PREAL_LOCAL_FILE); return BasicFileTools.getFileAsMock(null,in); } public InputStream vMagnFile(PAKCRestServiceTO simulationInstance) throws Exception{ InputStream in = this.getClass().getClassLoader().getResourceAsStream(VMAGN_LOCAL_FILE); return BasicFileTools.getFileAsMock(null,in); } public InputStream vPhaseFile(PAKCRestServiceTO simulationInstance) throws Exception{ InputStream in = this.getClass().getClassLoader().getResourceAsStream(VPHASE_LOCAL_FILE); return BasicFileTools.getFileAsMock(null,in); } }
UTF-8
Java
11,922
java
PakSolverControlerService.java
Java
[ { "context": "em.utils.BasicFileTools;\r\n\r\n\r\n/**\r\n * \r\n * @author jbjares\r\n * \r\n */\r\n@Service(value = \"pakSolverControlerSe", "end": 1445, "score": 0.9992915391921997, "start": 1438, "tag": "USERNAME", "value": "jbjares" } ]
null
[]
package eu.sifem.simulation.configuration; import java.io.InputStream; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.LinkedList; import java.util.List; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import eu.sifem.model.to.AsyncTripleStoreInsertMessageTO; import eu.sifem.model.to.CenterlineTO; import eu.sifem.model.to.DatAndUnvSolverTO; import eu.sifem.model.to.PAKCRestServiceTO; import eu.sifem.model.to.PimagTO; import eu.sifem.model.to.PrealTO; import eu.sifem.model.to.ProcessTO; import eu.sifem.model.to.Simple2DGraphTO; import eu.sifem.model.to.SimulationInstanceTO; import eu.sifem.model.to.SolverResultFilesTO; import eu.sifem.model.to.SolverResultXYGraphTO; import eu.sifem.model.to.VmagnTO; import eu.sifem.model.to.VphaseTO; import eu.sifem.service.IPakRDFMapperService; import eu.sifem.service.IPakSolverControlerService; import eu.sifem.service.IResourceInjectionService; import eu.sifem.service.dao.IConfigFileDAOService; import eu.sifem.service.dao.IDatAndUnvSolverDAOService; import eu.sifem.service.dao.IProcessDAOService; import eu.sifem.service.dao.ISolverResultFilesDAO; import eu.sifem.utils.BasicFileTools; /** * * @author jbjares * */ @Service(value = "pakSolverControlerService") public class PakSolverControlerService implements IPakSolverControlerService { @Autowired private IPakRDFMapperService pakRDFMapper; @Autowired private IResourceInjectionService resourceInjectionService; @Autowired private IConfigFileDAOService configFileDAO; @Autowired private IDatAndUnvSolverDAOService datAndUnvSolverDAOService; @Autowired private IProcessDAOService processDAOService; @Autowired private IDatAndUnvSolverDAOService datAndUnvSolverDAO; @Autowired private ISolverResultFilesDAO solverResultFilesDAO; //TODO Deprecating.. // @Override // public void runPakcSolverService(SimulationInstanceTO simulationInstanceTO, SessionIndexTO sessionIndexTO) throws Exception { // // int instanceNumbers = new Util().getInstacesNumberByConfigSessionID(sessionIndexTO.getCfgSessionIdList().get(0)); // for(int i=0;i<instanceNumbers;i++){ // String instanceName = "instance_"+i; // simulationInstanceTO.setInstanceName(instanceName); // configFileDAO.updateInstanceName(simulationInstanceTO.getProjectName(),simulationInstanceTO.getSimulationName(),instanceName); // List<InputStream> cfgIs = configFileDAO.findCFGFile(simulationInstanceTO.getProjectName(),simulationInstanceTO.getSimulationName(),instanceName); // if(cfgIs==null){ // cfgIs = configFileDAO.findCFGFile(simulationInstanceTO.getProjectName(),simulationInstanceTO.getSimulationName()); // } // if(cfgIs==null){ // return; // } // for(InputStream is: cfgIs){ // PAKCRestServiceTO result = callService(is); // DatAndUnvSolverTO datAndUnvSolverTO = new DatAndUnvSolverTO(); // datAndUnvSolverTO.setProjectName(simulationInstanceTO.getProjectName()); // datAndUnvSolverTO.setSimulationName(simulationInstanceTO.getSimulationName()); // datAndUnvSolverTO.setInstanceName(instanceName); // // InputStream datIs = new ByteArrayInputStream(result.getDatFile()); // datAndUnvSolverTO.setDatFile(datIs); // // InputStream unvIs = new ByteArrayInputStream(result.getUnvFile()); // datAndUnvSolverTO.setUnvFile(unvIs); // datAndUnvSolverDAOService.insert(datAndUnvSolverTO); // } // } // // // } // // // // // private PAKCRestServiceTO callService(InputStream cfgFileIs) throws Exception { // byte[] cfgFileByteArr = IOUtils.toByteArray(cfgFileIs); // return callService(cfgFileByteArr); // } public IPakRDFMapperService getPakRDFMapper() { return pakRDFMapper; } public void setPakRDFMapper(IPakRDFMapperService pakRDFMapper) { this.pakRDFMapper = pakRDFMapper; } @Override public List<AsyncTripleStoreInsertMessageTO> semantifyOutputService(SimulationInstanceTO simulationInstanceTO,List<DatAndUnvSolverTO> datAndUnvSolverTOList) throws Exception { List<AsyncTripleStoreInsertMessageTO> asyncTripleStoreInsertMessageTOList = new ArrayList<AsyncTripleStoreInsertMessageTO>(); AsyncTripleStoreInsertMessageTO asyncTripleStoreInsertMessageTO = new AsyncTripleStoreInsertMessageTO(); List<InputStream> semantificationFiles = new ArrayList<InputStream>(); for(DatAndUnvSolverTO datAndUnvSolverTO:datAndUnvSolverTOList){ InputStream datIs = datAndUnvSolverDAO.findDatFileByProjectName(datAndUnvSolverTO.getProjectName(),datAndUnvSolverTO.getSimulationName(),datAndUnvSolverTO.getInstanceName()); InputStream unvIs = datAndUnvSolverDAO.findUnvFileByProjectName(datAndUnvSolverTO.getProjectName(),datAndUnvSolverTO.getSimulationName(),datAndUnvSolverTO.getInstanceName()); System.err.println(" --- " + datAndUnvSolverTO.getProjectName() + " " + datAndUnvSolverTO.getSimulationName() + " " + datAndUnvSolverTO.getInstanceName()); //dat InputStream datTTLFile = pakRDFMapper.datToRDFService(simulationInstanceTO,datIs); semantificationFiles.add(datTTLFile); asyncTripleStoreInsertMessageTO.getTripleFiles().put("dat", datTTLFile); //unv InputStream unvTTLFile = pakRDFMapper.unvToRDFService(simulationInstanceTO,unvIs); semantificationFiles.add(unvTTLFile); asyncTripleStoreInsertMessageTO.getTripleFiles().put("unv", unvTTLFile); asyncTripleStoreInsertMessageTO.getSemantificationFiles().addAll(semantificationFiles); asyncTripleStoreInsertMessageTOList.add(asyncTripleStoreInsertMessageTO); } return asyncTripleStoreInsertMessageTOList; } @Override public void saveOrUpdateProcessStatus(ProcessTO sifemProcess) { processDAOService.saveOrUpdate(sifemProcess); } @Override public SolverResultXYGraphTO showResultGraphs(String projectID,String simulationID,Boolean isInsert) throws Exception { //SolverResultFilesTO solverResultFilesTO = solverResultFilesDAO.findByProjectID(projectID); SolverResultFilesTO solverResultFilesTO = solverResultFilesDAO.findByProjectAndSimulationID(projectID,simulationID); SolverResultXYGraphTO solverResultXYGraphTO = parseStreamsToWrapperObjects(solverResultFilesTO,isInsert,projectID,simulationID); return solverResultXYGraphTO; } @Override public SolverResultXYGraphTO parseStreamsToWrapperObjects(SolverResultFilesTO solverResultFilesTO,Boolean isInsert, String projectID, String simulationID) throws Exception { solverResultFilesTO = solverResultFilesDAO.findByProjectAndSimulationID(projectID, simulationID); // if(solverResultFilesTO==null || solverResultFilesTO.get_id()==null || // solverResultFilesTO.getDcenterlineFile()==null || // solverResultFilesTO.getPimagFile()==null || // solverResultFilesTO.getPrealFile()==null || // solverResultFilesTO.getVmagnFile()==null || // solverResultFilesTO.getVphaseFile()==null){ // solverResultFilesTO = new SolverResultFilesTO(); // // InputStream dcenterlineIS = dCenterLineFile(null); // InputStream pImagIS = pImagFile(null); // InputStream pRealIS = pRealFile(null); // InputStream vMagnIS = vMagnFile(null); // InputStream vPhaseIS = vPhaseFile(null); // // solverResultFilesTO.setDcenterlineFile(dcenterlineIS); // solverResultFilesTO.setPimagFile(pImagIS); // solverResultFilesTO.setPrealFile(pRealIS); // solverResultFilesTO.setVmagnFile(vMagnIS); // solverResultFilesTO.setVphaseFile(vPhaseIS); // // if(isInsert){ // solverResultFilesTO.setProjectID(projectID); // solverResultFilesTO.setSimulationID(simulationID); // solverResultFilesDAO.insert(solverResultFilesTO); // } // } //solverResultFilesTO = solverResultFilesDAO.findByProjectID(projectID); //String dcenterStr = IOUtils.toString(solverResultFilesTO.getDcenterlineFile(),"UTF-8"); String dcenterStr = BasicFileTools.extractText(solverResultFilesTO.getDcenterlineFile()); String pimagStr = BasicFileTools.extractText(solverResultFilesTO.getPimagFile()); String prealStr = BasicFileTools.extractText(solverResultFilesTO.getPrealFile()); String vmagnStr = BasicFileTools.extractText(solverResultFilesTO.getVmagnFile()); String vphaseStr = BasicFileTools.extractText(solverResultFilesTO.getVphaseFile()); CenterlineTO centerlineTO = (CenterlineTO) graphWrapper(dcenterStr.trim(),CenterlineTO.class.getCanonicalName()); PimagTO pimagTO = (PimagTO) graphWrapper(pimagStr.trim(),PimagTO.class.getCanonicalName()); PrealTO prealTO = (PrealTO) graphWrapper(prealStr.trim(),PrealTO.class.getCanonicalName()); VmagnTO vmagnTO = (VmagnTO) graphWrapper(vmagnStr.trim(),VmagnTO.class.getCanonicalName()); VphaseTO vphaseTO = (VphaseTO) graphWrapper(vphaseStr.trim(),VphaseTO.class.getCanonicalName()); SolverResultXYGraphTO solverResultXYGraphTO = new SolverResultXYGraphTO(); solverResultXYGraphTO.setProjectID(solverResultFilesTO.getProjectID()); solverResultXYGraphTO.setCenterlineTO(centerlineTO); solverResultXYGraphTO.setPimagTO(pimagTO); solverResultXYGraphTO.setPrealTO(prealTO); solverResultXYGraphTO.setVmagnTO(vmagnTO); solverResultXYGraphTO.setVphaseTO(vphaseTO); return solverResultXYGraphTO; } private Object graphWrapper(String graphStr,String clazz) throws InstantiationException, IllegalAccessException, ClassNotFoundException { Object obj = Class.forName(clazz).newInstance(); graphStr = graphStr.trim(); int count = 1; List<String> items = Arrays.asList(graphStr.split("\\s*,\\s*")); HashMap<Double, Double> xyMap = new HashMap<Double, Double>(); Double previousKey = null; for(String value:items){ if(!isNum(value)){ continue; } Boolean isX = (count%2)==0; if(!isX){ previousKey = Double.parseDouble(value); xyMap.put(Double.parseDouble(value),null); }else{ Double previousValue = xyMap.get(previousKey); if(previousKey!=null || previousValue==null){ xyMap.put(previousKey,Double.parseDouble(value)); } } count++; } ((Simple2DGraphTO)obj).getXyMap().putAll(xyMap); return obj; } public static boolean isNum(String strNum) { boolean ret = true; try { Double.parseDouble(strNum); }catch (NumberFormatException e) { ret = false; } return ret; } //TODO could be removed after Panos' service is ready public InputStream pImagFile(PAKCRestServiceTO simulationInstance) throws Exception{ InputStream in = this.getClass().getClassLoader().getResourceAsStream(PIMAG_LOCAL_FILE); return BasicFileTools.getFileAsMock(null,in); } public InputStream dCenterLineFile(PAKCRestServiceTO simulationInstance) throws Exception{ InputStream in = this.getClass().getClassLoader().getResourceAsStream(DCENTERLINE_LOCAL_FILE); return BasicFileTools.getFileAsMock(null,in); } public InputStream pRealFile(PAKCRestServiceTO simulationInstance) throws Exception{ InputStream in = this.getClass().getClassLoader().getResourceAsStream(PREAL_LOCAL_FILE); return BasicFileTools.getFileAsMock(null,in); } public InputStream vMagnFile(PAKCRestServiceTO simulationInstance) throws Exception{ InputStream in = this.getClass().getClassLoader().getResourceAsStream(VMAGN_LOCAL_FILE); return BasicFileTools.getFileAsMock(null,in); } public InputStream vPhaseFile(PAKCRestServiceTO simulationInstance) throws Exception{ InputStream in = this.getClass().getClassLoader().getResourceAsStream(VPHASE_LOCAL_FILE); return BasicFileTools.getFileAsMock(null,in); } }
11,922
0.769082
0.768411
302
37.483444
38.672398
187
false
false
0
0
0
0
0
0
2.221854
false
false
7
8d431d7a03f649b0105b43cd69c5a8486f810dff
25,649,544,727,262
085e5ff0c393e8a73d5fcdf142da77607c9756e7
/src/PlayTicTacToe.java
e7b3a120f9ef86d7698af8295c45b1a5f7c4cb72
[]
no_license
abrahamvee/TicTacToe
https://github.com/abrahamvee/TicTacToe
2c50ee5c47ef4e18fdd075c5d5597cad33d1bac3
efca605c805b3818bf6f18bee33547e77093a513
refs/heads/master
2021-10-28T00:47:16.230000
2019-04-20T21:49:41
2019-04-20T21:49:41
182,147,431
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.Arrays; import java.util.Scanner; public class PlayTicTacToe { final static int BOARD_SIZE=9; public static void main(String[] args) throws Exception { TicTacToeGame game1 = new TicTacToeGame(); Scanner in = new Scanner(System.in); int cell = 0; boolean succesfulTurn = false, notFirstTurn=false; boolean tie = false; char continueGamePlay = 'y'; game1.setInitialTurn(); System.out.println("The computer has " +game1.getWonMatches() + "matches in memory."); System.out.println("Welcome to Tic-Tac-Toe. Use the following numbers to select a cell."); game1.getGrid().printBoardAid(); //BoardAid prints the numbers to be used for gameplay. do { if(continueGamePlay=='y') { //to start a new match game1.setInitialTurn(); game1.resetGame(); game1.getGrid().printBoard(); } while(!game1.checkGameOver()) { if(notFirstTurn) { game1.changeTurn(); } succesfulTurn = false; if(game1.turn.getTurn()==1) { System.out.println("Where do you want to place your X: "); cell = in.nextInt()-1; //Minus one to match numbers showed in aid. do { succesfulTurn=game1.getGrid().setX(cell); if(succesfulTurn==false) { System.out.println("Invalid cell. Try other."); cell = in.nextInt()-1; } }while(!succesfulTurn); } else if (game1.turn.getTurn()==0){ System.out.println("The computers turn!!!"); do { succesfulTurn=game1.getGrid().setO(game1.computersChoice()); }while(!succesfulTurn); } game1.getGrid().printBoard(); notFirstTurn = true; if(game1.getGrid().getEmptyCells()==0 && game1.checkGameOver()==false) { game1.setTie(); } } System.out.println(game1.declareWinner()); System.out.println("Do you want to keep playing? Y/N"); continueGamePlay = in.next().charAt(0); }while(continueGamePlay!='n'); } }
UTF-8
Java
1,933
java
PlayTicTacToe.java
Java
[]
null
[]
import java.util.Arrays; import java.util.Scanner; public class PlayTicTacToe { final static int BOARD_SIZE=9; public static void main(String[] args) throws Exception { TicTacToeGame game1 = new TicTacToeGame(); Scanner in = new Scanner(System.in); int cell = 0; boolean succesfulTurn = false, notFirstTurn=false; boolean tie = false; char continueGamePlay = 'y'; game1.setInitialTurn(); System.out.println("The computer has " +game1.getWonMatches() + "matches in memory."); System.out.println("Welcome to Tic-Tac-Toe. Use the following numbers to select a cell."); game1.getGrid().printBoardAid(); //BoardAid prints the numbers to be used for gameplay. do { if(continueGamePlay=='y') { //to start a new match game1.setInitialTurn(); game1.resetGame(); game1.getGrid().printBoard(); } while(!game1.checkGameOver()) { if(notFirstTurn) { game1.changeTurn(); } succesfulTurn = false; if(game1.turn.getTurn()==1) { System.out.println("Where do you want to place your X: "); cell = in.nextInt()-1; //Minus one to match numbers showed in aid. do { succesfulTurn=game1.getGrid().setX(cell); if(succesfulTurn==false) { System.out.println("Invalid cell. Try other."); cell = in.nextInt()-1; } }while(!succesfulTurn); } else if (game1.turn.getTurn()==0){ System.out.println("The computers turn!!!"); do { succesfulTurn=game1.getGrid().setO(game1.computersChoice()); }while(!succesfulTurn); } game1.getGrid().printBoard(); notFirstTurn = true; if(game1.getGrid().getEmptyCells()==0 && game1.checkGameOver()==false) { game1.setTie(); } } System.out.println(game1.declareWinner()); System.out.println("Do you want to keep playing? Y/N"); continueGamePlay = in.next().charAt(0); }while(continueGamePlay!='n'); } }
1,933
0.642007
0.628039
70
26.585714
23.983025
92
false
false
0
0
0
0
0
0
3.557143
false
false
7
a68a3393fbdbcd562d41658e0d8a4b22cfb31157
11,149,735,141,014
305d6cf93fd149d3330a2a4aad0e1b8084712e61
/app/src/main/java/com/example/cv/e_commerce/ViewHolder/ProductViewHolder.java
6644dbc41d569a19147128353cb72a5249e6b318
[]
no_license
Rameeshatariq/Ecommerce
https://github.com/Rameeshatariq/Ecommerce
005204d937aec072cc5d06ce2b2c0f5ca9172a3b
56108ebb08c33536b1e7fa58ba3c77b1fc9d9f6c
refs/heads/master
2020-04-23T07:05:55.552000
2019-02-16T11:30:56
2019-02-16T11:30:56
170,996,373
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.cv.e_commerce.ViewHolder; import android.support.v7.widget.RecyclerView; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import com.example.cv.e_commerce.R; import com.example.cv.e_commerce.interfaces.ItemClickListner; public class ProductViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{ public TextView txtProductName, txtProductDescription, txtProductPrice; public ImageView imageView; public ItemClickListner listner; public ProductViewHolder(View itemView) { super(itemView); imageView=(ImageView)itemView.findViewById(R.id.product_image); txtProductDescription=(TextView) itemView.findViewById(R.id.product_description); txtProductName=(TextView) itemView.findViewById(R.id.product_name); txtProductPrice=(TextView) itemView.findViewById(R.id.product_price); } public void onItemClickListner(ItemClickListner listner){ this.listner=listner; } @Override public void onClick(View view) { listner.onClick(view, getAdapterPosition(), false); } }
UTF-8
Java
1,129
java
ProductViewHolder.java
Java
[]
null
[]
package com.example.cv.e_commerce.ViewHolder; import android.support.v7.widget.RecyclerView; import android.view.View; import android.widget.ImageView; import android.widget.TextView; import com.example.cv.e_commerce.R; import com.example.cv.e_commerce.interfaces.ItemClickListner; public class ProductViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{ public TextView txtProductName, txtProductDescription, txtProductPrice; public ImageView imageView; public ItemClickListner listner; public ProductViewHolder(View itemView) { super(itemView); imageView=(ImageView)itemView.findViewById(R.id.product_image); txtProductDescription=(TextView) itemView.findViewById(R.id.product_description); txtProductName=(TextView) itemView.findViewById(R.id.product_name); txtProductPrice=(TextView) itemView.findViewById(R.id.product_price); } public void onItemClickListner(ItemClickListner listner){ this.listner=listner; } @Override public void onClick(View view) { listner.onClick(view, getAdapterPosition(), false); } }
1,129
0.767051
0.766165
34
32.205883
29.29744
95
false
false
0
0
0
0
0
0
0.617647
false
false
7
5fcb55a0e59bcb4c1b5200d3cbd1e943575e3573
5,231,270,201,339
1b3f5e57b0b7d073a1a0e1c59fe1df090e7331bc
/events/Event.java
e4162573fe214a65758870bc3477e9c7c6475b6d
[]
no_license
shehab8/HipHap
https://github.com/shehab8/HipHap
beddb43b3ec090287991f3cbedf065b659bd5355
c2d0ffed174130f7dbf9f5355ebf6973f38ebae3
refs/heads/master
2020-04-08T15:26:47.957000
2018-12-04T12:28:51
2018-12-04T12:28:51
159,479,145
0
0
null
true
2018-11-28T09:46:20
2018-11-28T09:46:19
2018-11-28T09:37:12
2018-11-28T09:37:10
15
0
0
0
null
false
null
package src.events; import src.Application; import src.Helper; import src.users.Employee; import src.users.Partner; import java.util.ArrayList; import java.util.*; import java.text.*; public class Event { private String name; private int ID; private String serviceType; private String eventType; private int nbOfHoursNeeded; Employee employeeResponsible; private Date orgStartDate ; private Date orgEndDate ; ArrayList<Partner> partners = new ArrayList<>(); // partners for this particular event ArrayList<String> specs = new ArrayList<>(); //eg: food, dj, photographer, limousine, balloons // also maybe this should be just one string /** * Constructor for creating a whole new event by employee * */ public Event(int ID, String eventType, String name, String serviceType, Employee employeeResponsible, int nbOfHoursNeeded, String specsString){ this.ID = ID; this.name = name; this.serviceType = serviceType; this.eventType = eventType; this.employeeResponsible = employeeResponsible; this.nbOfHoursNeeded = nbOfHoursNeeded; this.orgStartDate = setOrgStartDate(employeeResponsible); this.orgEndDate = setOrgEndDate(); String[]specsHelper = specsString.split(", "); for(int i = 0; i < specsHelper.length; i++){ specs.add(specsHelper[i]); } } /** * Constructor for creating a new event with reading from our database * */ public Event(int ID, String eventType, String name, String serviceType, String startDate, String endDate, int nbOfHoursNeeded, String specsString){ this.ID = ID; this.eventType = eventType; this.name = name; this.serviceType = serviceType; try { this.orgStartDate = new SimpleDateFormat("dd.MM.yyyy 'at' HH").parse(startDate); this.orgEndDate = new SimpleDateFormat("dd.MM.yyyy 'at' HH").parse(endDate); } catch (ParseException e) { System.out.print("Parse exception: " + e.getMessage()); } this.nbOfHoursNeeded = nbOfHoursNeeded; String[]specsHelper = specsString.split(", "); for(int i = 0; i < specsHelper.length; i++){ specs.add(specsHelper[i]); } } // Set-ers /** * Setting event name * @param name (String) - event name*/ public void setName(String name) { this.name = name; } /** * Setting event ID * @param ID (int) - event ID*/ public void setID(int ID) { this.ID = ID; } /** * Setting type of service * @param type (String) - type of service : consultation, planning, full organization*/ public void setServiceType(String type) { this.serviceType = type; } /** * Setting event type * @param type (String) - type of event: Trip, Business party, Conference*/ public void setEventType (String type) {this.eventType = type; } /** * sets specification for the event, items needed like office supplies * @param specsString (String) - items needed for the event*/ public void setSpecs(String specsString) { String[]specsHelper = specsString.split(", "); for(int i = 0; i < specsHelper.length; i++){ specs.add(specsHelper[i]); } } /** * Setting the organizing start date, the date when the employee responsible for the event will start working on it. * Date is in format "dd.MM.yyyy 'at' HH" * @param employeeResponsible (Employee) - employee responsible for organizing this event * @return startDate (Date) - the date when the responsible employee will start organizing the event*/ public Date setOrgStartDate( Employee employeeResponsible){ Employee currentUser = Application.getCurrentUser(); Date startDate; if( currentUser.getID() == 1111 ) {//manager int employeeID = Helper.getInt("Enter ID of the employee that will be asigned this event: "); startDate = employeeResponsible.getLastEventInfo(); } else{ startDate = employeeResponsible.getLastEventInfo(); } return startDate; } /** * Setting the organizing end date, the date when the employee responsible for this event will finish the organizing * Date is in the format "dd.MM.yyyy 'at' HH" * @return endDate (Date) - the date when the responsible employee will finish the organizing*/ public Date setOrgEndDate(){ Date endDate = getOrgStartDate(); int daysToMove = ( endDate.getHours() + nbOfHoursNeeded ) / 8; //8 working hours a day int hoursLeft = ( endDate.getHours() + nbOfHoursNeeded ) % 8; if (endDate.getDate() + daysToMove < 31 ) { //because in documentation its explained like : If the date was April 30, for example, and the date is set to 31, then it will be treated as if it were on May 1, because April has only 30 days. endDate.setDate(endDate.getDate() + daysToMove); }else{ endDate.setMonth(endDate.getMonth() + 1 ); endDate.setDate(endDate.getDate() + daysToMove - 31); } endDate.setHours(hoursLeft); return endDate; } // Get-ers /** * Returns name of the event * @return name (String) - name of the event*/ public String getName(){ return this.name; } /** * Returns event ID * @return ID (int) - ID of the event*/ public int getID() { return this.ID; } /** * Returns service type of the event * @return serviceType (string) - type of service : consultation, planning, full organization*/ public String getServiceType() { return this.serviceType; } /** * Returns event type of the event * @return eventType (String) - type of event: Trip, Business party, Conference*/ public String getEventType(){ return this.eventType; } /** * Returns the the organizing start date, the date when the employee responsible for the event will start working on it. * Date is in format "dd.MM.yyyy 'at' HH" * @return startDate (Date) - the date when the responsible employee will start organizing the event*/ public Date getOrgStartDate() { return this.orgStartDate; } /** * Returns the organizing end date, the date when the employee responsible for this event will finish the organizing * Date is in the format "dd.MM.yyyy 'at' HH" * @return endDate (Date) - the date when the responsible employee will finish the organizing*/ public Date getOrgEndDate() { return this.orgEndDate; } /** * Returns the number of hours needed to organize the event * @return nbOfHoursNeeded (int) - number of hours needed to organize the event*/ public int getNbOfHoursNeeded() { return nbOfHoursNeeded; } /** * returns specifications of needed items like decorations, office supplies * @return specs (arrayList <String>) - items needed for the event*/ public ArrayList<String> getSpecs() { return specs; } //Modifiers /** * Adds a partener to the partner arrayList * @param partner (Partner) - partner for the event*/ public void addPartner(Partner partner){ partners.add(partner); } /** * Adds a specification of the event to the specification arrayList * @param spec (String) - specification for the event*/ public void addSpecification(String spec){ specs.add(spec); } }
UTF-8
Java
7,588
java
Event.java
Java
[ { "context": "String){\n this.ID = ID;\n this.name = name;\n this.serviceType = serviceType;\n ", "end": 963, "score": 0.9188880324363708, "start": 959, "tag": "NAME", "value": "name" }, { "context": " this.eventType = eventType;\n this.name = name;\n this.serviceType = serviceType;\n\n ", "end": 1747, "score": 0.64858478307724, "start": 1743, "tag": "NAME", "value": "name" } ]
null
[]
package src.events; import src.Application; import src.Helper; import src.users.Employee; import src.users.Partner; import java.util.ArrayList; import java.util.*; import java.text.*; public class Event { private String name; private int ID; private String serviceType; private String eventType; private int nbOfHoursNeeded; Employee employeeResponsible; private Date orgStartDate ; private Date orgEndDate ; ArrayList<Partner> partners = new ArrayList<>(); // partners for this particular event ArrayList<String> specs = new ArrayList<>(); //eg: food, dj, photographer, limousine, balloons // also maybe this should be just one string /** * Constructor for creating a whole new event by employee * */ public Event(int ID, String eventType, String name, String serviceType, Employee employeeResponsible, int nbOfHoursNeeded, String specsString){ this.ID = ID; this.name = name; this.serviceType = serviceType; this.eventType = eventType; this.employeeResponsible = employeeResponsible; this.nbOfHoursNeeded = nbOfHoursNeeded; this.orgStartDate = setOrgStartDate(employeeResponsible); this.orgEndDate = setOrgEndDate(); String[]specsHelper = specsString.split(", "); for(int i = 0; i < specsHelper.length; i++){ specs.add(specsHelper[i]); } } /** * Constructor for creating a new event with reading from our database * */ public Event(int ID, String eventType, String name, String serviceType, String startDate, String endDate, int nbOfHoursNeeded, String specsString){ this.ID = ID; this.eventType = eventType; this.name = name; this.serviceType = serviceType; try { this.orgStartDate = new SimpleDateFormat("dd.MM.yyyy 'at' HH").parse(startDate); this.orgEndDate = new SimpleDateFormat("dd.MM.yyyy 'at' HH").parse(endDate); } catch (ParseException e) { System.out.print("Parse exception: " + e.getMessage()); } this.nbOfHoursNeeded = nbOfHoursNeeded; String[]specsHelper = specsString.split(", "); for(int i = 0; i < specsHelper.length; i++){ specs.add(specsHelper[i]); } } // Set-ers /** * Setting event name * @param name (String) - event name*/ public void setName(String name) { this.name = name; } /** * Setting event ID * @param ID (int) - event ID*/ public void setID(int ID) { this.ID = ID; } /** * Setting type of service * @param type (String) - type of service : consultation, planning, full organization*/ public void setServiceType(String type) { this.serviceType = type; } /** * Setting event type * @param type (String) - type of event: Trip, Business party, Conference*/ public void setEventType (String type) {this.eventType = type; } /** * sets specification for the event, items needed like office supplies * @param specsString (String) - items needed for the event*/ public void setSpecs(String specsString) { String[]specsHelper = specsString.split(", "); for(int i = 0; i < specsHelper.length; i++){ specs.add(specsHelper[i]); } } /** * Setting the organizing start date, the date when the employee responsible for the event will start working on it. * Date is in format "dd.MM.yyyy 'at' HH" * @param employeeResponsible (Employee) - employee responsible for organizing this event * @return startDate (Date) - the date when the responsible employee will start organizing the event*/ public Date setOrgStartDate( Employee employeeResponsible){ Employee currentUser = Application.getCurrentUser(); Date startDate; if( currentUser.getID() == 1111 ) {//manager int employeeID = Helper.getInt("Enter ID of the employee that will be asigned this event: "); startDate = employeeResponsible.getLastEventInfo(); } else{ startDate = employeeResponsible.getLastEventInfo(); } return startDate; } /** * Setting the organizing end date, the date when the employee responsible for this event will finish the organizing * Date is in the format "dd.MM.yyyy 'at' HH" * @return endDate (Date) - the date when the responsible employee will finish the organizing*/ public Date setOrgEndDate(){ Date endDate = getOrgStartDate(); int daysToMove = ( endDate.getHours() + nbOfHoursNeeded ) / 8; //8 working hours a day int hoursLeft = ( endDate.getHours() + nbOfHoursNeeded ) % 8; if (endDate.getDate() + daysToMove < 31 ) { //because in documentation its explained like : If the date was April 30, for example, and the date is set to 31, then it will be treated as if it were on May 1, because April has only 30 days. endDate.setDate(endDate.getDate() + daysToMove); }else{ endDate.setMonth(endDate.getMonth() + 1 ); endDate.setDate(endDate.getDate() + daysToMove - 31); } endDate.setHours(hoursLeft); return endDate; } // Get-ers /** * Returns name of the event * @return name (String) - name of the event*/ public String getName(){ return this.name; } /** * Returns event ID * @return ID (int) - ID of the event*/ public int getID() { return this.ID; } /** * Returns service type of the event * @return serviceType (string) - type of service : consultation, planning, full organization*/ public String getServiceType() { return this.serviceType; } /** * Returns event type of the event * @return eventType (String) - type of event: Trip, Business party, Conference*/ public String getEventType(){ return this.eventType; } /** * Returns the the organizing start date, the date when the employee responsible for the event will start working on it. * Date is in format "dd.MM.yyyy 'at' HH" * @return startDate (Date) - the date when the responsible employee will start organizing the event*/ public Date getOrgStartDate() { return this.orgStartDate; } /** * Returns the organizing end date, the date when the employee responsible for this event will finish the organizing * Date is in the format "dd.MM.yyyy 'at' HH" * @return endDate (Date) - the date when the responsible employee will finish the organizing*/ public Date getOrgEndDate() { return this.orgEndDate; } /** * Returns the number of hours needed to organize the event * @return nbOfHoursNeeded (int) - number of hours needed to organize the event*/ public int getNbOfHoursNeeded() { return nbOfHoursNeeded; } /** * returns specifications of needed items like decorations, office supplies * @return specs (arrayList <String>) - items needed for the event*/ public ArrayList<String> getSpecs() { return specs; } //Modifiers /** * Adds a partener to the partner arrayList * @param partner (Partner) - partner for the event*/ public void addPartner(Partner partner){ partners.add(partner); } /** * Adds a specification of the event to the specification arrayList * @param spec (String) - specification for the event*/ public void addSpecification(String spec){ specs.add(spec); } }
7,588
0.643252
0.640353
217
33.972351
35.167133
246
false
false
0
0
0
0
0
0
0.516129
false
false
7
121604571d67e57cce1be0bbb8b5a74aae3cd46f
24,378,234,395,703
a8e7217ed80875b9e9e08710113a19224d213d61
/generatedsources/com/acme/mypackage/POAElementType.java
bab7adc34a5ddf6d1abd3945bada66bff09c7806
[]
no_license
ministryofjustice/laa-decision-automation-model
https://github.com/ministryofjustice/laa-decision-automation-model
727dcc94fe88a410a1f77189313e9d9136d9eefd
01d0989951a0e13621371c26d15d99912be48c6a
refs/heads/master
2020-03-06T17:35:30.846000
2018-05-24T12:33:03
2018-05-24T12:33:03
126,992,407
0
1
null
false
2021-04-08T07:43:49
2018-03-27T13:41:48
2019-02-11T17:03:38
2018-05-24T12:33:09
432
0
0
0
Java
false
false
package com.acme.mypackage; import java.math.BigDecimal; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; import javax.xml.datatype.XMLGregorianCalendar; /** * <p>Java class for POAElementType complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="POAElementType"&gt; * &lt;complexContent&gt; * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt; * &lt;sequence&gt; * &lt;element name="ProviderID" type="{http://legalservices.gov.uk/Enterprise/Common/1.0/Common}ID15"/&gt; * &lt;element name="CaseReferenceNumber" type="{http://legalservices.gov.uk/Enterprise/Common/1.0/Common}IDREF30"/&gt; * &lt;element name="Reason" type="{http://legalservices.gov.uk/Enterprise/Common/1.0/Common}C50" minOccurs="0"/&gt; * &lt;element name="CourtType" type="{http://legalservices.gov.uk/Enterprise/Common/1.0/Common}LOV" minOccurs="0"/&gt; * &lt;element name="DateIncurred" type="{http://legalservices.gov.uk/Enterprise/Common/1.0/Common}Dt" minOccurs="0"/&gt; * &lt;element name="ActualNetCost" type="{http://legalservices.gov.uk/Enterprise/Common/1.0/Common}Amount" minOccurs="0"/&gt; * &lt;element name="VATRate" type="{http://legalservices.gov.uk/Enterprise/Common/1.0/Common}LOV" minOccurs="0"/&gt; * &lt;element name="DtldAssessmentOrderDate" type="{http://legalservices.gov.uk/Enterprise/Common/1.0/Common}Dt" minOccurs="0"/&gt; * &lt;element name="Notes" type="{http://legalservices.gov.uk/Enterprise/Common/1.0/Common}C2000" minOccurs="0"/&gt; * &lt;element name="CalculatedNetCost" type="{http://legalservices.gov.uk/Enterprise/Common/1.0/Common}Amount" minOccurs="0"/&gt; * &lt;element name="ActualTotalCost" type="{http://legalservices.gov.uk/Enterprise/Common/1.0/Common}Amount" minOccurs="0"/&gt; * &lt;element name="OPAResponse" type="{http://legalservices.gov.uk/Enterprise/Common/1.0/Common}AssesmentResultType"/&gt; * &lt;/sequence&gt; * &lt;/restriction&gt; * &lt;/complexContent&gt; * &lt;/complexType&gt; * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "POAElementType", namespace = "http://legalservices.gov.uk/CCMS/Finance/Payables/1.0/BillingBIO", propOrder = { "providerID", "caseReferenceNumber", "reason", "courtType", "dateIncurred", "actualNetCost", "vatRate", "dtldAssessmentOrderDate", "notes", "calculatedNetCost", "actualTotalCost", "opaResponse" }) public class POAElementType { @XmlElement(name = "ProviderID", required = true) protected String providerID; @XmlElement(name = "CaseReferenceNumber", required = true) protected String caseReferenceNumber; @XmlElement(name = "Reason") protected String reason; @XmlElement(name = "CourtType") protected String courtType; @XmlElement(name = "DateIncurred") @XmlSchemaType(name = "date") protected XMLGregorianCalendar dateIncurred; @XmlElement(name = "ActualNetCost") protected BigDecimal actualNetCost; @XmlElement(name = "VATRate") protected String vatRate; @XmlElement(name = "DtldAssessmentOrderDate") @XmlSchemaType(name = "date") protected XMLGregorianCalendar dtldAssessmentOrderDate; @XmlElement(name = "Notes") protected String notes; @XmlElement(name = "CalculatedNetCost") protected BigDecimal calculatedNetCost; @XmlElement(name = "ActualTotalCost") protected BigDecimal actualTotalCost; @XmlElement(name = "OPAResponse", required = true) protected AssesmentResultType opaResponse; /** * Gets the value of the providerID property. * * @return * possible object is * {@link String } * */ public String getProviderID() { return providerID; } /** * Sets the value of the providerID property. * * @param value * allowed object is * {@link String } * */ public void setProviderID(String value) { this.providerID = value; } /** * Gets the value of the caseReferenceNumber property. * * @return * possible object is * {@link String } * */ public String getCaseReferenceNumber() { return caseReferenceNumber; } /** * Sets the value of the caseReferenceNumber property. * * @param value * allowed object is * {@link String } * */ public void setCaseReferenceNumber(String value) { this.caseReferenceNumber = value; } /** * Gets the value of the reason property. * * @return * possible object is * {@link String } * */ public String getReason() { return reason; } /** * Sets the value of the reason property. * * @param value * allowed object is * {@link String } * */ public void setReason(String value) { this.reason = value; } /** * Gets the value of the courtType property. * * @return * possible object is * {@link String } * */ public String getCourtType() { return courtType; } /** * Sets the value of the courtType property. * * @param value * allowed object is * {@link String } * */ public void setCourtType(String value) { this.courtType = value; } /** * Gets the value of the dateIncurred property. * * @return * possible object is * {@link XMLGregorianCalendar } * */ public XMLGregorianCalendar getDateIncurred() { return dateIncurred; } /** * Sets the value of the dateIncurred property. * * @param value * allowed object is * {@link XMLGregorianCalendar } * */ public void setDateIncurred(XMLGregorianCalendar value) { this.dateIncurred = value; } /** * Gets the value of the actualNetCost property. * * @return * possible object is * {@link BigDecimal } * */ public BigDecimal getActualNetCost() { return actualNetCost; } /** * Sets the value of the actualNetCost property. * * @param value * allowed object is * {@link BigDecimal } * */ public void setActualNetCost(BigDecimal value) { this.actualNetCost = value; } /** * Gets the value of the vatRate property. * * @return * possible object is * {@link String } * */ public String getVATRate() { return vatRate; } /** * Sets the value of the vatRate property. * * @param value * allowed object is * {@link String } * */ public void setVATRate(String value) { this.vatRate = value; } /** * Gets the value of the dtldAssessmentOrderDate property. * * @return * possible object is * {@link XMLGregorianCalendar } * */ public XMLGregorianCalendar getDtldAssessmentOrderDate() { return dtldAssessmentOrderDate; } /** * Sets the value of the dtldAssessmentOrderDate property. * * @param value * allowed object is * {@link XMLGregorianCalendar } * */ public void setDtldAssessmentOrderDate(XMLGregorianCalendar value) { this.dtldAssessmentOrderDate = value; } /** * Gets the value of the notes property. * * @return * possible object is * {@link String } * */ public String getNotes() { return notes; } /** * Sets the value of the notes property. * * @param value * allowed object is * {@link String } * */ public void setNotes(String value) { this.notes = value; } /** * Gets the value of the calculatedNetCost property. * * @return * possible object is * {@link BigDecimal } * */ public BigDecimal getCalculatedNetCost() { return calculatedNetCost; } /** * Sets the value of the calculatedNetCost property. * * @param value * allowed object is * {@link BigDecimal } * */ public void setCalculatedNetCost(BigDecimal value) { this.calculatedNetCost = value; } /** * Gets the value of the actualTotalCost property. * * @return * possible object is * {@link BigDecimal } * */ public BigDecimal getActualTotalCost() { return actualTotalCost; } /** * Sets the value of the actualTotalCost property. * * @param value * allowed object is * {@link BigDecimal } * */ public void setActualTotalCost(BigDecimal value) { this.actualTotalCost = value; } /** * Gets the value of the opaResponse property. * * @return * possible object is * {@link AssesmentResultType } * */ public AssesmentResultType getOPAResponse() { return opaResponse; } /** * Sets the value of the opaResponse property. * * @param value * allowed object is * {@link AssesmentResultType } * */ public void setOPAResponse(AssesmentResultType value) { this.opaResponse = value; } }
UTF-8
Java
9,974
java
POAElementType.java
Java
[]
null
[]
package com.acme.mypackage; import java.math.BigDecimal; import javax.xml.bind.annotation.XmlAccessType; import javax.xml.bind.annotation.XmlAccessorType; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlSchemaType; import javax.xml.bind.annotation.XmlType; import javax.xml.datatype.XMLGregorianCalendar; /** * <p>Java class for POAElementType complex type. * * <p>The following schema fragment specifies the expected content contained within this class. * * <pre> * &lt;complexType name="POAElementType"&gt; * &lt;complexContent&gt; * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt; * &lt;sequence&gt; * &lt;element name="ProviderID" type="{http://legalservices.gov.uk/Enterprise/Common/1.0/Common}ID15"/&gt; * &lt;element name="CaseReferenceNumber" type="{http://legalservices.gov.uk/Enterprise/Common/1.0/Common}IDREF30"/&gt; * &lt;element name="Reason" type="{http://legalservices.gov.uk/Enterprise/Common/1.0/Common}C50" minOccurs="0"/&gt; * &lt;element name="CourtType" type="{http://legalservices.gov.uk/Enterprise/Common/1.0/Common}LOV" minOccurs="0"/&gt; * &lt;element name="DateIncurred" type="{http://legalservices.gov.uk/Enterprise/Common/1.0/Common}Dt" minOccurs="0"/&gt; * &lt;element name="ActualNetCost" type="{http://legalservices.gov.uk/Enterprise/Common/1.0/Common}Amount" minOccurs="0"/&gt; * &lt;element name="VATRate" type="{http://legalservices.gov.uk/Enterprise/Common/1.0/Common}LOV" minOccurs="0"/&gt; * &lt;element name="DtldAssessmentOrderDate" type="{http://legalservices.gov.uk/Enterprise/Common/1.0/Common}Dt" minOccurs="0"/&gt; * &lt;element name="Notes" type="{http://legalservices.gov.uk/Enterprise/Common/1.0/Common}C2000" minOccurs="0"/&gt; * &lt;element name="CalculatedNetCost" type="{http://legalservices.gov.uk/Enterprise/Common/1.0/Common}Amount" minOccurs="0"/&gt; * &lt;element name="ActualTotalCost" type="{http://legalservices.gov.uk/Enterprise/Common/1.0/Common}Amount" minOccurs="0"/&gt; * &lt;element name="OPAResponse" type="{http://legalservices.gov.uk/Enterprise/Common/1.0/Common}AssesmentResultType"/&gt; * &lt;/sequence&gt; * &lt;/restriction&gt; * &lt;/complexContent&gt; * &lt;/complexType&gt; * </pre> * * */ @XmlAccessorType(XmlAccessType.FIELD) @XmlType(name = "POAElementType", namespace = "http://legalservices.gov.uk/CCMS/Finance/Payables/1.0/BillingBIO", propOrder = { "providerID", "caseReferenceNumber", "reason", "courtType", "dateIncurred", "actualNetCost", "vatRate", "dtldAssessmentOrderDate", "notes", "calculatedNetCost", "actualTotalCost", "opaResponse" }) public class POAElementType { @XmlElement(name = "ProviderID", required = true) protected String providerID; @XmlElement(name = "CaseReferenceNumber", required = true) protected String caseReferenceNumber; @XmlElement(name = "Reason") protected String reason; @XmlElement(name = "CourtType") protected String courtType; @XmlElement(name = "DateIncurred") @XmlSchemaType(name = "date") protected XMLGregorianCalendar dateIncurred; @XmlElement(name = "ActualNetCost") protected BigDecimal actualNetCost; @XmlElement(name = "VATRate") protected String vatRate; @XmlElement(name = "DtldAssessmentOrderDate") @XmlSchemaType(name = "date") protected XMLGregorianCalendar dtldAssessmentOrderDate; @XmlElement(name = "Notes") protected String notes; @XmlElement(name = "CalculatedNetCost") protected BigDecimal calculatedNetCost; @XmlElement(name = "ActualTotalCost") protected BigDecimal actualTotalCost; @XmlElement(name = "OPAResponse", required = true) protected AssesmentResultType opaResponse; /** * Gets the value of the providerID property. * * @return * possible object is * {@link String } * */ public String getProviderID() { return providerID; } /** * Sets the value of the providerID property. * * @param value * allowed object is * {@link String } * */ public void setProviderID(String value) { this.providerID = value; } /** * Gets the value of the caseReferenceNumber property. * * @return * possible object is * {@link String } * */ public String getCaseReferenceNumber() { return caseReferenceNumber; } /** * Sets the value of the caseReferenceNumber property. * * @param value * allowed object is * {@link String } * */ public void setCaseReferenceNumber(String value) { this.caseReferenceNumber = value; } /** * Gets the value of the reason property. * * @return * possible object is * {@link String } * */ public String getReason() { return reason; } /** * Sets the value of the reason property. * * @param value * allowed object is * {@link String } * */ public void setReason(String value) { this.reason = value; } /** * Gets the value of the courtType property. * * @return * possible object is * {@link String } * */ public String getCourtType() { return courtType; } /** * Sets the value of the courtType property. * * @param value * allowed object is * {@link String } * */ public void setCourtType(String value) { this.courtType = value; } /** * Gets the value of the dateIncurred property. * * @return * possible object is * {@link XMLGregorianCalendar } * */ public XMLGregorianCalendar getDateIncurred() { return dateIncurred; } /** * Sets the value of the dateIncurred property. * * @param value * allowed object is * {@link XMLGregorianCalendar } * */ public void setDateIncurred(XMLGregorianCalendar value) { this.dateIncurred = value; } /** * Gets the value of the actualNetCost property. * * @return * possible object is * {@link BigDecimal } * */ public BigDecimal getActualNetCost() { return actualNetCost; } /** * Sets the value of the actualNetCost property. * * @param value * allowed object is * {@link BigDecimal } * */ public void setActualNetCost(BigDecimal value) { this.actualNetCost = value; } /** * Gets the value of the vatRate property. * * @return * possible object is * {@link String } * */ public String getVATRate() { return vatRate; } /** * Sets the value of the vatRate property. * * @param value * allowed object is * {@link String } * */ public void setVATRate(String value) { this.vatRate = value; } /** * Gets the value of the dtldAssessmentOrderDate property. * * @return * possible object is * {@link XMLGregorianCalendar } * */ public XMLGregorianCalendar getDtldAssessmentOrderDate() { return dtldAssessmentOrderDate; } /** * Sets the value of the dtldAssessmentOrderDate property. * * @param value * allowed object is * {@link XMLGregorianCalendar } * */ public void setDtldAssessmentOrderDate(XMLGregorianCalendar value) { this.dtldAssessmentOrderDate = value; } /** * Gets the value of the notes property. * * @return * possible object is * {@link String } * */ public String getNotes() { return notes; } /** * Sets the value of the notes property. * * @param value * allowed object is * {@link String } * */ public void setNotes(String value) { this.notes = value; } /** * Gets the value of the calculatedNetCost property. * * @return * possible object is * {@link BigDecimal } * */ public BigDecimal getCalculatedNetCost() { return calculatedNetCost; } /** * Sets the value of the calculatedNetCost property. * * @param value * allowed object is * {@link BigDecimal } * */ public void setCalculatedNetCost(BigDecimal value) { this.calculatedNetCost = value; } /** * Gets the value of the actualTotalCost property. * * @return * possible object is * {@link BigDecimal } * */ public BigDecimal getActualTotalCost() { return actualTotalCost; } /** * Sets the value of the actualTotalCost property. * * @param value * allowed object is * {@link BigDecimal } * */ public void setActualTotalCost(BigDecimal value) { this.actualTotalCost = value; } /** * Gets the value of the opaResponse property. * * @return * possible object is * {@link AssesmentResultType } * */ public AssesmentResultType getOPAResponse() { return opaResponse; } /** * Sets the value of the opaResponse property. * * @param value * allowed object is * {@link AssesmentResultType } * */ public void setOPAResponse(AssesmentResultType value) { this.opaResponse = value; } }
9,974
0.590134
0.585121
374
25.665775
26.272799
140
false
false
0
0
0
0
0
0
0.26738
false
false
7
fd9fa9f9be5f7b573c29b117f0aeb8c651e8a63d
33,260,226,768,449
7ba243b60fefc918bf8844a28a62c210a0f31151
/andromda-core/src/main/java/org/andromda/core/metafacade/MetafacadeConstants.java
9f4ca019eb1ca410882db95d5a0b52d736a9f3d4
[ "BSD-3-Clause", "Apache-1.1", "Apache-2.0", "LicenseRef-scancode-public-domain" ]
permissive
ojmakhura/andromda
https://github.com/ojmakhura/andromda
e27bcd4c8950b465378b8d0a456f71100821a213
534e744fa3afaac627263acd636f4a0554c7c6d6
refs/heads/master
2023-08-29T12:43:02.057000
2022-12-10T11:00:00
2022-12-10T11:00:00
130,977,549
5
6
NOASSERTION
false
2023-05-09T18:33:01
2018-04-25T08:48:49
2022-11-23T06:28:28
2023-05-09T18:33:01
611,205
4
5
29
Java
false
false
package org.andromda.core.metafacade; /** * Contains constants for use with metafacades. * For example, the metafacade namespace separator <em>::</em> * is contained within this class. * * @author Chad Brandon */ public interface MetafacadeConstants { /** * Used to separate the metafacade namespaces. */ public static final String NAMESPACE_SCOPE_OPERATOR = "::"; /** * The suffix for the metafacade implementation classes (each metafacade * implementation class ends with this string). */ public static final String METAFACADE_IMPLEMENTATION_SUFFIX = "Impl"; }
UTF-8
Java
612
java
MetafacadeConstants.java
Java
[ { "context": ">\n * is contained within this class.\n *\n * @author Chad Brandon\n */\npublic interface MetafacadeConstants\n{\n /*", "end": 215, "score": 0.999858021736145, "start": 203, "tag": "NAME", "value": "Chad Brandon" } ]
null
[]
package org.andromda.core.metafacade; /** * Contains constants for use with metafacades. * For example, the metafacade namespace separator <em>::</em> * is contained within this class. * * @author <NAME> */ public interface MetafacadeConstants { /** * Used to separate the metafacade namespaces. */ public static final String NAMESPACE_SCOPE_OPERATOR = "::"; /** * The suffix for the metafacade implementation classes (each metafacade * implementation class ends with this string). */ public static final String METAFACADE_IMPLEMENTATION_SUFFIX = "Impl"; }
606
0.699346
0.699346
22
26.818182
26.090117
76
false
false
0
0
0
0
0
0
0.181818
false
false
7
15c335bdffafd6f3191673d8edde0145afaa5dc8
33,260,226,764,250
69a4f2d51ebeea36c4d8192e25cfb5f3f77bef5e
/methods/Method_12776.java
40d05818c52df1d3bb999589b17f95da6edc92c4
[]
no_license
P79N6A/icse_20_user_study
https://github.com/P79N6A/icse_20_user_study
5b9c42c6384502fdc9588430899f257761f1f506
8a3676bc96059ea2c4f6d209016f5088a5628f3c
refs/heads/master
2020-06-24T08:25:22.606000
2019-07-25T15:31:16
2019-07-25T15:31:16
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public static void copyNativeLib(File apk,Context context,PackageInfo packageInfo,File nativeLibDir) throws Exception { long startTime=System.currentTimeMillis(); ZipFile zipfile=new ZipFile(apk.getAbsolutePath()); try { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { for ( String cpuArch : Build.SUPPORTED_ABIS) { if (findAndCopyNativeLib(zipfile,context,cpuArch,packageInfo,nativeLibDir)) { return; } } } else { if (findAndCopyNativeLib(zipfile,context,Build.CPU_ABI,packageInfo,nativeLibDir)) { return; } } findAndCopyNativeLib(zipfile,context,"armeabi",packageInfo,nativeLibDir); } finally { zipfile.close(); Log.d(TAG,"Done! +" + (System.currentTimeMillis() - startTime) + "ms"); } }
UTF-8
Java
803
java
Method_12776.java
Java
[]
null
[]
public static void copyNativeLib(File apk,Context context,PackageInfo packageInfo,File nativeLibDir) throws Exception { long startTime=System.currentTimeMillis(); ZipFile zipfile=new ZipFile(apk.getAbsolutePath()); try { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { for ( String cpuArch : Build.SUPPORTED_ABIS) { if (findAndCopyNativeLib(zipfile,context,cpuArch,packageInfo,nativeLibDir)) { return; } } } else { if (findAndCopyNativeLib(zipfile,context,Build.CPU_ABI,packageInfo,nativeLibDir)) { return; } } findAndCopyNativeLib(zipfile,context,"armeabi",packageInfo,nativeLibDir); } finally { zipfile.close(); Log.d(TAG,"Done! +" + (System.currentTimeMillis() - startTime) + "ms"); } }
803
0.676214
0.676214
23
33.913044
34.816181
119
false
false
0
0
0
0
0
0
1
false
false
7
2d8808ec90ac2f506d815b50cb4765ae753e5f9a
33,844,342,313,136
92d89357f7a089283cab9d7ce09c5903eb38573f
/xmlbeans/src/main/java/org/brekka/stillingar/xmlbeans/XmlBeansConfigurationSource.java
d43f2b12a48ab8aaf3bffc618a40fa96593ef568
[ "Apache-2.0" ]
permissive
vijayvani/stillingar
https://github.com/vijayvani/stillingar
e9fbc2a420f3321f1eb63a170ccaf014b2c8f974
24171c40874760fa79b4358dbc2559a578a2247c
refs/heads/master
2020-05-16T08:30:13.729000
2017-04-30T13:20:00
2017-04-30T13:20:00
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright 2011 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.brekka.stillingar.xmlbeans; import static java.lang.String.format; import java.util.ArrayList; import java.util.List; import org.apache.xmlbeans.XmlCursor; import org.apache.xmlbeans.XmlCursor.TokenType; import org.apache.xmlbeans.XmlObject; import org.brekka.stillingar.api.ConfigurationSource; import org.brekka.stillingar.api.ValueConfigurationException; import org.brekka.stillingar.core.conversion.ConversionManager; import org.brekka.stillingar.core.dom.DefaultNamespaceContext; /** * Configuration snapshot based on Apache XmlBeans. * * @author Andrew Taylor */ class XmlBeansConfigurationSource implements ConfigurationSource { private final XmlObject bean; private final ConversionManager conversionManager; private final DefaultNamespaceContext xpathNamespaces; public XmlBeansConfigurationSource(XmlObject bean, DefaultNamespaceContext xpathNamespaces, ConversionManager conversionManager) { this.bean = bean; this.xpathNamespaces = xpathNamespaces; this.conversionManager = conversionManager; } /* * (non-Javadoc) * * @see org.brekka.stillingar.core.ConfigurationSource#isAvailable(java.lang.Class) */ @Override public boolean isAvailable(Class<?> type) { XmlCursor cursor = bean.newCursor(); try { TokenType token = cursor.toNextToken(); while (token != TokenType.ENDDOC) { if (token == TokenType.START) { XmlObject object = cursor.getObject(); if (type.isAssignableFrom(object.getClass())) { return true; } } token = cursor.toNextToken(); } } finally { cursor.dispose(); } return false; } /* * (non-Javadoc) * * @see org.brekka.stillingar.core.ConfigurationSource#isAvailable(java.lang.String) */ @Override public boolean isAvailable(String expression) { return evaluate(expression).length > 0; } /* * (non-Javadoc) * * @see org.brekka.configuration.xmlbeans.Instance#retrieve(java.lang.Class) */ @Override public <T> T retrieve(Class<T> valueType) { T result = null; XmlObject[] found = find(valueType, true); if (found.length == 1) { result = convert(valueType, found[0], null); } return result; } /* * (non-Javadoc) * * @see org.brekka.configuration.xmlbeans.Instance#retrieve(java.lang.Class, java.lang.String) */ @Override public <T> T retrieve(String expression, Class<T> valueType) { T value; XmlObject[] found = evaluate(expression); if (found.length == 1) { XmlObject xml = found[0]; value = convert(valueType, xml, expression); } else if (found.length == 0) { // No value found, return null value = null; } else { throw new ValueConfigurationException( "multiple values found, only one expected", valueType.getClass(), expression); } return value; } /* * (non-Javadoc) * * @see org.brekka.configuration.xmlbeans.Instance#retrieveList(java.lang.Class) */ @Override public <T> List<T> retrieveList(Class<T> valueType) { List<T> results = new ArrayList<T>(); XmlObject[] found = find(valueType, false); for (XmlObject xmlObject : found) { T value = convert(valueType, xmlObject, null); results.add(value); } return results; } /* * (non-Javadoc) * * @see org.brekka.configuration.xmlbeans.Instance#retrieveList(java.lang.Class, java.lang.String) */ @Override public <T> List<T> retrieveList(String expression, Class<T> valueType) { List<T> results = new ArrayList<T>(); XmlObject[] found = evaluate(expression); for (XmlObject xmlObject : found) { T value = convert(valueType, xmlObject, expression); results.add(value); } return results; } private XmlObject[] find(Class<?> type, boolean singleExpected) { List<XmlObject> results = new ArrayList<XmlObject>(); XmlCursor cursor = bean.newCursor(); TokenType token = cursor.toNextToken(); while (token != TokenType.ENDDOC) { if (token == TokenType.START) { XmlObject object = cursor.getObject(); if (type.isAssignableFrom(object.getClass())) { results.add(object); if (results.size() > 1 && singleExpected) { throw new ValueConfigurationException( "multiple values found, only one expected", type.getClass(), null); } } } token = cursor.toNextToken(); } cursor.dispose(); return results.toArray(new XmlObject[results.size()]); } private XmlObject[] evaluate(String expression) { StringBuilder sb = new StringBuilder(); for (String prefix : xpathNamespaces.getPrefixes()) { sb.append("declare namespace "); sb.append(prefix); sb.append("='"); sb.append(xpathNamespaces.getNamespaceURI(prefix)); sb.append("';"); } sb.append('.'); sb.append(expression); return bean.selectPath(sb.toString()); } @SuppressWarnings("unchecked") protected <T> T convert(Class<T> expectedType, XmlObject object, String expression) { T value; if (object == null) { // Leave as null value = null; } else if (expectedType.isAssignableFrom(object.getClass())) { value = (T) object; } else if (conversionManager.hasConverter(expectedType)) { try { value = conversionManager.convert(object, expectedType); } catch (IllegalArgumentException e) { throw new ValueConfigurationException(format( "Conversion failure"), expectedType, expression, e); } } else { throw new ValueConfigurationException(format( "No conversion available from type '%s'", object.getClass() .getName()), expectedType, expression); } return value; } }
UTF-8
Java
7,214
java
XmlBeansConfigurationSource.java
Java
[ { "context": " snapshot based on Apache XmlBeans.\n * \n * @author Andrew Taylor\n */\nclass XmlBeansConfigurationSource implements ", "end": 1202, "score": 0.9992549419403076, "start": 1189, "tag": "NAME", "value": "Andrew Taylor" } ]
null
[]
/* * Copyright 2011 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.brekka.stillingar.xmlbeans; import static java.lang.String.format; import java.util.ArrayList; import java.util.List; import org.apache.xmlbeans.XmlCursor; import org.apache.xmlbeans.XmlCursor.TokenType; import org.apache.xmlbeans.XmlObject; import org.brekka.stillingar.api.ConfigurationSource; import org.brekka.stillingar.api.ValueConfigurationException; import org.brekka.stillingar.core.conversion.ConversionManager; import org.brekka.stillingar.core.dom.DefaultNamespaceContext; /** * Configuration snapshot based on Apache XmlBeans. * * @author <NAME> */ class XmlBeansConfigurationSource implements ConfigurationSource { private final XmlObject bean; private final ConversionManager conversionManager; private final DefaultNamespaceContext xpathNamespaces; public XmlBeansConfigurationSource(XmlObject bean, DefaultNamespaceContext xpathNamespaces, ConversionManager conversionManager) { this.bean = bean; this.xpathNamespaces = xpathNamespaces; this.conversionManager = conversionManager; } /* * (non-Javadoc) * * @see org.brekka.stillingar.core.ConfigurationSource#isAvailable(java.lang.Class) */ @Override public boolean isAvailable(Class<?> type) { XmlCursor cursor = bean.newCursor(); try { TokenType token = cursor.toNextToken(); while (token != TokenType.ENDDOC) { if (token == TokenType.START) { XmlObject object = cursor.getObject(); if (type.isAssignableFrom(object.getClass())) { return true; } } token = cursor.toNextToken(); } } finally { cursor.dispose(); } return false; } /* * (non-Javadoc) * * @see org.brekka.stillingar.core.ConfigurationSource#isAvailable(java.lang.String) */ @Override public boolean isAvailable(String expression) { return evaluate(expression).length > 0; } /* * (non-Javadoc) * * @see org.brekka.configuration.xmlbeans.Instance#retrieve(java.lang.Class) */ @Override public <T> T retrieve(Class<T> valueType) { T result = null; XmlObject[] found = find(valueType, true); if (found.length == 1) { result = convert(valueType, found[0], null); } return result; } /* * (non-Javadoc) * * @see org.brekka.configuration.xmlbeans.Instance#retrieve(java.lang.Class, java.lang.String) */ @Override public <T> T retrieve(String expression, Class<T> valueType) { T value; XmlObject[] found = evaluate(expression); if (found.length == 1) { XmlObject xml = found[0]; value = convert(valueType, xml, expression); } else if (found.length == 0) { // No value found, return null value = null; } else { throw new ValueConfigurationException( "multiple values found, only one expected", valueType.getClass(), expression); } return value; } /* * (non-Javadoc) * * @see org.brekka.configuration.xmlbeans.Instance#retrieveList(java.lang.Class) */ @Override public <T> List<T> retrieveList(Class<T> valueType) { List<T> results = new ArrayList<T>(); XmlObject[] found = find(valueType, false); for (XmlObject xmlObject : found) { T value = convert(valueType, xmlObject, null); results.add(value); } return results; } /* * (non-Javadoc) * * @see org.brekka.configuration.xmlbeans.Instance#retrieveList(java.lang.Class, java.lang.String) */ @Override public <T> List<T> retrieveList(String expression, Class<T> valueType) { List<T> results = new ArrayList<T>(); XmlObject[] found = evaluate(expression); for (XmlObject xmlObject : found) { T value = convert(valueType, xmlObject, expression); results.add(value); } return results; } private XmlObject[] find(Class<?> type, boolean singleExpected) { List<XmlObject> results = new ArrayList<XmlObject>(); XmlCursor cursor = bean.newCursor(); TokenType token = cursor.toNextToken(); while (token != TokenType.ENDDOC) { if (token == TokenType.START) { XmlObject object = cursor.getObject(); if (type.isAssignableFrom(object.getClass())) { results.add(object); if (results.size() > 1 && singleExpected) { throw new ValueConfigurationException( "multiple values found, only one expected", type.getClass(), null); } } } token = cursor.toNextToken(); } cursor.dispose(); return results.toArray(new XmlObject[results.size()]); } private XmlObject[] evaluate(String expression) { StringBuilder sb = new StringBuilder(); for (String prefix : xpathNamespaces.getPrefixes()) { sb.append("declare namespace "); sb.append(prefix); sb.append("='"); sb.append(xpathNamespaces.getNamespaceURI(prefix)); sb.append("';"); } sb.append('.'); sb.append(expression); return bean.selectPath(sb.toString()); } @SuppressWarnings("unchecked") protected <T> T convert(Class<T> expectedType, XmlObject object, String expression) { T value; if (object == null) { // Leave as null value = null; } else if (expectedType.isAssignableFrom(object.getClass())) { value = (T) object; } else if (conversionManager.hasConverter(expectedType)) { try { value = conversionManager.convert(object, expectedType); } catch (IllegalArgumentException e) { throw new ValueConfigurationException(format( "Conversion failure"), expectedType, expression, e); } } else { throw new ValueConfigurationException(format( "No conversion available from type '%s'", object.getClass() .getName()), expectedType, expression); } return value; } }
7,207
0.594954
0.592875
215
32.55349
25.524191
102
false
false
0
0
0
0
0
0
0.511628
false
false
7
fe13b75ed2888229766ff6b9bbfd25a3b9c85283
3,375,844,356,222
3f53b1b7f3bca80305f459cfc085bdd37e963f2c
/JMP2017/Task9WebService/src/com/jmp/ws/PriceList.java
1e6f80dced7be55710ba77a218861963039c2081
[]
no_license
Hleb-Karpenka/JMP2017
https://github.com/Hleb-Karpenka/JMP2017
3b2852685a0c526ba6a9794618f3a40c2d0c551c
b60e8cb61055344181f8fab358cd11fbc00db228
refs/heads/master
2021-01-22T03:44:38.043000
2017-06-25T08:25:41
2017-06-25T08:25:41
81,456,410
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.jmp.ws; import java.util.ArrayList; /** * Created by Gleb88 on 18.03.2017. */ public class PriceList { ArrayList<Price> priceList = new ArrayList<Price>(); public PriceList(ArrayList<Price> priceList) { this.priceList = priceList; } public ArrayList<Price> getPriceList() { return priceList; } public void setPriceList(ArrayList<Price> priceList) { this.priceList = priceList; } public PriceList() { priceList.add(new Price ("RAM_DDR3_2GB","20")); priceList.add(new Price ("RAM_DDR4_2GB","40")); } public String getPriceByName(String name) { for (Price price: priceList) { if(price.getName().equals(name)) { return price.getCost(); } } return "no price with such name ".concat(name); } public String addPricebyName(String name, String cost) { try { priceList.add(new Price (name,cost)); return "price is added"; }catch (Exception excp){ return "price is not added"; } } public String editPricebyName(String name, String cost) { for (Price price: priceList) { if(price.getName().equals(name)) { price.setCost(cost); return "price edited"; } } return "false"; } public String delitePricebyName(String name) { for (Price price: priceList) { if(price.getName().equals(name)) { priceList.remove(price); return "price was deleted"; } } return "price was not deleted"; } }
UTF-8
Java
1,729
java
PriceList.java
Java
[ { "context": "s;\n\nimport java.util.ArrayList;\n\n/**\n * Created by Gleb88 on 18.03.2017.\n */\npublic class PriceList {\n\n ", "end": 74, "score": 0.9995079040527344, "start": 68, "tag": "USERNAME", "value": "Gleb88" } ]
null
[]
package com.jmp.ws; import java.util.ArrayList; /** * Created by Gleb88 on 18.03.2017. */ public class PriceList { ArrayList<Price> priceList = new ArrayList<Price>(); public PriceList(ArrayList<Price> priceList) { this.priceList = priceList; } public ArrayList<Price> getPriceList() { return priceList; } public void setPriceList(ArrayList<Price> priceList) { this.priceList = priceList; } public PriceList() { priceList.add(new Price ("RAM_DDR3_2GB","20")); priceList.add(new Price ("RAM_DDR4_2GB","40")); } public String getPriceByName(String name) { for (Price price: priceList) { if(price.getName().equals(name)) { return price.getCost(); } } return "no price with such name ".concat(name); } public String addPricebyName(String name, String cost) { try { priceList.add(new Price (name,cost)); return "price is added"; }catch (Exception excp){ return "price is not added"; } } public String editPricebyName(String name, String cost) { for (Price price: priceList) { if(price.getName().equals(name)) { price.setCost(cost); return "price edited"; } } return "false"; } public String delitePricebyName(String name) { for (Price price: priceList) { if(price.getName().equals(name)) { priceList.remove(price); return "price was deleted"; } } return "price was not deleted"; } }
1,729
0.53904
0.528629
71
23.352112
19.659853
61
false
false
0
0
0
0
0
0
0.338028
false
false
7
a9c205c00b925b1047d3150038575b12d2e114be
33,749,853,048,784
7c794358e8afeb68f27102f288d6abd1265bbe87
/src/BEAN/Tipo_Mantenimiento.java
88f49317a9aa0f307449a5a8b9a36242e5df34ec
[]
no_license
daniellatapiav/desarrollo-apps-ii
https://github.com/daniellatapiav/desarrollo-apps-ii
a954df415791cde736bc9f21dd10036249691d4d
455d2ef6e9b989c6134b38abe09c068c1fa32cb2
refs/heads/master
2020-09-21T21:05:41.059000
2019-12-03T20:39:54
2019-12-03T20:39:54
224,929,878
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package BEAN; public class Tipo_Mantenimiento { private int id_tipoMant; private String tipoMant_desc; public Tipo_Mantenimiento(int id_tipoMant, String tipoMant_desc) { this.id_tipoMant = id_tipoMant; this.tipoMant_desc = tipoMant_desc; } public Tipo_Mantenimiento() {} public int getId_tipoMant() { return id_tipoMant; } public void setId_tipoMant(int id_tipoMant) { this.id_tipoMant = id_tipoMant; } public String getTipoMant_desc() { return tipoMant_desc; } public void setTipoMant_desc(String tipoMant_desc) { this.tipoMant_desc = tipoMant_desc; } }
UTF-8
Java
662
java
Tipo_Mantenimiento.java
Java
[]
null
[]
package BEAN; public class Tipo_Mantenimiento { private int id_tipoMant; private String tipoMant_desc; public Tipo_Mantenimiento(int id_tipoMant, String tipoMant_desc) { this.id_tipoMant = id_tipoMant; this.tipoMant_desc = tipoMant_desc; } public Tipo_Mantenimiento() {} public int getId_tipoMant() { return id_tipoMant; } public void setId_tipoMant(int id_tipoMant) { this.id_tipoMant = id_tipoMant; } public String getTipoMant_desc() { return tipoMant_desc; } public void setTipoMant_desc(String tipoMant_desc) { this.tipoMant_desc = tipoMant_desc; } }
662
0.645015
0.645015
29
21.827587
20.23665
70
false
false
0
0
0
0
0
0
0.344828
false
false
7
9627724e32c0f87a68dee87382a022ce39ad0658
16,260,746,195,989
76414e8814cf36aa52946dfb15f63eef6e16d600
/src/main/java/com/ydm/bootlast/controller/TransInfoController.java
9e9c420b81f00ba3c3e0d7dd1ea6390474c81462
[]
no_license
ydmxiaoyu/swagger2-spring-boot
https://github.com/ydmxiaoyu/swagger2-spring-boot
731541106eb03b9c9da7e6791682ba49149fb3ce
f907feac45e38871930b5b1a596d990bbaeed4f9
refs/heads/master
2020-06-11T00:36:45.299000
2019-06-26T01:23:50
2019-06-26T01:23:50
193,804,096
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ydm.bootlast.controller; import com.ydm.bootlast.model.Result; import com.ydm.bootlast.model.TransInfo; import com.ydm.bootlast.service.ITransInfoService; import io.swagger.annotations.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import java.util.List; /** * trans_info 表 crud 接口 * * @author yudaoming * @version 1.0 * @date 2019/6/24 14:26 */ @RestController @RequestMapping(produces = "application/json") @Api(tags = {"交易数据操作接口"},description = "TransInfoController") public class TransInfoController { @Autowired private ITransInfoService transInfoService; @GetMapping("GET/trans-info/{id}") @ApiOperation(value = "使用交易id查询交易数据") @ApiImplicitParam(name = "id",value = "交易ID",dataType = "int",paramType = "path",required = true) @ApiResponses({ @ApiResponse(code = 400, message = "请求参数有误"), @ApiResponse(code = 401, message = "未授权"), @ApiResponse(code = 403, message = "禁止访问"), @ApiResponse(code = 404, message = "请求路径不存在"), @ApiResponse(code = 500, message = "服务器内部错误") }) public Result<TransInfo> findById(@PathVariable("id")int id){ Result<TransInfo> result = new Result<>(); result.setData(transInfoService.findById(id)); result.setCode(200); result.setMsg("查询成功"); return result; } @GetMapping("GET/trans-info") @ApiOperation(value = "根据要显示的页面页码和页面大小来查询该页数据") @ApiImplicitParams({ @ApiImplicitParam(name = "currentPage",value = "查询的页面页码",dataType = "int",paramType = "query",required = true), @ApiImplicitParam(name = "pageSize",value = "页面显示多少条数据",dataType = "int",paramType = "query",required = true) }) @ApiResponses({ @ApiResponse(code = 400, message = "请求参数有误"), @ApiResponse(code = 401, message = "未授权"), @ApiResponse(code = 403, message = "禁止访问"), @ApiResponse(code = 404, message = "请求路径不存在"), @ApiResponse(code = 500, message = "服务器内部错误") }) public Result<List<TransInfo>> pageSerach(@RequestParam("currentPage") int currentPage,@RequestParam("pageSize") int pageSize){ Result<List<TransInfo>> result = new Result<>(); result.setData(transInfoService.pageSerach(currentPage,pageSize)); result.setCode(200); result.setMsg("查询成功"); return result; } @PutMapping("PUT/trans-info") @ApiOperation(value = "根据交易id更新一条交易数据") @ApiResponses({ @ApiResponse(code = 400, message = "请求参数有误"), @ApiResponse(code = 401, message = "未授权"), @ApiResponse(code = 403, message = "禁止访问"), @ApiResponse(code = 404, message = "请求路径不存在"), @ApiResponse(code = 500, message = "服务器内部错误") }) public Result<Integer> updateOne(@RequestBody TransInfo transInfo){ Result<Integer> result = new Result<>(); int rows = transInfoService.updateOne(transInfo); result.setData(rows); result.setCode(200); if(rows == 0){ result.setMsg("更新失败"); }else { result.setMsg("更新成功"); } return result; } @PostMapping("POST/trans-info") @ApiOperation(value = "保存一条交易数据") @ApiResponses({ @ApiResponse(code = 400, message = "请求参数有误"), @ApiResponse(code = 401, message = "未授权"), @ApiResponse(code = 403, message = "禁止访问"), @ApiResponse(code = 404, message = "请求路径不存在"), @ApiResponse(code = 500, message = "服务器内部错误") }) public Result<Integer> saveOne(@RequestBody TransInfo transInfo){ Result<Integer> result = new Result<>(); int rows = transInfoService.saveOne(transInfo); result.setData(rows); result.setCode(200); if(rows == 0){ result.setMsg("保存失败"); }else { result.setMsg("保存成功"); } return result; } @DeleteMapping("DELETE/trans-info/{id}") @ApiOperation(value = "根据交易id删除一条交易数据") @ApiImplicitParam(name = "id",value = "交易ID",dataType = "int",paramType = "path",required = true) @ApiResponses({ @ApiResponse(code = 400, message = "请求参数有误"), @ApiResponse(code = 401, message = "未授权"), @ApiResponse(code = 403, message = "禁止访问"), @ApiResponse(code = 404, message = "请求路径不存在"), @ApiResponse(code = 500, message = "服务器内部错误") }) public Result<Integer> deleteById(@PathVariable("id")int id){ Result<Integer> result = new Result<>(); int rows = transInfoService.deleteById(id); result.setData(rows); result.setCode(200); if(rows == 0){ result.setMsg("删除失败"); }else { result.setMsg("删除成功"); } return result; } }
UTF-8
Java
5,453
java
TransInfoController.java
Java
[ { "context": ".List;\n\n\n/**\n * trans_info 表 crud 接口\n *\n * @author yudaoming\n * @version 1.0\n * @date 2019/6/24 14:26\n */\n@Res", "end": 441, "score": 0.9996395111083984, "start": 432, "tag": "USERNAME", "value": "yudaoming" } ]
null
[]
package com.ydm.bootlast.controller; import com.ydm.bootlast.model.Result; import com.ydm.bootlast.model.TransInfo; import com.ydm.bootlast.service.ITransInfoService; import io.swagger.annotations.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.*; import java.util.List; /** * trans_info 表 crud 接口 * * @author yudaoming * @version 1.0 * @date 2019/6/24 14:26 */ @RestController @RequestMapping(produces = "application/json") @Api(tags = {"交易数据操作接口"},description = "TransInfoController") public class TransInfoController { @Autowired private ITransInfoService transInfoService; @GetMapping("GET/trans-info/{id}") @ApiOperation(value = "使用交易id查询交易数据") @ApiImplicitParam(name = "id",value = "交易ID",dataType = "int",paramType = "path",required = true) @ApiResponses({ @ApiResponse(code = 400, message = "请求参数有误"), @ApiResponse(code = 401, message = "未授权"), @ApiResponse(code = 403, message = "禁止访问"), @ApiResponse(code = 404, message = "请求路径不存在"), @ApiResponse(code = 500, message = "服务器内部错误") }) public Result<TransInfo> findById(@PathVariable("id")int id){ Result<TransInfo> result = new Result<>(); result.setData(transInfoService.findById(id)); result.setCode(200); result.setMsg("查询成功"); return result; } @GetMapping("GET/trans-info") @ApiOperation(value = "根据要显示的页面页码和页面大小来查询该页数据") @ApiImplicitParams({ @ApiImplicitParam(name = "currentPage",value = "查询的页面页码",dataType = "int",paramType = "query",required = true), @ApiImplicitParam(name = "pageSize",value = "页面显示多少条数据",dataType = "int",paramType = "query",required = true) }) @ApiResponses({ @ApiResponse(code = 400, message = "请求参数有误"), @ApiResponse(code = 401, message = "未授权"), @ApiResponse(code = 403, message = "禁止访问"), @ApiResponse(code = 404, message = "请求路径不存在"), @ApiResponse(code = 500, message = "服务器内部错误") }) public Result<List<TransInfo>> pageSerach(@RequestParam("currentPage") int currentPage,@RequestParam("pageSize") int pageSize){ Result<List<TransInfo>> result = new Result<>(); result.setData(transInfoService.pageSerach(currentPage,pageSize)); result.setCode(200); result.setMsg("查询成功"); return result; } @PutMapping("PUT/trans-info") @ApiOperation(value = "根据交易id更新一条交易数据") @ApiResponses({ @ApiResponse(code = 400, message = "请求参数有误"), @ApiResponse(code = 401, message = "未授权"), @ApiResponse(code = 403, message = "禁止访问"), @ApiResponse(code = 404, message = "请求路径不存在"), @ApiResponse(code = 500, message = "服务器内部错误") }) public Result<Integer> updateOne(@RequestBody TransInfo transInfo){ Result<Integer> result = new Result<>(); int rows = transInfoService.updateOne(transInfo); result.setData(rows); result.setCode(200); if(rows == 0){ result.setMsg("更新失败"); }else { result.setMsg("更新成功"); } return result; } @PostMapping("POST/trans-info") @ApiOperation(value = "保存一条交易数据") @ApiResponses({ @ApiResponse(code = 400, message = "请求参数有误"), @ApiResponse(code = 401, message = "未授权"), @ApiResponse(code = 403, message = "禁止访问"), @ApiResponse(code = 404, message = "请求路径不存在"), @ApiResponse(code = 500, message = "服务器内部错误") }) public Result<Integer> saveOne(@RequestBody TransInfo transInfo){ Result<Integer> result = new Result<>(); int rows = transInfoService.saveOne(transInfo); result.setData(rows); result.setCode(200); if(rows == 0){ result.setMsg("保存失败"); }else { result.setMsg("保存成功"); } return result; } @DeleteMapping("DELETE/trans-info/{id}") @ApiOperation(value = "根据交易id删除一条交易数据") @ApiImplicitParam(name = "id",value = "交易ID",dataType = "int",paramType = "path",required = true) @ApiResponses({ @ApiResponse(code = 400, message = "请求参数有误"), @ApiResponse(code = 401, message = "未授权"), @ApiResponse(code = 403, message = "禁止访问"), @ApiResponse(code = 404, message = "请求路径不存在"), @ApiResponse(code = 500, message = "服务器内部错误") }) public Result<Integer> deleteById(@PathVariable("id")int id){ Result<Integer> result = new Result<>(); int rows = transInfoService.deleteById(id); result.setData(rows); result.setCode(200); if(rows == 0){ result.setMsg("删除失败"); }else { result.setMsg("删除成功"); } return result; } }
5,453
0.605397
0.583891
134
35.783581
25.908957
131
false
false
0
0
0
0
0
0
0.791045
false
false
7
83f16d058a3999866f2f7a3fb9ad24e4cf3ad2d6
32,684,701,176,069
f87d9cd8396c3d7075bff788d327bc6c7e4a142a
/src/main/java/com/team6/app/quiz/Question.java
dd487c6f7e1fe96701fa11db07da024ae3d37684
[]
no_license
chrisn21/team6
https://github.com/chrisn21/team6
29b884d85082d78ec11db99b3c73d8c89b0744c2
9100e10ab59f0cb002ba0cc2a728fdd1698ed783
refs/heads/master
2016-09-06T21:54:35.201000
2014-02-15T01:53:23
2014-02-15T01:53:23
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.team6.app.quiz; import org.springframework.data.annotation.Id; public class Question { private String category; private String answer; private int difficulty; private String question; public Question(String category, String answer, int difficulty, String question) { this.category = category; this.answer = answer; this.difficulty = difficulty; this.question = question; } public String getCategory() { return category; } public int getDifficulty() { return difficulty; } public String getQuestion() { return question; } public String getAnswer() { return answer; } }
UTF-8
Java
628
java
Question.java
Java
[]
null
[]
package com.team6.app.quiz; import org.springframework.data.annotation.Id; public class Question { private String category; private String answer; private int difficulty; private String question; public Question(String category, String answer, int difficulty, String question) { this.category = category; this.answer = answer; this.difficulty = difficulty; this.question = question; } public String getCategory() { return category; } public int getDifficulty() { return difficulty; } public String getQuestion() { return question; } public String getAnswer() { return answer; } }
628
0.72293
0.721338
37
15.972973
16.894724
81
false
false
0
0
0
0
0
0
1.486486
false
false
7
c4255af16d480a35ea3169cdfd8c46f456ed7af8
13,108,240,242,385
69fd3deb58cfd8bb485e15e7fd1ddf3a9bdc4114
/src/main/java/org/sgodden/ui/models/DefaultBackingObjectListModel.java
334e48c1c09a0b05fde30282477a28aecfbe125c
[]
no_license
sgodden/sgo-commons
https://github.com/sgodden/sgo-commons
98caf64364907dd6ef933e34c0c5b7d790573443
ea3b3ae9793bd3ed51200cb8ca9f5862e8bbf112
refs/heads/master
2021-01-10T00:53:27.236000
2009-03-10T10:11:42
2009-03-10T10:11:42
32,789,579
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.sgodden.ui.models; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import nextapp.echo.app.list.DefaultListModel; /** * Extends {@link DefaultListModel} to allow a backing object to be maintained * per item in the list. * @author sgodden */ @SuppressWarnings("serial") public class DefaultBackingObjectListModel extends DefaultListModel implements BackingObjectDataModel { private List < Object > backingObjects = new ArrayList < Object >(); private Map < Object, Object > backingObjectsToItems = new HashMap < Object, Object >(); /** * Adds the specified element to the list, with the corresponding backing * object. * @param item the item to be rendered in the list. * @param backingObject the backing object for the item. */ public void add(Object item, Object backingObject) { super.add(item); backingObjects.add(backingObject); backingObjectsToItems.put(backingObject, item); } /** * Returns the backing object for the specified row. * @param rowIndex the index of the row. * @return the backing object. */ public Object getBackingObjectForRow(int rowIndex) { return backingObjects.get(rowIndex); } /** * See {@link BackingObjectDataModel#getValueForBackingObject(Object)}. * @param backingObject the backing object. * @return the model value. */ public Object getValueForBackingObject(Object backingObject) { return backingObjectsToItems.get(backingObject); } }
UTF-8
Java
1,599
java
DefaultBackingObjectListModel.java
Java
[ { "context": " be maintained\n * per item in the list.\n * @author sgodden\n */\n@SuppressWarnings(\"serial\")\npublic class Defa", "end": 306, "score": 0.9995517134666443, "start": 299, "tag": "USERNAME", "value": "sgodden" } ]
null
[]
package org.sgodden.ui.models; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import nextapp.echo.app.list.DefaultListModel; /** * Extends {@link DefaultListModel} to allow a backing object to be maintained * per item in the list. * @author sgodden */ @SuppressWarnings("serial") public class DefaultBackingObjectListModel extends DefaultListModel implements BackingObjectDataModel { private List < Object > backingObjects = new ArrayList < Object >(); private Map < Object, Object > backingObjectsToItems = new HashMap < Object, Object >(); /** * Adds the specified element to the list, with the corresponding backing * object. * @param item the item to be rendered in the list. * @param backingObject the backing object for the item. */ public void add(Object item, Object backingObject) { super.add(item); backingObjects.add(backingObject); backingObjectsToItems.put(backingObject, item); } /** * Returns the backing object for the specified row. * @param rowIndex the index of the row. * @return the backing object. */ public Object getBackingObjectForRow(int rowIndex) { return backingObjects.get(rowIndex); } /** * See {@link BackingObjectDataModel#getValueForBackingObject(Object)}. * @param backingObject the backing object. * @return the model value. */ public Object getValueForBackingObject(Object backingObject) { return backingObjectsToItems.get(backingObject); } }
1,599
0.697311
0.697311
52
29.76923
26.641216
92
false
false
0
0
0
0
0
0
0.346154
false
false
7
34e19e023083b9453af5740b099f6a0ef151de38
27,633,819,616,330
c69127b41030c74ac13cdcd7037491694308ab58
/EjPlanilla/src/uml/Detalle.java
d42fbdd3d084163837b67c9c55f7eb9e2945115e
[ "Apache-2.0" ]
permissive
jhomikel/EjPlanilla
https://github.com/jhomikel/EjPlanilla
cbdb1b58e870484dd98d3a296ddf1f2dbd072e23
90cede0c5059ff7e009a2b1783e93b09ca4ec803
refs/heads/master
2016-08-03T12:47:24.825000
2015-04-21T17:42:50
2015-04-21T17:42:50
34,331,579
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 uml; import java.util.ArrayList; import java.util.List; /** * * @author PCVirtual */ public class Detalle { private Empleado emp; private Planilla pla; private double renta; private double bono; private double sueldoNeto; private List<Detalle> lstDetalle; public Detalle() { lstDetalle = new ArrayList(); } public Detalle(Empleado emp, Planilla pla) { this.emp = emp; this.pla = pla; renta = emp.getSueldo() * 0.1; if(pla.getMes().equals("Diciembre")){ bono = emp.getSueldo() * 0.3; } else { bono = 0; } sueldoNeto = emp.getSueldo() - renta + bono; } public Empleado getEmp() { return emp; } public void setEmp(Empleado emp) { this.emp = emp; } public Planilla getPla() { return pla; } public void setPla(Planilla pla) { this.pla = pla; } public double getRenta() { return renta; } public void setRenta(double renta) { this.renta = renta; } public double getBono() { return bono; } public void setBono(double bono) { this.bono = bono; } public double getSueldoNeto() { return sueldoNeto; } public void setSueldoNeto(double sueldoNeto) { this.sueldoNeto = sueldoNeto; } public List<Detalle> getLstDetalle() { return lstDetalle; } public void setLstDetalle(List<Detalle> lstDetalle) { this.lstDetalle = lstDetalle; } }
UTF-8
Java
1,849
java
Detalle.java
Java
[ { "context": "st;\r\nimport java.util.List;\r\n\r\n/**\r\n *\r\n * @author PCVirtual\r\n */\r\npublic class Detalle {\r\n private Emplead", "end": 292, "score": 0.9996607303619385, "start": 283, "tag": "USERNAME", "value": "PCVirtual" } ]
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 uml; import java.util.ArrayList; import java.util.List; /** * * @author PCVirtual */ public class Detalle { private Empleado emp; private Planilla pla; private double renta; private double bono; private double sueldoNeto; private List<Detalle> lstDetalle; public Detalle() { lstDetalle = new ArrayList(); } public Detalle(Empleado emp, Planilla pla) { this.emp = emp; this.pla = pla; renta = emp.getSueldo() * 0.1; if(pla.getMes().equals("Diciembre")){ bono = emp.getSueldo() * 0.3; } else { bono = 0; } sueldoNeto = emp.getSueldo() - renta + bono; } public Empleado getEmp() { return emp; } public void setEmp(Empleado emp) { this.emp = emp; } public Planilla getPla() { return pla; } public void setPla(Planilla pla) { this.pla = pla; } public double getRenta() { return renta; } public void setRenta(double renta) { this.renta = renta; } public double getBono() { return bono; } public void setBono(double bono) { this.bono = bono; } public double getSueldoNeto() { return sueldoNeto; } public void setSueldoNeto(double sueldoNeto) { this.sueldoNeto = sueldoNeto; } public List<Detalle> getLstDetalle() { return lstDetalle; } public void setLstDetalle(List<Detalle> lstDetalle) { this.lstDetalle = lstDetalle; } }
1,849
0.555976
0.553272
89
18.77528
17.462482
79
false
false
0
0
0
0
0
0
0.359551
false
false
7
2deef8d12b4f66ed08253c98e947c4e8e6cdd343
27,633,819,616,201
424157d1a697851b2c7ad753df60a5bab6c79ef6
/src/main/java/test/task/benchmark/AbstractBenchmark.java
c9436b56b16844247159b80b8f929c74a68edc18
[]
no_license
sergmkw/lock-benchmark
https://github.com/sergmkw/lock-benchmark
2b82ca643cb21983d7e1bc263f15c24cb2b9ae0c
83c27b2a4cd7dc4b6c5bfba3cd8a0152fe3dc28e
refs/heads/master
2016-09-05T20:46:59.451000
2014-09-14T18:17:21
2014-09-14T18:17:21
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package test.task.benchmark; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.OutputTimeUnit; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; import test.task.Player; import java.util.concurrent.TimeUnit; @State(Scope.Benchmark) @BenchmarkMode(Mode.Throughput) @OutputTimeUnit(TimeUnit.MILLISECONDS) @Warmup(iterations = 5, time = 500, timeUnit = TimeUnit.MILLISECONDS) @Measurement(iterations = 5) @Threads(10) @Fork(1) public abstract class AbstractBenchmark { protected Player player; public abstract void setup(); @Benchmark public long randomlyReadWrite() { long time = System.nanoTime(); if (time % 2 == 0) { return player.getPoints(); } else { if (time % 9 == 0) { player.update(time, time + 1); return 0l; } else { return player.getKudos(); } } } @Benchmark public long systematicallyReadWrite() { long time = System.nanoTime(); long kudos = player.getKudos(); long points = player.getPoints(); player.update(points + time, kudos + points); return player.getKudos(); } @Benchmark public long readOnly() { long time = System.nanoTime(); if (time % 2 == 0) { return player.getKudos(); } else { return player.getPoints(); } } @Benchmark public void writeOnly() { long time = System.nanoTime(); player.update(time + 1, time - 1); } }
UTF-8
Java
1,879
java
AbstractBenchmark.java
Java
[]
null
[]
package test.task.benchmark; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Fork; import org.openjdk.jmh.annotations.Measurement; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.OutputTimeUnit; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.State; import org.openjdk.jmh.annotations.Threads; import org.openjdk.jmh.annotations.Warmup; import test.task.Player; import java.util.concurrent.TimeUnit; @State(Scope.Benchmark) @BenchmarkMode(Mode.Throughput) @OutputTimeUnit(TimeUnit.MILLISECONDS) @Warmup(iterations = 5, time = 500, timeUnit = TimeUnit.MILLISECONDS) @Measurement(iterations = 5) @Threads(10) @Fork(1) public abstract class AbstractBenchmark { protected Player player; public abstract void setup(); @Benchmark public long randomlyReadWrite() { long time = System.nanoTime(); if (time % 2 == 0) { return player.getPoints(); } else { if (time % 9 == 0) { player.update(time, time + 1); return 0l; } else { return player.getKudos(); } } } @Benchmark public long systematicallyReadWrite() { long time = System.nanoTime(); long kudos = player.getKudos(); long points = player.getPoints(); player.update(points + time, kudos + points); return player.getKudos(); } @Benchmark public long readOnly() { long time = System.nanoTime(); if (time % 2 == 0) { return player.getKudos(); } else { return player.getPoints(); } } @Benchmark public void writeOnly() { long time = System.nanoTime(); player.update(time + 1, time - 1); } }
1,879
0.634912
0.625333
70
25.842857
17.097733
69
false
false
0
0
0
0
0
0
0.5
false
false
7
3eb87f143853d7b6bf231c80c5c4f7207dfe3f81
3,813,931,001,348
2f84af35c09df364de56dc0bf88823f064f90841
/dip-proxy-server/src/main/java/edu/ucla/mbi/proxy/advice/NativeTracker.java
f4a38ebef77a66df8c639419894a2a1e1a5ae640
[]
no_license
IMExConsortium/dip-proxy
https://github.com/IMExConsortium/dip-proxy
fc9a06e4c44586f63734b3a1aecb156c9f90176c
3a2d03e6a83147c80889437b04780666a7d466d3
refs/heads/master
2022-01-31T02:16:45.263000
2020-06-13T18:53:14
2020-06-13T18:53:14
43,387,017
0
0
null
false
2022-01-04T16:44:23
2015-09-29T18:43:21
2020-06-13T18:57:50
2022-01-04T16:44:20
1,074
0
0
3
Java
false
false
package edu.ucla.mbi.proxy.advice; /*=========================================================================== * $HeadURL:: $ * $Id:: $ * Version: $Rev:: $ *=========================================================================== * * NativeTracker: monitor access to native servers * *========================================================================= */ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.util.*; import org.aspectj.lang.ProceedingJoinPoint; import edu.ucla.mbi.cache.*; import edu.ucla.mbi.cache.orm.*; import edu.ucla.mbi.proxy.context.WSContext; import edu.ucla.mbi.proxy.ProxyFault; import edu.ucla.mbi.fault.*; public class NativeTracker { public static final int DEFAULT_INTERVAL = 0; private int interval = DEFAULT_INTERVAL; // units: milliseconds private WSContext wsContext; public void setWsContext(WSContext context){ this.wsContext = context; } public void initialize(){ Log log = LogFactory.getLog( NativeTracker.class ); log.info( "NativeAdvice initialized" ); } public void setMinInterval( String interval ){ Log log = LogFactory.getLog( NativeTracker.class ); if ( interval != null ) { if (interval.replaceAll( "\\s+", "" ).matches( "^\\d+$" ) ) { try { // detault units: seconds this.interval = 1000*Integer.parseInt( interval ); } catch ( NumberFormatException nfe ) { log.info( "ProxyWS: ttl=" + interval + " :format error. Using default." ); } } else { log.info("ProxyWS: ttl="+interval+ " :unknown units/format. Using default."); } } else { log.info( "ProxyWS: ttl not specified: Using default." ); } } public Object invoke( ProceedingJoinPoint pjp ) throws Throwable { java.lang.Object[] args = pjp.getArgs(); Log log = LogFactory.getLog( NativeTracker.class ); log.info( "called:" + " prv=" + args[0] + " srv=" + args[1] + " ns=" + args[2] + " ac=" + args[3] ); NativeAuditDAO nad = wsContext.getDipProxyDAO().getNativeAuditDAO(); NativeAudit lastAudit = nad.findLast( (String) args[0], (String) args[1] ); Calendar beforeCal = Calendar.getInstance(); Object returnValue = null; int status = 0; try { returnValue = pjp.proceed(); } catch ( ProxyFault fault ) { log.info( "invoke: proxy fault code: " + fault.getFaultInfo().getFaultCode() ); log.info( "invoke: proxy fault message: " + fault.getFaultInfo().getMessage() ); status = fault.getFaultInfo().getFaultCode(); } Calendar afterCal = Calendar.getInstance(); long resTime = afterCal.getTimeInMillis() - beforeCal.getTimeInMillis() ; log.info( " response time: " + resTime ); NativeAudit nextAudit = null; if (lastAudit != null ) { log.info( "last audit:" + " prv=" + lastAudit.getProvider() + " srv=" + lastAudit.getService() + " ns=" + lastAudit.getNs() + " ac=" + lastAudit.getAc() + " time=" + lastAudit.getTime() ); if( ( afterCal.getTimeInMillis() - lastAudit.getTime().getTime() > interval ) && status == 0 ) { nextAudit = new NativeAudit( (String) args[0], (String) args[1], (String) args[2], (String) args[3], beforeCal.getTime(), resTime ); } } else { if( status == 0 ) { nextAudit = new NativeAudit( (String) args[0], (String) args[1], (String) args[2], (String) args[3], beforeCal.getTime(), resTime ); } } if( status != 0 ) { nextAudit = new NativeAudit( (String) args[0], (String) args[1], (String) args[2], (String) args[3], beforeCal.getTime(), resTime, status ); } if ( nextAudit != null ) { log.info( " audit archived" ); nad.create( nextAudit ); } log.info( "DONE" ); if( status != 0 ) { throw FaultFactory.newInstance( status ); } else { return returnValue; } } }
UTF-8
Java
5,594
java
NativeTracker.java
Java
[]
null
[]
package edu.ucla.mbi.proxy.advice; /*=========================================================================== * $HeadURL:: $ * $Id:: $ * Version: $Rev:: $ *=========================================================================== * * NativeTracker: monitor access to native servers * *========================================================================= */ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import java.util.*; import org.aspectj.lang.ProceedingJoinPoint; import edu.ucla.mbi.cache.*; import edu.ucla.mbi.cache.orm.*; import edu.ucla.mbi.proxy.context.WSContext; import edu.ucla.mbi.proxy.ProxyFault; import edu.ucla.mbi.fault.*; public class NativeTracker { public static final int DEFAULT_INTERVAL = 0; private int interval = DEFAULT_INTERVAL; // units: milliseconds private WSContext wsContext; public void setWsContext(WSContext context){ this.wsContext = context; } public void initialize(){ Log log = LogFactory.getLog( NativeTracker.class ); log.info( "NativeAdvice initialized" ); } public void setMinInterval( String interval ){ Log log = LogFactory.getLog( NativeTracker.class ); if ( interval != null ) { if (interval.replaceAll( "\\s+", "" ).matches( "^\\d+$" ) ) { try { // detault units: seconds this.interval = 1000*Integer.parseInt( interval ); } catch ( NumberFormatException nfe ) { log.info( "ProxyWS: ttl=" + interval + " :format error. Using default." ); } } else { log.info("ProxyWS: ttl="+interval+ " :unknown units/format. Using default."); } } else { log.info( "ProxyWS: ttl not specified: Using default." ); } } public Object invoke( ProceedingJoinPoint pjp ) throws Throwable { java.lang.Object[] args = pjp.getArgs(); Log log = LogFactory.getLog( NativeTracker.class ); log.info( "called:" + " prv=" + args[0] + " srv=" + args[1] + " ns=" + args[2] + " ac=" + args[3] ); NativeAuditDAO nad = wsContext.getDipProxyDAO().getNativeAuditDAO(); NativeAudit lastAudit = nad.findLast( (String) args[0], (String) args[1] ); Calendar beforeCal = Calendar.getInstance(); Object returnValue = null; int status = 0; try { returnValue = pjp.proceed(); } catch ( ProxyFault fault ) { log.info( "invoke: proxy fault code: " + fault.getFaultInfo().getFaultCode() ); log.info( "invoke: proxy fault message: " + fault.getFaultInfo().getMessage() ); status = fault.getFaultInfo().getFaultCode(); } Calendar afterCal = Calendar.getInstance(); long resTime = afterCal.getTimeInMillis() - beforeCal.getTimeInMillis() ; log.info( " response time: " + resTime ); NativeAudit nextAudit = null; if (lastAudit != null ) { log.info( "last audit:" + " prv=" + lastAudit.getProvider() + " srv=" + lastAudit.getService() + " ns=" + lastAudit.getNs() + " ac=" + lastAudit.getAc() + " time=" + lastAudit.getTime() ); if( ( afterCal.getTimeInMillis() - lastAudit.getTime().getTime() > interval ) && status == 0 ) { nextAudit = new NativeAudit( (String) args[0], (String) args[1], (String) args[2], (String) args[3], beforeCal.getTime(), resTime ); } } else { if( status == 0 ) { nextAudit = new NativeAudit( (String) args[0], (String) args[1], (String) args[2], (String) args[3], beforeCal.getTime(), resTime ); } } if( status != 0 ) { nextAudit = new NativeAudit( (String) args[0], (String) args[1], (String) args[2], (String) args[3], beforeCal.getTime(), resTime, status ); } if ( nextAudit != null ) { log.info( " audit archived" ); nad.create( nextAudit ); } log.info( "DONE" ); if( status != 0 ) { throw FaultFactory.newInstance( status ); } else { return returnValue; } } }
5,594
0.408831
0.403826
158
34.405064
24.84026
78
false
false
0
0
0
0
76
0.040222
0.405063
false
false
7
50493d7a89efda15bafe1e85d22f7502ba31489d
32,117,765,476,940
73234855f2fc13805a22945a8d88eca779a353c4
/src/client/View/gui/BalconyView.java
595f8691a2b5b46f08cd3a95e865250402ef4fd9
[]
no_license
leonardoarcari/council_of_four
https://github.com/leonardoarcari/council_of_four
849794e8c947cf5a2ed052ecd2ba27bd30ded5cc
89195ca4169207fe4546b52bd9dad01f7a3f1243
refs/heads/master
2020-12-30T16:46:50.036000
2016-07-07T09:44:37
2016-07-07T09:44:37
91,029,654
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package client.View.gui; import client.CachedData; import client.View.ViewAlgorithms; import core.Player; import core.gamelogic.actions.Action; import core.gamelogic.actions.CouncilorElectionAction; import core.gamelogic.actions.FastCouncilorElectionAction; import core.gamemodel.Councilor; import core.gamemodel.PoliticsCard; import core.gamemodel.RegionType; import core.gamemodel.modelinterface.BalconyInterface; import javafx.beans.binding.Bindings; import javafx.beans.property.BooleanProperty; import javafx.beans.property.SimpleBooleanProperty; import javafx.collections.FXCollections; import javafx.collections.ListChangeListener; import javafx.collections.ObservableList; import javafx.embed.swing.SwingFXUtils; import javafx.geometry.Insets; import javafx.geometry.Orientation; import javafx.geometry.Pos; import javafx.scene.canvas.Canvas; import javafx.scene.canvas.GraphicsContext; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.Separator; import javafx.scene.image.Image; import javafx.scene.image.WritableImage; import javafx.scene.layout.VBox; import org.controlsfx.control.PopOver; import java.awt.image.BufferedImage; import java.util.ArrayList; import java.util.Iterator; import java.util.List; /** * A <code>BalconyView</code> is a <code>ObjectImageView</code> to show a model * {@link core.gamemodel.CouncilorsBalcony Balcony} of councilors. */ public class BalconyView extends ObjectImageView implements HasMainAction, HasFastAction { private ObservableList<Councilor> councilors; private RegionType balconyRegion; private List<Image> councilorImages; private PopOver popOver; private Button satisfyCouncil; private Action currentAction; private Button electCouncilor; private Button fastElection; private BooleanProperty isCouncilSatisfiable; private BooleanProperty nullRegionPermitCards; private ObservableList<PoliticsCard> availablePoliticsCards; /** * Initializes a <code>BalconyView</code> with an empty set of councilors. * @param image Default background image * @param balconyRegion region of the model's balcony associated to this BalconyView * @param leftX Normalized left x coordinate of this in case it's added to an anchor pane * @param topY Normalized top y coordinate of this in case it's added to an anchor pane * @param width Normalized width of this */ public BalconyView(Image image, RegionType balconyRegion, double leftX, double topY, double width) { super(image, leftX, topY, width); this.balconyRegion = balconyRegion; councilorImages = new ArrayList<>(); councilors = FXCollections.observableArrayList(); availablePoliticsCards = FXCollections.observableArrayList(); buildPopOver(); setUpCouncilors(); isCouncilSatisfiable = new SimpleBooleanProperty(false); nullRegionPermitCards = new SimpleBooleanProperty(false); //Listen when either the balcony or the player politics card councilors.addListener((ListChangeListener<? super Councilor>) c -> { availablePoliticsCards.clear(); isCouncilSatisfiable.set(ViewAlgorithms.checkForSatisfaction(councilors,availablePoliticsCards)); }); CachedData.getInstance().listenToPolitics(c -> { availablePoliticsCards.clear(); isCouncilSatisfiable.set(ViewAlgorithms.checkForSatisfaction(councilors,availablePoliticsCards)); }); } private void setCouncilors(List<Councilor> councilors) { this.councilors.clear(); this.councilors.addAll(councilors); } /** * Updates the BalconyInterface this represents * @param balcony Model's balcony to represent */ public void setBalcony(BalconyInterface balcony) { List<Councilor> councilors = new ArrayList<>(); Iterator<Councilor> councilorIterator = balcony.councilorsIterator(); while(councilorIterator.hasNext()) { councilors.add(councilorIterator.next()); } setCouncilors(councilors); } private void setUpCouncilors() { councilors.addListener((ListChangeListener<Councilor>) c -> { ClassLoader loader = this.getClass().getClassLoader(); while(c.next()) { if(c.wasAdded()) { councilorImages.clear(); c.getList().forEach(o -> councilorImages.add(loadCouncilorImage(o, loader))); this.setImage(drawBalcony(councilorImages, loader)); } } }); } private static Image drawBalcony(List<Image> councilorImages, ClassLoader loader) { Canvas free = new Canvas(255, 140); GraphicsContext gc = free.getGraphicsContext2D(); Image backImage = new Image(loader.getResourceAsStream("backbalcony.png")); gc.drawImage(backImage,0,0,255,140); int index = 0; for(Image image : councilorImages) { gc.drawImage(image,15+index*56.25,5,56.25,140); index++; } Image balcImage = new Image(loader.getResourceAsStream("balcony.png")); gc.drawImage(balcImage,0,0,255,140); WritableImage balc = new WritableImage(255,140); free.snapshot(null,balc); BufferedImage bi = SwingFXUtils.fromFXImage(balc, null); return SwingFXUtils.toFXImage(bi, null); } private Image loadCouncilorImage(Councilor councilor, ClassLoader loader) { String counColor = councilor.getCouncilorColor().toString(); counColor = counColor + "_councilor.png"; counColor = counColor.toLowerCase(); return new Image(loader.getResourceAsStream(counColor)); } private void buildPopOver() { popOver = new PopOver(); popOver.setId("popover"); popOver.setArrowLocation(PopOver.ArrowLocation.TOP_CENTER); VBox balconyBox = new VBox(5); balconyBox.setPadding(new Insets(5)); Label normalAction = new Label("-- Main Actions --"); normalAction.setAlignment(Pos.CENTER); normalAction.setMaxWidth(Double.MAX_VALUE); electCouncilor = new Button("Elect Councilor"); electCouncilor.setDisable(true); electCouncilor.setMaxWidth(Double.MAX_VALUE); setStyle(electCouncilor); electCouncilor.setOnMouseClicked(event -> { CachedData cachedData = CachedData.getInstance(); currentAction = new CouncilorElectionAction((Player)cachedData.getMe(), cachedData.getSelectedCouncilor(), balconyRegion); cachedData.getController().sendInfo(currentAction); cachedData.setIsCouncilorSelected(false); cachedData.setSelectedCouncilor(null); }); satisfyCouncil = new Button("Satisfy Council"); satisfyCouncil.setDisable(true); satisfyCouncil.setMaxWidth(Double.MAX_VALUE); setStyle(satisfyCouncil); satisfyCouncil.setOnMouseClicked(event -> { SelectPoliticsView politicsView = new SelectPoliticsView(balconyRegion); politicsView.updatePoliticsCards(availablePoliticsCards.iterator()); popOver.hide(); ShowPane.getInstance().setContent(politicsView); ShowPane.getInstance().show(); }); Label fastAction = new Label("-- Fast Action --"); fastAction.setAlignment(Pos.CENTER); fastAction.setMaxWidth(Double.MAX_VALUE); fastElection = new Button("Elect Councilor"); fastElection.setDisable(true); fastElection.setMaxWidth(Double.MAX_VALUE); setStyle(fastElection); fastElection.setOnMouseClicked(event -> { CachedData cachedData = CachedData.getInstance(); currentAction = new FastCouncilorElectionAction((Player)cachedData.getMe(), balconyRegion, cachedData.getSelectedCouncilor()); cachedData.getController().sendInfo(currentAction); cachedData.setIsCouncilorSelected(false); cachedData.setSelectedCouncilor(null); }); Separator separator = new Separator(Orientation.HORIZONTAL); separator.setPadding(new Insets(5,5,5,5)); balconyBox.getChildren().addAll(normalAction, electCouncilor,satisfyCouncil,separator,fastAction, fastElection); setOnMouseClicked(event-> { popOver.setContentNode(balconyBox); popOver.setHeight(balconyBox.getHeight()); popOver.show(this, 10); }); } @Override public void setDisableBindingMainAction(BooleanProperty mainActionAvailable) { electCouncilor.disableProperty().bind(Bindings.or(CachedData.getInstance().isCouncilorSelectedProperty().not(), mainActionAvailable.not())); satisfyCouncil.disableProperty().bind(Bindings.or(isCouncilSatisfiable.not(), mainActionAvailable.not()).or(nullRegionPermitCards)); } @Override public void setDisableBindingFastAction(BooleanProperty fastActionAvailable) { fastElection.disableProperty().bind(Bindings.or(CachedData.getInstance().isCouncilorSelectedProperty().not(), fastActionAvailable.not())); } public void setNullRegionPermitCards(Boolean property) { nullRegionPermitCards.setValue(property); } private void setStyle(Button button) { button.setStyle("-fx-background-radius: 30;\n" + "-fx-background-insets: 0,1,1;\n" + "-fx-text-fill: black;\n" + "-fx-effect: dropshadow( three-pass-box , rgba(0,200,255,0.3) , 3, 0.0 , 0 , 1 );"); } }
UTF-8
Java
9,645
java
BalconyView.java
Java
[]
null
[]
package client.View.gui; import client.CachedData; import client.View.ViewAlgorithms; import core.Player; import core.gamelogic.actions.Action; import core.gamelogic.actions.CouncilorElectionAction; import core.gamelogic.actions.FastCouncilorElectionAction; import core.gamemodel.Councilor; import core.gamemodel.PoliticsCard; import core.gamemodel.RegionType; import core.gamemodel.modelinterface.BalconyInterface; import javafx.beans.binding.Bindings; import javafx.beans.property.BooleanProperty; import javafx.beans.property.SimpleBooleanProperty; import javafx.collections.FXCollections; import javafx.collections.ListChangeListener; import javafx.collections.ObservableList; import javafx.embed.swing.SwingFXUtils; import javafx.geometry.Insets; import javafx.geometry.Orientation; import javafx.geometry.Pos; import javafx.scene.canvas.Canvas; import javafx.scene.canvas.GraphicsContext; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.Separator; import javafx.scene.image.Image; import javafx.scene.image.WritableImage; import javafx.scene.layout.VBox; import org.controlsfx.control.PopOver; import java.awt.image.BufferedImage; import java.util.ArrayList; import java.util.Iterator; import java.util.List; /** * A <code>BalconyView</code> is a <code>ObjectImageView</code> to show a model * {@link core.gamemodel.CouncilorsBalcony Balcony} of councilors. */ public class BalconyView extends ObjectImageView implements HasMainAction, HasFastAction { private ObservableList<Councilor> councilors; private RegionType balconyRegion; private List<Image> councilorImages; private PopOver popOver; private Button satisfyCouncil; private Action currentAction; private Button electCouncilor; private Button fastElection; private BooleanProperty isCouncilSatisfiable; private BooleanProperty nullRegionPermitCards; private ObservableList<PoliticsCard> availablePoliticsCards; /** * Initializes a <code>BalconyView</code> with an empty set of councilors. * @param image Default background image * @param balconyRegion region of the model's balcony associated to this BalconyView * @param leftX Normalized left x coordinate of this in case it's added to an anchor pane * @param topY Normalized top y coordinate of this in case it's added to an anchor pane * @param width Normalized width of this */ public BalconyView(Image image, RegionType balconyRegion, double leftX, double topY, double width) { super(image, leftX, topY, width); this.balconyRegion = balconyRegion; councilorImages = new ArrayList<>(); councilors = FXCollections.observableArrayList(); availablePoliticsCards = FXCollections.observableArrayList(); buildPopOver(); setUpCouncilors(); isCouncilSatisfiable = new SimpleBooleanProperty(false); nullRegionPermitCards = new SimpleBooleanProperty(false); //Listen when either the balcony or the player politics card councilors.addListener((ListChangeListener<? super Councilor>) c -> { availablePoliticsCards.clear(); isCouncilSatisfiable.set(ViewAlgorithms.checkForSatisfaction(councilors,availablePoliticsCards)); }); CachedData.getInstance().listenToPolitics(c -> { availablePoliticsCards.clear(); isCouncilSatisfiable.set(ViewAlgorithms.checkForSatisfaction(councilors,availablePoliticsCards)); }); } private void setCouncilors(List<Councilor> councilors) { this.councilors.clear(); this.councilors.addAll(councilors); } /** * Updates the BalconyInterface this represents * @param balcony Model's balcony to represent */ public void setBalcony(BalconyInterface balcony) { List<Councilor> councilors = new ArrayList<>(); Iterator<Councilor> councilorIterator = balcony.councilorsIterator(); while(councilorIterator.hasNext()) { councilors.add(councilorIterator.next()); } setCouncilors(councilors); } private void setUpCouncilors() { councilors.addListener((ListChangeListener<Councilor>) c -> { ClassLoader loader = this.getClass().getClassLoader(); while(c.next()) { if(c.wasAdded()) { councilorImages.clear(); c.getList().forEach(o -> councilorImages.add(loadCouncilorImage(o, loader))); this.setImage(drawBalcony(councilorImages, loader)); } } }); } private static Image drawBalcony(List<Image> councilorImages, ClassLoader loader) { Canvas free = new Canvas(255, 140); GraphicsContext gc = free.getGraphicsContext2D(); Image backImage = new Image(loader.getResourceAsStream("backbalcony.png")); gc.drawImage(backImage,0,0,255,140); int index = 0; for(Image image : councilorImages) { gc.drawImage(image,15+index*56.25,5,56.25,140); index++; } Image balcImage = new Image(loader.getResourceAsStream("balcony.png")); gc.drawImage(balcImage,0,0,255,140); WritableImage balc = new WritableImage(255,140); free.snapshot(null,balc); BufferedImage bi = SwingFXUtils.fromFXImage(balc, null); return SwingFXUtils.toFXImage(bi, null); } private Image loadCouncilorImage(Councilor councilor, ClassLoader loader) { String counColor = councilor.getCouncilorColor().toString(); counColor = counColor + "_councilor.png"; counColor = counColor.toLowerCase(); return new Image(loader.getResourceAsStream(counColor)); } private void buildPopOver() { popOver = new PopOver(); popOver.setId("popover"); popOver.setArrowLocation(PopOver.ArrowLocation.TOP_CENTER); VBox balconyBox = new VBox(5); balconyBox.setPadding(new Insets(5)); Label normalAction = new Label("-- Main Actions --"); normalAction.setAlignment(Pos.CENTER); normalAction.setMaxWidth(Double.MAX_VALUE); electCouncilor = new Button("Elect Councilor"); electCouncilor.setDisable(true); electCouncilor.setMaxWidth(Double.MAX_VALUE); setStyle(electCouncilor); electCouncilor.setOnMouseClicked(event -> { CachedData cachedData = CachedData.getInstance(); currentAction = new CouncilorElectionAction((Player)cachedData.getMe(), cachedData.getSelectedCouncilor(), balconyRegion); cachedData.getController().sendInfo(currentAction); cachedData.setIsCouncilorSelected(false); cachedData.setSelectedCouncilor(null); }); satisfyCouncil = new Button("Satisfy Council"); satisfyCouncil.setDisable(true); satisfyCouncil.setMaxWidth(Double.MAX_VALUE); setStyle(satisfyCouncil); satisfyCouncil.setOnMouseClicked(event -> { SelectPoliticsView politicsView = new SelectPoliticsView(balconyRegion); politicsView.updatePoliticsCards(availablePoliticsCards.iterator()); popOver.hide(); ShowPane.getInstance().setContent(politicsView); ShowPane.getInstance().show(); }); Label fastAction = new Label("-- Fast Action --"); fastAction.setAlignment(Pos.CENTER); fastAction.setMaxWidth(Double.MAX_VALUE); fastElection = new Button("Elect Councilor"); fastElection.setDisable(true); fastElection.setMaxWidth(Double.MAX_VALUE); setStyle(fastElection); fastElection.setOnMouseClicked(event -> { CachedData cachedData = CachedData.getInstance(); currentAction = new FastCouncilorElectionAction((Player)cachedData.getMe(), balconyRegion, cachedData.getSelectedCouncilor()); cachedData.getController().sendInfo(currentAction); cachedData.setIsCouncilorSelected(false); cachedData.setSelectedCouncilor(null); }); Separator separator = new Separator(Orientation.HORIZONTAL); separator.setPadding(new Insets(5,5,5,5)); balconyBox.getChildren().addAll(normalAction, electCouncilor,satisfyCouncil,separator,fastAction, fastElection); setOnMouseClicked(event-> { popOver.setContentNode(balconyBox); popOver.setHeight(balconyBox.getHeight()); popOver.show(this, 10); }); } @Override public void setDisableBindingMainAction(BooleanProperty mainActionAvailable) { electCouncilor.disableProperty().bind(Bindings.or(CachedData.getInstance().isCouncilorSelectedProperty().not(), mainActionAvailable.not())); satisfyCouncil.disableProperty().bind(Bindings.or(isCouncilSatisfiable.not(), mainActionAvailable.not()).or(nullRegionPermitCards)); } @Override public void setDisableBindingFastAction(BooleanProperty fastActionAvailable) { fastElection.disableProperty().bind(Bindings.or(CachedData.getInstance().isCouncilorSelectedProperty().not(), fastActionAvailable.not())); } public void setNullRegionPermitCards(Boolean property) { nullRegionPermitCards.setValue(property); } private void setStyle(Button button) { button.setStyle("-fx-background-radius: 30;\n" + "-fx-background-insets: 0,1,1;\n" + "-fx-text-fill: black;\n" + "-fx-effect: dropshadow( three-pass-box , rgba(0,200,255,0.3) , 3, 0.0 , 0 , 1 );"); } }
9,645
0.696008
0.688647
228
41.307018
30.279438
148
false
false
0
0
0
0
0
0
0.885965
false
false
7
9f1c4327aa846acc4902b2024862707ff64622d5
23,167,053,597,557
07f1226ad7efd9ba3364e3f0067455111ff251d0
/src/main/java/vekta/spawner/location/feature/ConditionalFeatureData.java
d47f55d7217c9b1340b233d4cba9e112101b4f29
[ "MIT" ]
permissive
rvanasa/vekta
https://github.com/rvanasa/vekta
6dbf5b8282c1cafd4ec4dd3fb047412b831d0b29
f3fc144d6a99e5781c8378b1952bbf98244c2b38
refs/heads/master
2021-07-09T06:37:00.130000
2021-04-08T21:39:25
2021-04-08T21:39:25
239,011,192
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package vekta.spawner.location.feature; import java.io.Serializable; // TODO: use a better convention for these class ConditionalFeatureData implements Serializable { String cold; String warm; String large; String tiny; }
UTF-8
Java
228
java
ConditionalFeatureData.java
Java
[]
null
[]
package vekta.spawner.location.feature; import java.io.Serializable; // TODO: use a better convention for these class ConditionalFeatureData implements Serializable { String cold; String warm; String large; String tiny; }
228
0.789474
0.789474
11
19.727272
17.602123
54
false
false
0
0
0
0
0
0
0.909091
false
false
7
c96ffa6b50a62fbf14c5e82536e47098acbe2ecb
31,653,908,994,039
dd6c631b2490a2546dcdc143c6f34f1c331eefdd
/src/main/java/by/aistexped/documentgenerator/transformers/Replacer.java
0f12189a059e4c3ebb857e58e5c52d4283b92b4d
[]
no_license
Xini1/Document_generator
https://github.com/Xini1/Document_generator
a4e469946fe198f94a7b5e1746f90b1b0df5d60c
4f99394cc93536bb081f48c23fb7922be3486d1e
refs/heads/master
2022-11-17T23:05:53.497000
2020-06-30T11:38:27
2020-06-30T11:38:27
274,857,373
0
0
null
false
2020-06-30T11:23:41
2020-06-25T07:43:53
2020-06-26T07:05:32
2020-06-30T11:23:41
50
0
0
0
Java
false
false
package by.aistexped.documentgenerator.transformers; import by.aistexped.documentgenerator.iohandlers.Property; import org.apache.poi.xwpf.usermodel.*; import java.util.Map; public class Replacer { private XWPFDocument document; public Replacer(XWPFDocument document, Map<Property, String> properties) { this.document = document; } public void replace(Replacements replacements) { for (XWPFHeader header : document.getHeaderList()) { for (XWPFParagraph paragraph : header.getParagraphs()) { replacements.apply(paragraph); } } for (XWPFParagraph paragraph : document.getParagraphs()) { replacements.apply(paragraph); } for (XWPFTable table : document.getTables()) { for (XWPFTableRow row : table.getRows()) { for (XWPFTableCell cell : row.getTableCells()) { for (XWPFParagraph paragraph : cell.getParagraphs()) { replacements.apply(paragraph); } } } } } }
UTF-8
Java
1,111
java
Replacer.java
Java
[]
null
[]
package by.aistexped.documentgenerator.transformers; import by.aistexped.documentgenerator.iohandlers.Property; import org.apache.poi.xwpf.usermodel.*; import java.util.Map; public class Replacer { private XWPFDocument document; public Replacer(XWPFDocument document, Map<Property, String> properties) { this.document = document; } public void replace(Replacements replacements) { for (XWPFHeader header : document.getHeaderList()) { for (XWPFParagraph paragraph : header.getParagraphs()) { replacements.apply(paragraph); } } for (XWPFParagraph paragraph : document.getParagraphs()) { replacements.apply(paragraph); } for (XWPFTable table : document.getTables()) { for (XWPFTableRow row : table.getRows()) { for (XWPFTableCell cell : row.getTableCells()) { for (XWPFParagraph paragraph : cell.getParagraphs()) { replacements.apply(paragraph); } } } } } }
1,111
0.59856
0.59856
37
29.027027
25.763462
78
false
false
0
0
0
0
0
0
0.297297
false
false
7
2ff3190f2d5f96b4635e86e74e6b6a22d3dadec5
10,977,936,424,262
c35500eea5b33131d911c05de69ec14184eda679
/soa-client/src/main/java/org/ebayopensource/turmeric/runtime/common/binding/Deserializer.java
c0d3e2d3403185681e24ea2125c779aa9b01d2c8
[ "Apache-2.0" ]
permissive
ramananandh/MyPublicRepo
https://github.com/ramananandh/MyPublicRepo
42b9fd2c1fce41fd0de9b828531aa4ada2c75185
686129c380f438f0858428cc19c2ebc7f5e6b13f
refs/heads/master
2020-06-06T17:49:41.818000
2011-08-29T06:34:07
2011-08-29T06:34:07
1,922,268
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
/******************************************************************************* * Copyright (c) 2006-2010 eBay Inc. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 *******************************************************************************/ package org.ebayopensource.turmeric.runtime.common.binding; import javax.xml.stream.XMLStreamReader; import org.ebayopensource.turmeric.runtime.common.exceptions.ServiceException; import org.ebayopensource.turmeric.runtime.common.pipeline.InboundMessage; /** * Deserializer is responsible for managing the process of unmarshalling * encoded data of a particular encoding, for example, schema xml, * name-value, or JSON, into a Java content tree. It can also provide * data encoding validation. * * @author smalladi * @author wdeng */ public interface Deserializer { /** * Initiate deserialization of the specified inbound message value. * @param msg the inbound message * @param clazz the bound (target) type * @return an object of the specified bound type * @throws ServiceException Exception when deserialization fails. */ public Object deserialize(InboundMessage msg, Class<?> clazz) throws ServiceException; /** * Initiate deserialization of the specified inbound message value. * @param msg the inbound message * @param clazz the bound (target) type * @param reader the XMLStreamReader to read in the payload. * @return an object of the specified bound type * @throws ServiceException Exception when deserialization fails. */ public Object deserialize(InboundMessage msg, Class<?> clazz, XMLStreamReader reader) throws ServiceException; /** * @deprecated * * For custom deserializer. This method returns the Class object of * the top level java type this deserializer creates. * * @return The Class object of * the top level java type this deserializer creates. */ public Class getBoundType(); }
UTF-8
Java
2,137
java
Deserializer.java
Java
[ { "context": "rovide \n * data encoding validation.\n *\n * @author smalladi\n * @author wdeng\n */\npublic interface Deserialize", "end": 980, "score": 0.9993690252304077, "start": 972, "tag": "USERNAME", "value": "smalladi" }, { "context": "ding validation.\n *\n * @author smalladi\n * @author wdeng\n */\npublic interface Deserializer {\n\t\n\t/**\n\t * In", "end": 997, "score": 0.9982659816741943, "start": 992, "tag": "USERNAME", "value": "wdeng" } ]
null
[]
/******************************************************************************* * Copyright (c) 2006-2010 eBay Inc. All Rights Reserved. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 *******************************************************************************/ package org.ebayopensource.turmeric.runtime.common.binding; import javax.xml.stream.XMLStreamReader; import org.ebayopensource.turmeric.runtime.common.exceptions.ServiceException; import org.ebayopensource.turmeric.runtime.common.pipeline.InboundMessage; /** * Deserializer is responsible for managing the process of unmarshalling * encoded data of a particular encoding, for example, schema xml, * name-value, or JSON, into a Java content tree. It can also provide * data encoding validation. * * @author smalladi * @author wdeng */ public interface Deserializer { /** * Initiate deserialization of the specified inbound message value. * @param msg the inbound message * @param clazz the bound (target) type * @return an object of the specified bound type * @throws ServiceException Exception when deserialization fails. */ public Object deserialize(InboundMessage msg, Class<?> clazz) throws ServiceException; /** * Initiate deserialization of the specified inbound message value. * @param msg the inbound message * @param clazz the bound (target) type * @param reader the XMLStreamReader to read in the payload. * @return an object of the specified bound type * @throws ServiceException Exception when deserialization fails. */ public Object deserialize(InboundMessage msg, Class<?> clazz, XMLStreamReader reader) throws ServiceException; /** * @deprecated * * For custom deserializer. This method returns the Class object of * the top level java type this deserializer creates. * * @return The Class object of * the top level java type this deserializer creates. */ public Class getBoundType(); }
2,137
0.689284
0.683669
57
36.491226
30.536215
111
false
false
0
0
0
0
0
0
0.807018
false
false
7
9e8f476ed87ef86d22ad540885e7486523823edc
24,885,040,557,054
a59c242afce0e7c7c5d356dbab13b376036c879b
/columbia_research/src/edu/columbia/lrl/CrossLayer/physical_models/devices/FP/DPSKMachZehnderModulatorModel.java
a0044772852d65989dafd51e93f296cc71a98bc5
[]
no_license
ShijiaYan/PhoenixSim
https://github.com/ShijiaYan/PhoenixSim
1dbf2c5bf0c1ca00828dfea0104f7077d6221ed5
2b9248e690c43b5bebd80a8de9af2034c89b0822
refs/heads/master
2022-12-13T11:56:12.332000
2020-06-18T04:32:47
2020-06-18T04:32:47
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package edu.columbia.lrl.CrossLayer.physical_models.devices.FP; import java.util.ArrayList; import java.util.List; import java.util.Map; import ch.epfl.general_libraries.clazzes.ParamName; import ch.epfl.general_libraries.utils.MoreArrays; import ch.epfl.general_libraries.utils.SimpleMap; import edu.columbia.lrl.CrossLayer.PowerConsumption; import edu.columbia.lrl.CrossLayer.physical_models.PhysicalParameterAndModelsSet; import edu.columbia.lrl.CrossLayer.physical_models.PowerPenalty; import edu.columbia.lrl.CrossLayer.physical_models.devices.modulations.AbstractModulator; import edu.columbia.lrl.CrossLayer.physical_models.util.AbstractLinkFormat; import edu.columbia.lrl.CrossLayer.physical_models.util.Constants; public class DPSKMachZehnderModulatorModel { // Parameters private double armLength; // length of each arm private double waveguideLoss; // dB/cm private double junctionLoss; // dB private double dutyCycle; // between 0 and 1 (NOT in percent) private double vPi; private double vPulseCarver; private double vPeakToPeak; private double capPulseCarver; private double capModulator; private double bandwidthModulator; // private double dataRate ; // Initialize the parameters with the constructor public DPSKMachZehnderModulatorModel( // @ParamName(name = "Modulation Rate (bits/sec)", default_ = "10e9") double dataRate, @ParamName(name = "Length of Arm of MZM (m)", default_ = "1000e-6") double armLength, @ParamName(name = "Waveguide Loss Factor (dB/cm)", default_ = "10") double waveguideLoss, @ParamName(name = "Junction Loss (dB)", default_ = "0.5") double junctionLoss, @ParamName(name = "Duty Cyle of RZ Modulation", default_ = "0.33") double dutyCycle, @ParamName(name = "Pi Voltage (volts)", default_ = "5") double vPi, @ParamName(name = "Pulse Carver drive voltage (volts)", default_ = "2") double vPulseCarver, @ParamName(name = "Peak-to-Peak Voltage (volts)", default_ = "2") double vPeakToPeak, @ParamName(name = "Pulse Carver Capacitance (fF)", default_ = "10") double capPulseCarver, @ParamName(name = "Modulator Capacitance (fF)", default_ = "10") double capModulator, @ParamName(name = "Modulator 3dB Bandwidth (Hz)", default_ = "10e9") double bandwidthModulator) { super(); // required by the super class (AbstractModulatorArrayModel) // this.dataRate = dataRate ; this.armLength = armLength; this.waveguideLoss = waveguideLoss; this.junctionLoss = junctionLoss; this.dutyCycle = dutyCycle; this.vPi = vPi; this.vPulseCarver = vPulseCarver; this.vPeakToPeak = vPeakToPeak; this.capPulseCarver = capPulseCarver; this.capModulator = capModulator; this.bandwidthModulator = bandwidthModulator; } public Map<String, String> getAllParameters() { Map<String, String> map = new SimpleMap<>(); map.put("Length of Arm of MZM (m)", armLength + ""); map.put("Waveguide Loss Factor (dB/cm)", waveguideLoss + ""); map.put("Junction Loss (dB)", junctionLoss + ""); map.put("Duty Cycle of RZ Modulation", dutyCycle + ""); map.put("Pi Voltage (volts)", vPi + ""); map.put("Pulse Carver drive voltage (volts)", vPulseCarver + ""); map.put("Peak-to-Peak Voltage (volts)", vPeakToPeak + ""); map.put("Pulse Carver Capacitance", capPulseCarver + ""); map.put("Modulator Capacitance", capModulator + ""); map.put("Modulator 3dB Bandwidth (Hz)", bandwidthModulator + ""); return map; } // First we calculate the passive Optical Losses public ArrayList<PowerPenalty> getPassivePowerPenalties(Constants ct, AbstractLinkFormat linkFormat) { // This double insertionLoss = 2 * waveguideLoss * 100 * armLength + 4 * junctionLoss; double lossDutyCycle = -10 * Math.log10(dutyCycle); // Adding IL PowerPenalty insertionLossPP = new PowerPenalty(PowerPenalty.INSERTION_LOSS, AbstractModulator.MODULATOR, insertionLoss); PowerPenalty lossDutyCyclePP = new PowerPenalty(PowerPenalty.DUTY_CYCLE, AbstractModulator.MODULATOR, lossDutyCycle); return MoreArrays.getArrayList(insertionLossPP, lossDutyCyclePP); } public ArrayList<PowerPenalty> getActivePowerPenalties(Constants ct, AbstractLinkFormat linkFormat) { // This double pulseCarverLoss = Math.pow(Math.sin(Math.PI * vPulseCarver / vPi), 2); double pulseCarverPP = -10 * Math.log10(pulseCarverLoss); PowerPenalty pulseCarverPenalty = new PowerPenalty("Pulse Carver Penalty", AbstractModulator.MODULATOR, pulseCarverPP); return MoreArrays.getArrayList(pulseCarverPenalty); } public double getEffectiveModulationBitRate(AbstractLinkFormat linkFormat) { return linkFormat.getWavelengthRate() / dutyCycle; } public List<PowerConsumption> getDevicePowerConsumptions(PhysicalParameterAndModelsSet modelSet, AbstractLinkFormat linkFormat) { ArrayList<PowerConsumption> pc = new ArrayList<>(1); PowerConsumption p1 = new PowerConsumption("Not implemented for MZ", false, true, true, 0); pc.add(p1); return pc; } // Power and Energy Consumption }
UTF-8
Java
5,094
java
DPSKMachZehnderModulatorModel.java
Java
[]
null
[]
package edu.columbia.lrl.CrossLayer.physical_models.devices.FP; import java.util.ArrayList; import java.util.List; import java.util.Map; import ch.epfl.general_libraries.clazzes.ParamName; import ch.epfl.general_libraries.utils.MoreArrays; import ch.epfl.general_libraries.utils.SimpleMap; import edu.columbia.lrl.CrossLayer.PowerConsumption; import edu.columbia.lrl.CrossLayer.physical_models.PhysicalParameterAndModelsSet; import edu.columbia.lrl.CrossLayer.physical_models.PowerPenalty; import edu.columbia.lrl.CrossLayer.physical_models.devices.modulations.AbstractModulator; import edu.columbia.lrl.CrossLayer.physical_models.util.AbstractLinkFormat; import edu.columbia.lrl.CrossLayer.physical_models.util.Constants; public class DPSKMachZehnderModulatorModel { // Parameters private double armLength; // length of each arm private double waveguideLoss; // dB/cm private double junctionLoss; // dB private double dutyCycle; // between 0 and 1 (NOT in percent) private double vPi; private double vPulseCarver; private double vPeakToPeak; private double capPulseCarver; private double capModulator; private double bandwidthModulator; // private double dataRate ; // Initialize the parameters with the constructor public DPSKMachZehnderModulatorModel( // @ParamName(name = "Modulation Rate (bits/sec)", default_ = "10e9") double dataRate, @ParamName(name = "Length of Arm of MZM (m)", default_ = "1000e-6") double armLength, @ParamName(name = "Waveguide Loss Factor (dB/cm)", default_ = "10") double waveguideLoss, @ParamName(name = "Junction Loss (dB)", default_ = "0.5") double junctionLoss, @ParamName(name = "Duty Cyle of RZ Modulation", default_ = "0.33") double dutyCycle, @ParamName(name = "Pi Voltage (volts)", default_ = "5") double vPi, @ParamName(name = "Pulse Carver drive voltage (volts)", default_ = "2") double vPulseCarver, @ParamName(name = "Peak-to-Peak Voltage (volts)", default_ = "2") double vPeakToPeak, @ParamName(name = "Pulse Carver Capacitance (fF)", default_ = "10") double capPulseCarver, @ParamName(name = "Modulator Capacitance (fF)", default_ = "10") double capModulator, @ParamName(name = "Modulator 3dB Bandwidth (Hz)", default_ = "10e9") double bandwidthModulator) { super(); // required by the super class (AbstractModulatorArrayModel) // this.dataRate = dataRate ; this.armLength = armLength; this.waveguideLoss = waveguideLoss; this.junctionLoss = junctionLoss; this.dutyCycle = dutyCycle; this.vPi = vPi; this.vPulseCarver = vPulseCarver; this.vPeakToPeak = vPeakToPeak; this.capPulseCarver = capPulseCarver; this.capModulator = capModulator; this.bandwidthModulator = bandwidthModulator; } public Map<String, String> getAllParameters() { Map<String, String> map = new SimpleMap<>(); map.put("Length of Arm of MZM (m)", armLength + ""); map.put("Waveguide Loss Factor (dB/cm)", waveguideLoss + ""); map.put("Junction Loss (dB)", junctionLoss + ""); map.put("Duty Cycle of RZ Modulation", dutyCycle + ""); map.put("Pi Voltage (volts)", vPi + ""); map.put("Pulse Carver drive voltage (volts)", vPulseCarver + ""); map.put("Peak-to-Peak Voltage (volts)", vPeakToPeak + ""); map.put("Pulse Carver Capacitance", capPulseCarver + ""); map.put("Modulator Capacitance", capModulator + ""); map.put("Modulator 3dB Bandwidth (Hz)", bandwidthModulator + ""); return map; } // First we calculate the passive Optical Losses public ArrayList<PowerPenalty> getPassivePowerPenalties(Constants ct, AbstractLinkFormat linkFormat) { // This double insertionLoss = 2 * waveguideLoss * 100 * armLength + 4 * junctionLoss; double lossDutyCycle = -10 * Math.log10(dutyCycle); // Adding IL PowerPenalty insertionLossPP = new PowerPenalty(PowerPenalty.INSERTION_LOSS, AbstractModulator.MODULATOR, insertionLoss); PowerPenalty lossDutyCyclePP = new PowerPenalty(PowerPenalty.DUTY_CYCLE, AbstractModulator.MODULATOR, lossDutyCycle); return MoreArrays.getArrayList(insertionLossPP, lossDutyCyclePP); } public ArrayList<PowerPenalty> getActivePowerPenalties(Constants ct, AbstractLinkFormat linkFormat) { // This double pulseCarverLoss = Math.pow(Math.sin(Math.PI * vPulseCarver / vPi), 2); double pulseCarverPP = -10 * Math.log10(pulseCarverLoss); PowerPenalty pulseCarverPenalty = new PowerPenalty("Pulse Carver Penalty", AbstractModulator.MODULATOR, pulseCarverPP); return MoreArrays.getArrayList(pulseCarverPenalty); } public double getEffectiveModulationBitRate(AbstractLinkFormat linkFormat) { return linkFormat.getWavelengthRate() / dutyCycle; } public List<PowerConsumption> getDevicePowerConsumptions(PhysicalParameterAndModelsSet modelSet, AbstractLinkFormat linkFormat) { ArrayList<PowerConsumption> pc = new ArrayList<>(1); PowerConsumption p1 = new PowerConsumption("Not implemented for MZ", false, true, true, 0); pc.add(p1); return pc; } // Power and Energy Consumption }
5,094
0.734001
0.724774
118
41.169491
32.394627
107
false
false
0
0
0
0
0
0
2.262712
false
false
7
0e9a567bebb5573e34c91573e75092543953bcca
4,664,334,536,216
c6d1381bfacbf191dfbb8bac393648162679989b
/app/src/test/java/example/codeclan/com/toptenmovies/RankingTest.java
1b1f7b8bbf1d32b66c9097d5ac7d6b1275bfedae
[]
no_license
bk8335/week7_day1hw
https://github.com/bk8335/week7_day1hw
9744e6f660d5db5044c3a6433cb3f04b3e86adfb
58b0c037608ba9329899315636e74180496eac09
refs/heads/master
2021-01-19T20:40:46.896000
2017-04-17T17:02:39
2017-04-17T17:02:39
88,530,274
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package example.codeclan.com.toptenmovies; import org.junit.Before; import org.junit.Test; import static junit.framework.Assert.assertEquals; /** * Created by user on 17/04/2017. */ public class RankingTest { Movie movie1; Movie movie2; Movie movie3; Movie movie4; Movie movie5; Movie movie6; Movie movie7; Movie movie8; Movie movie9; Movie movie10; Movie movie11; Ranking ranking; @Before public void before() { movie1 = new Movie("a", "action", 1); movie2 = new Movie("b", "action", 2); movie3 = new Movie("Iron Man", "comic-book", 3); movie4 = new Movie("Iron Man 2", "comic-book", 4); movie5 = new Movie("Iron Man 3", "comic-book", 5); movie6 = new Movie("c", "action", 6); movie7 = new Movie("d", "action", 7); movie8 = new Movie("e", "action", 8); movie9 = new Movie("f", "action", 9); movie10 = new Movie("g", "action", 10); ranking = new Ranking(); } @Test public void setRankingTest() { ranking.setMovie(movie3); Movie result = ranking.getMovieByRank(3); assertEquals("Iron Man", result.getTitle()); } @Test public void replaceFinalMovieTest() { movie11 = new Movie("this is a new movie", "sci-fi", 4); ranking.setMovie(movie11); Movie result = ranking.getMovieByRank(4); assertEquals("this is a new movie", result.getTitle()); } }
UTF-8
Java
1,437
java
RankingTest.java
Java
[ { "context": ".framework.Assert.assertEquals;\n\n/**\n * Created by user on 17/04/2017.\n */\n\npublic class RankingTest {\n\n ", "end": 167, "score": 0.8867655992507935, "start": 163, "tag": "USERNAME", "value": "user" } ]
null
[]
package example.codeclan.com.toptenmovies; import org.junit.Before; import org.junit.Test; import static junit.framework.Assert.assertEquals; /** * Created by user on 17/04/2017. */ public class RankingTest { Movie movie1; Movie movie2; Movie movie3; Movie movie4; Movie movie5; Movie movie6; Movie movie7; Movie movie8; Movie movie9; Movie movie10; Movie movie11; Ranking ranking; @Before public void before() { movie1 = new Movie("a", "action", 1); movie2 = new Movie("b", "action", 2); movie3 = new Movie("Iron Man", "comic-book", 3); movie4 = new Movie("Iron Man 2", "comic-book", 4); movie5 = new Movie("Iron Man 3", "comic-book", 5); movie6 = new Movie("c", "action", 6); movie7 = new Movie("d", "action", 7); movie8 = new Movie("e", "action", 8); movie9 = new Movie("f", "action", 9); movie10 = new Movie("g", "action", 10); ranking = new Ranking(); } @Test public void setRankingTest() { ranking.setMovie(movie3); Movie result = ranking.getMovieByRank(3); assertEquals("Iron Man", result.getTitle()); } @Test public void replaceFinalMovieTest() { movie11 = new Movie("this is a new movie", "sci-fi", 4); ranking.setMovie(movie11); Movie result = ranking.getMovieByRank(4); assertEquals("this is a new movie", result.getTitle()); } }
1,437
0.607516
0.570633
58
23.775862
18.988239
64
false
false
0
0
0
0
0
0
1
false
false
7
d7e34f4969f7a1171490342676733db38ea07dc5
26,886,495,332,488
48db1af993cc160a148fb4faa954ff706d745639
/src/com/nw/temp/model/Calidad.java
72549d400f2a0bf407126a45dd2107e9a79ac7ba
[]
no_license
ratadelaniebla/nirsa
https://github.com/ratadelaniebla/nirsa
68d303672136ca6d8285ca662cdbb5e59bd46589
524e974958224d94713ffe16e30efa9a9a5ad3e1
refs/heads/master
2020-03-12T11:08:49.257000
2018-07-01T17:15:20
2018-07-01T17:15:20
130,589,942
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.nw.temp.model; import java.util.ArrayList; import java.util.List; public class Calidad { private String muestreo; private String especieTalla; private List<Double> porcentajeSales = new ArrayList<Double>(); private List<Double> histamina = new ArrayList<Double>(); public Calidad() { } public Calidad(String muestreo,String especieTalla,List<Double> porcentajeSales,List<Double> histamina ) { this.muestreo = muestreo; this.especieTalla = especieTalla; this.porcentajeSales = porcentajeSales; this.histamina=histamina; } public List<Double> getPorcentajeSales() { return porcentajeSales; } public void setPorcentajeSales(List<Double> porcentajeSales) { this.porcentajeSales = porcentajeSales; } public String getMuestreo() { return muestreo; } public void setMuestreo(String muestreo) { this.muestreo = muestreo; } public String getEspecieTalla() { return especieTalla; } public void setEspecieTalla(String especieTalla) { this.especieTalla = especieTalla; } public List<Double> getHistamina() { return histamina; } public void setHistamina(List<Double> histamina) { this.histamina = histamina; } }
UTF-8
Java
1,272
java
Calidad.java
Java
[]
null
[]
package com.nw.temp.model; import java.util.ArrayList; import java.util.List; public class Calidad { private String muestreo; private String especieTalla; private List<Double> porcentajeSales = new ArrayList<Double>(); private List<Double> histamina = new ArrayList<Double>(); public Calidad() { } public Calidad(String muestreo,String especieTalla,List<Double> porcentajeSales,List<Double> histamina ) { this.muestreo = muestreo; this.especieTalla = especieTalla; this.porcentajeSales = porcentajeSales; this.histamina=histamina; } public List<Double> getPorcentajeSales() { return porcentajeSales; } public void setPorcentajeSales(List<Double> porcentajeSales) { this.porcentajeSales = porcentajeSales; } public String getMuestreo() { return muestreo; } public void setMuestreo(String muestreo) { this.muestreo = muestreo; } public String getEspecieTalla() { return especieTalla; } public void setEspecieTalla(String especieTalla) { this.especieTalla = especieTalla; } public List<Double> getHistamina() { return histamina; } public void setHistamina(List<Double> histamina) { this.histamina = histamina; } }
1,272
0.693396
0.693396
65
17.569231
21.79059
107
false
false
0
0
0
0
0
0
1.123077
false
false
7
87fda0e329d40ffde76065754fe18180f82c99bb
7,799,660,666,546
e4852e3717a172279e78a763620140d3aec75717
/src/org/insightech/er/db/impl/informix/InformixDBManager.java
e9ac9dd8cdd0ce62898e9eca3182469ca55e0278
[ "Apache-2.0" ]
permissive
dixonmartinez/ermasterr
https://github.com/dixonmartinez/ermasterr
516958df278d26677f286aa60ca0611e030c5267
5ca1cf4e89902c81b63b16630ae053f8d7741caf
refs/heads/master
2022-11-10T09:54:49.131000
2020-06-30T21:19:05
2020-06-30T21:19:05
119,575,038
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.insightech.er.db.impl.informix; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; import org.insightech.er.db.DBManagerBase; import org.insightech.er.db.sqltype.SqlTypeManager; import org.insightech.er.editor.model.ERDiagram; import org.insightech.er.editor.model.dbexport.db.PreTableExportManager; import org.insightech.er.editor.model.dbexport.ddl.DDLCreator; import org.insightech.er.editor.model.dbimport.ImportFromDBManager; import org.insightech.er.editor.model.dbimport.PreImportFromDBManager; import org.insightech.er.editor.model.diagram_contents.element.node.category.Category; import org.insightech.er.editor.model.diagram_contents.element.node.table.ERTable; import org.insightech.er.editor.model.diagram_contents.element.node.table.properties.TableProperties; import org.insightech.er.editor.model.diagram_contents.not_element.tablespace.TablespaceProperties; public class InformixDBManager extends DBManagerBase { public static final String ID = "Informix"; @Override public String getId() { return ID; } /** * {@inheritDoc} */ @Override public String getDriverClassName() { return "com.informix.jdbc.IfxDriver"; } /** * {@inheritDoc} */ @Override protected String getURL() { return "jdbc:informix-sqli://<HOST NAME>:<PORT>/<DB NAME>:INFORMIXSERVER=<SERVER NAME>"; } @Override public int getDefaultPort() { return 1525; } @Override public SqlTypeManager getSqlTypeManager() { return new InformixSqlTypeManager(); } @Override public TableProperties createTableProperties(TableProperties tableProperties) { if (tableProperties != null && tableProperties instanceof InformixTableProperties) { return tableProperties; } return new InformixTableProperties(); } @Override public DDLCreator getDDLCreator(ERDiagram diagram, Category targetCategory, boolean semicolon) { return new InformixDDLCreator(diagram, targetCategory, semicolon); } @Override public List<String> getIndexTypeList(ERTable table) { List<String> list = new ArrayList<String>(); list.add("BTREE"); return list; } @Override protected int[] getSupportItems() { return new int[] { SUPPORT_AUTO_INCREMENT, SUPPORT_SCHEMA, SUPPORT_SEQUENCE, SUPPORT_SEQUENCE_NOCACHE }; } @Override public ImportFromDBManager getTableImportManager() { return new InformixTableImportManager(); } @Override public PreImportFromDBManager getPreTableImportManager() { return new InformixPreTableImportManager(); } @Override public PreTableExportManager getPreTableExportManager() { return new InformixPreTableExportManager(); } @Override public TablespaceProperties createTablespaceProperties() { return null; } @Override public TablespaceProperties checkTablespaceProperties( TablespaceProperties tablespaceProperties) { return null; } @Override public String[] getCurrentTimeValue() { return new String[] { "CURRENT", "SYSDATE" }; } @Override public List<String> getSystemSchemaList() { List<String> list = new ArrayList<String>(); list.add("sysadmin"); list.add("sysmaster"); list.add("sysuser"); list.add("sysutils"); return list; } @Override public BigDecimal getSequenceMaxValue() { return null; } }
UTF-8
Java
3,386
java
InformixDBManager.java
Java
[]
null
[]
package org.insightech.er.db.impl.informix; import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; import org.insightech.er.db.DBManagerBase; import org.insightech.er.db.sqltype.SqlTypeManager; import org.insightech.er.editor.model.ERDiagram; import org.insightech.er.editor.model.dbexport.db.PreTableExportManager; import org.insightech.er.editor.model.dbexport.ddl.DDLCreator; import org.insightech.er.editor.model.dbimport.ImportFromDBManager; import org.insightech.er.editor.model.dbimport.PreImportFromDBManager; import org.insightech.er.editor.model.diagram_contents.element.node.category.Category; import org.insightech.er.editor.model.diagram_contents.element.node.table.ERTable; import org.insightech.er.editor.model.diagram_contents.element.node.table.properties.TableProperties; import org.insightech.er.editor.model.diagram_contents.not_element.tablespace.TablespaceProperties; public class InformixDBManager extends DBManagerBase { public static final String ID = "Informix"; @Override public String getId() { return ID; } /** * {@inheritDoc} */ @Override public String getDriverClassName() { return "com.informix.jdbc.IfxDriver"; } /** * {@inheritDoc} */ @Override protected String getURL() { return "jdbc:informix-sqli://<HOST NAME>:<PORT>/<DB NAME>:INFORMIXSERVER=<SERVER NAME>"; } @Override public int getDefaultPort() { return 1525; } @Override public SqlTypeManager getSqlTypeManager() { return new InformixSqlTypeManager(); } @Override public TableProperties createTableProperties(TableProperties tableProperties) { if (tableProperties != null && tableProperties instanceof InformixTableProperties) { return tableProperties; } return new InformixTableProperties(); } @Override public DDLCreator getDDLCreator(ERDiagram diagram, Category targetCategory, boolean semicolon) { return new InformixDDLCreator(diagram, targetCategory, semicolon); } @Override public List<String> getIndexTypeList(ERTable table) { List<String> list = new ArrayList<String>(); list.add("BTREE"); return list; } @Override protected int[] getSupportItems() { return new int[] { SUPPORT_AUTO_INCREMENT, SUPPORT_SCHEMA, SUPPORT_SEQUENCE, SUPPORT_SEQUENCE_NOCACHE }; } @Override public ImportFromDBManager getTableImportManager() { return new InformixTableImportManager(); } @Override public PreImportFromDBManager getPreTableImportManager() { return new InformixPreTableImportManager(); } @Override public PreTableExportManager getPreTableExportManager() { return new InformixPreTableExportManager(); } @Override public TablespaceProperties createTablespaceProperties() { return null; } @Override public TablespaceProperties checkTablespaceProperties( TablespaceProperties tablespaceProperties) { return null; } @Override public String[] getCurrentTimeValue() { return new String[] { "CURRENT", "SYSDATE" }; } @Override public List<String> getSystemSchemaList() { List<String> list = new ArrayList<String>(); list.add("sysadmin"); list.add("sysmaster"); list.add("sysuser"); list.add("sysutils"); return list; } @Override public BigDecimal getSequenceMaxValue() { return null; } }
3,386
0.735972
0.73479
132
23.651516
25.681318
101
false
false
0
0
0
0
0
0
1.333333
false
false
7
308c7cce698317bb5641c625757bf8ae6fe0bc39
6,897,717,493,120
8dc5bab20f7af73f84d6e9996404d4c200dd4ef3
/src/main/java/ru/ekolesnik/guice/example1/model/MockDataSource.java
fff847d224b0199d49cb8385f2c79a1d67a17167
[]
no_license
evgenykolesnik/google-guice-introduction
https://github.com/evgenykolesnik/google-guice-introduction
89c85a1139dabe8399f6925705187d71448c8c2b
84d0083f5aebc2448db29c6b27ef884cc3c82cd6
refs/heads/master
2016-08-11T06:51:57.073000
2015-12-10T12:00:59
2015-12-10T12:00:59
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ru.ekolesnik.guice.example1.model; /** * Created by ekolesnik on 10/12/15. */ public class MockDataSource implements DataSource { public void connect() { System.out.println("Retrieving data from mock..."); } }
UTF-8
Java
237
java
MockDataSource.java
Java
[ { "context": "ekolesnik.guice.example1.model;\n\n/**\n * Created by ekolesnik on 10/12/15.\n */\npublic class MockDataSource impl", "end": 71, "score": 0.9995973706245422, "start": 62, "tag": "USERNAME", "value": "ekolesnik" } ]
null
[]
package ru.ekolesnik.guice.example1.model; /** * Created by ekolesnik on 10/12/15. */ public class MockDataSource implements DataSource { public void connect() { System.out.println("Retrieving data from mock..."); } }
237
0.683544
0.654008
10
22.700001
21.822237
59
false
false
0
0
0
0
0
0
0.2
false
false
7
7de82f1ae0808cee18ac937bc6697c3fa5c478da
6,897,717,494,536
e5513644e68c28b142cfdeebbdd912f215ccec12
/xper-train/xper-allen/src/org/xper/allen/intan/SimpleEStimMessage.java
82cfded1f36ed4db10ac72cc13bbcc0a9a977944
[]
no_license
AllenMuhanChen/ProjectChangeShape
https://github.com/AllenMuhanChen/ProjectChangeShape
e36f1bd158d56671e0da4f8a76c0991ec8c22d8c
294053afe509dcdddfc8b7a6f7b5b0a4c7de3450
refs/heads/master
2023-02-18T00:53:54.252000
2022-10-25T15:43:27
2022-10-25T15:45:04
237,318,149
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package org.xper.allen.intan; import org.xper.allen.saccade.console.SaccadeTargetMessage; import org.xper.drawing.Coordinates2D; import com.thoughtworks.xstream.XStream; public class SimpleEStimMessage { long timestamp; Coordinates2D targetPos = new Coordinates2D(); double targetEyeWindowSize; long eStimObjDataId; public SimpleEStimMessage(long timestamp, Coordinates2D targetPos, double targetEyeWindowSize, long eStimObjDataId) { super(); this.timestamp = timestamp; this.targetPos = targetPos; this.targetEyeWindowSize = targetEyeWindowSize; this.eStimObjDataId = eStimObjDataId; } public SimpleEStimMessage() { } transient static XStream s = new XStream(); static { s.alias("SimpleEStimMessage", SimpleEStimMessage.class); s.alias("Coordinates2D", Coordinates2D.class); } public static SimpleEStimMessage fromXml(String xml) { return (SimpleEStimMessage)s.fromXML(xml); } public static String toXml(SimpleEStimMessage msg) { return s.toXML(msg); } public String toXml() { return s.toXML(this); } public long getTimestamp() { return timestamp; } public void setTimestamp(long timestamp) { this.timestamp = timestamp; } public Coordinates2D getTargetPos() { return targetPos; } public void setTargetPos(Coordinates2D targetPos) { this.targetPos = targetPos; } public double getTargetEyeWindowSize() { return targetEyeWindowSize; } public void setTargetEyeWindowSize(double targetEyeWindowSize) { this.targetEyeWindowSize = targetEyeWindowSize; } public long geteStimObjDataId() { return eStimObjDataId; } public void seteStimObjDataId(long eStimObjDataId) { this.eStimObjDataId = eStimObjDataId; } }
UTF-8
Java
1,705
java
SimpleEStimMessage.java
Java
[]
null
[]
package org.xper.allen.intan; import org.xper.allen.saccade.console.SaccadeTargetMessage; import org.xper.drawing.Coordinates2D; import com.thoughtworks.xstream.XStream; public class SimpleEStimMessage { long timestamp; Coordinates2D targetPos = new Coordinates2D(); double targetEyeWindowSize; long eStimObjDataId; public SimpleEStimMessage(long timestamp, Coordinates2D targetPos, double targetEyeWindowSize, long eStimObjDataId) { super(); this.timestamp = timestamp; this.targetPos = targetPos; this.targetEyeWindowSize = targetEyeWindowSize; this.eStimObjDataId = eStimObjDataId; } public SimpleEStimMessage() { } transient static XStream s = new XStream(); static { s.alias("SimpleEStimMessage", SimpleEStimMessage.class); s.alias("Coordinates2D", Coordinates2D.class); } public static SimpleEStimMessage fromXml(String xml) { return (SimpleEStimMessage)s.fromXML(xml); } public static String toXml(SimpleEStimMessage msg) { return s.toXML(msg); } public String toXml() { return s.toXML(this); } public long getTimestamp() { return timestamp; } public void setTimestamp(long timestamp) { this.timestamp = timestamp; } public Coordinates2D getTargetPos() { return targetPos; } public void setTargetPos(Coordinates2D targetPos) { this.targetPos = targetPos; } public double getTargetEyeWindowSize() { return targetEyeWindowSize; } public void setTargetEyeWindowSize(double targetEyeWindowSize) { this.targetEyeWindowSize = targetEyeWindowSize; } public long geteStimObjDataId() { return eStimObjDataId; } public void seteStimObjDataId(long eStimObjDataId) { this.eStimObjDataId = eStimObjDataId; } }
1,705
0.762463
0.757771
79
20.582279
21.492777
95
false
false
0
0
0
0
0
0
1.417722
false
false
7
4b74c74a292feba22a42c7314b05114889c884de
15,040,975,538,922
1839abbfa8d51d0a101b7d29445fb9344f7ef5de
/src/com/ares/article/dao/ArticleMapper.java
ede57e74ffd094bbd90e69da44ff4661f69b92c9
[]
no_license
xiang776987/ares_blog
https://github.com/xiang776987/ares_blog
572cf3c972fdc38afe550d999ebfbefa3ba3479f
05170dc3318df9e17a0badcd4ed4cfdf538dfe50
refs/heads/master
2021-01-12T12:12:04.340000
2016-09-11T17:04:22
2016-09-11T17:04:22
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ares.article.dao; import java.util.List; import org.apache.ibatis.annotations.Param; import com.ares.article.po.ArticleBase; public interface ArticleMapper { /** * 根据博文Id获得博文对象 * @param articleId * @return * @throws Exception */ public ArticleBase getArticleById(Integer articleId) throws Exception; /** * 根据博文Id删除博文记录 * @param articleId * @throws Exception */ public void deleteArticleById(Integer articleId) throws Exception; /** * 更新博文记录 * @param articleBase * @throws Exception */ public void updateArticle(ArticleBase articleBase) throws Exception; /** * 增加博文记录 * @param articleBase * @throws Exception */ public void addArticle(ArticleBase articleBase) throws Exception; /** * 获得博文列表(分页) * @param pageNum 当前页数 * @param pageSize 分页大小 * @return * @throws Exception */ public List<ArticleBase> getArticles(@Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize) throws Exception; /** * 根据标签id获得博文列表(分页) * @param tagId 标签id * @param pageNum 当前页数 * @param pageSize 分页大小 * @return * @throws Exception */ public List<ArticleBase> getArticleByTag(@Param("tagId") Integer tagId, @Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize) throws Exception; }
UTF-8
Java
1,426
java
ArticleMapper.java
Java
[]
null
[]
package com.ares.article.dao; import java.util.List; import org.apache.ibatis.annotations.Param; import com.ares.article.po.ArticleBase; public interface ArticleMapper { /** * 根据博文Id获得博文对象 * @param articleId * @return * @throws Exception */ public ArticleBase getArticleById(Integer articleId) throws Exception; /** * 根据博文Id删除博文记录 * @param articleId * @throws Exception */ public void deleteArticleById(Integer articleId) throws Exception; /** * 更新博文记录 * @param articleBase * @throws Exception */ public void updateArticle(ArticleBase articleBase) throws Exception; /** * 增加博文记录 * @param articleBase * @throws Exception */ public void addArticle(ArticleBase articleBase) throws Exception; /** * 获得博文列表(分页) * @param pageNum 当前页数 * @param pageSize 分页大小 * @return * @throws Exception */ public List<ArticleBase> getArticles(@Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize) throws Exception; /** * 根据标签id获得博文列表(分页) * @param tagId 标签id * @param pageNum 当前页数 * @param pageSize 分页大小 * @return * @throws Exception */ public List<ArticleBase> getArticleByTag(@Param("tagId") Integer tagId, @Param("pageNum") Integer pageNum, @Param("pageSize") Integer pageSize) throws Exception; }
1,426
0.712833
0.712833
54
22.666666
24.145393
127
false
false
0
0
0
0
0
0
1.12963
false
false
7
d53d2038bec3d6f7dc496638aa3786ed00fa0283
17,978,733,166,995
73fd20b3d38e7cc8e4145f5485b55a57655163f1
/src/main/java/br/com/emanuelgabriel/brasileiraoapi/dto/EquipeDTO.java
279028287c6a081ceb5c7bc7590bacd976bac620
[]
no_license
EmanuelGabriel/brasileirao-api
https://github.com/EmanuelGabriel/brasileirao-api
673c64493df2636523e8b2b4c343e6386cef07d6
5ae98afe1563ba20e512c09928c41a1b239bfc4d
refs/heads/main
2023-02-18T05:40:03.118000
2021-01-19T16:56:21
2021-01-19T16:56:21
331,048,414
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.com.emanuelgabriel.brasileiraoapi.dto; import java.io.Serializable; import javax.validation.constraints.NotBlank; public class EquipeDTO implements Serializable { private static final long serialVersionUID = 1L; @NotBlank private String nomeEquipe; @NotBlank private String urlLogoEquipe; public EquipeDTO() { } public String getNomeEquipe() { return nomeEquipe; } public void setNomeEquipe(String nomeEquipe) { this.nomeEquipe = nomeEquipe; } public String getUrlLogoEquipe() { return urlLogoEquipe; } public void setUrlLogoEquipe(String urlLogoEquipe) { this.urlLogoEquipe = urlLogoEquipe; } }
UTF-8
Java
642
java
EquipeDTO.java
Java
[ { "context": "package br.com.emanuelgabriel.brasileiraoapi.dto;\n\nimport java.io.Serializable;", "end": 29, "score": 0.8171229362487793, "start": 15, "tag": "USERNAME", "value": "emanuelgabriel" } ]
null
[]
package br.com.emanuelgabriel.brasileiraoapi.dto; import java.io.Serializable; import javax.validation.constraints.NotBlank; public class EquipeDTO implements Serializable { private static final long serialVersionUID = 1L; @NotBlank private String nomeEquipe; @NotBlank private String urlLogoEquipe; public EquipeDTO() { } public String getNomeEquipe() { return nomeEquipe; } public void setNomeEquipe(String nomeEquipe) { this.nomeEquipe = nomeEquipe; } public String getUrlLogoEquipe() { return urlLogoEquipe; } public void setUrlLogoEquipe(String urlLogoEquipe) { this.urlLogoEquipe = urlLogoEquipe; } }
642
0.771028
0.76947
36
16.833334
18.656992
53
false
false
0
0
0
0
0
0
0.916667
false
false
7
973264d587e7e5c1d474bb685629bc9cc25e6d3e
23,983,097,444,264
c373a26f2853747ed560a38c7d07632206ffdb0f
/src/main/java/com/cameronedge/fixwiki/FixwikiUtil.java
52b340589fa38b98dbe0788181d91b0cd5c23f26
[ "Apache-2.0" ]
permissive
FIXTradingCommunity/FIXwiki
https://github.com/FIXTradingCommunity/FIXwiki
52384e33be0cdae232b5d8fd770e0d56b7e92c53
7b2bdf9f03d74af81681ec60c0d22767bc052d5d
refs/heads/master
2021-11-11T19:03:10.703000
2021-11-10T14:13:55
2021-11-10T14:13:55
46,840,455
2
2
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * Copyright (c) 2010. Cameron Edge Pty Ltd. All rights reserved. */ package com.cameronedge.fixwiki; import com.cameronedge.fixrepo.RepoUtil; import java.io.IOException; import java.io.LineNumberReader; import java.io.PrintWriter; import java.io.StringReader; import java.io.Writer; import java.util.HashSet; import java.util.List; import java.util.Set; /** * FIXwiki related utilities. * * @author John Cameron */ public class FixwikiUtil { private static Set<Character> wikiFormattingChars = new HashSet<Character>(); static { wikiFormattingChars.add(' '); wikiFormattingChars.add('*'); wikiFormattingChars.add('#'); wikiFormattingChars.add(';'); wikiFormattingChars.add(':'); wikiFormattingChars.add('='); wikiFormattingChars.add('{'); wikiFormattingChars.add('|'); wikiFormattingChars.add('!'); } public static String formatDescription(String value, LinkDetector linkDetector) { //Turn all whole words which match field or messages names into links by surrounding them with [[]] String valueWithLinks = linkDetector == null ? value : linkDetector.convert(value); String formatted = valueWithLinks; if (valueWithLinks != null && valueWithLinks.length() > 0) { LineNumberReader reader = new LineNumberReader(new StringReader(valueWithLinks)); StringBuffer result = new StringBuffer(); String s; try { while ((s = reader.readLine()) != null) { s = s.trim(); if (s.length() > 0) { s = RepoUtil.cleanText(s); char firstChar = s.charAt(0); if (firstChar <= 127) { //Normal ASCII character. //Escape it if it is some Wiki formatting character. if (wikiFormattingChars.contains(firstChar)) { result.append("<nowiki>"); result.append(firstChar); result.append("</nowiki>"); if (s.length() > 1) { result.append(s.substring(1)); } } else { result.append(s); } } else { //Special character triggers some special processing. if (firstChar == RepoUtil.BULLET) { //Treat this as a list - translate to standard Wiki list character '*'. result.append('*'); if (s.length() > 1) { result.append(s.substring(1)); } } else { result.append(s); } } } //New lines convert to double new lines, forcing a Wiki line break result.append("\n\n"); } } catch (IOException ex) { //Cannot happen processing a String } formatted = result.toString(); //Having bar characters anywhere in the string is asking for trouble! Bar is used as delimiter is passing //parameteres to Wiki templates. formatted = formatted.replace('|', ' '); } return formatted; } public static void writeWikiTable(Writer writer, List<String[]> table, LinkDetector linkDetector) { PrintWriter wikiWriter = new PrintWriter(writer); wikiWriter.println("\n{|border=\"1\""); for (String[] columns : table) { wikiWriter.println("\n|-"); for (String column : columns) { wikiWriter.print("\n|"); //Convert text to contain links. wikiWriter.print(formatDescription(column, linkDetector)); } } wikiWriter.println("\n|}"); } }
UTF-8
Java
3,553
java
FixwikiUtil.java
Java
[ { "context": ";\n\n/**\n * FIXwiki related utilities.\n *\n * @author John Cameron\n */\npublic class FixwikiUtil {\n private static S", "end": 423, "score": 0.9998788237571716, "start": 411, "tag": "NAME", "value": "John Cameron" } ]
null
[]
/* * Copyright (c) 2010. Cameron Edge Pty Ltd. All rights reserved. */ package com.cameronedge.fixwiki; import com.cameronedge.fixrepo.RepoUtil; import java.io.IOException; import java.io.LineNumberReader; import java.io.PrintWriter; import java.io.StringReader; import java.io.Writer; import java.util.HashSet; import java.util.List; import java.util.Set; /** * FIXwiki related utilities. * * @author <NAME> */ public class FixwikiUtil { private static Set<Character> wikiFormattingChars = new HashSet<Character>(); static { wikiFormattingChars.add(' '); wikiFormattingChars.add('*'); wikiFormattingChars.add('#'); wikiFormattingChars.add(';'); wikiFormattingChars.add(':'); wikiFormattingChars.add('='); wikiFormattingChars.add('{'); wikiFormattingChars.add('|'); wikiFormattingChars.add('!'); } public static String formatDescription(String value, LinkDetector linkDetector) { //Turn all whole words which match field or messages names into links by surrounding them with [[]] String valueWithLinks = linkDetector == null ? value : linkDetector.convert(value); String formatted = valueWithLinks; if (valueWithLinks != null && valueWithLinks.length() > 0) { LineNumberReader reader = new LineNumberReader(new StringReader(valueWithLinks)); StringBuffer result = new StringBuffer(); String s; try { while ((s = reader.readLine()) != null) { s = s.trim(); if (s.length() > 0) { s = RepoUtil.cleanText(s); char firstChar = s.charAt(0); if (firstChar <= 127) { //Normal ASCII character. //Escape it if it is some Wiki formatting character. if (wikiFormattingChars.contains(firstChar)) { result.append("<nowiki>"); result.append(firstChar); result.append("</nowiki>"); if (s.length() > 1) { result.append(s.substring(1)); } } else { result.append(s); } } else { //Special character triggers some special processing. if (firstChar == RepoUtil.BULLET) { //Treat this as a list - translate to standard Wiki list character '*'. result.append('*'); if (s.length() > 1) { result.append(s.substring(1)); } } else { result.append(s); } } } //New lines convert to double new lines, forcing a Wiki line break result.append("\n\n"); } } catch (IOException ex) { //Cannot happen processing a String } formatted = result.toString(); //Having bar characters anywhere in the string is asking for trouble! Bar is used as delimiter is passing //parameteres to Wiki templates. formatted = formatted.replace('|', ' '); } return formatted; } public static void writeWikiTable(Writer writer, List<String[]> table, LinkDetector linkDetector) { PrintWriter wikiWriter = new PrintWriter(writer); wikiWriter.println("\n{|border=\"1\""); for (String[] columns : table) { wikiWriter.println("\n|-"); for (String column : columns) { wikiWriter.print("\n|"); //Convert text to contain links. wikiWriter.print(formatDescription(column, linkDetector)); } } wikiWriter.println("\n|}"); } }
3,547
0.590768
0.586547
116
29.629311
25.304193
111
false
false
0
0
0
0
0
0
0.508621
false
false
7
c14455499e917ceae3f0a4748e1f5e7904cf0372
31,224,412,308,234
c86f874445e36489fb5922010d197aafc4b4b784
/src/test/java/com/bustop/service/ConverterServiceTest.java
5eead3d0728f7ae231bdde590d827346d8d7e9fe
[]
no_license
karuneshapk/bustop
https://github.com/karuneshapk/bustop
8675eaa4cf994b0505559addad5ec0725d5bc1dd
25ab6fb254e9208c2c87a273d5d88fb3e1362e69
refs/heads/master
2022-06-10T07:29:18.817000
2020-05-07T16:10:09
2020-05-07T16:10:09
261,336,264
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.bustop.service; import com.bustop.entity.Tour; import com.bustop.entity.enums.CompanyType; import com.bustop.service.ConverterService; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.runners.MockitoJUnitRunner; import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.nullValue; import static org.hamcrest.core.IsNull.notNullValue; import static org.junit.Assert.assertThat; @RunWith(MockitoJUnitRunner.class) public class ConverterServiceTest { @InjectMocks ConverterService converterService = new ConverterService(); @Test public void toTour_WhenEqualsAtOneHour_ShouldTourObject() { Tour tour = converterService.toTour("posh 01:00 02:00"); assertThat(tour, notNullValue()); } @Test public void toTour_WhenLongerThanOneHour_ShouldReturnNull() { Tour tour = converterService.toTour("posh 01:00 02:01"); assertThat(tour, nullValue()); } @Test public void toTour_WhenIsLessThanOneHour_ShouldReturnTourObject() { Tour tour = converterService.toTour("posh 01:00 01:59"); assertThat(tour, notNullValue()); } @Test public void toTour_WhenHourStringFormatIsNotFull_ShouldReturnCorrectTourObject() { Tour tour = converterService.toTour("posh 1:30 2:25"); assertThat(tour.getCompanyType(), is(CompanyType.POSH)); assertThat(tour.getDepartureTime().getHour(), is(1)); assertThat(tour.getArriveTime().getHour(), is(2)); } }
UTF-8
Java
1,506
java
ConverterServiceTest.java
Java
[]
null
[]
package com.bustop.service; import com.bustop.entity.Tour; import com.bustop.entity.enums.CompanyType; import com.bustop.service.ConverterService; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.runners.MockitoJUnitRunner; import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.nullValue; import static org.hamcrest.core.IsNull.notNullValue; import static org.junit.Assert.assertThat; @RunWith(MockitoJUnitRunner.class) public class ConverterServiceTest { @InjectMocks ConverterService converterService = new ConverterService(); @Test public void toTour_WhenEqualsAtOneHour_ShouldTourObject() { Tour tour = converterService.toTour("posh 01:00 02:00"); assertThat(tour, notNullValue()); } @Test public void toTour_WhenLongerThanOneHour_ShouldReturnNull() { Tour tour = converterService.toTour("posh 01:00 02:01"); assertThat(tour, nullValue()); } @Test public void toTour_WhenIsLessThanOneHour_ShouldReturnTourObject() { Tour tour = converterService.toTour("posh 01:00 01:59"); assertThat(tour, notNullValue()); } @Test public void toTour_WhenHourStringFormatIsNotFull_ShouldReturnCorrectTourObject() { Tour tour = converterService.toTour("posh 1:30 2:25"); assertThat(tour.getCompanyType(), is(CompanyType.POSH)); assertThat(tour.getDepartureTime().getHour(), is(1)); assertThat(tour.getArriveTime().getHour(), is(2)); } }
1,506
0.7749
0.753652
49
29.734694
24.557117
83
false
false
0
0
0
0
0
0
1.306122
false
false
7
f67b5c7332bb9efb30feca5465f4d9b29a3ba36b
11,312,943,880,810
2973656a3d07a92a2f227d8808852c9edc655630
/app/src/main/java/zbp/rupbe/sightparser/applayer/descriptors/BlockParameterType.java
289a14c6370b07dc57fd01dce9305991ff836f58
[]
no_license
oschumac/SightRemote
https://github.com/oschumac/SightRemote
21d87861fb18a86750256765ba4a9652e4074da5
229bae722da5e1b3d4dfee006e3626eed0e921a9
refs/heads/master
2021-06-21T21:17:45.087000
2017-08-14T18:31:22
2017-08-14T18:31:22
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package zbp.rupbe.sightparser.applayer.descriptors; import java.lang.reflect.Method; import zbp.rupbe.sightparser.pipeline.ByteBuf; /** * Created by Tebbe Ubben on 11.07.2017. */ public enum BlockParameterType { BYTE("readByte", "putByte", 1), SHORT("readShort", "putShort", 2), INTEGER("readInt", "putInt", 4), FLOAT("readFloat", "putDouble", 4), DOUBLE("readDouble", "putDouble", 8), LONG("readLong", "putLOng", 8), BYTES("readBytes", "putBytes", true), SHORT_LE("readShortLE", "putShortLE", 2), INTEGER_LE("readIntLE", "putIntLE", 4), FLOAT_LE("readFloatLE", "putFloatLE", 4), DOUBLE_LE("readDoubleLE", "putDoubleLE", 8), LONG_LE("readLongLE", "putLongLE", 8), BYTES_LE("readBytesLE", "putBytesLE", true), BOOLEAN("readBoolean", "putBoolean", 2), ENUM("readEnum", "putEnum", 2, Class.class); private Method byteBufReadMethod; private Method byteBufPutMethod; private boolean isArray = false; private int valueSize = 0; BlockParameterType(String readMethod, String putMethod, int valueSize, Class arg) { try { byteBufReadMethod = ByteBuf.class.getMethod(readMethod, arg); byteBufPutMethod = ByteBuf.class.getMethod(putMethod); this.valueSize = valueSize; } catch (NoSuchMethodException e) { e.printStackTrace(); } } BlockParameterType(String readMethod, String putMethod, int valueSize) { this(readMethod, putMethod, 0, null); } BlockParameterType(String readMethod, String putMethod, boolean isArray) { this(readMethod, putMethod, 0, isArray ? Integer.class : null); isArray = true; } public boolean isArray() { return isArray; } public Method getReadMethod() { return byteBufReadMethod; } public Method getPutMethod() { return byteBufPutMethod; } public int getValueSize() { return valueSize; } }
UTF-8
Java
1,978
java
BlockParameterType.java
Java
[ { "context": "e.sightparser.pipeline.ByteBuf;\n\n/**\n * Created by Tebbe Ubben on 11.07.2017.\n */\n\npublic enum BlockParameterTyp", "end": 164, "score": 0.9998763203620911, "start": 153, "tag": "NAME", "value": "Tebbe Ubben" } ]
null
[]
package zbp.rupbe.sightparser.applayer.descriptors; import java.lang.reflect.Method; import zbp.rupbe.sightparser.pipeline.ByteBuf; /** * Created by <NAME> on 11.07.2017. */ public enum BlockParameterType { BYTE("readByte", "putByte", 1), SHORT("readShort", "putShort", 2), INTEGER("readInt", "putInt", 4), FLOAT("readFloat", "putDouble", 4), DOUBLE("readDouble", "putDouble", 8), LONG("readLong", "putLOng", 8), BYTES("readBytes", "putBytes", true), SHORT_LE("readShortLE", "putShortLE", 2), INTEGER_LE("readIntLE", "putIntLE", 4), FLOAT_LE("readFloatLE", "putFloatLE", 4), DOUBLE_LE("readDoubleLE", "putDoubleLE", 8), LONG_LE("readLongLE", "putLongLE", 8), BYTES_LE("readBytesLE", "putBytesLE", true), BOOLEAN("readBoolean", "putBoolean", 2), ENUM("readEnum", "putEnum", 2, Class.class); private Method byteBufReadMethod; private Method byteBufPutMethod; private boolean isArray = false; private int valueSize = 0; BlockParameterType(String readMethod, String putMethod, int valueSize, Class arg) { try { byteBufReadMethod = ByteBuf.class.getMethod(readMethod, arg); byteBufPutMethod = ByteBuf.class.getMethod(putMethod); this.valueSize = valueSize; } catch (NoSuchMethodException e) { e.printStackTrace(); } } BlockParameterType(String readMethod, String putMethod, int valueSize) { this(readMethod, putMethod, 0, null); } BlockParameterType(String readMethod, String putMethod, boolean isArray) { this(readMethod, putMethod, 0, isArray ? Integer.class : null); isArray = true; } public boolean isArray() { return isArray; } public Method getReadMethod() { return byteBufReadMethod; } public Method getPutMethod() { return byteBufPutMethod; } public int getValueSize() { return valueSize; } }
1,973
0.64459
0.632457
70
27.257143
22.946949
87
false
false
0
0
0
0
0
0
1.114286
false
false
7
7bad9e142209c557b7295d95833133c3ecdcb5d5
11,312,943,878,538
350f75ca150b3e4ec4dddcef467859be08c12df2
/SQLama-plugin/src/sqlama/plugin/type/Editor.java
d5c01b251bc40f9e51355102a96e879dc77319f0
[]
no_license
Suhestvitelnoe/SQLama
https://github.com/Suhestvitelnoe/SQLama
ea92106faf59060e1ed9d4563f6a3b4900d67fcc
3d18938faa94ae4390bf8fd9ac63da7c2bdd3f68
refs/heads/master
2020-04-03T09:36:29.048000
2015-05-12T10:26:03
2015-05-12T10:26:03
67,889,498
1
0
null
true
2016-09-10T19:11:08
2016-09-10T19:11:07
2015-05-07T13:43:49
2015-05-12T10:26:17
260
0
0
0
null
null
null
package sqlama.plugin.type; /** * * @author marduke */ public abstract class Editor extends PluginBase { @Override public final boolean isUnique() { return true; } @Override public final PluginType getType() { return PluginType.EDITOR; } }
UTF-8
Java
290
java
Editor.java
Java
[ { "context": "\npackage sqlama.plugin.type;\n\n/**\n *\n * @author marduke\n */\npublic abstract class Editor extends PluginBa", "end": 55, "score": 0.9995548725128174, "start": 48, "tag": "USERNAME", "value": "marduke" } ]
null
[]
package sqlama.plugin.type; /** * * @author marduke */ public abstract class Editor extends PluginBase { @Override public final boolean isUnique() { return true; } @Override public final PluginType getType() { return PluginType.EDITOR; } }
290
0.62069
0.62069
17
16
15.161872
49
false
false
0
0
0
0
0
0
0.176471
false
false
7
272d06219a8ffe47744dbc709b7808e542820300
28,295,244,580,951
ffa47987c48b3a2e83dcd24129a750768a8a48f4
/src/ru/storex/homedit/gxt/client/Homedit.java
ed1e79030640d5580cb6cca4037a13136da4af01
[]
no_license
storex/homedit
https://github.com/storex/homedit
cd6496b4a58b741673e46a55320cb05da4cec1ba
8565d5da67072d6181b45a668119e0806a1cd955
refs/heads/master
2016-05-28T22:25:25.088000
2014-09-20T07:34:30
2014-09-20T07:34:30
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ru.storex.homedit.gxt.client; import com.google.gwt.core.client.EntryPoint; /** * Created by storex on 16.09.2014. */ public class Homedit implements EntryPoint { public void onModuleLoad() { } }
UTF-8
Java
216
java
Homedit.java
Java
[ { "context": "gle.gwt.core.client.EntryPoint;\n\n/**\n * Created by storex on 16.09.2014.\n */\npublic class Homedit implement", "end": 110, "score": 0.9994632005691528, "start": 104, "tag": "USERNAME", "value": "storex" } ]
null
[]
package ru.storex.homedit.gxt.client; import com.google.gwt.core.client.EntryPoint; /** * Created by storex on 16.09.2014. */ public class Homedit implements EntryPoint { public void onModuleLoad() { } }
216
0.712963
0.675926
11
18.636364
18.592632
45
false
false
0
0
0
0
0
0
0.181818
false
false
7
f7cada3a9362745b0830fa67edfc49a81aab92a7
3,642,132,310,121
1b1c401d5facb2839c233773fcebefe346f3c076
/MultiTool/src/main/java/chabernac/task/gui/TaskTreeModel.java
dc39ce29f53e40c21ad5846423faf8e90f2784ba
[]
no_license
guychauliac/p2pmessenger
https://github.com/guychauliac/p2pmessenger
a0836cc8ff9c83b5ba95879f0ebfc8d5a1eea321
1652844014ddb9de00497505ffb14f122adcf57a
refs/heads/master
2023-05-09T01:29:36.992000
2017-11-20T15:09:57
2017-11-20T15:09:57
43,264,205
0
0
null
false
2021-06-04T01:00:10
2015-09-27T20:43:38
2017-07-31T09:35:23
2021-06-04T01:00:07
68,503
0
0
59
Java
false
false
package chabernac.task.gui; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.TreeNode; import chabernac.application.ApplicationRefBase; import chabernac.task.Task; public class TaskTreeModel extends DefaultTreeModel { private boolean showFinishedTasks = true; public TaskTreeModel() { super((Task)ApplicationRefBase.getInstance().get(ApplicationRefBase.ROOTTASK)); } public int getChildCount(Object aParent){ Task theTask = (Task)aParent; if(showFinishedTasks) return theTask.getChildCount(); return getUnfinishedChildren(theTask); } public Object getChild(Object aParent, int index){ Task theTask = (Task)aParent; TreeNode theChild = null; if(showFinishedTasks) { theChild = theTask.getChildAt(index); } else { theChild = getUnfinishedChildAt((Task)aParent, index); } return theChild; } public void setShowFinished(boolean showFinished){ showFinishedTasks = showFinished; } public static int getUnfinishedChildren(Task aTask){ int counter = 0; for(int i=0;i<aTask.getChildCount();i++){ if(!((Task)aTask.getChildAt(i)).isCompleted()) counter++; } return counter; } public Task getUnfinishedChildAt(Task aTask, int index){ int counter = 0; for(int i=0;i<aTask.getChildCount();i++){ if(!((Task)aTask.getChildAt(i)).isCompleted()){ if(counter == index) return (Task)aTask.getChildAt(i); counter++; } } return null; } public boolean isShowFinishedVisible() { return showFinishedTasks; } }
UTF-8
Java
1,643
java
TaskTreeModel.java
Java
[]
null
[]
package chabernac.task.gui; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.TreeNode; import chabernac.application.ApplicationRefBase; import chabernac.task.Task; public class TaskTreeModel extends DefaultTreeModel { private boolean showFinishedTasks = true; public TaskTreeModel() { super((Task)ApplicationRefBase.getInstance().get(ApplicationRefBase.ROOTTASK)); } public int getChildCount(Object aParent){ Task theTask = (Task)aParent; if(showFinishedTasks) return theTask.getChildCount(); return getUnfinishedChildren(theTask); } public Object getChild(Object aParent, int index){ Task theTask = (Task)aParent; TreeNode theChild = null; if(showFinishedTasks) { theChild = theTask.getChildAt(index); } else { theChild = getUnfinishedChildAt((Task)aParent, index); } return theChild; } public void setShowFinished(boolean showFinished){ showFinishedTasks = showFinished; } public static int getUnfinishedChildren(Task aTask){ int counter = 0; for(int i=0;i<aTask.getChildCount();i++){ if(!((Task)aTask.getChildAt(i)).isCompleted()) counter++; } return counter; } public Task getUnfinishedChildAt(Task aTask, int index){ int counter = 0; for(int i=0;i<aTask.getChildCount();i++){ if(!((Task)aTask.getChildAt(i)).isCompleted()){ if(counter == index) return (Task)aTask.getChildAt(i); counter++; } } return null; } public boolean isShowFinishedVisible() { return showFinishedTasks; } }
1,643
0.666464
0.664029
59
25.847458
22.017569
83
false
false
0
0
0
0
0
0
0.525424
false
false
7
5141f0159ffa9b9b72950924f3f013fd8b785a44
19,816,979,134,332
b1854dce51b781a4e001f9206c906b7e7e78ad8d
/src/main/java/it/polimi/ingsw/ps31/model/stateModel/StateAllDevelopmentCard.java
576884d0ab24dedbfd1ede143ab3e22fb6ed8333
[]
no_license
Ciuse/Millenium_Bug
https://github.com/Ciuse/Millenium_Bug
1b573e8232cc40923e0e9c8d9fb76d8068577a94
d4194168ea5d31d0abbabf2d4986d33b3bd1c81a
refs/heads/master
2021-09-08T10:18:35.192000
2017-07-11T11:59:04
2017-07-11T11:59:04
86,914,853
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package it.polimi.ingsw.ps31.model.stateModel; import java.util.ArrayList; import java.util.List; /** * Created by Giuseppe on 30/06/2017. * Stato che raccoglie tutti gli stati dei delle carte sviluppo per ottimizzarne l invio quando è necessario aggiornarle tutte * * @see StateType * @see it.polimi.ingsw.ps31.messages.messageMV.MVUpdateState * @see StateDevelopmentCard */ public class StateAllDevelopmentCard extends StateType { private List<StateDevelopmentCard> stateDevelopmentCardList=new ArrayList<>(); public List<StateDevelopmentCard> getStateDevelopmentCardList() { return stateDevelopmentCardList; } public StateAllDevelopmentCard(List<StateDevelopmentCard> stateDevelopmentCardList) { this.stateDevelopmentCardList = stateDevelopmentCardList; } @Override public void acceptState(StateVisitor stateVisitor) { stateVisitor.visit(this); } }
UTF-8
Java
921
java
StateAllDevelopmentCard.java
Java
[ { "context": "rayList;\nimport java.util.List;\n\n/**\n * Created by Giuseppe on 30/06/2017.\n * Stato che raccoglie tutti", "end": 120, "score": 0.703862190246582, "start": 118, "tag": "NAME", "value": "Gi" }, { "context": "List;\nimport java.util.List;\n\n/**\n * Created by Giuseppe on 30/06/2017.\n * Stato che raccoglie tutti gli s", "end": 126, "score": 0.7981667518615723, "start": 120, "tag": "USERNAME", "value": "useppe" } ]
null
[]
package it.polimi.ingsw.ps31.model.stateModel; import java.util.ArrayList; import java.util.List; /** * Created by Giuseppe on 30/06/2017. * Stato che raccoglie tutti gli stati dei delle carte sviluppo per ottimizzarne l invio quando è necessario aggiornarle tutte * * @see StateType * @see it.polimi.ingsw.ps31.messages.messageMV.MVUpdateState * @see StateDevelopmentCard */ public class StateAllDevelopmentCard extends StateType { private List<StateDevelopmentCard> stateDevelopmentCardList=new ArrayList<>(); public List<StateDevelopmentCard> getStateDevelopmentCardList() { return stateDevelopmentCardList; } public StateAllDevelopmentCard(List<StateDevelopmentCard> stateDevelopmentCardList) { this.stateDevelopmentCardList = stateDevelopmentCardList; } @Override public void acceptState(StateVisitor stateVisitor) { stateVisitor.visit(this); } }
921
0.765217
0.752174
29
30.724138
32.616791
126
false
false
0
0
0
0
0
0
0.241379
false
false
7
2a498de399641b68db1ccd2de1300f5df5b7c415
28,166,395,577,029
5e02902ff5f548c4c41ab37e4e69eab79d3f707a
/tank/src/game/tank/Main.java
2f31cc923a531c631bfe6579c4bc8cd85644120d
[]
no_license
MaisonWan/tank
https://github.com/MaisonWan/tank
bebce5d5fc6113e341a696cce23bf2d9a3231ff2
ca1968597ba45b0de61b755f4ccf99e0e6dc7261
refs/heads/master
2020-04-10T22:43:21.580000
2015-10-26T07:53:10
2015-10-26T07:53:10
21,342,056
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package game.tank; import game.tank.listener.DirectionListener; import game.tank.listener.FireMouseListener; import game.tank.ui.TankPanel; import java.awt.Container; import java.awt.Toolkit; import javax.swing.JFrame; public class Main { public static void main(String[] args) { JFrame frame = new JFrame(); frame.setTitle("坦克大战"); TankPanel panel = new TankPanel(); panel.setFrame(frame); Container contentPane = frame.getContentPane(); contentPane.add(panel); frame.pack(); frame.setResizable(false); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); // 居中显示 int winWidth = frame.getWidth(); int winHeight = frame.getHeight(); Toolkit kit = Toolkit.getDefaultToolkit(); int screenWidth = kit.getScreenSize().width; int screenHeight = kit.getScreenSize().height; frame.setLocation((screenWidth - winWidth) / 2, (screenHeight - winHeight) / 2); // 添加监听器 FireMouseListener fireListener = new FireMouseListener(panel); frame.addKeyListener(new DirectionListener(panel)); frame.addMouseListener(fireListener); frame.setFocusable(true); // this line is necessary } }
GB18030
Java
1,221
java
Main.java
Java
[]
null
[]
package game.tank; import game.tank.listener.DirectionListener; import game.tank.listener.FireMouseListener; import game.tank.ui.TankPanel; import java.awt.Container; import java.awt.Toolkit; import javax.swing.JFrame; public class Main { public static void main(String[] args) { JFrame frame = new JFrame(); frame.setTitle("坦克大战"); TankPanel panel = new TankPanel(); panel.setFrame(frame); Container contentPane = frame.getContentPane(); contentPane.add(panel); frame.pack(); frame.setResizable(false); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); // 居中显示 int winWidth = frame.getWidth(); int winHeight = frame.getHeight(); Toolkit kit = Toolkit.getDefaultToolkit(); int screenWidth = kit.getScreenSize().width; int screenHeight = kit.getScreenSize().height; frame.setLocation((screenWidth - winWidth) / 2, (screenHeight - winHeight) / 2); // 添加监听器 FireMouseListener fireListener = new FireMouseListener(panel); frame.addKeyListener(new DirectionListener(panel)); frame.addMouseListener(fireListener); frame.setFocusable(true); // this line is necessary } }
1,221
0.716318
0.714644
42
26.452381
20.542873
82
false
false
0
0
0
0
0
0
1.904762
false
false
7
8f5d4b41661ee9f485b92da1977565144d1bba7d
30,820,685,356,935
322de170efbb6d9f0a16aeced88cd2c4354ab67b
/src/Backend/ItemCondition.java
102526a7ea532f83cc079663ce392bda29315e6d
[]
no_license
jmatulaa/CarShowroomApplication
https://github.com/jmatulaa/CarShowroomApplication
d5e41bebe0893b63d8dbd6c1dbd8f6cdc95db4ae
436d07835169193f4f2a9581b1c71ca9a6ba8fad
refs/heads/main
2023-05-31T02:24:22.145000
2021-06-21T13:50:13
2021-06-21T13:50:13
367,687,478
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package Backend; public enum ItemCondition { NEW, USED, DEMAGED; }
UTF-8
Java
72
java
ItemCondition.java
Java
[]
null
[]
package Backend; public enum ItemCondition { NEW, USED, DEMAGED; }
72
0.708333
0.708333
5
13.4
11.110355
27
false
false
0
0
0
0
0
0
0.8
false
false
7
63142e112a82c6d4e93c29484c0588762c406647
180,388,675,003
fc160694094b89ab09e5c9a0f03db80437eabc93
/java-kms/google-cloud-kms/src/main/java/com/google/cloud/kms/v1/stub/GrpcKeyManagementServiceStub.java
fc09861fa41437c3cc5d791ba84828c9bb902252
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
googleapis/google-cloud-java
https://github.com/googleapis/google-cloud-java
4f4d97a145e0310db142ecbc3340ce3a2a444e5e
6e23c3a406e19af410a1a1dd0d0487329875040e
refs/heads/main
2023-09-04T09:09:02.481000
2023-08-31T20:45:11
2023-08-31T20:45:11
26,181,278
1,122
685
Apache-2.0
false
2023-09-13T21:21:23
2014-11-04T17:57:16
2023-09-13T01:26:53
2023-09-13T21:21:22
662,277
1,769
1,100
75
Java
false
false
/* * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.cloud.kms.v1.stub; import static com.google.cloud.kms.v1.KeyManagementServiceClient.ListCryptoKeyVersionsPagedResponse; import static com.google.cloud.kms.v1.KeyManagementServiceClient.ListCryptoKeysPagedResponse; import static com.google.cloud.kms.v1.KeyManagementServiceClient.ListImportJobsPagedResponse; import static com.google.cloud.kms.v1.KeyManagementServiceClient.ListKeyRingsPagedResponse; import static com.google.cloud.kms.v1.KeyManagementServiceClient.ListLocationsPagedResponse; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcStubCallableFactory; import com.google.api.gax.rpc.ClientContext; import com.google.api.gax.rpc.RequestParamsBuilder; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.kms.v1.AsymmetricDecryptRequest; import com.google.cloud.kms.v1.AsymmetricDecryptResponse; import com.google.cloud.kms.v1.AsymmetricSignRequest; import com.google.cloud.kms.v1.AsymmetricSignResponse; import com.google.cloud.kms.v1.CreateCryptoKeyRequest; import com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest; import com.google.cloud.kms.v1.CreateImportJobRequest; import com.google.cloud.kms.v1.CreateKeyRingRequest; import com.google.cloud.kms.v1.CryptoKey; import com.google.cloud.kms.v1.CryptoKeyVersion; import com.google.cloud.kms.v1.DecryptRequest; import com.google.cloud.kms.v1.DecryptResponse; import com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest; import com.google.cloud.kms.v1.EncryptRequest; import com.google.cloud.kms.v1.EncryptResponse; import com.google.cloud.kms.v1.GenerateRandomBytesRequest; import com.google.cloud.kms.v1.GenerateRandomBytesResponse; import com.google.cloud.kms.v1.GetCryptoKeyRequest; import com.google.cloud.kms.v1.GetCryptoKeyVersionRequest; import com.google.cloud.kms.v1.GetImportJobRequest; import com.google.cloud.kms.v1.GetKeyRingRequest; import com.google.cloud.kms.v1.GetPublicKeyRequest; import com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest; import com.google.cloud.kms.v1.ImportJob; import com.google.cloud.kms.v1.KeyRing; import com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest; import com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse; import com.google.cloud.kms.v1.ListCryptoKeysRequest; import com.google.cloud.kms.v1.ListCryptoKeysResponse; import com.google.cloud.kms.v1.ListImportJobsRequest; import com.google.cloud.kms.v1.ListImportJobsResponse; import com.google.cloud.kms.v1.ListKeyRingsRequest; import com.google.cloud.kms.v1.ListKeyRingsResponse; import com.google.cloud.kms.v1.MacSignRequest; import com.google.cloud.kms.v1.MacSignResponse; import com.google.cloud.kms.v1.MacVerifyRequest; import com.google.cloud.kms.v1.MacVerifyResponse; import com.google.cloud.kms.v1.PublicKey; import com.google.cloud.kms.v1.RawDecryptRequest; import com.google.cloud.kms.v1.RawDecryptResponse; import com.google.cloud.kms.v1.RawEncryptRequest; import com.google.cloud.kms.v1.RawEncryptResponse; import com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest; import com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest; import com.google.cloud.kms.v1.UpdateCryptoKeyRequest; import com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest; import com.google.cloud.location.GetLocationRequest; import com.google.cloud.location.ListLocationsRequest; import com.google.cloud.location.ListLocationsResponse; import com.google.cloud.location.Location; import com.google.iam.v1.GetIamPolicyRequest; import com.google.iam.v1.Policy; import com.google.iam.v1.SetIamPolicyRequest; import com.google.iam.v1.TestIamPermissionsRequest; import com.google.iam.v1.TestIamPermissionsResponse; import com.google.longrunning.stub.GrpcOperationsStub; import io.grpc.MethodDescriptor; import io.grpc.protobuf.ProtoUtils; import java.io.IOException; import java.util.concurrent.TimeUnit; import javax.annotation.Generated; // AUTO-GENERATED DOCUMENTATION AND CLASS. /** * gRPC stub implementation for the KeyManagementService service API. * * <p>This class is for advanced usage and reflects the underlying API directly. */ @Generated("by gapic-generator-java") public class GrpcKeyManagementServiceStub extends KeyManagementServiceStub { private static final MethodDescriptor<ListKeyRingsRequest, ListKeyRingsResponse> listKeyRingsMethodDescriptor = MethodDescriptor.<ListKeyRingsRequest, ListKeyRingsResponse>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/ListKeyRings") .setRequestMarshaller(ProtoUtils.marshaller(ListKeyRingsRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(ListKeyRingsResponse.getDefaultInstance())) .build(); private static final MethodDescriptor<ListCryptoKeysRequest, ListCryptoKeysResponse> listCryptoKeysMethodDescriptor = MethodDescriptor.<ListCryptoKeysRequest, ListCryptoKeysResponse>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/ListCryptoKeys") .setRequestMarshaller( ProtoUtils.marshaller(ListCryptoKeysRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(ListCryptoKeysResponse.getDefaultInstance())) .build(); private static final MethodDescriptor<ListCryptoKeyVersionsRequest, ListCryptoKeyVersionsResponse> listCryptoKeyVersionsMethodDescriptor = MethodDescriptor.<ListCryptoKeyVersionsRequest, ListCryptoKeyVersionsResponse>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/ListCryptoKeyVersions") .setRequestMarshaller( ProtoUtils.marshaller(ListCryptoKeyVersionsRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(ListCryptoKeyVersionsResponse.getDefaultInstance())) .build(); private static final MethodDescriptor<ListImportJobsRequest, ListImportJobsResponse> listImportJobsMethodDescriptor = MethodDescriptor.<ListImportJobsRequest, ListImportJobsResponse>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/ListImportJobs") .setRequestMarshaller( ProtoUtils.marshaller(ListImportJobsRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(ListImportJobsResponse.getDefaultInstance())) .build(); private static final MethodDescriptor<GetKeyRingRequest, KeyRing> getKeyRingMethodDescriptor = MethodDescriptor.<GetKeyRingRequest, KeyRing>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/GetKeyRing") .setRequestMarshaller(ProtoUtils.marshaller(GetKeyRingRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(KeyRing.getDefaultInstance())) .build(); private static final MethodDescriptor<GetCryptoKeyRequest, CryptoKey> getCryptoKeyMethodDescriptor = MethodDescriptor.<GetCryptoKeyRequest, CryptoKey>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/GetCryptoKey") .setRequestMarshaller(ProtoUtils.marshaller(GetCryptoKeyRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(CryptoKey.getDefaultInstance())) .build(); private static final MethodDescriptor<GetCryptoKeyVersionRequest, CryptoKeyVersion> getCryptoKeyVersionMethodDescriptor = MethodDescriptor.<GetCryptoKeyVersionRequest, CryptoKeyVersion>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/GetCryptoKeyVersion") .setRequestMarshaller( ProtoUtils.marshaller(GetCryptoKeyVersionRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(CryptoKeyVersion.getDefaultInstance())) .build(); private static final MethodDescriptor<GetPublicKeyRequest, PublicKey> getPublicKeyMethodDescriptor = MethodDescriptor.<GetPublicKeyRequest, PublicKey>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/GetPublicKey") .setRequestMarshaller(ProtoUtils.marshaller(GetPublicKeyRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(PublicKey.getDefaultInstance())) .build(); private static final MethodDescriptor<GetImportJobRequest, ImportJob> getImportJobMethodDescriptor = MethodDescriptor.<GetImportJobRequest, ImportJob>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/GetImportJob") .setRequestMarshaller(ProtoUtils.marshaller(GetImportJobRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(ImportJob.getDefaultInstance())) .build(); private static final MethodDescriptor<CreateKeyRingRequest, KeyRing> createKeyRingMethodDescriptor = MethodDescriptor.<CreateKeyRingRequest, KeyRing>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/CreateKeyRing") .setRequestMarshaller( ProtoUtils.marshaller(CreateKeyRingRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(KeyRing.getDefaultInstance())) .build(); private static final MethodDescriptor<CreateCryptoKeyRequest, CryptoKey> createCryptoKeyMethodDescriptor = MethodDescriptor.<CreateCryptoKeyRequest, CryptoKey>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/CreateCryptoKey") .setRequestMarshaller( ProtoUtils.marshaller(CreateCryptoKeyRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(CryptoKey.getDefaultInstance())) .build(); private static final MethodDescriptor<CreateCryptoKeyVersionRequest, CryptoKeyVersion> createCryptoKeyVersionMethodDescriptor = MethodDescriptor.<CreateCryptoKeyVersionRequest, CryptoKeyVersion>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/CreateCryptoKeyVersion") .setRequestMarshaller( ProtoUtils.marshaller(CreateCryptoKeyVersionRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(CryptoKeyVersion.getDefaultInstance())) .build(); private static final MethodDescriptor<ImportCryptoKeyVersionRequest, CryptoKeyVersion> importCryptoKeyVersionMethodDescriptor = MethodDescriptor.<ImportCryptoKeyVersionRequest, CryptoKeyVersion>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/ImportCryptoKeyVersion") .setRequestMarshaller( ProtoUtils.marshaller(ImportCryptoKeyVersionRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(CryptoKeyVersion.getDefaultInstance())) .build(); private static final MethodDescriptor<CreateImportJobRequest, ImportJob> createImportJobMethodDescriptor = MethodDescriptor.<CreateImportJobRequest, ImportJob>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/CreateImportJob") .setRequestMarshaller( ProtoUtils.marshaller(CreateImportJobRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(ImportJob.getDefaultInstance())) .build(); private static final MethodDescriptor<UpdateCryptoKeyRequest, CryptoKey> updateCryptoKeyMethodDescriptor = MethodDescriptor.<UpdateCryptoKeyRequest, CryptoKey>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/UpdateCryptoKey") .setRequestMarshaller( ProtoUtils.marshaller(UpdateCryptoKeyRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(CryptoKey.getDefaultInstance())) .build(); private static final MethodDescriptor<UpdateCryptoKeyVersionRequest, CryptoKeyVersion> updateCryptoKeyVersionMethodDescriptor = MethodDescriptor.<UpdateCryptoKeyVersionRequest, CryptoKeyVersion>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/UpdateCryptoKeyVersion") .setRequestMarshaller( ProtoUtils.marshaller(UpdateCryptoKeyVersionRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(CryptoKeyVersion.getDefaultInstance())) .build(); private static final MethodDescriptor<UpdateCryptoKeyPrimaryVersionRequest, CryptoKey> updateCryptoKeyPrimaryVersionMethodDescriptor = MethodDescriptor.<UpdateCryptoKeyPrimaryVersionRequest, CryptoKey>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.cloud.kms.v1.KeyManagementService/UpdateCryptoKeyPrimaryVersion") .setRequestMarshaller( ProtoUtils.marshaller(UpdateCryptoKeyPrimaryVersionRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(CryptoKey.getDefaultInstance())) .build(); private static final MethodDescriptor<DestroyCryptoKeyVersionRequest, CryptoKeyVersion> destroyCryptoKeyVersionMethodDescriptor = MethodDescriptor.<DestroyCryptoKeyVersionRequest, CryptoKeyVersion>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/DestroyCryptoKeyVersion") .setRequestMarshaller( ProtoUtils.marshaller(DestroyCryptoKeyVersionRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(CryptoKeyVersion.getDefaultInstance())) .build(); private static final MethodDescriptor<RestoreCryptoKeyVersionRequest, CryptoKeyVersion> restoreCryptoKeyVersionMethodDescriptor = MethodDescriptor.<RestoreCryptoKeyVersionRequest, CryptoKeyVersion>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/RestoreCryptoKeyVersion") .setRequestMarshaller( ProtoUtils.marshaller(RestoreCryptoKeyVersionRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(CryptoKeyVersion.getDefaultInstance())) .build(); private static final MethodDescriptor<EncryptRequest, EncryptResponse> encryptMethodDescriptor = MethodDescriptor.<EncryptRequest, EncryptResponse>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/Encrypt") .setRequestMarshaller(ProtoUtils.marshaller(EncryptRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(EncryptResponse.getDefaultInstance())) .build(); private static final MethodDescriptor<DecryptRequest, DecryptResponse> decryptMethodDescriptor = MethodDescriptor.<DecryptRequest, DecryptResponse>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/Decrypt") .setRequestMarshaller(ProtoUtils.marshaller(DecryptRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(DecryptResponse.getDefaultInstance())) .build(); private static final MethodDescriptor<RawEncryptRequest, RawEncryptResponse> rawEncryptMethodDescriptor = MethodDescriptor.<RawEncryptRequest, RawEncryptResponse>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/RawEncrypt") .setRequestMarshaller(ProtoUtils.marshaller(RawEncryptRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(RawEncryptResponse.getDefaultInstance())) .build(); private static final MethodDescriptor<RawDecryptRequest, RawDecryptResponse> rawDecryptMethodDescriptor = MethodDescriptor.<RawDecryptRequest, RawDecryptResponse>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/RawDecrypt") .setRequestMarshaller(ProtoUtils.marshaller(RawDecryptRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(RawDecryptResponse.getDefaultInstance())) .build(); private static final MethodDescriptor<AsymmetricSignRequest, AsymmetricSignResponse> asymmetricSignMethodDescriptor = MethodDescriptor.<AsymmetricSignRequest, AsymmetricSignResponse>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/AsymmetricSign") .setRequestMarshaller( ProtoUtils.marshaller(AsymmetricSignRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(AsymmetricSignResponse.getDefaultInstance())) .build(); private static final MethodDescriptor<AsymmetricDecryptRequest, AsymmetricDecryptResponse> asymmetricDecryptMethodDescriptor = MethodDescriptor.<AsymmetricDecryptRequest, AsymmetricDecryptResponse>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/AsymmetricDecrypt") .setRequestMarshaller( ProtoUtils.marshaller(AsymmetricDecryptRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(AsymmetricDecryptResponse.getDefaultInstance())) .build(); private static final MethodDescriptor<MacSignRequest, MacSignResponse> macSignMethodDescriptor = MethodDescriptor.<MacSignRequest, MacSignResponse>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/MacSign") .setRequestMarshaller(ProtoUtils.marshaller(MacSignRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(MacSignResponse.getDefaultInstance())) .build(); private static final MethodDescriptor<MacVerifyRequest, MacVerifyResponse> macVerifyMethodDescriptor = MethodDescriptor.<MacVerifyRequest, MacVerifyResponse>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/MacVerify") .setRequestMarshaller(ProtoUtils.marshaller(MacVerifyRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(MacVerifyResponse.getDefaultInstance())) .build(); private static final MethodDescriptor<GenerateRandomBytesRequest, GenerateRandomBytesResponse> generateRandomBytesMethodDescriptor = MethodDescriptor.<GenerateRandomBytesRequest, GenerateRandomBytesResponse>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/GenerateRandomBytes") .setRequestMarshaller( ProtoUtils.marshaller(GenerateRandomBytesRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(GenerateRandomBytesResponse.getDefaultInstance())) .build(); private static final MethodDescriptor<ListLocationsRequest, ListLocationsResponse> listLocationsMethodDescriptor = MethodDescriptor.<ListLocationsRequest, ListLocationsResponse>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.location.Locations/ListLocations") .setRequestMarshaller( ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) .build(); private static final MethodDescriptor<GetLocationRequest, Location> getLocationMethodDescriptor = MethodDescriptor.<GetLocationRequest, Location>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.location.Locations/GetLocation") .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) .build(); private static final MethodDescriptor<SetIamPolicyRequest, Policy> setIamPolicyMethodDescriptor = MethodDescriptor.<SetIamPolicyRequest, Policy>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.iam.v1.IAMPolicy/SetIamPolicy") .setRequestMarshaller(ProtoUtils.marshaller(SetIamPolicyRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance())) .build(); private static final MethodDescriptor<GetIamPolicyRequest, Policy> getIamPolicyMethodDescriptor = MethodDescriptor.<GetIamPolicyRequest, Policy>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.iam.v1.IAMPolicy/GetIamPolicy") .setRequestMarshaller(ProtoUtils.marshaller(GetIamPolicyRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance())) .build(); private static final MethodDescriptor<TestIamPermissionsRequest, TestIamPermissionsResponse> testIamPermissionsMethodDescriptor = MethodDescriptor.<TestIamPermissionsRequest, TestIamPermissionsResponse>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.iam.v1.IAMPolicy/TestIamPermissions") .setRequestMarshaller( ProtoUtils.marshaller(TestIamPermissionsRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(TestIamPermissionsResponse.getDefaultInstance())) .build(); private final UnaryCallable<ListKeyRingsRequest, ListKeyRingsResponse> listKeyRingsCallable; private final UnaryCallable<ListKeyRingsRequest, ListKeyRingsPagedResponse> listKeyRingsPagedCallable; private final UnaryCallable<ListCryptoKeysRequest, ListCryptoKeysResponse> listCryptoKeysCallable; private final UnaryCallable<ListCryptoKeysRequest, ListCryptoKeysPagedResponse> listCryptoKeysPagedCallable; private final UnaryCallable<ListCryptoKeyVersionsRequest, ListCryptoKeyVersionsResponse> listCryptoKeyVersionsCallable; private final UnaryCallable<ListCryptoKeyVersionsRequest, ListCryptoKeyVersionsPagedResponse> listCryptoKeyVersionsPagedCallable; private final UnaryCallable<ListImportJobsRequest, ListImportJobsResponse> listImportJobsCallable; private final UnaryCallable<ListImportJobsRequest, ListImportJobsPagedResponse> listImportJobsPagedCallable; private final UnaryCallable<GetKeyRingRequest, KeyRing> getKeyRingCallable; private final UnaryCallable<GetCryptoKeyRequest, CryptoKey> getCryptoKeyCallable; private final UnaryCallable<GetCryptoKeyVersionRequest, CryptoKeyVersion> getCryptoKeyVersionCallable; private final UnaryCallable<GetPublicKeyRequest, PublicKey> getPublicKeyCallable; private final UnaryCallable<GetImportJobRequest, ImportJob> getImportJobCallable; private final UnaryCallable<CreateKeyRingRequest, KeyRing> createKeyRingCallable; private final UnaryCallable<CreateCryptoKeyRequest, CryptoKey> createCryptoKeyCallable; private final UnaryCallable<CreateCryptoKeyVersionRequest, CryptoKeyVersion> createCryptoKeyVersionCallable; private final UnaryCallable<ImportCryptoKeyVersionRequest, CryptoKeyVersion> importCryptoKeyVersionCallable; private final UnaryCallable<CreateImportJobRequest, ImportJob> createImportJobCallable; private final UnaryCallable<UpdateCryptoKeyRequest, CryptoKey> updateCryptoKeyCallable; private final UnaryCallable<UpdateCryptoKeyVersionRequest, CryptoKeyVersion> updateCryptoKeyVersionCallable; private final UnaryCallable<UpdateCryptoKeyPrimaryVersionRequest, CryptoKey> updateCryptoKeyPrimaryVersionCallable; private final UnaryCallable<DestroyCryptoKeyVersionRequest, CryptoKeyVersion> destroyCryptoKeyVersionCallable; private final UnaryCallable<RestoreCryptoKeyVersionRequest, CryptoKeyVersion> restoreCryptoKeyVersionCallable; private final UnaryCallable<EncryptRequest, EncryptResponse> encryptCallable; private final UnaryCallable<DecryptRequest, DecryptResponse> decryptCallable; private final UnaryCallable<RawEncryptRequest, RawEncryptResponse> rawEncryptCallable; private final UnaryCallable<RawDecryptRequest, RawDecryptResponse> rawDecryptCallable; private final UnaryCallable<AsymmetricSignRequest, AsymmetricSignResponse> asymmetricSignCallable; private final UnaryCallable<AsymmetricDecryptRequest, AsymmetricDecryptResponse> asymmetricDecryptCallable; private final UnaryCallable<MacSignRequest, MacSignResponse> macSignCallable; private final UnaryCallable<MacVerifyRequest, MacVerifyResponse> macVerifyCallable; private final UnaryCallable<GenerateRandomBytesRequest, GenerateRandomBytesResponse> generateRandomBytesCallable; private final UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable; private final UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse> listLocationsPagedCallable; private final UnaryCallable<GetLocationRequest, Location> getLocationCallable; private final UnaryCallable<SetIamPolicyRequest, Policy> setIamPolicyCallable; private final UnaryCallable<GetIamPolicyRequest, Policy> getIamPolicyCallable; private final UnaryCallable<TestIamPermissionsRequest, TestIamPermissionsResponse> testIamPermissionsCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcKeyManagementServiceStub create(KeyManagementServiceStubSettings settings) throws IOException { return new GrpcKeyManagementServiceStub(settings, ClientContext.create(settings)); } public static final GrpcKeyManagementServiceStub create(ClientContext clientContext) throws IOException { return new GrpcKeyManagementServiceStub( KeyManagementServiceStubSettings.newBuilder().build(), clientContext); } public static final GrpcKeyManagementServiceStub create( ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { return new GrpcKeyManagementServiceStub( KeyManagementServiceStubSettings.newBuilder().build(), clientContext, callableFactory); } /** * Constructs an instance of GrpcKeyManagementServiceStub, using the given settings. This is * protected so that it is easy to make a subclass, but otherwise, the static factory methods * should be preferred. */ protected GrpcKeyManagementServiceStub( KeyManagementServiceStubSettings settings, ClientContext clientContext) throws IOException { this(settings, clientContext, new GrpcKeyManagementServiceCallableFactory()); } /** * Constructs an instance of GrpcKeyManagementServiceStub, using the given settings. This is * protected so that it is easy to make a subclass, but otherwise, the static factory methods * should be preferred. */ protected GrpcKeyManagementServiceStub( KeyManagementServiceStubSettings settings, ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { this.callableFactory = callableFactory; this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); GrpcCallSettings<ListKeyRingsRequest, ListKeyRingsResponse> listKeyRingsTransportSettings = GrpcCallSettings.<ListKeyRingsRequest, ListKeyRingsResponse>newBuilder() .setMethodDescriptor(listKeyRingsMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings<ListCryptoKeysRequest, ListCryptoKeysResponse> listCryptoKeysTransportSettings = GrpcCallSettings.<ListCryptoKeysRequest, ListCryptoKeysResponse>newBuilder() .setMethodDescriptor(listCryptoKeysMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings<ListCryptoKeyVersionsRequest, ListCryptoKeyVersionsResponse> listCryptoKeyVersionsTransportSettings = GrpcCallSettings .<ListCryptoKeyVersionsRequest, ListCryptoKeyVersionsResponse>newBuilder() .setMethodDescriptor(listCryptoKeyVersionsMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings<ListImportJobsRequest, ListImportJobsResponse> listImportJobsTransportSettings = GrpcCallSettings.<ListImportJobsRequest, ListImportJobsResponse>newBuilder() .setMethodDescriptor(listImportJobsMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings<GetKeyRingRequest, KeyRing> getKeyRingTransportSettings = GrpcCallSettings.<GetKeyRingRequest, KeyRing>newBuilder() .setMethodDescriptor(getKeyRingMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings<GetCryptoKeyRequest, CryptoKey> getCryptoKeyTransportSettings = GrpcCallSettings.<GetCryptoKeyRequest, CryptoKey>newBuilder() .setMethodDescriptor(getCryptoKeyMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings<GetCryptoKeyVersionRequest, CryptoKeyVersion> getCryptoKeyVersionTransportSettings = GrpcCallSettings.<GetCryptoKeyVersionRequest, CryptoKeyVersion>newBuilder() .setMethodDescriptor(getCryptoKeyVersionMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings<GetPublicKeyRequest, PublicKey> getPublicKeyTransportSettings = GrpcCallSettings.<GetPublicKeyRequest, PublicKey>newBuilder() .setMethodDescriptor(getPublicKeyMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings<GetImportJobRequest, ImportJob> getImportJobTransportSettings = GrpcCallSettings.<GetImportJobRequest, ImportJob>newBuilder() .setMethodDescriptor(getImportJobMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings<CreateKeyRingRequest, KeyRing> createKeyRingTransportSettings = GrpcCallSettings.<CreateKeyRingRequest, KeyRing>newBuilder() .setMethodDescriptor(createKeyRingMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings<CreateCryptoKeyRequest, CryptoKey> createCryptoKeyTransportSettings = GrpcCallSettings.<CreateCryptoKeyRequest, CryptoKey>newBuilder() .setMethodDescriptor(createCryptoKeyMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings<CreateCryptoKeyVersionRequest, CryptoKeyVersion> createCryptoKeyVersionTransportSettings = GrpcCallSettings.<CreateCryptoKeyVersionRequest, CryptoKeyVersion>newBuilder() .setMethodDescriptor(createCryptoKeyVersionMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings<ImportCryptoKeyVersionRequest, CryptoKeyVersion> importCryptoKeyVersionTransportSettings = GrpcCallSettings.<ImportCryptoKeyVersionRequest, CryptoKeyVersion>newBuilder() .setMethodDescriptor(importCryptoKeyVersionMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings<CreateImportJobRequest, ImportJob> createImportJobTransportSettings = GrpcCallSettings.<CreateImportJobRequest, ImportJob>newBuilder() .setMethodDescriptor(createImportJobMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings<UpdateCryptoKeyRequest, CryptoKey> updateCryptoKeyTransportSettings = GrpcCallSettings.<UpdateCryptoKeyRequest, CryptoKey>newBuilder() .setMethodDescriptor(updateCryptoKeyMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("crypto_key.name", String.valueOf(request.getCryptoKey().getName())); return builder.build(); }) .build(); GrpcCallSettings<UpdateCryptoKeyVersionRequest, CryptoKeyVersion> updateCryptoKeyVersionTransportSettings = GrpcCallSettings.<UpdateCryptoKeyVersionRequest, CryptoKeyVersion>newBuilder() .setMethodDescriptor(updateCryptoKeyVersionMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add( "crypto_key_version.name", String.valueOf(request.getCryptoKeyVersion().getName())); return builder.build(); }) .build(); GrpcCallSettings<UpdateCryptoKeyPrimaryVersionRequest, CryptoKey> updateCryptoKeyPrimaryVersionTransportSettings = GrpcCallSettings.<UpdateCryptoKeyPrimaryVersionRequest, CryptoKey>newBuilder() .setMethodDescriptor(updateCryptoKeyPrimaryVersionMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings<DestroyCryptoKeyVersionRequest, CryptoKeyVersion> destroyCryptoKeyVersionTransportSettings = GrpcCallSettings.<DestroyCryptoKeyVersionRequest, CryptoKeyVersion>newBuilder() .setMethodDescriptor(destroyCryptoKeyVersionMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings<RestoreCryptoKeyVersionRequest, CryptoKeyVersion> restoreCryptoKeyVersionTransportSettings = GrpcCallSettings.<RestoreCryptoKeyVersionRequest, CryptoKeyVersion>newBuilder() .setMethodDescriptor(restoreCryptoKeyVersionMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings<EncryptRequest, EncryptResponse> encryptTransportSettings = GrpcCallSettings.<EncryptRequest, EncryptResponse>newBuilder() .setMethodDescriptor(encryptMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings<DecryptRequest, DecryptResponse> decryptTransportSettings = GrpcCallSettings.<DecryptRequest, DecryptResponse>newBuilder() .setMethodDescriptor(decryptMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings<RawEncryptRequest, RawEncryptResponse> rawEncryptTransportSettings = GrpcCallSettings.<RawEncryptRequest, RawEncryptResponse>newBuilder() .setMethodDescriptor(rawEncryptMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings<RawDecryptRequest, RawDecryptResponse> rawDecryptTransportSettings = GrpcCallSettings.<RawDecryptRequest, RawDecryptResponse>newBuilder() .setMethodDescriptor(rawDecryptMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings<AsymmetricSignRequest, AsymmetricSignResponse> asymmetricSignTransportSettings = GrpcCallSettings.<AsymmetricSignRequest, AsymmetricSignResponse>newBuilder() .setMethodDescriptor(asymmetricSignMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings<AsymmetricDecryptRequest, AsymmetricDecryptResponse> asymmetricDecryptTransportSettings = GrpcCallSettings.<AsymmetricDecryptRequest, AsymmetricDecryptResponse>newBuilder() .setMethodDescriptor(asymmetricDecryptMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings<MacSignRequest, MacSignResponse> macSignTransportSettings = GrpcCallSettings.<MacSignRequest, MacSignResponse>newBuilder() .setMethodDescriptor(macSignMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings<MacVerifyRequest, MacVerifyResponse> macVerifyTransportSettings = GrpcCallSettings.<MacVerifyRequest, MacVerifyResponse>newBuilder() .setMethodDescriptor(macVerifyMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings<GenerateRandomBytesRequest, GenerateRandomBytesResponse> generateRandomBytesTransportSettings = GrpcCallSettings.<GenerateRandomBytesRequest, GenerateRandomBytesResponse>newBuilder() .setMethodDescriptor(generateRandomBytesMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("location", String.valueOf(request.getLocation())); return builder.build(); }) .build(); GrpcCallSettings<ListLocationsRequest, ListLocationsResponse> listLocationsTransportSettings = GrpcCallSettings.<ListLocationsRequest, ListLocationsResponse>newBuilder() .setMethodDescriptor(listLocationsMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings<GetLocationRequest, Location> getLocationTransportSettings = GrpcCallSettings.<GetLocationRequest, Location>newBuilder() .setMethodDescriptor(getLocationMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings<SetIamPolicyRequest, Policy> setIamPolicyTransportSettings = GrpcCallSettings.<SetIamPolicyRequest, Policy>newBuilder() .setMethodDescriptor(setIamPolicyMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("resource", String.valueOf(request.getResource())); return builder.build(); }) .build(); GrpcCallSettings<GetIamPolicyRequest, Policy> getIamPolicyTransportSettings = GrpcCallSettings.<GetIamPolicyRequest, Policy>newBuilder() .setMethodDescriptor(getIamPolicyMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("resource", String.valueOf(request.getResource())); return builder.build(); }) .build(); GrpcCallSettings<TestIamPermissionsRequest, TestIamPermissionsResponse> testIamPermissionsTransportSettings = GrpcCallSettings.<TestIamPermissionsRequest, TestIamPermissionsResponse>newBuilder() .setMethodDescriptor(testIamPermissionsMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("resource", String.valueOf(request.getResource())); return builder.build(); }) .build(); this.listKeyRingsCallable = callableFactory.createUnaryCallable( listKeyRingsTransportSettings, settings.listKeyRingsSettings(), clientContext); this.listKeyRingsPagedCallable = callableFactory.createPagedCallable( listKeyRingsTransportSettings, settings.listKeyRingsSettings(), clientContext); this.listCryptoKeysCallable = callableFactory.createUnaryCallable( listCryptoKeysTransportSettings, settings.listCryptoKeysSettings(), clientContext); this.listCryptoKeysPagedCallable = callableFactory.createPagedCallable( listCryptoKeysTransportSettings, settings.listCryptoKeysSettings(), clientContext); this.listCryptoKeyVersionsCallable = callableFactory.createUnaryCallable( listCryptoKeyVersionsTransportSettings, settings.listCryptoKeyVersionsSettings(), clientContext); this.listCryptoKeyVersionsPagedCallable = callableFactory.createPagedCallable( listCryptoKeyVersionsTransportSettings, settings.listCryptoKeyVersionsSettings(), clientContext); this.listImportJobsCallable = callableFactory.createUnaryCallable( listImportJobsTransportSettings, settings.listImportJobsSettings(), clientContext); this.listImportJobsPagedCallable = callableFactory.createPagedCallable( listImportJobsTransportSettings, settings.listImportJobsSettings(), clientContext); this.getKeyRingCallable = callableFactory.createUnaryCallable( getKeyRingTransportSettings, settings.getKeyRingSettings(), clientContext); this.getCryptoKeyCallable = callableFactory.createUnaryCallable( getCryptoKeyTransportSettings, settings.getCryptoKeySettings(), clientContext); this.getCryptoKeyVersionCallable = callableFactory.createUnaryCallable( getCryptoKeyVersionTransportSettings, settings.getCryptoKeyVersionSettings(), clientContext); this.getPublicKeyCallable = callableFactory.createUnaryCallable( getPublicKeyTransportSettings, settings.getPublicKeySettings(), clientContext); this.getImportJobCallable = callableFactory.createUnaryCallable( getImportJobTransportSettings, settings.getImportJobSettings(), clientContext); this.createKeyRingCallable = callableFactory.createUnaryCallable( createKeyRingTransportSettings, settings.createKeyRingSettings(), clientContext); this.createCryptoKeyCallable = callableFactory.createUnaryCallable( createCryptoKeyTransportSettings, settings.createCryptoKeySettings(), clientContext); this.createCryptoKeyVersionCallable = callableFactory.createUnaryCallable( createCryptoKeyVersionTransportSettings, settings.createCryptoKeyVersionSettings(), clientContext); this.importCryptoKeyVersionCallable = callableFactory.createUnaryCallable( importCryptoKeyVersionTransportSettings, settings.importCryptoKeyVersionSettings(), clientContext); this.createImportJobCallable = callableFactory.createUnaryCallable( createImportJobTransportSettings, settings.createImportJobSettings(), clientContext); this.updateCryptoKeyCallable = callableFactory.createUnaryCallable( updateCryptoKeyTransportSettings, settings.updateCryptoKeySettings(), clientContext); this.updateCryptoKeyVersionCallable = callableFactory.createUnaryCallable( updateCryptoKeyVersionTransportSettings, settings.updateCryptoKeyVersionSettings(), clientContext); this.updateCryptoKeyPrimaryVersionCallable = callableFactory.createUnaryCallable( updateCryptoKeyPrimaryVersionTransportSettings, settings.updateCryptoKeyPrimaryVersionSettings(), clientContext); this.destroyCryptoKeyVersionCallable = callableFactory.createUnaryCallable( destroyCryptoKeyVersionTransportSettings, settings.destroyCryptoKeyVersionSettings(), clientContext); this.restoreCryptoKeyVersionCallable = callableFactory.createUnaryCallable( restoreCryptoKeyVersionTransportSettings, settings.restoreCryptoKeyVersionSettings(), clientContext); this.encryptCallable = callableFactory.createUnaryCallable( encryptTransportSettings, settings.encryptSettings(), clientContext); this.decryptCallable = callableFactory.createUnaryCallable( decryptTransportSettings, settings.decryptSettings(), clientContext); this.rawEncryptCallable = callableFactory.createUnaryCallable( rawEncryptTransportSettings, settings.rawEncryptSettings(), clientContext); this.rawDecryptCallable = callableFactory.createUnaryCallable( rawDecryptTransportSettings, settings.rawDecryptSettings(), clientContext); this.asymmetricSignCallable = callableFactory.createUnaryCallable( asymmetricSignTransportSettings, settings.asymmetricSignSettings(), clientContext); this.asymmetricDecryptCallable = callableFactory.createUnaryCallable( asymmetricDecryptTransportSettings, settings.asymmetricDecryptSettings(), clientContext); this.macSignCallable = callableFactory.createUnaryCallable( macSignTransportSettings, settings.macSignSettings(), clientContext); this.macVerifyCallable = callableFactory.createUnaryCallable( macVerifyTransportSettings, settings.macVerifySettings(), clientContext); this.generateRandomBytesCallable = callableFactory.createUnaryCallable( generateRandomBytesTransportSettings, settings.generateRandomBytesSettings(), clientContext); this.listLocationsCallable = callableFactory.createUnaryCallable( listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); this.listLocationsPagedCallable = callableFactory.createPagedCallable( listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); this.getLocationCallable = callableFactory.createUnaryCallable( getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.setIamPolicyCallable = callableFactory.createUnaryCallable( setIamPolicyTransportSettings, settings.setIamPolicySettings(), clientContext); this.getIamPolicyCallable = callableFactory.createUnaryCallable( getIamPolicyTransportSettings, settings.getIamPolicySettings(), clientContext); this.testIamPermissionsCallable = callableFactory.createUnaryCallable( testIamPermissionsTransportSettings, settings.testIamPermissionsSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } public GrpcOperationsStub getOperationsStub() { return operationsStub; } @Override public UnaryCallable<ListKeyRingsRequest, ListKeyRingsResponse> listKeyRingsCallable() { return listKeyRingsCallable; } @Override public UnaryCallable<ListKeyRingsRequest, ListKeyRingsPagedResponse> listKeyRingsPagedCallable() { return listKeyRingsPagedCallable; } @Override public UnaryCallable<ListCryptoKeysRequest, ListCryptoKeysResponse> listCryptoKeysCallable() { return listCryptoKeysCallable; } @Override public UnaryCallable<ListCryptoKeysRequest, ListCryptoKeysPagedResponse> listCryptoKeysPagedCallable() { return listCryptoKeysPagedCallable; } @Override public UnaryCallable<ListCryptoKeyVersionsRequest, ListCryptoKeyVersionsResponse> listCryptoKeyVersionsCallable() { return listCryptoKeyVersionsCallable; } @Override public UnaryCallable<ListCryptoKeyVersionsRequest, ListCryptoKeyVersionsPagedResponse> listCryptoKeyVersionsPagedCallable() { return listCryptoKeyVersionsPagedCallable; } @Override public UnaryCallable<ListImportJobsRequest, ListImportJobsResponse> listImportJobsCallable() { return listImportJobsCallable; } @Override public UnaryCallable<ListImportJobsRequest, ListImportJobsPagedResponse> listImportJobsPagedCallable() { return listImportJobsPagedCallable; } @Override public UnaryCallable<GetKeyRingRequest, KeyRing> getKeyRingCallable() { return getKeyRingCallable; } @Override public UnaryCallable<GetCryptoKeyRequest, CryptoKey> getCryptoKeyCallable() { return getCryptoKeyCallable; } @Override public UnaryCallable<GetCryptoKeyVersionRequest, CryptoKeyVersion> getCryptoKeyVersionCallable() { return getCryptoKeyVersionCallable; } @Override public UnaryCallable<GetPublicKeyRequest, PublicKey> getPublicKeyCallable() { return getPublicKeyCallable; } @Override public UnaryCallable<GetImportJobRequest, ImportJob> getImportJobCallable() { return getImportJobCallable; } @Override public UnaryCallable<CreateKeyRingRequest, KeyRing> createKeyRingCallable() { return createKeyRingCallable; } @Override public UnaryCallable<CreateCryptoKeyRequest, CryptoKey> createCryptoKeyCallable() { return createCryptoKeyCallable; } @Override public UnaryCallable<CreateCryptoKeyVersionRequest, CryptoKeyVersion> createCryptoKeyVersionCallable() { return createCryptoKeyVersionCallable; } @Override public UnaryCallable<ImportCryptoKeyVersionRequest, CryptoKeyVersion> importCryptoKeyVersionCallable() { return importCryptoKeyVersionCallable; } @Override public UnaryCallable<CreateImportJobRequest, ImportJob> createImportJobCallable() { return createImportJobCallable; } @Override public UnaryCallable<UpdateCryptoKeyRequest, CryptoKey> updateCryptoKeyCallable() { return updateCryptoKeyCallable; } @Override public UnaryCallable<UpdateCryptoKeyVersionRequest, CryptoKeyVersion> updateCryptoKeyVersionCallable() { return updateCryptoKeyVersionCallable; } @Override public UnaryCallable<UpdateCryptoKeyPrimaryVersionRequest, CryptoKey> updateCryptoKeyPrimaryVersionCallable() { return updateCryptoKeyPrimaryVersionCallable; } @Override public UnaryCallable<DestroyCryptoKeyVersionRequest, CryptoKeyVersion> destroyCryptoKeyVersionCallable() { return destroyCryptoKeyVersionCallable; } @Override public UnaryCallable<RestoreCryptoKeyVersionRequest, CryptoKeyVersion> restoreCryptoKeyVersionCallable() { return restoreCryptoKeyVersionCallable; } @Override public UnaryCallable<EncryptRequest, EncryptResponse> encryptCallable() { return encryptCallable; } @Override public UnaryCallable<DecryptRequest, DecryptResponse> decryptCallable() { return decryptCallable; } @Override public UnaryCallable<RawEncryptRequest, RawEncryptResponse> rawEncryptCallable() { return rawEncryptCallable; } @Override public UnaryCallable<RawDecryptRequest, RawDecryptResponse> rawDecryptCallable() { return rawDecryptCallable; } @Override public UnaryCallable<AsymmetricSignRequest, AsymmetricSignResponse> asymmetricSignCallable() { return asymmetricSignCallable; } @Override public UnaryCallable<AsymmetricDecryptRequest, AsymmetricDecryptResponse> asymmetricDecryptCallable() { return asymmetricDecryptCallable; } @Override public UnaryCallable<MacSignRequest, MacSignResponse> macSignCallable() { return macSignCallable; } @Override public UnaryCallable<MacVerifyRequest, MacVerifyResponse> macVerifyCallable() { return macVerifyCallable; } @Override public UnaryCallable<GenerateRandomBytesRequest, GenerateRandomBytesResponse> generateRandomBytesCallable() { return generateRandomBytesCallable; } @Override public UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable() { return listLocationsCallable; } @Override public UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse> listLocationsPagedCallable() { return listLocationsPagedCallable; } @Override public UnaryCallable<GetLocationRequest, Location> getLocationCallable() { return getLocationCallable; } @Override public UnaryCallable<SetIamPolicyRequest, Policy> setIamPolicyCallable() { return setIamPolicyCallable; } @Override public UnaryCallable<GetIamPolicyRequest, Policy> getIamPolicyCallable() { return getIamPolicyCallable; } @Override public UnaryCallable<TestIamPermissionsRequest, TestIamPermissionsResponse> testIamPermissionsCallable() { return testIamPermissionsCallable; } @Override public final void close() { try { backgroundResources.close(); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new IllegalStateException("Failed to close resource", e); } } @Override public void shutdown() { backgroundResources.shutdown(); } @Override public boolean isShutdown() { return backgroundResources.isShutdown(); } @Override public boolean isTerminated() { return backgroundResources.isTerminated(); } @Override public void shutdownNow() { backgroundResources.shutdownNow(); } @Override public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { return backgroundResources.awaitTermination(duration, unit); } }
UTF-8
Java
62,537
java
GrpcKeyManagementServiceStub.java
Java
[]
null
[]
/* * Copyright 2023 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.google.cloud.kms.v1.stub; import static com.google.cloud.kms.v1.KeyManagementServiceClient.ListCryptoKeyVersionsPagedResponse; import static com.google.cloud.kms.v1.KeyManagementServiceClient.ListCryptoKeysPagedResponse; import static com.google.cloud.kms.v1.KeyManagementServiceClient.ListImportJobsPagedResponse; import static com.google.cloud.kms.v1.KeyManagementServiceClient.ListKeyRingsPagedResponse; import static com.google.cloud.kms.v1.KeyManagementServiceClient.ListLocationsPagedResponse; import com.google.api.gax.core.BackgroundResource; import com.google.api.gax.core.BackgroundResourceAggregation; import com.google.api.gax.grpc.GrpcCallSettings; import com.google.api.gax.grpc.GrpcStubCallableFactory; import com.google.api.gax.rpc.ClientContext; import com.google.api.gax.rpc.RequestParamsBuilder; import com.google.api.gax.rpc.UnaryCallable; import com.google.cloud.kms.v1.AsymmetricDecryptRequest; import com.google.cloud.kms.v1.AsymmetricDecryptResponse; import com.google.cloud.kms.v1.AsymmetricSignRequest; import com.google.cloud.kms.v1.AsymmetricSignResponse; import com.google.cloud.kms.v1.CreateCryptoKeyRequest; import com.google.cloud.kms.v1.CreateCryptoKeyVersionRequest; import com.google.cloud.kms.v1.CreateImportJobRequest; import com.google.cloud.kms.v1.CreateKeyRingRequest; import com.google.cloud.kms.v1.CryptoKey; import com.google.cloud.kms.v1.CryptoKeyVersion; import com.google.cloud.kms.v1.DecryptRequest; import com.google.cloud.kms.v1.DecryptResponse; import com.google.cloud.kms.v1.DestroyCryptoKeyVersionRequest; import com.google.cloud.kms.v1.EncryptRequest; import com.google.cloud.kms.v1.EncryptResponse; import com.google.cloud.kms.v1.GenerateRandomBytesRequest; import com.google.cloud.kms.v1.GenerateRandomBytesResponse; import com.google.cloud.kms.v1.GetCryptoKeyRequest; import com.google.cloud.kms.v1.GetCryptoKeyVersionRequest; import com.google.cloud.kms.v1.GetImportJobRequest; import com.google.cloud.kms.v1.GetKeyRingRequest; import com.google.cloud.kms.v1.GetPublicKeyRequest; import com.google.cloud.kms.v1.ImportCryptoKeyVersionRequest; import com.google.cloud.kms.v1.ImportJob; import com.google.cloud.kms.v1.KeyRing; import com.google.cloud.kms.v1.ListCryptoKeyVersionsRequest; import com.google.cloud.kms.v1.ListCryptoKeyVersionsResponse; import com.google.cloud.kms.v1.ListCryptoKeysRequest; import com.google.cloud.kms.v1.ListCryptoKeysResponse; import com.google.cloud.kms.v1.ListImportJobsRequest; import com.google.cloud.kms.v1.ListImportJobsResponse; import com.google.cloud.kms.v1.ListKeyRingsRequest; import com.google.cloud.kms.v1.ListKeyRingsResponse; import com.google.cloud.kms.v1.MacSignRequest; import com.google.cloud.kms.v1.MacSignResponse; import com.google.cloud.kms.v1.MacVerifyRequest; import com.google.cloud.kms.v1.MacVerifyResponse; import com.google.cloud.kms.v1.PublicKey; import com.google.cloud.kms.v1.RawDecryptRequest; import com.google.cloud.kms.v1.RawDecryptResponse; import com.google.cloud.kms.v1.RawEncryptRequest; import com.google.cloud.kms.v1.RawEncryptResponse; import com.google.cloud.kms.v1.RestoreCryptoKeyVersionRequest; import com.google.cloud.kms.v1.UpdateCryptoKeyPrimaryVersionRequest; import com.google.cloud.kms.v1.UpdateCryptoKeyRequest; import com.google.cloud.kms.v1.UpdateCryptoKeyVersionRequest; import com.google.cloud.location.GetLocationRequest; import com.google.cloud.location.ListLocationsRequest; import com.google.cloud.location.ListLocationsResponse; import com.google.cloud.location.Location; import com.google.iam.v1.GetIamPolicyRequest; import com.google.iam.v1.Policy; import com.google.iam.v1.SetIamPolicyRequest; import com.google.iam.v1.TestIamPermissionsRequest; import com.google.iam.v1.TestIamPermissionsResponse; import com.google.longrunning.stub.GrpcOperationsStub; import io.grpc.MethodDescriptor; import io.grpc.protobuf.ProtoUtils; import java.io.IOException; import java.util.concurrent.TimeUnit; import javax.annotation.Generated; // AUTO-GENERATED DOCUMENTATION AND CLASS. /** * gRPC stub implementation for the KeyManagementService service API. * * <p>This class is for advanced usage and reflects the underlying API directly. */ @Generated("by gapic-generator-java") public class GrpcKeyManagementServiceStub extends KeyManagementServiceStub { private static final MethodDescriptor<ListKeyRingsRequest, ListKeyRingsResponse> listKeyRingsMethodDescriptor = MethodDescriptor.<ListKeyRingsRequest, ListKeyRingsResponse>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/ListKeyRings") .setRequestMarshaller(ProtoUtils.marshaller(ListKeyRingsRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(ListKeyRingsResponse.getDefaultInstance())) .build(); private static final MethodDescriptor<ListCryptoKeysRequest, ListCryptoKeysResponse> listCryptoKeysMethodDescriptor = MethodDescriptor.<ListCryptoKeysRequest, ListCryptoKeysResponse>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/ListCryptoKeys") .setRequestMarshaller( ProtoUtils.marshaller(ListCryptoKeysRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(ListCryptoKeysResponse.getDefaultInstance())) .build(); private static final MethodDescriptor<ListCryptoKeyVersionsRequest, ListCryptoKeyVersionsResponse> listCryptoKeyVersionsMethodDescriptor = MethodDescriptor.<ListCryptoKeyVersionsRequest, ListCryptoKeyVersionsResponse>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/ListCryptoKeyVersions") .setRequestMarshaller( ProtoUtils.marshaller(ListCryptoKeyVersionsRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(ListCryptoKeyVersionsResponse.getDefaultInstance())) .build(); private static final MethodDescriptor<ListImportJobsRequest, ListImportJobsResponse> listImportJobsMethodDescriptor = MethodDescriptor.<ListImportJobsRequest, ListImportJobsResponse>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/ListImportJobs") .setRequestMarshaller( ProtoUtils.marshaller(ListImportJobsRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(ListImportJobsResponse.getDefaultInstance())) .build(); private static final MethodDescriptor<GetKeyRingRequest, KeyRing> getKeyRingMethodDescriptor = MethodDescriptor.<GetKeyRingRequest, KeyRing>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/GetKeyRing") .setRequestMarshaller(ProtoUtils.marshaller(GetKeyRingRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(KeyRing.getDefaultInstance())) .build(); private static final MethodDescriptor<GetCryptoKeyRequest, CryptoKey> getCryptoKeyMethodDescriptor = MethodDescriptor.<GetCryptoKeyRequest, CryptoKey>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/GetCryptoKey") .setRequestMarshaller(ProtoUtils.marshaller(GetCryptoKeyRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(CryptoKey.getDefaultInstance())) .build(); private static final MethodDescriptor<GetCryptoKeyVersionRequest, CryptoKeyVersion> getCryptoKeyVersionMethodDescriptor = MethodDescriptor.<GetCryptoKeyVersionRequest, CryptoKeyVersion>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/GetCryptoKeyVersion") .setRequestMarshaller( ProtoUtils.marshaller(GetCryptoKeyVersionRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(CryptoKeyVersion.getDefaultInstance())) .build(); private static final MethodDescriptor<GetPublicKeyRequest, PublicKey> getPublicKeyMethodDescriptor = MethodDescriptor.<GetPublicKeyRequest, PublicKey>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/GetPublicKey") .setRequestMarshaller(ProtoUtils.marshaller(GetPublicKeyRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(PublicKey.getDefaultInstance())) .build(); private static final MethodDescriptor<GetImportJobRequest, ImportJob> getImportJobMethodDescriptor = MethodDescriptor.<GetImportJobRequest, ImportJob>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/GetImportJob") .setRequestMarshaller(ProtoUtils.marshaller(GetImportJobRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(ImportJob.getDefaultInstance())) .build(); private static final MethodDescriptor<CreateKeyRingRequest, KeyRing> createKeyRingMethodDescriptor = MethodDescriptor.<CreateKeyRingRequest, KeyRing>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/CreateKeyRing") .setRequestMarshaller( ProtoUtils.marshaller(CreateKeyRingRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(KeyRing.getDefaultInstance())) .build(); private static final MethodDescriptor<CreateCryptoKeyRequest, CryptoKey> createCryptoKeyMethodDescriptor = MethodDescriptor.<CreateCryptoKeyRequest, CryptoKey>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/CreateCryptoKey") .setRequestMarshaller( ProtoUtils.marshaller(CreateCryptoKeyRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(CryptoKey.getDefaultInstance())) .build(); private static final MethodDescriptor<CreateCryptoKeyVersionRequest, CryptoKeyVersion> createCryptoKeyVersionMethodDescriptor = MethodDescriptor.<CreateCryptoKeyVersionRequest, CryptoKeyVersion>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/CreateCryptoKeyVersion") .setRequestMarshaller( ProtoUtils.marshaller(CreateCryptoKeyVersionRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(CryptoKeyVersion.getDefaultInstance())) .build(); private static final MethodDescriptor<ImportCryptoKeyVersionRequest, CryptoKeyVersion> importCryptoKeyVersionMethodDescriptor = MethodDescriptor.<ImportCryptoKeyVersionRequest, CryptoKeyVersion>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/ImportCryptoKeyVersion") .setRequestMarshaller( ProtoUtils.marshaller(ImportCryptoKeyVersionRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(CryptoKeyVersion.getDefaultInstance())) .build(); private static final MethodDescriptor<CreateImportJobRequest, ImportJob> createImportJobMethodDescriptor = MethodDescriptor.<CreateImportJobRequest, ImportJob>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/CreateImportJob") .setRequestMarshaller( ProtoUtils.marshaller(CreateImportJobRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(ImportJob.getDefaultInstance())) .build(); private static final MethodDescriptor<UpdateCryptoKeyRequest, CryptoKey> updateCryptoKeyMethodDescriptor = MethodDescriptor.<UpdateCryptoKeyRequest, CryptoKey>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/UpdateCryptoKey") .setRequestMarshaller( ProtoUtils.marshaller(UpdateCryptoKeyRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(CryptoKey.getDefaultInstance())) .build(); private static final MethodDescriptor<UpdateCryptoKeyVersionRequest, CryptoKeyVersion> updateCryptoKeyVersionMethodDescriptor = MethodDescriptor.<UpdateCryptoKeyVersionRequest, CryptoKeyVersion>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/UpdateCryptoKeyVersion") .setRequestMarshaller( ProtoUtils.marshaller(UpdateCryptoKeyVersionRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(CryptoKeyVersion.getDefaultInstance())) .build(); private static final MethodDescriptor<UpdateCryptoKeyPrimaryVersionRequest, CryptoKey> updateCryptoKeyPrimaryVersionMethodDescriptor = MethodDescriptor.<UpdateCryptoKeyPrimaryVersionRequest, CryptoKey>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName( "google.cloud.kms.v1.KeyManagementService/UpdateCryptoKeyPrimaryVersion") .setRequestMarshaller( ProtoUtils.marshaller(UpdateCryptoKeyPrimaryVersionRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(CryptoKey.getDefaultInstance())) .build(); private static final MethodDescriptor<DestroyCryptoKeyVersionRequest, CryptoKeyVersion> destroyCryptoKeyVersionMethodDescriptor = MethodDescriptor.<DestroyCryptoKeyVersionRequest, CryptoKeyVersion>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/DestroyCryptoKeyVersion") .setRequestMarshaller( ProtoUtils.marshaller(DestroyCryptoKeyVersionRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(CryptoKeyVersion.getDefaultInstance())) .build(); private static final MethodDescriptor<RestoreCryptoKeyVersionRequest, CryptoKeyVersion> restoreCryptoKeyVersionMethodDescriptor = MethodDescriptor.<RestoreCryptoKeyVersionRequest, CryptoKeyVersion>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/RestoreCryptoKeyVersion") .setRequestMarshaller( ProtoUtils.marshaller(RestoreCryptoKeyVersionRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(CryptoKeyVersion.getDefaultInstance())) .build(); private static final MethodDescriptor<EncryptRequest, EncryptResponse> encryptMethodDescriptor = MethodDescriptor.<EncryptRequest, EncryptResponse>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/Encrypt") .setRequestMarshaller(ProtoUtils.marshaller(EncryptRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(EncryptResponse.getDefaultInstance())) .build(); private static final MethodDescriptor<DecryptRequest, DecryptResponse> decryptMethodDescriptor = MethodDescriptor.<DecryptRequest, DecryptResponse>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/Decrypt") .setRequestMarshaller(ProtoUtils.marshaller(DecryptRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(DecryptResponse.getDefaultInstance())) .build(); private static final MethodDescriptor<RawEncryptRequest, RawEncryptResponse> rawEncryptMethodDescriptor = MethodDescriptor.<RawEncryptRequest, RawEncryptResponse>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/RawEncrypt") .setRequestMarshaller(ProtoUtils.marshaller(RawEncryptRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(RawEncryptResponse.getDefaultInstance())) .build(); private static final MethodDescriptor<RawDecryptRequest, RawDecryptResponse> rawDecryptMethodDescriptor = MethodDescriptor.<RawDecryptRequest, RawDecryptResponse>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/RawDecrypt") .setRequestMarshaller(ProtoUtils.marshaller(RawDecryptRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(RawDecryptResponse.getDefaultInstance())) .build(); private static final MethodDescriptor<AsymmetricSignRequest, AsymmetricSignResponse> asymmetricSignMethodDescriptor = MethodDescriptor.<AsymmetricSignRequest, AsymmetricSignResponse>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/AsymmetricSign") .setRequestMarshaller( ProtoUtils.marshaller(AsymmetricSignRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(AsymmetricSignResponse.getDefaultInstance())) .build(); private static final MethodDescriptor<AsymmetricDecryptRequest, AsymmetricDecryptResponse> asymmetricDecryptMethodDescriptor = MethodDescriptor.<AsymmetricDecryptRequest, AsymmetricDecryptResponse>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/AsymmetricDecrypt") .setRequestMarshaller( ProtoUtils.marshaller(AsymmetricDecryptRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(AsymmetricDecryptResponse.getDefaultInstance())) .build(); private static final MethodDescriptor<MacSignRequest, MacSignResponse> macSignMethodDescriptor = MethodDescriptor.<MacSignRequest, MacSignResponse>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/MacSign") .setRequestMarshaller(ProtoUtils.marshaller(MacSignRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(MacSignResponse.getDefaultInstance())) .build(); private static final MethodDescriptor<MacVerifyRequest, MacVerifyResponse> macVerifyMethodDescriptor = MethodDescriptor.<MacVerifyRequest, MacVerifyResponse>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/MacVerify") .setRequestMarshaller(ProtoUtils.marshaller(MacVerifyRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(MacVerifyResponse.getDefaultInstance())) .build(); private static final MethodDescriptor<GenerateRandomBytesRequest, GenerateRandomBytesResponse> generateRandomBytesMethodDescriptor = MethodDescriptor.<GenerateRandomBytesRequest, GenerateRandomBytesResponse>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.kms.v1.KeyManagementService/GenerateRandomBytes") .setRequestMarshaller( ProtoUtils.marshaller(GenerateRandomBytesRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(GenerateRandomBytesResponse.getDefaultInstance())) .build(); private static final MethodDescriptor<ListLocationsRequest, ListLocationsResponse> listLocationsMethodDescriptor = MethodDescriptor.<ListLocationsRequest, ListLocationsResponse>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.location.Locations/ListLocations") .setRequestMarshaller( ProtoUtils.marshaller(ListLocationsRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(ListLocationsResponse.getDefaultInstance())) .build(); private static final MethodDescriptor<GetLocationRequest, Location> getLocationMethodDescriptor = MethodDescriptor.<GetLocationRequest, Location>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.cloud.location.Locations/GetLocation") .setRequestMarshaller(ProtoUtils.marshaller(GetLocationRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Location.getDefaultInstance())) .build(); private static final MethodDescriptor<SetIamPolicyRequest, Policy> setIamPolicyMethodDescriptor = MethodDescriptor.<SetIamPolicyRequest, Policy>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.iam.v1.IAMPolicy/SetIamPolicy") .setRequestMarshaller(ProtoUtils.marshaller(SetIamPolicyRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance())) .build(); private static final MethodDescriptor<GetIamPolicyRequest, Policy> getIamPolicyMethodDescriptor = MethodDescriptor.<GetIamPolicyRequest, Policy>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.iam.v1.IAMPolicy/GetIamPolicy") .setRequestMarshaller(ProtoUtils.marshaller(GetIamPolicyRequest.getDefaultInstance())) .setResponseMarshaller(ProtoUtils.marshaller(Policy.getDefaultInstance())) .build(); private static final MethodDescriptor<TestIamPermissionsRequest, TestIamPermissionsResponse> testIamPermissionsMethodDescriptor = MethodDescriptor.<TestIamPermissionsRequest, TestIamPermissionsResponse>newBuilder() .setType(MethodDescriptor.MethodType.UNARY) .setFullMethodName("google.iam.v1.IAMPolicy/TestIamPermissions") .setRequestMarshaller( ProtoUtils.marshaller(TestIamPermissionsRequest.getDefaultInstance())) .setResponseMarshaller( ProtoUtils.marshaller(TestIamPermissionsResponse.getDefaultInstance())) .build(); private final UnaryCallable<ListKeyRingsRequest, ListKeyRingsResponse> listKeyRingsCallable; private final UnaryCallable<ListKeyRingsRequest, ListKeyRingsPagedResponse> listKeyRingsPagedCallable; private final UnaryCallable<ListCryptoKeysRequest, ListCryptoKeysResponse> listCryptoKeysCallable; private final UnaryCallable<ListCryptoKeysRequest, ListCryptoKeysPagedResponse> listCryptoKeysPagedCallable; private final UnaryCallable<ListCryptoKeyVersionsRequest, ListCryptoKeyVersionsResponse> listCryptoKeyVersionsCallable; private final UnaryCallable<ListCryptoKeyVersionsRequest, ListCryptoKeyVersionsPagedResponse> listCryptoKeyVersionsPagedCallable; private final UnaryCallable<ListImportJobsRequest, ListImportJobsResponse> listImportJobsCallable; private final UnaryCallable<ListImportJobsRequest, ListImportJobsPagedResponse> listImportJobsPagedCallable; private final UnaryCallable<GetKeyRingRequest, KeyRing> getKeyRingCallable; private final UnaryCallable<GetCryptoKeyRequest, CryptoKey> getCryptoKeyCallable; private final UnaryCallable<GetCryptoKeyVersionRequest, CryptoKeyVersion> getCryptoKeyVersionCallable; private final UnaryCallable<GetPublicKeyRequest, PublicKey> getPublicKeyCallable; private final UnaryCallable<GetImportJobRequest, ImportJob> getImportJobCallable; private final UnaryCallable<CreateKeyRingRequest, KeyRing> createKeyRingCallable; private final UnaryCallable<CreateCryptoKeyRequest, CryptoKey> createCryptoKeyCallable; private final UnaryCallable<CreateCryptoKeyVersionRequest, CryptoKeyVersion> createCryptoKeyVersionCallable; private final UnaryCallable<ImportCryptoKeyVersionRequest, CryptoKeyVersion> importCryptoKeyVersionCallable; private final UnaryCallable<CreateImportJobRequest, ImportJob> createImportJobCallable; private final UnaryCallable<UpdateCryptoKeyRequest, CryptoKey> updateCryptoKeyCallable; private final UnaryCallable<UpdateCryptoKeyVersionRequest, CryptoKeyVersion> updateCryptoKeyVersionCallable; private final UnaryCallable<UpdateCryptoKeyPrimaryVersionRequest, CryptoKey> updateCryptoKeyPrimaryVersionCallable; private final UnaryCallable<DestroyCryptoKeyVersionRequest, CryptoKeyVersion> destroyCryptoKeyVersionCallable; private final UnaryCallable<RestoreCryptoKeyVersionRequest, CryptoKeyVersion> restoreCryptoKeyVersionCallable; private final UnaryCallable<EncryptRequest, EncryptResponse> encryptCallable; private final UnaryCallable<DecryptRequest, DecryptResponse> decryptCallable; private final UnaryCallable<RawEncryptRequest, RawEncryptResponse> rawEncryptCallable; private final UnaryCallable<RawDecryptRequest, RawDecryptResponse> rawDecryptCallable; private final UnaryCallable<AsymmetricSignRequest, AsymmetricSignResponse> asymmetricSignCallable; private final UnaryCallable<AsymmetricDecryptRequest, AsymmetricDecryptResponse> asymmetricDecryptCallable; private final UnaryCallable<MacSignRequest, MacSignResponse> macSignCallable; private final UnaryCallable<MacVerifyRequest, MacVerifyResponse> macVerifyCallable; private final UnaryCallable<GenerateRandomBytesRequest, GenerateRandomBytesResponse> generateRandomBytesCallable; private final UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable; private final UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse> listLocationsPagedCallable; private final UnaryCallable<GetLocationRequest, Location> getLocationCallable; private final UnaryCallable<SetIamPolicyRequest, Policy> setIamPolicyCallable; private final UnaryCallable<GetIamPolicyRequest, Policy> getIamPolicyCallable; private final UnaryCallable<TestIamPermissionsRequest, TestIamPermissionsResponse> testIamPermissionsCallable; private final BackgroundResource backgroundResources; private final GrpcOperationsStub operationsStub; private final GrpcStubCallableFactory callableFactory; public static final GrpcKeyManagementServiceStub create(KeyManagementServiceStubSettings settings) throws IOException { return new GrpcKeyManagementServiceStub(settings, ClientContext.create(settings)); } public static final GrpcKeyManagementServiceStub create(ClientContext clientContext) throws IOException { return new GrpcKeyManagementServiceStub( KeyManagementServiceStubSettings.newBuilder().build(), clientContext); } public static final GrpcKeyManagementServiceStub create( ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { return new GrpcKeyManagementServiceStub( KeyManagementServiceStubSettings.newBuilder().build(), clientContext, callableFactory); } /** * Constructs an instance of GrpcKeyManagementServiceStub, using the given settings. This is * protected so that it is easy to make a subclass, but otherwise, the static factory methods * should be preferred. */ protected GrpcKeyManagementServiceStub( KeyManagementServiceStubSettings settings, ClientContext clientContext) throws IOException { this(settings, clientContext, new GrpcKeyManagementServiceCallableFactory()); } /** * Constructs an instance of GrpcKeyManagementServiceStub, using the given settings. This is * protected so that it is easy to make a subclass, but otherwise, the static factory methods * should be preferred. */ protected GrpcKeyManagementServiceStub( KeyManagementServiceStubSettings settings, ClientContext clientContext, GrpcStubCallableFactory callableFactory) throws IOException { this.callableFactory = callableFactory; this.operationsStub = GrpcOperationsStub.create(clientContext, callableFactory); GrpcCallSettings<ListKeyRingsRequest, ListKeyRingsResponse> listKeyRingsTransportSettings = GrpcCallSettings.<ListKeyRingsRequest, ListKeyRingsResponse>newBuilder() .setMethodDescriptor(listKeyRingsMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings<ListCryptoKeysRequest, ListCryptoKeysResponse> listCryptoKeysTransportSettings = GrpcCallSettings.<ListCryptoKeysRequest, ListCryptoKeysResponse>newBuilder() .setMethodDescriptor(listCryptoKeysMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings<ListCryptoKeyVersionsRequest, ListCryptoKeyVersionsResponse> listCryptoKeyVersionsTransportSettings = GrpcCallSettings .<ListCryptoKeyVersionsRequest, ListCryptoKeyVersionsResponse>newBuilder() .setMethodDescriptor(listCryptoKeyVersionsMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings<ListImportJobsRequest, ListImportJobsResponse> listImportJobsTransportSettings = GrpcCallSettings.<ListImportJobsRequest, ListImportJobsResponse>newBuilder() .setMethodDescriptor(listImportJobsMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings<GetKeyRingRequest, KeyRing> getKeyRingTransportSettings = GrpcCallSettings.<GetKeyRingRequest, KeyRing>newBuilder() .setMethodDescriptor(getKeyRingMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings<GetCryptoKeyRequest, CryptoKey> getCryptoKeyTransportSettings = GrpcCallSettings.<GetCryptoKeyRequest, CryptoKey>newBuilder() .setMethodDescriptor(getCryptoKeyMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings<GetCryptoKeyVersionRequest, CryptoKeyVersion> getCryptoKeyVersionTransportSettings = GrpcCallSettings.<GetCryptoKeyVersionRequest, CryptoKeyVersion>newBuilder() .setMethodDescriptor(getCryptoKeyVersionMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings<GetPublicKeyRequest, PublicKey> getPublicKeyTransportSettings = GrpcCallSettings.<GetPublicKeyRequest, PublicKey>newBuilder() .setMethodDescriptor(getPublicKeyMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings<GetImportJobRequest, ImportJob> getImportJobTransportSettings = GrpcCallSettings.<GetImportJobRequest, ImportJob>newBuilder() .setMethodDescriptor(getImportJobMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings<CreateKeyRingRequest, KeyRing> createKeyRingTransportSettings = GrpcCallSettings.<CreateKeyRingRequest, KeyRing>newBuilder() .setMethodDescriptor(createKeyRingMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings<CreateCryptoKeyRequest, CryptoKey> createCryptoKeyTransportSettings = GrpcCallSettings.<CreateCryptoKeyRequest, CryptoKey>newBuilder() .setMethodDescriptor(createCryptoKeyMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings<CreateCryptoKeyVersionRequest, CryptoKeyVersion> createCryptoKeyVersionTransportSettings = GrpcCallSettings.<CreateCryptoKeyVersionRequest, CryptoKeyVersion>newBuilder() .setMethodDescriptor(createCryptoKeyVersionMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings<ImportCryptoKeyVersionRequest, CryptoKeyVersion> importCryptoKeyVersionTransportSettings = GrpcCallSettings.<ImportCryptoKeyVersionRequest, CryptoKeyVersion>newBuilder() .setMethodDescriptor(importCryptoKeyVersionMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings<CreateImportJobRequest, ImportJob> createImportJobTransportSettings = GrpcCallSettings.<CreateImportJobRequest, ImportJob>newBuilder() .setMethodDescriptor(createImportJobMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("parent", String.valueOf(request.getParent())); return builder.build(); }) .build(); GrpcCallSettings<UpdateCryptoKeyRequest, CryptoKey> updateCryptoKeyTransportSettings = GrpcCallSettings.<UpdateCryptoKeyRequest, CryptoKey>newBuilder() .setMethodDescriptor(updateCryptoKeyMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("crypto_key.name", String.valueOf(request.getCryptoKey().getName())); return builder.build(); }) .build(); GrpcCallSettings<UpdateCryptoKeyVersionRequest, CryptoKeyVersion> updateCryptoKeyVersionTransportSettings = GrpcCallSettings.<UpdateCryptoKeyVersionRequest, CryptoKeyVersion>newBuilder() .setMethodDescriptor(updateCryptoKeyVersionMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add( "crypto_key_version.name", String.valueOf(request.getCryptoKeyVersion().getName())); return builder.build(); }) .build(); GrpcCallSettings<UpdateCryptoKeyPrimaryVersionRequest, CryptoKey> updateCryptoKeyPrimaryVersionTransportSettings = GrpcCallSettings.<UpdateCryptoKeyPrimaryVersionRequest, CryptoKey>newBuilder() .setMethodDescriptor(updateCryptoKeyPrimaryVersionMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings<DestroyCryptoKeyVersionRequest, CryptoKeyVersion> destroyCryptoKeyVersionTransportSettings = GrpcCallSettings.<DestroyCryptoKeyVersionRequest, CryptoKeyVersion>newBuilder() .setMethodDescriptor(destroyCryptoKeyVersionMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings<RestoreCryptoKeyVersionRequest, CryptoKeyVersion> restoreCryptoKeyVersionTransportSettings = GrpcCallSettings.<RestoreCryptoKeyVersionRequest, CryptoKeyVersion>newBuilder() .setMethodDescriptor(restoreCryptoKeyVersionMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings<EncryptRequest, EncryptResponse> encryptTransportSettings = GrpcCallSettings.<EncryptRequest, EncryptResponse>newBuilder() .setMethodDescriptor(encryptMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings<DecryptRequest, DecryptResponse> decryptTransportSettings = GrpcCallSettings.<DecryptRequest, DecryptResponse>newBuilder() .setMethodDescriptor(decryptMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings<RawEncryptRequest, RawEncryptResponse> rawEncryptTransportSettings = GrpcCallSettings.<RawEncryptRequest, RawEncryptResponse>newBuilder() .setMethodDescriptor(rawEncryptMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings<RawDecryptRequest, RawDecryptResponse> rawDecryptTransportSettings = GrpcCallSettings.<RawDecryptRequest, RawDecryptResponse>newBuilder() .setMethodDescriptor(rawDecryptMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings<AsymmetricSignRequest, AsymmetricSignResponse> asymmetricSignTransportSettings = GrpcCallSettings.<AsymmetricSignRequest, AsymmetricSignResponse>newBuilder() .setMethodDescriptor(asymmetricSignMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings<AsymmetricDecryptRequest, AsymmetricDecryptResponse> asymmetricDecryptTransportSettings = GrpcCallSettings.<AsymmetricDecryptRequest, AsymmetricDecryptResponse>newBuilder() .setMethodDescriptor(asymmetricDecryptMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings<MacSignRequest, MacSignResponse> macSignTransportSettings = GrpcCallSettings.<MacSignRequest, MacSignResponse>newBuilder() .setMethodDescriptor(macSignMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings<MacVerifyRequest, MacVerifyResponse> macVerifyTransportSettings = GrpcCallSettings.<MacVerifyRequest, MacVerifyResponse>newBuilder() .setMethodDescriptor(macVerifyMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings<GenerateRandomBytesRequest, GenerateRandomBytesResponse> generateRandomBytesTransportSettings = GrpcCallSettings.<GenerateRandomBytesRequest, GenerateRandomBytesResponse>newBuilder() .setMethodDescriptor(generateRandomBytesMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("location", String.valueOf(request.getLocation())); return builder.build(); }) .build(); GrpcCallSettings<ListLocationsRequest, ListLocationsResponse> listLocationsTransportSettings = GrpcCallSettings.<ListLocationsRequest, ListLocationsResponse>newBuilder() .setMethodDescriptor(listLocationsMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings<GetLocationRequest, Location> getLocationTransportSettings = GrpcCallSettings.<GetLocationRequest, Location>newBuilder() .setMethodDescriptor(getLocationMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("name", String.valueOf(request.getName())); return builder.build(); }) .build(); GrpcCallSettings<SetIamPolicyRequest, Policy> setIamPolicyTransportSettings = GrpcCallSettings.<SetIamPolicyRequest, Policy>newBuilder() .setMethodDescriptor(setIamPolicyMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("resource", String.valueOf(request.getResource())); return builder.build(); }) .build(); GrpcCallSettings<GetIamPolicyRequest, Policy> getIamPolicyTransportSettings = GrpcCallSettings.<GetIamPolicyRequest, Policy>newBuilder() .setMethodDescriptor(getIamPolicyMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("resource", String.valueOf(request.getResource())); return builder.build(); }) .build(); GrpcCallSettings<TestIamPermissionsRequest, TestIamPermissionsResponse> testIamPermissionsTransportSettings = GrpcCallSettings.<TestIamPermissionsRequest, TestIamPermissionsResponse>newBuilder() .setMethodDescriptor(testIamPermissionsMethodDescriptor) .setParamsExtractor( request -> { RequestParamsBuilder builder = RequestParamsBuilder.create(); builder.add("resource", String.valueOf(request.getResource())); return builder.build(); }) .build(); this.listKeyRingsCallable = callableFactory.createUnaryCallable( listKeyRingsTransportSettings, settings.listKeyRingsSettings(), clientContext); this.listKeyRingsPagedCallable = callableFactory.createPagedCallable( listKeyRingsTransportSettings, settings.listKeyRingsSettings(), clientContext); this.listCryptoKeysCallable = callableFactory.createUnaryCallable( listCryptoKeysTransportSettings, settings.listCryptoKeysSettings(), clientContext); this.listCryptoKeysPagedCallable = callableFactory.createPagedCallable( listCryptoKeysTransportSettings, settings.listCryptoKeysSettings(), clientContext); this.listCryptoKeyVersionsCallable = callableFactory.createUnaryCallable( listCryptoKeyVersionsTransportSettings, settings.listCryptoKeyVersionsSettings(), clientContext); this.listCryptoKeyVersionsPagedCallable = callableFactory.createPagedCallable( listCryptoKeyVersionsTransportSettings, settings.listCryptoKeyVersionsSettings(), clientContext); this.listImportJobsCallable = callableFactory.createUnaryCallable( listImportJobsTransportSettings, settings.listImportJobsSettings(), clientContext); this.listImportJobsPagedCallable = callableFactory.createPagedCallable( listImportJobsTransportSettings, settings.listImportJobsSettings(), clientContext); this.getKeyRingCallable = callableFactory.createUnaryCallable( getKeyRingTransportSettings, settings.getKeyRingSettings(), clientContext); this.getCryptoKeyCallable = callableFactory.createUnaryCallable( getCryptoKeyTransportSettings, settings.getCryptoKeySettings(), clientContext); this.getCryptoKeyVersionCallable = callableFactory.createUnaryCallable( getCryptoKeyVersionTransportSettings, settings.getCryptoKeyVersionSettings(), clientContext); this.getPublicKeyCallable = callableFactory.createUnaryCallable( getPublicKeyTransportSettings, settings.getPublicKeySettings(), clientContext); this.getImportJobCallable = callableFactory.createUnaryCallable( getImportJobTransportSettings, settings.getImportJobSettings(), clientContext); this.createKeyRingCallable = callableFactory.createUnaryCallable( createKeyRingTransportSettings, settings.createKeyRingSettings(), clientContext); this.createCryptoKeyCallable = callableFactory.createUnaryCallable( createCryptoKeyTransportSettings, settings.createCryptoKeySettings(), clientContext); this.createCryptoKeyVersionCallable = callableFactory.createUnaryCallable( createCryptoKeyVersionTransportSettings, settings.createCryptoKeyVersionSettings(), clientContext); this.importCryptoKeyVersionCallable = callableFactory.createUnaryCallable( importCryptoKeyVersionTransportSettings, settings.importCryptoKeyVersionSettings(), clientContext); this.createImportJobCallable = callableFactory.createUnaryCallable( createImportJobTransportSettings, settings.createImportJobSettings(), clientContext); this.updateCryptoKeyCallable = callableFactory.createUnaryCallable( updateCryptoKeyTransportSettings, settings.updateCryptoKeySettings(), clientContext); this.updateCryptoKeyVersionCallable = callableFactory.createUnaryCallable( updateCryptoKeyVersionTransportSettings, settings.updateCryptoKeyVersionSettings(), clientContext); this.updateCryptoKeyPrimaryVersionCallable = callableFactory.createUnaryCallable( updateCryptoKeyPrimaryVersionTransportSettings, settings.updateCryptoKeyPrimaryVersionSettings(), clientContext); this.destroyCryptoKeyVersionCallable = callableFactory.createUnaryCallable( destroyCryptoKeyVersionTransportSettings, settings.destroyCryptoKeyVersionSettings(), clientContext); this.restoreCryptoKeyVersionCallable = callableFactory.createUnaryCallable( restoreCryptoKeyVersionTransportSettings, settings.restoreCryptoKeyVersionSettings(), clientContext); this.encryptCallable = callableFactory.createUnaryCallable( encryptTransportSettings, settings.encryptSettings(), clientContext); this.decryptCallable = callableFactory.createUnaryCallable( decryptTransportSettings, settings.decryptSettings(), clientContext); this.rawEncryptCallable = callableFactory.createUnaryCallable( rawEncryptTransportSettings, settings.rawEncryptSettings(), clientContext); this.rawDecryptCallable = callableFactory.createUnaryCallable( rawDecryptTransportSettings, settings.rawDecryptSettings(), clientContext); this.asymmetricSignCallable = callableFactory.createUnaryCallable( asymmetricSignTransportSettings, settings.asymmetricSignSettings(), clientContext); this.asymmetricDecryptCallable = callableFactory.createUnaryCallable( asymmetricDecryptTransportSettings, settings.asymmetricDecryptSettings(), clientContext); this.macSignCallable = callableFactory.createUnaryCallable( macSignTransportSettings, settings.macSignSettings(), clientContext); this.macVerifyCallable = callableFactory.createUnaryCallable( macVerifyTransportSettings, settings.macVerifySettings(), clientContext); this.generateRandomBytesCallable = callableFactory.createUnaryCallable( generateRandomBytesTransportSettings, settings.generateRandomBytesSettings(), clientContext); this.listLocationsCallable = callableFactory.createUnaryCallable( listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); this.listLocationsPagedCallable = callableFactory.createPagedCallable( listLocationsTransportSettings, settings.listLocationsSettings(), clientContext); this.getLocationCallable = callableFactory.createUnaryCallable( getLocationTransportSettings, settings.getLocationSettings(), clientContext); this.setIamPolicyCallable = callableFactory.createUnaryCallable( setIamPolicyTransportSettings, settings.setIamPolicySettings(), clientContext); this.getIamPolicyCallable = callableFactory.createUnaryCallable( getIamPolicyTransportSettings, settings.getIamPolicySettings(), clientContext); this.testIamPermissionsCallable = callableFactory.createUnaryCallable( testIamPermissionsTransportSettings, settings.testIamPermissionsSettings(), clientContext); this.backgroundResources = new BackgroundResourceAggregation(clientContext.getBackgroundResources()); } public GrpcOperationsStub getOperationsStub() { return operationsStub; } @Override public UnaryCallable<ListKeyRingsRequest, ListKeyRingsResponse> listKeyRingsCallable() { return listKeyRingsCallable; } @Override public UnaryCallable<ListKeyRingsRequest, ListKeyRingsPagedResponse> listKeyRingsPagedCallable() { return listKeyRingsPagedCallable; } @Override public UnaryCallable<ListCryptoKeysRequest, ListCryptoKeysResponse> listCryptoKeysCallable() { return listCryptoKeysCallable; } @Override public UnaryCallable<ListCryptoKeysRequest, ListCryptoKeysPagedResponse> listCryptoKeysPagedCallable() { return listCryptoKeysPagedCallable; } @Override public UnaryCallable<ListCryptoKeyVersionsRequest, ListCryptoKeyVersionsResponse> listCryptoKeyVersionsCallable() { return listCryptoKeyVersionsCallable; } @Override public UnaryCallable<ListCryptoKeyVersionsRequest, ListCryptoKeyVersionsPagedResponse> listCryptoKeyVersionsPagedCallable() { return listCryptoKeyVersionsPagedCallable; } @Override public UnaryCallable<ListImportJobsRequest, ListImportJobsResponse> listImportJobsCallable() { return listImportJobsCallable; } @Override public UnaryCallable<ListImportJobsRequest, ListImportJobsPagedResponse> listImportJobsPagedCallable() { return listImportJobsPagedCallable; } @Override public UnaryCallable<GetKeyRingRequest, KeyRing> getKeyRingCallable() { return getKeyRingCallable; } @Override public UnaryCallable<GetCryptoKeyRequest, CryptoKey> getCryptoKeyCallable() { return getCryptoKeyCallable; } @Override public UnaryCallable<GetCryptoKeyVersionRequest, CryptoKeyVersion> getCryptoKeyVersionCallable() { return getCryptoKeyVersionCallable; } @Override public UnaryCallable<GetPublicKeyRequest, PublicKey> getPublicKeyCallable() { return getPublicKeyCallable; } @Override public UnaryCallable<GetImportJobRequest, ImportJob> getImportJobCallable() { return getImportJobCallable; } @Override public UnaryCallable<CreateKeyRingRequest, KeyRing> createKeyRingCallable() { return createKeyRingCallable; } @Override public UnaryCallable<CreateCryptoKeyRequest, CryptoKey> createCryptoKeyCallable() { return createCryptoKeyCallable; } @Override public UnaryCallable<CreateCryptoKeyVersionRequest, CryptoKeyVersion> createCryptoKeyVersionCallable() { return createCryptoKeyVersionCallable; } @Override public UnaryCallable<ImportCryptoKeyVersionRequest, CryptoKeyVersion> importCryptoKeyVersionCallable() { return importCryptoKeyVersionCallable; } @Override public UnaryCallable<CreateImportJobRequest, ImportJob> createImportJobCallable() { return createImportJobCallable; } @Override public UnaryCallable<UpdateCryptoKeyRequest, CryptoKey> updateCryptoKeyCallable() { return updateCryptoKeyCallable; } @Override public UnaryCallable<UpdateCryptoKeyVersionRequest, CryptoKeyVersion> updateCryptoKeyVersionCallable() { return updateCryptoKeyVersionCallable; } @Override public UnaryCallable<UpdateCryptoKeyPrimaryVersionRequest, CryptoKey> updateCryptoKeyPrimaryVersionCallable() { return updateCryptoKeyPrimaryVersionCallable; } @Override public UnaryCallable<DestroyCryptoKeyVersionRequest, CryptoKeyVersion> destroyCryptoKeyVersionCallable() { return destroyCryptoKeyVersionCallable; } @Override public UnaryCallable<RestoreCryptoKeyVersionRequest, CryptoKeyVersion> restoreCryptoKeyVersionCallable() { return restoreCryptoKeyVersionCallable; } @Override public UnaryCallable<EncryptRequest, EncryptResponse> encryptCallable() { return encryptCallable; } @Override public UnaryCallable<DecryptRequest, DecryptResponse> decryptCallable() { return decryptCallable; } @Override public UnaryCallable<RawEncryptRequest, RawEncryptResponse> rawEncryptCallable() { return rawEncryptCallable; } @Override public UnaryCallable<RawDecryptRequest, RawDecryptResponse> rawDecryptCallable() { return rawDecryptCallable; } @Override public UnaryCallable<AsymmetricSignRequest, AsymmetricSignResponse> asymmetricSignCallable() { return asymmetricSignCallable; } @Override public UnaryCallable<AsymmetricDecryptRequest, AsymmetricDecryptResponse> asymmetricDecryptCallable() { return asymmetricDecryptCallable; } @Override public UnaryCallable<MacSignRequest, MacSignResponse> macSignCallable() { return macSignCallable; } @Override public UnaryCallable<MacVerifyRequest, MacVerifyResponse> macVerifyCallable() { return macVerifyCallable; } @Override public UnaryCallable<GenerateRandomBytesRequest, GenerateRandomBytesResponse> generateRandomBytesCallable() { return generateRandomBytesCallable; } @Override public UnaryCallable<ListLocationsRequest, ListLocationsResponse> listLocationsCallable() { return listLocationsCallable; } @Override public UnaryCallable<ListLocationsRequest, ListLocationsPagedResponse> listLocationsPagedCallable() { return listLocationsPagedCallable; } @Override public UnaryCallable<GetLocationRequest, Location> getLocationCallable() { return getLocationCallable; } @Override public UnaryCallable<SetIamPolicyRequest, Policy> setIamPolicyCallable() { return setIamPolicyCallable; } @Override public UnaryCallable<GetIamPolicyRequest, Policy> getIamPolicyCallable() { return getIamPolicyCallable; } @Override public UnaryCallable<TestIamPermissionsRequest, TestIamPermissionsResponse> testIamPermissionsCallable() { return testIamPermissionsCallable; } @Override public final void close() { try { backgroundResources.close(); } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new IllegalStateException("Failed to close resource", e); } } @Override public void shutdown() { backgroundResources.shutdown(); } @Override public boolean isShutdown() { return backgroundResources.isShutdown(); } @Override public boolean isTerminated() { return backgroundResources.isTerminated(); } @Override public void shutdownNow() { backgroundResources.shutdownNow(); } @Override public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { return backgroundResources.awaitTermination(duration, unit); } }
62,537
0.717447
0.715912
1,254
48.870014
30.209631
100
false
false
0
0
0
0
0
0
0.569378
false
false
7
0fef52281810edc247e66a497a6c55fdc76d5885
19,662,360,327,577
0598bddcb08f4fbd7783c80c741a8d40a12d0b43
/command/GUI.java
81b98572fa327cb0d676ed43824c0fa6d5c9f769
[]
no_license
schnitzlein/javapatterns
https://github.com/schnitzlein/javapatterns
b0fdaf2d352c74c2fc2862e6f63826cc886d3113
42087ed7cba15b255f264f9823f4d1dbdf83643d
refs/heads/master
2022-04-18T23:11:12.509000
2020-04-16T12:50:48
2020-04-16T12:50:48
256,203,947
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import javax.swing.JButton; import javax.swing.JColorChooser; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextField; import java.awt.Dimension; import java.awt.GridLayout; import java.awt.Color; import java.util.Random; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class GUI extends JFrame implements ActionListener{ //FIXME: Liste nur bis Stelle 1 gehen oder undo redo anpassen //aus undo kann ab Listen Stelle 0 nicht wieder redo gemacht werden, Zugriff auf 0 verhindern und eine pos weniger //wäre quick and dirty Klient k = new Klient(0); Aufrufer a = new Aufrufer(); private Color color = new Color(255, 255, 255); Random random = new Random(); private JTextField textf = new JTextField(); private JButton b1 = new JButton("change Color"); private JButton b2 = new JButton("redo"); private JButton b3 = new JButton("undo"); private JButton b4 = new JButton("print History"); //private JButton b5 = new JButton("choose Color"); //private JColorChooser jc = new JColorChooser(); //Farben (RGB) int r = 255; int g = 255; int b = 255; public Color randomColor(){ random = new Random(); r = random.nextInt(255); g = random.nextInt(255); b = random.nextInt(255); return new Color(r, g, b); } public GUI(){ Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); int w = this.getSize().width; int h = this.getSize().height; int x = (dim.width-w)/2; int y = (dim.height-h)/2; this.setLocation(x, y); this.setTitle("Command Pattern"); this.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); JPanel buttons = new JPanel(new GridLayout(1,5)); this.setLayout( new GridLayout(2,1) ); this.setSize(230,130); //pack wird verwendet faellt also weg b2.setEnabled(false); b3.setEnabled(false); this.add(textf); this.add(buttons); buttons.add(b1); buttons.add(b2); buttons.add(b3); buttons.add(b4); //buttons.add(b5); b1.addActionListener(this); b2.addActionListener(this); b3.addActionListener(this); b4.addActionListener(this); //b5.addActionListener(this); k.getEmpfaenger().setzeEmpfaenger(textf); /*KonkreterBefehl first_cmd = new KonkreterBefehl(k.myEmpfaenger.getObject(),this.k.myEmpfaenger); first_cmd.setColor(new Color(255,255,255)); a.doSth(first_cmd);*/ this.setVisible(true); this.pack(); }//Konstruktor public static void main(String[] args){ new GUI(); } @Override public void actionPerformed(ActionEvent ae) { //change Color if (ae.getActionCommand().equals("change Color")){ //Change Color and add this change Color command bzw. neuen erzeugen color = randomColor(); //textf.setBackground(color); textf.setText(color.toString()); // //Befehl in Aufrufer commands pushen // KonkreterBefehl neu_cmd = new KonkreterBefehl(k.myEmpfaenger.getObject(),this.k.myEmpfaenger); neu_cmd.setColor(color); a.doSth(neu_cmd); a.deleteUndoCmds(); //eigenitlich uncool schränkt ein das ich nachdem ein neuer befehl kam ich nicht weiter zurück kann // //Befehl in Aufrufer commands pushen // // // Kram mit Liste // try { a.showLast().commandAction(); } catch (Exception e) { System.out.println("Befehl konnte nicht geladen oder verarbeitet werden."); e.printStackTrace(); } b3.setEnabled(true); //undo an b2.setEnabled(false); //redo aus }//change Color //redo if (ae.getActionCommand().equals("redo")){ a.redo(); try { a.showLast().commandAction(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } if (a.isRedoCmdsLeer()) b2.setEnabled(false); }//redo //undo if (ae.getActionCommand().equals("undo")){ // if (a.getCmdsSize() == 1){ textf.setBackground(new Color(255,255,255)); textf.setText(textf.getBackground().toString()); b3.setEnabled(false); b2.setEnabled(false); a.deleteCmds(); } else { a.undo(); b2.setEnabled(true); try { a.showLast().commandAction(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } }//undo /*if (ae.getActionCommand().equals("choose Color")){ JDialog jd = new JDialog(); jd.setSize(500,400); jd.getContentPane().add(jc); jd.setDefaultCloseOperation(DISPOSE_ON_CLOSE); jd.setVisible(true); }*/ if (ae.getActionCommand().equals("print History")){ a.printHistory(); } }//actionPerformed }//GUI
ISO-8859-1
Java
4,864
java
GUI.java
Java
[]
null
[]
import javax.swing.JButton; import javax.swing.JColorChooser; import javax.swing.JDialog; import javax.swing.JFrame; import javax.swing.JPanel; import javax.swing.JTextField; import java.awt.Dimension; import java.awt.GridLayout; import java.awt.Color; import java.util.Random; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class GUI extends JFrame implements ActionListener{ //FIXME: Liste nur bis Stelle 1 gehen oder undo redo anpassen //aus undo kann ab Listen Stelle 0 nicht wieder redo gemacht werden, Zugriff auf 0 verhindern und eine pos weniger //wäre quick and dirty Klient k = new Klient(0); Aufrufer a = new Aufrufer(); private Color color = new Color(255, 255, 255); Random random = new Random(); private JTextField textf = new JTextField(); private JButton b1 = new JButton("change Color"); private JButton b2 = new JButton("redo"); private JButton b3 = new JButton("undo"); private JButton b4 = new JButton("print History"); //private JButton b5 = new JButton("choose Color"); //private JColorChooser jc = new JColorChooser(); //Farben (RGB) int r = 255; int g = 255; int b = 255; public Color randomColor(){ random = new Random(); r = random.nextInt(255); g = random.nextInt(255); b = random.nextInt(255); return new Color(r, g, b); } public GUI(){ Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); int w = this.getSize().width; int h = this.getSize().height; int x = (dim.width-w)/2; int y = (dim.height-h)/2; this.setLocation(x, y); this.setTitle("Command Pattern"); this.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); JPanel buttons = new JPanel(new GridLayout(1,5)); this.setLayout( new GridLayout(2,1) ); this.setSize(230,130); //pack wird verwendet faellt also weg b2.setEnabled(false); b3.setEnabled(false); this.add(textf); this.add(buttons); buttons.add(b1); buttons.add(b2); buttons.add(b3); buttons.add(b4); //buttons.add(b5); b1.addActionListener(this); b2.addActionListener(this); b3.addActionListener(this); b4.addActionListener(this); //b5.addActionListener(this); k.getEmpfaenger().setzeEmpfaenger(textf); /*KonkreterBefehl first_cmd = new KonkreterBefehl(k.myEmpfaenger.getObject(),this.k.myEmpfaenger); first_cmd.setColor(new Color(255,255,255)); a.doSth(first_cmd);*/ this.setVisible(true); this.pack(); }//Konstruktor public static void main(String[] args){ new GUI(); } @Override public void actionPerformed(ActionEvent ae) { //change Color if (ae.getActionCommand().equals("change Color")){ //Change Color and add this change Color command bzw. neuen erzeugen color = randomColor(); //textf.setBackground(color); textf.setText(color.toString()); // //Befehl in Aufrufer commands pushen // KonkreterBefehl neu_cmd = new KonkreterBefehl(k.myEmpfaenger.getObject(),this.k.myEmpfaenger); neu_cmd.setColor(color); a.doSth(neu_cmd); a.deleteUndoCmds(); //eigenitlich uncool schränkt ein das ich nachdem ein neuer befehl kam ich nicht weiter zurück kann // //Befehl in Aufrufer commands pushen // // // Kram mit Liste // try { a.showLast().commandAction(); } catch (Exception e) { System.out.println("Befehl konnte nicht geladen oder verarbeitet werden."); e.printStackTrace(); } b3.setEnabled(true); //undo an b2.setEnabled(false); //redo aus }//change Color //redo if (ae.getActionCommand().equals("redo")){ a.redo(); try { a.showLast().commandAction(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } if (a.isRedoCmdsLeer()) b2.setEnabled(false); }//redo //undo if (ae.getActionCommand().equals("undo")){ // if (a.getCmdsSize() == 1){ textf.setBackground(new Color(255,255,255)); textf.setText(textf.getBackground().toString()); b3.setEnabled(false); b2.setEnabled(false); a.deleteCmds(); } else { a.undo(); b2.setEnabled(true); try { a.showLast().commandAction(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } }//undo /*if (ae.getActionCommand().equals("choose Color")){ JDialog jd = new JDialog(); jd.setSize(500,400); jd.getContentPane().add(jc); jd.setDefaultCloseOperation(DISPOSE_ON_CLOSE); jd.setVisible(true); }*/ if (ae.getActionCommand().equals("print History")){ a.printHistory(); } }//actionPerformed }//GUI
4,864
0.639169
0.620448
191
24.445026
21.529133
126
false
false
0
0
0
0
0
0
0.623037
false
false
7
0fae9031fcc8cdbe88b6a02725966969353b7b89
8,203,387,564,383
de016a8c14f97ab27b7690f5b1be25cfac991ca5
/payment-service/src/main/java/com/microservices/payment/controller/PaymentCardController.java
f87a2a0389a8e3ec21b3275adcbfc751ef656293
[]
no_license
Error404NotFoundFCiencias/store-microservices
https://github.com/Error404NotFoundFCiencias/store-microservices
ff0ac5c9a7cc5bc363aed55021c6c0ed3248b345
69b20da8545ad97d89a83f7589c7bedb3dc47b46
refs/heads/main
2023-03-02T16:57:29.518000
2021-02-09T13:42:50
2021-02-09T13:42:50
331,735,137
1
0
null
true
2021-02-03T03:04:05
2021-01-21T19:39:57
2021-01-30T14:19:37
2021-02-03T03:04:04
124
1
0
0
Java
false
false
package com.microservices.payment.controller; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import com.microservices.payment.entity.Card; import com.microservices.payment.service.interfaces.CardService; import lombok.extern.slf4j.Slf4j; @Slf4j @RestController @RequestMapping("/payment-card") public class PaymentCardController { @Autowired CardService cardService; // -------------------Retrieve All Cards-------------------------------------------- @GetMapping public ResponseEntity<List<Card>> listAllInvoices() { List<Card> cards = cardService.findCardAll(); if (cards.isEmpty()) { return ResponseEntity.noContent().build(); } return ResponseEntity.ok(cards); } @GetMapping("/{id}") public ResponseEntity<Card> getCardById(@PathVariable Long id) { Card c = cardService.getCard(id); return ResponseEntity.ok(c); } @GetMapping("/customer/{id}") public ResponseEntity<List<Card>> listAllCardsByCustomerId(@PathVariable Long id) { List<Card> cards = cardService.findAllByCustomerId(id); return cards == null ? ResponseEntity.notFound().build() : ResponseEntity.ok(cards); } @PostMapping public ResponseEntity<Card> createCard(@RequestBody Card card) { Card newCard = cardService.createCard(card); if (newCard == null) { return new ResponseEntity<>(card, HttpStatus.CONFLICT); } return ResponseEntity.ok(newCard); } @PutMapping("/{id}") public ResponseEntity<Card> updateCard(@PathVariable Long id, @RequestBody Card card) { card.setId(id); Card cardDb = cardService.updateCard(card); return cardDb == null ? ResponseEntity.notFound().build() : ResponseEntity.ok(cardDb) ; } @PutMapping("/balance/{id}") public ResponseEntity<Card> updateBalance(@PathVariable Long id, @RequestParam Double quantity) { int result = cardService.updateBalance(id, quantity); return result == 0 ? ResponseEntity.notFound().build() : ResponseEntity.ok().build() ; } @DeleteMapping("/{id}") public ResponseEntity<Card> deleteCard(@PathVariable Long id) { Card card = cardService.deleteCard(id); return card == null ? ResponseEntity.notFound().build() : ResponseEntity.ok(card); } }
UTF-8
Java
2,541
java
PaymentCardController.java
Java
[]
null
[]
package com.microservices.payment.controller; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.*; import com.microservices.payment.entity.Card; import com.microservices.payment.service.interfaces.CardService; import lombok.extern.slf4j.Slf4j; @Slf4j @RestController @RequestMapping("/payment-card") public class PaymentCardController { @Autowired CardService cardService; // -------------------Retrieve All Cards-------------------------------------------- @GetMapping public ResponseEntity<List<Card>> listAllInvoices() { List<Card> cards = cardService.findCardAll(); if (cards.isEmpty()) { return ResponseEntity.noContent().build(); } return ResponseEntity.ok(cards); } @GetMapping("/{id}") public ResponseEntity<Card> getCardById(@PathVariable Long id) { Card c = cardService.getCard(id); return ResponseEntity.ok(c); } @GetMapping("/customer/{id}") public ResponseEntity<List<Card>> listAllCardsByCustomerId(@PathVariable Long id) { List<Card> cards = cardService.findAllByCustomerId(id); return cards == null ? ResponseEntity.notFound().build() : ResponseEntity.ok(cards); } @PostMapping public ResponseEntity<Card> createCard(@RequestBody Card card) { Card newCard = cardService.createCard(card); if (newCard == null) { return new ResponseEntity<>(card, HttpStatus.CONFLICT); } return ResponseEntity.ok(newCard); } @PutMapping("/{id}") public ResponseEntity<Card> updateCard(@PathVariable Long id, @RequestBody Card card) { card.setId(id); Card cardDb = cardService.updateCard(card); return cardDb == null ? ResponseEntity.notFound().build() : ResponseEntity.ok(cardDb) ; } @PutMapping("/balance/{id}") public ResponseEntity<Card> updateBalance(@PathVariable Long id, @RequestParam Double quantity) { int result = cardService.updateBalance(id, quantity); return result == 0 ? ResponseEntity.notFound().build() : ResponseEntity.ok().build() ; } @DeleteMapping("/{id}") public ResponseEntity<Card> deleteCard(@PathVariable Long id) { Card card = cardService.deleteCard(id); return card == null ? ResponseEntity.notFound().build() : ResponseEntity.ok(card); } }
2,541
0.668634
0.66706
77
32
29.948874
101
false
false
0
0
0
0
0
0
0.402597
false
false
14
38134aa6f81007fa01a161e5856b669a9cb50b30
11,570,641,896,813
0b8a7f0b5a50cac16bbcbb8f02c19068727b41a9
/src/main/java/ma/xavion/appecole/service/EcoleService.java
1180f53a5e1e94f7d8a43895c81fbd68f64a7404
[]
no_license
zakaria1159/appecole-1
https://github.com/zakaria1159/appecole-1
743abf5cb3d9591da362c194708f1fcd6c3d680d
7bdea6e36ba51ba2374a04ba9fa160fd9426c93f
refs/heads/master
2021-07-04T08:04:39.614000
2019-03-20T18:47:07
2019-03-20T18:47:07
175,674,704
0
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package ma.xavion.appecole.service; import ma.xavion.appecole.domain.Ecole; import java.util.List; import java.util.Optional; /** * Service Interface for managing Ecole. */ public interface EcoleService { /** * Save a ecole. * * @param ecole the entity to save * @return the persisted entity */ Ecole save(Ecole ecole); /** * Get all the ecoles. * * @return the list of entities */ List<Ecole> findAll(); /** * Get the "id" ecole. * * @param id the id of the entity * @return the entity */ Optional<Ecole> findOne(Long id); /** * Delete the "id" ecole. * * @param id the id of the entity */ void delete(Long id); /** * Search for the ecole corresponding to the query. * * @param query the query of the search * * @return the list of entities */ List<Ecole> search(String query); }
UTF-8
Java
953
java
EcoleService.java
Java
[]
null
[]
package ma.xavion.appecole.service; import ma.xavion.appecole.domain.Ecole; import java.util.List; import java.util.Optional; /** * Service Interface for managing Ecole. */ public interface EcoleService { /** * Save a ecole. * * @param ecole the entity to save * @return the persisted entity */ Ecole save(Ecole ecole); /** * Get all the ecoles. * * @return the list of entities */ List<Ecole> findAll(); /** * Get the "id" ecole. * * @param id the id of the entity * @return the entity */ Optional<Ecole> findOne(Long id); /** * Delete the "id" ecole. * * @param id the id of the entity */ void delete(Long id); /** * Search for the ecole corresponding to the query. * * @param query the query of the search * * @return the list of entities */ List<Ecole> search(String query); }
953
0.570829
0.570829
52
17.326923
15.420667
55
false
false
0
0
0
0
0
0
0.173077
false
false
14
db4f103a2da462d07245da129a6173e63492260f
25,262,997,637,590
6f8359afd86e352dd0f5e128165b5e93953d3d86
/src/Frame.java
9fbc1636785160d5d962c5d0ddfc10932bf0f229
[]
no_license
diagonalisability/lwjgl-maze-game
https://github.com/diagonalisability/lwjgl-maze-game
330a21ca472ad6d42e18250a0d7d03e5caa7ea59
4cf77bb8aa7860e54c6e0e7f4dbe9204dec6c230
refs/heads/master
2022-11-23T17:03:12.717000
2020-08-01T00:10:19
2020-08-01T00:10:19
284,150,368
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/* * David Jacewicz * June 7, 2018 * Ms. Krasteva * A Swing window */ /* * Modification: fix resize after frame modification * David Jacewicz * June 8, 2018 * 10 minutes * Version: 0.05 */ import java.awt.*; import javax.swing.*; import static util.Util.*; public class Frame extends JFrame { private final static Color BACKGROUND_COLOR = new Color(138,196,234); private boolean firstElement = true; /** * Creates a Swing window with the given title * * @param title The title of the window */ public Frame(String title) { super(title); setContentPane(new JPanel(){{ setBorder(BorderFactory.createEmptyBorder(10,10,10,10)); }}); setResizable(false); setDefaultCloseOperation(EXIT_ON_CLOSE); setBackground(new Color(50,100,150)); setLayout(new BoxLayout(getContentPane(),BoxLayout.Y_AXIS)); getContentPane().setBackground(BACKGROUND_COLOR); add(new Panel(){{ add(new JLabel("<html><style>body{font-size:30px;}</style><body>"+title+"</body></html>"){{ setAlignmentX(Component.CENTER_ALIGNMENT); }});}}); } /** Resize after packing frame */ public void pack() { super.pack(); Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); setLocation(dim.width/2-this.getSize().width/2, dim.height/2-this.getSize().height/2); } /** Creates a Swing window with an empty title */ public Frame() { this(""); } /** * Adds a Swing GUI component to the window * * @param component The GUI component to be added */ public void add(JComponent component) { if(firstElement) firstElement = false; else { super.add(Box.createRigidArea(new Dimension(0,5))); } super.add(component); } /** * Adds a GUI button to this Swing window * * @param button The button to be added */ public void add(Button button) { super.add(new Panel(){{add(button);}}); } }
UTF-8
Java
1,838
java
Frame.java
Java
[ { "context": "/*\n * David Jacewicz\n * June 7, 2018\n * Ms. Krasteva\n * A Swing window", "end": 20, "score": 0.9998211860656738, "start": 6, "tag": "NAME", "value": "David Jacewicz" }, { "context": "/*\n * David Jacewicz\n * June 7, 2018\n * Ms. Krasteva\n * A Swing window\n */\n\n/*\n * Modification: fix re", "end": 52, "score": 0.997613787651062, "start": 44, "tag": "NAME", "value": "Krasteva" }, { "context": "dification: fix resize after frame modification\n * David Jacewicz\n * June 8, 2018\n * 10 minutes\n * Version: 0.05\n *", "end": 149, "score": 0.9991089105606079, "start": 135, "tag": "NAME", "value": "David Jacewicz" } ]
null
[]
/* * <NAME> * June 7, 2018 * Ms. Krasteva * A Swing window */ /* * Modification: fix resize after frame modification * <NAME> * June 8, 2018 * 10 minutes * Version: 0.05 */ import java.awt.*; import javax.swing.*; import static util.Util.*; public class Frame extends JFrame { private final static Color BACKGROUND_COLOR = new Color(138,196,234); private boolean firstElement = true; /** * Creates a Swing window with the given title * * @param title The title of the window */ public Frame(String title) { super(title); setContentPane(new JPanel(){{ setBorder(BorderFactory.createEmptyBorder(10,10,10,10)); }}); setResizable(false); setDefaultCloseOperation(EXIT_ON_CLOSE); setBackground(new Color(50,100,150)); setLayout(new BoxLayout(getContentPane(),BoxLayout.Y_AXIS)); getContentPane().setBackground(BACKGROUND_COLOR); add(new Panel(){{ add(new JLabel("<html><style>body{font-size:30px;}</style><body>"+title+"</body></html>"){{ setAlignmentX(Component.CENTER_ALIGNMENT); }});}}); } /** Resize after packing frame */ public void pack() { super.pack(); Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); setLocation(dim.width/2-this.getSize().width/2, dim.height/2-this.getSize().height/2); } /** Creates a Swing window with an empty title */ public Frame() { this(""); } /** * Adds a Swing GUI component to the window * * @param component The GUI component to be added */ public void add(JComponent component) { if(firstElement) firstElement = false; else { super.add(Box.createRigidArea(new Dimension(0,5))); } super.add(component); } /** * Adds a GUI button to this Swing window * * @param button The button to be added */ public void add(Button button) { super.add(new Panel(){{add(button);}}); } }
1,822
0.681175
0.65506
74
23.837837
23.027027
111
false
false
0
0
0
0
0
0
1.527027
false
false
14
4cf25380df727a53c486a22126d0dd564993a1a0
33,174,327,394,965
c975d9397c2e656a049002602fcfa1d6a5f52d7f
/src/main/java/toast/specialMobs/entity/zombie/EntityBrutishZombie.java
ebfcaf8e644f8070b51dc84c62f8c96e9fc70fb5
[]
no_license
necanthrope/SpecialMobs
https://github.com/necanthrope/SpecialMobs
74e193624af4e759bf0665692262809ed1c898fb
c145998415e965ae859eb26d7d397ab02cf5cbc5
refs/heads/master
2021-01-21T13:36:44.464000
2016-01-18T05:30:09
2016-01-18T05:30:09
49,854,217
2
1
null
null
null
null
null
null
null
null
null
null
null
null
null
package toast.specialMobs.entity.zombie; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.init.Items; import net.minecraft.item.ItemBow; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import toast.specialMobs.EffectHelper; import toast.specialMobs.EnchantmentSpecial; import toast.specialMobs._SpecialMobs; public class EntityBrutishZombie extends Entity_SpecialZombie { @SuppressWarnings("hiding") public static final ResourceLocation[] TEXTURES = new ResourceLocation[] { new ResourceLocation(_SpecialMobs.TEXTURE_PATH + "zombie/brutish.png"), new ResourceLocation(_SpecialMobs.TEXTURE_PATH + "zombie/brutish_villager.png") }; public EntityBrutishZombie(World world) { super(world); this.getSpecialData().setTextures(EntityBrutishZombie.TEXTURES); this.experienceValue += 2; } /// Overridden to modify inherited attributes. @Override public void adjustTypeAttributes() { this.getSpecialData().addAttribute(SharedMonsterAttributes.maxHealth, 20.0); this.getSpecialData().armor += 10; if (this.getHeldItem() == null) { this.setCurrentItemOrArmor(0, new ItemStack(Items.wooden_sword)); } ItemStack itemStack = this.getHeldItem(); if (itemStack != null) { if (itemStack.getItem() instanceof ItemBow) { if (EnchantmentSpecial.painBow != null) { EffectHelper.overrideEnchantment(itemStack, EnchantmentSpecial.painBow, this.rand.nextInt(EnchantmentSpecial.painBow.getMaxLevel()) + 1); } } else if (EnchantmentSpecial.painSword != null) { EffectHelper.overrideEnchantment(itemStack, EnchantmentSpecial.painSword, this.rand.nextInt(EnchantmentSpecial.painSword.getMaxLevel()) + 1); } } } /// Called when this entity is killed. @Override protected void dropFewItems(boolean hit, int looting) { super.dropFewItems(hit, looting); for (int i = this.rand.nextInt(2 + looting); i-- > 0;) { this.dropItem(Items.flint, 1); } } /// Called 2.5% of the time when this entity is killed. 20% chance that superRare == 1, otherwise superRare == 0. @Override protected void dropRareDrop(int superRare) { this.dropItem(Items.iron_ingot, 1); } }
UTF-8
Java
2,456
java
EntityBrutishZombie.java
Java
[]
null
[]
package toast.specialMobs.entity.zombie; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.init.Items; import net.minecraft.item.ItemBow; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import toast.specialMobs.EffectHelper; import toast.specialMobs.EnchantmentSpecial; import toast.specialMobs._SpecialMobs; public class EntityBrutishZombie extends Entity_SpecialZombie { @SuppressWarnings("hiding") public static final ResourceLocation[] TEXTURES = new ResourceLocation[] { new ResourceLocation(_SpecialMobs.TEXTURE_PATH + "zombie/brutish.png"), new ResourceLocation(_SpecialMobs.TEXTURE_PATH + "zombie/brutish_villager.png") }; public EntityBrutishZombie(World world) { super(world); this.getSpecialData().setTextures(EntityBrutishZombie.TEXTURES); this.experienceValue += 2; } /// Overridden to modify inherited attributes. @Override public void adjustTypeAttributes() { this.getSpecialData().addAttribute(SharedMonsterAttributes.maxHealth, 20.0); this.getSpecialData().armor += 10; if (this.getHeldItem() == null) { this.setCurrentItemOrArmor(0, new ItemStack(Items.wooden_sword)); } ItemStack itemStack = this.getHeldItem(); if (itemStack != null) { if (itemStack.getItem() instanceof ItemBow) { if (EnchantmentSpecial.painBow != null) { EffectHelper.overrideEnchantment(itemStack, EnchantmentSpecial.painBow, this.rand.nextInt(EnchantmentSpecial.painBow.getMaxLevel()) + 1); } } else if (EnchantmentSpecial.painSword != null) { EffectHelper.overrideEnchantment(itemStack, EnchantmentSpecial.painSword, this.rand.nextInt(EnchantmentSpecial.painSword.getMaxLevel()) + 1); } } } /// Called when this entity is killed. @Override protected void dropFewItems(boolean hit, int looting) { super.dropFewItems(hit, looting); for (int i = this.rand.nextInt(2 + looting); i-- > 0;) { this.dropItem(Items.flint, 1); } } /// Called 2.5% of the time when this entity is killed. 20% chance that superRare == 1, otherwise superRare == 0. @Override protected void dropRareDrop(int superRare) { this.dropItem(Items.iron_ingot, 1); } }
2,456
0.678746
0.67101
63
38
34.143951
157
false
false
0
0
0
0
0
0
0.587302
false
false
14
1073aada091d478984515a67a5a665520dcadfc5
20,366,734,941,501
8d1f240f5e758cc236d2e632edc8960248c9c4f4
/src/main/java/SetDuplicate/SetApp.java
0ebd3400ce861572ce274ca789ddea40cb3555b4
[]
no_license
feriwnarta/NextLearn
https://github.com/feriwnarta/NextLearn
95e1d356caefb2b55ec886fe22f98841e495a11b
b39b152b8ca2992eef04f6cb099a9b396b7d937b
refs/heads/main
2023-05-09T09:45:50.600000
2021-06-06T09:14:43
2021-06-06T09:14:43
374,315,587
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 SetDuplicate; /** * * @author Feri Winarta */ import java.util.Comparator; import java.util.HashSet; import java.util.Set; public class SetApp { public static void main(String[] args) { Person person1 = new Person(1, "Joko"); Person person2 = new Person(2, "Tinggkir"); Person person3 = new Person(3, "Sukijem"); Person person4 = new Person(4, "Jaka"); } }
UTF-8
Java
666
java
SetApp.java
Java
[ { "context": "itor.\n */\npackage SetDuplicate;\n\n/**\n *\n * @author Feri Winarta\n */\n\nimport java.util.Comparator;\nimport java.uti", "end": 238, "score": 0.9998530149459839, "start": 226, "tag": "NAME", "value": "Feri Winarta" }, { "context": "] args) {\n Person person1 = new Person(1, \"Joko\");\n Person person2 = new Person(2, \"Tinggk", "end": 433, "score": 0.999785840511322, "start": 429, "tag": "NAME", "value": "Joko" }, { "context": " \"Joko\");\n Person person2 = new Person(2, \"Tinggkir\");\n Person person3 = new Person(3, \"Sukije", "end": 485, "score": 0.9997753500938416, "start": 477, "tag": "NAME", "value": "Tinggkir" }, { "context": "nggkir\");\n Person person3 = new Person(3, \"Sukijem\");\n Person person4 = new Person(4, \"Jaka\")", "end": 536, "score": 0.9997242093086243, "start": 529, "tag": "NAME", "value": "Sukijem" }, { "context": "ukijem\");\n Person person4 = new Person(4, \"Jaka\");\n \n \n \n \n \n ", "end": 584, "score": 0.9997794032096863, "start": 580, "tag": "NAME", "value": "Jaka" } ]
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 SetDuplicate; /** * * @author <NAME> */ import java.util.Comparator; import java.util.HashSet; import java.util.Set; public class SetApp { public static void main(String[] args) { Person person1 = new Person(1, "Joko"); Person person2 = new Person(2, "Tinggkir"); Person person3 = new Person(3, "Sukijem"); Person person4 = new Person(4, "Jaka"); } }
660
0.596096
0.584084
32
19.8125
20.697882
79
false
false
0
0
0
0
0
0
0.46875
false
false
14
27fff2d0a30e9c997e6d67081fea7da6b53b4fc0
13,537,736,917,589
594f8e476062ef4c79e510576a588536b43e8f21
/src/test/java/com/ds/service/UserServiceTester.java
6c34878b01ae703c10baf602d6fb14c7613c09cd
[]
no_license
kevinlehung/DatingServer
https://github.com/kevinlehung/DatingServer
426d18b36aaad7da5f52258b66a91a3cfa05b676
147f0d012a5e06953de5f6210d710e0b9da2c8aa
refs/heads/master
2020-05-18T16:02:33.299000
2014-07-06T02:36:45
2014-07-06T02:36:45
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.ds.service; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import com.ds.BaseTester; /** * * @author hunglevn@outlook.com * */ public class UserServiceTester extends BaseTester { @Autowired IUserService userService; @Test public void testCreateAccount () { //userService.createUser("kevin@yahoo.com", "password"); } }
UTF-8
Java
385
java
UserServiceTester.java
Java
[ { "context": "red;\n\nimport com.ds.BaseTester;\n\n/**\n *\n * @author hunglevn@outlook.com\n *\n */\npublic class UserServiceTester extends Bas", "end": 177, "score": 0.9999256134033203, "start": 157, "tag": "EMAIL", "value": "hunglevn@outlook.com" }, { "context": "estCreateAccount () {\n\t\t//userService.createUser(\"kevin@yahoo.com\", \"password\");\n\t}\n}\n", "end": 364, "score": 0.999926745891571, "start": 349, "tag": "EMAIL", "value": "kevin@yahoo.com" }, { "context": " {\n\t\t//userService.createUser(\"kevin@yahoo.com\", \"password\");\n\t}\n}\n", "end": 376, "score": 0.9990666508674622, "start": 368, "tag": "PASSWORD", "value": "password" } ]
null
[]
package com.ds.service; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import com.ds.BaseTester; /** * * @author <EMAIL> * */ public class UserServiceTester extends BaseTester { @Autowired IUserService userService; @Test public void testCreateAccount () { //userService.createUser("<EMAIL>", "<PASSWORD>"); } }
366
0.745455
0.745455
21
17.333334
19.746811
62
false
false
0
0
0
0
0
0
0.714286
false
false
14
2b134515b2371aa3cff8c72ca5a6c2a31d84d575
30,382,598,655,968
d9522b68d25635677527143fbcfd438a7c4fbe80
/src/test/java/be/civadis/plamob/web/rest/MissionResourceIntTest.java
ac27c1eb10553f56ef2eae034edbcad2e403fcf3
[]
no_license
spirale-software/plamob
https://github.com/spirale-software/plamob
024c981be81e0c04ff3d3b000da291176b5ae347
c20ac8d098fc4edbe4f35cfcd6a9b898638013d1
refs/heads/master
2021-04-15T09:37:33.532000
2018-04-05T10:25:51
2018-04-05T10:25:51
126,456,155
0
1
null
false
2020-09-18T11:56:15
2018-03-23T08:33:31
2018-04-05T10:27:52
2018-04-05T10:27:51
671
0
1
1
Java
false
false
package be.civadis.plamob.web.rest; import be.civadis.plamob.PlamobApp; import be.civadis.plamob.domain.Mission; import be.civadis.plamob.repository.MissionRepository; import be.civadis.plamob.service.MissionService; import be.civadis.plamob.service.dto.MissionDTO; import be.civadis.plamob.service.mapper.MissionMapper; import be.civadis.plamob.web.rest.errors.ExceptionTranslator; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.MockitoAnnotations; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.data.web.PageableHandlerMethodArgumentResolver; import org.springframework.http.MediaType; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.transaction.annotation.Transactional; import javax.persistence.EntityManager; import java.util.List; import static be.civadis.plamob.web.rest.TestUtil.createFormattingConversionService; import static org.assertj.core.api.Assertions.assertThat; import static org.hamcrest.Matchers.hasItem; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; import be.civadis.plamob.domain.enumeration.ETAT_MISSION; /** * Test class for the MissionResource REST controller. * * @see MissionResource */ @RunWith(SpringRunner.class) @SpringBootTest(classes = PlamobApp.class) public class MissionResourceIntTest { private static final String DEFAULT_RESUME = "AAAAAAAAAA"; private static final String UPDATED_RESUME = "BBBBBBBBBB"; private static final String DEFAULT_OBJECTIF = "AAAAAAAAAA"; private static final String UPDATED_OBJECTIF = "BBBBBBBBBB"; private static final String DEFAULT_DELAI = "AAAAAAAAAA"; private static final String UPDATED_DELAI = "BBBBBBBBBB"; private static final String DEFAULT_TECHNOLOGIE = "AAAAAAAAAA"; private static final String UPDATED_TECHNOLOGIE = "BBBBBBBBBB"; private static final String DEFAULT_AUTRE = "AAAAAAAAAA"; private static final String UPDATED_AUTRE = "BBBBBBBBBB"; private static final ETAT_MISSION DEFAULT_ETAT = ETAT_MISSION.EN_ATTENTE; private static final ETAT_MISSION UPDATED_ETAT = ETAT_MISSION.EN_COURS; @Autowired private MissionRepository missionRepository; @Autowired private MissionMapper missionMapper; @Autowired private MissionService missionService; @Autowired private MappingJackson2HttpMessageConverter jacksonMessageConverter; @Autowired private PageableHandlerMethodArgumentResolver pageableArgumentResolver; @Autowired private ExceptionTranslator exceptionTranslator; @Autowired private EntityManager em; private MockMvc restMissionMockMvc; private Mission mission; @Before public void setup() { MockitoAnnotations.initMocks(this); final MissionResource missionResource = new MissionResource(missionService); this.restMissionMockMvc = MockMvcBuilders.standaloneSetup(missionResource) .setCustomArgumentResolvers(pageableArgumentResolver) .setControllerAdvice(exceptionTranslator) .setConversionService(createFormattingConversionService()) .setMessageConverters(jacksonMessageConverter).build(); } /** * Create an entity for this test. * * This is a static method, as tests for other entities might also need it, * if they test an entity which requires the current entity. */ public static Mission createEntity(EntityManager em) { Mission mission = new Mission() .resume(DEFAULT_RESUME) .objectif(DEFAULT_OBJECTIF) .delai(DEFAULT_DELAI) .technologie(DEFAULT_TECHNOLOGIE) .autre(DEFAULT_AUTRE) .etat(DEFAULT_ETAT); return mission; } @Before public void initTest() { mission = createEntity(em); } @Test @Transactional public void createMission() throws Exception { int databaseSizeBeforeCreate = missionRepository.findAll().size(); // Create the Mission MissionDTO missionDTO = missionMapper.toDto(mission); restMissionMockMvc.perform(post("/api/missions") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(missionDTO))) .andExpect(status().isCreated()); // Validate the Mission in the database List<Mission> missionList = missionRepository.findAll(); assertThat(missionList).hasSize(databaseSizeBeforeCreate + 1); Mission testMission = missionList.get(missionList.size() - 1); assertThat(testMission.getResume()).isEqualTo(DEFAULT_RESUME); assertThat(testMission.getObjectif()).isEqualTo(DEFAULT_OBJECTIF); assertThat(testMission.getDelai()).isEqualTo(DEFAULT_DELAI); assertThat(testMission.getTechnologie()).isEqualTo(DEFAULT_TECHNOLOGIE); assertThat(testMission.getAutre()).isEqualTo(DEFAULT_AUTRE); assertThat(testMission.getEtat()).isEqualTo(DEFAULT_ETAT); } @Test @Transactional public void createMissionWithExistingId() throws Exception { int databaseSizeBeforeCreate = missionRepository.findAll().size(); // Create the Mission with an existing ID mission.setId(1L); MissionDTO missionDTO = missionMapper.toDto(mission); // An entity with an existing ID cannot be created, so this API call must fail restMissionMockMvc.perform(post("/api/missions") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(missionDTO))) .andExpect(status().isBadRequest()); // Validate the Mission in the database List<Mission> missionList = missionRepository.findAll(); assertThat(missionList).hasSize(databaseSizeBeforeCreate); } @Test @Transactional public void getAllMissions() throws Exception { // Initialize the database missionRepository.saveAndFlush(mission); // Get all the missionList restMissionMockMvc.perform(get("/api/missions?sort=id,desc")) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) .andExpect(jsonPath("$.[*].id").value(hasItem(mission.getId().intValue()))) .andExpect(jsonPath("$.[*].resume").value(hasItem(DEFAULT_RESUME.toString()))) .andExpect(jsonPath("$.[*].objectif").value(hasItem(DEFAULT_OBJECTIF.toString()))) .andExpect(jsonPath("$.[*].delai").value(hasItem(DEFAULT_DELAI.toString()))) .andExpect(jsonPath("$.[*].technologie").value(hasItem(DEFAULT_TECHNOLOGIE.toString()))) .andExpect(jsonPath("$.[*].autre").value(hasItem(DEFAULT_AUTRE.toString()))) .andExpect(jsonPath("$.[*].etat").value(hasItem(DEFAULT_ETAT.toString()))); } @Test @Transactional public void getMission() throws Exception { // Initialize the database missionRepository.saveAndFlush(mission); // Get the mission restMissionMockMvc.perform(get("/api/missions/{id}", mission.getId())) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) .andExpect(jsonPath("$.id").value(mission.getId().intValue())) .andExpect(jsonPath("$.resume").value(DEFAULT_RESUME.toString())) .andExpect(jsonPath("$.objectif").value(DEFAULT_OBJECTIF.toString())) .andExpect(jsonPath("$.delai").value(DEFAULT_DELAI.toString())) .andExpect(jsonPath("$.technologie").value(DEFAULT_TECHNOLOGIE.toString())) .andExpect(jsonPath("$.autre").value(DEFAULT_AUTRE.toString())) .andExpect(jsonPath("$.etat").value(DEFAULT_ETAT.toString())); } @Test @Transactional public void getNonExistingMission() throws Exception { // Get the mission restMissionMockMvc.perform(get("/api/missions/{id}", Long.MAX_VALUE)) .andExpect(status().isNotFound()); } @Test @Transactional public void updateMission() throws Exception { // Initialize the database missionRepository.saveAndFlush(mission); int databaseSizeBeforeUpdate = missionRepository.findAll().size(); // Update the mission Mission updatedMission = missionRepository.findOne(mission.getId()); // Disconnect from session so that the updates on updatedMission are not directly saved in db em.detach(updatedMission); updatedMission .resume(UPDATED_RESUME) .objectif(UPDATED_OBJECTIF) .delai(UPDATED_DELAI) .technologie(UPDATED_TECHNOLOGIE) .autre(UPDATED_AUTRE) .etat(UPDATED_ETAT); MissionDTO missionDTO = missionMapper.toDto(updatedMission); restMissionMockMvc.perform(put("/api/missions") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(missionDTO))) .andExpect(status().isOk()); // Validate the Mission in the database List<Mission> missionList = missionRepository.findAll(); assertThat(missionList).hasSize(databaseSizeBeforeUpdate); Mission testMission = missionList.get(missionList.size() - 1); assertThat(testMission.getResume()).isEqualTo(UPDATED_RESUME); assertThat(testMission.getObjectif()).isEqualTo(UPDATED_OBJECTIF); assertThat(testMission.getDelai()).isEqualTo(UPDATED_DELAI); assertThat(testMission.getTechnologie()).isEqualTo(UPDATED_TECHNOLOGIE); assertThat(testMission.getAutre()).isEqualTo(UPDATED_AUTRE); assertThat(testMission.getEtat()).isEqualTo(UPDATED_ETAT); } @Test @Transactional public void updateNonExistingMission() throws Exception { int databaseSizeBeforeUpdate = missionRepository.findAll().size(); // Create the Mission MissionDTO missionDTO = missionMapper.toDto(mission); // If the entity doesn't have an ID, it will be created instead of just being updated restMissionMockMvc.perform(put("/api/missions") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(missionDTO))) .andExpect(status().isCreated()); // Validate the Mission in the database List<Mission> missionList = missionRepository.findAll(); assertThat(missionList).hasSize(databaseSizeBeforeUpdate + 1); } @Test @Transactional public void deleteMission() throws Exception { // Initialize the database missionRepository.saveAndFlush(mission); int databaseSizeBeforeDelete = missionRepository.findAll().size(); // Get the mission restMissionMockMvc.perform(delete("/api/missions/{id}", mission.getId()) .accept(TestUtil.APPLICATION_JSON_UTF8)) .andExpect(status().isOk()); // Validate the database is empty List<Mission> missionList = missionRepository.findAll(); assertThat(missionList).hasSize(databaseSizeBeforeDelete - 1); } @Test @Transactional public void equalsVerifier() throws Exception { TestUtil.equalsVerifier(Mission.class); Mission mission1 = new Mission(); mission1.setId(1L); Mission mission2 = new Mission(); mission2.setId(mission1.getId()); assertThat(mission1).isEqualTo(mission2); mission2.setId(2L); assertThat(mission1).isNotEqualTo(mission2); mission1.setId(null); assertThat(mission1).isNotEqualTo(mission2); } @Test @Transactional public void dtoEqualsVerifier() throws Exception { TestUtil.equalsVerifier(MissionDTO.class); MissionDTO missionDTO1 = new MissionDTO(); missionDTO1.setId(1L); MissionDTO missionDTO2 = new MissionDTO(); assertThat(missionDTO1).isNotEqualTo(missionDTO2); missionDTO2.setId(missionDTO1.getId()); assertThat(missionDTO1).isEqualTo(missionDTO2); missionDTO2.setId(2L); assertThat(missionDTO1).isNotEqualTo(missionDTO2); missionDTO1.setId(null); assertThat(missionDTO1).isNotEqualTo(missionDTO2); } @Test @Transactional public void testEntityFromId() { assertThat(missionMapper.fromId(42L).getId()).isEqualTo(42); assertThat(missionMapper.fromId(null)).isNull(); } }
UTF-8
Java
12,937
java
MissionResourceIntTest.java
Java
[]
null
[]
package be.civadis.plamob.web.rest; import be.civadis.plamob.PlamobApp; import be.civadis.plamob.domain.Mission; import be.civadis.plamob.repository.MissionRepository; import be.civadis.plamob.service.MissionService; import be.civadis.plamob.service.dto.MissionDTO; import be.civadis.plamob.service.mapper.MissionMapper; import be.civadis.plamob.web.rest.errors.ExceptionTranslator; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.MockitoAnnotations; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.data.web.PageableHandlerMethodArgumentResolver; import org.springframework.http.MediaType; import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; import org.springframework.test.context.junit4.SpringRunner; import org.springframework.test.web.servlet.MockMvc; import org.springframework.test.web.servlet.setup.MockMvcBuilders; import org.springframework.transaction.annotation.Transactional; import javax.persistence.EntityManager; import java.util.List; import static be.civadis.plamob.web.rest.TestUtil.createFormattingConversionService; import static org.assertj.core.api.Assertions.assertThat; import static org.hamcrest.Matchers.hasItem; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*; import be.civadis.plamob.domain.enumeration.ETAT_MISSION; /** * Test class for the MissionResource REST controller. * * @see MissionResource */ @RunWith(SpringRunner.class) @SpringBootTest(classes = PlamobApp.class) public class MissionResourceIntTest { private static final String DEFAULT_RESUME = "AAAAAAAAAA"; private static final String UPDATED_RESUME = "BBBBBBBBBB"; private static final String DEFAULT_OBJECTIF = "AAAAAAAAAA"; private static final String UPDATED_OBJECTIF = "BBBBBBBBBB"; private static final String DEFAULT_DELAI = "AAAAAAAAAA"; private static final String UPDATED_DELAI = "BBBBBBBBBB"; private static final String DEFAULT_TECHNOLOGIE = "AAAAAAAAAA"; private static final String UPDATED_TECHNOLOGIE = "BBBBBBBBBB"; private static final String DEFAULT_AUTRE = "AAAAAAAAAA"; private static final String UPDATED_AUTRE = "BBBBBBBBBB"; private static final ETAT_MISSION DEFAULT_ETAT = ETAT_MISSION.EN_ATTENTE; private static final ETAT_MISSION UPDATED_ETAT = ETAT_MISSION.EN_COURS; @Autowired private MissionRepository missionRepository; @Autowired private MissionMapper missionMapper; @Autowired private MissionService missionService; @Autowired private MappingJackson2HttpMessageConverter jacksonMessageConverter; @Autowired private PageableHandlerMethodArgumentResolver pageableArgumentResolver; @Autowired private ExceptionTranslator exceptionTranslator; @Autowired private EntityManager em; private MockMvc restMissionMockMvc; private Mission mission; @Before public void setup() { MockitoAnnotations.initMocks(this); final MissionResource missionResource = new MissionResource(missionService); this.restMissionMockMvc = MockMvcBuilders.standaloneSetup(missionResource) .setCustomArgumentResolvers(pageableArgumentResolver) .setControllerAdvice(exceptionTranslator) .setConversionService(createFormattingConversionService()) .setMessageConverters(jacksonMessageConverter).build(); } /** * Create an entity for this test. * * This is a static method, as tests for other entities might also need it, * if they test an entity which requires the current entity. */ public static Mission createEntity(EntityManager em) { Mission mission = new Mission() .resume(DEFAULT_RESUME) .objectif(DEFAULT_OBJECTIF) .delai(DEFAULT_DELAI) .technologie(DEFAULT_TECHNOLOGIE) .autre(DEFAULT_AUTRE) .etat(DEFAULT_ETAT); return mission; } @Before public void initTest() { mission = createEntity(em); } @Test @Transactional public void createMission() throws Exception { int databaseSizeBeforeCreate = missionRepository.findAll().size(); // Create the Mission MissionDTO missionDTO = missionMapper.toDto(mission); restMissionMockMvc.perform(post("/api/missions") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(missionDTO))) .andExpect(status().isCreated()); // Validate the Mission in the database List<Mission> missionList = missionRepository.findAll(); assertThat(missionList).hasSize(databaseSizeBeforeCreate + 1); Mission testMission = missionList.get(missionList.size() - 1); assertThat(testMission.getResume()).isEqualTo(DEFAULT_RESUME); assertThat(testMission.getObjectif()).isEqualTo(DEFAULT_OBJECTIF); assertThat(testMission.getDelai()).isEqualTo(DEFAULT_DELAI); assertThat(testMission.getTechnologie()).isEqualTo(DEFAULT_TECHNOLOGIE); assertThat(testMission.getAutre()).isEqualTo(DEFAULT_AUTRE); assertThat(testMission.getEtat()).isEqualTo(DEFAULT_ETAT); } @Test @Transactional public void createMissionWithExistingId() throws Exception { int databaseSizeBeforeCreate = missionRepository.findAll().size(); // Create the Mission with an existing ID mission.setId(1L); MissionDTO missionDTO = missionMapper.toDto(mission); // An entity with an existing ID cannot be created, so this API call must fail restMissionMockMvc.perform(post("/api/missions") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(missionDTO))) .andExpect(status().isBadRequest()); // Validate the Mission in the database List<Mission> missionList = missionRepository.findAll(); assertThat(missionList).hasSize(databaseSizeBeforeCreate); } @Test @Transactional public void getAllMissions() throws Exception { // Initialize the database missionRepository.saveAndFlush(mission); // Get all the missionList restMissionMockMvc.perform(get("/api/missions?sort=id,desc")) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) .andExpect(jsonPath("$.[*].id").value(hasItem(mission.getId().intValue()))) .andExpect(jsonPath("$.[*].resume").value(hasItem(DEFAULT_RESUME.toString()))) .andExpect(jsonPath("$.[*].objectif").value(hasItem(DEFAULT_OBJECTIF.toString()))) .andExpect(jsonPath("$.[*].delai").value(hasItem(DEFAULT_DELAI.toString()))) .andExpect(jsonPath("$.[*].technologie").value(hasItem(DEFAULT_TECHNOLOGIE.toString()))) .andExpect(jsonPath("$.[*].autre").value(hasItem(DEFAULT_AUTRE.toString()))) .andExpect(jsonPath("$.[*].etat").value(hasItem(DEFAULT_ETAT.toString()))); } @Test @Transactional public void getMission() throws Exception { // Initialize the database missionRepository.saveAndFlush(mission); // Get the mission restMissionMockMvc.perform(get("/api/missions/{id}", mission.getId())) .andExpect(status().isOk()) .andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8_VALUE)) .andExpect(jsonPath("$.id").value(mission.getId().intValue())) .andExpect(jsonPath("$.resume").value(DEFAULT_RESUME.toString())) .andExpect(jsonPath("$.objectif").value(DEFAULT_OBJECTIF.toString())) .andExpect(jsonPath("$.delai").value(DEFAULT_DELAI.toString())) .andExpect(jsonPath("$.technologie").value(DEFAULT_TECHNOLOGIE.toString())) .andExpect(jsonPath("$.autre").value(DEFAULT_AUTRE.toString())) .andExpect(jsonPath("$.etat").value(DEFAULT_ETAT.toString())); } @Test @Transactional public void getNonExistingMission() throws Exception { // Get the mission restMissionMockMvc.perform(get("/api/missions/{id}", Long.MAX_VALUE)) .andExpect(status().isNotFound()); } @Test @Transactional public void updateMission() throws Exception { // Initialize the database missionRepository.saveAndFlush(mission); int databaseSizeBeforeUpdate = missionRepository.findAll().size(); // Update the mission Mission updatedMission = missionRepository.findOne(mission.getId()); // Disconnect from session so that the updates on updatedMission are not directly saved in db em.detach(updatedMission); updatedMission .resume(UPDATED_RESUME) .objectif(UPDATED_OBJECTIF) .delai(UPDATED_DELAI) .technologie(UPDATED_TECHNOLOGIE) .autre(UPDATED_AUTRE) .etat(UPDATED_ETAT); MissionDTO missionDTO = missionMapper.toDto(updatedMission); restMissionMockMvc.perform(put("/api/missions") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(missionDTO))) .andExpect(status().isOk()); // Validate the Mission in the database List<Mission> missionList = missionRepository.findAll(); assertThat(missionList).hasSize(databaseSizeBeforeUpdate); Mission testMission = missionList.get(missionList.size() - 1); assertThat(testMission.getResume()).isEqualTo(UPDATED_RESUME); assertThat(testMission.getObjectif()).isEqualTo(UPDATED_OBJECTIF); assertThat(testMission.getDelai()).isEqualTo(UPDATED_DELAI); assertThat(testMission.getTechnologie()).isEqualTo(UPDATED_TECHNOLOGIE); assertThat(testMission.getAutre()).isEqualTo(UPDATED_AUTRE); assertThat(testMission.getEtat()).isEqualTo(UPDATED_ETAT); } @Test @Transactional public void updateNonExistingMission() throws Exception { int databaseSizeBeforeUpdate = missionRepository.findAll().size(); // Create the Mission MissionDTO missionDTO = missionMapper.toDto(mission); // If the entity doesn't have an ID, it will be created instead of just being updated restMissionMockMvc.perform(put("/api/missions") .contentType(TestUtil.APPLICATION_JSON_UTF8) .content(TestUtil.convertObjectToJsonBytes(missionDTO))) .andExpect(status().isCreated()); // Validate the Mission in the database List<Mission> missionList = missionRepository.findAll(); assertThat(missionList).hasSize(databaseSizeBeforeUpdate + 1); } @Test @Transactional public void deleteMission() throws Exception { // Initialize the database missionRepository.saveAndFlush(mission); int databaseSizeBeforeDelete = missionRepository.findAll().size(); // Get the mission restMissionMockMvc.perform(delete("/api/missions/{id}", mission.getId()) .accept(TestUtil.APPLICATION_JSON_UTF8)) .andExpect(status().isOk()); // Validate the database is empty List<Mission> missionList = missionRepository.findAll(); assertThat(missionList).hasSize(databaseSizeBeforeDelete - 1); } @Test @Transactional public void equalsVerifier() throws Exception { TestUtil.equalsVerifier(Mission.class); Mission mission1 = new Mission(); mission1.setId(1L); Mission mission2 = new Mission(); mission2.setId(mission1.getId()); assertThat(mission1).isEqualTo(mission2); mission2.setId(2L); assertThat(mission1).isNotEqualTo(mission2); mission1.setId(null); assertThat(mission1).isNotEqualTo(mission2); } @Test @Transactional public void dtoEqualsVerifier() throws Exception { TestUtil.equalsVerifier(MissionDTO.class); MissionDTO missionDTO1 = new MissionDTO(); missionDTO1.setId(1L); MissionDTO missionDTO2 = new MissionDTO(); assertThat(missionDTO1).isNotEqualTo(missionDTO2); missionDTO2.setId(missionDTO1.getId()); assertThat(missionDTO1).isEqualTo(missionDTO2); missionDTO2.setId(2L); assertThat(missionDTO1).isNotEqualTo(missionDTO2); missionDTO1.setId(null); assertThat(missionDTO1).isNotEqualTo(missionDTO2); } @Test @Transactional public void testEntityFromId() { assertThat(missionMapper.fromId(42L).getId()).isEqualTo(42); assertThat(missionMapper.fromId(null)).isNull(); } }
12,937
0.697843
0.693824
321
39.302181
28.034119
101
false
false
0
0
0
0
0
0
0.423676
false
false
14
ac69aa33b51362630c420adbd06a85323e5e515d
1,168,231,165,433
0fb9e65d561000bc364dc539c9d07a5a875a1057
/RINSEG/app/src/main/java/rinseg/asistp/com/ui/activities/ActivityFotoComentario.java
11ccb67d41d34682d1829456dadc5b8ac7d3f786
[]
no_license
carlosramosasis/rinseg_prueba
https://github.com/carlosramosasis/rinseg_prueba
6c0013664770f6ca98354cb6301dc33cf71be368
ebe0dc5500c8471487a4dac17b6f5fdc0d80f2b4
refs/heads/master
2021-01-13T03:09:20.332000
2016-12-26T21:55:10
2016-12-26T21:55:10
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package rinseg.asistp.com.ui.activities; import android.graphics.Bitmap; import android.net.Uri; import android.os.Bundle; import android.provider.MediaStore; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.View; import android.widget.EditText; import android.widget.ImageButton; import android.widget.ImageView; import java.io.IOException; import io.realm.Realm; import io.realm.RealmConfiguration; import rinseg.asistp.com.models.FotoModel; import rinseg.asistp.com.models.ImagenRO; import rinseg.asistp.com.models.ROP; import rinseg.asistp.com.rinseg.R; import rinseg.asistp.com.utils.Constants; import rinseg.asistp.com.utils.Generic; import rinseg.asistp.com.utils.Messages; import rinseg.asistp.com.utils.RinsegModule; public class ActivityFotoComentario extends AppCompatActivity { public Toolbar toolbarFotoComentario; public ImageView imageFoto; public EditText txtComentario; private ActivityFotoComentario thiss = (ActivityFotoComentario) this; private FotoModel fotoModel; Bitmap bitmap; ImageView imageView; ImageButton btnGuardar; ROP mRop; ImagenRO imagenRO; String tmpIdRop = null; RealmConfiguration myConfig; View rootLayout; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_foto_comentario); if (savedInstanceState == null) { Bundle extras = getIntent().getExtras(); if (extras != null) { fotoModel = (FotoModel) extras.getSerializable("imagen_rop"); tmpIdRop = extras.getString("ROPtmpId", null); } } setUpElements(); LoadRopPendiente(); MostrarImagen(); setUpActions(); } @Override protected void onResume() { super.onResume(); toolbarFotoComentario.setTitle(R.string.title_add_imagen); txtComentario.clearFocus(); } //Proceso para cargar las vistas private void setUpElements() { rootLayout = findViewById(R.id.coordinator_foto_comentario); toolbarFotoComentario = (Toolbar) findViewById(R.id.toolbarFotoComentario); toolbarFotoComentario.setNavigationIcon(R.drawable.ic_arrow_left); imageFoto = (ImageView) findViewById(R.id.image_foto_comentario); txtComentario = (EditText) findViewById(R.id.txt_comentario); imageView = (ImageView) findViewById(R.id.image_foto_comentario); btnGuardar = (ImageButton) findViewById(R.id.btn_guardar_foto_comentario); //configuramos Realm Realm.init(this.getApplicationContext()); myConfig = new RealmConfiguration.Builder() .name("rinseg.realm") .schemaVersion(2) .modules(new RinsegModule()) .deleteRealmIfMigrationNeeded() .build(); } //cargamos los eventos private void setUpActions() { toolbarFotoComentario.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { thiss.finish(); } }); btnGuardar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if(txtComentario.getText().toString().trim().length() == 0){ Messages.showToast(rootLayout, getString(R.string.error_comentario)); return; } SaveImagenComentario(); } }); } public void replaceFragment(Fragment fragment, boolean addToBackStack, int animIdIn1, int animIdOut1, int animIdIn2, int animIdOut2) { FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); String tag = fragment.getClass().getSimpleName(); tag = "Tag_" + tag; transaction.setCustomAnimations(animIdIn1, animIdOut1, animIdIn2, animIdOut2); transaction.replace(R.id.frame_main_content_inspeccion_detalle, fragment, tag); if (addToBackStack) transaction.addToBackStack(null); transaction.commit(); } private void MostrarImagen() { if (fotoModel.uri != null) { Uri uri = fotoModel.uri; try { bitmap = MediaStore.Images.Media.getBitmap(this.getContentResolver(), uri); imageView.setImageBitmap(bitmap); } catch (IOException e) { e.printStackTrace(); } } } private void LoadRopPendiente() { //ROP tmpRop = new ROP(); if (tmpIdRop != null) { final Realm realm = Realm.getInstance(myConfig); try { mRop = realm.where(ROP.class).equalTo("tmpId", tmpIdRop).findFirst(); if (mRop == null) { return; } } catch (Exception e) { e.printStackTrace(); } finally { realm.close(); } } } private void SaveImagenComentario() { String nombreImagen = Generic.randomString(Constants.CHARSET_AZ_09, Constants.LEN_IMAGEN); Boolean result = Generic.GuardarImagenCarpeta(this.getApplicationContext(), mRop.getTmpId(), bitmap, nombreImagen); if (result) { Realm realm = Realm.getInstance(myConfig); try { realm.beginTransaction(); imagenRO = realm.createObject(ImagenRO.class); imagenRO.setName(nombreImagen +".jpg"); imagenRO.setDescripcion(txtComentario.getText().toString().trim()); mRop.listaImgComent.add(imagenRO); realm.commitTransaction(); Messages.showToast(rootLayout, getString(R.string.guardo_ok)); this.finish(); } catch (Exception e) { e.printStackTrace(); Messages.showToast(rootLayout, getString(R.string.guardo_error)); } finally { realm.close(); } } else { Messages.showToast(rootLayout, getString(R.string.guardo_error)); } } }
UTF-8
Java
6,500
java
ActivityFotoComentario.java
Java
[]
null
[]
package rinseg.asistp.com.ui.activities; import android.graphics.Bitmap; import android.net.Uri; import android.os.Bundle; import android.provider.MediaStore; import android.support.v4.app.Fragment; import android.support.v4.app.FragmentTransaction; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.View; import android.widget.EditText; import android.widget.ImageButton; import android.widget.ImageView; import java.io.IOException; import io.realm.Realm; import io.realm.RealmConfiguration; import rinseg.asistp.com.models.FotoModel; import rinseg.asistp.com.models.ImagenRO; import rinseg.asistp.com.models.ROP; import rinseg.asistp.com.rinseg.R; import rinseg.asistp.com.utils.Constants; import rinseg.asistp.com.utils.Generic; import rinseg.asistp.com.utils.Messages; import rinseg.asistp.com.utils.RinsegModule; public class ActivityFotoComentario extends AppCompatActivity { public Toolbar toolbarFotoComentario; public ImageView imageFoto; public EditText txtComentario; private ActivityFotoComentario thiss = (ActivityFotoComentario) this; private FotoModel fotoModel; Bitmap bitmap; ImageView imageView; ImageButton btnGuardar; ROP mRop; ImagenRO imagenRO; String tmpIdRop = null; RealmConfiguration myConfig; View rootLayout; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_foto_comentario); if (savedInstanceState == null) { Bundle extras = getIntent().getExtras(); if (extras != null) { fotoModel = (FotoModel) extras.getSerializable("imagen_rop"); tmpIdRop = extras.getString("ROPtmpId", null); } } setUpElements(); LoadRopPendiente(); MostrarImagen(); setUpActions(); } @Override protected void onResume() { super.onResume(); toolbarFotoComentario.setTitle(R.string.title_add_imagen); txtComentario.clearFocus(); } //Proceso para cargar las vistas private void setUpElements() { rootLayout = findViewById(R.id.coordinator_foto_comentario); toolbarFotoComentario = (Toolbar) findViewById(R.id.toolbarFotoComentario); toolbarFotoComentario.setNavigationIcon(R.drawable.ic_arrow_left); imageFoto = (ImageView) findViewById(R.id.image_foto_comentario); txtComentario = (EditText) findViewById(R.id.txt_comentario); imageView = (ImageView) findViewById(R.id.image_foto_comentario); btnGuardar = (ImageButton) findViewById(R.id.btn_guardar_foto_comentario); //configuramos Realm Realm.init(this.getApplicationContext()); myConfig = new RealmConfiguration.Builder() .name("rinseg.realm") .schemaVersion(2) .modules(new RinsegModule()) .deleteRealmIfMigrationNeeded() .build(); } //cargamos los eventos private void setUpActions() { toolbarFotoComentario.setNavigationOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { thiss.finish(); } }); btnGuardar.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if(txtComentario.getText().toString().trim().length() == 0){ Messages.showToast(rootLayout, getString(R.string.error_comentario)); return; } SaveImagenComentario(); } }); } public void replaceFragment(Fragment fragment, boolean addToBackStack, int animIdIn1, int animIdOut1, int animIdIn2, int animIdOut2) { FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); String tag = fragment.getClass().getSimpleName(); tag = "Tag_" + tag; transaction.setCustomAnimations(animIdIn1, animIdOut1, animIdIn2, animIdOut2); transaction.replace(R.id.frame_main_content_inspeccion_detalle, fragment, tag); if (addToBackStack) transaction.addToBackStack(null); transaction.commit(); } private void MostrarImagen() { if (fotoModel.uri != null) { Uri uri = fotoModel.uri; try { bitmap = MediaStore.Images.Media.getBitmap(this.getContentResolver(), uri); imageView.setImageBitmap(bitmap); } catch (IOException e) { e.printStackTrace(); } } } private void LoadRopPendiente() { //ROP tmpRop = new ROP(); if (tmpIdRop != null) { final Realm realm = Realm.getInstance(myConfig); try { mRop = realm.where(ROP.class).equalTo("tmpId", tmpIdRop).findFirst(); if (mRop == null) { return; } } catch (Exception e) { e.printStackTrace(); } finally { realm.close(); } } } private void SaveImagenComentario() { String nombreImagen = Generic.randomString(Constants.CHARSET_AZ_09, Constants.LEN_IMAGEN); Boolean result = Generic.GuardarImagenCarpeta(this.getApplicationContext(), mRop.getTmpId(), bitmap, nombreImagen); if (result) { Realm realm = Realm.getInstance(myConfig); try { realm.beginTransaction(); imagenRO = realm.createObject(ImagenRO.class); imagenRO.setName(nombreImagen +".jpg"); imagenRO.setDescripcion(txtComentario.getText().toString().trim()); mRop.listaImgComent.add(imagenRO); realm.commitTransaction(); Messages.showToast(rootLayout, getString(R.string.guardo_ok)); this.finish(); } catch (Exception e) { e.printStackTrace(); Messages.showToast(rootLayout, getString(R.string.guardo_error)); } finally { realm.close(); } } else { Messages.showToast(rootLayout, getString(R.string.guardo_error)); } } }
6,500
0.613231
0.610769
194
32.505154
25.654373
123
false
false
0
0
0
0
0
0
0.603093
false
false
14
c91f2759d4ae7471a27116a82510b5abe30526b5
18,227,841,238,751
20d7841da2cc433277ded4543052d0ce021b36ff
/Zadanie 8 - koniec/src/Zadanie8.java
f7609af39afac742a4a2cc06c4af50fb30e95896
[]
no_license
P-Pinker/Java-exercises-algorithms-tasks
https://github.com/P-Pinker/Java-exercises-algorithms-tasks
fac3b12473c0fa0bd9b471ff264ce59b350e6bea
11c43b30dbfa099bfd26bf760b3ae5f9461b1582
refs/heads/master
2020-03-25T23:29:55.049000
2018-08-13T14:13:40
2018-08-13T14:13:40
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class Zadanie8<T> { public T item; public Zadanie8(T item) { this.item = item; } public Class getType () { return item.getClass(); } public static void main(String[] args) { Zadanie8<String> object1 = new Zadanie8<>("string"); System.out.println(object1.getType()); Zadanie8<Integer> object2 = new Zadanie8<>(123); System.out.println(object2.getType()); } }
UTF-8
Java
449
java
Zadanie8.java
Java
[]
null
[]
public class Zadanie8<T> { public T item; public Zadanie8(T item) { this.item = item; } public Class getType () { return item.getClass(); } public static void main(String[] args) { Zadanie8<String> object1 = new Zadanie8<>("string"); System.out.println(object1.getType()); Zadanie8<Integer> object2 = new Zadanie8<>(123); System.out.println(object2.getType()); } }
449
0.583519
0.554566
23
18.52174
20.170727
60
false
false
0
0
0
0
0
0
0.304348
false
false
14
bd6481a502eb446bf169737789f8b0e3aca7f5cf
20,117,626,861,215
035142e5cbe4a600e12734ab3d6f892f0e5eff34
/app/src/main/java/com/example/inloc/RestaurantParisDetails.java
ac6e3fac407f90622ecab798dc3ff9208a86cd90
[]
no_license
InLocTeam/InLoc-Final
https://github.com/InLocTeam/InLoc-Final
4fe3e0db1dfe26680690fd3bbc7b9fbd745c939f
1f744b5b32e65bac12817799dc42b5bd92207b18
refs/heads/master
2021-01-22T00:51:51.586000
2016-03-23T22:05:37
2016-03-23T22:05:37
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.inloc; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.ArrayAdapter; import android.widget.ListView; public class RestaurantParisDetails extends AppCompatActivity { double [] Restaurantstars = {5, 4.2, 4}; //Defines array with current amount of visitors for each double estimatedSebstars = Restaurantstars[0]*1; //Estimated futur amount calculated based on evolution between 2011 and 2014 double estimatedCobeaStars= Restaurantstars[1]*1.04; //Estimated futur amount calculated based on evolution between 2011 and 2014 double estimatedSixiemStars = Restaurantstars[2]*1.04; //Estimated futur amount calculated based on evolution between 2011 and 2014 double c1= (double) estimatedSebstars; //Converts the doubles defined previously into integers double c2 = (double) estimatedCobeaStars; double c3 = (double) estimatedSixiemStars; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_landmarks_paris_details); //Defines the array at the far left of the screen String [] DetailRestaurant = {"\n\n\n\n","Seb'on", "Cobea", "Le Sixieme Sens" }; //Convert integers to string so they can be displayed as strings in the listview String man2= Double.toString(c1); String man3= Double.toString(c2); String man4= Double.toString(c3); //Convert integers to string so they can be displayed as strings in the listview String in1 = Double.toString(Restaurantstars[0]); String in2 = Double.toString(Restaurantstars[1]); String in3 = Double.toString(Restaurantstars[2]); //Defines the array at the far right of the screen String [] IN = {"Current amount of stars (2016) \n",in1, in2, in3 }; //Defines the array on the middle of the screen String [] man = {"Predicted amount of stars (2017) \n",man2, man3, man4 }; //Links the array defined earlier to a listview displayed on the screen ListView listView1 = (ListView) findViewById(R.id.listView1); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, IN); listView1.setAdapter(adapter); //Links the array defined earlier to a listview displayed on the screen ListView listView2 = (ListView) findViewById(R.id.listView2); ArrayAdapter<String> predicted = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, man); listView2.setAdapter(predicted); String [] Ranking = {"\n\n\n ","Tour Eiffeil", "Musee du Louvres", "Notre Dame" }; //Sort array of integers and Strings by Alphabetical order for the landmarks displayed Double [] Estimatedresults = {c1,c2,c3}; for(int i=0;i<DetailRestaurant.length;i++) { for(int j=i+1;j<DetailRestaurant.length;j++) { if(DetailRestaurant[j].compareTo(DetailRestaurant[i])<0) { String temp = DetailRestaurant[j]; DetailRestaurant[j]=DetailRestaurant[i]; DetailRestaurant[i]=temp; String caca1 = Double.toString(Estimatedresults[0]); String caca2 = Double.toString(Estimatedresults[1]); String caca3 = Double.toString(Estimatedresults[2]); String [] CACA = {caca1,caca2,caca3 }; ListView listView3 = (ListView) findViewById(R.id.listView3); ArrayAdapter<String> sorted = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, DetailRestaurant); listView3.setAdapter(sorted); } } } } }
UTF-8
Java
3,976
java
RestaurantParisDetails.java
Java
[]
null
[]
package com.example.inloc; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.widget.ArrayAdapter; import android.widget.ListView; public class RestaurantParisDetails extends AppCompatActivity { double [] Restaurantstars = {5, 4.2, 4}; //Defines array with current amount of visitors for each double estimatedSebstars = Restaurantstars[0]*1; //Estimated futur amount calculated based on evolution between 2011 and 2014 double estimatedCobeaStars= Restaurantstars[1]*1.04; //Estimated futur amount calculated based on evolution between 2011 and 2014 double estimatedSixiemStars = Restaurantstars[2]*1.04; //Estimated futur amount calculated based on evolution between 2011 and 2014 double c1= (double) estimatedSebstars; //Converts the doubles defined previously into integers double c2 = (double) estimatedCobeaStars; double c3 = (double) estimatedSixiemStars; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_landmarks_paris_details); //Defines the array at the far left of the screen String [] DetailRestaurant = {"\n\n\n\n","Seb'on", "Cobea", "Le Sixieme Sens" }; //Convert integers to string so they can be displayed as strings in the listview String man2= Double.toString(c1); String man3= Double.toString(c2); String man4= Double.toString(c3); //Convert integers to string so they can be displayed as strings in the listview String in1 = Double.toString(Restaurantstars[0]); String in2 = Double.toString(Restaurantstars[1]); String in3 = Double.toString(Restaurantstars[2]); //Defines the array at the far right of the screen String [] IN = {"Current amount of stars (2016) \n",in1, in2, in3 }; //Defines the array on the middle of the screen String [] man = {"Predicted amount of stars (2017) \n",man2, man3, man4 }; //Links the array defined earlier to a listview displayed on the screen ListView listView1 = (ListView) findViewById(R.id.listView1); ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, IN); listView1.setAdapter(adapter); //Links the array defined earlier to a listview displayed on the screen ListView listView2 = (ListView) findViewById(R.id.listView2); ArrayAdapter<String> predicted = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, man); listView2.setAdapter(predicted); String [] Ranking = {"\n\n\n ","Tour Eiffeil", "Musee du Louvres", "Notre Dame" }; //Sort array of integers and Strings by Alphabetical order for the landmarks displayed Double [] Estimatedresults = {c1,c2,c3}; for(int i=0;i<DetailRestaurant.length;i++) { for(int j=i+1;j<DetailRestaurant.length;j++) { if(DetailRestaurant[j].compareTo(DetailRestaurant[i])<0) { String temp = DetailRestaurant[j]; DetailRestaurant[j]=DetailRestaurant[i]; DetailRestaurant[i]=temp; String caca1 = Double.toString(Estimatedresults[0]); String caca2 = Double.toString(Estimatedresults[1]); String caca3 = Double.toString(Estimatedresults[2]); String [] CACA = {caca1,caca2,caca3 }; ListView listView3 = (ListView) findViewById(R.id.listView3); ArrayAdapter<String> sorted = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, DetailRestaurant); listView3.setAdapter(sorted); } } } } }
3,976
0.639839
0.615946
123
31.235773
36.215721
137
false
false
0
0
0
0
0
0
0.560976
false
false
14
4a8e51808001b4b9daf302049cfd4e1819f23c17
14,809,047,261,926
d78e6edd46bbe6efd159475951205c41921b77e6
/src/cn/edu/web/filter/AA.java
73bb2e4fb1efd1cee1124a8fbdaf79e64b20b1bc
[]
no_license
liujianliang150/BD25
https://github.com/liujianliang150/BD25
d0290a923d9eea12a8ef171c8f2d0098ec3a00af
578dce1a21e65379ed2af3cbfae8d6a3aeefcbf1
refs/heads/master
2020-08-30T16:11:31.131000
2019-10-30T04:14:04
2019-10-30T04:14:04
218,429,593
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package cn.edu.web.filter; /** * <p>Description: </p> * <p>Copyright: Copyright (c) 2018</p> * <p>Company: www.ycyy.com</p> * * @author jillion * @version 1.0 * @date 2019/10/30 */ public class AA { }
UTF-8
Java
210
java
AA.java
Java
[ { "context": "</p>\n * <p>Company: www.ycyy.com</p>\n *\n * @author jillion\n * @version 1.0\n * @date 2019/10/30\n */\npublic cl", "end": 149, "score": 0.9996305704116821, "start": 142, "tag": "USERNAME", "value": "jillion" } ]
null
[]
package cn.edu.web.filter; /** * <p>Description: </p> * <p>Copyright: Copyright (c) 2018</p> * <p>Company: www.ycyy.com</p> * * @author jillion * @version 1.0 * @date 2019/10/30 */ public class AA { }
210
0.595238
0.528571
13
15.153846
12.164553
39
false
false
0
0
0
0
0
0
0.076923
false
false
14
5b9540d3d243365763399d0fcba01fcaf9d66a5b
14,809,047,262,279
b28e290adb8e3c2a5c7feb10f62aa265a7a1de90
/src/com/arkansascodingacademy/Dime.java
eaaa8ce320566f924ab3ef539510574302db4bee
[]
no_license
sabrinarunge/CoinCollection2018
https://github.com/sabrinarunge/CoinCollection2018
530d81d42fed747ecb76cfb25628aeb16700970f
a878b32b76a3611e905bcfce0384bfbfd094055e
refs/heads/master
2020-03-26T21:59:56.311000
2018-08-20T21:24:11
2018-08-20T21:24:11
145,424,324
0
0
null
true
2018-08-20T13:53:40
2018-08-20T13:53:39
2018-05-09T14:42:56
2018-02-09T16:49:21
1
0
0
0
null
false
null
package com.arkansascodingacademy; import java.math.BigDecimal; public class Dime { private int year; //initialize the year variable public Dime(int year) { this.year = year; } public BigDecimal getFaceValue() //return the face value of one dime { return new BigDecimal("0.10"); } public BigDecimal getCollectibleValue() //return the collectible value of one dime { return getFaceValue(); } }
UTF-8
Java
479
java
Dime.java
Java
[]
null
[]
package com.arkansascodingacademy; import java.math.BigDecimal; public class Dime { private int year; //initialize the year variable public Dime(int year) { this.year = year; } public BigDecimal getFaceValue() //return the face value of one dime { return new BigDecimal("0.10"); } public BigDecimal getCollectibleValue() //return the collectible value of one dime { return getFaceValue(); } }
479
0.63048
0.624217
23
19.826086
25.228783
90
false
false
0
0
0
0
0
0
0.26087
false
false
14
5ace8f87c0981c950efdcdf2e1c95e0d80549c79
3,212,635,581,722
ceefea8029098d396ce7c0b49ee2225f92917fef
/src/main/scala/com/tencent/client/plasma/exceptions/PlasmaClientException.java
a95125011032c7a800b5f7cfbc3cfdcb63f07646
[ "Apache-2.0" ]
permissive
wangcaihua/PyAngelPS
https://github.com/wangcaihua/PyAngelPS
9bb7511ebea928d11b337d61724b725076eb153d
828fb37258447c439b9e1f8e356b6b1b065ff2f5
refs/heads/master
2020-07-23T05:21:20.949000
2019-09-10T03:23:45
2019-09-10T03:23:45
207,456,695
1
0
Apache-2.0
true
2019-09-10T03:24:37
2019-09-10T03:24:34
2019-09-10T03:23:49
2019-09-10T03:23:46
174
0
0
0
null
false
false
package com.tencent.client.plasma.exceptions; public class PlasmaClientException extends RuntimeException { public PlasmaClientException(String message) { super(message); } public PlasmaClientException(String message, Throwable t) { super(message, t); } }
UTF-8
Java
287
java
PlasmaClientException.java
Java
[]
null
[]
package com.tencent.client.plasma.exceptions; public class PlasmaClientException extends RuntimeException { public PlasmaClientException(String message) { super(message); } public PlasmaClientException(String message, Throwable t) { super(message, t); } }
287
0.728223
0.728223
12
21.916666
23.928568
61
false
false
0
0
0
0
0
0
0.416667
false
false
14
374037427b384c28418209315cc39bdb40b77a84
10,505,490,012,816
e82751436e15008af109c17866272ac52fc0e83c
/2021_02_10_Revue/src/BubbleSort.java
b244b8c39cc356a5fe37d062f4f41935daba49f0
[]
no_license
AlexReimer/Tel_Ran-Java-OOP
https://github.com/AlexReimer/Tel_Ran-Java-OOP
c7d3291b7252148dffe38da968b613b3bc8529b2
e3c4949de12d69a217f6b04be45a7e0c435fe36e
refs/heads/main
2023-05-05T03:48:42.659000
2021-05-09T21:23:44
2021-05-09T21:23:44
335,653,231
0
2
null
false
2021-03-04T10:14:13
2021-02-03T14:35:57
2021-03-02T20:18:20
2021-03-04T10:14:13
57
0
2
1
Java
false
false
import java.util.Arrays; public class BubbleSort { public static void main(String[] args) { int[] myLovelyArray = generateArray(10); //копируем входящий массив в новый чтобы не трогать оригинальные данные например int[] myCopyFromLovelyArray = copyMyArray(myLovelyArray); System.out.println(Arrays.toString(myLovelyArray)); bubbSort(myLovelyArray); System.out.println(Arrays.toString(myLovelyArray)); System.out.println("Копия изначального массива"); System.out.println(Arrays.toString(myCopyFromLovelyArray)); bubbleSortRecursion(myCopyFromLovelyArray); System.out.println(Arrays.toString(myCopyFromLovelyArray)); } private static void bubbleSortRecursion(int[] input) { int count = 0; for (int i = 0; i < input.length - 1; i++) { if (input [i] > input [i +1]) { swap (input, i); count ++; } } if (count >0) { bubbleSortRecursion(input); } } //копируем входящий массив в новый чтобы не трогать оригинальные данные например private static int[] copyMyArray(int[] input) { int output[] = new int[input.length]; for (int i = 0; i < input.length; i++) { output[i] = input[i]; } return output; } //еще один вариант Пузурьковой сортировки private static void bubbSort(int[] input) { boolean unsorted = true; while (unsorted) { unsorted = false; for (int i = 0; i < input.length - 1; i++) { if (input[i] > input[i + 1]) { swap(input, i); unsorted = true; } } } } private static void swap(int[] input, int i) { int temp = input[i]; input[i] = input[i + 1]; input[i + 1] = temp; } private static int[] generateArray(int size) { int[] output = new int[size]; for (int i = 0; i < output.length; i++) { output[i] = randomIntGenerate(); } return output; } private static int randomIntGenerate() { return (int) (Math.random() * 100); //такая запись генерирует числа от 0 до 100 } }
UTF-8
Java
2,510
java
BubbleSort.java
Java
[]
null
[]
import java.util.Arrays; public class BubbleSort { public static void main(String[] args) { int[] myLovelyArray = generateArray(10); //копируем входящий массив в новый чтобы не трогать оригинальные данные например int[] myCopyFromLovelyArray = copyMyArray(myLovelyArray); System.out.println(Arrays.toString(myLovelyArray)); bubbSort(myLovelyArray); System.out.println(Arrays.toString(myLovelyArray)); System.out.println("Копия изначального массива"); System.out.println(Arrays.toString(myCopyFromLovelyArray)); bubbleSortRecursion(myCopyFromLovelyArray); System.out.println(Arrays.toString(myCopyFromLovelyArray)); } private static void bubbleSortRecursion(int[] input) { int count = 0; for (int i = 0; i < input.length - 1; i++) { if (input [i] > input [i +1]) { swap (input, i); count ++; } } if (count >0) { bubbleSortRecursion(input); } } //копируем входящий массив в новый чтобы не трогать оригинальные данные например private static int[] copyMyArray(int[] input) { int output[] = new int[input.length]; for (int i = 0; i < input.length; i++) { output[i] = input[i]; } return output; } //еще один вариант Пузурьковой сортировки private static void bubbSort(int[] input) { boolean unsorted = true; while (unsorted) { unsorted = false; for (int i = 0; i < input.length - 1; i++) { if (input[i] > input[i + 1]) { swap(input, i); unsorted = true; } } } } private static void swap(int[] input, int i) { int temp = input[i]; input[i] = input[i + 1]; input[i + 1] = temp; } private static int[] generateArray(int size) { int[] output = new int[size]; for (int i = 0; i < output.length; i++) { output[i] = randomIntGenerate(); } return output; } private static int randomIntGenerate() { return (int) (Math.random() * 100); //такая запись генерирует числа от 0 до 100 } }
2,510
0.552735
0.543545
75
29.466667
23.609226
88
false
false
0
0
0
0
0
0
0.52
false
false
14
685c59395ff9a6612d3bebd3005dbacc944f3b2f
10,505,490,013,740
f0286069e7dd0e094cf8c0df31ebe7a646b400f7
/app/src/main/java/com/eazy/firda/eazy/GuestSearchFragment.java
d571e99f85e5271bb766bf015d9c60f46fb28038
[]
no_license
nasacell/Eazy
https://github.com/nasacell/Eazy
2ef44294d3a596560c757ee0e674dcf8ea93ea61
9d8d90b1935a99d2d082f2a9cdbd6cf835dc7c58
refs/heads/master
2020-03-22T14:50:28.967000
2018-07-08T23:28:01
2018-07-08T23:28:01
140,209,672
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.eazy.firda.eazy; import android.app.ProgressDialog; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.location.Address; import android.location.Geocoder; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.RelativeLayout; import android.widget.ScrollView; import com.eazy.firda.eazy.Tasks.JSONParser; import com.eazy.firda.eazy.adapter.CarRecyclerAdapter; import com.eazy.firda.eazy.models.Car; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import java.util.List; import java.util.Locale; /** * A simple {@link Fragment} subclass. * Activities that contain this fragment must implement the * {@link GuestSearchFragment.OnFragmentInteractionListener} interface * to handle interaction events. * Use the {@link GuestSearchFragment#newInstance} factory method to * create an instance of this fragment. */ public class GuestSearchFragment extends Fragment { // TODO: Rename parameter arguments, choose names that match // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER private static final String ARG_PARAM1 = "param1"; private static final String ARG_PARAM2 = "param2"; // TODO: Rename and change types of parameters private String mParam1; private String mParam2; private OnFragmentInteractionListener mListener; RecyclerView rvRating, rvTrip; RecyclerView.LayoutManager layoutManager, layoutManager2; ProgressBar progress; ScrollView layMain; LinearLayout laySearch; RelativeLayout layNullRated, layNullFeatured; CarRecyclerAdapter rAdapter1, rAdapter2; SharedPreferences sp; SharedPreferences.Editor editor; String callUrl = "http://new.entongproject.com/api/customer/list_fav_car"; List<Car> cars = new ArrayList<Car>(); List<Car> cars2 = new ArrayList<Car>(); String data; public GuestSearchFragment() { // Required empty public constructor } /** * Use this factory method to create a new instance of * this fragment using the provided parameters. * * @param param1 Parameter 1. * @param param2 Parameter 2. * @return A new instance of fragment GuestSearchFragment. */ // TODO: Rename and change types and number of parameters public static GuestSearchFragment newInstance(String param1, String param2) { GuestSearchFragment fragment = new GuestSearchFragment(); Bundle args = new Bundle(); args.putString(ARG_PARAM1, param1); args.putString(ARG_PARAM2, param2); fragment.setArguments(args); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { mParam1 = getArguments().getString(ARG_PARAM1); mParam2 = getArguments().getString(ARG_PARAM2); } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View v = inflater.inflate(R.layout.fragment_guest_search, container, false); layMain = v.findViewById(R.id.layMain); layMain.setVisibility(View.INVISIBLE); progress = v.findViewById(R.id.progressBar); // search.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // Intent search = new Intent(getActivity(), ListCar.class); // startActivity(search); // } // }); laySearch = v.findViewById(R.id.laySearch); laySearch.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent search = new Intent(getActivity(), ListCar.class); startActivity(search); } }); layNullRated = v.findViewById(R.id.nullRated); layNullRated.setVisibility(View.INVISIBLE); layNullFeatured = v.findViewById(R.id.nullFeatured); layNullFeatured.setVisibility(View.INVISIBLE); rvRating = (RecyclerView)v.findViewById(R.id.rvRating); rvRating.setHasFixedSize(true); layoutManager = new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false); rvRating.setLayoutManager(layoutManager); rAdapter1 = new CarRecyclerAdapter(getActivity(), cars, "rating"); rvTrip = (RecyclerView) v.findViewById(R.id.rvTrip); layoutManager2 = new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false); rvTrip.setHasFixedSize(true); rvTrip.setLayoutManager(layoutManager2); rAdapter2 = new CarRecyclerAdapter(getActivity(),cars2, "trips"); progress.setVisibility(View.VISIBLE); favRate fr = new favRate(); fr.execute(); favTrip ft = new favTrip(); ft.execute(); progress.setVisibility(View.INVISIBLE); layMain.setVisibility(View.VISIBLE); rAdapter1.notifyDataSetChanged(); rvRating.setAdapter(rAdapter1); rAdapter2.notifyDataSetChanged(); rvTrip.setAdapter(rAdapter2); return v; } private class favRate extends AsyncTask<Void, Void, JSONObject> { ProgressDialog progressDialog; @Override protected void onPreExecute(){ progressDialog = new ProgressDialog(getActivity()); progressDialog.setMessage("Loading..."); progressDialog.setIndeterminate(false); progressDialog.setCancelable(true); // progressDialog.show(); } @Override protected JSONObject doInBackground(Void... voids) { JSONParser jParser = new JSONParser(); data = "rating"; Log.v("url", callUrl); Log.v("data", data); JSONObject response = jParser.getJsonFromUrl(callUrl, data); Log.v("response", response.toString()); return response; } @Override protected void onPostExecute(JSONObject response){ String result; try{ //result = response.getString("result"); if(response.getString("result").equals("success")){ JSONArray mCars = response.getJSONArray("cars"); for(int i = 0, size = mCars.length(); i < size; i++){ JSONObject carDetail = mCars.getJSONObject(i); Log.v("carDetail", carDetail.toString()); String location = "not identified"; String city = "not identified"; if ((!carDetail.isNull("location_lat") || carDetail.getDouble("location_lat") != 0.0) && (!carDetail.isNull("location_long")|| carDetail.getDouble("location_long") != 0.0)) { Geocoder geocoder = new Geocoder(getActivity(), Locale.getDefault()); try { List<Address> addresses = geocoder.getFromLocation(carDetail.getDouble("location_lat"), carDetail.getDouble("location_long"), 1); Address obj = addresses.get(0); city = addresses.get(0).getLocality(); location = obj.getAddressLine(0); //location = obj.getFeatureName(); Log.v("address", addresses.toString()); Log.v("obj", obj.toString()); } catch(Exception e){ Log.e("address", "error", e); } } Log.v("location", location); String imageCar = carDetail.isNull("photo")? "http://new.entongproject.com/images/car/car_default.png" : carDetail.getString("photo"); Car car = new Car(carDetail.getString("id"), carDetail.getString("car_name"), carDetail.getString("owner_name"), imageCar, carDetail.getInt("year"), carDetail.getDouble("price"), carDetail.getDouble("total_rating"), location, city, 0); cars.add(car); } } else{ rvRating.setVisibility(View.INVISIBLE); layNullRated.setVisibility(View.VISIBLE); Log.v("Error", response.getString("message")); } }catch(JSONException e){ e.printStackTrace(); } rAdapter1.notifyDataSetChanged(); // progressDialog.dismiss(); } } private class favTrip extends AsyncTask<Void, Void, JSONObject>{ ProgressDialog progressDialog; @Override protected void onPreExecute(){ progressDialog = new ProgressDialog(getActivity()); progressDialog.setMessage("Loading..."); progressDialog.setIndeterminate(false); progressDialog.setCancelable(true); // progressDialog.show(); } @Override protected JSONObject doInBackground(Void... voids) { JSONParser jParser = new JSONParser(); data = "trips"; Log.v("url", callUrl); Log.v("data", data); JSONObject response = jParser.getJsonFromUrl(callUrl, data); Log.v("response", response.toString()); return response; } @Override protected void onPostExecute(JSONObject response){ String result; try{ //result = response.getString("result"); if(response.getString("result").equals("success")){ JSONArray mCars = response.getJSONArray("cars"); for(int i = 0, size = mCars.length(); i < size; i++){ JSONObject carDetail = mCars.getJSONObject(i); Log.v("carDetail", carDetail.toString()); String location = "not identified"; String city = "not identified"; if ((!carDetail.isNull("location_lat") || carDetail.getDouble("location_lat") != 0.0) && (!carDetail.isNull("location_long")|| carDetail.getDouble("location_long") != 0.0)) { Geocoder geocoder = new Geocoder(getActivity(), Locale.getDefault()); try { List<Address> addresses = geocoder.getFromLocation(carDetail.getDouble("location_lat"), carDetail.getDouble("location_long"), 1); Address obj = addresses.get(0); city = addresses.get(0).getLocality(); location = obj.getAddressLine(0); //location = obj.getFeatureName(); Log.v("address", addresses.toString()); Log.v("obj", obj.toString()); } catch(Exception e){ Log.e("address", "error", e); } } Log.v("location", location); String imageCar = carDetail.isNull("photo")? "http://new.entongproject.com/images/car/car_default.png" : carDetail.getString("photo"); Car car = new Car(carDetail.getString("id"), carDetail.getString("car_name"), carDetail.getString("owner_name"), imageCar, carDetail.getInt("year"), carDetail.getDouble("price"), carDetail.getDouble("total_rating"), location, city, 0); cars2.add(car); } } else{ rvTrip.setVisibility(View.INVISIBLE); layNullFeatured.setVisibility(View.VISIBLE); Log.v("Error", response.getString("message")); } }catch(JSONException e){ e.printStackTrace(); } rAdapter2.notifyDataSetChanged(); // progressDialog.dismiss(); } } // TODO: Rename method, update argument and hook method into UI event public void onButtonPressed(Uri uri) { if (mListener != null) { mListener.onFragmentInteraction(uri); } } @Override public void onAttach(Context context) { super.onAttach(context); // if (context instanceof OnFragmentInteractionListener) { // mListener = (OnFragmentInteractionListener) context; // } else { // throw new RuntimeException(context.toString() // + " must implement OnFragmentInteractionListener"); // } } @Override public void onDetach() { super.onDetach(); mListener = null; } /** * This interface must be implemented by activities that contain this * fragment to allow an interaction in this fragment to be communicated * to the activity and potentially other fragments contained in that * activity. * <p> * See the Android Training lesson <a href= * "http://developer.android.com/training/basics/fragments/communicating.html" * >Communicating with Other Fragments</a> for more information. */ public interface OnFragmentInteractionListener { // TODO: Update argument type and name void onFragmentInteraction(Uri uri); } }
UTF-8
Java
14,481
java
GuestSearchFragment.java
Java
[]
null
[]
package com.eazy.firda.eazy; import android.app.ProgressDialog; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.location.Address; import android.location.Geocoder; import android.net.Uri; import android.os.AsyncTask; import android.os.Bundle; import android.support.v4.app.Fragment; import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.RecyclerView; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.LinearLayout; import android.widget.ProgressBar; import android.widget.RelativeLayout; import android.widget.ScrollView; import com.eazy.firda.eazy.Tasks.JSONParser; import com.eazy.firda.eazy.adapter.CarRecyclerAdapter; import com.eazy.firda.eazy.models.Car; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import java.util.ArrayList; import java.util.List; import java.util.Locale; /** * A simple {@link Fragment} subclass. * Activities that contain this fragment must implement the * {@link GuestSearchFragment.OnFragmentInteractionListener} interface * to handle interaction events. * Use the {@link GuestSearchFragment#newInstance} factory method to * create an instance of this fragment. */ public class GuestSearchFragment extends Fragment { // TODO: Rename parameter arguments, choose names that match // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER private static final String ARG_PARAM1 = "param1"; private static final String ARG_PARAM2 = "param2"; // TODO: Rename and change types of parameters private String mParam1; private String mParam2; private OnFragmentInteractionListener mListener; RecyclerView rvRating, rvTrip; RecyclerView.LayoutManager layoutManager, layoutManager2; ProgressBar progress; ScrollView layMain; LinearLayout laySearch; RelativeLayout layNullRated, layNullFeatured; CarRecyclerAdapter rAdapter1, rAdapter2; SharedPreferences sp; SharedPreferences.Editor editor; String callUrl = "http://new.entongproject.com/api/customer/list_fav_car"; List<Car> cars = new ArrayList<Car>(); List<Car> cars2 = new ArrayList<Car>(); String data; public GuestSearchFragment() { // Required empty public constructor } /** * Use this factory method to create a new instance of * this fragment using the provided parameters. * * @param param1 Parameter 1. * @param param2 Parameter 2. * @return A new instance of fragment GuestSearchFragment. */ // TODO: Rename and change types and number of parameters public static GuestSearchFragment newInstance(String param1, String param2) { GuestSearchFragment fragment = new GuestSearchFragment(); Bundle args = new Bundle(); args.putString(ARG_PARAM1, param1); args.putString(ARG_PARAM2, param2); fragment.setArguments(args); return fragment; } @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getArguments() != null) { mParam1 = getArguments().getString(ARG_PARAM1); mParam2 = getArguments().getString(ARG_PARAM2); } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // Inflate the layout for this fragment View v = inflater.inflate(R.layout.fragment_guest_search, container, false); layMain = v.findViewById(R.id.layMain); layMain.setVisibility(View.INVISIBLE); progress = v.findViewById(R.id.progressBar); // search.setOnClickListener(new View.OnClickListener() { // @Override // public void onClick(View v) { // Intent search = new Intent(getActivity(), ListCar.class); // startActivity(search); // } // }); laySearch = v.findViewById(R.id.laySearch); laySearch.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent search = new Intent(getActivity(), ListCar.class); startActivity(search); } }); layNullRated = v.findViewById(R.id.nullRated); layNullRated.setVisibility(View.INVISIBLE); layNullFeatured = v.findViewById(R.id.nullFeatured); layNullFeatured.setVisibility(View.INVISIBLE); rvRating = (RecyclerView)v.findViewById(R.id.rvRating); rvRating.setHasFixedSize(true); layoutManager = new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false); rvRating.setLayoutManager(layoutManager); rAdapter1 = new CarRecyclerAdapter(getActivity(), cars, "rating"); rvTrip = (RecyclerView) v.findViewById(R.id.rvTrip); layoutManager2 = new LinearLayoutManager(getActivity(), LinearLayoutManager.HORIZONTAL, false); rvTrip.setHasFixedSize(true); rvTrip.setLayoutManager(layoutManager2); rAdapter2 = new CarRecyclerAdapter(getActivity(),cars2, "trips"); progress.setVisibility(View.VISIBLE); favRate fr = new favRate(); fr.execute(); favTrip ft = new favTrip(); ft.execute(); progress.setVisibility(View.INVISIBLE); layMain.setVisibility(View.VISIBLE); rAdapter1.notifyDataSetChanged(); rvRating.setAdapter(rAdapter1); rAdapter2.notifyDataSetChanged(); rvTrip.setAdapter(rAdapter2); return v; } private class favRate extends AsyncTask<Void, Void, JSONObject> { ProgressDialog progressDialog; @Override protected void onPreExecute(){ progressDialog = new ProgressDialog(getActivity()); progressDialog.setMessage("Loading..."); progressDialog.setIndeterminate(false); progressDialog.setCancelable(true); // progressDialog.show(); } @Override protected JSONObject doInBackground(Void... voids) { JSONParser jParser = new JSONParser(); data = "rating"; Log.v("url", callUrl); Log.v("data", data); JSONObject response = jParser.getJsonFromUrl(callUrl, data); Log.v("response", response.toString()); return response; } @Override protected void onPostExecute(JSONObject response){ String result; try{ //result = response.getString("result"); if(response.getString("result").equals("success")){ JSONArray mCars = response.getJSONArray("cars"); for(int i = 0, size = mCars.length(); i < size; i++){ JSONObject carDetail = mCars.getJSONObject(i); Log.v("carDetail", carDetail.toString()); String location = "not identified"; String city = "not identified"; if ((!carDetail.isNull("location_lat") || carDetail.getDouble("location_lat") != 0.0) && (!carDetail.isNull("location_long")|| carDetail.getDouble("location_long") != 0.0)) { Geocoder geocoder = new Geocoder(getActivity(), Locale.getDefault()); try { List<Address> addresses = geocoder.getFromLocation(carDetail.getDouble("location_lat"), carDetail.getDouble("location_long"), 1); Address obj = addresses.get(0); city = addresses.get(0).getLocality(); location = obj.getAddressLine(0); //location = obj.getFeatureName(); Log.v("address", addresses.toString()); Log.v("obj", obj.toString()); } catch(Exception e){ Log.e("address", "error", e); } } Log.v("location", location); String imageCar = carDetail.isNull("photo")? "http://new.entongproject.com/images/car/car_default.png" : carDetail.getString("photo"); Car car = new Car(carDetail.getString("id"), carDetail.getString("car_name"), carDetail.getString("owner_name"), imageCar, carDetail.getInt("year"), carDetail.getDouble("price"), carDetail.getDouble("total_rating"), location, city, 0); cars.add(car); } } else{ rvRating.setVisibility(View.INVISIBLE); layNullRated.setVisibility(View.VISIBLE); Log.v("Error", response.getString("message")); } }catch(JSONException e){ e.printStackTrace(); } rAdapter1.notifyDataSetChanged(); // progressDialog.dismiss(); } } private class favTrip extends AsyncTask<Void, Void, JSONObject>{ ProgressDialog progressDialog; @Override protected void onPreExecute(){ progressDialog = new ProgressDialog(getActivity()); progressDialog.setMessage("Loading..."); progressDialog.setIndeterminate(false); progressDialog.setCancelable(true); // progressDialog.show(); } @Override protected JSONObject doInBackground(Void... voids) { JSONParser jParser = new JSONParser(); data = "trips"; Log.v("url", callUrl); Log.v("data", data); JSONObject response = jParser.getJsonFromUrl(callUrl, data); Log.v("response", response.toString()); return response; } @Override protected void onPostExecute(JSONObject response){ String result; try{ //result = response.getString("result"); if(response.getString("result").equals("success")){ JSONArray mCars = response.getJSONArray("cars"); for(int i = 0, size = mCars.length(); i < size; i++){ JSONObject carDetail = mCars.getJSONObject(i); Log.v("carDetail", carDetail.toString()); String location = "not identified"; String city = "not identified"; if ((!carDetail.isNull("location_lat") || carDetail.getDouble("location_lat") != 0.0) && (!carDetail.isNull("location_long")|| carDetail.getDouble("location_long") != 0.0)) { Geocoder geocoder = new Geocoder(getActivity(), Locale.getDefault()); try { List<Address> addresses = geocoder.getFromLocation(carDetail.getDouble("location_lat"), carDetail.getDouble("location_long"), 1); Address obj = addresses.get(0); city = addresses.get(0).getLocality(); location = obj.getAddressLine(0); //location = obj.getFeatureName(); Log.v("address", addresses.toString()); Log.v("obj", obj.toString()); } catch(Exception e){ Log.e("address", "error", e); } } Log.v("location", location); String imageCar = carDetail.isNull("photo")? "http://new.entongproject.com/images/car/car_default.png" : carDetail.getString("photo"); Car car = new Car(carDetail.getString("id"), carDetail.getString("car_name"), carDetail.getString("owner_name"), imageCar, carDetail.getInt("year"), carDetail.getDouble("price"), carDetail.getDouble("total_rating"), location, city, 0); cars2.add(car); } } else{ rvTrip.setVisibility(View.INVISIBLE); layNullFeatured.setVisibility(View.VISIBLE); Log.v("Error", response.getString("message")); } }catch(JSONException e){ e.printStackTrace(); } rAdapter2.notifyDataSetChanged(); // progressDialog.dismiss(); } } // TODO: Rename method, update argument and hook method into UI event public void onButtonPressed(Uri uri) { if (mListener != null) { mListener.onFragmentInteraction(uri); } } @Override public void onAttach(Context context) { super.onAttach(context); // if (context instanceof OnFragmentInteractionListener) { // mListener = (OnFragmentInteractionListener) context; // } else { // throw new RuntimeException(context.toString() // + " must implement OnFragmentInteractionListener"); // } } @Override public void onDetach() { super.onDetach(); mListener = null; } /** * This interface must be implemented by activities that contain this * fragment to allow an interaction in this fragment to be communicated * to the activity and potentially other fragments contained in that * activity. * <p> * See the Android Training lesson <a href= * "http://developer.android.com/training/basics/fragments/communicating.html" * >Communicating with Other Fragments</a> for more information. */ public interface OnFragmentInteractionListener { // TODO: Update argument type and name void onFragmentInteraction(Uri uri); } }
14,481
0.576963
0.572889
378
37.309525
28.997938
132
false
false
0
0
0
0
0
0
0.706349
false
false
14
13736b22b526ac738bb1ced68dad0fddb1867ee7
13,675,175,941,423
1e3cdb8adc6bdf56dc726c087a75609400bc0fe3
/app/src/main/java/com/admin/notepad/index/IndexActivity.java
e297cb0f04aa3ba1dcd9b6bbc2b2bee7df9d8d2b
[]
no_license
tanqilin/Notepad
https://github.com/tanqilin/Notepad
35c24d4f3c24f525978ce78c773537a31195354a
bceb16de8b004263a17225ef1017a95899c681e0
refs/heads/master
2021-01-22T04:54:07.857000
2017-10-04T08:15:54
2017-10-04T08:15:54
102,271,619
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.admin.notepad.index; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.View; import android.support.design.widget.NavigationView; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import android.view.Window; import android.view.WindowManager; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.Toast; import com.admin.notepad.MainActivity; import com.admin.notepad.R; import com.admin.notepad.adapter.RecyclerCardAdapter; import com.admin.notepad.db.UserLog; import com.admin.notepad.dbService.LogService; import com.admin.notepad.model.CardModel; import com.admin.notepad.util.FileUtil; import com.bumptech.glide.Glide; import java.util.ArrayList; import java.util.List; import java.util.Random; public class IndexActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { //记录用户首次点击返回键的时间,用于实现双击退出应用功能 private long firstTime = 0; private SwipeRefreshLayout swipe_refresh; // 下拉刷新 private NavigationView navigationView; private ImageView drawerLayoutBack; // 抽屉背景图 private ImageView drawerLayoutHead; // 抽屉头像 private RecyclerView recyclerView; // 超级ListView private List<CardModel> cardList = new ArrayList<>(); // 数据列表 private RecyclerCardAdapter cardAdapter; // 适配器 @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_index); // 设置标题 swipe_refresh = (SwipeRefreshLayout) findViewById(R.id.swipe_refresh); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setTitle("我的小日记"); // 悬浮图标 FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { CreateActivity.actionStart(IndexActivity.this); } }); // 设置抽屉属性 DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); initDrawerUserSetting(); initActivityStartTitle(drawer); // 渲染 RecyclerView List initRecyclerViewCard(); // 设置下拉刷新 swipe_refresh.setColorSchemeResources(R.color.colorAccent); swipe_refresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { // 响应下拉动作 initDrawerUserSetting(); initRecyclerViewCard(); swipe_refresh.setRefreshing(false); // 关闭下拉刷新 } }); } // 处理抽屉控件中的点击事件 @SuppressWarnings("StatementWithEmptyBody") @Override public boolean onNavigationItemSelected(MenuItem item) { // Handle navigation view item clicks here. int id = item.getItemId(); if (id == R.id.nav_camera) { ThisMeActivity.actionStart(IndexActivity.this); } else if (id == R.id.nav_gallery) { LogManageActivity.actionStart(IndexActivity.this); } else if (id == R.id.nav_weather) { WeatherActivity.actionStart(IndexActivity.this); } else if (id == R.id.nav_manage) { GroupActivity.actionStart(IndexActivity.this); } else if (id == R.id.nav_share) { PrivacyActivity.actionStart(IndexActivity.this); } else if (id == R.id.nav_setting) { SettingActivity.actionStart(IndexActivity.this); } DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; } // 初始化抽屉菜单中用户的设置信息 private void initDrawerUserSetting(){ // 抽屉中的控件不能直接获取到 View headerView = navigationView.getHeaderView(0); drawerLayoutBack = (ImageView) headerView.findViewById(R.id.index_background); drawerLayoutHead = (ImageView) headerView.findViewById(R.id.icon_image); // 从缓存中加载用户设置好的图片 SharedPreferences pref = getSharedPreferences("Setting",MODE_PRIVATE); String background = pref.getString("background", null); String headimage = pref.getString("head", null); if(background != null) drawerLayoutBack.setImageURI(Uri.parse(background)); if(headimage != null) drawerLayoutHead.setImageURI(Uri.parse(headimage)); // Glide.with(this).load(background).into(drawerLayoutBack); } // 设置状态栏为透明 private void initActivityStartTitle(DrawerLayout drawer){ // 使用代码根据按android版本设置导航栏为透明色 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { WindowManager.LayoutParams localLayoutParams = getWindow().getAttributes(); localLayoutParams.flags = (WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS | localLayoutParams.flags); if(Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP){ //将侧边栏顶部延伸至status bar drawer.setFitsSystemWindows(true); //将主页面顶部延伸至status bar;虽默认为false,但经测试,DrawerLayout需显示设置 drawer.setClipToPadding(false); } } } // 初始化数据用于渲染CardView private void initRecyclerViewCard(){ recyclerView = (RecyclerView) findViewById(R.id.recycler_view); GridLayoutManager layoutManager = new GridLayoutManager(this,2); // 布局管理 recyclerView.setLayoutManager(layoutManager); List<UserLog> logs = LogService.GetAllUserLog(); cardList.clear(); for (UserLog log : logs){ cardList.add(new CardModel(log)); } // Toast.makeText(IndexActivity.this,"加载中...",Toast.LENGTH_SHORT).show(); // 把数据放入适配器 cardAdapter = new RecyclerCardAdapter(cardList,R.layout.activity_recycler_item); recyclerView.setAdapter(cardAdapter); } // 启动活动 public static void actionStart(Context context){ Intent intent = new Intent(context,IndexActivity.class); context.startActivity(intent); } @Override public void onBackPressed() { long secondTime = System.currentTimeMillis(); if (secondTime - firstTime > 2000) { Toast.makeText(IndexActivity.this, "再按一次退出程序", Toast.LENGTH_SHORT).show(); firstTime = secondTime; } else { System.exit(0); } } // 活动由停止状态变为运行状态 @Override protected void onRestart(){ initDrawerUserSetting(); initRecyclerViewCard(); super.onRestart(); } }
UTF-8
Java
8,135
java
IndexActivity.java
Java
[]
null
[]
package com.admin.notepad.index; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.net.Uri; import android.os.Build; import android.os.Bundle; import android.support.design.widget.FloatingActionButton; import android.support.design.widget.Snackbar; import android.support.v4.widget.SwipeRefreshLayout; import android.support.v7.widget.GridLayoutManager; import android.support.v7.widget.RecyclerView; import android.view.View; import android.support.design.widget.NavigationView; import android.support.v4.view.GravityCompat; import android.support.v4.widget.DrawerLayout; import android.support.v7.app.ActionBarDrawerToggle; import android.support.v7.app.AppCompatActivity; import android.support.v7.widget.Toolbar; import android.view.Menu; import android.view.MenuItem; import android.view.Window; import android.view.WindowManager; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.Toast; import com.admin.notepad.MainActivity; import com.admin.notepad.R; import com.admin.notepad.adapter.RecyclerCardAdapter; import com.admin.notepad.db.UserLog; import com.admin.notepad.dbService.LogService; import com.admin.notepad.model.CardModel; import com.admin.notepad.util.FileUtil; import com.bumptech.glide.Glide; import java.util.ArrayList; import java.util.List; import java.util.Random; public class IndexActivity extends AppCompatActivity implements NavigationView.OnNavigationItemSelectedListener { //记录用户首次点击返回键的时间,用于实现双击退出应用功能 private long firstTime = 0; private SwipeRefreshLayout swipe_refresh; // 下拉刷新 private NavigationView navigationView; private ImageView drawerLayoutBack; // 抽屉背景图 private ImageView drawerLayoutHead; // 抽屉头像 private RecyclerView recyclerView; // 超级ListView private List<CardModel> cardList = new ArrayList<>(); // 数据列表 private RecyclerCardAdapter cardAdapter; // 适配器 @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_index); // 设置标题 swipe_refresh = (SwipeRefreshLayout) findViewById(R.id.swipe_refresh); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); getSupportActionBar().setTitle("我的小日记"); // 悬浮图标 FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); fab.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { CreateActivity.actionStart(IndexActivity.this); } }); // 设置抽屉属性 DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); ActionBarDrawerToggle toggle = new ActionBarDrawerToggle(this, drawer, toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close); drawer.setDrawerListener(toggle); toggle.syncState(); navigationView = (NavigationView) findViewById(R.id.nav_view); navigationView.setNavigationItemSelectedListener(this); initDrawerUserSetting(); initActivityStartTitle(drawer); // 渲染 RecyclerView List initRecyclerViewCard(); // 设置下拉刷新 swipe_refresh.setColorSchemeResources(R.color.colorAccent); swipe_refresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() { @Override public void onRefresh() { // 响应下拉动作 initDrawerUserSetting(); initRecyclerViewCard(); swipe_refresh.setRefreshing(false); // 关闭下拉刷新 } }); } // 处理抽屉控件中的点击事件 @SuppressWarnings("StatementWithEmptyBody") @Override public boolean onNavigationItemSelected(MenuItem item) { // Handle navigation view item clicks here. int id = item.getItemId(); if (id == R.id.nav_camera) { ThisMeActivity.actionStart(IndexActivity.this); } else if (id == R.id.nav_gallery) { LogManageActivity.actionStart(IndexActivity.this); } else if (id == R.id.nav_weather) { WeatherActivity.actionStart(IndexActivity.this); } else if (id == R.id.nav_manage) { GroupActivity.actionStart(IndexActivity.this); } else if (id == R.id.nav_share) { PrivacyActivity.actionStart(IndexActivity.this); } else if (id == R.id.nav_setting) { SettingActivity.actionStart(IndexActivity.this); } DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout); drawer.closeDrawer(GravityCompat.START); return true; } // 初始化抽屉菜单中用户的设置信息 private void initDrawerUserSetting(){ // 抽屉中的控件不能直接获取到 View headerView = navigationView.getHeaderView(0); drawerLayoutBack = (ImageView) headerView.findViewById(R.id.index_background); drawerLayoutHead = (ImageView) headerView.findViewById(R.id.icon_image); // 从缓存中加载用户设置好的图片 SharedPreferences pref = getSharedPreferences("Setting",MODE_PRIVATE); String background = pref.getString("background", null); String headimage = pref.getString("head", null); if(background != null) drawerLayoutBack.setImageURI(Uri.parse(background)); if(headimage != null) drawerLayoutHead.setImageURI(Uri.parse(headimage)); // Glide.with(this).load(background).into(drawerLayoutBack); } // 设置状态栏为透明 private void initActivityStartTitle(DrawerLayout drawer){ // 使用代码根据按android版本设置导航栏为透明色 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { WindowManager.LayoutParams localLayoutParams = getWindow().getAttributes(); localLayoutParams.flags = (WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS | localLayoutParams.flags); if(Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP){ //将侧边栏顶部延伸至status bar drawer.setFitsSystemWindows(true); //将主页面顶部延伸至status bar;虽默认为false,但经测试,DrawerLayout需显示设置 drawer.setClipToPadding(false); } } } // 初始化数据用于渲染CardView private void initRecyclerViewCard(){ recyclerView = (RecyclerView) findViewById(R.id.recycler_view); GridLayoutManager layoutManager = new GridLayoutManager(this,2); // 布局管理 recyclerView.setLayoutManager(layoutManager); List<UserLog> logs = LogService.GetAllUserLog(); cardList.clear(); for (UserLog log : logs){ cardList.add(new CardModel(log)); } // Toast.makeText(IndexActivity.this,"加载中...",Toast.LENGTH_SHORT).show(); // 把数据放入适配器 cardAdapter = new RecyclerCardAdapter(cardList,R.layout.activity_recycler_item); recyclerView.setAdapter(cardAdapter); } // 启动活动 public static void actionStart(Context context){ Intent intent = new Intent(context,IndexActivity.class); context.startActivity(intent); } @Override public void onBackPressed() { long secondTime = System.currentTimeMillis(); if (secondTime - firstTime > 2000) { Toast.makeText(IndexActivity.this, "再按一次退出程序", Toast.LENGTH_SHORT).show(); firstTime = secondTime; } else { System.exit(0); } } // 活动由停止状态变为运行状态 @Override protected void onRestart(){ initDrawerUserSetting(); initRecyclerViewCard(); super.onRestart(); } }
8,135
0.681586
0.679492
202
36.826733
26.150831
155
false
false
0
0
0
0
0
0
0.633663
false
false
14
7722bf6acdd01f5f3fb3492b28508ee998968ba8
23,270,132,811,853
f628d1066195c11eb564295d02c5303111d3884a
/AutoSuggest/src/autosuggest/service/SearchServiceLogic.java
be535da1874dd5424549b8c7dc51ed7c0990b214
[]
no_license
KIMSONGYEE/song2
https://github.com/KIMSONGYEE/song2
5ba4635ddc1c6b51262e631355b27049f05c4143
068b36b668cc610d9e6807850d8c1ee883f46f74
refs/heads/master
2021-01-01T06:56:57.275000
2017-07-21T02:31:15
2017-07-21T02:31:15
97,558,273
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package autosuggest.service; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import autosuggest.domain.SearchWord; import autosuggest.store.SearchStore; @Service public class SearchServiceLogic implements SearchService { @Autowired private SearchStore store; @Override public List<SearchWord> findWord(String keyword) { List<SearchWord> words = store.findWord(keyword); return words; } }
UTF-8
Java
513
java
SearchServiceLogic.java
Java
[]
null
[]
package autosuggest.service; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import autosuggest.domain.SearchWord; import autosuggest.store.SearchStore; @Service public class SearchServiceLogic implements SearchService { @Autowired private SearchStore store; @Override public List<SearchWord> findWord(String keyword) { List<SearchWord> words = store.findWord(keyword); return words; } }
513
0.76998
0.76998
23
20.304348
21.156631
62
false
false
0
0
0
0
0
0
0.826087
false
false
14
711596c40176940d6db7384ac8613c6c406a33da
33,904,471,867,937
1d938204f6b27fdc0fe2b433c45f7456c0c5696e
/vjezbaObrisatKasnije/src/ba/edu/ssst/LowestSalaryThread.java
5a848888b7ca29f013344594a06a3a849e051b5f
[]
no_license
AmelHelez/Java-projects
https://github.com/AmelHelez/Java-projects
fbb43df2641e8e96918a820537102e7c9140a546
79daefc8e7763c65b849634665b4bd8eef1093c8
refs/heads/master
2020-12-31T09:13:41.708000
2020-02-07T16:45:30
2020-02-07T16:45:30
238,969,548
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ba.edu.ssst; import java.util.ArrayList; public class LowestSalaryThread implements Runnable{ ArrayList<Employee> employees = new ArrayList<>(); Employee e1; public LowestSalaryThread(ArrayList<Employee> employees) { this.employees = employees; } @Override public void run() { Integer lowest = employees.get(0).getSalary(); for(Employee e : employees) { if(e.getSalary() < lowest) { lowest = e.getSalary(); e1 = new Employee(e.getFirstName(), e.getLastName(), e.getDepartment(), lowest); } } System.out.println(e1); Sync.displaySmallest(e1); } }
UTF-8
Java
692
java
LowestSalaryThread.java
Java
[]
null
[]
package ba.edu.ssst; import java.util.ArrayList; public class LowestSalaryThread implements Runnable{ ArrayList<Employee> employees = new ArrayList<>(); Employee e1; public LowestSalaryThread(ArrayList<Employee> employees) { this.employees = employees; } @Override public void run() { Integer lowest = employees.get(0).getSalary(); for(Employee e : employees) { if(e.getSalary() < lowest) { lowest = e.getSalary(); e1 = new Employee(e.getFirstName(), e.getLastName(), e.getDepartment(), lowest); } } System.out.println(e1); Sync.displaySmallest(e1); } }
692
0.598266
0.59104
27
24.629629
23.856279
96
false
false
0
0
0
0
0
0
0.481481
false
false
14
528a57513e844a26f3c6f64c9da8a396fb9a4358
34,454,227,684,587
24ccbd9f7cd29fdc07be2a88132cd253c87db9d5
/src/com/googlecode/junittime/domain/reporting/CSVReportGenerator.java
140bcf86aab2f9cb55b5b0c6291682baaca0d961
[]
no_license
vijayvani/junit-time
https://github.com/vijayvani/junit-time
3e1a4c4efc314ffabe3b8d87eaa8301d7698da14
a81af3bdf084c75202ded48d7e6a89b76a89de45
refs/heads/master
2020-05-18T21:19:54.576000
2009-03-12T15:44:31
2009-03-12T15:44:31
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.googlecode.junittime.domain.reporting; import com.googlecode.junittime.domain.TestCase; import com.googlecode.junittime.domain.TestCaseRepository; import org.apache.commons.io.FileUtils; import java.io.File; import java.io.IOException; import static java.lang.String.format; import java.util.List; // job: generate csv report according to testCaseRepository public class CSVReportGenerator implements ReportGenerator { public void generate(File reportFile, TestCaseRepository testCaseRepository) throws IOException { writeBufferToFile(reportFile, generateCSVInBuffer(testCaseRepository.byDurationDesc())); } private StringBuilder generateCSVInBuffer(List<TestCase> testCases) { StringBuilder buffer = new StringBuilder(); for (TestCase testCase : testCases) { buffer.append(generateLine(testCase)); } return buffer; } private String generateLine(TestCase testCase) { return format("%s, %s, %.3f%s", testCase.getClassName(), testCase.getTestName(), testCase.getDuration(), System.getProperty("line.separator")); } private void writeBufferToFile(File reportFile, StringBuilder buffer) throws IOException { FileUtils.writeStringToFile(reportFile, buffer.toString()); } }
UTF-8
Java
1,350
java
CSVReportGenerator.java
Java
[]
null
[]
package com.googlecode.junittime.domain.reporting; import com.googlecode.junittime.domain.TestCase; import com.googlecode.junittime.domain.TestCaseRepository; import org.apache.commons.io.FileUtils; import java.io.File; import java.io.IOException; import static java.lang.String.format; import java.util.List; // job: generate csv report according to testCaseRepository public class CSVReportGenerator implements ReportGenerator { public void generate(File reportFile, TestCaseRepository testCaseRepository) throws IOException { writeBufferToFile(reportFile, generateCSVInBuffer(testCaseRepository.byDurationDesc())); } private StringBuilder generateCSVInBuffer(List<TestCase> testCases) { StringBuilder buffer = new StringBuilder(); for (TestCase testCase : testCases) { buffer.append(generateLine(testCase)); } return buffer; } private String generateLine(TestCase testCase) { return format("%s, %s, %.3f%s", testCase.getClassName(), testCase.getTestName(), testCase.getDuration(), System.getProperty("line.separator")); } private void writeBufferToFile(File reportFile, StringBuilder buffer) throws IOException { FileUtils.writeStringToFile(reportFile, buffer.toString()); } }
1,350
0.716296
0.715556
37
35.486488
28.888996
101
false
false
0
0
0
0
0
0
0.648649
false
false
14
2d614f6f12a6a7747ed26f6576d3439ccc2b2302
36,636,071,050,797
73458087c9a504dedc5acd84ecd63db5dfcd5ca1
/src/com/estrongs/android/ui/a/df.java
51571861d07c3548f51fd9575513c9b4906fdb15
[]
no_license
jtap60/com.estr
https://github.com/jtap60/com.estr
99ff2a6dd07b02b41a9cc3c1d28bb6545e68fb27
8b70bf2da8b24c7cef5973744e6054ef972fc745
refs/heads/master
2020-04-14T02:12:20.424000
2018-12-30T10:56:45
2018-12-30T10:56:45
163,578,360
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.estrongs.android.ui.a; import android.view.View; import android.view.View.OnClickListener; import com.estrongs.android.ui.view.ag; class df implements View.OnClickListener { df(db paramdb) {} public void onClick(View paramView) { ag.a(db.a(a), 2131428340, 0); } } /* Location: * Qualified Name: com.estrongs.android.ui.a.df * Java Class Version: 6 (50.0) * JD-Core Version: 0.7.1 */
UTF-8
Java
425
java
df.java
Java
[]
null
[]
package com.estrongs.android.ui.a; import android.view.View; import android.view.View.OnClickListener; import com.estrongs.android.ui.view.ag; class df implements View.OnClickListener { df(db paramdb) {} public void onClick(View paramView) { ag.a(db.a(a), 2131428340, 0); } } /* Location: * Qualified Name: com.estrongs.android.ui.a.df * Java Class Version: 6 (50.0) * JD-Core Version: 0.7.1 */
425
0.687059
0.644706
22
18.363636
16.595579
51
false
false
0
0
0
0
0
0
0.318182
false
false
14
4f0d6905ba4ed04813b5a473d42000336ab0e07d
34,187,939,710,561
50003c1484b4f202cff38492fed537da2a90e559
/src/main/java/com/spring/controller/TestController.java
3e9993ff5f508c6c1a3d7e88d558e28d58e1ec69
[]
no_license
WilliamWangZi/SpringMvcDemo
https://github.com/WilliamWangZi/SpringMvcDemo
ab98f6527f8d80fcea51ab021da1cc644e9670d6
df99f34d93b61a4b6d74ff448a84707663361fcb
refs/heads/master
2022-01-26T05:31:40.043000
2019-07-20T08:59:33
2019-07-20T08:59:33
197,904,786
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.spring.controller; import com.spring.annoation.Controller; import com.spring.annoation.RequestMapping; @Controller @RequestMapping(value = "/test") public class TestController { @RequestMapping(value = "/testMethod") public String test(){ return "test SpringMVC success"; } }
UTF-8
Java
311
java
TestController.java
Java
[]
null
[]
package com.spring.controller; import com.spring.annoation.Controller; import com.spring.annoation.RequestMapping; @Controller @RequestMapping(value = "/test") public class TestController { @RequestMapping(value = "/testMethod") public String test(){ return "test SpringMVC success"; } }
311
0.729904
0.729904
14
21.214285
16.840336
43
false
false
0
0
0
0
0
0
0.285714
false
false
14
ebeb721c9e68f7278e29cee7eb6511b481cfed3e
37,795,712,216,288
a180423bc551e75fa76ac3ed11925ffb748243ff
/dc-model/src/main/java/de/digitalcollections/model/text/contentblock/ContentBlock.java
95c31587e1389b4212725976d2ee0697ed4fe8dc
[ "MIT" ]
permissive
dbmdz/digitalcollections-model
https://github.com/dbmdz/digitalcollections-model
684e538e5991b394e32dc90f53d5ecdc3accccb1
c18efbe667e0caf01de42580137bc693e63b2415
refs/heads/main
2023-09-04T12:35:35.543000
2023-09-04T04:56:58
2023-09-04T05:49:13
141,161,598
6
2
MIT
false
2023-09-14T15:52:38
2018-07-16T15:59:07
2023-04-15T18:58:35
2023-09-14T15:52:37
4,197
3
2
1
Java
false
false
package de.digitalcollections.model.text.contentblock; public abstract class ContentBlock {}
UTF-8
Java
94
java
ContentBlock.java
Java
[]
null
[]
package de.digitalcollections.model.text.contentblock; public abstract class ContentBlock {}
94
0.840426
0.840426
3
30.333334
22.543785
54
false
false
0
0
0
0
0
0
0.333333
false
false
14
8559ff696eb5cfcd726e2b3860f5bf78a2d61df8
38,852,274,170,386
ef02ceb89976eed1de90d4b11dff99dd2b4c628a
/IndigoService/src/main/java/com/fire/core/bhns/source/options/BaseServiceOption.java
49b37fc0d41b67135b9eca79ce51e1975ba633de
[]
no_license
x163maiaytang/Indigo
https://github.com/x163maiaytang/Indigo
ac37a3b583e081f8629ec571ce8727cfa3cc6786
5a2bdcc84b2a9925ab3e5936d6b116818100fae2
refs/heads/master
2020-03-29T08:20:05.217000
2018-12-06T06:23:08
2018-12-06T06:23:08
149,705,226
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.fire.core.bhns.source.options; import org.apache.log4j.Logger; import com.fire.core.bhns.AbstractSimpleService; import com.fire.core.bhns.IMethodCollection; import com.fire.core.bhns.IServicePortal; import com.fire.core.bhns.ISimpleService; import com.fire.core.bhns.portal.SimpleMethodCollection; import com.fire.core.bhns.proxy.ServiceRemoteProxy; import com.fire.core.bhns.source.IServiceOption; public abstract class BaseServiceOption implements IServiceOption { protected static final Logger logger = Logger.getLogger(BaseServiceOption.class); private final static String POT_PROXY_PACKAGE = "com.fire.game.service.bo.proxy.remoteportal."; private final static String SVR_REMOTE_PROXY_PACKAGE = "com.fire.game.service.bo.proxy.remoteservice."; private final static String SVR_ACTOR_PROXY_PACKAGE = "com.fire.game.service.bo.proxy.actor."; private int _portalId; // 服务标识 private Class<? extends ISimpleService> svrClass;// 服务接口 private Class<? extends IServicePortal> ptoClass;// portal接口 private Class<? extends ISimpleService> svrAcotrProxyClass; private Class<? extends ISimpleService> svrRemoteProxyClass; private Class<? extends IServicePortal> portalRemoteProxyClass; protected IMethodCollection srvMethodMap;// 函数快捷入口 protected IMethodCollection ptoMethodMap; @SuppressWarnings( { "unchecked", "rawtypes" }) public BaseServiceOption(int ptid, Class<? extends ISimpleService> svrclass, Class<? extends IServicePortal> ptoClass) { this._portalId = ptid; this.svrClass = svrclass; this.ptoClass = ptoClass; try { if (svrclass != null) { // svrAcotrProxyClass = (Class<? extends ISimpleService>) Class // .forName(SVR_ACTOR_PROXY_PACKAGE // + svrclass.getSimpleName() + "ActorProxy"); svrRemoteProxyClass = (Class<? extends ISimpleService>) Class .forName(SVR_REMOTE_PROXY_PACKAGE + svrClass.getSimpleName() + "RemoteProxy"); } portalRemoteProxyClass = (Class<? extends IServicePortal>) Class .forName(POT_PROXY_PACKAGE + ptoClass.getSimpleName() + "RemoteProxy"); srvMethodMap = new SimpleMethodCollection(this.svrClass); ptoMethodMap = new SimpleMethodCollection(this.ptoClass); } catch (Exception e) { e.printStackTrace(); } } public int portalId() { return _portalId; } public IMethodCollection getServiceMethodMap() { return srvMethodMap; } public IMethodCollection getPortalMethodMap() { return ptoMethodMap; } public Class<? extends ISimpleService> serviceClass() { return svrClass; } public Class<? extends IServicePortal> portalClass() { return ptoClass; } @Override public Class<? extends ISimpleService> serviceActorProxyClass() { return svrAcotrProxyClass; } @Override public AbstractSimpleService createSvrImpInstance() { if (this.serviceClass() != null) { try { return (AbstractSimpleService<?>) this.serviceClass() .newInstance(); } catch (Exception e) { e.printStackTrace(); } } return null; } @Override public AbstractSimpleService createSvrActorProxyInstance(long serviceId) { try { return (AbstractSimpleService) this.svrAcotrProxyClass .getConstructor(long.class, int.class).newInstance( serviceId, this._portalId); } catch (Exception e) { e.printStackTrace(); } return null; } public AbstractSimpleService createSvrRemoteProxyInstance(long serviceId, ServiceRemoteProxy<?, ?> proxy) { try { return (AbstractSimpleService) this.svrRemoteProxyClass .getConstructor(long.class, ServiceRemoteProxy.class) .newInstance(serviceId, proxy); } catch (Exception e) { e.printStackTrace(); } return null; } @Override public IServicePortal createPortalRemoteProxyInstance(ServiceRemoteProxy<?,?> proxy, IServiceOption serviceOption) { try { return (IServicePortal) this.portalRemoteProxyClass.getConstructor( ServiceRemoteProxy.class, IServiceOption.class).newInstance(proxy, serviceOption); } catch (Exception e) { e.printStackTrace(); } return null; } }
UTF-8
Java
4,108
java
BaseServiceOption.java
Java
[]
null
[]
package com.fire.core.bhns.source.options; import org.apache.log4j.Logger; import com.fire.core.bhns.AbstractSimpleService; import com.fire.core.bhns.IMethodCollection; import com.fire.core.bhns.IServicePortal; import com.fire.core.bhns.ISimpleService; import com.fire.core.bhns.portal.SimpleMethodCollection; import com.fire.core.bhns.proxy.ServiceRemoteProxy; import com.fire.core.bhns.source.IServiceOption; public abstract class BaseServiceOption implements IServiceOption { protected static final Logger logger = Logger.getLogger(BaseServiceOption.class); private final static String POT_PROXY_PACKAGE = "com.fire.game.service.bo.proxy.remoteportal."; private final static String SVR_REMOTE_PROXY_PACKAGE = "com.fire.game.service.bo.proxy.remoteservice."; private final static String SVR_ACTOR_PROXY_PACKAGE = "com.fire.game.service.bo.proxy.actor."; private int _portalId; // 服务标识 private Class<? extends ISimpleService> svrClass;// 服务接口 private Class<? extends IServicePortal> ptoClass;// portal接口 private Class<? extends ISimpleService> svrAcotrProxyClass; private Class<? extends ISimpleService> svrRemoteProxyClass; private Class<? extends IServicePortal> portalRemoteProxyClass; protected IMethodCollection srvMethodMap;// 函数快捷入口 protected IMethodCollection ptoMethodMap; @SuppressWarnings( { "unchecked", "rawtypes" }) public BaseServiceOption(int ptid, Class<? extends ISimpleService> svrclass, Class<? extends IServicePortal> ptoClass) { this._portalId = ptid; this.svrClass = svrclass; this.ptoClass = ptoClass; try { if (svrclass != null) { // svrAcotrProxyClass = (Class<? extends ISimpleService>) Class // .forName(SVR_ACTOR_PROXY_PACKAGE // + svrclass.getSimpleName() + "ActorProxy"); svrRemoteProxyClass = (Class<? extends ISimpleService>) Class .forName(SVR_REMOTE_PROXY_PACKAGE + svrClass.getSimpleName() + "RemoteProxy"); } portalRemoteProxyClass = (Class<? extends IServicePortal>) Class .forName(POT_PROXY_PACKAGE + ptoClass.getSimpleName() + "RemoteProxy"); srvMethodMap = new SimpleMethodCollection(this.svrClass); ptoMethodMap = new SimpleMethodCollection(this.ptoClass); } catch (Exception e) { e.printStackTrace(); } } public int portalId() { return _portalId; } public IMethodCollection getServiceMethodMap() { return srvMethodMap; } public IMethodCollection getPortalMethodMap() { return ptoMethodMap; } public Class<? extends ISimpleService> serviceClass() { return svrClass; } public Class<? extends IServicePortal> portalClass() { return ptoClass; } @Override public Class<? extends ISimpleService> serviceActorProxyClass() { return svrAcotrProxyClass; } @Override public AbstractSimpleService createSvrImpInstance() { if (this.serviceClass() != null) { try { return (AbstractSimpleService<?>) this.serviceClass() .newInstance(); } catch (Exception e) { e.printStackTrace(); } } return null; } @Override public AbstractSimpleService createSvrActorProxyInstance(long serviceId) { try { return (AbstractSimpleService) this.svrAcotrProxyClass .getConstructor(long.class, int.class).newInstance( serviceId, this._portalId); } catch (Exception e) { e.printStackTrace(); } return null; } public AbstractSimpleService createSvrRemoteProxyInstance(long serviceId, ServiceRemoteProxy<?, ?> proxy) { try { return (AbstractSimpleService) this.svrRemoteProxyClass .getConstructor(long.class, ServiceRemoteProxy.class) .newInstance(serviceId, proxy); } catch (Exception e) { e.printStackTrace(); } return null; } @Override public IServicePortal createPortalRemoteProxyInstance(ServiceRemoteProxy<?,?> proxy, IServiceOption serviceOption) { try { return (IServicePortal) this.portalRemoteProxyClass.getConstructor( ServiceRemoteProxy.class, IServiceOption.class).newInstance(proxy, serviceOption); } catch (Exception e) { e.printStackTrace(); } return null; } }
4,108
0.740186
0.739941
157
24.961784
26.700958
115
false
false
0
0
0
0
0
0
2.140127
false
false
14
2f018289e6805ddf32269e5d7deb679d05254d53
39,041,252,744,092
6baf1fe00541560788e78de5244ae17a7a2b375a
/hollywood/com.oculus.bugreporter-OculusBugReporter/sources/java/util/function/BiConsumer.java
d050c230d608d47744e8945faff473b99621cc66
[]
no_license
phwd/quest-tracker
https://github.com/phwd/quest-tracker
286e605644fc05f00f4904e51f73d77444a78003
3d46fbb467ba11bee5827f7cae7dfeabeb1fd2ba
refs/heads/main
2023-03-29T20:33:10.959000
2021-04-10T22:14:11
2021-04-10T22:14:11
357,185,040
4
2
null
true
2021-04-12T12:28:09
2021-04-12T12:28:08
2021-04-10T22:15:44
2021-04-10T22:15:39
116,441
0
0
0
null
false
false
package java.util.function; import java.util.Objects; @FunctionalInterface public interface BiConsumer<T, U> { void accept(T t, U u); default BiConsumer<T, U> andThen(BiConsumer<? super T, ? super U> after) { Objects.requireNonNull(after); return new BiConsumer(after) { /* class java.util.function.$$Lambda$BiConsumer$V89VXFfSN6jmLaAoQrZCMiBju4 */ private final /* synthetic */ BiConsumer f$1; { this.f$1 = r2; } @Override // java.util.function.BiConsumer public final void accept(Object obj, Object obj2) { BiConsumer.lambda$andThen$0(BiConsumer.this, this.f$1, obj, obj2); } }; } /* JADX INFO: Multiple debug info for r0v0 java.util.function.BiConsumer: [D('_this' java.util.function.BiConsumer), D('this' java.util.function.BiConsumer<T, U>)] */ static /* synthetic */ default void lambda$andThen$0(BiConsumer _this, BiConsumer after, Object l, Object r) { _this.accept(l, r); after.accept(l, r); } }
UTF-8
Java
1,091
java
BiConsumer.java
Java
[]
null
[]
package java.util.function; import java.util.Objects; @FunctionalInterface public interface BiConsumer<T, U> { void accept(T t, U u); default BiConsumer<T, U> andThen(BiConsumer<? super T, ? super U> after) { Objects.requireNonNull(after); return new BiConsumer(after) { /* class java.util.function.$$Lambda$BiConsumer$V89VXFfSN6jmLaAoQrZCMiBju4 */ private final /* synthetic */ BiConsumer f$1; { this.f$1 = r2; } @Override // java.util.function.BiConsumer public final void accept(Object obj, Object obj2) { BiConsumer.lambda$andThen$0(BiConsumer.this, this.f$1, obj, obj2); } }; } /* JADX INFO: Multiple debug info for r0v0 java.util.function.BiConsumer: [D('_this' java.util.function.BiConsumer), D('this' java.util.function.BiConsumer<T, U>)] */ static /* synthetic */ default void lambda$andThen$0(BiConsumer _this, BiConsumer after, Object l, Object r) { _this.accept(l, r); after.accept(l, r); } }
1,091
0.610449
0.597617
31
34.19355
38.551533
170
false
false
0
0
0
0
0
0
0.806452
false
false
14
c576f551bb40c5389b11a73730483df621f64ff8
3,917,010,240,182
c4a14d70951d7ec5aac7fe7ebb2db891cfe6c0b1
/modulos/apps/LOCALGIS-Workbench/src/main/java/com/vividsolutions/jump/parameter/ParameterListSchema.java
cf65d4ee035612041fed149fc373e1d02e823d5e
[]
no_license
pepeysusmapas/allocalgis
https://github.com/pepeysusmapas/allocalgis
925756321b695066775acd012f9487cb0725fcde
c14346d877753ca17339f583d469dbac444ffa98
refs/heads/master
2020-09-14T20:15:26.459000
2016-09-27T10:08:32
2016-09-27T10:08:32
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * ParameterListSchema.java * © MINETUR, Government of Spain * This program is part of LocalGIS * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.vividsolutions.jump.parameter; import java.util.HashMap; import java.util.Map; /** * The schema for a {@link ParameterList}. * Parameter names should be case-retentive (i.e. comparisons are case-insensitive, * but the case is maintained). */ public class ParameterListSchema { private String[] paramNames; private Class[] paramClasses; private Map nameMap = new HashMap(); public ParameterListSchema(String[] paramNames, Class[] paramClasses) { initialize(paramNames, paramClasses); } protected ParameterListSchema initialize(String[] paramNames, Class[] paramClasses) { this.paramNames = paramNames; this.paramClasses = paramClasses; for (int i = 0; i < paramNames.length; i++) { nameMap.put(paramNames[i], new Integer(i)); } return this; } public String[] getNames() { return paramNames; } public Class[] getClasses() { return paramClasses; } public boolean isValidName(String name) { return nameMap.containsKey(name); } public boolean equals(Object obj) { return equals((ParameterListSchema)obj); } private boolean equals(ParameterListSchema other) { if (paramNames.length != other.paramNames.length) { return false; } for (int i = 0; i < paramNames.length; i++) { if (!paramNames[i].equals(other.paramNames[i])) { return false; } } for (int i = 0; i < paramNames.length; i++) { if (paramClasses[i] != other.paramClasses[i]) { return false; } } return true; } public Class getClass(String name) { return paramClasses[((Integer)nameMap.get(name)).intValue()]; } }
WINDOWS-1252
Java
2,412
java
ParameterListSchema.java
Java
[ { "context": "/**\r\n * ParameterListSchema.java\r\n * © MINETUR, Government of Spain\r\n * This program is part of ", "end": 46, "score": 0.6535536646842957, "start": 39, "tag": "NAME", "value": "MINETUR" } ]
null
[]
/** * ParameterListSchema.java * © MINETUR, Government of Spain * This program is part of LocalGIS * This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ package com.vividsolutions.jump.parameter; import java.util.HashMap; import java.util.Map; /** * The schema for a {@link ParameterList}. * Parameter names should be case-retentive (i.e. comparisons are case-insensitive, * but the case is maintained). */ public class ParameterListSchema { private String[] paramNames; private Class[] paramClasses; private Map nameMap = new HashMap(); public ParameterListSchema(String[] paramNames, Class[] paramClasses) { initialize(paramNames, paramClasses); } protected ParameterListSchema initialize(String[] paramNames, Class[] paramClasses) { this.paramNames = paramNames; this.paramClasses = paramClasses; for (int i = 0; i < paramNames.length; i++) { nameMap.put(paramNames[i], new Integer(i)); } return this; } public String[] getNames() { return paramNames; } public Class[] getClasses() { return paramClasses; } public boolean isValidName(String name) { return nameMap.containsKey(name); } public boolean equals(Object obj) { return equals((ParameterListSchema)obj); } private boolean equals(ParameterListSchema other) { if (paramNames.length != other.paramNames.length) { return false; } for (int i = 0; i < paramNames.length; i++) { if (!paramNames[i].equals(other.paramNames[i])) { return false; } } for (int i = 0; i < paramNames.length; i++) { if (paramClasses[i] != other.paramClasses[i]) { return false; } } return true; } public Class getClass(String name) { return paramClasses[((Integer)nameMap.get(name)).intValue()]; } }
2,412
0.688096
0.686437
63
36.301586
46.103622
242
false
false
0
0
0
0
0
0
0.587302
false
false
14
727f6502fc0ad8d20b36337e8796bc2c71f5583a
23,149,873,795,000
1051167756891ca3eff7284bcd07db28d379be7e
/fixture-factory/src/main/java/br/com/abevieiramota/fixture_factory/model/Turma.java
29596cd41f7494faa15b443da8c3e0b2ce2ad583
[]
no_license
abevieiramota/learning-fixture-factory
https://github.com/abevieiramota/learning-fixture-factory
73eb6a739ef4727f720d914d72810a858ca0d56b
7e93bb427c6742e1a9031b8302e0e4fb209e84e6
refs/heads/master
2017-10-14T22:39:30.235000
2017-03-28T13:40:33
2017-03-28T13:40:33
86,465,338
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package br.com.abevieiramota.fixture_factory.model; import java.util.Collection; public class Turma { private Collection<Discente> discentes; private Docente docente; public Collection<Discente> getDiscentes() { return discentes; } public void setDiscentes(Collection<Discente> discentes) { this.discentes = discentes; } public Docente getDocente() { return docente; } public void setDocente(Docente docente) { this.docente = docente; } }
UTF-8
Java
462
java
Turma.java
Java
[]
null
[]
package br.com.abevieiramota.fixture_factory.model; import java.util.Collection; public class Turma { private Collection<Discente> discentes; private Docente docente; public Collection<Discente> getDiscentes() { return discentes; } public void setDiscentes(Collection<Discente> discentes) { this.discentes = discentes; } public Docente getDocente() { return docente; } public void setDocente(Docente docente) { this.docente = docente; } }
462
0.755411
0.755411
22
20
18.480947
59
false
false
0
0
0
0
0
0
1.227273
false
false
14
4a80c74e4b9db3cadeae68144c06134bda361942
21,492,016,419,803
87ee4600e16515b2d557fecb57166d82d6fd4fed
/src/SEP2/src/client/view/UserProfileController.java
4eaaade5fd9089054b0bea9ec5f94aae25e43421
[]
no_license
Igork777/Social-media-for-musicians
https://github.com/Igork777/Social-media-for-musicians
73065676813fc86a1e2b6d6525279ea2e422fe29
552a321425e8116debc4f02fb695e957e3b0453d
refs/heads/master
2022-11-20T11:40:37.611000
2021-11-18T16:24:05
2021-11-18T16:24:05
281,729,218
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package client.view; import client.core.ViewHandler; import client.core.ViewModelFactory; import client.viewModel.UserViewModel; import javafx.fxml.FXML; import javafx.scene.control.Label; import javafx.scene.input.MouseEvent; public class UserProfileController extends ViewController { @FXML private Label nameId; @FXML private Label cityId; @FXML private Label dateOfBirthId; @FXML private Label regionId; private ViewHandler viewHandler; private UserViewModel userViewModel; /** * The method which assigns viewModelFactory and viewHandler * to the local variables * Also text fields from view layer bind with the text properties from the view model layer * @param viewModelFactory parameter, in order to have the connection with the model layer * @param viewHandler parameter, in order to change views */ @Override public void init(ViewModelFactory viewModelFactory, ViewHandler viewHandler) { this.viewHandler = viewHandler; userViewModel = viewModelFactory.getUserViewModel(); nameId.textProperty().bind(userViewModel.nameProperty()); cityId.textProperty().bind(userViewModel.cityProperty()); dateOfBirthId.textProperty().bind(userViewModel.dateOfBirthProperty()); regionId.textProperty().bind(userViewModel.regionProperty()); userViewModel.feed(); } }
UTF-8
Java
1,410
java
UserProfileController.java
Java
[]
null
[]
package client.view; import client.core.ViewHandler; import client.core.ViewModelFactory; import client.viewModel.UserViewModel; import javafx.fxml.FXML; import javafx.scene.control.Label; import javafx.scene.input.MouseEvent; public class UserProfileController extends ViewController { @FXML private Label nameId; @FXML private Label cityId; @FXML private Label dateOfBirthId; @FXML private Label regionId; private ViewHandler viewHandler; private UserViewModel userViewModel; /** * The method which assigns viewModelFactory and viewHandler * to the local variables * Also text fields from view layer bind with the text properties from the view model layer * @param viewModelFactory parameter, in order to have the connection with the model layer * @param viewHandler parameter, in order to change views */ @Override public void init(ViewModelFactory viewModelFactory, ViewHandler viewHandler) { this.viewHandler = viewHandler; userViewModel = viewModelFactory.getUserViewModel(); nameId.textProperty().bind(userViewModel.nameProperty()); cityId.textProperty().bind(userViewModel.cityProperty()); dateOfBirthId.textProperty().bind(userViewModel.dateOfBirthProperty()); regionId.textProperty().bind(userViewModel.regionProperty()); userViewModel.feed(); } }
1,410
0.733333
0.733333
43
31.790697
27.321989
95
false
false
0
0
0
0
0
0
0.534884
false
false
14
88a25f0361352a41e18b76c4ddb4bd5746cd026b
16,733,192,655,072
4c91b6e1551cd02a739b942a0c1d289b0a52a1ba
/Oude Oefententamens/Startproject-Brouwerij-Voorkennis-Electrische-Autos/Oefentoets/src/nl/hva/ict/oop2/deel2/Trappist.java
59373c4721a0dacfdd0e76183e4b14257bcd7990
[]
no_license
CocoHuissoon/oldprojects
https://github.com/CocoHuissoon/oldprojects
983078ac6172cca5e1ad9e04c385a9e696ee0924
872ce2ed73e756435f32fa14416b72af7a5106dc
refs/heads/master
2022-12-05T07:27:05.367000
2019-09-01T14:29:53
2019-09-01T14:29:53
205,686,427
0
0
null
false
2022-11-24T09:45:36
2019-09-01T14:17:26
2019-09-01T14:30:29
2022-11-24T09:45:33
46,449
0
0
6
JavaScript
false
false
package nl.hva.ict.oop2.deel2; import nl.hva.ict.oop2.deel1.Biertype; public class Trappist extends Biertype { private String naam; public Trappist(String naam) { super(); this.naam = naam; } @Override public void rijp() { rijpweken++; System.out.printf(" Trappist %s rijpt nu %d weken \n",this.naam, this.rijpweken); } }
UTF-8
Java
347
java
Trappist.java
Java
[]
null
[]
package nl.hva.ict.oop2.deel2; import nl.hva.ict.oop2.deel1.Biertype; public class Trappist extends Biertype { private String naam; public Trappist(String naam) { super(); this.naam = naam; } @Override public void rijp() { rijpweken++; System.out.printf(" Trappist %s rijpt nu %d weken \n",this.naam, this.rijpweken); } }
347
0.682997
0.67147
22
14.772727
19.824072
83
false
false
0
0
0
0
0
0
1.181818
false
false
14
dd3e7afe12e325cc5f74dafebcf9fc60763a6081
13,580,686,626,493
dc12f678172695132831df7e193d330bcb100c16
/src/main/java/com/ucams/modules/gen/dao/GenTableColumnDao.java
af05f31ee59cbb48acc1046cef2d5bd1961bb9ad
[]
no_license
sunjxer/UCAMS
https://github.com/sunjxer/UCAMS
d50b791c37d6c4e6587b7ad8d59b3e1d53d3ea20
46ad194aaa8a370e2d97c6c62d7a946ee2c54d3d
refs/heads/master
2021-04-12T11:41:51.511000
2018-03-21T09:20:58
2018-03-21T09:20:58
126,133,325
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * Copyright &copy; Ucams All rights reserved. */ package com.ucams.modules.gen.dao; import com.ucams.common.persistence.CrudDao; import com.ucams.common.persistence.annotation.MyBatisDao; import com.ucams.modules.gen.entity.GenTableColumn; /** * 业务表字段DAO接口 * @author zhuye * @version 2013-10-15 */ @MyBatisDao public interface GenTableColumnDao extends CrudDao<GenTableColumn> { public void deleteByGenTableId(String genTableId); }
UTF-8
Java
461
java
GenTableColumnDao.java
Java
[ { "context": "tity.GenTableColumn;\n\n/**\n * 业务表字段DAO接口\n * @author zhuye\n * @version 2013-10-15\n */\n@MyBatisDao\npublic int", "end": 282, "score": 0.999641478061676, "start": 277, "tag": "USERNAME", "value": "zhuye" } ]
null
[]
/** * Copyright &copy; Ucams All rights reserved. */ package com.ucams.modules.gen.dao; import com.ucams.common.persistence.CrudDao; import com.ucams.common.persistence.annotation.MyBatisDao; import com.ucams.modules.gen.entity.GenTableColumn; /** * 业务表字段DAO接口 * @author zhuye * @version 2013-10-15 */ @MyBatisDao public interface GenTableColumnDao extends CrudDao<GenTableColumn> { public void deleteByGenTableId(String genTableId); }
461
0.774049
0.756152
19
22.526316
22.739645
68
false
false
0
0
0
0
0
0
0.421053
false
false
14
56f5f66f3848d366ce09a45efb8ae72345398547
16,569,983,835,304
14c0b74e99a1b793071897ffc84526e9c7e13a12
/TimeConversion.java
7e4d044fa2ba861da3ab842a0a2f99061caa07de
[]
no_license
RajagurunathanM/HackerRankProblems
https://github.com/RajagurunathanM/HackerRankProblems
25103f1d379568c1d6fd632d8e2de2a3fc4c187d
9fc8a5eac5eabfbbdf3cd3d0b892f3f7d6c2bf7e
refs/heads/master
2022-06-08T12:52:40.640000
2020-05-06T12:53:18
2020-05-06T12:53:18
261,754,357
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
import java.util.*; class TimeConversion { static String time(String s) { String result=""; if('A'==s.charAt(8)) { int val=Integer.valueOf(s.substring(0,2)); if(val == 12) { result= "00"+s.substring(2,8); } else { result=s.substring(0,8); } } else { int val=Integer.valueOf(s.substring(0,2)); if(val == 12) { result= s.substring(0,8); } if(val>12) { result= String.valueOf((val+11)) + s.substring(2,8); } if(val<12) { result= String.valueOf((val+12)) + s.substring(2,8); } } return result; } public static void main(String[] args) { Scanner x = new Scanner(System.in); String s = x.next(); String result; System.out.println(result = time(s)); } }
UTF-8
Java
875
java
TimeConversion.java
Java
[]
null
[]
import java.util.*; class TimeConversion { static String time(String s) { String result=""; if('A'==s.charAt(8)) { int val=Integer.valueOf(s.substring(0,2)); if(val == 12) { result= "00"+s.substring(2,8); } else { result=s.substring(0,8); } } else { int val=Integer.valueOf(s.substring(0,2)); if(val == 12) { result= s.substring(0,8); } if(val>12) { result= String.valueOf((val+11)) + s.substring(2,8); } if(val<12) { result= String.valueOf((val+12)) + s.substring(2,8); } } return result; } public static void main(String[] args) { Scanner x = new Scanner(System.in); String s = x.next(); String result; System.out.println(result = time(s)); } }
875
0.486857
0.453714
64
11.703125
14.456486
56
false
false
0
0
0
0
0
0
2.609375
false
false
14
487907c7bc59ceb355f8b3c6529f20d05c58bef5
20,581,483,306,597
85691df7c641fe1848a8a6c7ec4c81203ab21f39
/youran-generate-web/src/main/java/com/youran/generate/web/ws/MetaCodeGenWsController.java
05c3e244318c0be65116f05f84104e9e13c1ea25
[ "Apache-2.0" ]
permissive
cai3178940/youran
https://github.com/cai3178940/youran
4f9d7967b13999bdf923dfebfd784ef73c49e55a
d643df782e6d358e074358fdd533f94ea2f08ad9
refs/heads/master
2022-12-21T09:10:54.238000
2022-10-02T08:18:01
2022-10-02T08:18:01
165,246,320
133
63
Apache-2.0
false
2022-10-02T08:19:52
2019-01-11T13:14:16
2022-08-04T11:07:20
2022-10-02T08:19:50
28,254
113
57
3
Java
false
false
package com.youran.generate.web.ws; import com.youran.common.constant.ErrorCode; import com.youran.common.exception.BusinessException; import com.youran.common.util.DateUtil; import com.youran.generate.config.GenerateAuthentication; import com.youran.generate.constant.WebConst; import com.youran.generate.pojo.po.GenHistoryPO; import com.youran.generate.pojo.vo.ProgressVO; import com.youran.generate.service.MetaCodeGenService; import com.youran.generate.service.MetaProjectService; import com.youran.generate.web.AbstractController; import io.swagger.annotations.Api; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.messaging.handler.annotation.DestinationVariable; import org.springframework.messaging.handler.annotation.Header; import org.springframework.messaging.handler.annotation.MessageMapping; import org.springframework.messaging.simp.SimpMessagingTemplate; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import javax.servlet.http.HttpServletResponse; import java.io.File; import java.util.Date; import java.util.LinkedHashMap; import java.util.Map; /** * 【代码生成】websocket控制器 * * @author: cbb * @date: 2017/5/13 */ @Controller @Api(tags = "【代码生成websocket专用】API") public class MetaCodeGenWsController extends AbstractController { private static final Logger LOGGER = LoggerFactory.getLogger(MetaCodeGenWsController.class); @Autowired private SimpMessagingTemplate template; @Autowired private MetaCodeGenService metaCodeGenService; @Autowired private MetaProjectService metaProjectService; /** * 简单实现一个LRU缓存 * 保存生成的代码压缩包地址 * key:sessionId * value:[projectId,zipFilePath] */ private LinkedHashMap<String, Object[]> lruCache = new LinkedHashMap<String, Object[]>() { @Override protected boolean removeEldestEntry(Map.Entry<String, Object[]> eldest) { return size() > 100; } }; /** * websocket服务:只生成代码 * * @param sessionId websocket连接id * @param projectId 项目id * @param templateId 模板id * @param authentication 当前用户授权信息 */ @MessageMapping(value = "/gen_code/{sessionId}") public void genCode(@DestinationVariable String sessionId, @Header Integer projectId, @Header Integer templateId, GenerateAuthentication authentication) { this.checkAuthentication(authentication); // 进度响应主题 String topic = "/code_gen/gen_code_progress/" + sessionId; try { // 初始化进度条 ProgressVO.initProgress(sessionId); // 生成代码压缩包 metaCodeGenService.genProjectCodeIfNotExists(projectId, templateId, progressVO -> this.replyProgress(topic, progressVO)); this.replyProgress(topic, ProgressVO.success("代码生成完毕")); } catch (BusinessException e) { // 如果捕获到异常,则将异常也通知给前端浏览器 this.replyProgress(topic, ProgressVO.error(e.getMessage())); } catch (Throwable e) { // 如果捕获到异常,则将异常也通知给前端浏览器 this.replyProgress(topic, ProgressVO.error("系统内部错误")); LOGGER.error("代码生成异常", e); } } /** * websocket服务:生成代码并打压缩包 * * @param sessionId websocket连接id * @param projectId 项目id * @param templateId 模板id * @param authentication 当前用户授权信息 */ @MessageMapping(value = "/gen_code_and_zip/{sessionId}") public void genCodeAndZip(@DestinationVariable String sessionId, @Header Integer projectId, @Header Integer templateId, GenerateAuthentication authentication) { this.checkAuthentication(authentication); // 进度响应主题 String topic = "/code_gen/gen_code_and_zip_progress/" + sessionId; try { // 初始化进度条 ProgressVO.initProgress(sessionId); // 生成代码压缩包 File zipFile = metaCodeGenService.genCodeZip(projectId, templateId, progressVO -> this.replyProgress(topic, progressVO)); // 将zip文件路径存入缓存,随后浏览器就能下载了 lruCache.put(sessionId, new Object[]{projectId, zipFile.getPath()}); this.replyProgress(topic, ProgressVO.success("代码生成完毕")); } catch (BusinessException e) { // 如果捕获到异常,则将异常也通知给前端浏览器 this.replyProgress(topic, ProgressVO.error(e.getMessage())); } catch (Throwable e) { // 如果捕获到异常,则将异常也通知给前端浏览器 this.replyProgress(topic, ProgressVO.error("系统内部错误")); LOGGER.error("代码生成异常", e); } } /** * http服务-下载代码 * 代码生成完以后,浏览器调用该服务下载代码 * * @param sessionId * @param response */ @GetMapping(value = WebConst.API_PATH + "/code_gen/download_code/{sessionId}") public void downloadCode(@PathVariable String sessionId, HttpServletResponse response) { File zipFile = null; Integer projectId = null; Object[] arr = lruCache.get(sessionId); if (arr != null) { projectId = (Integer) arr[0]; String zipFilePath = (String) arr[1]; zipFile = new File(zipFilePath); } if (zipFile == null || !zipFile.exists()) { this.replyNotFound(response); } else { String normalProjectName = metaProjectService.getNormalProjectName(projectId); String downloadFileName = normalProjectName + DateUtil.getDateStr(new Date(), "yyyyMMddHHmmss") + ".zip"; this.replyDownloadFile(response, zipFile, downloadFileName); } } /** * websocket服务:提交Git * * @param sessionId websocket连接id * @param projectId 项目id * @param templateId 模板id * @param authentication 当前用户授权信息 */ @MessageMapping(value = "/git_commit/{sessionId}") public void gitCommit(@DestinationVariable String sessionId, @Header Integer projectId, @Header Integer templateId, GenerateAuthentication authentication) { this.checkAuthentication(authentication); // 进度响应主题 String topic = "/code_gen/git_commit_progress/" + sessionId; try { // 初始化进度条 ProgressVO.initProgress(sessionId); // 提交到仓库 GenHistoryPO history = metaCodeGenService.gitCommit(projectId, templateId, progressVO -> this.replyProgress(topic, progressVO)); this.replyProgress(topic, ProgressVO.success("已在【" + history.getBranch() + "】分支提交最新代码,并push到远程")); } catch (BusinessException e) { // 如果捕获到异常,则将异常也通知给前端浏览器 this.replyProgress(topic, ProgressVO.error(e.getMessage())); } catch (Exception e) { // 如果捕获到异常,则将异常也通知给前端浏览器 this.replyProgress(topic, ProgressVO.error("系统内部错误")); LOGGER.error("提交Git异常", e); } } /** * websocket服务:显示git代码差异 * * @param sessionId websocket连接id * @param projectId 项目id * @param templateId 模板id * @param authentication 当前用户授权信息 */ @MessageMapping(value = "/git_diff/{sessionId}") public void gitDiff(@DestinationVariable String sessionId, @Header Integer projectId, @Header Integer templateId, GenerateAuthentication authentication) { this.checkAuthentication(authentication); // 进度响应主题 String topic = "/code_gen/git_diff_progress/" + sessionId; try { // 初始化进度条 ProgressVO.initProgress(sessionId); // 提交到仓库 String diffText = metaCodeGenService.showGitDiff(projectId, templateId, progressVO -> this.replyProgress(topic, progressVO)); this.replyProgress(topic, ProgressVO.success("成功获取代码差异", diffText)); } catch (BusinessException e) { // 如果捕获到异常,则将异常也通知给前端浏览器 this.replyProgress(topic, ProgressVO.error(e.getMessage())); } catch (Exception e) { // 如果捕获到异常,则将异常也通知给前端浏览器 this.replyProgress(topic, ProgressVO.error("系统内部错误")); LOGGER.error("提交Git异常", e); } } /** * 将进度发送给某个topic * 由前端浏览器接收 * * @param topic 主题 * @param vo 进度 */ private void replyProgress(String topic, ProgressVO vo) { // 如果前端浏览器监听了topic主题,就能收到进度消息 this.template.convertAndSend(topic, vo); } /** * 校验用户权限 * * @param authentication */ private void checkAuthentication(GenerateAuthentication authentication) { if (authentication == null) { LOGGER.error("无操作权限"); throw new BusinessException(ErrorCode.UNAUTHORIZED); } } }
UTF-8
Java
10,143
java
MetaCodeGenWsController.java
Java
[ { "context": "til.Map;\n\n/**\n * 【代码生成】websocket控制器\n *\n * @author: cbb\n * @date: 2017/5/13\n */\n@Controller\n@Api(tags = \"", "end": 1331, "score": 0.999447762966156, "start": 1328, "tag": "USERNAME", "value": "cbb" }, { "context": " * 简单实现一个LRU缓存\n * 保存生成的代码压缩包地址\n * key:sessionId\n * value:[projectId,zipFilePath]\n */\n ", "end": 1828, "score": 0.8960883021354675, "start": 1819, "tag": "KEY", "value": "sessionId" } ]
null
[]
package com.youran.generate.web.ws; import com.youran.common.constant.ErrorCode; import com.youran.common.exception.BusinessException; import com.youran.common.util.DateUtil; import com.youran.generate.config.GenerateAuthentication; import com.youran.generate.constant.WebConst; import com.youran.generate.pojo.po.GenHistoryPO; import com.youran.generate.pojo.vo.ProgressVO; import com.youran.generate.service.MetaCodeGenService; import com.youran.generate.service.MetaProjectService; import com.youran.generate.web.AbstractController; import io.swagger.annotations.Api; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.messaging.handler.annotation.DestinationVariable; import org.springframework.messaging.handler.annotation.Header; import org.springframework.messaging.handler.annotation.MessageMapping; import org.springframework.messaging.simp.SimpMessagingTemplate; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import javax.servlet.http.HttpServletResponse; import java.io.File; import java.util.Date; import java.util.LinkedHashMap; import java.util.Map; /** * 【代码生成】websocket控制器 * * @author: cbb * @date: 2017/5/13 */ @Controller @Api(tags = "【代码生成websocket专用】API") public class MetaCodeGenWsController extends AbstractController { private static final Logger LOGGER = LoggerFactory.getLogger(MetaCodeGenWsController.class); @Autowired private SimpMessagingTemplate template; @Autowired private MetaCodeGenService metaCodeGenService; @Autowired private MetaProjectService metaProjectService; /** * 简单实现一个LRU缓存 * 保存生成的代码压缩包地址 * key:sessionId * value:[projectId,zipFilePath] */ private LinkedHashMap<String, Object[]> lruCache = new LinkedHashMap<String, Object[]>() { @Override protected boolean removeEldestEntry(Map.Entry<String, Object[]> eldest) { return size() > 100; } }; /** * websocket服务:只生成代码 * * @param sessionId websocket连接id * @param projectId 项目id * @param templateId 模板id * @param authentication 当前用户授权信息 */ @MessageMapping(value = "/gen_code/{sessionId}") public void genCode(@DestinationVariable String sessionId, @Header Integer projectId, @Header Integer templateId, GenerateAuthentication authentication) { this.checkAuthentication(authentication); // 进度响应主题 String topic = "/code_gen/gen_code_progress/" + sessionId; try { // 初始化进度条 ProgressVO.initProgress(sessionId); // 生成代码压缩包 metaCodeGenService.genProjectCodeIfNotExists(projectId, templateId, progressVO -> this.replyProgress(topic, progressVO)); this.replyProgress(topic, ProgressVO.success("代码生成完毕")); } catch (BusinessException e) { // 如果捕获到异常,则将异常也通知给前端浏览器 this.replyProgress(topic, ProgressVO.error(e.getMessage())); } catch (Throwable e) { // 如果捕获到异常,则将异常也通知给前端浏览器 this.replyProgress(topic, ProgressVO.error("系统内部错误")); LOGGER.error("代码生成异常", e); } } /** * websocket服务:生成代码并打压缩包 * * @param sessionId websocket连接id * @param projectId 项目id * @param templateId 模板id * @param authentication 当前用户授权信息 */ @MessageMapping(value = "/gen_code_and_zip/{sessionId}") public void genCodeAndZip(@DestinationVariable String sessionId, @Header Integer projectId, @Header Integer templateId, GenerateAuthentication authentication) { this.checkAuthentication(authentication); // 进度响应主题 String topic = "/code_gen/gen_code_and_zip_progress/" + sessionId; try { // 初始化进度条 ProgressVO.initProgress(sessionId); // 生成代码压缩包 File zipFile = metaCodeGenService.genCodeZip(projectId, templateId, progressVO -> this.replyProgress(topic, progressVO)); // 将zip文件路径存入缓存,随后浏览器就能下载了 lruCache.put(sessionId, new Object[]{projectId, zipFile.getPath()}); this.replyProgress(topic, ProgressVO.success("代码生成完毕")); } catch (BusinessException e) { // 如果捕获到异常,则将异常也通知给前端浏览器 this.replyProgress(topic, ProgressVO.error(e.getMessage())); } catch (Throwable e) { // 如果捕获到异常,则将异常也通知给前端浏览器 this.replyProgress(topic, ProgressVO.error("系统内部错误")); LOGGER.error("代码生成异常", e); } } /** * http服务-下载代码 * 代码生成完以后,浏览器调用该服务下载代码 * * @param sessionId * @param response */ @GetMapping(value = WebConst.API_PATH + "/code_gen/download_code/{sessionId}") public void downloadCode(@PathVariable String sessionId, HttpServletResponse response) { File zipFile = null; Integer projectId = null; Object[] arr = lruCache.get(sessionId); if (arr != null) { projectId = (Integer) arr[0]; String zipFilePath = (String) arr[1]; zipFile = new File(zipFilePath); } if (zipFile == null || !zipFile.exists()) { this.replyNotFound(response); } else { String normalProjectName = metaProjectService.getNormalProjectName(projectId); String downloadFileName = normalProjectName + DateUtil.getDateStr(new Date(), "yyyyMMddHHmmss") + ".zip"; this.replyDownloadFile(response, zipFile, downloadFileName); } } /** * websocket服务:提交Git * * @param sessionId websocket连接id * @param projectId 项目id * @param templateId 模板id * @param authentication 当前用户授权信息 */ @MessageMapping(value = "/git_commit/{sessionId}") public void gitCommit(@DestinationVariable String sessionId, @Header Integer projectId, @Header Integer templateId, GenerateAuthentication authentication) { this.checkAuthentication(authentication); // 进度响应主题 String topic = "/code_gen/git_commit_progress/" + sessionId; try { // 初始化进度条 ProgressVO.initProgress(sessionId); // 提交到仓库 GenHistoryPO history = metaCodeGenService.gitCommit(projectId, templateId, progressVO -> this.replyProgress(topic, progressVO)); this.replyProgress(topic, ProgressVO.success("已在【" + history.getBranch() + "】分支提交最新代码,并push到远程")); } catch (BusinessException e) { // 如果捕获到异常,则将异常也通知给前端浏览器 this.replyProgress(topic, ProgressVO.error(e.getMessage())); } catch (Exception e) { // 如果捕获到异常,则将异常也通知给前端浏览器 this.replyProgress(topic, ProgressVO.error("系统内部错误")); LOGGER.error("提交Git异常", e); } } /** * websocket服务:显示git代码差异 * * @param sessionId websocket连接id * @param projectId 项目id * @param templateId 模板id * @param authentication 当前用户授权信息 */ @MessageMapping(value = "/git_diff/{sessionId}") public void gitDiff(@DestinationVariable String sessionId, @Header Integer projectId, @Header Integer templateId, GenerateAuthentication authentication) { this.checkAuthentication(authentication); // 进度响应主题 String topic = "/code_gen/git_diff_progress/" + sessionId; try { // 初始化进度条 ProgressVO.initProgress(sessionId); // 提交到仓库 String diffText = metaCodeGenService.showGitDiff(projectId, templateId, progressVO -> this.replyProgress(topic, progressVO)); this.replyProgress(topic, ProgressVO.success("成功获取代码差异", diffText)); } catch (BusinessException e) { // 如果捕获到异常,则将异常也通知给前端浏览器 this.replyProgress(topic, ProgressVO.error(e.getMessage())); } catch (Exception e) { // 如果捕获到异常,则将异常也通知给前端浏览器 this.replyProgress(topic, ProgressVO.error("系统内部错误")); LOGGER.error("提交Git异常", e); } } /** * 将进度发送给某个topic * 由前端浏览器接收 * * @param topic 主题 * @param vo 进度 */ private void replyProgress(String topic, ProgressVO vo) { // 如果前端浏览器监听了topic主题,就能收到进度消息 this.template.convertAndSend(topic, vo); } /** * 校验用户权限 * * @param authentication */ private void checkAuthentication(GenerateAuthentication authentication) { if (authentication == null) { LOGGER.error("无操作权限"); throw new BusinessException(ErrorCode.UNAUTHORIZED); } } }
10,143
0.628215
0.62667
250
35.236
25.418188
117
false
false
0
0
0
0
0
0
0.536
false
false
14
5c8db9827c5fee37d89ac0c46067337ce285e5e0
31,688,268,772,164
8b317e93eda0a7d07d94520d9de3cebad243e03c
/app/src/main/java/com/shoujia/zhangshangxiu/history/HistoryActivity.java
aa0816509aaaf0611f82bd73042789374ffd3987
[]
no_license
wutongyuqq/zhangshangxiu-new
https://github.com/wutongyuqq/zhangshangxiu-new
1f382af0503987eb5dfec3ec2a6680bf007f09d6
892e256806266e73bd5873d8e1e3ec78c38c38f9
refs/heads/master
2021-07-03T01:32:23.323000
2020-12-07T21:59:36
2020-12-07T21:59:36
203,604,610
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.shoujia.zhangshangxiu.history; import android.content.Intent; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.os.Bundle; import android.text.TextUtils; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.widget.AdapterView; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.PopupWindow; import android.widget.TextView; import com.shoujia.zhangshangxiu.R; import com.shoujia.zhangshangxiu.base.BaseActivity; import com.shoujia.zhangshangxiu.car.CarListActivity; import com.shoujia.zhangshangxiu.db.DBManager; import com.shoujia.zhangshangxiu.entity.ManageInfo; import com.shoujia.zhangshangxiu.entity.OrderBean; import com.shoujia.zhangshangxiu.history.adapter.HistoryListAdapter; import com.shoujia.zhangshangxiu.history.help.HistoryDataHelper; import com.shoujia.zhangshangxiu.manager.help.ManageDataHelper; import com.shoujia.zhangshangxiu.order.ProjectOrderActivity; import com.shoujia.zhangshangxiu.order.adapter.WxgzListAdapter; import com.shoujia.zhangshangxiu.support.InfoSupport; import com.shoujia.zhangshangxiu.support.NavSupport; import com.shoujia.zhangshangxiu.util.Constance; import com.shoujia.zhangshangxiu.util.DateUtil; import com.shoujia.zhangshangxiu.util.SharePreferenceManager; import com.shoujia.zhangshangxiu.util.Util; import com.shoujia.zhangshangxiu.view.CustomDatePicker; import java.util.ArrayList; import java.util.List; /** * Created by Administrator on 2017/2/23 0023. * 首页 */ public class HistoryActivity extends BaseActivity implements View.OnClickListener{ private final String TAG = "HomeActivity"; private NavSupport navSupport; private List<ManageInfo> mInfoList; List<ManageInfo> mTotalBeans; private List<ManageInfo> manageInfoList; private HistoryListAdapter carListAdapter; ListView mListview; TextView select_date_start,select_date_end,select_gz; ImageView query_btn; String typeStr; private int mQueryType; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_history_list); initView(); initData(); } private void initView() { mInfoList = new ArrayList<>(); navSupport = new NavSupport(this,19); mListview = findViewById(R.id.listview); carListAdapter = new HistoryListAdapter(this,mInfoList); View emptyView = View.inflate(this, R.layout.no_network_view, null); emptyView.setVisibility(View.GONE); ((ViewGroup)mListview.getParent()).addView(emptyView); mListview.setEmptyView(emptyView); mListview.setAdapter(carListAdapter); new InfoSupport(this); mTotalBeans = new ArrayList<>(); select_date_start = findViewById(R.id.select_date_start); select_date_end = findViewById(R.id.select_date_end); query_btn = findViewById(R.id.query_btn); select_gz = findViewById(R.id.select_gz); select_date_start.setOnClickListener(this); select_date_end.setOnClickListener(this); query_btn.setOnClickListener(this); select_gz.setOnClickListener(this); mListview.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { ManageInfo info = mInfoList.get(i); SharePreferenceManager sp = new SharePreferenceManager(HistoryActivity.this); sp.putString(Constance.JSD_ID,info.getJsd_id()); sp.putString(Constance.CHEJIAHAO,info.getCjhm()); sp.putString(Constance.CURRENTCP,info.getCp()); sp.putString(Constance.CHEXING,info.getCx()); sp.putString(Constance.JIECHEDATE,info.getJc_date()); sp.putString(Constance.YUWANGONG,info.getYwg_date()); startActivity(new Intent(HistoryActivity.this,ProjectOrderActivity.class)); } }); } //初始化数据 private void initData(){ typeStr = getIntent().getStringExtra("typeStr"); String endDate = DateUtil.getCurrentDate(); String startDate = endDate.substring(0,endDate.length()-2)+"01"; select_date_end.setText(endDate); select_date_start.setText("2017-01-01"); getData(); getWxgzList(); } @Override protected void updateUIThread(int msgInt){ if(msgInt==302){ dismissDialog(); String gzStr = select_gz.getText().toString(); if(mQueryType != 0){ mInfoList.clear(); for(ManageInfo bean : mTotalBeans){ if((bean.getWxgz().contains(gzStr)||gzStr.equals("全部"))){ mInfoList.add(bean); } } carListAdapter.notifyDataSetChanged(); }else{ carListAdapter.notifyDataSetChanged(); } } } private void getData(){ mInfoList.clear(); showDialog(this); HistoryDataHelper carDataHelper = new HistoryDataHelper(this); carDataHelper.setPreZero(new HistoryDataHelper.GetDataListener() { @Override public void getData(List<ManageInfo> manageInfoList) { if(manageInfoList!=null) { mTotalBeans = manageInfoList; mInfoList.addAll(manageInfoList); mQueryType = 0; mHandler.sendEmptyMessage(302); } } @Override public void onFail() { mHandler.sendEmptyMessage(302); } }); String startDate = select_date_start.getText().toString(); String endDate = select_date_end.getText().toString(); String startDateStr = startDate+" 00:00:00"; String endDateStr = endDate+" 23:59:59"; if(typeStr==null){ typeStr=""; } carDataHelper.getCardList(startDateStr, endDateStr); } @Override public void onClick(View v) { switch (v.getId()){ case R.id.select_date_start: selectDate(select_date_start); break; case R.id.select_date_end: selectDate(select_date_end); break; case R.id.query_btn: mQueryType = 1; getData(); break; case R.id.select_gz: initPopWindow(); break; default: break; } } private void getWxgzList(){ manageInfoList = new ArrayList<>(); ManageDataHelper helper = new ManageDataHelper(this); helper.setPreZero(); helper.getListData(0); helper.setGetDataListener(new ManageDataHelper.GetDataListener() { @Override public void getData(List<ManageInfo> manageInfos) { manageInfoList.clear(); if(manageInfos!=null) { manageInfoList.addAll(manageInfos); } DBManager dbManager = DBManager.getInstanse(HistoryActivity.this); dbManager.insertManagerListData(manageInfos); } }); } private void initPopWindow(){ // 用于PopupWindow的View View contentView=LayoutInflater.from(this).inflate(R.layout.popwindow_bank_rate, null, false); ListView mListView = contentView.findViewById(R.id.listview); // 创建PopupWindow对象,其中: // 第一个参数是用于PopupWindow中的View,第二个参数是PopupWindow的宽度, // 第三个参数是PopupWindow的高度,第四个参数指定PopupWindow能否获得焦点 final PopupWindow mPopupWindow=new PopupWindow(contentView, Util.dp2px(this,120), LinearLayout.LayoutParams.WRAP_CONTENT, true); mPopupWindow.showAsDropDown(select_gz); mPopupWindow.setTouchable(true); // 设置屏幕点击事件 final DBManager dbManager = DBManager.getInstanse(this); final List<String> wxgzList = new ArrayList<>(); wxgzList.add("全部"); wxgzList.addAll(dbManager.queryWxgzListData()); WxgzListAdapter homeCarInfoAdapter = new WxgzListAdapter(this,wxgzList);//新建并配置ArrayAapeter mListView.setAdapter(homeCarInfoAdapter); mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) { mPopupWindow.dismiss(); String info = wxgzList.get(position); select_gz.setText(info); mQueryType = 2; getData(); } }); // 设置PopupWindow的背景 mPopupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); // 设置PopupWindow是否能响应外部点击事件 mPopupWindow.setOutsideTouchable(true); // 设置PopupWindow是否能响应点击事件 mPopupWindow.setTouchable(true); // 显示PopupWindow,其中: // 第一个参数是PopupWindow的锚点,第二和第三个参数分别是PopupWindow相对锚点的x、y偏移 // 或者也可以调用此方法显示PopupWindow,其中: // 第一个参数是PopupWindow的父View,第二个参数是PopupWindow相对父View的位置, // 第三和第四个参数分别是PopupWindow相对父View的x、y偏移 // window.showAtLocation(parent, gravity, x, y); } private void selectDate(final TextView textView){ CustomDatePicker customDatePicker = new CustomDatePicker(this, new CustomDatePicker.ResultHandler() { @Override public void handle(String time) { // 回调接口,获得选中的时间 Log.d("yyyyy", time); if(!TextUtils.isEmpty(time)&&time.length()>=10){ String pickTime = time.substring(0,10); textView.setText(pickTime); } } },"2007-01-01 00:00","2025-12-31 00:00"); customDatePicker.show(); } @Override public void onPause() { // TODO Auto-generated method stub super.onPause(); } @Override public void onResume() { super.onResume(); } }
UTF-8
Java
9,259
java
HistoryActivity.java
Java
[ { "context": "rayList;\nimport java.util.List;\n\n/**\n * Created by Administrator on 2017/2/23 0023.\n * 首页\n */\npublic class History", "end": 1626, "score": 0.9382831454277039, "start": 1613, "tag": "NAME", "value": "Administrator" } ]
null
[]
package com.shoujia.zhangshangxiu.history; import android.content.Intent; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.os.Bundle; import android.text.TextUtils; import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.Window; import android.widget.AdapterView; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.PopupWindow; import android.widget.TextView; import com.shoujia.zhangshangxiu.R; import com.shoujia.zhangshangxiu.base.BaseActivity; import com.shoujia.zhangshangxiu.car.CarListActivity; import com.shoujia.zhangshangxiu.db.DBManager; import com.shoujia.zhangshangxiu.entity.ManageInfo; import com.shoujia.zhangshangxiu.entity.OrderBean; import com.shoujia.zhangshangxiu.history.adapter.HistoryListAdapter; import com.shoujia.zhangshangxiu.history.help.HistoryDataHelper; import com.shoujia.zhangshangxiu.manager.help.ManageDataHelper; import com.shoujia.zhangshangxiu.order.ProjectOrderActivity; import com.shoujia.zhangshangxiu.order.adapter.WxgzListAdapter; import com.shoujia.zhangshangxiu.support.InfoSupport; import com.shoujia.zhangshangxiu.support.NavSupport; import com.shoujia.zhangshangxiu.util.Constance; import com.shoujia.zhangshangxiu.util.DateUtil; import com.shoujia.zhangshangxiu.util.SharePreferenceManager; import com.shoujia.zhangshangxiu.util.Util; import com.shoujia.zhangshangxiu.view.CustomDatePicker; import java.util.ArrayList; import java.util.List; /** * Created by Administrator on 2017/2/23 0023. * 首页 */ public class HistoryActivity extends BaseActivity implements View.OnClickListener{ private final String TAG = "HomeActivity"; private NavSupport navSupport; private List<ManageInfo> mInfoList; List<ManageInfo> mTotalBeans; private List<ManageInfo> manageInfoList; private HistoryListAdapter carListAdapter; ListView mListview; TextView select_date_start,select_date_end,select_gz; ImageView query_btn; String typeStr; private int mQueryType; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_history_list); initView(); initData(); } private void initView() { mInfoList = new ArrayList<>(); navSupport = new NavSupport(this,19); mListview = findViewById(R.id.listview); carListAdapter = new HistoryListAdapter(this,mInfoList); View emptyView = View.inflate(this, R.layout.no_network_view, null); emptyView.setVisibility(View.GONE); ((ViewGroup)mListview.getParent()).addView(emptyView); mListview.setEmptyView(emptyView); mListview.setAdapter(carListAdapter); new InfoSupport(this); mTotalBeans = new ArrayList<>(); select_date_start = findViewById(R.id.select_date_start); select_date_end = findViewById(R.id.select_date_end); query_btn = findViewById(R.id.query_btn); select_gz = findViewById(R.id.select_gz); select_date_start.setOnClickListener(this); select_date_end.setOnClickListener(this); query_btn.setOnClickListener(this); select_gz.setOnClickListener(this); mListview.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) { ManageInfo info = mInfoList.get(i); SharePreferenceManager sp = new SharePreferenceManager(HistoryActivity.this); sp.putString(Constance.JSD_ID,info.getJsd_id()); sp.putString(Constance.CHEJIAHAO,info.getCjhm()); sp.putString(Constance.CURRENTCP,info.getCp()); sp.putString(Constance.CHEXING,info.getCx()); sp.putString(Constance.JIECHEDATE,info.getJc_date()); sp.putString(Constance.YUWANGONG,info.getYwg_date()); startActivity(new Intent(HistoryActivity.this,ProjectOrderActivity.class)); } }); } //初始化数据 private void initData(){ typeStr = getIntent().getStringExtra("typeStr"); String endDate = DateUtil.getCurrentDate(); String startDate = endDate.substring(0,endDate.length()-2)+"01"; select_date_end.setText(endDate); select_date_start.setText("2017-01-01"); getData(); getWxgzList(); } @Override protected void updateUIThread(int msgInt){ if(msgInt==302){ dismissDialog(); String gzStr = select_gz.getText().toString(); if(mQueryType != 0){ mInfoList.clear(); for(ManageInfo bean : mTotalBeans){ if((bean.getWxgz().contains(gzStr)||gzStr.equals("全部"))){ mInfoList.add(bean); } } carListAdapter.notifyDataSetChanged(); }else{ carListAdapter.notifyDataSetChanged(); } } } private void getData(){ mInfoList.clear(); showDialog(this); HistoryDataHelper carDataHelper = new HistoryDataHelper(this); carDataHelper.setPreZero(new HistoryDataHelper.GetDataListener() { @Override public void getData(List<ManageInfo> manageInfoList) { if(manageInfoList!=null) { mTotalBeans = manageInfoList; mInfoList.addAll(manageInfoList); mQueryType = 0; mHandler.sendEmptyMessage(302); } } @Override public void onFail() { mHandler.sendEmptyMessage(302); } }); String startDate = select_date_start.getText().toString(); String endDate = select_date_end.getText().toString(); String startDateStr = startDate+" 00:00:00"; String endDateStr = endDate+" 23:59:59"; if(typeStr==null){ typeStr=""; } carDataHelper.getCardList(startDateStr, endDateStr); } @Override public void onClick(View v) { switch (v.getId()){ case R.id.select_date_start: selectDate(select_date_start); break; case R.id.select_date_end: selectDate(select_date_end); break; case R.id.query_btn: mQueryType = 1; getData(); break; case R.id.select_gz: initPopWindow(); break; default: break; } } private void getWxgzList(){ manageInfoList = new ArrayList<>(); ManageDataHelper helper = new ManageDataHelper(this); helper.setPreZero(); helper.getListData(0); helper.setGetDataListener(new ManageDataHelper.GetDataListener() { @Override public void getData(List<ManageInfo> manageInfos) { manageInfoList.clear(); if(manageInfos!=null) { manageInfoList.addAll(manageInfos); } DBManager dbManager = DBManager.getInstanse(HistoryActivity.this); dbManager.insertManagerListData(manageInfos); } }); } private void initPopWindow(){ // 用于PopupWindow的View View contentView=LayoutInflater.from(this).inflate(R.layout.popwindow_bank_rate, null, false); ListView mListView = contentView.findViewById(R.id.listview); // 创建PopupWindow对象,其中: // 第一个参数是用于PopupWindow中的View,第二个参数是PopupWindow的宽度, // 第三个参数是PopupWindow的高度,第四个参数指定PopupWindow能否获得焦点 final PopupWindow mPopupWindow=new PopupWindow(contentView, Util.dp2px(this,120), LinearLayout.LayoutParams.WRAP_CONTENT, true); mPopupWindow.showAsDropDown(select_gz); mPopupWindow.setTouchable(true); // 设置屏幕点击事件 final DBManager dbManager = DBManager.getInstanse(this); final List<String> wxgzList = new ArrayList<>(); wxgzList.add("全部"); wxgzList.addAll(dbManager.queryWxgzListData()); WxgzListAdapter homeCarInfoAdapter = new WxgzListAdapter(this,wxgzList);//新建并配置ArrayAapeter mListView.setAdapter(homeCarInfoAdapter); mListView.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView<?> adapterView, View view, int position, long l) { mPopupWindow.dismiss(); String info = wxgzList.get(position); select_gz.setText(info); mQueryType = 2; getData(); } }); // 设置PopupWindow的背景 mPopupWindow.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT)); // 设置PopupWindow是否能响应外部点击事件 mPopupWindow.setOutsideTouchable(true); // 设置PopupWindow是否能响应点击事件 mPopupWindow.setTouchable(true); // 显示PopupWindow,其中: // 第一个参数是PopupWindow的锚点,第二和第三个参数分别是PopupWindow相对锚点的x、y偏移 // 或者也可以调用此方法显示PopupWindow,其中: // 第一个参数是PopupWindow的父View,第二个参数是PopupWindow相对父View的位置, // 第三和第四个参数分别是PopupWindow相对父View的x、y偏移 // window.showAtLocation(parent, gravity, x, y); } private void selectDate(final TextView textView){ CustomDatePicker customDatePicker = new CustomDatePicker(this, new CustomDatePicker.ResultHandler() { @Override public void handle(String time) { // 回调接口,获得选中的时间 Log.d("yyyyy", time); if(!TextUtils.isEmpty(time)&&time.length()>=10){ String pickTime = time.substring(0,10); textView.setText(pickTime); } } },"2007-01-01 00:00","2025-12-31 00:00"); customDatePicker.show(); } @Override public void onPause() { // TODO Auto-generated method stub super.onPause(); } @Override public void onResume() { super.onResume(); } }
9,259
0.747765
0.73826
286
29.898602
22.886927
103
false
false
0
0
0
0
0
0
2.381119
false
false
14
9aee059b291a2148403b41d58b934fc343f7310a
38,019,050,509,870
6afe0ec3c90cdac8e358c179d2d6238111b6eadc
/src/com/brayanbedritchuk/tcc/conversores/ConversorTelaAndroid.java
d88d94cdd1298b188d16a96cf0ab78198cc7a998
[]
no_license
brayan/android-screens-generator
https://github.com/brayan/android-screens-generator
c99482fccb118e40d804430396b0bdef2883c091
1bbe4e55089c2e0face6b66dc28d77b7966ee73f
refs/heads/master
2020-06-16T11:26:20.433000
2019-07-06T16:10:15
2019-07-06T16:10:15
195,555,937
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.brayanbedritchuk.tcc.conversores; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; import javax.servlet.http.HttpServletRequest; import com.brayanbedritchuk.tcc.exceptions.ComponenteInvalidoException; import com.brayanbedritchuk.tcc.model.Atributo; import com.brayanbedritchuk.tcc.model.ComponenteAndroid; import com.brayanbedritchuk.tcc.model.TelaAndroid; import com.brayanbedritchuk.tcc.model.componentes.CardViewConfiguracao; import com.brayanbedritchuk.tcc.model.componentes.CheckBoxConfiguracao; import com.brayanbedritchuk.tcc.model.componentes.ComponenteConfiguracao; import com.brayanbedritchuk.tcc.model.componentes.EditTextConfiguracao; import com.brayanbedritchuk.tcc.model.componentes.FloatingActionButtonConfiguracao; import com.brayanbedritchuk.tcc.model.componentes.RectangularButtonConfiguracao; import com.brayanbedritchuk.tcc.model.componentes.RecyclerViewConfiguracao; import com.brayanbedritchuk.tcc.model.componentes.TextViewConfiguracao; import com.brayanbedritchuk.tcc.model.componentes.ToolbarConfiguracao; import com.brayanbedritchuk.tcc.util.AtributoUtils; public class ConversorTelaAndroid { private HttpServletRequest request; private TelaAndroid tela; public TelaAndroid converter(HttpServletRequest request) throws ComponenteInvalidoException { this.request = request; this.tela = new TelaAndroid(); converterComponentePrincipal(); converterComponentesFilhos(); gerarIds(); return tela; } private void converterComponentePrincipal() { tela.setNome(request.getParameter(TelaAndroid.PARAMETRO_NOME).trim()); tela.setPacote(request.getParameter(TelaAndroid.PARAMETRO_PACOTE).trim()); ComponenteAndroid componente = new ComponenteAndroid(); componente.setTipo(request.getParameter(TelaAndroid.PARAMETRO_TIPO).trim()); componente.adicionarAtributo( new Atributo("xmlns:android", "http://schemas.android.com/apk/res/android")); componente.adicionarAtributo(new Atributo(AtributoUtils.WIDTH, request.getParameter(TelaAndroid.PARAMETRO_LARGURA).trim())); componente.adicionarAtributo(new Atributo(AtributoUtils.HEIGHT, request.getParameter(TelaAndroid.PARAMETRO_ALTURA).trim())); componente.adicionarAtributo(new Atributo(AtributoUtils.ORIENTATION, request.getParameter(TelaAndroid.PARAMETRO_ORIENTACAO).trim())); tela.setComponentePrincipal(componente); } private void converterComponentesFilhos() throws ComponenteInvalidoException { ComponenteAndroid filho = null; for (Map.Entry<String, String[]> parametro : request.getParameterMap().entrySet()) { if (isParametroComponentePrincipal(parametro)) { continue; } ComponenteConfiguracao componenteAtual = getComponenteAtual(parametro.getKey()); if (isParametroInicial(parametro)) { filho = inicializarFilho(componenteAtual); } adicionarAtributo(filho, parametro); if (isParametroFinal(parametro)) { tela.getComponentePrincipal().adicionarFilho(filho); filho = null; } } } private ComponenteAndroid inicializarFilho(ComponenteConfiguracao componenteAtual) { ComponenteAndroid filho = new ComponenteAndroid(); filho.setTipo(componenteAtual.getTipo()); filho.setCaminhoImport(componenteAtual.getImport()); filho.setSupportLib(componenteAtual.isSupportLib()); return filho; } private boolean isParametroFinal(Map.Entry<String, String[]> parametro) { return parametro.getKey().toLowerCase().contains("altura"); } private boolean isParametroInicial(Map.Entry<String, String[]> parametro) { return parametro.getKey().toLowerCase().contains("largura"); } private boolean isParametroComponentePrincipal(Map.Entry<String, String[]> parametro) { return parametro.getKey().toLowerCase().contains("principal"); } private void adicionarAtributo(ComponenteAndroid novoComponente, Entry<String, String[]> entry) { String atributo = entry.getKey().toLowerCase(); String valor = entry.getValue()[0].trim(); if (atributo.contains("largura")) { novoComponente.adicionarAtributo(new Atributo(AtributoUtils.WIDTH, valor)); } else if (atributo.contains("altura")) { novoComponente.adicionarAtributo(new Atributo(AtributoUtils.HEIGHT, valor)); } else if (atributo.contains("texto")) { novoComponente.adicionarAtributo(new Atributo(AtributoUtils.TEXT, valor)); } else if (atributo.contains("orientation")) { novoComponente.adicionarAtributo(new Atributo(AtributoUtils.ORIENTATION, valor)); } else if (atributo.contains("hint")) { novoComponente.adicionarAtributo(new Atributo(AtributoUtils.HINT, valor)); } } private ComponenteConfiguracao getComponenteAtual(String key) throws ComponenteInvalidoException { String componente = key.toLowerCase(); if (componente.contains("toolbar")) { return new ToolbarConfiguracao(); } else if (componente.contains("edittext")) { return new EditTextConfiguracao(); } else if (componente.contains("textview")) { return new TextViewConfiguracao(); } else if (componente.contains("cardview")) { return new CardViewConfiguracao(); } else if (componente.contains("rectangularbutton")) { return new RectangularButtonConfiguracao(); } else if (componente.contains("floatingactionbutton")) { return new FloatingActionButtonConfiguracao(); } else if (componente.contains("recyclerview")) { return new RecyclerViewConfiguracao(); } else if (componente.contains("checkbox")) { return new CheckBoxConfiguracao(); } throw new ComponenteInvalidoException( "Nenhum componente foi encontrado para a chave recebida: " + key.toLowerCase()); } public void gerarIds() { HashMap<String, List<ComponenteAndroid>> componentes = new HashMap<>(); List<ComponenteAndroid> filhos = tela.getComponentePrincipal().getFilhos(); for (ComponenteAndroid filho : filhos) { List<ComponenteAndroid> componentesAdicionados = componentes.get(filho.getTipo()); if (componentesAdicionados == null) { componentesAdicionados = new ArrayList<>(); componentesAdicionados.add(filho); filho.setNome(filho.getTipo().toLowerCase() + componentesAdicionados.size()); filho.adicionarAtributo(new Atributo("android:id", "@+id/" + filho.getNome())); componentes.put(filho.getTipo(), componentesAdicionados); } else { componentesAdicionados.add(filho); filho.setNome(filho.getTipo().toLowerCase() + componentesAdicionados.size()); filho.adicionarAtributo(new Atributo("android:id", "@+id/" + filho.getNome())); } } } }
UTF-8
Java
6,549
java
ConversorTelaAndroid.java
Java
[]
null
[]
package com.brayanbedritchuk.tcc.conversores; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Map.Entry; import javax.servlet.http.HttpServletRequest; import com.brayanbedritchuk.tcc.exceptions.ComponenteInvalidoException; import com.brayanbedritchuk.tcc.model.Atributo; import com.brayanbedritchuk.tcc.model.ComponenteAndroid; import com.brayanbedritchuk.tcc.model.TelaAndroid; import com.brayanbedritchuk.tcc.model.componentes.CardViewConfiguracao; import com.brayanbedritchuk.tcc.model.componentes.CheckBoxConfiguracao; import com.brayanbedritchuk.tcc.model.componentes.ComponenteConfiguracao; import com.brayanbedritchuk.tcc.model.componentes.EditTextConfiguracao; import com.brayanbedritchuk.tcc.model.componentes.FloatingActionButtonConfiguracao; import com.brayanbedritchuk.tcc.model.componentes.RectangularButtonConfiguracao; import com.brayanbedritchuk.tcc.model.componentes.RecyclerViewConfiguracao; import com.brayanbedritchuk.tcc.model.componentes.TextViewConfiguracao; import com.brayanbedritchuk.tcc.model.componentes.ToolbarConfiguracao; import com.brayanbedritchuk.tcc.util.AtributoUtils; public class ConversorTelaAndroid { private HttpServletRequest request; private TelaAndroid tela; public TelaAndroid converter(HttpServletRequest request) throws ComponenteInvalidoException { this.request = request; this.tela = new TelaAndroid(); converterComponentePrincipal(); converterComponentesFilhos(); gerarIds(); return tela; } private void converterComponentePrincipal() { tela.setNome(request.getParameter(TelaAndroid.PARAMETRO_NOME).trim()); tela.setPacote(request.getParameter(TelaAndroid.PARAMETRO_PACOTE).trim()); ComponenteAndroid componente = new ComponenteAndroid(); componente.setTipo(request.getParameter(TelaAndroid.PARAMETRO_TIPO).trim()); componente.adicionarAtributo( new Atributo("xmlns:android", "http://schemas.android.com/apk/res/android")); componente.adicionarAtributo(new Atributo(AtributoUtils.WIDTH, request.getParameter(TelaAndroid.PARAMETRO_LARGURA).trim())); componente.adicionarAtributo(new Atributo(AtributoUtils.HEIGHT, request.getParameter(TelaAndroid.PARAMETRO_ALTURA).trim())); componente.adicionarAtributo(new Atributo(AtributoUtils.ORIENTATION, request.getParameter(TelaAndroid.PARAMETRO_ORIENTACAO).trim())); tela.setComponentePrincipal(componente); } private void converterComponentesFilhos() throws ComponenteInvalidoException { ComponenteAndroid filho = null; for (Map.Entry<String, String[]> parametro : request.getParameterMap().entrySet()) { if (isParametroComponentePrincipal(parametro)) { continue; } ComponenteConfiguracao componenteAtual = getComponenteAtual(parametro.getKey()); if (isParametroInicial(parametro)) { filho = inicializarFilho(componenteAtual); } adicionarAtributo(filho, parametro); if (isParametroFinal(parametro)) { tela.getComponentePrincipal().adicionarFilho(filho); filho = null; } } } private ComponenteAndroid inicializarFilho(ComponenteConfiguracao componenteAtual) { ComponenteAndroid filho = new ComponenteAndroid(); filho.setTipo(componenteAtual.getTipo()); filho.setCaminhoImport(componenteAtual.getImport()); filho.setSupportLib(componenteAtual.isSupportLib()); return filho; } private boolean isParametroFinal(Map.Entry<String, String[]> parametro) { return parametro.getKey().toLowerCase().contains("altura"); } private boolean isParametroInicial(Map.Entry<String, String[]> parametro) { return parametro.getKey().toLowerCase().contains("largura"); } private boolean isParametroComponentePrincipal(Map.Entry<String, String[]> parametro) { return parametro.getKey().toLowerCase().contains("principal"); } private void adicionarAtributo(ComponenteAndroid novoComponente, Entry<String, String[]> entry) { String atributo = entry.getKey().toLowerCase(); String valor = entry.getValue()[0].trim(); if (atributo.contains("largura")) { novoComponente.adicionarAtributo(new Atributo(AtributoUtils.WIDTH, valor)); } else if (atributo.contains("altura")) { novoComponente.adicionarAtributo(new Atributo(AtributoUtils.HEIGHT, valor)); } else if (atributo.contains("texto")) { novoComponente.adicionarAtributo(new Atributo(AtributoUtils.TEXT, valor)); } else if (atributo.contains("orientation")) { novoComponente.adicionarAtributo(new Atributo(AtributoUtils.ORIENTATION, valor)); } else if (atributo.contains("hint")) { novoComponente.adicionarAtributo(new Atributo(AtributoUtils.HINT, valor)); } } private ComponenteConfiguracao getComponenteAtual(String key) throws ComponenteInvalidoException { String componente = key.toLowerCase(); if (componente.contains("toolbar")) { return new ToolbarConfiguracao(); } else if (componente.contains("edittext")) { return new EditTextConfiguracao(); } else if (componente.contains("textview")) { return new TextViewConfiguracao(); } else if (componente.contains("cardview")) { return new CardViewConfiguracao(); } else if (componente.contains("rectangularbutton")) { return new RectangularButtonConfiguracao(); } else if (componente.contains("floatingactionbutton")) { return new FloatingActionButtonConfiguracao(); } else if (componente.contains("recyclerview")) { return new RecyclerViewConfiguracao(); } else if (componente.contains("checkbox")) { return new CheckBoxConfiguracao(); } throw new ComponenteInvalidoException( "Nenhum componente foi encontrado para a chave recebida: " + key.toLowerCase()); } public void gerarIds() { HashMap<String, List<ComponenteAndroid>> componentes = new HashMap<>(); List<ComponenteAndroid> filhos = tela.getComponentePrincipal().getFilhos(); for (ComponenteAndroid filho : filhos) { List<ComponenteAndroid> componentesAdicionados = componentes.get(filho.getTipo()); if (componentesAdicionados == null) { componentesAdicionados = new ArrayList<>(); componentesAdicionados.add(filho); filho.setNome(filho.getTipo().toLowerCase() + componentesAdicionados.size()); filho.adicionarAtributo(new Atributo("android:id", "@+id/" + filho.getNome())); componentes.put(filho.getTipo(), componentesAdicionados); } else { componentesAdicionados.add(filho); filho.setNome(filho.getTipo().toLowerCase() + componentesAdicionados.size()); filho.adicionarAtributo(new Atributo("android:id", "@+id/" + filho.getNome())); } } } }
6,549
0.774775
0.774622
181
35.18232
29.843884
94
false
false
0
0
0
0
0
0
2.044199
false
false
14
e3067b1c5d50818746c6e1085dd4474f0a449a76
1,717,986,952,837
c7db055b8573c87c6549b02c4e7a8548aabe73bd
/backend/src/main/java/com/aau/moodle20/entity/FinishesExample.java
935d6ab0b51a06b850f4c39151c0a4bd2bf0199d
[]
no_license
Kirdock/Moodle2.0
https://github.com/Kirdock/Moodle2.0
b20a5e1ef39a6edfc531cdb9dfc15d816574d0bd
4dfc0e17c6b5adc2ec66068d018ddc8ddf5670b2
refs/heads/master
2023-01-09T18:23:53.725000
2021-09-18T09:48:37
2021-09-18T09:48:37
247,430,672
0
0
null
false
2023-01-06T04:30:17
2020-03-15T08:47:00
2021-09-18T09:49:04
2023-01-06T04:30:15
2,062
0
0
34
Java
false
false
package com.aau.moodle20.entity; import com.aau.moodle20.constants.EFinishesExampleState; import com.aau.moodle20.entity.embeddable.FinishesExampleKey; import javax.persistence.*; import java.util.Comparator; import java.util.List; import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; @Entity @Table(name = "finishes_example") public class FinishesExample { @EmbeddedId private FinishesExampleKey id; @ManyToOne @MapsId("matriculationNumber") @JoinColumn(name = "matriculation_Number") private User user; @ManyToOne @MapsId("example_id") @JoinColumn(name = "example_id") private Example example; private String description; @Transient private byte[] attachmentContent; private String fileName; private Boolean valid = false; private Boolean hasPresented = false; private EFinishesExampleState state; private Integer remainingUploadCount; @OneToMany(mappedBy = "finishesExample", fetch = FetchType.LAZY) private Set<ViolationHistory> violationHistories; public FinishesExampleKey getId() { return id; } public User getUser() { return user; } public void setUser(User user) { this.user = user; } public void setId(FinishesExampleKey id) { this.id = id; } public Example getExample() { return example; } public void setExample(Example example) { this.example = example; } public String getDescription() { return description; } public void setDescription(String reason) { this.description = reason; } public byte[] getAttachmentContent() { return attachmentContent; } public void setAttachmentContent(byte[] attachmentContent) { this.attachmentContent = attachmentContent; } public Boolean getValid() { return valid; } public void setValid(Boolean valid) { this.valid = valid; } public Boolean getHasPresented() { return hasPresented; } public void setHasPresented(Boolean hasPresented) { this.hasPresented = hasPresented; } public EFinishesExampleState getState() { return state; } public void setState(EFinishesExampleState state) { this.state = state; } public String getFileName() { return fileName; } public void setFileName(String fileName) { this.fileName = fileName; } public Integer getRemainingUploadCount() { return remainingUploadCount; } public void setRemainingUploadCount(Integer remainingUploadCount) { this.remainingUploadCount = remainingUploadCount; } public Set<ViolationHistory> getViolationHistories() { return violationHistories; } public List<ViolationHistory> getViolationHistoryList() { return violationHistories.stream().sorted(Comparator.comparing(ViolationHistory::getDate)).collect(Collectors.toList()); } public void setViolationHistories(Set<ViolationHistory> violationHistories) { this.violationHistories = violationHistories; } @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof FinishesExample)) return false; FinishesExample that = (FinishesExample) o; return Objects.equals(getId(), that.getId()) && Objects.equals(getDescription(), that.getDescription()) && Objects.equals(getFileName(), that.getFileName()) && Objects.equals(getValid(), that.getValid()) && Objects.equals(getHasPresented(), that.getHasPresented()) && getState() == that.getState() && Objects.equals(getRemainingUploadCount(), that.getRemainingUploadCount()); } @Override public int hashCode() { return Objects.hash(getId(), getDescription(), getFileName(), getValid(), getHasPresented(), getState(), getRemainingUploadCount()); } }
UTF-8
Java
4,048
java
FinishesExample.java
Java
[]
null
[]
package com.aau.moodle20.entity; import com.aau.moodle20.constants.EFinishesExampleState; import com.aau.moodle20.entity.embeddable.FinishesExampleKey; import javax.persistence.*; import java.util.Comparator; import java.util.List; import java.util.Objects; import java.util.Set; import java.util.stream.Collectors; @Entity @Table(name = "finishes_example") public class FinishesExample { @EmbeddedId private FinishesExampleKey id; @ManyToOne @MapsId("matriculationNumber") @JoinColumn(name = "matriculation_Number") private User user; @ManyToOne @MapsId("example_id") @JoinColumn(name = "example_id") private Example example; private String description; @Transient private byte[] attachmentContent; private String fileName; private Boolean valid = false; private Boolean hasPresented = false; private EFinishesExampleState state; private Integer remainingUploadCount; @OneToMany(mappedBy = "finishesExample", fetch = FetchType.LAZY) private Set<ViolationHistory> violationHistories; public FinishesExampleKey getId() { return id; } public User getUser() { return user; } public void setUser(User user) { this.user = user; } public void setId(FinishesExampleKey id) { this.id = id; } public Example getExample() { return example; } public void setExample(Example example) { this.example = example; } public String getDescription() { return description; } public void setDescription(String reason) { this.description = reason; } public byte[] getAttachmentContent() { return attachmentContent; } public void setAttachmentContent(byte[] attachmentContent) { this.attachmentContent = attachmentContent; } public Boolean getValid() { return valid; } public void setValid(Boolean valid) { this.valid = valid; } public Boolean getHasPresented() { return hasPresented; } public void setHasPresented(Boolean hasPresented) { this.hasPresented = hasPresented; } public EFinishesExampleState getState() { return state; } public void setState(EFinishesExampleState state) { this.state = state; } public String getFileName() { return fileName; } public void setFileName(String fileName) { this.fileName = fileName; } public Integer getRemainingUploadCount() { return remainingUploadCount; } public void setRemainingUploadCount(Integer remainingUploadCount) { this.remainingUploadCount = remainingUploadCount; } public Set<ViolationHistory> getViolationHistories() { return violationHistories; } public List<ViolationHistory> getViolationHistoryList() { return violationHistories.stream().sorted(Comparator.comparing(ViolationHistory::getDate)).collect(Collectors.toList()); } public void setViolationHistories(Set<ViolationHistory> violationHistories) { this.violationHistories = violationHistories; } @Override public boolean equals(Object o) { if (this == o) return true; if (!(o instanceof FinishesExample)) return false; FinishesExample that = (FinishesExample) o; return Objects.equals(getId(), that.getId()) && Objects.equals(getDescription(), that.getDescription()) && Objects.equals(getFileName(), that.getFileName()) && Objects.equals(getValid(), that.getValid()) && Objects.equals(getHasPresented(), that.getHasPresented()) && getState() == that.getState() && Objects.equals(getRemainingUploadCount(), that.getRemainingUploadCount()); } @Override public int hashCode() { return Objects.hash(getId(), getDescription(), getFileName(), getValid(), getHasPresented(), getState(), getRemainingUploadCount()); } }
4,048
0.665267
0.663785
154
25.285715
25.273752
140
false
false
0
0
0
0
0
0
0.396104
false
false
14
b6631dd3ab47440f6e91f051b242acbc7a58e5e3
34,368,328,328,322
76d3f6b1c3d8cda2ffe3d901e696021ba0c3d190
/src/model/Grade.java
650c6078e061f2d4d6942af81c27576d91006dcd
[]
no_license
Diego-Hidalgo/academic-schedule
https://github.com/Diego-Hidalgo/academic-schedule
1efd45c8807c29621ee352a97ca9351a6f107dfa
1fccedad9167e5ccf92d54b110dbadf78171c935
refs/heads/master
2023-05-29T23:37:03.652000
2021-06-12T21:35:33
2021-06-12T21:35:33
368,319,524
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package model; import java.io.Serializable; public class Grade implements Comparable<Grade>, Serializable { private static final long serialVersionUID = 1L; private double grade; private double percentage; private String description; private Grade parent; private Grade rigth; private Grade left; /** * Constructor of the Grade class. Creates a new Grade object<br> * <b>pre:</b> * <b>post:</b> a new Grade object has been created. */ public Grade() { grade = 0; percentage = 0; description = new String(); }//End Grade constructor /** * Constructor of the Grade class. Creates a new Grade object<br> * <b>pre:</b> * <b>post:</b> a new Grade object has been created. * @param grade * @param percentage * @param description */ public Grade(double grade, double percentage, String description) { this.grade = grade; this.percentage = percentage; this.description = description; }//End Grade constructor public void setGrade(double grade) { this.grade = grade; } public void setPercentage(double percentage) { this.percentage = percentage; } public void setDescription(String description) { this.description = description; } public String getDescription() { return description; } public double getGrade() { return this.grade; } public double getPercentage() { return this.percentage; } public double getAverageGrade() { return (grade*percentage)/100; }//End public Grade getRigth() { return rigth; } public void setRigth(Grade rigth) { this.rigth = rigth; } public Grade getLeft() { return left; } public void setLeft(Grade left) { this.left = left; } public Grade getParent() { return parent; } public void setParent(Grade parent) { this.parent = parent; } /** * returns the information of the description and the value of the grade in a String<br> * <b>pre:</b> * <b>post:</b> the String that contains the indicated information */ @Override public String toString(){ return description + " " + grade; } /** * Compares this Grade object with a given Grade object<br> * <b>pre:</b> the param is not null * <b>post:</b> a numeric value that indicates the comparison * @param o the other object to compare */ @Override public int compareTo(Grade o) { int result = 0; if(o.grade > grade) result = 1; else if(o.grade < grade) result = -1; return result; }//End compareTo }//End Grade
UTF-8
Java
2,474
java
Grade.java
Java
[]
null
[]
package model; import java.io.Serializable; public class Grade implements Comparable<Grade>, Serializable { private static final long serialVersionUID = 1L; private double grade; private double percentage; private String description; private Grade parent; private Grade rigth; private Grade left; /** * Constructor of the Grade class. Creates a new Grade object<br> * <b>pre:</b> * <b>post:</b> a new Grade object has been created. */ public Grade() { grade = 0; percentage = 0; description = new String(); }//End Grade constructor /** * Constructor of the Grade class. Creates a new Grade object<br> * <b>pre:</b> * <b>post:</b> a new Grade object has been created. * @param grade * @param percentage * @param description */ public Grade(double grade, double percentage, String description) { this.grade = grade; this.percentage = percentage; this.description = description; }//End Grade constructor public void setGrade(double grade) { this.grade = grade; } public void setPercentage(double percentage) { this.percentage = percentage; } public void setDescription(String description) { this.description = description; } public String getDescription() { return description; } public double getGrade() { return this.grade; } public double getPercentage() { return this.percentage; } public double getAverageGrade() { return (grade*percentage)/100; }//End public Grade getRigth() { return rigth; } public void setRigth(Grade rigth) { this.rigth = rigth; } public Grade getLeft() { return left; } public void setLeft(Grade left) { this.left = left; } public Grade getParent() { return parent; } public void setParent(Grade parent) { this.parent = parent; } /** * returns the information of the description and the value of the grade in a String<br> * <b>pre:</b> * <b>post:</b> the String that contains the indicated information */ @Override public String toString(){ return description + " " + grade; } /** * Compares this Grade object with a given Grade object<br> * <b>pre:</b> the param is not null * <b>post:</b> a numeric value that indicates the comparison * @param o the other object to compare */ @Override public int compareTo(Grade o) { int result = 0; if(o.grade > grade) result = 1; else if(o.grade < grade) result = -1; return result; }//End compareTo }//End Grade
2,474
0.675424
0.671787
119
19.798319
19.317593
89
false
false
0
0
0
0
0
0
1.336134
false
false
14
8c8e129bab920dc289f6f7499752d6db2719c1a5
5,866,925,352,568
0f85a0909cb0b964eab2095687d79ea4d6a55a83
/AvivaHealth/src/java/classes/resistance.java
33138eb82c491a38ef5d1b49e4bf4ce29898aab4
[]
no_license
AvivaHealthTrackerUEA/HealthTrackerWebsite
https://github.com/AvivaHealthTrackerUEA/HealthTrackerWebsite
8d75dd7e0e83207767bd3018cef7ad186be33542
c03c7dc9804850f0402e5bec49e969eebde29e99
refs/heads/master
2016-09-06T15:50:02.600000
2015-05-21T15:23:25
2015-05-21T15:23:41
34,390,828
1
3
null
false
2015-05-18T10:54:46
2015-04-22T13:07:10
2015-05-17T11:08:47
2015-05-18T10:54:27
517
1
3
1
Java
null
null
package classes; import java.sql.Connection; import java.sql.PreparedStatement; import classes.DBAccess; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import javax.servlet.ServletException; public class Resistance { private String name; private String date; private String reps; private String sets; private String weight; public Resistance(){} public Resistance(String name, String date, String reps, String sets, String weight) { this.name = name; this.date = date; this.reps = reps; this.sets = sets; this.weight = weight;} public String getName() { return name;} public void setName(String name) { this.name = name;} public String getDate() { return date;} public void setDate(String date) { this.date = date;} public String getReps() { return reps;} public void setReps(String reps) { this.reps = reps;} public String getSets() { return sets;} public void setSets(String sets) { this.sets = sets;} public String getWeight() { return weight;} public void setWeight(String weight) { this.weight = weight;} public void addResistanceToDatabase(String u,String n, String d, String r, String s, String w) throws ServletException{ try{ DBAccess db = new DBAccess(); Connection con = db.getConnection(); PreparedStatement ps = con.prepareStatement("INSERT INTO resistance_log (username,name,date,reps,sets,weight) " + "VALUES ('"+u+"','" + n + "','" + d + "','" + r + "','" + s+"', '" + w + "')"); ps.executeUpdate();} catch (Exception e) { throw new ServletException("Persist Problem", e);} } public boolean isAnother(String n) throws ServletException{ try{ DBAccess db2 = new DBAccess(); Connection con = db2.getConnection(); PreparedStatement ps2 = con.prepareStatement("SELECT name FROM resistance_log where name='" + n + "'"); ResultSet rs = ps2.executeQuery(); if (rs.next()){ return true; } return false; } catch (Exception e) { throw new ServletException("Persist Problem", e);}} }
UTF-8
Java
2,455
java
resistance.java
Java
[]
null
[]
package classes; import java.sql.Connection; import java.sql.PreparedStatement; import classes.DBAccess; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import javax.servlet.ServletException; public class Resistance { private String name; private String date; private String reps; private String sets; private String weight; public Resistance(){} public Resistance(String name, String date, String reps, String sets, String weight) { this.name = name; this.date = date; this.reps = reps; this.sets = sets; this.weight = weight;} public String getName() { return name;} public void setName(String name) { this.name = name;} public String getDate() { return date;} public void setDate(String date) { this.date = date;} public String getReps() { return reps;} public void setReps(String reps) { this.reps = reps;} public String getSets() { return sets;} public void setSets(String sets) { this.sets = sets;} public String getWeight() { return weight;} public void setWeight(String weight) { this.weight = weight;} public void addResistanceToDatabase(String u,String n, String d, String r, String s, String w) throws ServletException{ try{ DBAccess db = new DBAccess(); Connection con = db.getConnection(); PreparedStatement ps = con.prepareStatement("INSERT INTO resistance_log (username,name,date,reps,sets,weight) " + "VALUES ('"+u+"','" + n + "','" + d + "','" + r + "','" + s+"', '" + w + "')"); ps.executeUpdate();} catch (Exception e) { throw new ServletException("Persist Problem", e);} } public boolean isAnother(String n) throws ServletException{ try{ DBAccess db2 = new DBAccess(); Connection con = db2.getConnection(); PreparedStatement ps2 = con.prepareStatement("SELECT name FROM resistance_log where name='" + n + "'"); ResultSet rs = ps2.executeQuery(); if (rs.next()){ return true; } return false; } catch (Exception e) { throw new ServletException("Persist Problem", e);}} }
2,455
0.576782
0.575153
94
24.946808
25.623032
125
false
false
0
0
0
0
0
0
0.648936
false
false
14
bd9808efaf4268da26a865d9052f73998b84719b
23,450,521,443,641
8dd5c952a64214693b42d32d7ab29f97f3840c2e
/Blockchain/src/realmetamorph/blockchain/block/NonceGenerator.java
6c97d74351f9403ffb8e2c13d01f1244c4a564ff
[]
no_license
RealMetamorphEDU/Practice
https://github.com/RealMetamorphEDU/Practice
88162f2decf0c5beb1d33c14fa789cc570e30678
41f44cd0d554053f4a6c08720a792bab2fed4cc4
refs/heads/master
2020-06-15T06:42:20.868000
2019-09-08T20:13:14
2019-09-08T20:13:14
195,229,196
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/******************************************************************************* * Группа: БВТ1703. * Студент: Тимчук А.В. * Создано: 9.7.2019. * Copyright (c) 2019. ******************************************************************************/ package realmetamorph.blockchain.block; import java.math.BigInteger; import java.nio.ByteBuffer; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import static realmetamorph.blockchain.Blockchain.KEY_SIZE; import static realmetamorph.blockchain.Blockchain.completeShaString; class NonceGenerator { private byte[] data; private boolean interrupted; private int threadsCount; private long nonce; NonceGenerator(byte[] psByte, byte[] pkByte, byte[] tsByte, byte[] bhByte, byte[] tcByte, byte[] bsByte, byte[] mrByte) { this.data = new byte[92 + KEY_SIZE]; System.arraycopy(psByte, 0, data, 0, 32); System.arraycopy(pkByte, 0, data, 40, KEY_SIZE); System.arraycopy(tsByte, 0, data, 40 + KEY_SIZE, 8); System.arraycopy(bhByte, 0, data, 48 + KEY_SIZE, 4); System.arraycopy(tcByte, 0, data, 52 + KEY_SIZE, 4); System.arraycopy(bsByte, 0, data, 56 + KEY_SIZE, 4); System.arraycopy(mrByte, 0, data, 60 + KEY_SIZE, 32); this.interrupted = false; this.threadsCount = Runtime.getRuntime().availableProcessors() * 8; this.nonce = 0; } long generateNonce(IBlockGenerator generator) { Thread thread = null; long startNonce = Math.max(generator.getStartNonce(), 0); for (int i = 0; i < threadsCount; i++) { int srt = i; thread = new Thread(new Runnable() { private final long start = srt + startNonce + 1; private final long offset = threadsCount; @Override public void run() { try { MessageDigest digest = MessageDigest.getInstance("SHA-256"); for (long j = start; j < Long.MAX_VALUE; j += offset) { byte[] nonceByte = ByteBuffer.allocate(8).putLong(j).array(); System.arraycopy(nonceByte, 0, data, 32, 8); String shaHex = completeShaString(new BigInteger(1, digest.digest(digest.digest(data))).toString(16)); if (generator.checkSHAHex(shaHex, j)) { nonce = j; interrupted = true; break; } if (interrupted) break; } } catch (NoSuchAlgorithmException ignored) { } } }); thread.start(); } try { if (thread != null) thread.join(); } catch (InterruptedException ignored) { } return nonce; } }
UTF-8
Java
3,067
java
NonceGenerator.java
Java
[ { "context": "******************\n * Группа: БВТ1703.\n * Студент: Тимчук А.В.\n * Создано: 9.7.2019.\n * Copyright (c) 2019.\n **", "end": 123, "score": 0.999863862991333, "start": 113, "tag": "NAME", "value": "Тимчук А.В" } ]
null
[]
/******************************************************************************* * Группа: БВТ1703. * Студент: <NAME>. * Создано: 9.7.2019. * Copyright (c) 2019. ******************************************************************************/ package realmetamorph.blockchain.block; import java.math.BigInteger; import java.nio.ByteBuffer; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import static realmetamorph.blockchain.Blockchain.KEY_SIZE; import static realmetamorph.blockchain.Blockchain.completeShaString; class NonceGenerator { private byte[] data; private boolean interrupted; private int threadsCount; private long nonce; NonceGenerator(byte[] psByte, byte[] pkByte, byte[] tsByte, byte[] bhByte, byte[] tcByte, byte[] bsByte, byte[] mrByte) { this.data = new byte[92 + KEY_SIZE]; System.arraycopy(psByte, 0, data, 0, 32); System.arraycopy(pkByte, 0, data, 40, KEY_SIZE); System.arraycopy(tsByte, 0, data, 40 + KEY_SIZE, 8); System.arraycopy(bhByte, 0, data, 48 + KEY_SIZE, 4); System.arraycopy(tcByte, 0, data, 52 + KEY_SIZE, 4); System.arraycopy(bsByte, 0, data, 56 + KEY_SIZE, 4); System.arraycopy(mrByte, 0, data, 60 + KEY_SIZE, 32); this.interrupted = false; this.threadsCount = Runtime.getRuntime().availableProcessors() * 8; this.nonce = 0; } long generateNonce(IBlockGenerator generator) { Thread thread = null; long startNonce = Math.max(generator.getStartNonce(), 0); for (int i = 0; i < threadsCount; i++) { int srt = i; thread = new Thread(new Runnable() { private final long start = srt + startNonce + 1; private final long offset = threadsCount; @Override public void run() { try { MessageDigest digest = MessageDigest.getInstance("SHA-256"); for (long j = start; j < Long.MAX_VALUE; j += offset) { byte[] nonceByte = ByteBuffer.allocate(8).putLong(j).array(); System.arraycopy(nonceByte, 0, data, 32, 8); String shaHex = completeShaString(new BigInteger(1, digest.digest(digest.digest(data))).toString(16)); if (generator.checkSHAHex(shaHex, j)) { nonce = j; interrupted = true; break; } if (interrupted) break; } } catch (NoSuchAlgorithmException ignored) { } } }); thread.start(); } try { if (thread != null) thread.join(); } catch (InterruptedException ignored) { } return nonce; } }
3,055
0.50527
0.485507
78
37.923077
27.900818
130
false
false
0
0
0
0
0
0
1.076923
false
false
14
d19d6843beaf36a5d41318a90ee496f3f022f6c5
13,941,463,865,517
b0c1c81c9b28335cbae305447de63b06459e9bed
/app/src/main/java/ui/AddQuestionFragment.java
d21520b16b7f82fdc7b3d68e30e2e4c77d9d6194
[ "Apache-2.0" ]
permissive
liuyongfeng90/NMDXApp
https://github.com/liuyongfeng90/NMDXApp
8a0658cd6e94e594e1a4f07650968bdc4fb57f87
b2ca8f942946dd2c6484268217d797c97e407ebd
refs/heads/master
2020-02-05T21:04:30.595000
2018-04-05T13:35:14
2018-04-05T13:35:14
97,900,082
2
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ui; import android.annotation.SuppressLint; import android.app.DatePickerDialog; import android.app.DatePickerDialog.OnDateSetListener; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.os.Environment; import android.os.Handler; import android.os.Message; import android.text.TextUtils; import android.view.View; import android.widget.Button; import android.widget.DatePicker; import android.widget.EditText; import android.widget.GridView; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.nmdx.app.Constants; import com.nmdx.app.R; import java.io.File; 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.Locale; import java.util.Map; import adapter.AdapterFragmentAdd; import db.DataHelper; import model.EventsCode; import model.FileInfo; import model.OnSelectListener; import model.QuestionImages; import model.Result; import model.UserInfo; import service.SocketClientAdd; import utils.AddFileMenu; import utils.ImageUtils; import utils.JsonUtil; import utils.MediaUtils; import utils.Util; import view.dialog.MyDialogUpload; import view.dialog.MyDialogYesNo; /** * @author liuyongfeng * @Description: 问题反馈 * @date 2016年3月18日 下午2:26:45 */ public class AddQuestionFragment extends BaseFragment implements OnSelectListener { private static final int SEND_DATA_ACTON = 2;//提交 private View project_item; private View user_item; private View time_item; private TextView time_item_et; private TextView user_item_et; private TextView project_item_et; private EditText remark_item_et; private Button cal_btn; private Button send_btn; private UserInfo user; private GridView gridView; private AdapterFragmentAdd mAdapter; private String date; private List<Long> pids = new ArrayList<>(); private List<Long> userIds = new ArrayList<>(); private ImageView image_add; private MyDialogUpload myDialogUpload; private DataHelper dataHelper; public static String key = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()); // 原始图路径 private List<QuestionImages> path = new ArrayList<>(); //压缩图路劲 private List<String> smallPath = new ArrayList<>(); private SendDataTask sendDataTask; @SuppressLint("HandlerLeak") private Handler mHandler = new Handler() { @Override public void handleMessage(Message msg) { super.handleMessage(msg); switch (msg.what) { case EventsCode.GET_IMAGES://获取照片 mAdapter.notifyDataSetChanged(); break; case SEND_DATA_ACTON: if (TextUtils.isEmpty(folderName)) folderName = Util.getYM() + "\\" + System.currentTimeMillis();//文件夹名称 sendDataTask = new SendDataTask(); sendDataTask.execute(); break; default: break; } } }; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragment_add); user = app.getUserInfo(); dataHelper = new DataHelper(mContext); } @Override protected void initViews() { cal_btn = $(R.id.cel_btn); send_btn = $(R.id.send_btn); project_item = $(R.id.project_item); user_item = $(R.id.user_item); remark_item_et = $(R.id.remark_item_et); time_item = $(R.id.time_item); project_item_et = $(R.id.project_item_et); user_item_et = $(R.id.user_item_et); time_item_et = $(R.id.time_item_et); image_add = $(R.id.image_add); gridView = $(R.id.gridView); mAdapter = new AdapterFragmentAdd(AddQuestionFragment.this, path); gridView.setAdapter(mAdapter); project_item.setOnClickListener(listener); user_item.setOnClickListener(listener); time_item.setOnClickListener(listener); cal_btn.setOnClickListener(listener); send_btn.setOnClickListener(listener); image_add.setOnClickListener(listener); } /** * 按钮点击事件 */ private View.OnClickListener listener = new View.OnClickListener() { @Override public void onClick(View v) { switch (v.getId()) { case R.id.project_item: SelectProjectFragment selectProjectFragment = new SelectProjectFragment(); selectProjectFragment.setOnSelectListener(AddQuestionFragment.this); addFragment(selectProjectFragment); break; case R.id.user_item: SelectUserFragment selectUserFragment = new SelectUserFragment(); selectUserFragment.setOnSelectListener(AddQuestionFragment.this); addFragment(selectUserFragment); break; case R.id.time_item: Calendar calendar = Calendar.getInstance(Locale.CHINA); DatePickerDialog dialog = new DatePickerDialog(mContext, new OnDateSetListener() { @Override public void onDateSet(DatePicker arg0, int arg1, int arg2, int arg3) { time_item_et.setText(String.valueOf(arg1 + "-" + (arg2 + 1) + "-" + arg3)); date = arg1 + "-" + (arg2 + 1) + "-" + arg3; } }, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH)); dialog.show(); break; case R.id.cel_btn: back(); break; case R.id.send_btn: send(); break; case R.id.image_add: AddFileMenu addFileMenu = new AddFileMenu(AddQuestionFragment.this); addFileMenu.addImage(); break; default: break; } } }; @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { case EventsCode.SYSTEM_CAMERA:// 拍照 case EventsCode.ORIENTATION_CAMERA:// 系统拍照 case EventsCode.PHOTO_GALLERY:// 相册 addImage(); break; default: break; } super.onActivityResult(requestCode, resultCode, data); } /** * 获取返回的照片 */ private void addImage() { mHandler.post(new Runnable() { @Override public void run() { if (app.getChooseImages().size() > 0) { for (FileInfo info : app.getChooseImages()) { try { if (info != null && new File(info.getPath()).exists()) { try { QuestionImages images = new QuestionImages(); images.setPath(info.getPath()); path.add(images); } catch (Exception e) { e.printStackTrace(); } } } catch (Exception e) { e.printStackTrace(); } } app.getChooseImages().clear(); mHandler.sendEmptyMessage(EventsCode.GET_IMAGES); } } }); } @Override public void onSelectFinish(int type, Map<Long, String> map) { if (type == 0) {// 项目 StringBuilder sb = new StringBuilder(); pids.clear(); for (Map.Entry<Long, String> entry : map.entrySet()) { sb.append(entry.getValue() + " "); pids.add(entry.getKey()); } project_item_et.setText(sb.toString()); } if (type == 1) {// 人员 StringBuilder sb = new StringBuilder(); userIds.clear(); for (Map.Entry<Long, String> entry : map.entrySet()) { sb.append(entry.getValue() + " "); userIds.add(entry.getKey()); } user_item_et.setText(sb.toString()); } } /** * 提交 */ protected void send() { if (pids == null || pids.size() == 0) { Toast.makeText(mContext, "请选择项目", Toast.LENGTH_LONG).show(); return; } if (userIds == null || userIds.size() == 0) { Toast.makeText(mContext, "请选择接收人", Toast.LENGTH_LONG).show(); return; } if (TextUtils.isEmpty(date)) { Toast.makeText(mContext, "请填写日期", Toast.LENGTH_LONG).show(); return; } final MyDialogYesNo dialogYesNo = new MyDialogYesNo(getActivity()); dialogYesNo.setMessage("确定上传任务信息吗?"); dialogYesNo.setNegativeButton("取消", new View.OnClickListener() { @Override public void onClick(View view) { dialogYesNo.dismiss(); } }); dialogYesNo.setPositiveButton("确定", new View.OnClickListener() { @Override public void onClick(View view) { dialogYesNo.dismiss(); mHandler.sendEmptyMessage(SEND_DATA_ACTON); } }); } /** * 上传任务 */ private int fileCount = 0;// 文件总数 private String folderName;//上传图片到的目标文件夹 private String UploadMsg = "网络中断,请检查网络后,点击【上传】继续上传"; private class SendDataTask extends AsyncTask<String, Integer, String> { private boolean isFinish = false; private boolean isStop = false;//是否停止上传 private Map<String, String> textParams; private Integer[] progress; private SocketClientAdd socketClient = null; @Override protected void onPreExecute() { try { progress = new Integer[]{0, 0, 0}; myDialogUpload = new MyDialogUpload(getActivity()); myDialogUpload.setMsg("正在为您打包压缩数据,请勿退出!"); } catch (Exception e) { e.printStackTrace(); } super.onPreExecute(); } @Override protected String doInBackground(String... params) { /**对要dataitems上传的图片、文件进行压缩及重命名 * 压缩成功true * 失败返回false */ if (!compressData()) { return null; } //收集发送的文本参数 textParams = getPostTextParam(); if (textParams == null) { return null; } //开始上传及状态回调 socketClient = new SocketClientAdd(dataHelper, textParams, smallPath, folderName); socketClient.setCallback(new SocketClientAdd.progressCallback() { @Override public void uploadResult(Result result) { if (result.getCode() == 1) { isFinish = true; } else { isFinish = false; } UploadMsg = result.getMsg(); } @Override public void progress(long fileLengthTemp, long fileLength) { int p = (int) (((float) fileLengthTemp / (float) fileLength) * 100); progress[0] = p; publishProgress(progress); } @Override public void count(int fileCount) { progress[1] = fileCount; } @Override public void uploadCount(int fileCountTemp) { progress[2] = fileCountTemp; publishProgress(progress); } }); socketClient.StartUploadFiles(0);//0--问题反馈,1--整改通知单 return null; } @Override protected void onProgressUpdate(Integer... values) { try { if (values[0] > 0) { myDialogUpload.setNumber(values[0]); } if (values[1] > 0 && values[2] > 0) { if (values[1] == smallPath.size()) { myDialogUpload.setMsg(String.valueOf("(" + values[2] + "/" + values[1] + ")" + getString(R.string.loading_dialog_message_string))); } else { myDialogUpload.setMsg(String.valueOf("(" + values[2] + "/" + values[1] + ")" + getString(R.string.loading_dialog_message_string2))); } } } catch (Exception e) { e.printStackTrace(); } super.onProgressUpdate(values); } @Override protected void onPostExecute(String result) { myDialogUpload.dismiss(); if (isFinish) { Toast.makeText(mContext, "上传成功", Toast.LENGTH_LONG).show(); dataHelper.deleteUploadLog(key); back(); } else { if (!isStop) { Toast.makeText(mContext, UploadMsg, Toast.LENGTH_SHORT).show(); } } super.onPostExecute(result); } } /** * 对要dataitems上传的图片、文件进行压缩及重命名<br> * 压缩成功true * 失败返回false */ @SuppressLint("SimpleDateFormat") private boolean compressData() { try { String taskCompressDataDir = "问题反馈" + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + "/"; fileCount = 0; int fileCountTemp = 0; for (int i = 0; i < path.size(); i++) { fileCountTemp += copyToSDCard(taskCompressDataDir, path.get(i).getPath(), i); fileCount++; } if (fileCountTemp == fileCount) return true; } catch (Exception e) { e.printStackTrace(); } return false; } /*** * 将ItemInfo 文件复制一份到SD卡 * * @param taskCompressDataDir * @param p * @return */ private int copyToSDCard(String taskCompressDataDir, String path, int p) { int fileCountTemp = 0; String name = "问题反馈"; File file = new File(path); if (file.exists()) { String filename = name + "_" + (p + 1) + "." + MediaUtils.getEndType(file.getPath()); String storageState = Environment.getExternalStorageState(); if (storageState.equals(Environment.MEDIA_MOUNTED)) { String newPath = Constants.DEFAULT_SAVE_IMAGE_PATH + taskCompressDataDir + filename; int maxLen = 256; if (ImageUtils.copyImage(mContext, file.getAbsolutePath(), newPath, maxLen)) { fileCountTemp++; smallPath.add(newPath); } } } return fileCountTemp; } /** * 收集发送的文本参数 * * @return */ private Map<String, String> getPostTextParam() { try { user = app.getUserInfo(); Map<String, String> paras = new HashMap<>(); paras.put("userId", user.getUserId()); paras.put("scheduledSurveyorIds", JsonUtil.objectToJson(userIds)); paras.put("projectids", JsonUtil.objectToJson(pids)); paras.put("date", String.valueOf(date)); paras.put("remark", remark_item_et.getText().toString()); return paras; } catch (Exception e) { e.printStackTrace(); } return null; } @Override public void onDestroy() { if (dataHelper != null) { dataHelper.Close(); } super.onDestroy(); } }
UTF-8
Java
16,790
java
AddQuestionFragment.java
Java
[ { "context": "\nimport view.dialog.MyDialogYesNo;\n\n/**\n * @author liuyongfeng\n * @Description: 问题反馈\n * @date 2016年3月18日 下午2:26:", "end": 1337, "score": 0.9981034398078918, "start": 1326, "tag": "USERNAME", "value": "liuyongfeng" }, { "context": " public static String key = new SimpleDateFormat(\"yyyyMMddHHmmss\").format(new Date());\n\n // 原始图路径\n private List<Quest", "end": 2235, "score": 0.8274575471878052, "start": 2212, "tag": "KEY", "value": "yyyyMMddHHmmss\").format" } ]
null
[]
package ui; import android.annotation.SuppressLint; import android.app.DatePickerDialog; import android.app.DatePickerDialog.OnDateSetListener; import android.content.Intent; import android.os.AsyncTask; import android.os.Bundle; import android.os.Environment; import android.os.Handler; import android.os.Message; import android.text.TextUtils; import android.view.View; import android.widget.Button; import android.widget.DatePicker; import android.widget.EditText; import android.widget.GridView; import android.widget.ImageView; import android.widget.TextView; import android.widget.Toast; import com.nmdx.app.Constants; import com.nmdx.app.R; import java.io.File; 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.Locale; import java.util.Map; import adapter.AdapterFragmentAdd; import db.DataHelper; import model.EventsCode; import model.FileInfo; import model.OnSelectListener; import model.QuestionImages; import model.Result; import model.UserInfo; import service.SocketClientAdd; import utils.AddFileMenu; import utils.ImageUtils; import utils.JsonUtil; import utils.MediaUtils; import utils.Util; import view.dialog.MyDialogUpload; import view.dialog.MyDialogYesNo; /** * @author liuyongfeng * @Description: 问题反馈 * @date 2016年3月18日 下午2:26:45 */ public class AddQuestionFragment extends BaseFragment implements OnSelectListener { private static final int SEND_DATA_ACTON = 2;//提交 private View project_item; private View user_item; private View time_item; private TextView time_item_et; private TextView user_item_et; private TextView project_item_et; private EditText remark_item_et; private Button cal_btn; private Button send_btn; private UserInfo user; private GridView gridView; private AdapterFragmentAdd mAdapter; private String date; private List<Long> pids = new ArrayList<>(); private List<Long> userIds = new ArrayList<>(); private ImageView image_add; private MyDialogUpload myDialogUpload; private DataHelper dataHelper; public static String key = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()); // 原始图路径 private List<QuestionImages> path = new ArrayList<>(); //压缩图路劲 private List<String> smallPath = new ArrayList<>(); private SendDataTask sendDataTask; @SuppressLint("HandlerLeak") private Handler mHandler = new Handler() { @Override public void handleMessage(Message msg) { super.handleMessage(msg); switch (msg.what) { case EventsCode.GET_IMAGES://获取照片 mAdapter.notifyDataSetChanged(); break; case SEND_DATA_ACTON: if (TextUtils.isEmpty(folderName)) folderName = Util.getYM() + "\\" + System.currentTimeMillis();//文件夹名称 sendDataTask = new SendDataTask(); sendDataTask.execute(); break; default: break; } } }; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.fragment_add); user = app.getUserInfo(); dataHelper = new DataHelper(mContext); } @Override protected void initViews() { cal_btn = $(R.id.cel_btn); send_btn = $(R.id.send_btn); project_item = $(R.id.project_item); user_item = $(R.id.user_item); remark_item_et = $(R.id.remark_item_et); time_item = $(R.id.time_item); project_item_et = $(R.id.project_item_et); user_item_et = $(R.id.user_item_et); time_item_et = $(R.id.time_item_et); image_add = $(R.id.image_add); gridView = $(R.id.gridView); mAdapter = new AdapterFragmentAdd(AddQuestionFragment.this, path); gridView.setAdapter(mAdapter); project_item.setOnClickListener(listener); user_item.setOnClickListener(listener); time_item.setOnClickListener(listener); cal_btn.setOnClickListener(listener); send_btn.setOnClickListener(listener); image_add.setOnClickListener(listener); } /** * 按钮点击事件 */ private View.OnClickListener listener = new View.OnClickListener() { @Override public void onClick(View v) { switch (v.getId()) { case R.id.project_item: SelectProjectFragment selectProjectFragment = new SelectProjectFragment(); selectProjectFragment.setOnSelectListener(AddQuestionFragment.this); addFragment(selectProjectFragment); break; case R.id.user_item: SelectUserFragment selectUserFragment = new SelectUserFragment(); selectUserFragment.setOnSelectListener(AddQuestionFragment.this); addFragment(selectUserFragment); break; case R.id.time_item: Calendar calendar = Calendar.getInstance(Locale.CHINA); DatePickerDialog dialog = new DatePickerDialog(mContext, new OnDateSetListener() { @Override public void onDateSet(DatePicker arg0, int arg1, int arg2, int arg3) { time_item_et.setText(String.valueOf(arg1 + "-" + (arg2 + 1) + "-" + arg3)); date = arg1 + "-" + (arg2 + 1) + "-" + arg3; } }, calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH)); dialog.show(); break; case R.id.cel_btn: back(); break; case R.id.send_btn: send(); break; case R.id.image_add: AddFileMenu addFileMenu = new AddFileMenu(AddQuestionFragment.this); addFileMenu.addImage(); break; default: break; } } }; @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { case EventsCode.SYSTEM_CAMERA:// 拍照 case EventsCode.ORIENTATION_CAMERA:// 系统拍照 case EventsCode.PHOTO_GALLERY:// 相册 addImage(); break; default: break; } super.onActivityResult(requestCode, resultCode, data); } /** * 获取返回的照片 */ private void addImage() { mHandler.post(new Runnable() { @Override public void run() { if (app.getChooseImages().size() > 0) { for (FileInfo info : app.getChooseImages()) { try { if (info != null && new File(info.getPath()).exists()) { try { QuestionImages images = new QuestionImages(); images.setPath(info.getPath()); path.add(images); } catch (Exception e) { e.printStackTrace(); } } } catch (Exception e) { e.printStackTrace(); } } app.getChooseImages().clear(); mHandler.sendEmptyMessage(EventsCode.GET_IMAGES); } } }); } @Override public void onSelectFinish(int type, Map<Long, String> map) { if (type == 0) {// 项目 StringBuilder sb = new StringBuilder(); pids.clear(); for (Map.Entry<Long, String> entry : map.entrySet()) { sb.append(entry.getValue() + " "); pids.add(entry.getKey()); } project_item_et.setText(sb.toString()); } if (type == 1) {// 人员 StringBuilder sb = new StringBuilder(); userIds.clear(); for (Map.Entry<Long, String> entry : map.entrySet()) { sb.append(entry.getValue() + " "); userIds.add(entry.getKey()); } user_item_et.setText(sb.toString()); } } /** * 提交 */ protected void send() { if (pids == null || pids.size() == 0) { Toast.makeText(mContext, "请选择项目", Toast.LENGTH_LONG).show(); return; } if (userIds == null || userIds.size() == 0) { Toast.makeText(mContext, "请选择接收人", Toast.LENGTH_LONG).show(); return; } if (TextUtils.isEmpty(date)) { Toast.makeText(mContext, "请填写日期", Toast.LENGTH_LONG).show(); return; } final MyDialogYesNo dialogYesNo = new MyDialogYesNo(getActivity()); dialogYesNo.setMessage("确定上传任务信息吗?"); dialogYesNo.setNegativeButton("取消", new View.OnClickListener() { @Override public void onClick(View view) { dialogYesNo.dismiss(); } }); dialogYesNo.setPositiveButton("确定", new View.OnClickListener() { @Override public void onClick(View view) { dialogYesNo.dismiss(); mHandler.sendEmptyMessage(SEND_DATA_ACTON); } }); } /** * 上传任务 */ private int fileCount = 0;// 文件总数 private String folderName;//上传图片到的目标文件夹 private String UploadMsg = "网络中断,请检查网络后,点击【上传】继续上传"; private class SendDataTask extends AsyncTask<String, Integer, String> { private boolean isFinish = false; private boolean isStop = false;//是否停止上传 private Map<String, String> textParams; private Integer[] progress; private SocketClientAdd socketClient = null; @Override protected void onPreExecute() { try { progress = new Integer[]{0, 0, 0}; myDialogUpload = new MyDialogUpload(getActivity()); myDialogUpload.setMsg("正在为您打包压缩数据,请勿退出!"); } catch (Exception e) { e.printStackTrace(); } super.onPreExecute(); } @Override protected String doInBackground(String... params) { /**对要dataitems上传的图片、文件进行压缩及重命名 * 压缩成功true * 失败返回false */ if (!compressData()) { return null; } //收集发送的文本参数 textParams = getPostTextParam(); if (textParams == null) { return null; } //开始上传及状态回调 socketClient = new SocketClientAdd(dataHelper, textParams, smallPath, folderName); socketClient.setCallback(new SocketClientAdd.progressCallback() { @Override public void uploadResult(Result result) { if (result.getCode() == 1) { isFinish = true; } else { isFinish = false; } UploadMsg = result.getMsg(); } @Override public void progress(long fileLengthTemp, long fileLength) { int p = (int) (((float) fileLengthTemp / (float) fileLength) * 100); progress[0] = p; publishProgress(progress); } @Override public void count(int fileCount) { progress[1] = fileCount; } @Override public void uploadCount(int fileCountTemp) { progress[2] = fileCountTemp; publishProgress(progress); } }); socketClient.StartUploadFiles(0);//0--问题反馈,1--整改通知单 return null; } @Override protected void onProgressUpdate(Integer... values) { try { if (values[0] > 0) { myDialogUpload.setNumber(values[0]); } if (values[1] > 0 && values[2] > 0) { if (values[1] == smallPath.size()) { myDialogUpload.setMsg(String.valueOf("(" + values[2] + "/" + values[1] + ")" + getString(R.string.loading_dialog_message_string))); } else { myDialogUpload.setMsg(String.valueOf("(" + values[2] + "/" + values[1] + ")" + getString(R.string.loading_dialog_message_string2))); } } } catch (Exception e) { e.printStackTrace(); } super.onProgressUpdate(values); } @Override protected void onPostExecute(String result) { myDialogUpload.dismiss(); if (isFinish) { Toast.makeText(mContext, "上传成功", Toast.LENGTH_LONG).show(); dataHelper.deleteUploadLog(key); back(); } else { if (!isStop) { Toast.makeText(mContext, UploadMsg, Toast.LENGTH_SHORT).show(); } } super.onPostExecute(result); } } /** * 对要dataitems上传的图片、文件进行压缩及重命名<br> * 压缩成功true * 失败返回false */ @SuppressLint("SimpleDateFormat") private boolean compressData() { try { String taskCompressDataDir = "问题反馈" + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + "/"; fileCount = 0; int fileCountTemp = 0; for (int i = 0; i < path.size(); i++) { fileCountTemp += copyToSDCard(taskCompressDataDir, path.get(i).getPath(), i); fileCount++; } if (fileCountTemp == fileCount) return true; } catch (Exception e) { e.printStackTrace(); } return false; } /*** * 将ItemInfo 文件复制一份到SD卡 * * @param taskCompressDataDir * @param p * @return */ private int copyToSDCard(String taskCompressDataDir, String path, int p) { int fileCountTemp = 0; String name = "问题反馈"; File file = new File(path); if (file.exists()) { String filename = name + "_" + (p + 1) + "." + MediaUtils.getEndType(file.getPath()); String storageState = Environment.getExternalStorageState(); if (storageState.equals(Environment.MEDIA_MOUNTED)) { String newPath = Constants.DEFAULT_SAVE_IMAGE_PATH + taskCompressDataDir + filename; int maxLen = 256; if (ImageUtils.copyImage(mContext, file.getAbsolutePath(), newPath, maxLen)) { fileCountTemp++; smallPath.add(newPath); } } } return fileCountTemp; } /** * 收集发送的文本参数 * * @return */ private Map<String, String> getPostTextParam() { try { user = app.getUserInfo(); Map<String, String> paras = new HashMap<>(); paras.put("userId", user.getUserId()); paras.put("scheduledSurveyorIds", JsonUtil.objectToJson(userIds)); paras.put("projectids", JsonUtil.objectToJson(pids)); paras.put("date", String.valueOf(date)); paras.put("remark", remark_item_et.getText().toString()); return paras; } catch (Exception e) { e.printStackTrace(); } return null; } @Override public void onDestroy() { if (dataHelper != null) { dataHelper.Close(); } super.onDestroy(); } }
16,790
0.529314
0.52532
497
31.740442
24.060266
119
false
false
0
0
0
0
0
0
0.577465
false
false
14
7dda856a8d84b20b0e14d65e3071c7ae42dfc425
36,532,991,849,071
3042a5f9fee36ef330c89bcb0268a6f1e275812a
/SoftCon2020_Assignment_5/AirportShuttleService/src/CostBehavior.java
07dcd2497e3597583c1054ec8e5822b9db519259
[]
no_license
HuberNicolas/swc-group38
https://github.com/HuberNicolas/swc-group38
14a6bbd36ecfbc0a8243c3566863083a0169e1b6
6461a9f66bfaa4b604dcee976fb886b9f1ffe550
refs/heads/master
2023-03-08T13:11:35.011000
2021-02-22T07:59:45
2021-02-22T07:59:45
296,023,252
3
0
null
null
null
null
null
null
null
null
null
null
null
null
null
/** * interface for the cost behaviour */ public interface CostBehavior { public void printCostBehavior(); } // encapsulated cost behaviour class CHFhour implements CostBehavior{ @Override public void printCostBehavior() { System.out.print("CHF/h" + "\n"); } } class CHF implements CostBehavior{ @Override public void printCostBehavior() { System.out.print("CHF" + "\n"); } }
UTF-8
Java
422
java
CostBehavior.java
Java
[]
null
[]
/** * interface for the cost behaviour */ public interface CostBehavior { public void printCostBehavior(); } // encapsulated cost behaviour class CHFhour implements CostBehavior{ @Override public void printCostBehavior() { System.out.print("CHF/h" + "\n"); } } class CHF implements CostBehavior{ @Override public void printCostBehavior() { System.out.print("CHF" + "\n"); } }
422
0.658768
0.658768
20
20.15
16.140863
41
false
false
0
0
0
0
0
0
0.15
false
false
14
736e45937a4ca81d61c2e3e265e3ab21c5b92825
38,860,864,109,449
14a467154b3f5b26bec68333b11ab8481829abea
/src/com/example/wicket/helper/StringHelper.java
7bfbbe2ce64d78258f0f227f007a8fb2132961d9
[]
no_license
madhubhushan/bcpoc
https://github.com/madhubhushan/bcpoc
74386b5a32c9eae00e321905c7a1642ce625ba24
f41ba9b7b6816648c87a7fdceca55c60f909c40f
refs/heads/master
2021-05-15T09:10:20.528000
2017-10-30T18:38:09
2017-10-30T18:38:09
108,003,819
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.example.wicket.helper; public class StringHelper { public static boolean isNullOrEmpty(String stringToCheck) { return stringToCheck == null || stringToCheck.isEmpty(); } }
UTF-8
Java
190
java
StringHelper.java
Java
[]
null
[]
package com.example.wicket.helper; public class StringHelper { public static boolean isNullOrEmpty(String stringToCheck) { return stringToCheck == null || stringToCheck.isEmpty(); } }
190
0.768421
0.768421
9
20.111111
23.283014
58
false
false
0
0
0
0
0
0
1
false
false
14
c08d61e3c0d6ebb94a6acd17eb15fdde187b4282
38,860,864,110,878
5aa89c4889b6a2c8d813891a95b8a5abc4224cc6
/app/src/main/java/ro/pub/cs/systems/eim/practicaltest02/ClientThreadAsyncTask.java
8bce8c56d4567965d501c1537b0ea9ad6b334edf
[ "Apache-2.0" ]
permissive
Anghel96/PracticalTest02
https://github.com/Anghel96/PracticalTest02
b0d998ab83b9140fab3a17c74700a4d36699233c
63ce44861b852c85871702c8e4175139ef02f411
refs/heads/master
2020-05-24T10:23:11.271000
2019-05-19T18:13:15
2019-05-19T18:13:15
187,227,639
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package ro.pub.cs.systems.eim.practicaltest02; import android.os.AsyncTask; import android.util.Log; import android.widget.TextView; import java.io.BufferedReader; import java.io.IOException; import java.io.PrintWriter; import java.net.Socket; public class ClientThreadAsyncTask extends AsyncTask<String, String, Void> { private TextView messageTextView; public ClientThreadAsyncTask(TextView messageTextView) { this.messageTextView = messageTextView; } @Override protected Void doInBackground(String... params) { String address; int port; String city; String getWeatherInfo; Socket socket = null; try { port = Integer.parseInt(params[0]); address = params[1]; city = params[2]; getWeatherInfo = params[3]; socket = new Socket(address, port); if (socket == null) { Log.e("TAG", "[CLIENT THREAD] Could not create socket!"); } PrintWriter printWriter = Utilities.getWriter(socket); BufferedReader bufferedReader = Utilities.getReader(socket); if(printWriter == null || bufferedReader == null) { Log.e("TAG", "[CLIENT THREAD] Buffered Reader / Print Writer are null!"); } printWriter.println(city); printWriter.flush(); printWriter.println(getWeatherInfo); printWriter.flush(); String content; while ((content = bufferedReader.readLine()) != null) { final String finalContent = content; messageTextView.post(new Runnable() { @Override public void run() { publishProgress(finalContent); } }); } } catch (IOException ioException) { Log.e(Constants.TAG, "[CLIENT THREAD] An exception has occurred: " + ioException.getMessage()); if (Constants.DEBUG) { ioException.printStackTrace(); } } finally { if (socket != null) { try { socket.close(); } catch (IOException ioException) { Log.e(Constants.TAG, "[CLIENT THREAD] An exception has occurred: " + ioException.getMessage()); if (Constants.DEBUG) { ioException.printStackTrace(); } } } } return null; } @Override protected void onPreExecute() { messageTextView.setText(""); } @Override protected void onProgressUpdate(String... values) { messageTextView.append(values[0] + "\n"); } @Override protected void onPostExecute(Void aVoid) {} }
UTF-8
Java
2,945
java
ClientThreadAsyncTask.java
Java
[]
null
[]
package ro.pub.cs.systems.eim.practicaltest02; import android.os.AsyncTask; import android.util.Log; import android.widget.TextView; import java.io.BufferedReader; import java.io.IOException; import java.io.PrintWriter; import java.net.Socket; public class ClientThreadAsyncTask extends AsyncTask<String, String, Void> { private TextView messageTextView; public ClientThreadAsyncTask(TextView messageTextView) { this.messageTextView = messageTextView; } @Override protected Void doInBackground(String... params) { String address; int port; String city; String getWeatherInfo; Socket socket = null; try { port = Integer.parseInt(params[0]); address = params[1]; city = params[2]; getWeatherInfo = params[3]; socket = new Socket(address, port); if (socket == null) { Log.e("TAG", "[CLIENT THREAD] Could not create socket!"); } PrintWriter printWriter = Utilities.getWriter(socket); BufferedReader bufferedReader = Utilities.getReader(socket); if(printWriter == null || bufferedReader == null) { Log.e("TAG", "[CLIENT THREAD] Buffered Reader / Print Writer are null!"); } printWriter.println(city); printWriter.flush(); printWriter.println(getWeatherInfo); printWriter.flush(); String content; while ((content = bufferedReader.readLine()) != null) { final String finalContent = content; messageTextView.post(new Runnable() { @Override public void run() { publishProgress(finalContent); } }); } } catch (IOException ioException) { Log.e(Constants.TAG, "[CLIENT THREAD] An exception has occurred: " + ioException.getMessage()); if (Constants.DEBUG) { ioException.printStackTrace(); } } finally { if (socket != null) { try { socket.close(); } catch (IOException ioException) { Log.e(Constants.TAG, "[CLIENT THREAD] An exception has occurred: " + ioException.getMessage()); if (Constants.DEBUG) { ioException.printStackTrace(); } } } } return null; } @Override protected void onPreExecute() { messageTextView.setText(""); } @Override protected void onProgressUpdate(String... values) { messageTextView.append(values[0] + "\n"); } @Override protected void onPostExecute(Void aVoid) {} }
2,945
0.533786
0.531409
88
31.46591
23.961594
115
false
false
0
0
0
0
0
0
0.556818
false
false
14
0eef71203dd7e8481f65f503f41d25625932c6dc
38,869,454,029,741
e6bd8e921e7c3df087161aae49eca728f17b4c31
/demo/app/src/main/java/com/michaelflisar/lumberjack/demo/MainActivity.java
f208b55716e7bcb5e15a0c70b978561505b19864
[ "Apache-2.0" ]
permissive
Raskilas/Lumberjack
https://github.com/Raskilas/Lumberjack
3c363be866626c6e919589d91c48d133bc98d040
365427ac2705eb32a8dc2629d2d174f3ad966a77
refs/heads/master
2020-03-17T14:40:49.039000
2018-02-22T20:26:07
2018-02-22T20:26:07
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.michaelflisar.lumberjack.demo; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import java.util.ArrayList; import java.util.Arrays; public class MainActivity extends AppCompatActivity implements View.OnClickListener { private int mCount = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState != null) mCount = savedInstanceState.getInt("mCount"); findViewById(R.id.btLog).setOnClickListener(this); findViewById(R.id.btLogError).setOnClickListener(this); // here we can ask for the permission, so we init the overlay logger in here // make sure to pass on the result of the permission dialog to the overlay logger! L.initOverlayLogger(this); // Test 1: a few simple test messages (no groups used) L.d("Main activity created"); L.d("Test message 1: %s", "This is the first simple test log"); L.e(new Throwable("ERROR"), "Test error: %s", "Test error log"); // ... all syntaxes supported by timber are supported by lumberjack! // Test 2: simple advanced logging messages // => we enabled pretty collection printing so following will look good when logged // => we enabled to print the first 5 values of collections, so following will print the values of the collection L.d("Test array log: %s", new ArrayList<>(Arrays.asList("array value 1", "array value 2"))); // Test 3: a few logs with usage of groups L.withGroup(L.G_TEST1).d("Test message in test group"); L.withGroup(L.G_TEST1).d("Test message in test group, value=%d", 999); // Test 4: Send a log that is filtered by our test filter => this message must be ignored by the loggers! // Filters can be defined for each logger seperately L.withGroup(L.G_FILTERED).e("This message should NOT appear anywhere because the group is filtered!"); // Test 5 - custom object formatting // we have registered a custom formatter for our TestClass, so we can DIRECTLY pass TestClasses for any string paramter and lumberjack will take care of it! L.d("Test custom object log: %s", new TestClass(99)); L.d("Test custom object array log: %s", new ArrayList<>(Arrays.asList(new TestClass(1), new TestClass(2), new TestClass(10)))); // Test 6 - log labeled value pairs L.d(L.labeledValueBuilder() .addPair("String", "Value") .addPair("Integer", 999) .addPair("Long", 5L)); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { L.handleOverlayPermissionDialogResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data); } @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putInt("mCount", mCount); } @Override public void onClick(View view) { if (view.getId() == R.id.btLog) { mCount++; L.d("Button clicked: %d", mCount); } else { L.e("Error message"); } } public static class TestClass { public int x; public TestClass(int x) { this.x = x; } public String getLogData() { return "TestLogData says: My x value is " + x; } } }
UTF-8
Java
3,661
java
MainActivity.java
Java
[ { "context": "package com.michaelflisar.lumberjack.demo;\n\nimport android.content.Intent;\n", "end": 25, "score": 0.9843703508377075, "start": 12, "tag": "USERNAME", "value": "michaelflisar" } ]
null
[]
package com.michaelflisar.lumberjack.demo; import android.content.Intent; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import java.util.ArrayList; import java.util.Arrays; public class MainActivity extends AppCompatActivity implements View.OnClickListener { private int mCount = 0; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); if (savedInstanceState != null) mCount = savedInstanceState.getInt("mCount"); findViewById(R.id.btLog).setOnClickListener(this); findViewById(R.id.btLogError).setOnClickListener(this); // here we can ask for the permission, so we init the overlay logger in here // make sure to pass on the result of the permission dialog to the overlay logger! L.initOverlayLogger(this); // Test 1: a few simple test messages (no groups used) L.d("Main activity created"); L.d("Test message 1: %s", "This is the first simple test log"); L.e(new Throwable("ERROR"), "Test error: %s", "Test error log"); // ... all syntaxes supported by timber are supported by lumberjack! // Test 2: simple advanced logging messages // => we enabled pretty collection printing so following will look good when logged // => we enabled to print the first 5 values of collections, so following will print the values of the collection L.d("Test array log: %s", new ArrayList<>(Arrays.asList("array value 1", "array value 2"))); // Test 3: a few logs with usage of groups L.withGroup(L.G_TEST1).d("Test message in test group"); L.withGroup(L.G_TEST1).d("Test message in test group, value=%d", 999); // Test 4: Send a log that is filtered by our test filter => this message must be ignored by the loggers! // Filters can be defined for each logger seperately L.withGroup(L.G_FILTERED).e("This message should NOT appear anywhere because the group is filtered!"); // Test 5 - custom object formatting // we have registered a custom formatter for our TestClass, so we can DIRECTLY pass TestClasses for any string paramter and lumberjack will take care of it! L.d("Test custom object log: %s", new TestClass(99)); L.d("Test custom object array log: %s", new ArrayList<>(Arrays.asList(new TestClass(1), new TestClass(2), new TestClass(10)))); // Test 6 - log labeled value pairs L.d(L.labeledValueBuilder() .addPair("String", "Value") .addPair("Integer", 999) .addPair("Long", 5L)); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { L.handleOverlayPermissionDialogResult(requestCode, resultCode, data); super.onActivityResult(requestCode, resultCode, data); } @Override public void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); outState.putInt("mCount", mCount); } @Override public void onClick(View view) { if (view.getId() == R.id.btLog) { mCount++; L.d("Button clicked: %d", mCount); } else { L.e("Error message"); } } public static class TestClass { public int x; public TestClass(int x) { this.x = x; } public String getLogData() { return "TestLogData says: My x value is " + x; } } }
3,661
0.637531
0.630156
101
35.247524
34.438469
164
false
false
0
0
0
0
0
0
0.584158
false
false
14
a573b230b7cc13703891d70214fb876e61790cb4
36,172,214,602,081
808825dc82652254b760526734b600549bcad3ef
/game-service/src/main/java/com/codecta/gameservice/entity/Weapon.java
f8dc8715d672de33befe8f0d6b5179f0827e4d35
[]
no_license
ahmedmujic/spring-boot-microservices
https://github.com/ahmedmujic/spring-boot-microservices
e1d7e923df5c98a21e38fdccb898f5fc18b66a44
f3c145747270918980d14e46221f777ada502085
refs/heads/master
2023-04-27T06:09:53.084000
2021-05-20T10:33:40
2021-05-20T10:33:40
349,227,227
1
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.codecta.gameservice.entity; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import javax.persistence.*; import java.util.ArrayList; import java.util.List; @Entity @Data @NoArgsConstructor @AllArgsConstructor public class Weapon { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Integer id; private String weaponName; private Double damage; private Integer weaponHealth; @OneToMany(mappedBy = "weapon", fetch = FetchType.LAZY) private List<Player> players = new ArrayList<>(); @ManyToMany(mappedBy = "weapons") private List<Inventory> inventories = new ArrayList<>(); }
UTF-8
Java
676
java
Weapon.java
Java
[]
null
[]
package com.codecta.gameservice.entity; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; import javax.persistence.*; import java.util.ArrayList; import java.util.List; @Entity @Data @NoArgsConstructor @AllArgsConstructor public class Weapon { @Id @GeneratedValue(strategy = GenerationType.AUTO) private Integer id; private String weaponName; private Double damage; private Integer weaponHealth; @OneToMany(mappedBy = "weapon", fetch = FetchType.LAZY) private List<Player> players = new ArrayList<>(); @ManyToMany(mappedBy = "weapons") private List<Inventory> inventories = new ArrayList<>(); }
676
0.747041
0.747041
27
24.037037
17.88954
60
false
false
0
0
0
0
0
0
0.518519
false
false
14
e5b972bef1f0e03f62c881c0dc50a0e69b8aba20
39,298,950,794,654
fa47ab057878c892ad343acdfa0e8802b21e9fd9
/EvaluacionFinal6/app/src/main/java/com/exercises/sart1991/evaluacionfinal6/model/Vehicle.java
39e24f449daacd31f5bb1a50c5774401d7022924
[]
no_license
sart1991/android_course_nu
https://github.com/sart1991/android_course_nu
ecf7758b440c35efa996dffc0c52735b70b0b5bf
da73fa9d41eca1631faf9b4066c75ad89b10c5f5
refs/heads/master
2021-01-11T06:46:14.876000
2017-11-09T02:58:26
2017-11-09T02:58:26
71,836,726
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package com.exercises.sart1991.evaluacionfinal6.model; import java.io.Serializable; /** * Created by sart1 on 5/9/2017. */ public class Vehicle implements Serializable { private String registrationNumber; private String clientId; public Vehicle(String registrationNumber, String clientId) { this.registrationNumber = registrationNumber; this.clientId = clientId; } public String getRegistrationNumber() { return registrationNumber; } public void setRegistrationNumber(String registrationNumber) { this.registrationNumber = registrationNumber; } public String getClientId() { return clientId; } public void setClientId(String clientId) { this.clientId = clientId; } @Override public String toString() { return "Vehicle{" + "registrationNumber='" + registrationNumber + '\'' + ", clientId='" + clientId + '\'' + '}'; } }
UTF-8
Java
995
java
Vehicle.java
Java
[ { "context": ";\n\nimport java.io.Serializable;\n\n/**\n * Created by sart1 on 5/9/2017.\n */\n\npublic class Vehicle implements", "end": 109, "score": 0.9996013045310974, "start": 104, "tag": "USERNAME", "value": "sart1" } ]
null
[]
package com.exercises.sart1991.evaluacionfinal6.model; import java.io.Serializable; /** * Created by sart1 on 5/9/2017. */ public class Vehicle implements Serializable { private String registrationNumber; private String clientId; public Vehicle(String registrationNumber, String clientId) { this.registrationNumber = registrationNumber; this.clientId = clientId; } public String getRegistrationNumber() { return registrationNumber; } public void setRegistrationNumber(String registrationNumber) { this.registrationNumber = registrationNumber; } public String getClientId() { return clientId; } public void setClientId(String clientId) { this.clientId = clientId; } @Override public String toString() { return "Vehicle{" + "registrationNumber='" + registrationNumber + '\'' + ", clientId='" + clientId + '\'' + '}'; } }
995
0.637186
0.625126
42
22.690475
21.804857
68
false
false
0
0
0
0
0
0
0.309524
false
false
14
1c1f36ae5cf0cf77a7aa682c276afae282839f69
31,954,556,715,891
59847492fe816e2c364feeebd43f2b22f0347ac5
/Array/Basic Questions/CheckArraySorted.java
222982064448874146b30d466f2b7741b12e2910
[]
no_license
chiraggup1995/Data-Structure-Algorithm
https://github.com/chiraggup1995/Data-Structure-Algorithm
c0bda2c17289908dccf8b838b00b9df096f56bbd
e98ee05666fcc966dca36d00c560cef619731f00
refs/heads/main
2023-07-04T22:07:41.984000
2021-08-19T03:58:13
2021-08-19T03:58:13
345,486,019
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
public class CheckArraySorted { public static boolean check_sorted(int[] array){ boolean sorted_flag = true; if(array.length == 0){ return sorted_flag; } for(int i =0; i < array.length-1; i++){ if(array[i] > array[i+1]){ sorted_flag = false; break; } System.out.println(i); } return sorted_flag; } public static void main(String arg[]){ int[] arr = {2,4,5,6,11,10,10,22}; boolean sorted_flag = check_sorted(arr); if(sorted_flag == true){ System.out.println("Array is sorted"); } else{ System.out.println("Array is not sorted"); } } }
UTF-8
Java
752
java
CheckArraySorted.java
Java
[]
null
[]
public class CheckArraySorted { public static boolean check_sorted(int[] array){ boolean sorted_flag = true; if(array.length == 0){ return sorted_flag; } for(int i =0; i < array.length-1; i++){ if(array[i] > array[i+1]){ sorted_flag = false; break; } System.out.println(i); } return sorted_flag; } public static void main(String arg[]){ int[] arr = {2,4,5,6,11,10,10,22}; boolean sorted_flag = check_sorted(arr); if(sorted_flag == true){ System.out.println("Array is sorted"); } else{ System.out.println("Array is not sorted"); } } }
752
0.485372
0.464096
28
25.857143
17.251738
54
false
false
0
0
0
0
0
0
0.678571
false
false
14
5ecdac7188a16e4e2c11b168b09bb1805fb3dd55
9,629,316,712,269
7f34a1e43bb1ec5091277025cb649f19183e4d9c
/sonarqube-companion-rest/src/main/java/pl/consdata/ico/sqcompanion/violation/project/GroupViolationsHistoryDiff.java
70174d37bfdb134f013f59770df5560f7f1a9c64
[ "MIT" ]
permissive
maciej-consdata/sonarqube-companion
https://github.com/maciej-consdata/sonarqube-companion
1975c4d32f268053064177fe22adbf0c0cc59463
36748b08a7c7b83a1b9795ed30047d0c8cbda9f2
refs/heads/master
2020-05-31T14:38:38.875000
2019-06-05T06:03:53
2019-06-05T06:03:53
190,333,575
0
0
MIT
true
2019-06-05T05:49:43
2019-06-05T05:49:43
2019-04-01T11:30:39
2019-02-28T06:28:35
4,034
0
0
0
null
false
false
package pl.consdata.ico.sqcompanion.violation.project; import lombok.Builder; import lombok.Data; import pl.consdata.ico.sqcompanion.violation.Violations; import pl.consdata.ico.sqcompanion.violation.project.ProjectViolationsHistoryDiff; import java.util.List; @Data @Builder public class GroupViolationsHistoryDiff { private final Violations groupDiff; private final Violations addedViolations; private final Violations removedViolations; private final List<ProjectViolationsHistoryDiff> projectDiffs; }
UTF-8
Java
526
java
GroupViolationsHistoryDiff.java
Java
[]
null
[]
package pl.consdata.ico.sqcompanion.violation.project; import lombok.Builder; import lombok.Data; import pl.consdata.ico.sqcompanion.violation.Violations; import pl.consdata.ico.sqcompanion.violation.project.ProjectViolationsHistoryDiff; import java.util.List; @Data @Builder public class GroupViolationsHistoryDiff { private final Violations groupDiff; private final Violations addedViolations; private final Violations removedViolations; private final List<ProjectViolationsHistoryDiff> projectDiffs; }
526
0.825095
0.825095
19
26.68421
25.60644
82
false
false
0
0
0
0
0
0
0.526316
false
false
14
3d27c3ba1302d29a15264fb6e77ea56e294d6b9b
5,454,608,500,227
ccf3acc82cddeec37ee58277b4c4624618af5118
/src/filter/DataFilter.java
5741de9ba972b43ab1c0d5cedd631abe77450682
[]
no_license
plaa/ArduinoAD
https://github.com/plaa/ArduinoAD
6ba2a881ef92c588590f42aa72a380b4a943c7c2
650b8724f29640212796a9ce3811152716ec25fa
refs/heads/master
2021-01-20T04:30:08.721000
2013-04-08T20:03:03
2013-04-08T20:03:03
null
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package filter; import java.util.List; import seriallistener.AbstractDataSource; import seriallistener.DataListener; import seriallistener.DataVO; public abstract class DataFilter extends AbstractDataSource implements DataListener { private int sampleCount = 0; private int byteMissCount = 0; private int timingMissCount = 0; /** * The current byte miss count. This value is increased every time a byte * miss event is received. */ public int getByteMissCount() { return byteMissCount; } /** * Set the current byte miss count. */ public void setByteMissCount(int byteMissCount) { this.byteMissCount = byteMissCount; } public int getSampleCount() { return sampleCount; } public void setSampleCount(int count) { this.sampleCount = count; } public int getTimingMissCount() { return timingMissCount; } public void setTimingMissCount(int timingMissCount) { this.timingMissCount = timingMissCount; } public void reset() { this.timingMissCount = 0; this.sampleCount = 0; this.byteMissCount = 0; } @Override public void processData(final List<DataVO> data) { for (DataVO d: data) { if (d.isByteMissObject()) byteMissCount++; else sampleCount++; if (d.isTimingFault()) timingMissCount++; filter(d); } fireData(data); } protected abstract void filter(DataVO data); }
UTF-8
Java
1,381
java
DataFilter.java
Java
[]
null
[]
package filter; import java.util.List; import seriallistener.AbstractDataSource; import seriallistener.DataListener; import seriallistener.DataVO; public abstract class DataFilter extends AbstractDataSource implements DataListener { private int sampleCount = 0; private int byteMissCount = 0; private int timingMissCount = 0; /** * The current byte miss count. This value is increased every time a byte * miss event is received. */ public int getByteMissCount() { return byteMissCount; } /** * Set the current byte miss count. */ public void setByteMissCount(int byteMissCount) { this.byteMissCount = byteMissCount; } public int getSampleCount() { return sampleCount; } public void setSampleCount(int count) { this.sampleCount = count; } public int getTimingMissCount() { return timingMissCount; } public void setTimingMissCount(int timingMissCount) { this.timingMissCount = timingMissCount; } public void reset() { this.timingMissCount = 0; this.sampleCount = 0; this.byteMissCount = 0; } @Override public void processData(final List<DataVO> data) { for (DataVO d: data) { if (d.isByteMissObject()) byteMissCount++; else sampleCount++; if (d.isTimingFault()) timingMissCount++; filter(d); } fireData(data); } protected abstract void filter(DataVO data); }
1,381
0.708182
0.703838
78
16.705128
18.551458
85
false
false
0
0
0
0
0
0
1.5
false
false
14
6d8824a58f9a486f5b9300e606ff0789833f9974
17,832,704,243,192
36bf72a3fe3c4abe2f2ba44166bbebdbc18a7643
/nativelevel/Custom/Items/OssoMagico.java
c5c0f19bed8c4550d131dbb9aefe44f126a951f7
[]
no_license
Ziden/KnightsOfMinecraft
https://github.com/Ziden/KnightsOfMinecraft
d682d786e4980fda9006902012e050b6d00f5cf8
ff5ab136b716e4801e29800add39069b0bde1f5f
refs/heads/master
2021-08-15T06:45:49.625000
2017-11-17T14:46:05
2017-11-17T14:46:05
110,597,785
14
4
null
null
null
null
null
null
null
null
null
null
null
null
null
/* ╭╮╭━╮╱╱╭━╮╭━╮ ┃┃┃╭╯╱╱┃┃╰╯┃┃ ┃╰╯╯╭━━┫╭╮╭╮┃ ┃╭╮┃┃╭╮┃┃┃┃┃┃ ┃┃┃╰┫╰╯┃┃┃┃┃┃ ╰╯╰━┻━━┻╯╰╯╰╯ Desenvolvedor: ZidenVentania Colaboradores: NeT32, Gabripj, Feldmann Patrocionio: InstaMC */ package nativelevel.Custom.Items; import nativelevel.Custom.CustomItem; import nativelevel.Jobs; import nativelevel.KoM; import nativelevel.Lang.L; import org.bukkit.ChatColor; import org.bukkit.Effect; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Fireball; import org.bukkit.entity.Player; import org.bukkit.entity.SmallFireball; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; import org.bukkit.util.Vector; public class OssoMagico extends CustomItem { public OssoMagico() { super(Material.BONE, L.m("Osso Magico"),L.m("Domesticador de Lobos"),CustomItem.INCOMUM); } @Override public boolean onItemInteract(Player player) { return true; } }
UTF-8
Java
1,107
java
OssoMagico.java
Java
[ { "context": "╯╰╯\n\n Desenvolvedor: ZidenVentania\n Colaboradores: NeT32, Gabripj, Feldmann\n Patrocionio: InstaMC\n\n */\npac", "end": 147, "score": 0.9846763014793396, "start": 142, "tag": "USERNAME", "value": "NeT32" }, { "context": "esenvolvedor: ZidenVentania\n Colaboradores: NeT32, Gabripj, Feldmann\n Patrocionio: InstaMC\n\n */\npackage nati", "end": 156, "score": 0.8537442088127136, "start": 149, "tag": "NAME", "value": "Gabripj" }, { "context": "dor: ZidenVentania\n Colaboradores: NeT32, Gabripj, Feldmann\n Patrocionio: InstaMC\n\n */\npackage nativelevel.Cu", "end": 166, "score": 0.9831734299659729, "start": 158, "tag": "NAME", "value": "Feldmann" } ]
null
[]
/* ╭╮╭━╮╱╱╭━╮╭━╮ ┃┃┃╭╯╱╱┃┃╰╯┃┃ ┃╰╯╯╭━━┫╭╮╭╮┃ ┃╭╮┃┃╭╮┃┃┃┃┃┃ ┃┃┃╰┫╰╯┃┃┃┃┃┃ ╰╯╰━┻━━┻╯╰╯╰╯ Desenvolvedor: ZidenVentania Colaboradores: NeT32, Gabripj, Feldmann Patrocionio: InstaMC */ package nativelevel.Custom.Items; import nativelevel.Custom.CustomItem; import nativelevel.Jobs; import nativelevel.KoM; import nativelevel.Lang.L; import org.bukkit.ChatColor; import org.bukkit.Effect; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.Fireball; import org.bukkit.entity.Player; import org.bukkit.entity.SmallFireball; import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffectType; import org.bukkit.util.Vector; public class OssoMagico extends CustomItem { public OssoMagico() { super(Material.BONE, L.m("Osso Magico"),L.m("Domesticador de Lobos"),CustomItem.INCOMUM); } @Override public boolean onItemInteract(Player player) { return true; } }
1,107
0.6898
0.687697
43
21.093023
18.648293
97
false
false
0
0
0
0
0
0
0.511628
false
false
14
7b2052781243dff06bfe4ce744599902239e699c
31,619,549,254,323
199cd65095ec65fde6e588468e5284d41aa53f5b
/SortedIntList.java
897c9e7e2ae082596cb94091790a67230657038d
[]
no_license
cindyhou0210/ArrayIntList
https://github.com/cindyhou0210/ArrayIntList
7101152425781c00df3fbb7f93843b0f897ed88d
08172494b3b170f9f2a3f915bd03be79e348c2c2
refs/heads/master
2020-11-29T23:24:19.504000
2019-12-26T09:54:16
2019-12-26T09:54:16
230,237,960
0
0
null
null
null
null
null
null
null
null
null
null
null
null
null
package main; import java.util.*; //Cindy hou //Cosi12B //Antonella Dililo //cindyhou0210@brandeis.edu //this is the sortedIntList object class with constructors and various methods, this class inherits //basic behaviors from parent class ArrayIntList public class SortedIntList extends ArrayIntList { private boolean unique; /** * inheritate from the parent class */ public SortedIntList() { super(); } /** * constructor * @param unique */ public SortedIntList(boolean unique) { super(); this.unique = unique; } /** * constructing a new object with capacity * @param capacity */ public SortedIntList(int capacity) { super(capacity); this.unique = false; } /** * constructor a new object with its uniqueness and capacity * @param unique * @param capacity */ public SortedIntList(boolean unique, int capacity) { super(capacity); this.unique = unique; } /** * add value in the sorted array, array should be remain sorted */ public void add(int value) { if(size() < this.getLength() && indexOf(value) < 0 || !unique) { if(size() == 0) { resetValue(0,value); } for(int i = size(); i >0; i--) { if(get(i-1) > value) { //get (i) = get(i -1); resetValue(i, get(i-1)); //intList[i - 1] = value; resetValue(i-1, value); } else { //intList[i] = value; resetValue(i,value); i = -1; } } } int neS = size(); setSize(neS + 1); } /** * throws an exception when try to add value to a specific index */ public void add(int index, int value) { throw new UnsupportedOperationException("unsupported"); } /** * get the status of uniqueness * @return the status */ public boolean getUnique() { return unique; } /** * search for the minimum value in the array * @return the min value */ public int min() { int min = get(0); for(int i = 1; i < size(); i++) { if(get(i) < min) { min =get(i); } } return min; } /** * search for the maximum value in the array * @return the max value */ public int max() { int max = get(0); for(int i = 1; i < size(); i++) { if(get(i) > max) { max = get(i); } } return max; } /** * set the unique status to the parameter. if funique equals to true remove all the duplicates * @param unique */ public void setUnique(boolean unique) { if(unique == true) { for(int i = 0; i < size(); i++) { for(int j = i+1; j < size(); j++) { if(get(i) == get(j)) { remove(i); } } } this.unique= unique; } else { this.unique = unique; } } /** * return the index of the value * negative if its not found */ public int indexOf(int value) { int index1 =binarySearch(value); return index1; } /** * to String method */ public String toString() { int [] array = new int[this.size()]; for(int i = 0; i < array.length;i++) { array[i] = this.get(i); } if(unique == true) { return "S: " + Arrays.toString(array) + "U"; } return "S: " + Arrays.toString(array); } }
UTF-8
Java
3,241
java
SortedIntList.java
Java
[ { "context": "package main;\r\n\r\nimport java.util.*;\r\n//Cindy hou\r\n//Cosi12B\r\n//Antonella Dililo\r\n//cindyhou0210@br", "end": 49, "score": 0.999879002571106, "start": 40, "tag": "NAME", "value": "Cindy hou" }, { "context": "kage main;\r\n\r\nimport java.util.*;\r\n//Cindy hou\r\n//Cosi12B\r\n//Antonella Dililo\r\n//cindyhou0210@brandeis.edu\r", "end": 60, "score": 0.9912703633308411, "start": 53, "tag": "USERNAME", "value": "Cosi12B" }, { "context": "\n\r\nimport java.util.*;\r\n//Cindy hou\r\n//Cosi12B\r\n//Antonella Dililo\r\n//cindyhou0210@brandeis.edu\r\n//this is the sorte", "end": 80, "score": 0.9998806118965149, "start": 64, "tag": "NAME", "value": "Antonella Dililo" }, { "context": "*;\r\n//Cindy hou\r\n//Cosi12B\r\n//Antonella Dililo\r\n//cindyhou0210@brandeis.edu\r\n//this is the sortedIntList object class with co", "end": 109, "score": 0.9999302625656128, "start": 84, "tag": "EMAIL", "value": "cindyhou0210@brandeis.edu" } ]
null
[]
package main; import java.util.*; //<NAME> //Cosi12B //<NAME> //<EMAIL> //this is the sortedIntList object class with constructors and various methods, this class inherits //basic behaviors from parent class ArrayIntList public class SortedIntList extends ArrayIntList { private boolean unique; /** * inheritate from the parent class */ public SortedIntList() { super(); } /** * constructor * @param unique */ public SortedIntList(boolean unique) { super(); this.unique = unique; } /** * constructing a new object with capacity * @param capacity */ public SortedIntList(int capacity) { super(capacity); this.unique = false; } /** * constructor a new object with its uniqueness and capacity * @param unique * @param capacity */ public SortedIntList(boolean unique, int capacity) { super(capacity); this.unique = unique; } /** * add value in the sorted array, array should be remain sorted */ public void add(int value) { if(size() < this.getLength() && indexOf(value) < 0 || !unique) { if(size() == 0) { resetValue(0,value); } for(int i = size(); i >0; i--) { if(get(i-1) > value) { //get (i) = get(i -1); resetValue(i, get(i-1)); //intList[i - 1] = value; resetValue(i-1, value); } else { //intList[i] = value; resetValue(i,value); i = -1; } } } int neS = size(); setSize(neS + 1); } /** * throws an exception when try to add value to a specific index */ public void add(int index, int value) { throw new UnsupportedOperationException("unsupported"); } /** * get the status of uniqueness * @return the status */ public boolean getUnique() { return unique; } /** * search for the minimum value in the array * @return the min value */ public int min() { int min = get(0); for(int i = 1; i < size(); i++) { if(get(i) < min) { min =get(i); } } return min; } /** * search for the maximum value in the array * @return the max value */ public int max() { int max = get(0); for(int i = 1; i < size(); i++) { if(get(i) > max) { max = get(i); } } return max; } /** * set the unique status to the parameter. if funique equals to true remove all the duplicates * @param unique */ public void setUnique(boolean unique) { if(unique == true) { for(int i = 0; i < size(); i++) { for(int j = i+1; j < size(); j++) { if(get(i) == get(j)) { remove(i); } } } this.unique= unique; } else { this.unique = unique; } } /** * return the index of the value * negative if its not found */ public int indexOf(int value) { int index1 =binarySearch(value); return index1; } /** * to String method */ public String toString() { int [] array = new int[this.size()]; for(int i = 0; i < array.length;i++) { array[i] = this.get(i); } if(unique == true) { return "S: " + Arrays.toString(array) + "U"; } return "S: " + Arrays.toString(array); } }
3,210
0.55847
0.550447
164
17.762196
18.122503
100
false
false
0
0
0
0
0
0
2.04878
false
false
14