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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
66fe7dc090db4b0adf49e43f3b2eadb2ad12306f
| 32,023,276,184,567 |
2c6119335524a3487acefafb311df9e515c009a0
|
/src/main/slides-resources/jvmFunctional/code/for-3.java
|
0d91fdc643a9832ca678a3ba3b011ce5f7472978
|
[] |
no_license
|
arnaudbos/slides
|
https://github.com/arnaudbos/slides
|
633db721f05749beefafeac7a1e97bc995eea797
|
3aa8ceb97314137e1a0a41877883a50783830c44
|
refs/heads/master
| 2020-03-22T08:32:00.071000 | 2018-06-29T09:16:05 | 2018-06-29T09:16:05 | 139,772,250 | 0 | 0 | null | true | 2018-07-04T23:01:53 | 2018-07-04T23:01:52 | 2018-06-29T09:16:16 | 2018-06-29T09:16:15 | 180,075 | 0 | 0 | 0 | null | false | null |
public static List<Event> funErrors(List<Event> events, int size) {
return events.stream()
.filter(Event::isError)
.limit(size)
.collect(Collectors.toList());
}
|
UTF-8
|
Java
| 200 |
java
|
for-3.java
|
Java
|
[] | null |
[] |
public static List<Event> funErrors(List<Event> events, int size) {
return events.stream()
.filter(Event::isError)
.limit(size)
.collect(Collectors.toList());
}
| 200 | 0.6 | 0.6 | 6 | 32.5 | 19.972898 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false |
13
|
f0da6bb52368e967bf5cfbcc5d61091220bc5dd9
| 8,675,833,966,495 |
1d6bfe21a951806ef3fd6984fefaf2b66f44b66a
|
/com/csgsystems/udt/customerudtrequest/InvsLineValuesGetBulkUdtTemplateItem.java
|
41e0ceaee694f371b34302feb918aaa82a5a27df
|
[] |
no_license
|
patrickmcgrory/Projects
|
https://github.com/patrickmcgrory/Projects
|
218e1c3ea4f3f57f5f6f218889eb289d927f639e
|
6a9024efc9cb968df3f5cbd3b5cb8cd5482095d8
|
refs/heads/master
| 2018-04-22T06:02:19.798000 | 2015-11-14T17:30:16 | 2015-11-14T17:30:16 | 91,143,423 | 0 | 0 | null | true | 2017-05-13T02:19:23 | 2017-05-13T02:19:23 | 2015-11-02T14:45:23 | 2015-11-14T17:30:51 | 9,760 | 0 | 0 | 0 | null | null | null |
/*
* Generated code DO NOT EDIT
* Generated file: InvsLineValuesGetBulkUdtTemplateItem.java
* Copyright 2006 Comverse, Inc. All Rights Reserved.
*/
package com.csgsystems.udt.customerudtrequest;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.math.BigInteger;
import com.csgsystems.api.bulk.*;
import com.csgsystems.udt.*;
import com.csgsystems.aruba.connection.BSDMSessionContext;
import com.csgsystems.iv.data.*;
/**
*
* Class used to create a InvsLineValuesGetBulkUdtTemplateItem Bulk Template
*
*/
public class InvsLineValuesGetBulkUdtTemplateItem extends BulkUdtTemplateItem {
protected InvsLineValuesObjectKeyData InvsLineValuesGetIn;
/**
*
* Constructor to create a InvsLineValuesGetBulkUdtTemplateItem
* @param id Unique request name
*
*/
public InvsLineValuesGetBulkUdtTemplateItem(String id, BSDMSessionContext context, InvsLineValuesObjectKeyData InvsLineValuesGetInIn) {
super(id, context, "InvsLineValuesGet");
InvsLineValuesGetIn = InvsLineValuesGetInIn;
}
public void translateToMap() {
if (InvsLineValuesGetIn != null) {
InvsLineValuesGetIn.resetFlags(true, true);
addInput("InvsLineValues", InvsLineValuesObjectKeyHelper.toMap(InvsLineValuesGetIn, new HashMap(), "InvsLineValuesObjectKeyData").get("InvsLineValuesObjectKeyData"));
}
}
/**
*
* Sets the InvsLineValues
* @param InvsLineValuesGetInIn Value of the InvsLineValuesGetIn
*
*/
public void setInvsLineValues(InvsLineValuesObjectKeyData InvsLineValuesGetInIn) {
InvsLineValuesGetIn = InvsLineValuesGetInIn;
}
public void translateFromMap() {
InvsLineValuesGetIn = InvsLineValuesObjectKeyHelper.fromMap(inputMap, "InvsLineValues");
}
/**
*
* Gets the InvsLineValues
* @return Value of the InvsLineValues
*
*/
public InvsLineValuesObjectKeyData getInvsLineValues( ) {
return InvsLineValuesGetIn;
}
}
|
UTF-8
|
Java
| 1,906 |
java
|
InvsLineValuesGetBulkUdtTemplateItem.java
|
Java
|
[] | null |
[] |
/*
* Generated code DO NOT EDIT
* Generated file: InvsLineValuesGetBulkUdtTemplateItem.java
* Copyright 2006 Comverse, Inc. All Rights Reserved.
*/
package com.csgsystems.udt.customerudtrequest;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.math.BigInteger;
import com.csgsystems.api.bulk.*;
import com.csgsystems.udt.*;
import com.csgsystems.aruba.connection.BSDMSessionContext;
import com.csgsystems.iv.data.*;
/**
*
* Class used to create a InvsLineValuesGetBulkUdtTemplateItem Bulk Template
*
*/
public class InvsLineValuesGetBulkUdtTemplateItem extends BulkUdtTemplateItem {
protected InvsLineValuesObjectKeyData InvsLineValuesGetIn;
/**
*
* Constructor to create a InvsLineValuesGetBulkUdtTemplateItem
* @param id Unique request name
*
*/
public InvsLineValuesGetBulkUdtTemplateItem(String id, BSDMSessionContext context, InvsLineValuesObjectKeyData InvsLineValuesGetInIn) {
super(id, context, "InvsLineValuesGet");
InvsLineValuesGetIn = InvsLineValuesGetInIn;
}
public void translateToMap() {
if (InvsLineValuesGetIn != null) {
InvsLineValuesGetIn.resetFlags(true, true);
addInput("InvsLineValues", InvsLineValuesObjectKeyHelper.toMap(InvsLineValuesGetIn, new HashMap(), "InvsLineValuesObjectKeyData").get("InvsLineValuesObjectKeyData"));
}
}
/**
*
* Sets the InvsLineValues
* @param InvsLineValuesGetInIn Value of the InvsLineValuesGetIn
*
*/
public void setInvsLineValues(InvsLineValuesObjectKeyData InvsLineValuesGetInIn) {
InvsLineValuesGetIn = InvsLineValuesGetInIn;
}
public void translateFromMap() {
InvsLineValuesGetIn = InvsLineValuesObjectKeyHelper.fromMap(inputMap, "InvsLineValues");
}
/**
*
* Gets the InvsLineValues
* @return Value of the InvsLineValues
*
*/
public InvsLineValuesObjectKeyData getInvsLineValues( ) {
return InvsLineValuesGetIn;
}
}
| 1,906 | 0.775446 | 0.773347 | 73 | 25.109589 | 33.234558 | 172 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.369863 | false | false |
13
|
adf3d29d193c8776e89811075609e2bb4cfdb136
| 12,352,325,970,279 |
339feb0a6e1774b2b4f13666d4c45a071050e59f
|
/张铭铖/01 JAVA基础作业/javase/src/com/qmx/work6/Animal.java
|
b27b8500219a4a4e2ad030c1c3b4d1b030f772ce
|
[] |
no_license
|
404name/QMX-Summer-Institute
|
https://github.com/404name/QMX-Summer-Institute
|
a5f88ff0bfed95a6f6ad7a4d341f6928ed865964
|
68df8868101cb676cd2b346d704e82377f33f41d
|
refs/heads/main
| 2023-06-26T15:05:25.673000 | 2021-07-23T09:37:57 | 2021-07-23T09:37:57 | 382,260,029 | 1 | 7 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.qmx.work6;
//引用类型:类,接口,数组
//interface,接口关键词
//定义一些方法,让不同的人实现
//接口中的所有方法类型默认为 public abstract
//接口中的所有变量类型默认为 public static final(常量)
//关键词implements来实现多个接口(弥补多继承)
public interface Animal {//接口
String cry();
String getAnimalName();
}
|
UTF-8
|
Java
| 403 |
java
|
Animal.java
|
Java
|
[] | null |
[] |
package com.qmx.work6;
//引用类型:类,接口,数组
//interface,接口关键词
//定义一些方法,让不同的人实现
//接口中的所有方法类型默认为 public abstract
//接口中的所有变量类型默认为 public static final(常量)
//关键词implements来实现多个接口(弥补多继承)
public interface Animal {//接口
String cry();
String getAnimalName();
}
| 403 | 0.741176 | 0.737255 | 11 | 22.181818 | 9.934496 | 39 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.454545 | false | false |
13
|
99753a5ad754de58cc007ac4381e2fde15b4c952
| 14,783,277,463,907 |
c7186bd6b888c57995367377c80c10d7057f73da
|
/src/main/java/bo/com/ahosoft/comportamiento/mediator/Formulario.java
|
b2e668436a2d46e88aaea2631f860530b03c8903
|
[] |
no_license
|
Arturo1214/desing-patterns
|
https://github.com/Arturo1214/desing-patterns
|
c8f50ff6c3006fa16f300eae6486404d9f57c6b0
|
964ecc7e4b2c0e85a40598d15011eeefa2e95cdc
|
refs/heads/master
| 2021-07-15T14:40:14.753000 | 2017-10-18T20:18:45 | 2017-10-18T20:18:45 | 106,472,660 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package bo.com.ahosoft.comportamiento.mediator;
import java.util.ArrayList;
import java.util.List;
/**
* Created by : Arturo Herrera o.
* Date : 12-10-17 - 11:56 AM
* Project : desing-patterns
* Package : bo.com.ahosoft.comportamiento.mediator
**/
public class Formulario {
protected List<Control> controles = new ArrayList<Control>();
protected List<Control> controlesCoprestatario = new ArrayList<Control>();
protected PopupMenu menuCoprestatario;
protected Boton botonOk;
protected Boolean enCurso = true;
public void agregaControl(Control control) {
controles.add(control);
control.setDirector(this);
}
public void agregaControlCoprestatario(Control control) {
controlesCoprestatario.add(control);
control.setDirector(this);
}
public void setMenuCoprestatario(PopupMenu menuCoprestatario) {
this.menuCoprestatario = menuCoprestatario;
}
public void setBotonOK(Boton botonOk) {
this.botonOk = botonOk;
}
public void controlModificado(Control control) {
if (control == menuCoprestatario)
if(control.getValor().equals("con coprestatario")) {
for (Control elementoCoprestatario: controlesCoprestatario)
elementoCoprestatario.informa();
}
if( control == botonOk)
enCurso = false;
}
public void informa() {
while (true) {
for (Control control: controles) {
control.informa();
if(!enCurso)
return;
}
}
}
}
|
UTF-8
|
Java
| 1,637 |
java
|
Formulario.java
|
Java
|
[
{
"context": "st;\nimport java.util.List;\n\n/**\n * Created by : Arturo Herrera o.\n * Date : 12-10-17 - 11:56 AM\n * Projec",
"end": 140,
"score": 0.9980723261833191,
"start": 124,
"tag": "NAME",
"value": "Arturo Herrera o"
}
] | null |
[] |
package bo.com.ahosoft.comportamiento.mediator;
import java.util.ArrayList;
import java.util.List;
/**
* Created by : <NAME>.
* Date : 12-10-17 - 11:56 AM
* Project : desing-patterns
* Package : bo.com.ahosoft.comportamiento.mediator
**/
public class Formulario {
protected List<Control> controles = new ArrayList<Control>();
protected List<Control> controlesCoprestatario = new ArrayList<Control>();
protected PopupMenu menuCoprestatario;
protected Boton botonOk;
protected Boolean enCurso = true;
public void agregaControl(Control control) {
controles.add(control);
control.setDirector(this);
}
public void agregaControlCoprestatario(Control control) {
controlesCoprestatario.add(control);
control.setDirector(this);
}
public void setMenuCoprestatario(PopupMenu menuCoprestatario) {
this.menuCoprestatario = menuCoprestatario;
}
public void setBotonOK(Boton botonOk) {
this.botonOk = botonOk;
}
public void controlModificado(Control control) {
if (control == menuCoprestatario)
if(control.getValor().equals("con coprestatario")) {
for (Control elementoCoprestatario: controlesCoprestatario)
elementoCoprestatario.informa();
}
if( control == botonOk)
enCurso = false;
}
public void informa() {
while (true) {
for (Control control: controles) {
control.informa();
if(!enCurso)
return;
}
}
}
}
| 1,627 | 0.621869 | 0.615761 | 57 | 27.719297 | 22.125443 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.315789 | false | false |
13
|
387a2e28602750b77311b2357ea9d90849833e5a
| 15,427,522,556,743 |
4fc66d983100bd37b752d30c869f7a75dbf89984
|
/src/contest/leetcode/linkedlist/Problem203.java
|
62886d15fe12439fe197a22273e7558913065e5f
|
[] |
no_license
|
rushbah123453/Coding-DSA
|
https://github.com/rushbah123453/Coding-DSA
|
442550b3b900f279af68e6a892a53fac298891d2
|
be0e6140380d99f2cc8b72cd11aaccf43377abea
|
refs/heads/master
| 2022-04-28T23:57:37.631000 | 2022-03-24T16:19:26 | 2022-03-24T16:19:26 | 247,305,178 | 4 | 2 | null | false | 2022-03-24T16:19:27 | 2020-03-14T15:46:31 | 2021-12-25T14:45:37 | 2022-03-24T16:19:27 | 1,837 | 1 | 1 | 0 |
Java
| false | false |
package contest.leetcode.linkedlist;
//https://leetcode.com/problems/remove-linked-list-elements/
public class Problem203 {
public ListNode removeElements(ListNode head, int val) {
ListNode temp=head,safe=head;
if(temp==null){
return null;
}
while(temp!=null && temp.val==val){
temp=temp.next;
head=temp;
}
while(temp!=null && temp.next!=null){
//System.out.println(temp.val + "^" + temp.next.val);
if(temp.next.val==val){
temp.next=temp.next.next;
}
else{
temp=temp.next;
}
}
return head;
}
}
|
UTF-8
|
Java
| 700 |
java
|
Problem203.java
|
Java
|
[] | null |
[] |
package contest.leetcode.linkedlist;
//https://leetcode.com/problems/remove-linked-list-elements/
public class Problem203 {
public ListNode removeElements(ListNode head, int val) {
ListNode temp=head,safe=head;
if(temp==null){
return null;
}
while(temp!=null && temp.val==val){
temp=temp.next;
head=temp;
}
while(temp!=null && temp.next!=null){
//System.out.println(temp.val + "^" + temp.next.val);
if(temp.next.val==val){
temp.next=temp.next.next;
}
else{
temp=temp.next;
}
}
return head;
}
}
| 700 | 0.507143 | 0.502857 | 30 | 22.333334 | 19.241159 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.366667 | false | false |
13
|
2487c87c37ae858bd828e996d41be2eadbf441b6
| 14,379,550,531,529 |
226daedadb55e38f21452f4181d468b36d1e5b63
|
/MyTravo/src/com/cobra/mytravo/internet/UploadNoteService.java
|
f1f5f40085a1344ec3e74ca66f86abba50bfd8f2
|
[] |
no_license
|
object8421/MyTravo
|
https://github.com/object8421/MyTravo
|
ef5ce2cd4c9b4c41bc9bdf3dc6cb1383f9cab21f
|
9f28995f0248f9c36266916f7c6bc3f55afa9186
|
refs/heads/master
| 2021-01-17T23:22:23.641000 | 2014-05-30T14:11:32 | 2014-05-30T14:11:32 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.cobra.mytravo.internet;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.List;
import org.json.JSONObject;
import org.json.JSONArray;
import org.json.JSONException;
import com.cobra.mytravo.data.AppData;
import com.cobra.mytravo.data.MyServerMessage;
import com.cobra.mytravo.data.NotesDataHelper;
import com.cobra.mytravo.data.TravelsDataHelper;
import com.cobra.mytravo.data.UserSyncDataHelper;
import com.cobra.mytravo.models.Note;
import com.cobra.mytravo.models.Travel;
import com.cobra.mytravo.models.UserSync;
import com.google.gson.Gson;
import android.app.IntentService;
import android.content.Intent;
import android.util.Log;
public class UploadNoteService extends IntentService
{
private List<Note> notes;
private NotesDataHelper mDataHelper;
private TravelsDataHelper travelsDataHelper;
private UserSyncDataHelper usersyncDataHelper;
private String type;
public UploadNoteService()
{
super("uploadnoteservice");
}
private JSONObject travsferNote(Note note)
{
JSONObject jsonObject = new JSONObject();
Travel travel = travelsDataHelper.queryByTime(note.getTravel_created_time());
note.setTravel_id(travel.getId());
mDataHelper.update(note);
try
{
jsonObject.put("id", note.getId());
jsonObject.put("content", note.getContent());
jsonObject.put("create_time",note.getCreate_time());
jsonObject.put("travel_id", note.getTravel_id());
jsonObject.put("tag", note.getTAG());
jsonObject.put("location", new JSONObject(new Gson().toJson(note.getLocation())));
jsonObject.put("image", "image" + String.valueOf(note.getTAG()));
} catch (JSONException e)
{
e.printStackTrace();
}
return jsonObject;
}
private JSONObject getJsonObject()
{
JSONObject jsonObject = new JSONObject();
JSONArray jsonArray = new JSONArray();
for (Note note : notes)
{
jsonArray.put(travsferNote(note));
}
try
{
jsonObject.put("notes", jsonArray);
} catch (JSONException e)
{
e.printStackTrace();
}
return jsonObject;
}
@Override
protected void onHandleIntent(Intent intent)
{
Log.i("UploadNoteService", "start");
type = intent.getStringExtra("type");
mDataHelper = new NotesDataHelper(this, AppData.getUserId());
travelsDataHelper = new TravelsDataHelper(this, AppData.getUserId());
usersyncDataHelper = new UserSyncDataHelper(this);
if("dirty".equals(type))
{
this.notes = mDataHelper.getDirtyNotes();
}
if("new".equals(type))
{
this.notes = mDataHelper.getNewNotes();
}
JSONObject jsonRequest;
String end = "\r\n";
String twoHyphens = "--";
String boundary = "-----WebKitFormBoundaryp7MA4YWxkTrZu0gW";
try
{
URL url = new URL(AppData.HOST_IP + "note/upload?token=" + AppData.getIdToken());
HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
httpURLConnection.setDoInput(true);
httpURLConnection.setDoOutput(true);
httpURLConnection.setUseCaches(false);
httpURLConnection.setRequestMethod("POST");
// httpURLConnection.setRequestProperty("Connection", "Keep-Alive");
// httpURLConnection.setRequestProperty("Charset", "UTF-8");
httpURLConnection.setRequestProperty("Content-Type", "multipart/form-data;boundary=" + boundary);
DataOutputStream dos = new DataOutputStream(httpURLConnection.getOutputStream());
dos.write((twoHyphens + boundary + end).getBytes());
dos.write(("Content-Disposition:form-data;name=\"notes\"" + end + end).getBytes());
dos.write(getJsonObject().toString().getBytes());
for(int i = 0 ; i < notes.size() ; i++)
{
String uploadfile = notes.get(i).getImage_url();
if(uploadfile != null)
{
dos.write((twoHyphens + boundary + end).getBytes());
dos.write(("Content-Disposition:form-data;name=\"image" +
String.valueOf(notes.get(i).getTAG()) + "\"; filename=\"" +
uploadfile.substring(uploadfile.lastIndexOf("/") + 1) + "\""
+ end).getBytes());
dos.write(end.getBytes());
FileInputStream fis = new FileInputStream(uploadfile);
byte[] buf = new byte[8192];
int count = 0;
while((count = fis.read(buf))!=-1)
{
dos.write(buf, 0, count);
}
fis.close();
System.out.println("file send to server............");
dos.write(end.getBytes());
}
}
dos.write((twoHyphens + boundary + twoHyphens + end).getBytes());
dos.flush();
InputStream is = httpURLConnection.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String result = br.readLine();
JSONObject response = new JSONObject(result);
int rsp_code = response.getInt("rsp_code");
String lm_time ;
if(rsp_code == 100)
{
lm_time = response.getString("lm_time");
if(lm_time != null)
{
UserSync clientsync = usersyncDataHelper.getByToken(AppData.getIdToken());
clientsync.setNote(lm_time);
usersyncDataHelper.update(clientsync);
}
JSONArray jsonArray = response.getJSONArray("rsps");
if(jsonArray != null && jsonArray.length() > 0)
{
for(int i = 0 ; i < jsonArray.length() ; i++)
{
JSONObject obj = jsonArray.getJSONObject(i);
if(obj.getInt("rsp_code") == MyServerMessage.SUCCESS)
{
int tag,id;
tag = obj.getInt("tag");
id = obj.getInt("id");
for(int j = 0 ; j < notes.size() ; j++)
{
Note nt = notes.get(j);
if(nt.getTAG() == tag)
{
nt.setId(id);
nt.setIs_sync(0);
mDataHelper.update(nt);
}
}
}
}
}
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
|
UTF-8
|
Java
| 5,855 |
java
|
UploadNoteService.java
|
Java
|
[
{
"context": "lientsync = usersyncDataHelper.getByToken(AppData.getIdToken());\n\t\t\t \tclientsync.setNote(lm_time);\n\t\t\t",
"end": 5059,
"score": 0.616092324256897,
"start": 5054,
"tag": "KEY",
"value": "getId"
}
] | null |
[] |
package com.cobra.mytravo.internet;
import java.io.BufferedReader;
import java.io.DataOutputStream;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.List;
import org.json.JSONObject;
import org.json.JSONArray;
import org.json.JSONException;
import com.cobra.mytravo.data.AppData;
import com.cobra.mytravo.data.MyServerMessage;
import com.cobra.mytravo.data.NotesDataHelper;
import com.cobra.mytravo.data.TravelsDataHelper;
import com.cobra.mytravo.data.UserSyncDataHelper;
import com.cobra.mytravo.models.Note;
import com.cobra.mytravo.models.Travel;
import com.cobra.mytravo.models.UserSync;
import com.google.gson.Gson;
import android.app.IntentService;
import android.content.Intent;
import android.util.Log;
public class UploadNoteService extends IntentService
{
private List<Note> notes;
private NotesDataHelper mDataHelper;
private TravelsDataHelper travelsDataHelper;
private UserSyncDataHelper usersyncDataHelper;
private String type;
public UploadNoteService()
{
super("uploadnoteservice");
}
private JSONObject travsferNote(Note note)
{
JSONObject jsonObject = new JSONObject();
Travel travel = travelsDataHelper.queryByTime(note.getTravel_created_time());
note.setTravel_id(travel.getId());
mDataHelper.update(note);
try
{
jsonObject.put("id", note.getId());
jsonObject.put("content", note.getContent());
jsonObject.put("create_time",note.getCreate_time());
jsonObject.put("travel_id", note.getTravel_id());
jsonObject.put("tag", note.getTAG());
jsonObject.put("location", new JSONObject(new Gson().toJson(note.getLocation())));
jsonObject.put("image", "image" + String.valueOf(note.getTAG()));
} catch (JSONException e)
{
e.printStackTrace();
}
return jsonObject;
}
private JSONObject getJsonObject()
{
JSONObject jsonObject = new JSONObject();
JSONArray jsonArray = new JSONArray();
for (Note note : notes)
{
jsonArray.put(travsferNote(note));
}
try
{
jsonObject.put("notes", jsonArray);
} catch (JSONException e)
{
e.printStackTrace();
}
return jsonObject;
}
@Override
protected void onHandleIntent(Intent intent)
{
Log.i("UploadNoteService", "start");
type = intent.getStringExtra("type");
mDataHelper = new NotesDataHelper(this, AppData.getUserId());
travelsDataHelper = new TravelsDataHelper(this, AppData.getUserId());
usersyncDataHelper = new UserSyncDataHelper(this);
if("dirty".equals(type))
{
this.notes = mDataHelper.getDirtyNotes();
}
if("new".equals(type))
{
this.notes = mDataHelper.getNewNotes();
}
JSONObject jsonRequest;
String end = "\r\n";
String twoHyphens = "--";
String boundary = "-----WebKitFormBoundaryp7MA4YWxkTrZu0gW";
try
{
URL url = new URL(AppData.HOST_IP + "note/upload?token=" + AppData.getIdToken());
HttpURLConnection httpURLConnection = (HttpURLConnection) url.openConnection();
httpURLConnection.setDoInput(true);
httpURLConnection.setDoOutput(true);
httpURLConnection.setUseCaches(false);
httpURLConnection.setRequestMethod("POST");
// httpURLConnection.setRequestProperty("Connection", "Keep-Alive");
// httpURLConnection.setRequestProperty("Charset", "UTF-8");
httpURLConnection.setRequestProperty("Content-Type", "multipart/form-data;boundary=" + boundary);
DataOutputStream dos = new DataOutputStream(httpURLConnection.getOutputStream());
dos.write((twoHyphens + boundary + end).getBytes());
dos.write(("Content-Disposition:form-data;name=\"notes\"" + end + end).getBytes());
dos.write(getJsonObject().toString().getBytes());
for(int i = 0 ; i < notes.size() ; i++)
{
String uploadfile = notes.get(i).getImage_url();
if(uploadfile != null)
{
dos.write((twoHyphens + boundary + end).getBytes());
dos.write(("Content-Disposition:form-data;name=\"image" +
String.valueOf(notes.get(i).getTAG()) + "\"; filename=\"" +
uploadfile.substring(uploadfile.lastIndexOf("/") + 1) + "\""
+ end).getBytes());
dos.write(end.getBytes());
FileInputStream fis = new FileInputStream(uploadfile);
byte[] buf = new byte[8192];
int count = 0;
while((count = fis.read(buf))!=-1)
{
dos.write(buf, 0, count);
}
fis.close();
System.out.println("file send to server............");
dos.write(end.getBytes());
}
}
dos.write((twoHyphens + boundary + twoHyphens + end).getBytes());
dos.flush();
InputStream is = httpURLConnection.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String result = br.readLine();
JSONObject response = new JSONObject(result);
int rsp_code = response.getInt("rsp_code");
String lm_time ;
if(rsp_code == 100)
{
lm_time = response.getString("lm_time");
if(lm_time != null)
{
UserSync clientsync = usersyncDataHelper.getByToken(AppData.getIdToken());
clientsync.setNote(lm_time);
usersyncDataHelper.update(clientsync);
}
JSONArray jsonArray = response.getJSONArray("rsps");
if(jsonArray != null && jsonArray.length() > 0)
{
for(int i = 0 ; i < jsonArray.length() ; i++)
{
JSONObject obj = jsonArray.getJSONObject(i);
if(obj.getInt("rsp_code") == MyServerMessage.SUCCESS)
{
int tag,id;
tag = obj.getInt("tag");
id = obj.getInt("id");
for(int j = 0 ; j < notes.size() ; j++)
{
Note nt = notes.get(j);
if(nt.getTAG() == tag)
{
nt.setId(id);
nt.setIs_sync(0);
mDataHelper.update(nt);
}
}
}
}
}
}
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
| 5,855 | 0.674979 | 0.671563 | 199 | 28.42211 | 22.866507 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.39196 | false | false |
13
|
b093be921b7ccd78d20d1f9a7aca6c14a5e24a8d
| 23,871,428,267,412 |
42bd384361a32e710c60107e155272dd9bf39f49
|
/arabianNights/src/org/academiadecodigo/bootcamp8/arabiannights/genie/Genie.java
|
3e6065f26cdb5bcfe1d3e9fabf54ea0a25e15d3f
|
[] |
no_license
|
MetalMethod/bootcampFiles
|
https://github.com/MetalMethod/bootcampFiles
|
73a5709234ff2301eedde382702e3acdd9d816bc
|
03b8c0c66445eac8039d68c6f55ad072d8cd676c
|
refs/heads/master
| 2018-04-25T10:03:09.222000 | 2017-06-05T11:46:50 | 2017-06-05T11:46:50 | 91,726,829 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.academiadecodigo.bootcamp8.arabiannights.genie;
/**
* Created by Igor Busquets on 15/05/17.
*/
public abstract class Genie {
//PROPERTIES
private int wishesMax = 0;
private int wishesGranted = 0;
//METHODS
public abstract void grantWish();
public abstract void printGenieType();
public void printWishesGranted(){
System.out.println("This genie granted " + wishesGranted + " wishes.");
}
//GETTERS
public int getWishesMax() {
return wishesMax;
}
public int getWishesGranted() {
return wishesGranted;
}
public void setWishesMax(int wishes){
this.wishesMax = wishes;
}
public void setWishesGranted(int i){
this.wishesGranted = i;
}
}
|
UTF-8
|
Java
| 770 |
java
|
Genie.java
|
Java
|
[
{
"context": ".bootcamp8.arabiannights.genie;\n\n/**\n * Created by Igor Busquets on 15/05/17.\n */\npublic abstract class Genie {\n\n ",
"end": 92,
"score": 0.9998524785041809,
"start": 79,
"tag": "NAME",
"value": "Igor Busquets"
}
] | null |
[] |
package org.academiadecodigo.bootcamp8.arabiannights.genie;
/**
* Created by <NAME> on 15/05/17.
*/
public abstract class Genie {
//PROPERTIES
private int wishesMax = 0;
private int wishesGranted = 0;
//METHODS
public abstract void grantWish();
public abstract void printGenieType();
public void printWishesGranted(){
System.out.println("This genie granted " + wishesGranted + " wishes.");
}
//GETTERS
public int getWishesMax() {
return wishesMax;
}
public int getWishesGranted() {
return wishesGranted;
}
public void setWishesMax(int wishes){
this.wishesMax = wishes;
}
public void setWishesGranted(int i){
this.wishesGranted = i;
}
}
| 763 | 0.636364 | 0.624675 | 45 | 16.111111 | 19.262194 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.222222 | false | false |
13
|
8f2b6031df54813b50a60d63989fd652e13f060f
| 23,527,830,878,492 |
41ace45d732bfe305df2dc9f01ab9fcb4884ffcf
|
/app/src/main/java/com/androidsampleproject/MenuView.java
|
4b033dec7b75817c5a9ac8027cbe523698cc9dbf
|
[] |
no_license
|
BlueMate/BluemateAndroidSampleProject
|
https://github.com/BlueMate/BluemateAndroidSampleProject
|
8d61b88ca64cb2ac77c99fb7016133ab0edfd036
|
ce5ef4e6bd336aaae59e07e10b6aaca8d9848f27
|
refs/heads/master
| 2016-03-26T20:37:12.870000 | 2014-07-16T02:25:00 | 2014-07-16T02:25:00 | 21,883,456 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.androidsampleproject;
import android.app.ActivityOptions;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.HashMap;
/**
* Created by relly on 7/13/2014.
*/
public class MenuView extends ListActivity {
private boolean isCustomTitleSupported;
private TextView mnvTitleTextView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
isCustomTitleSupported = requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);;
setContentView(R.layout.menu_view);
ListView mnvListView = getListView();
mnvListView.setOnItemClickListener(onMnvListViewItemClickListener);
ListAdapter adapter = new SimpleAdapter(this,
populateMenu(),
R.layout.menu_view_list,
new String[]{"name"},
new int[]{R.id.mnvButtonTextView});
setListAdapter(adapter);
if (isCustomTitleSupported){
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_menu_view_titlebar);
mnvTitleTextView = (TextView) findViewById(R.id.mnvTitletextView);
mnvTitleTextView.setText("Menu");
}
}
public void onMnvBackImageViewClick(View view) {
Bundle bundle = ActivityOptions.makeCustomAnimation(getApplicationContext(),
R.anim.slide_in_right,
R.anim.slide_out_right).toBundle();
Intent mvIntent = new Intent(getApplication(), MainView.class);
startActivity(mvIntent, bundle);
}
public void onTopBarExitButtonClick(View view) {
Intent toMainViewPageIntent = new Intent(getApplication(), MainView.class);
startActivity(toMainViewPageIntent);
}
private AdapterView.OnItemClickListener onMnvListViewItemClickListener = new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Bundle bundle = ActivityOptions.makeCustomAnimation(getApplicationContext(),
R.anim.slide_in_left,
R.anim.slide_out_left).toBundle();
Intent uivIntent = null;
switch ((int) id) {
case 0:
uivIntent = new Intent(getApplication(), UserInformationView.class);
startActivity(uivIntent, bundle);
break;
case 1:
uivIntent = new Intent(getApplication(), UserActivityView.class);
startActivity(uivIntent, bundle);
}
}
};
private ArrayList<HashMap<String, String>> populateMenu() {
ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>();
HashMap<String, String> m1 = new HashMap<String, String>();
m1.put("name", "User Information");
HashMap<String, String> m2 = new HashMap<String, String>();
m2.put("name", "User Activity");
list.add(m1);
list.add(m2);
return list;
}
private HashMap<String, String> populateMenus() {
HashMap<String, String> list = new HashMap<String, String>();
list.put("name", "One");
list.put("name", "Two");
list.put("name", "Three");
return list;
}
}
|
UTF-8
|
Java
| 3,767 |
java
|
MenuView.java
|
Java
|
[
{
"context": "List;\nimport java.util.HashMap;\n\n/**\n * Created by relly on 7/13/2014.\n */\npublic class MenuView extends L",
"end": 465,
"score": 0.9996355175971985,
"start": 460,
"tag": "USERNAME",
"value": "relly"
}
] | null |
[] |
package com.androidsampleproject;
import android.app.ActivityOptions;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import java.util.ArrayList;
import java.util.HashMap;
/**
* Created by relly on 7/13/2014.
*/
public class MenuView extends ListActivity {
private boolean isCustomTitleSupported;
private TextView mnvTitleTextView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
isCustomTitleSupported = requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);;
setContentView(R.layout.menu_view);
ListView mnvListView = getListView();
mnvListView.setOnItemClickListener(onMnvListViewItemClickListener);
ListAdapter adapter = new SimpleAdapter(this,
populateMenu(),
R.layout.menu_view_list,
new String[]{"name"},
new int[]{R.id.mnvButtonTextView});
setListAdapter(adapter);
if (isCustomTitleSupported){
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.custom_menu_view_titlebar);
mnvTitleTextView = (TextView) findViewById(R.id.mnvTitletextView);
mnvTitleTextView.setText("Menu");
}
}
public void onMnvBackImageViewClick(View view) {
Bundle bundle = ActivityOptions.makeCustomAnimation(getApplicationContext(),
R.anim.slide_in_right,
R.anim.slide_out_right).toBundle();
Intent mvIntent = new Intent(getApplication(), MainView.class);
startActivity(mvIntent, bundle);
}
public void onTopBarExitButtonClick(View view) {
Intent toMainViewPageIntent = new Intent(getApplication(), MainView.class);
startActivity(toMainViewPageIntent);
}
private AdapterView.OnItemClickListener onMnvListViewItemClickListener = new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
Bundle bundle = ActivityOptions.makeCustomAnimation(getApplicationContext(),
R.anim.slide_in_left,
R.anim.slide_out_left).toBundle();
Intent uivIntent = null;
switch ((int) id) {
case 0:
uivIntent = new Intent(getApplication(), UserInformationView.class);
startActivity(uivIntent, bundle);
break;
case 1:
uivIntent = new Intent(getApplication(), UserActivityView.class);
startActivity(uivIntent, bundle);
}
}
};
private ArrayList<HashMap<String, String>> populateMenu() {
ArrayList<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>();
HashMap<String, String> m1 = new HashMap<String, String>();
m1.put("name", "User Information");
HashMap<String, String> m2 = new HashMap<String, String>();
m2.put("name", "User Activity");
list.add(m1);
list.add(m2);
return list;
}
private HashMap<String, String> populateMenus() {
HashMap<String, String> list = new HashMap<String, String>();
list.put("name", "One");
list.put("name", "Two");
list.put("name", "Three");
return list;
}
}
| 3,767 | 0.621184 | 0.617202 | 110 | 33.245453 | 29.011341 | 116 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.790909 | false | false |
13
|
5af5ac4336c3ce17b0d1a630d5848d0745a0de13
| 13,056,700,586,238 |
eed1ec48c15c115d3315e647a9e4cf8928ad451a
|
/app/src/main/java/com/framgia/toeic/data/model/VocabularyLessonItem.java
|
15075e6e7c24b33ae8bcc2f8bd00330791f8adba
|
[] |
no_license
|
awesome-academy/Toeic_600_01
|
https://github.com/awesome-academy/Toeic_600_01
|
cffb748bc9b34ac27f8e763e7f785bb558cf1ce9
|
d8a0c817d340d9dcda2e07d388b43d9a3c74b9c0
|
refs/heads/master
| 2020-04-13T11:00:59.007000 | 2019-02-21T07:15:24 | 2019-02-21T07:15:24 | 163,161,159 | 1 | 2 | null | false | 2019-02-21T07:15:27 | 2018-12-26T09:20:15 | 2019-02-21T07:15:27 | 2019-02-21T07:15:25 | 7,240 | 0 | 2 | 1 |
Java
| false | null |
package com.framgia.toeic.data.model;
import android.os.Parcel;
public class VocabularyLessonItem extends VocabularyLesson {
private boolean mIsSelected;
public VocabularyLessonItem(boolean isSelected) {
mIsSelected = isSelected;
}
public VocabularyLessonItem(int id, String name, boolean isSelected) {
super(id, name);
mIsSelected = isSelected;
}
public VocabularyLessonItem(Parcel in, boolean isSelected) {
super(in);
mIsSelected = isSelected;
}
public boolean isSelected() {
return mIsSelected;
}
public void setSelected(boolean selected) {
mIsSelected = selected;
}
}
|
UTF-8
|
Java
| 679 |
java
|
VocabularyLessonItem.java
|
Java
|
[] | null |
[] |
package com.framgia.toeic.data.model;
import android.os.Parcel;
public class VocabularyLessonItem extends VocabularyLesson {
private boolean mIsSelected;
public VocabularyLessonItem(boolean isSelected) {
mIsSelected = isSelected;
}
public VocabularyLessonItem(int id, String name, boolean isSelected) {
super(id, name);
mIsSelected = isSelected;
}
public VocabularyLessonItem(Parcel in, boolean isSelected) {
super(in);
mIsSelected = isSelected;
}
public boolean isSelected() {
return mIsSelected;
}
public void setSelected(boolean selected) {
mIsSelected = selected;
}
}
| 679 | 0.675994 | 0.675994 | 29 | 22.413794 | 21.743834 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.482759 | false | false |
13
|
2c9e8ab82a141e4467626211940c8c5831d3d621
| 20,933,670,610,740 |
6d06658ebc872feb3ccf9293fcea5444ba75c03f
|
/src/test/jersey/resources/TestJerseyResource.java
|
d667c9a01e87811857feb6585c1b6510c455ca33
|
[] |
no_license
|
y-tsuda/ServletProject
|
https://github.com/y-tsuda/ServletProject
|
3b5a827b9682b682ed46955b546b1891e7c04f2f
|
876d11efba92fb2f1af7158c0ff03df116c68a6f
|
refs/heads/master
| 2021-01-09T06:22:04.836000 | 2017-12-30T12:54:48 | 2017-12-30T12:54:48 | 80,971,522 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package test.jersey.resources;
import java.util.HashSet;
import java.util.Set;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;
import net.arnx.jsonic.JSON;
import test.jersey.response.TestResponse;
@Path("/api")
public class TestJerseyResource {
// テストデータ
private static Set<TestResponse> set;
static{
// とりあえずテストデータ(ほんとはこんなことやってはダメ)
set = new HashSet<TestResponse>();
set.add(new TestResponse(1, "一郎"));
set.add(new TestResponse(2, "次郎"));
set.add(new TestResponse(3, "三郎"));
set.add(new TestResponse(4, "四郎"));
}
@GET
@Path("/method1")
@Produces({"application/json"})
public Response TestResources(@QueryParam("id") int id){
TestResponse res = null;
// idが一致するデータを返す
for( TestResponse tmp : set ){
if(id == tmp.getId()){
res = tmp;
}
}
// 一致無しの場合は空データを返す
if( res == null ){
res = new TestResponse(0, "");
}
// JSONICでJSON文字列にエンコードする。
String json = JSON.encode(res);
return Response.ok()
.entity(json)
.build();
}
@GET
@Path("/method2")
@Produces({"application/xml"})
public TestResponse TestResources2(@QueryParam("id") int id){
TestResponse res = null;
// idが一致するデータを返す
for( TestResponse tmp : set ){
if(id == tmp.getId()){
res = tmp;
}
}
// 一致無しの場合は空データを返す
if( res == null ){
res = new TestResponse(0, "");
}
return res;
}
}
|
UTF-8
|
Java
| 2,015 |
java
|
TestJerseyResource.java
|
Java
|
[] | null |
[] |
package test.jersey.resources;
import java.util.HashSet;
import java.util.Set;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;
import net.arnx.jsonic.JSON;
import test.jersey.response.TestResponse;
@Path("/api")
public class TestJerseyResource {
// テストデータ
private static Set<TestResponse> set;
static{
// とりあえずテストデータ(ほんとはこんなことやってはダメ)
set = new HashSet<TestResponse>();
set.add(new TestResponse(1, "一郎"));
set.add(new TestResponse(2, "次郎"));
set.add(new TestResponse(3, "三郎"));
set.add(new TestResponse(4, "四郎"));
}
@GET
@Path("/method1")
@Produces({"application/json"})
public Response TestResources(@QueryParam("id") int id){
TestResponse res = null;
// idが一致するデータを返す
for( TestResponse tmp : set ){
if(id == tmp.getId()){
res = tmp;
}
}
// 一致無しの場合は空データを返す
if( res == null ){
res = new TestResponse(0, "");
}
// JSONICでJSON文字列にエンコードする。
String json = JSON.encode(res);
return Response.ok()
.entity(json)
.build();
}
@GET
@Path("/method2")
@Produces({"application/xml"})
public TestResponse TestResources2(@QueryParam("id") int id){
TestResponse res = null;
// idが一致するデータを返す
for( TestResponse tmp : set ){
if(id == tmp.getId()){
res = tmp;
}
}
// 一致無しの場合は空データを返す
if( res == null ){
res = new TestResponse(0, "");
}
return res;
}
}
| 2,015 | 0.521932 | 0.516935 | 83 | 20.710844 | 15.7423 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.421687 | false | false |
13
|
a5e56f06499c4b95ce40923ef99251ca813e9e7d
| 6,468,220,760,434 |
073ffbe5329dec5f05d451656a7c7146818d2ac2
|
/Java Stock Simulation [old]/Stock.java
|
452b0319e65b215a704e9cc9a6d92b26dce04390
|
[] |
no_license
|
Feni/Hippocamp
|
https://github.com/Feni/Hippocamp
|
01c38d2582b640843a94562bcb69f951651fbac1
|
c0d99e86125ad2dc03ada0ba671977b457918f6e
|
refs/heads/master
| 2021-01-02T22:51:42.352000 | 2012-11-08T07:02:41 | 2012-11-08T07:02:41 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.util.*;
import java.text.*;
public class Stock implements Comparable{
double price = 0.0;
String symbol = "";
// The total money invested in this...
double cost = 0.0;
int shares = 0;
// If it's less that that, buy buy buy!
double minThreshold = 0.0;
// if it's more than that, sell sell sell!
double maxThreshold = 0.0;
// The most amount we are willing to dedicate to this stock...
// Current investment computed with cost * shares.
// If current < max, buy half (if it's above calculated min threshhold).
double maxInvestment = 0.0;
public Stock(String s, double p, int sh){
symbol = s;
price = p;
cost = p*sh;
shares = sh;
}
public void sell(int numShares){
if(numShares <= shares && shares != 0){
double money = numShares * price;
StockManager.moneyRemaining += money;
double profit = money - ((numShares/shares) * cost);
// pl("Profit: "+profit);
// pl("Cost "+cost);
cost -= money * (numShares/shares);
// pl("New Cost: "+cost);
shares-=numShares;
}
System.out.println("Sold "+this+" Remaining: "+StockManager.moneyRemaining);
}
public void buy(int numShares){
double money = numShares * price;
StockManager.moneyRemaining -= money;
shares+=numShares;
// pl("Cost: "+cost);
cost = (cost + (money * (numShares / shares)));
// pl("Cost After"+cost);
System.out.println("Bought "+this+" Remaining: "+StockManager.moneyRemaining);
}
public int compareTo(Object o){
Stock s = (Stock) o;
if(s.symbol.equals(symbol)){
return 0;
}
else{
return symbol.compareTo(s.symbol);
}
}
public String toString(){
return " "+symbol+" "+price+" :: Cost "+cost+" Shares "+shares;
}
public static void pl(Object o){
System.out.println(o);
}
public static void p(String str){
System.out.print(str);
}
}
|
UTF-8
|
Java
| 1,811 |
java
|
Stock.java
|
Java
|
[] | null |
[] |
import java.util.*;
import java.text.*;
public class Stock implements Comparable{
double price = 0.0;
String symbol = "";
// The total money invested in this...
double cost = 0.0;
int shares = 0;
// If it's less that that, buy buy buy!
double minThreshold = 0.0;
// if it's more than that, sell sell sell!
double maxThreshold = 0.0;
// The most amount we are willing to dedicate to this stock...
// Current investment computed with cost * shares.
// If current < max, buy half (if it's above calculated min threshhold).
double maxInvestment = 0.0;
public Stock(String s, double p, int sh){
symbol = s;
price = p;
cost = p*sh;
shares = sh;
}
public void sell(int numShares){
if(numShares <= shares && shares != 0){
double money = numShares * price;
StockManager.moneyRemaining += money;
double profit = money - ((numShares/shares) * cost);
// pl("Profit: "+profit);
// pl("Cost "+cost);
cost -= money * (numShares/shares);
// pl("New Cost: "+cost);
shares-=numShares;
}
System.out.println("Sold "+this+" Remaining: "+StockManager.moneyRemaining);
}
public void buy(int numShares){
double money = numShares * price;
StockManager.moneyRemaining -= money;
shares+=numShares;
// pl("Cost: "+cost);
cost = (cost + (money * (numShares / shares)));
// pl("Cost After"+cost);
System.out.println("Bought "+this+" Remaining: "+StockManager.moneyRemaining);
}
public int compareTo(Object o){
Stock s = (Stock) o;
if(s.symbol.equals(symbol)){
return 0;
}
else{
return symbol.compareTo(s.symbol);
}
}
public String toString(){
return " "+symbol+" "+price+" :: Cost "+cost+" Shares "+shares;
}
public static void pl(Object o){
System.out.println(o);
}
public static void p(String str){
System.out.print(str);
}
}
| 1,811 | 0.648813 | 0.641634 | 71 | 24.521128 | 19.868483 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.098592 | false | false |
13
|
87f66c1d2e6cb9a5c4e2604dc2865b5479433e2e
| 16,234,976,390,903 |
b1dc0cbbcdb3a543d9b42ab5c5548f24e879a4fe
|
/src/test/java/ch/uzh/ifi/hase/soprafs21/controller/GameControllerTest.java
|
8d9371de94ce88aad11c8c05a59767905f1c05f4
|
[
"Apache-2.0"
] |
permissive
|
sopra-fs21-group-25/sopra-fs21-jass-server
|
https://github.com/sopra-fs21-group-25/sopra-fs21-jass-server
|
d78cd5c32599b10f68ee453fde81291a41465d21
|
b4fbb980c77c2929b2644d53186df835cd5b6805
|
refs/heads/master
| 2023-05-11T03:45:07.887000 | 2021-05-30T21:22:39 | 2021-05-30T21:22:39 | 348,652,336 | 0 | 0 |
Apache-2.0
| false | 2021-05-25T21:18:35 | 2021-03-17T09:34:26 | 2021-05-25T14:40:38 | 2021-05-25T21:18:35 | 510 | 0 | 0 | 25 |
Java
| false | false |
package ch.uzh.ifi.hase.soprafs21.controller;
import ch.uzh.ifi.hase.soprafs21.entity.RegisteredUser;
import ch.uzh.ifi.hase.soprafs21.entity.SchieberGameSession;
import ch.uzh.ifi.hase.soprafs21.entity.User;
import ch.uzh.ifi.hase.soprafs21.game.*;
import ch.uzh.ifi.hase.soprafs21.rest.dto.CardsGetDTO;
import ch.uzh.ifi.hase.soprafs21.rest.dto.SchieberGameGetDTO;
import ch.uzh.ifi.hase.soprafs21.rest.dto.SchieberGamePostDTO;
import ch.uzh.ifi.hase.soprafs21.rest.dto.SchieberGamePutDTO;
import ch.uzh.ifi.hase.soprafs21.rest.mapper.DTOMapper;
import ch.uzh.ifi.hase.soprafs21.service.GameService;
import ch.uzh.ifi.hase.soprafs21.service.LobbyService;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.web.server.ResponseStatusException;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.is;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.ArgumentMatchers.anyListOf;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.doNothing;
import static org.springframework.http.RequestEntity.post;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@WebMvcTest(GameController.class)
class GameControllerTest {
@Autowired
private MockMvc mockMvc;
@MockBean
private GameService gameService;
private RegisteredUser peter;
private RegisteredUser marie;
private RegisteredUser ursine;
private RegisteredUser kai;
private List<Card> listCard;
private Card[] listofCard;
private SchieberGameSession schieberGameSession;
private SchieberGameSession postDTO;
private SchieberGamePostDTO schieberGamePostDTO;
private SchieberGamePutDTO schieberGamePutDTO;
private SchieberGameGetDTO schieber;
private CardsGetDTO playerCards;
@BeforeEach
public void setupGameSession(){
Card card1 = new Card();
card1.setRank(Rank.ACE);
card1.setSuit(Suit.BELL);
card1.setIsTrumpf(false);
Card card2 = new Card();
card2.setRank(Rank.KING);
card2.setSuit(Suit.BELL);
card2.setIsTrumpf(false);
Card card3 = new Card();
card3.setRank(Rank.UNDER);
card3.setSuit(Suit.BELL);
card3.setIsTrumpf(false);
Card card4 = new Card();
card4.setRank(Rank.SEVEN);
card4.setSuit(Suit.BELL);
card4.setIsTrumpf(false);
peter = new RegisteredUser();
peter.setUsername("Peter");
UUID peterID = UUID.randomUUID();
peter.setId(peterID);
marie = new RegisteredUser();
marie.setUsername("Marie");
UUID marieID = UUID.randomUUID();
marie.setId(marieID);
ursine = new RegisteredUser();
ursine.setUsername("Ursine");
UUID ursineID = UUID.randomUUID();
ursine.setId(ursineID);
kai = new RegisteredUser();
kai.setUsername("Kai");
UUID kaiID = UUID.randomUUID();
kai.setId(kaiID);
listofCard = new Card[4];
listofCard[0]= card1;
listofCard[1]= card2;
listofCard[2]= card3;
listofCard[3]= card4;
listCard = new ArrayList<>();
listCard.add(card1);
listCard.add(card2);
listCard.add(card3);
listCard.add(card4);
List<IngameModeMultiplicatorObject> ingameModeMultiplicators = new ArrayList<>();
IngameModeMultiplicatorObject oneObject = new IngameModeMultiplicatorObject();
oneObject.setIngameMode(IngameMode.ACORN);
oneObject.setMultiplicator(20);
ingameModeMultiplicators.add(oneObject);
IngameModeMultiplicatorObject[] myObjectforDTO = new IngameModeMultiplicatorObject[1];
myObjectforDTO[0]= new IngameModeMultiplicatorObject(IngameMode.ACORN, 1000);
//setup of the schhieber Game Session
schieberGameSession = new SchieberGameSession();
UUID gameID = UUID.randomUUID();
schieberGameSession.setId(gameID);
schieberGameSession.setIngameModes(ingameModeMultiplicators);
schieberGameSession.setCardPlayedByPlayer0(card1);
schieberGameSession.setCardPlayedByPlayer1(card2);
schieberGameSession.setCardPlayedByPlayer2(card3);
schieberGameSession.setCardPlayedByPlayer3(card4);
schieberGameSession.setCardsHeldByPlayer0(listCard);
schieberGameSession.setCardsHeldByPlayer1(listCard);
schieberGameSession.setCardsHeldByPlayer2(listCard);
schieberGameSession.setCardsHeldByPlayer3(listCard);
schieberGameSession.setCurrentIngameMode(IngameMode.ACORN);
schieberGameSession.setPointsToWin(2000);
schieberGameSession.setUser0(peter);
schieberGameSession.setUser1(marie);
schieberGameSession.setUser2(kai);
schieberGameSession.setUser3(ursine);
schieberGameSession.setWeisAsk("true");
schieberGameSession.setTrickToPlay(1);
schieberGameSession.setCrossWeisAllowed(true);
schieberGameSession.setWeisAllowed(Boolean.TRUE);
schieberGameSession.setStartingCardRank(Rank.NINE);
schieberGameSession.setStartingCardSuit(Suit.ROSE);
schieberGameSession.setInitiallyStartingPlayer();
schieberGameSession.setIdOfRoundStartingPlayer(peter.getId());
schieberGameSession.setPointsTeam1_3(200);
schieberGameSession.setPointsTeam0_2(200);
schieberGameSession.setPlayer0startsTrick(true);
schieberGameSession.setHasTrickStarted(false);
//setup of the DTO
schieberGamePostDTO = new SchieberGamePostDTO();
schieberGamePostDTO.setPointsToWin(2000);
schieberGamePostDTO.setPlayer0id(peter.getId());
schieberGamePostDTO.setPlayer1id(marie.getId());
schieberGamePostDTO.setPlayer2id(kai.getId());
schieberGamePostDTO.setPlayer3id(ursine.getId());
schieberGamePostDTO.setWeisAsk("true");
schieberGamePostDTO.setCrossWeisAllowed(true);
schieberGamePostDTO.setWeisAllowed(false);
schieberGamePostDTO.setIngameModes(myObjectforDTO);
schieberGamePostDTO.setStartingCard(card1);
// postDTO = DTOMapper.INSTANCE.convertSchieberGamePostDTOtoEntity(schieberGamePostDTO, gameService);
schieber = DTOMapper.INSTANCE.convertEntityToSchieberGameGetDTO(schieberGameSession);
playerCards = new CardsGetDTO();
playerCards.setCards(listofCard);
//set up of the put DTO
schieberGamePutDTO = new SchieberGamePutDTO();
schieberGamePutDTO.setIngameMode(IngameMode.ACORN);
schieberGamePutDTO.setUserId(peter.getId());
schieberGamePutDTO.setLowOrHigh(Roundstart.OBE);
schieberGamePutDTO.setPlayedCard(card3);
}
@Test
public void getGamewithID_test()throws Exception{
//given
given(gameService.getGameWithId(Mockito.any())).willReturn(schieberGameSession);
//make request
MockHttpServletRequestBuilder getRequest = get("/games/" + schieberGameSession.getId().toString())
.contentType(asJsonString(MediaType.APPLICATION_JSON));
mockMvc.perform(getRequest)
.andExpect(jsonPath("$.id", is(schieber.getId().toString())))
.andExpect(jsonPath("$.player0id", is(schieber.getPlayer0id().toString())))
.andExpect(jsonPath("$.player1id", is(schieber.getPlayer1id().toString())))
.andExpect(jsonPath("$.player2id", is(schieber.getPlayer2id().toString())))
.andExpect(jsonPath("$.player3id", is(schieber.getPlayer3id().toString())))
.andExpect(jsonPath("$.weisAllowed", is(schieber.getWeisAllowed())))
.andExpect(jsonPath("$.crossWeisAllowed", is(schieber.getCrossWeisAllowed())))
.andExpect(status().isOk());
}
@Test
public void getGamewithID_noID_test()throws Exception{
//when
given(gameService.getGameWithId(schieberGameSession.getId()))
.willThrow(new ResponseStatusException(HttpStatus.NOT_FOUND, "Could not find game with that id"));
//make request
MockHttpServletRequestBuilder getRequest = get("/games/" + schieberGameSession.getId().toString())
.contentType(asJsonString(MediaType.APPLICATION_JSON));
mockMvc.perform(getRequest)
.andExpect(status().isNotFound())
.andExpect(status().reason(containsString("Could not find game with that id")));
}
@Test
public void getGamewithID_ContainingCardsofPlayer_test()throws Exception{
given(gameService.getGameWithId(Mockito.any())).willReturn(schieberGameSession);
given(gameService.getPlayerCards(peter.getId(), schieberGameSession)).willReturn(java.util.Optional.ofNullable(listofCard));
MockHttpServletRequestBuilder getRequest = get("/games/" + schieberGameSession.getId().toString()+"/"+ peter.getId())
.contentType(asJsonString(MediaType.APPLICATION_JSON));
mockMvc.perform(getRequest)
.andExpect(jsonPath("$.id", is(schieber.getId().toString())))
.andExpect(jsonPath("$.pointsToWin", is(schieber.getPointsToWin())))
.andExpect(jsonPath("$.pointsTeam0_2", is(schieber.getPointsTeam0_2())))
.andExpect(jsonPath("$.pointsTeam1_3", is(schieber.getPointsTeam1_3())))
.andExpect(jsonPath("$.trickToPlay", is(schieber.getTrickToPlay())))
.andExpect(status().isOk());
}
@Test
public void getGamewithID_ContainingCardsofPlayer_DoNotExist_test()throws Exception{
given(gameService.getGameWithId(Mockito.any())).willReturn(schieberGameSession);
//given(gameService.getPlayerCards(peter.getId(), schieberGameSession)).willReturn(java.util.Optional.ofNullable(listofCard));
MockHttpServletRequestBuilder getRequest = get("/games/" + schieberGameSession.getId().toString()+"/"+ peter.getId())
.contentType(asJsonString(MediaType.APPLICATION_JSON));
mockMvc.perform(getRequest)
.andExpect(status().is(404))
.andExpect(status().reason(containsString("Cards for this player do not exist")));
}
@Test
public void getCardsOfUserWithId_test()throws Exception{
given(gameService.getGameWithId(Mockito.any())).willReturn(schieberGameSession);
given(gameService.getPlayerCards(peter.getId(), schieberGameSession)).willReturn(java.util.Optional.ofNullable(listofCard));
MockHttpServletRequestBuilder getRequest = get("/games/" + schieberGameSession.getId().toString()+"/cards/"+ peter.getId())
.contentType(MediaType.APPLICATION_JSON);
mockMvc.perform(getRequest)
//.andExpect(jsonPath("$.cards", is(listofCard)))
.andExpect(status().isOk());
}
@Test
public void getCardsOfUserWithId_DoNotExist_test()throws Exception{
given(gameService.getGameWithId(Mockito.any())).willReturn(schieberGameSession);
//given(gameService.getPlayerCards(peter.getId(), schieberGameSession)).willReturn(java.util.Optional.ofNullable(listofCard));
MockHttpServletRequestBuilder getRequest = get("/games/" + schieberGameSession.getId().toString()+"/cards/"+ peter.getId())
.contentType(asJsonString(MediaType.APPLICATION_JSON));
mockMvc.perform(getRequest)
.andExpect(status().is(404))
.andExpect(status().reason(containsString("Cards for this player do not exist")));
}
// @Test
// public void createGame_test()throws Exception{
// given(gameService.createNewGame(Mockito.any())).willReturn(schieberGameSession);
//
// MockHttpServletRequestBuilder postRequest = MockMvcRequestBuilders.post("/games")
// .contentType(MediaType.APPLICATION_JSON)
// .content(asJsonString(schieberGamePostDTO));
//
//
// mockMvc.perform(postRequest)
// .andExpect(status().is(405));
// }
@Test
public void updateGameState_test()throws Exception{
given(gameService.updateStateOfGameWithId(UUID.randomUUID(), schieberGamePutDTO)).willReturn(schieberGameSession);
given(gameService.getPlayerCards(UUID.randomUUID(), schieberGameSession)).willReturn(java.util.Optional.ofNullable(listofCard));
MockHttpServletRequestBuilder putRequest = put("/games/" + schieberGameSession.getId().toString())
.content(asJsonString(schieberGamePutDTO))
.contentType(MediaType.APPLICATION_JSON);
mockMvc.perform(putRequest)
.andExpect(status().is(404));
}
@Test
public void deleteGame_test()throws Exception{
doNothing().when(gameService).deleteGameSession(Mockito.any());
MockHttpServletRequestBuilder putRequest = put("/games/" + schieberGameSession.getId().toString()+"/close");
mockMvc.perform(putRequest)
.andExpect(status().is(204));
}
private String asJsonString(final Object object) {
try {
return new ObjectMapper().writeValueAsString(object);
}
catch (JsonProcessingException e) {
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, String.format("The request body could not be created.%s", e.toString()));
}
}
}
|
UTF-8
|
Java
| 14,495 |
java
|
GameControllerTest.java
|
Java
|
[
{
"context": "meService gameService;\n\n private RegisteredUser peter;\n private RegisteredUser marie;\n private Re",
"end": 2481,
"score": 0.7600803375244141,
"start": 2476,
"tag": "NAME",
"value": "peter"
},
{
"context": "e RegisteredUser peter;\n private RegisteredUser marie;\n private RegisteredUser ursine;\n private R",
"end": 2515,
"score": 0.9913414716720581,
"start": 2510,
"tag": "NAME",
"value": "marie"
},
{
"context": "e RegisteredUser marie;\n private RegisteredUser ursine;\n private RegisteredUser kai;\n privat",
"end": 2543,
"score": 0.8925079107284546,
"start": 2543,
"tag": "NAME",
"value": ""
},
{
"context": " RegisteredUser marie;\n private RegisteredUser ursine;\n private RegisteredUser kai;\n private List",
"end": 2550,
"score": 0.9918023943901062,
"start": 2544,
"tag": "NAME",
"value": "ursine"
},
{
"context": " RegisteredUser ursine;\n private RegisteredUser kai;\n private List<Card> listCard;\n private C",
"end": 2580,
"score": 0.7952114939689636,
"start": 2579,
"tag": "NAME",
"value": "k"
},
{
"context": " new RegisteredUser();\n peter.setUsername(\"Peter\");\n UUID peterID = UUID.randomUUID();\n ",
"end": 3595,
"score": 0.999442458152771,
"start": 3590,
"tag": "USERNAME",
"value": "Peter"
},
{
"context": " new RegisteredUser();\n marie.setUsername(\"Marie\");\n UUID marieID = UUID.randomUUID();\n ",
"end": 3742,
"score": 0.9993970394134521,
"start": 3737,
"tag": "USERNAME",
"value": "Marie"
},
{
"context": "new RegisteredUser();\n ursine.setUsername(\"Ursine\");\n UUID ursineID = UUID.randomUUID();\n ",
"end": 3892,
"score": 0.9995908737182617,
"start": 3886,
"tag": "USERNAME",
"value": "Ursine"
},
{
"context": " = new RegisteredUser();\n kai.setUsername(\"Kai\");\n UUID kaiID = UUID.randomUUID();\n ",
"end": 4036,
"score": 0.9995380640029907,
"start": 4033,
"tag": "USERNAME",
"value": "Kai"
},
{
"context": "ToWin(2000);\n schieberGameSession.setUser0(peter);\n schieberGameSession.setUser1(marie);\n ",
"end": 5813,
"score": 0.9986582398414612,
"start": 5808,
"tag": "NAME",
"value": "peter"
},
{
"context": "ser0(peter);\n schieberGameSession.setUser1(marie);\n schieberGameSession.setUser2(kai);\n ",
"end": 5858,
"score": 0.9995473027229309,
"start": 5853,
"tag": "NAME",
"value": "marie"
},
{
"context": "ser1(marie);\n schieberGameSession.setUser2(kai);\n schieberGameSession.setUser3(ursine);\n ",
"end": 5901,
"score": 0.9945228099822998,
"start": 5898,
"tag": "NAME",
"value": "kai"
},
{
"context": "tUser2(kai);\n schieberGameSession.setUser3(ursine);\n schieberGameSession.setWeisAsk(\"true\");",
"end": 5947,
"score": 0.9972617626190186,
"start": 5941,
"tag": "NAME",
"value": "ursine"
},
{
"context": " schieberGameSession.setIdOfRoundStartingPlayer(peter.getId());\n schieberGameSession.setPointsTe",
"end": 6396,
"score": 0.9788346290588379,
"start": 6391,
"tag": "NAME",
"value": "peter"
},
{
"context": "(2000);\n\n schieberGamePostDTO.setPlayer0id(peter.getId());\n schieberGamePostDTO.setPlayer1i",
"end": 6804,
"score": 0.9961361885070801,
"start": 6799,
"tag": "NAME",
"value": "peter"
},
{
"context": "etId());\n schieberGamePostDTO.setPlayer1id(marie.getId());\n schieberGamePostDTO.setPlayer2i",
"end": 6861,
"score": 0.9990614652633667,
"start": 6856,
"tag": "NAME",
"value": "marie"
},
{
"context": "etId());\n schieberGamePostDTO.setPlayer2id(kai.getId());\n schieberGamePostDTO.setPlayer3i",
"end": 6916,
"score": 0.9596666693687439,
"start": 6913,
"tag": "NAME",
"value": "kai"
},
{
"context": "etId());\n schieberGamePostDTO.setPlayer3id(ursine.getId());\n schieberGamePostDTO.setWeisAsk(",
"end": 6974,
"score": 0.9883394241333008,
"start": 6968,
"tag": "NAME",
"value": "ursine"
}
] | null |
[] |
package ch.uzh.ifi.hase.soprafs21.controller;
import ch.uzh.ifi.hase.soprafs21.entity.RegisteredUser;
import ch.uzh.ifi.hase.soprafs21.entity.SchieberGameSession;
import ch.uzh.ifi.hase.soprafs21.entity.User;
import ch.uzh.ifi.hase.soprafs21.game.*;
import ch.uzh.ifi.hase.soprafs21.rest.dto.CardsGetDTO;
import ch.uzh.ifi.hase.soprafs21.rest.dto.SchieberGameGetDTO;
import ch.uzh.ifi.hase.soprafs21.rest.dto.SchieberGamePostDTO;
import ch.uzh.ifi.hase.soprafs21.rest.dto.SchieberGamePutDTO;
import ch.uzh.ifi.hase.soprafs21.rest.mapper.DTOMapper;
import ch.uzh.ifi.hase.soprafs21.service.GameService;
import ch.uzh.ifi.hase.soprafs21.service.LobbyService;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.web.server.ResponseStatusException;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.is;
import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.ArgumentMatchers.anyListOf;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.doNothing;
import static org.springframework.http.RequestEntity.post;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.put;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@WebMvcTest(GameController.class)
class GameControllerTest {
@Autowired
private MockMvc mockMvc;
@MockBean
private GameService gameService;
private RegisteredUser peter;
private RegisteredUser marie;
private RegisteredUser ursine;
private RegisteredUser kai;
private List<Card> listCard;
private Card[] listofCard;
private SchieberGameSession schieberGameSession;
private SchieberGameSession postDTO;
private SchieberGamePostDTO schieberGamePostDTO;
private SchieberGamePutDTO schieberGamePutDTO;
private SchieberGameGetDTO schieber;
private CardsGetDTO playerCards;
@BeforeEach
public void setupGameSession(){
Card card1 = new Card();
card1.setRank(Rank.ACE);
card1.setSuit(Suit.BELL);
card1.setIsTrumpf(false);
Card card2 = new Card();
card2.setRank(Rank.KING);
card2.setSuit(Suit.BELL);
card2.setIsTrumpf(false);
Card card3 = new Card();
card3.setRank(Rank.UNDER);
card3.setSuit(Suit.BELL);
card3.setIsTrumpf(false);
Card card4 = new Card();
card4.setRank(Rank.SEVEN);
card4.setSuit(Suit.BELL);
card4.setIsTrumpf(false);
peter = new RegisteredUser();
peter.setUsername("Peter");
UUID peterID = UUID.randomUUID();
peter.setId(peterID);
marie = new RegisteredUser();
marie.setUsername("Marie");
UUID marieID = UUID.randomUUID();
marie.setId(marieID);
ursine = new RegisteredUser();
ursine.setUsername("Ursine");
UUID ursineID = UUID.randomUUID();
ursine.setId(ursineID);
kai = new RegisteredUser();
kai.setUsername("Kai");
UUID kaiID = UUID.randomUUID();
kai.setId(kaiID);
listofCard = new Card[4];
listofCard[0]= card1;
listofCard[1]= card2;
listofCard[2]= card3;
listofCard[3]= card4;
listCard = new ArrayList<>();
listCard.add(card1);
listCard.add(card2);
listCard.add(card3);
listCard.add(card4);
List<IngameModeMultiplicatorObject> ingameModeMultiplicators = new ArrayList<>();
IngameModeMultiplicatorObject oneObject = new IngameModeMultiplicatorObject();
oneObject.setIngameMode(IngameMode.ACORN);
oneObject.setMultiplicator(20);
ingameModeMultiplicators.add(oneObject);
IngameModeMultiplicatorObject[] myObjectforDTO = new IngameModeMultiplicatorObject[1];
myObjectforDTO[0]= new IngameModeMultiplicatorObject(IngameMode.ACORN, 1000);
//setup of the schhieber Game Session
schieberGameSession = new SchieberGameSession();
UUID gameID = UUID.randomUUID();
schieberGameSession.setId(gameID);
schieberGameSession.setIngameModes(ingameModeMultiplicators);
schieberGameSession.setCardPlayedByPlayer0(card1);
schieberGameSession.setCardPlayedByPlayer1(card2);
schieberGameSession.setCardPlayedByPlayer2(card3);
schieberGameSession.setCardPlayedByPlayer3(card4);
schieberGameSession.setCardsHeldByPlayer0(listCard);
schieberGameSession.setCardsHeldByPlayer1(listCard);
schieberGameSession.setCardsHeldByPlayer2(listCard);
schieberGameSession.setCardsHeldByPlayer3(listCard);
schieberGameSession.setCurrentIngameMode(IngameMode.ACORN);
schieberGameSession.setPointsToWin(2000);
schieberGameSession.setUser0(peter);
schieberGameSession.setUser1(marie);
schieberGameSession.setUser2(kai);
schieberGameSession.setUser3(ursine);
schieberGameSession.setWeisAsk("true");
schieberGameSession.setTrickToPlay(1);
schieberGameSession.setCrossWeisAllowed(true);
schieberGameSession.setWeisAllowed(Boolean.TRUE);
schieberGameSession.setStartingCardRank(Rank.NINE);
schieberGameSession.setStartingCardSuit(Suit.ROSE);
schieberGameSession.setInitiallyStartingPlayer();
schieberGameSession.setIdOfRoundStartingPlayer(peter.getId());
schieberGameSession.setPointsTeam1_3(200);
schieberGameSession.setPointsTeam0_2(200);
schieberGameSession.setPlayer0startsTrick(true);
schieberGameSession.setHasTrickStarted(false);
//setup of the DTO
schieberGamePostDTO = new SchieberGamePostDTO();
schieberGamePostDTO.setPointsToWin(2000);
schieberGamePostDTO.setPlayer0id(peter.getId());
schieberGamePostDTO.setPlayer1id(marie.getId());
schieberGamePostDTO.setPlayer2id(kai.getId());
schieberGamePostDTO.setPlayer3id(ursine.getId());
schieberGamePostDTO.setWeisAsk("true");
schieberGamePostDTO.setCrossWeisAllowed(true);
schieberGamePostDTO.setWeisAllowed(false);
schieberGamePostDTO.setIngameModes(myObjectforDTO);
schieberGamePostDTO.setStartingCard(card1);
// postDTO = DTOMapper.INSTANCE.convertSchieberGamePostDTOtoEntity(schieberGamePostDTO, gameService);
schieber = DTOMapper.INSTANCE.convertEntityToSchieberGameGetDTO(schieberGameSession);
playerCards = new CardsGetDTO();
playerCards.setCards(listofCard);
//set up of the put DTO
schieberGamePutDTO = new SchieberGamePutDTO();
schieberGamePutDTO.setIngameMode(IngameMode.ACORN);
schieberGamePutDTO.setUserId(peter.getId());
schieberGamePutDTO.setLowOrHigh(Roundstart.OBE);
schieberGamePutDTO.setPlayedCard(card3);
}
@Test
public void getGamewithID_test()throws Exception{
//given
given(gameService.getGameWithId(Mockito.any())).willReturn(schieberGameSession);
//make request
MockHttpServletRequestBuilder getRequest = get("/games/" + schieberGameSession.getId().toString())
.contentType(asJsonString(MediaType.APPLICATION_JSON));
mockMvc.perform(getRequest)
.andExpect(jsonPath("$.id", is(schieber.getId().toString())))
.andExpect(jsonPath("$.player0id", is(schieber.getPlayer0id().toString())))
.andExpect(jsonPath("$.player1id", is(schieber.getPlayer1id().toString())))
.andExpect(jsonPath("$.player2id", is(schieber.getPlayer2id().toString())))
.andExpect(jsonPath("$.player3id", is(schieber.getPlayer3id().toString())))
.andExpect(jsonPath("$.weisAllowed", is(schieber.getWeisAllowed())))
.andExpect(jsonPath("$.crossWeisAllowed", is(schieber.getCrossWeisAllowed())))
.andExpect(status().isOk());
}
@Test
public void getGamewithID_noID_test()throws Exception{
//when
given(gameService.getGameWithId(schieberGameSession.getId()))
.willThrow(new ResponseStatusException(HttpStatus.NOT_FOUND, "Could not find game with that id"));
//make request
MockHttpServletRequestBuilder getRequest = get("/games/" + schieberGameSession.getId().toString())
.contentType(asJsonString(MediaType.APPLICATION_JSON));
mockMvc.perform(getRequest)
.andExpect(status().isNotFound())
.andExpect(status().reason(containsString("Could not find game with that id")));
}
@Test
public void getGamewithID_ContainingCardsofPlayer_test()throws Exception{
given(gameService.getGameWithId(Mockito.any())).willReturn(schieberGameSession);
given(gameService.getPlayerCards(peter.getId(), schieberGameSession)).willReturn(java.util.Optional.ofNullable(listofCard));
MockHttpServletRequestBuilder getRequest = get("/games/" + schieberGameSession.getId().toString()+"/"+ peter.getId())
.contentType(asJsonString(MediaType.APPLICATION_JSON));
mockMvc.perform(getRequest)
.andExpect(jsonPath("$.id", is(schieber.getId().toString())))
.andExpect(jsonPath("$.pointsToWin", is(schieber.getPointsToWin())))
.andExpect(jsonPath("$.pointsTeam0_2", is(schieber.getPointsTeam0_2())))
.andExpect(jsonPath("$.pointsTeam1_3", is(schieber.getPointsTeam1_3())))
.andExpect(jsonPath("$.trickToPlay", is(schieber.getTrickToPlay())))
.andExpect(status().isOk());
}
@Test
public void getGamewithID_ContainingCardsofPlayer_DoNotExist_test()throws Exception{
given(gameService.getGameWithId(Mockito.any())).willReturn(schieberGameSession);
//given(gameService.getPlayerCards(peter.getId(), schieberGameSession)).willReturn(java.util.Optional.ofNullable(listofCard));
MockHttpServletRequestBuilder getRequest = get("/games/" + schieberGameSession.getId().toString()+"/"+ peter.getId())
.contentType(asJsonString(MediaType.APPLICATION_JSON));
mockMvc.perform(getRequest)
.andExpect(status().is(404))
.andExpect(status().reason(containsString("Cards for this player do not exist")));
}
@Test
public void getCardsOfUserWithId_test()throws Exception{
given(gameService.getGameWithId(Mockito.any())).willReturn(schieberGameSession);
given(gameService.getPlayerCards(peter.getId(), schieberGameSession)).willReturn(java.util.Optional.ofNullable(listofCard));
MockHttpServletRequestBuilder getRequest = get("/games/" + schieberGameSession.getId().toString()+"/cards/"+ peter.getId())
.contentType(MediaType.APPLICATION_JSON);
mockMvc.perform(getRequest)
//.andExpect(jsonPath("$.cards", is(listofCard)))
.andExpect(status().isOk());
}
@Test
public void getCardsOfUserWithId_DoNotExist_test()throws Exception{
given(gameService.getGameWithId(Mockito.any())).willReturn(schieberGameSession);
//given(gameService.getPlayerCards(peter.getId(), schieberGameSession)).willReturn(java.util.Optional.ofNullable(listofCard));
MockHttpServletRequestBuilder getRequest = get("/games/" + schieberGameSession.getId().toString()+"/cards/"+ peter.getId())
.contentType(asJsonString(MediaType.APPLICATION_JSON));
mockMvc.perform(getRequest)
.andExpect(status().is(404))
.andExpect(status().reason(containsString("Cards for this player do not exist")));
}
// @Test
// public void createGame_test()throws Exception{
// given(gameService.createNewGame(Mockito.any())).willReturn(schieberGameSession);
//
// MockHttpServletRequestBuilder postRequest = MockMvcRequestBuilders.post("/games")
// .contentType(MediaType.APPLICATION_JSON)
// .content(asJsonString(schieberGamePostDTO));
//
//
// mockMvc.perform(postRequest)
// .andExpect(status().is(405));
// }
@Test
public void updateGameState_test()throws Exception{
given(gameService.updateStateOfGameWithId(UUID.randomUUID(), schieberGamePutDTO)).willReturn(schieberGameSession);
given(gameService.getPlayerCards(UUID.randomUUID(), schieberGameSession)).willReturn(java.util.Optional.ofNullable(listofCard));
MockHttpServletRequestBuilder putRequest = put("/games/" + schieberGameSession.getId().toString())
.content(asJsonString(schieberGamePutDTO))
.contentType(MediaType.APPLICATION_JSON);
mockMvc.perform(putRequest)
.andExpect(status().is(404));
}
@Test
public void deleteGame_test()throws Exception{
doNothing().when(gameService).deleteGameSession(Mockito.any());
MockHttpServletRequestBuilder putRequest = put("/games/" + schieberGameSession.getId().toString()+"/close");
mockMvc.perform(putRequest)
.andExpect(status().is(204));
}
private String asJsonString(final Object object) {
try {
return new ObjectMapper().writeValueAsString(object);
}
catch (JsonProcessingException e) {
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, String.format("The request body could not be created.%s", e.toString()));
}
}
}
| 14,495 | 0.705899 | 0.696654 | 342 | 41.385963 | 33.35004 | 143 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.619883 | false | false |
13
|
672234d049aa27dae69795526294c0d4711b1e99
| 25,031,069,431,150 |
600f3cb5c7b12c3aa47e0fc2ec37b04c77bb2d00
|
/TeamCode/src/main/java/org/firstinspires/ftc/teamcode/TestCode/FollowLine.java
|
f79b55c5d11ee6a58598933270d2dc6ea1c35bdf
|
[
"BSD-3-Clause"
] |
permissive
|
Lucien19III/ftc_app
|
https://github.com/Lucien19III/ftc_app
|
c3c8058aca5a2453dd8cbd2e51a7fab22fc7f4bb
|
646d98241dc8352ed0745e1e2bda9bfd04e770cb
|
refs/heads/master
| 2021-01-12T17:05:25.315000 | 2017-01-07T01:27:39 | 2017-01-07T01:27:39 | 69,295,980 | 0 | 0 | null | true | 2016-09-26T21:53:10 | 2016-09-26T21:53:10 | 2016-03-08T22:21:58 | 2016-03-04T23:39:34 | 316,858 | 0 | 0 | 0 | null | null | null |
package org.firstinspires.ftc.teamcode.TestCode;
import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
import com.qualcomm.robotcore.eventloop.opmode.OpMode;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.OpticalDistanceSensor;
/**
* Created by alucien on 10/25/2016.
*/
//@Autonomous
public class FollowLine extends OpMode {
DcMotor leftMotor;
DcMotor rightMotor;
OpticalDistanceSensor opticalDistanceSensor;
@Override
public void init() {
leftMotor = hardwareMap.dcMotor.get("motor_left");
rightMotor = hardwareMap.dcMotor.get("motor_right");
rightMotor.setDirection(DcMotor.Direction.REVERSE);
opticalDistanceSensor = hardwareMap.opticalDistanceSensor.get("sensor_EOPD");
}
@Override
public void loop() {
double reflectance = opticalDistanceSensor.getLightDetected();
if (reflectance >= 0.25) {
rightMotor.setPower(-0.2);
leftMotor.setPower(0);
}
else {
leftMotor.setPower(-0.2);
rightMotor.setPower(0);
telemetry.addData("Reflectance", reflectance);
}
}
}
|
UTF-8
|
Java
| 1,184 |
java
|
FollowLine.java
|
Java
|
[
{
"context": "hardware.OpticalDistanceSensor;\n\n/**\n * Created by alucien on 10/25/2016.\n */\n//@Autonomous\npublic class Fol",
"end": 300,
"score": 0.9993584752082825,
"start": 293,
"tag": "USERNAME",
"value": "alucien"
}
] | null |
[] |
package org.firstinspires.ftc.teamcode.TestCode;
import com.qualcomm.robotcore.eventloop.opmode.Autonomous;
import com.qualcomm.robotcore.eventloop.opmode.OpMode;
import com.qualcomm.robotcore.hardware.DcMotor;
import com.qualcomm.robotcore.hardware.OpticalDistanceSensor;
/**
* Created by alucien on 10/25/2016.
*/
//@Autonomous
public class FollowLine extends OpMode {
DcMotor leftMotor;
DcMotor rightMotor;
OpticalDistanceSensor opticalDistanceSensor;
@Override
public void init() {
leftMotor = hardwareMap.dcMotor.get("motor_left");
rightMotor = hardwareMap.dcMotor.get("motor_right");
rightMotor.setDirection(DcMotor.Direction.REVERSE);
opticalDistanceSensor = hardwareMap.opticalDistanceSensor.get("sensor_EOPD");
}
@Override
public void loop() {
double reflectance = opticalDistanceSensor.getLightDetected();
if (reflectance >= 0.25) {
rightMotor.setPower(-0.2);
leftMotor.setPower(0);
}
else {
leftMotor.setPower(-0.2);
rightMotor.setPower(0);
telemetry.addData("Reflectance", reflectance);
}
}
}
| 1,184 | 0.679054 | 0.664696 | 42 | 27.190475 | 23.941633 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.452381 | false | false |
13
|
5108c3e8a8df55d0e8f64697ed1e6e39bb106874
| 21,337,397,556,426 |
2f8b9996b085eb932e6f8c1aa8dd7ab047d97e48
|
/app/src/main/java/com/snh/snhseller/ui/order/BToCOrderAllActivity.java
|
eca4c4892b65731dd180363a60f27ea97495739f
|
[] |
no_license
|
DreamFly01/snhSeller
|
https://github.com/DreamFly01/snhSeller
|
76beaa5bdb43759fee3c82c2f7dc82391ddc6b29
|
f051a8b50546abc0509b7a1f88cc88e6ff85084f
|
refs/heads/master
| 2022-01-24T16:17:44.685000 | 2019-07-27T06:50:29 | 2019-07-27T06:50:29 | 173,652,352 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.snh.snhseller.ui.order;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
import com.snh.module_netapi.requestApi.BaseResultBean;
import com.snh.module_netapi.requestApi.NetSubscriber;
import com.snh.snhseller.BaseActivity;
import com.snh.snhseller.R;
import com.snh.snhseller.adapter.OrderAdapter;
import com.snh.snhseller.bean.OrderBean;
import com.snh.snhseller.requestApi.RequestClient;
import com.snh.snhseller.utils.IsBang;
import com.snh.snhseller.utils.JumpUtils;
import com.snh.snhseller.utils.KeyBoardUtils;
import com.snh.snhseller.utils.StrUtils;
import com.snh.snhseller.wediget.RecycleViewDivider;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
/**
* <p>desc:<p>
* <p>author:DreamFly<p>
* <p>creatTime:2019/5/23<p>
* <p>changeTime:2019/5/23<p>
* <p>version:1<p>
*/
public class BToCOrderAllActivity extends BaseActivity {
@BindView(R.id.heard_back)
LinearLayout heardBack;
@BindView(R.id.heard_title)
TextView heardTitle;
@BindView(R.id.heard_menu)
ImageView heardMenu;
@BindView(R.id.heard_tv_menu)
TextView heardTvMenu;
@BindView(R.id.rl_menu)
RelativeLayout rlMenu;
@BindView(R.id.rl_head)
LinearLayout rlHead;
@BindView(R.id.recyclerView)
RecyclerView recyclerView;
@BindView(R.id.refreshLayout)
SmartRefreshLayout refreshLayout;
@BindView(R.id.et_search)
EditText etSearch;
private int index = 1;
private OrderAdapter adapter;
List<OrderBean> datas = new ArrayList<>();
private Bundle bundle;
private boolean isShow = true;
private String condition = "";
@Override
protected void initContentView(Bundle savedInstanceState) {
setContentView(R.layout.activity_btocorderall_layout);
bundle = getIntent().getExtras();
}
@Override
public void setUpViews() {
IsBang.setImmerHeard(this,rlHead,"#ffffff");
heardTitle.setText("订单搜索");
setRecyclerView();
}
@Override
public void setUpLisener() {
refreshLayout.setEnableLoadMore(false);
refreshLayout.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
index = 1;
isShow = true;
}
});
etSearch.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
KeyBoardUtils.hintKeyBoard(BToCOrderAllActivity.this);
isShow = true;
index = 1;
if (!StrUtils.isEmpty(etSearch.getText().toString())) {
condition = etSearch.getText().toString().trim();
} else {
condition = "";
}
adapter.setNewData(null);
getData();
return true;
}
return false;
}
});
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// TODO: add setContentView(...) invocation
ButterKnife.bind(this);
}
private void setRecyclerView() {
adapter = new OrderAdapter(R.layout.item_order_layout, null);
adapter.setType(0);
recyclerView.addItemDecoration(new RecycleViewDivider(this, LinearLayoutManager.VERTICAL, R.drawable.line));
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setAdapter(adapter);
adapter.setOnLoadMoreListener(new BaseQuickAdapter.RequestLoadMoreListener() {
@Override
public void onLoadMoreRequested() {
recyclerView.postDelayed(new Runnable() {
@Override
public void run() {
index += 1;
isShow = false;
getData();
}
}, 1000);
}
}, recyclerView);
adapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() {
@Override
public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
bundle = new Bundle();
bundle.putString("orderid", datas1.get(position).OrderId + "");
JumpUtils.dataJump(BToCOrderAllActivity.this, MyOrderDetailsActivity.class, bundle, false);
}
});
}
private List<OrderBean> datas1 = new ArrayList<>();
private void getData() {
addSubscription(RequestClient.getOrderList(condition, "", "", index, BToCOrderAllActivity.this, new NetSubscriber<BaseResultBean<List<OrderBean>>>(BToCOrderAllActivity.this, isShow) {
@Override
public void onResultNext(BaseResultBean<List<OrderBean>> model) {
if (index == 1) {
if (model.data.size() > 0) {
datas1 = model.data;
adapter.setNewData(model.data);
} else {
adapter.setNewData(null);
adapter.setEmptyView(R.layout.empty_layout, recyclerView);
}
} else {
if (model.data.size() > 0) {
datas1.addAll(model.data);
adapter.setNewData(datas1);
adapter.loadMoreComplete();
} else {
adapter.loadMoreEnd();
}
}
refreshLayout.finishRefresh();
}
}));
}
@OnClick(R.id.heard_back)
public void onClick() {
this.finish();
}
}
|
UTF-8
|
Java
| 6,651 |
java
|
BToCOrderAllActivity.java
|
Java
|
[
{
"context": "erknife.OnClick;\n\n/**\n * <p>desc:<p>\n * <p>author:DreamFly<p>\n * <p>creatTime:2019/5/23<p>\n * <p>changeTime:",
"end": 1436,
"score": 0.9996516704559326,
"start": 1428,
"tag": "USERNAME",
"value": "DreamFly"
}
] | null |
[] |
package com.snh.snhseller.ui.order;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
import com.snh.module_netapi.requestApi.BaseResultBean;
import com.snh.module_netapi.requestApi.NetSubscriber;
import com.snh.snhseller.BaseActivity;
import com.snh.snhseller.R;
import com.snh.snhseller.adapter.OrderAdapter;
import com.snh.snhseller.bean.OrderBean;
import com.snh.snhseller.requestApi.RequestClient;
import com.snh.snhseller.utils.IsBang;
import com.snh.snhseller.utils.JumpUtils;
import com.snh.snhseller.utils.KeyBoardUtils;
import com.snh.snhseller.utils.StrUtils;
import com.snh.snhseller.wediget.RecycleViewDivider;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
/**
* <p>desc:<p>
* <p>author:DreamFly<p>
* <p>creatTime:2019/5/23<p>
* <p>changeTime:2019/5/23<p>
* <p>version:1<p>
*/
public class BToCOrderAllActivity extends BaseActivity {
@BindView(R.id.heard_back)
LinearLayout heardBack;
@BindView(R.id.heard_title)
TextView heardTitle;
@BindView(R.id.heard_menu)
ImageView heardMenu;
@BindView(R.id.heard_tv_menu)
TextView heardTvMenu;
@BindView(R.id.rl_menu)
RelativeLayout rlMenu;
@BindView(R.id.rl_head)
LinearLayout rlHead;
@BindView(R.id.recyclerView)
RecyclerView recyclerView;
@BindView(R.id.refreshLayout)
SmartRefreshLayout refreshLayout;
@BindView(R.id.et_search)
EditText etSearch;
private int index = 1;
private OrderAdapter adapter;
List<OrderBean> datas = new ArrayList<>();
private Bundle bundle;
private boolean isShow = true;
private String condition = "";
@Override
protected void initContentView(Bundle savedInstanceState) {
setContentView(R.layout.activity_btocorderall_layout);
bundle = getIntent().getExtras();
}
@Override
public void setUpViews() {
IsBang.setImmerHeard(this,rlHead,"#ffffff");
heardTitle.setText("订单搜索");
setRecyclerView();
}
@Override
public void setUpLisener() {
refreshLayout.setEnableLoadMore(false);
refreshLayout.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
index = 1;
isShow = true;
}
});
etSearch.setOnEditorActionListener(new TextView.OnEditorActionListener() {
@Override
public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (actionId == EditorInfo.IME_ACTION_SEARCH) {
KeyBoardUtils.hintKeyBoard(BToCOrderAllActivity.this);
isShow = true;
index = 1;
if (!StrUtils.isEmpty(etSearch.getText().toString())) {
condition = etSearch.getText().toString().trim();
} else {
condition = "";
}
adapter.setNewData(null);
getData();
return true;
}
return false;
}
});
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// TODO: add setContentView(...) invocation
ButterKnife.bind(this);
}
private void setRecyclerView() {
adapter = new OrderAdapter(R.layout.item_order_layout, null);
adapter.setType(0);
recyclerView.addItemDecoration(new RecycleViewDivider(this, LinearLayoutManager.VERTICAL, R.drawable.line));
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setAdapter(adapter);
adapter.setOnLoadMoreListener(new BaseQuickAdapter.RequestLoadMoreListener() {
@Override
public void onLoadMoreRequested() {
recyclerView.postDelayed(new Runnable() {
@Override
public void run() {
index += 1;
isShow = false;
getData();
}
}, 1000);
}
}, recyclerView);
adapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() {
@Override
public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
bundle = new Bundle();
bundle.putString("orderid", datas1.get(position).OrderId + "");
JumpUtils.dataJump(BToCOrderAllActivity.this, MyOrderDetailsActivity.class, bundle, false);
}
});
}
private List<OrderBean> datas1 = new ArrayList<>();
private void getData() {
addSubscription(RequestClient.getOrderList(condition, "", "", index, BToCOrderAllActivity.this, new NetSubscriber<BaseResultBean<List<OrderBean>>>(BToCOrderAllActivity.this, isShow) {
@Override
public void onResultNext(BaseResultBean<List<OrderBean>> model) {
if (index == 1) {
if (model.data.size() > 0) {
datas1 = model.data;
adapter.setNewData(model.data);
} else {
adapter.setNewData(null);
adapter.setEmptyView(R.layout.empty_layout, recyclerView);
}
} else {
if (model.data.size() > 0) {
datas1.addAll(model.data);
adapter.setNewData(datas1);
adapter.loadMoreComplete();
} else {
adapter.loadMoreEnd();
}
}
refreshLayout.finishRefresh();
}
}));
}
@OnClick(R.id.heard_back)
public void onClick() {
this.finish();
}
}
| 6,651 | 0.61586 | 0.610734 | 188 | 34.281914 | 25.213984 | 192 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.62766 | false | false |
13
|
ba08efabf25aaffc454554199482a45f44e4b647
| 5,265,629,936,624 |
d5f90a41043d332c8a8b7fd82e6c49e966626ef4
|
/src/src/test/java/com/avanti/swtest/api/IssApiTest.java
|
fe90ccaaca0a722ada5618231b7404548d056072
|
[] |
no_license
|
dvillarraga/avantitest
|
https://github.com/dvillarraga/avantitest
|
b619bffec1408b225b6decf36d6cc1d5db2433c7
|
b7929aa8fd004745d461fd9b2441c08c5fddb076
|
refs/heads/master
| 2022-12-18T07:45:41.417000 | 2020-09-25T21:30:07 | 2020-09-25T21:30:07 | 298,105,189 | 0 | 0 | null | true | 2020-09-23T22:05:46 | 2020-09-23T22:05:45 | 2020-06-16T12:35:56 | 2020-05-09T17:37:41 | 12,880 | 0 | 0 | 0 | null | false | false |
package com.avanti.swtest.api;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.mockito.Matchers.anyDouble;
import static org.mockito.Matchers.anyFloat;
import static org.mockito.Mockito.when;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import com.avanti.swtest.api.IssApi;
import com.avanti.swtest.logic.DistanceCalculator;
import com.avanti.swtest.logic.PositionCaller;
import com.avanti.swtest.model.ISSPosition;
@RunWith(SpringRunner.class)
@SpringBootTest
public class IssApiTest {
private final double testingDistance = 245.6588;
private final double currentLatTest = 87654.4566;
private final double currentLonTest = 8765.234;
private final double delta = 0.5;
@Mock
PositionCaller positionCaller;
@Mock
DistanceCalculator distanceCalculator;
@InjectMocks
IssApi issApi;
@Before
public void init() {
MockitoAnnotations.initMocks(this);
when(distanceCalculator.getDistanceCalculationInKms(anyFloat(), anyDouble(), anyDouble())).thenReturn(testingDistance);
when( positionCaller.getIssPosition(anyFloat())).thenReturn( new ISSPosition(currentLonTest, currentLatTest, "ISS", 25544) );
}
@Test
public void calculateDistanceTest() {
assertNotNull("Problems mocking the entry point instance ISSApi",issApi);
double calculadteDistance = issApi.calculateDistance(anyFloat(), anyDouble(), anyDouble());
assertEquals("Calculate distance NOT working", testingDistance, calculadteDistance,0.5);
}
@Test
public void currentPositionTest() {
assertNotNull("Problems mocking the entry point instance ISSApi",issApi);
ISSPosition issCurrentPosition = issApi.getCurrentPosition(anyFloat());
assertEquals("Problems in IssApi calculating current latitude", currentLatTest, issCurrentPosition.getLatitude(), delta);
assertEquals("Problems in IssApi calculating current longitude", currentLonTest, issCurrentPosition.getLongitude(), delta);
}
}
|
UTF-8
|
Java
| 2,204 |
java
|
IssApiTest.java
|
Java
|
[] | null |
[] |
package com.avanti.swtest.api;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.mockito.Matchers.anyDouble;
import static org.mockito.Matchers.anyFloat;
import static org.mockito.Mockito.when;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import com.avanti.swtest.api.IssApi;
import com.avanti.swtest.logic.DistanceCalculator;
import com.avanti.swtest.logic.PositionCaller;
import com.avanti.swtest.model.ISSPosition;
@RunWith(SpringRunner.class)
@SpringBootTest
public class IssApiTest {
private final double testingDistance = 245.6588;
private final double currentLatTest = 87654.4566;
private final double currentLonTest = 8765.234;
private final double delta = 0.5;
@Mock
PositionCaller positionCaller;
@Mock
DistanceCalculator distanceCalculator;
@InjectMocks
IssApi issApi;
@Before
public void init() {
MockitoAnnotations.initMocks(this);
when(distanceCalculator.getDistanceCalculationInKms(anyFloat(), anyDouble(), anyDouble())).thenReturn(testingDistance);
when( positionCaller.getIssPosition(anyFloat())).thenReturn( new ISSPosition(currentLonTest, currentLatTest, "ISS", 25544) );
}
@Test
public void calculateDistanceTest() {
assertNotNull("Problems mocking the entry point instance ISSApi",issApi);
double calculadteDistance = issApi.calculateDistance(anyFloat(), anyDouble(), anyDouble());
assertEquals("Calculate distance NOT working", testingDistance, calculadteDistance,0.5);
}
@Test
public void currentPositionTest() {
assertNotNull("Problems mocking the entry point instance ISSApi",issApi);
ISSPosition issCurrentPosition = issApi.getCurrentPosition(anyFloat());
assertEquals("Problems in IssApi calculating current latitude", currentLatTest, issCurrentPosition.getLatitude(), delta);
assertEquals("Problems in IssApi calculating current longitude", currentLonTest, issCurrentPosition.getLongitude(), delta);
}
}
| 2,204 | 0.802632 | 0.787659 | 63 | 33.984127 | 33.359749 | 127 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.587302 | false | false |
13
|
bc0277a6458012b6002ddba969bc39b802b82793
| 5,085,241,314,920 |
fe3df106f1f58ded6393c56ddaca8ef6e2860842
|
/app/src/main/java/syahputro/bimo/projek/dinas/p3a/activity/ActivityArticleDetail.java
|
1de954f66059ffb785651b0245f8ed170e723687
|
[] |
no_license
|
bimosyah/Projek-Dinas-P3A
|
https://github.com/bimosyah/Projek-Dinas-P3A
|
a4e4ae0b8f6d03553d664be8e222d2f16cba00aa
|
92c42bd1462dbb8e2c73c91750c816ce9bbce9d8
|
refs/heads/master
| 2020-09-02T01:47:34.055000 | 2020-02-19T15:28:28 | 2020-02-19T15:28:28 | 219,105,793 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package syahputro.bimo.projek.dinas.p3a.activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.webkit.WebView;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.bumptech.glide.Glide;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import syahputro.bimo.projek.dinas.p3a.R;
import syahputro.bimo.projek.dinas.p3a.network.ApiClient;
import syahputro.bimo.projek.dinas.p3a.network.ApiService;
import syahputro.bimo.projek.dinas.p3a.network.response.artikel.detail_artikel.ResponseDetailArtikel;
public class ActivityArticleDetail extends AppCompatActivity {
ImageView imageView;
ApiService service;
TextView tvContent, tvTitle, tvTanggal, tvKategori;
ProgressBar loadingArtikel;
ConstraintLayout container_artikel;
WebView wvContent;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_article_detail);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setTitle("");
init();
String id_artikel = getIntent().getStringExtra("id_artikel");
loadArtikel(id_artikel);
}
private void loadArtikel(String id_artikel) {
Call<ResponseDetailArtikel> artikel = service.detail_artikel(Integer.parseInt(id_artikel));
artikel.enqueue(new Callback<ResponseDetailArtikel>() {
@Override
public void onResponse(Call<ResponseDetailArtikel> call, Response<ResponseDetailArtikel> response) {
if (response.isSuccessful()) {
if (response.body() != null) {
Log.d("Respone", "onResponse: " + response.body().getTotal());
Glide.with(getApplicationContext())
.load(response.body().getDataDetailArtikel().getImage())
.into(imageView);
tvTitle.setText(response.body().getDataDetailArtikel().getTitle());
tvTanggal.setText(response.body().getDataDetailArtikel().getDate());
tvKategori.setText(response.body().getDataDetailArtikel().getPostCategory());
wvContent.loadData(response.body().getDataDetailArtikel().getContent(), "text/html; charset=utf-8", "UTF-8");
container_artikel.setVisibility(View.VISIBLE);
loadingArtikel.setVisibility(View.GONE);
} else {
Toast.makeText(getApplicationContext(), "error body" + response.body(), Toast.LENGTH_LONG).show();
Log.d("error body", "onResponse: " + response.body());
}
} else {
Toast.makeText(getApplicationContext(), "error ga sukses" + response.body(), Toast.LENGTH_LONG).show();
Log.d("error body", "onResponse: " + response.body());
}
}
@Override
public void onFailure(Call<ResponseDetailArtikel> call, Throwable t) {
Toast.makeText(getApplicationContext(), "error " + t.getMessage(), Toast.LENGTH_LONG).show();
}
});
}
private void init() {
container_artikel = findViewById(R.id.container_artikel);
loadingArtikel = findViewById(R.id.loadingArtikel);
service = ApiClient.getClient().create(ApiService.class);
imageView = findViewById(R.id.ivArtikel);
tvTitle = findViewById(R.id.tvTitle);
tvTanggal = findViewById(R.id.tvTanggal);
tvKategori = findViewById(R.id.tvKategori);
//tvContent = findViewById(R.id.tvContent);
wvContent = findViewById(R.id.wvContent);
}
@Override
public boolean onSupportNavigateUp() {
onBackPressed();
return true;
}
}
|
UTF-8
|
Java
| 4,125 |
java
|
ActivityArticleDetail.java
|
Java
|
[] | null |
[] |
package syahputro.bimo.projek.dinas.p3a.activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.webkit.WebView;
import android.widget.ImageView;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.bumptech.glide.Glide;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
import syahputro.bimo.projek.dinas.p3a.R;
import syahputro.bimo.projek.dinas.p3a.network.ApiClient;
import syahputro.bimo.projek.dinas.p3a.network.ApiService;
import syahputro.bimo.projek.dinas.p3a.network.response.artikel.detail_artikel.ResponseDetailArtikel;
public class ActivityArticleDetail extends AppCompatActivity {
ImageView imageView;
ApiService service;
TextView tvContent, tvTitle, tvTanggal, tvKategori;
ProgressBar loadingArtikel;
ConstraintLayout container_artikel;
WebView wvContent;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_article_detail);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setTitle("");
init();
String id_artikel = getIntent().getStringExtra("id_artikel");
loadArtikel(id_artikel);
}
private void loadArtikel(String id_artikel) {
Call<ResponseDetailArtikel> artikel = service.detail_artikel(Integer.parseInt(id_artikel));
artikel.enqueue(new Callback<ResponseDetailArtikel>() {
@Override
public void onResponse(Call<ResponseDetailArtikel> call, Response<ResponseDetailArtikel> response) {
if (response.isSuccessful()) {
if (response.body() != null) {
Log.d("Respone", "onResponse: " + response.body().getTotal());
Glide.with(getApplicationContext())
.load(response.body().getDataDetailArtikel().getImage())
.into(imageView);
tvTitle.setText(response.body().getDataDetailArtikel().getTitle());
tvTanggal.setText(response.body().getDataDetailArtikel().getDate());
tvKategori.setText(response.body().getDataDetailArtikel().getPostCategory());
wvContent.loadData(response.body().getDataDetailArtikel().getContent(), "text/html; charset=utf-8", "UTF-8");
container_artikel.setVisibility(View.VISIBLE);
loadingArtikel.setVisibility(View.GONE);
} else {
Toast.makeText(getApplicationContext(), "error body" + response.body(), Toast.LENGTH_LONG).show();
Log.d("error body", "onResponse: " + response.body());
}
} else {
Toast.makeText(getApplicationContext(), "error ga sukses" + response.body(), Toast.LENGTH_LONG).show();
Log.d("error body", "onResponse: " + response.body());
}
}
@Override
public void onFailure(Call<ResponseDetailArtikel> call, Throwable t) {
Toast.makeText(getApplicationContext(), "error " + t.getMessage(), Toast.LENGTH_LONG).show();
}
});
}
private void init() {
container_artikel = findViewById(R.id.container_artikel);
loadingArtikel = findViewById(R.id.loadingArtikel);
service = ApiClient.getClient().create(ApiService.class);
imageView = findViewById(R.id.ivArtikel);
tvTitle = findViewById(R.id.tvTitle);
tvTanggal = findViewById(R.id.tvTanggal);
tvKategori = findViewById(R.id.tvKategori);
//tvContent = findViewById(R.id.tvContent);
wvContent = findViewById(R.id.wvContent);
}
@Override
public boolean onSupportNavigateUp() {
onBackPressed();
return true;
}
}
| 4,125 | 0.643152 | 0.640727 | 96 | 41.96875 | 32.194542 | 133 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.78125 | false | false |
13
|
1af7b62e4f7dd7277d196e5c2ce40ad9829fd154
| 9,715,216,052,458 |
0c6626b53b03393735bd61d5ca90ea9c5566fb4a
|
/src/test/java/com/Get/Methods/get_TagandAttribute.java
|
071dbbbc583c1dd16eab69b77b469b110689eb54
|
[] |
no_license
|
paida-1/selenium
|
https://github.com/paida-1/selenium
|
7c7909564397a4bb5c18f5c28244bcc420548cf6
|
bb5a304f4eaf91310d64e676a04547cda90d0bfd
|
refs/heads/master
| 2023-06-19T04:13:33.018000 | 2021-07-20T03:11:23 | 2021-07-20T03:11:23 | 387,656,099 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.Get.Methods;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.Test;
public class get_TagandAttribute {
@Test
public void TagAttribute()
{
System.setProperty("webdriver.chrome.driver","chromedriver.exe");
ChromeDriver driver=new ChromeDriver();
driver.get("https://www.nopcommerce.com/en/register?returnUrl=%2Fen");
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(30,TimeUnit.SECONDS);
String tag=driver.findElement(By.name("FirstName")).getTagName();
System.out.println("Tagname:"+tag);
driver.findElement(By.name("FirstName")).sendKeys("phani");
String attr=driver.findElement(By.name("FirstName")).getAttribute("value");
System.out.println("attri:"+attr);
}
}
|
UTF-8
|
Java
| 873 |
java
|
get_TagandAttribute.java
|
Java
|
[
{
"context": "river.findElement(By.name(\"FirstName\")).sendKeys(\"phani\");\r\n\t\t\r\n\t\tString attr=driver.findElement(By.name(",
"end": 734,
"score": 0.9997000694274902,
"start": 729,
"tag": "NAME",
"value": "phani"
}
] | null |
[] |
package com.Get.Methods;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.Test;
public class get_TagandAttribute {
@Test
public void TagAttribute()
{
System.setProperty("webdriver.chrome.driver","chromedriver.exe");
ChromeDriver driver=new ChromeDriver();
driver.get("https://www.nopcommerce.com/en/register?returnUrl=%2Fen");
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(30,TimeUnit.SECONDS);
String tag=driver.findElement(By.name("FirstName")).getTagName();
System.out.println("Tagname:"+tag);
driver.findElement(By.name("FirstName")).sendKeys("phani");
String attr=driver.findElement(By.name("FirstName")).getAttribute("value");
System.out.println("attri:"+attr);
}
}
| 873 | 0.717068 | 0.713631 | 29 | 28.103449 | 25.732504 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.689655 | false | false |
13
|
5ba24a287414760d0e9b85c795f073125c0a8cda
| 11,149,735,139,663 |
db725ff146e669d6457418cd2c1e1e0fc8b84daf
|
/mobsters-data-model/mobsters-dynamo/src/main/java/com/lvl6/mobsters/dynamo/repository/TaskStageForUserRepository.java
|
f60207a9af22d537c7ca7070f8763c3e474295a4
|
[] |
no_license
|
levelsix/mobsters-server-aws
|
https://github.com/levelsix/mobsters-server-aws
|
557a7cd2a725dcbb1370fe31a4e4b436031e47f8
|
e1357d16fe2d1931582ac06b4f509fb600614433
|
refs/heads/master
| 2021-01-22T12:09:06.878000 | 2014-10-05T10:45:22 | 2014-10-05T10:45:22 | 19,517,019 | 0 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.lvl6.mobsters.dynamo.repository;
import java.util.List;
import com.lvl6.mobsters.dynamo.TaskStageForUser;
public interface TaskStageForUserRepository extends BaseDynamoCollectionRepository<TaskStageForUser, Integer>
{
public List<TaskStageForUser> findByTaskForUserId( String taskForUserId );
}
|
UTF-8
|
Java
| 311 |
java
|
TaskStageForUserRepository.java
|
Java
|
[] | null |
[] |
package com.lvl6.mobsters.dynamo.repository;
import java.util.List;
import com.lvl6.mobsters.dynamo.TaskStageForUser;
public interface TaskStageForUserRepository extends BaseDynamoCollectionRepository<TaskStageForUser, Integer>
{
public List<TaskStageForUser> findByTaskForUserId( String taskForUserId );
}
| 311 | 0.848875 | 0.842444 | 10 | 30.1 | 36.426502 | 109 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6 | false | false |
13
|
cc6c52bc9aee387bbff951e10de6d2b529d2f09b
| 5,231,270,203,304 |
a47de126057af2c1ef3c8c8db715c51b1b62711d
|
/introannotation/src/main/java/com/hao/world/introannotation/annview/ViewUtils.java
|
59dbde37bbf26be7e3322090f2e410be7ce376a6
|
[] |
no_license
|
haofighter/Intro
|
https://github.com/haofighter/Intro
|
83ce8a47dfdadb019530173f451183899efc5811
|
46b4f69c8ab4e5066d9ff57fbb004f8cff4a1c42
|
refs/heads/master
| 2020-03-22T19:15:40.432000 | 2018-07-11T03:28:43 | 2018-07-11T03:28:43 | 140,516,597 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.hao.world.introannotation.annview;
import android.app.Activity;
import android.util.Log;
import android.view.View;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
public class ViewUtils {
public static void init(Object object, Activity activity, View.OnClickListener listener) {
Class classType = object.getClass();
// 该类是否存在AnnXmlView类型的注解
if (classType.isAnnotationPresent(AnnXmlView.class)) {
// 返回存在的AnnXmlView类型的注解
AnnXmlView annotation = (AnnXmlView) classType.getAnnotation(AnnXmlView.class);
try {
// 返回一个 Method 对象,它反映此 Class 对象所表示的类或接口的指定公共成员方法。
Method method = classType.getMethod("setContentView", int.class);
method.setAccessible(true);
int resId = annotation.value();
method.invoke(object, resId);//动态调用反射获取到的方法
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
// 返回 Field 对象的一个数组,这些对象反映此 Class 对象表示的类或接口声明的成员变量,
// 包括公共、保护、默认(包)访问和私有成员变量,但不包括继承的成员变量。
Field[] fields = classType.getDeclaredFields();
//遍历所有的成员变量
if (null != fields && fields.length > 0) {
for (Field field : fields) {
// 该成员变量是否存在AnnWidget类型的注解
if (field.isAnnotationPresent(AnnWidget.class)) {
AnnWidget annotation = field.getAnnotation(AnnWidget.class);
int viewId = annotation.value();
Log.e("TAG", viewId + "===========" + annotation.toString() + "===========" + field.getName());
View view = activity.findViewById(viewId);
view.setOnClickListener(listener);
if (null != view) {
try {
field.setAccessible(true);
field.set(object, view);//将对应的控件对号入座
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
}
}
}
}
}
|
UTF-8
|
Java
| 2,931 |
java
|
ViewUtils.java
|
Java
|
[] | null |
[] |
package com.hao.world.introannotation.annview;
import android.app.Activity;
import android.util.Log;
import android.view.View;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
public class ViewUtils {
public static void init(Object object, Activity activity, View.OnClickListener listener) {
Class classType = object.getClass();
// 该类是否存在AnnXmlView类型的注解
if (classType.isAnnotationPresent(AnnXmlView.class)) {
// 返回存在的AnnXmlView类型的注解
AnnXmlView annotation = (AnnXmlView) classType.getAnnotation(AnnXmlView.class);
try {
// 返回一个 Method 对象,它反映此 Class 对象所表示的类或接口的指定公共成员方法。
Method method = classType.getMethod("setContentView", int.class);
method.setAccessible(true);
int resId = annotation.value();
method.invoke(object, resId);//动态调用反射获取到的方法
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
// 返回 Field 对象的一个数组,这些对象反映此 Class 对象表示的类或接口声明的成员变量,
// 包括公共、保护、默认(包)访问和私有成员变量,但不包括继承的成员变量。
Field[] fields = classType.getDeclaredFields();
//遍历所有的成员变量
if (null != fields && fields.length > 0) {
for (Field field : fields) {
// 该成员变量是否存在AnnWidget类型的注解
if (field.isAnnotationPresent(AnnWidget.class)) {
AnnWidget annotation = field.getAnnotation(AnnWidget.class);
int viewId = annotation.value();
Log.e("TAG", viewId + "===========" + annotation.toString() + "===========" + field.getName());
View view = activity.findViewById(viewId);
view.setOnClickListener(listener);
if (null != view) {
try {
field.setAccessible(true);
field.set(object, view);//将对应的控件对号入座
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
}
}
}
}
}
| 2,931 | 0.536745 | 0.53636 | 73 | 34.61644 | 26.641521 | 115 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.452055 | false | false |
13
|
6e0b64a5b3ff81d30f998b6acf89f07dec516749
| 33,260,226,765,881 |
5ecd15baa833422572480fad3946e0e16a389000
|
/framework/MCS-Open/subsystems/runtime/main/api/java/com/volantis/mcs/wbdom/dissection/DissectableWBSAXExtensionString.java
|
bcd70a5f5e9b759903bd23ffbb31a3cbbc69a843
|
[] |
no_license
|
jabley/volmobserverce
|
https://github.com/jabley/volmobserverce
|
4c5db36ef72c3bb7ef20fb81855e18e9b53823b9
|
6d760f27ac5917533eca6708f389ed9347c7016d
|
refs/heads/master
| 2021-01-01T05:31:21.902000 | 2009-02-04T02:29:06 | 2009-02-04T02:29:06 | 38,675,289 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
This file is part of Volantis Mobility Server.
Volantis Mobility Server 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 3 of the License, or
(at your option) any later version.
Volantis Mobility Server 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 Volantis Mobility Server. If not, see <http://www.gnu.org/licenses/>.
*/
/* ----------------------------------------------------------------------------
* (c) Volantis Systems Ltd 2003.
* ----------------------------------------------------------------------------
*/
package com.volantis.mcs.wbdom.dissection;
import com.volantis.mcs.wbsax.WBSAXValueVisitor;
import com.volantis.mcs.wbsax.WBSAXException;
import com.volantis.mcs.wbsax.Extension;
import com.volantis.mcs.wbsax.WBSAXString;
import com.volantis.mcs.wbdom.WBDOMException;
import com.volantis.mcs.dissection.DissectionException;
/**
* An Adaptor which wraps {@link Extension} and {@link WBSAXString} in order
* to make it implement
* {@link com.volantis.mcs.dissection.string.DissectableString}.
* <p>
* At paul's suggestion, this was implemented so that each "extension string"
* appears as a single, very costly character. Supposedly, this prevents it
* being dissected.
*/
public class DissectableWBSAXExtensionString
extends DissectableWBSAXCharacter {
/**
* A "special" character used to represent extensions. Must be non-
* space.
*
* @todo Perhaps the "special" character ought to be defined by dissector?
* I would imagine it would want to detect it and handle it specially
* (e.g. for debugging?).
*/
private static final char NON_SPACE_SPECIAL_CHAR = '$';
private Extension extension;
private WBSAXString string;
// Add a single "special" character which has the cost of the string,
// i.e. cost(STR_I + bytes)
public DissectableWBSAXExtensionString(Extension extension,
WBSAXString string) throws WBDOMException {
this.extension = extension;
this.string = string;
}
// Inherit javadoc.
protected int getChar() {
return NON_SPACE_SPECIAL_CHAR;
}
// Inherit javadoc.
public int getCost() throws DissectionException {
try {
return 1 + string.getBytes().length;
} catch (WBSAXException e) {
throw new DissectionException(e);
}
}
// Inherit javadoc.
public boolean isCostContextDependent()
throws DissectionException {
return false;
}
// Inherit javadoc.
public void accept(WBSAXValueVisitor visitor) throws WBSAXException {
visitor.visitExtensionString(extension, string);
}
// Inherit javadoc.
public String toString() {
try {
return "[DissectableWBSAXExtensionString:c=" + getCost() + "]";
} catch (DissectionException e) {
throw new RuntimeException(e);
}
}
}
/*
===========================================================================
Change History
===========================================================================
$Log$
08-Dec-04 6416/3 ianw VBM:2004120703 New Build
08-Dec-04 6416/1 ianw VBM:2004120703 New Build
27-Aug-03 1286/1 geoff VBM:2003082101 Clean up wbdom.dissection (merge from Proteus)
26-Aug-03 1284/1 geoff VBM:2003082101 Clean up wbdom.dissection (merge from Mimas)
26-Aug-03 1278/1 geoff VBM:2003082101 Clean up wbdom.dissection (merge from Metis)
26-Aug-03 1238/2 geoff VBM:2003082101 Clean up wbdom.dissection
15-Jul-03 804/2 geoff VBM:2003070405 merge from metis with manual renames and copies
15-Jul-03 798/3 geoff VBM:2003070405 commit the clean up, athough I am not finished yet
24-Jun-03 365/1 geoff VBM:2003061005 first go at long string dissection; still needs cleanup and more testing.
===========================================================================
*/
|
UTF-8
|
Java
| 4,298 |
java
|
DissectableWBSAXExtensionString.java
|
Java
|
[] | null |
[] |
/*
This file is part of Volantis Mobility Server.
Volantis Mobility Server 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 3 of the License, or
(at your option) any later version.
Volantis Mobility Server 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 Volantis Mobility Server. If not, see <http://www.gnu.org/licenses/>.
*/
/* ----------------------------------------------------------------------------
* (c) Volantis Systems Ltd 2003.
* ----------------------------------------------------------------------------
*/
package com.volantis.mcs.wbdom.dissection;
import com.volantis.mcs.wbsax.WBSAXValueVisitor;
import com.volantis.mcs.wbsax.WBSAXException;
import com.volantis.mcs.wbsax.Extension;
import com.volantis.mcs.wbsax.WBSAXString;
import com.volantis.mcs.wbdom.WBDOMException;
import com.volantis.mcs.dissection.DissectionException;
/**
* An Adaptor which wraps {@link Extension} and {@link WBSAXString} in order
* to make it implement
* {@link com.volantis.mcs.dissection.string.DissectableString}.
* <p>
* At paul's suggestion, this was implemented so that each "extension string"
* appears as a single, very costly character. Supposedly, this prevents it
* being dissected.
*/
public class DissectableWBSAXExtensionString
extends DissectableWBSAXCharacter {
/**
* A "special" character used to represent extensions. Must be non-
* space.
*
* @todo Perhaps the "special" character ought to be defined by dissector?
* I would imagine it would want to detect it and handle it specially
* (e.g. for debugging?).
*/
private static final char NON_SPACE_SPECIAL_CHAR = '$';
private Extension extension;
private WBSAXString string;
// Add a single "special" character which has the cost of the string,
// i.e. cost(STR_I + bytes)
public DissectableWBSAXExtensionString(Extension extension,
WBSAXString string) throws WBDOMException {
this.extension = extension;
this.string = string;
}
// Inherit javadoc.
protected int getChar() {
return NON_SPACE_SPECIAL_CHAR;
}
// Inherit javadoc.
public int getCost() throws DissectionException {
try {
return 1 + string.getBytes().length;
} catch (WBSAXException e) {
throw new DissectionException(e);
}
}
// Inherit javadoc.
public boolean isCostContextDependent()
throws DissectionException {
return false;
}
// Inherit javadoc.
public void accept(WBSAXValueVisitor visitor) throws WBSAXException {
visitor.visitExtensionString(extension, string);
}
// Inherit javadoc.
public String toString() {
try {
return "[DissectableWBSAXExtensionString:c=" + getCost() + "]";
} catch (DissectionException e) {
throw new RuntimeException(e);
}
}
}
/*
===========================================================================
Change History
===========================================================================
$Log$
08-Dec-04 6416/3 ianw VBM:2004120703 New Build
08-Dec-04 6416/1 ianw VBM:2004120703 New Build
27-Aug-03 1286/1 geoff VBM:2003082101 Clean up wbdom.dissection (merge from Proteus)
26-Aug-03 1284/1 geoff VBM:2003082101 Clean up wbdom.dissection (merge from Mimas)
26-Aug-03 1278/1 geoff VBM:2003082101 Clean up wbdom.dissection (merge from Metis)
26-Aug-03 1238/2 geoff VBM:2003082101 Clean up wbdom.dissection
15-Jul-03 804/2 geoff VBM:2003070405 merge from metis with manual renames and copies
15-Jul-03 798/3 geoff VBM:2003070405 commit the clean up, athough I am not finished yet
24-Jun-03 365/1 geoff VBM:2003061005 first go at long string dissection; still needs cleanup and more testing.
===========================================================================
*/
| 4,298 | 0.639898 | 0.599395 | 126 | 33.095238 | 29.838568 | 111 | false | false | 0 | 0 | 0 | 0 | 76 | 0.053073 | 0.468254 | false | false |
13
|
58009f127d6a7ce88be69742281f13f0a919b687
| 33,260,226,765,482 |
d3c44e1c45f4b1f0b4ccaa5643ffaa8094f88438
|
/app/src/main/java/com/kahan/david/weatherapp/ui/city/ICityWeatherPresenter.java
|
6213f65d14d28d0af03ce10aa46d202815b2b5ef
|
[] |
no_license
|
DavidKahan/WeatherApp
|
https://github.com/DavidKahan/WeatherApp
|
9c657c389aa482e648c8d8bb4bc2d55e6233d967
|
cc692e0ab5c27b0d08ab5baf928e34d0afb97421
|
refs/heads/master
| 2021-01-01T20:18:40.721000 | 2017-07-30T15:48:56 | 2017-07-30T15:48:56 | 98,807,892 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.kahan.david.weatherapp.ui.city;
import android.content.Context;
/**
* Created by david on 29/07/2017.
*/
public interface ICityWeatherPresenter {
void setView(CityWeatherView view);
void getCityWeatherByID(Context context, String foodId);
void changePresentation();
}
|
UTF-8
|
Java
| 298 |
java
|
ICityWeatherPresenter.java
|
Java
|
[
{
"context": "import android.content.Context;\n\n/**\n * Created by david on 29/07/2017.\n */\npublic interface ICityWeatherP",
"end": 101,
"score": 0.997197151184082,
"start": 96,
"tag": "USERNAME",
"value": "david"
}
] | null |
[] |
package com.kahan.david.weatherapp.ui.city;
import android.content.Context;
/**
* Created by david on 29/07/2017.
*/
public interface ICityWeatherPresenter {
void setView(CityWeatherView view);
void getCityWeatherByID(Context context, String foodId);
void changePresentation();
}
| 298 | 0.748322 | 0.721476 | 14 | 20.285715 | 20.432568 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false |
13
|
16b15d76dae3d08bd02321b7de990158a818f4f2
| 8,650,064,162,458 |
4936069f41c16f5bc314669c524e2fd7981c2983
|
/agave-systems/systems-core/src/main/java/org/iplantc/service/systems/model/enumerations/SchedulerType.java
|
f0bb88e7473c5b2bd6b6c20b36729e315e1052c0
|
[] |
no_license
|
deardooley/agave-flat
|
https://github.com/deardooley/agave-flat
|
4c009bea5a02a75236990f41eb9183f48634b7d6
|
33be1ee238f94686123bc91c0b9075e3d8a2efb8
|
refs/heads/master
| 2020-12-30T13:28:35.800000 | 2017-04-05T20:42:26 | 2017-04-05T22:38:07 | 91,220,046 | 3 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
*
*/
package org.iplantc.service.systems.model.enumerations;
/**
* Types of batch schedulers.
*
* @author dooley
*
*/
public enum SchedulerType
{
LSF, CUSTOM_LSF, LOADLEVELER, CUSTOM_LOADLEVELER, PBS, CUSTOM_PBS, SGE, CUSTOM_GRIDENGINE, CONDOR, CUSTOM_CONDOR, FORK, TORQUE, CUSTOM_TORQUE, MOAB, SLURM, CUSTOM_SLURM, UNKNOWN;
public String getBatchSubmitCommand()
{
switch (this)
{
case LSF:
case CUSTOM_LSF:
return "bsub < ";
case LOADLEVELER:
case CUSTOM_LOADLEVELER:
return "llsub";
case TORQUE:
case CUSTOM_TORQUE:
case CUSTOM_PBS:
case MOAB:
case PBS:
case SGE:
case CUSTOM_GRIDENGINE:
return "qsub";
case CUSTOM_CONDOR:
case CONDOR:
return "condor_submit";
case UNKNOWN:
case FORK:
return "";
case SLURM:
case CUSTOM_SLURM:
return "sbatch";
default:
return "qsub";
}
}
public String getBatchKillCommand()
{
switch (this)
{
case LSF:
case CUSTOM_LSF:
return "bkill ";
case LOADLEVELER:
case CUSTOM_LOADLEVELER:
return "llcancel ";
case TORQUE:
case CUSTOM_TORQUE:
case CUSTOM_PBS:
case MOAB:
case PBS:
case SGE:
case CUSTOM_GRIDENGINE:
return "qdel ";
case CUSTOM_CONDOR:
case CONDOR:
return "condor_rm ";
case UNKNOWN:
case FORK:
return "kill -9 ";
case SLURM:
case CUSTOM_SLURM:
return "scancel ";
default:
return "qdel ";
}
}
@Override
public String toString() {
return name();
}
public String getBatchQueryCommand()
{
switch (this)
{
case LSF:
case CUSTOM_LSF:
return "bhist";
case LOADLEVELER:
case CUSTOM_LOADLEVELER:
return "llq";
case PBS:
case CUSTOM_PBS:
case TORQUE:
case CUSTOM_TORQUE:
case MOAB:
case SGE:
case CUSTOM_GRIDENGINE:
return "qstat -w | grep ";
case CUSTOM_CONDOR:
case CONDOR:
return "condor_q -format '%d' JobStatus";
case UNKNOWN:
case FORK:
return "ps -o pid= -o comm= -p ";
case SLURM:
case CUSTOM_SLURM:
// return "sacct -p -o 'JobIDRaw,State,ExitCode,Start,End,Elapsed,CPUTimeRaw,DerivedExitCode,NCPUS,NNodes' -j ";
return "sacct -p -o 'JOBID,State,ExitCode' -n -j ";
default:
return "qstat";
}
}
}
|
UTF-8
|
Java
| 2,248 |
java
|
SchedulerType.java
|
Java
|
[
{
"context": "\n\n/**\n * Types of batch schedulers.\n * \n * @author dooley\n * \n */\npublic enum SchedulerType\n{\n\tLSF, CUSTOM_",
"end": 124,
"score": 0.998894989490509,
"start": 118,
"tag": "USERNAME",
"value": "dooley"
}
] | null |
[] |
/**
*
*/
package org.iplantc.service.systems.model.enumerations;
/**
* Types of batch schedulers.
*
* @author dooley
*
*/
public enum SchedulerType
{
LSF, CUSTOM_LSF, LOADLEVELER, CUSTOM_LOADLEVELER, PBS, CUSTOM_PBS, SGE, CUSTOM_GRIDENGINE, CONDOR, CUSTOM_CONDOR, FORK, TORQUE, CUSTOM_TORQUE, MOAB, SLURM, CUSTOM_SLURM, UNKNOWN;
public String getBatchSubmitCommand()
{
switch (this)
{
case LSF:
case CUSTOM_LSF:
return "bsub < ";
case LOADLEVELER:
case CUSTOM_LOADLEVELER:
return "llsub";
case TORQUE:
case CUSTOM_TORQUE:
case CUSTOM_PBS:
case MOAB:
case PBS:
case SGE:
case CUSTOM_GRIDENGINE:
return "qsub";
case CUSTOM_CONDOR:
case CONDOR:
return "condor_submit";
case UNKNOWN:
case FORK:
return "";
case SLURM:
case CUSTOM_SLURM:
return "sbatch";
default:
return "qsub";
}
}
public String getBatchKillCommand()
{
switch (this)
{
case LSF:
case CUSTOM_LSF:
return "bkill ";
case LOADLEVELER:
case CUSTOM_LOADLEVELER:
return "llcancel ";
case TORQUE:
case CUSTOM_TORQUE:
case CUSTOM_PBS:
case MOAB:
case PBS:
case SGE:
case CUSTOM_GRIDENGINE:
return "qdel ";
case CUSTOM_CONDOR:
case CONDOR:
return "condor_rm ";
case UNKNOWN:
case FORK:
return "kill -9 ";
case SLURM:
case CUSTOM_SLURM:
return "scancel ";
default:
return "qdel ";
}
}
@Override
public String toString() {
return name();
}
public String getBatchQueryCommand()
{
switch (this)
{
case LSF:
case CUSTOM_LSF:
return "bhist";
case LOADLEVELER:
case CUSTOM_LOADLEVELER:
return "llq";
case PBS:
case CUSTOM_PBS:
case TORQUE:
case CUSTOM_TORQUE:
case MOAB:
case SGE:
case CUSTOM_GRIDENGINE:
return "qstat -w | grep ";
case CUSTOM_CONDOR:
case CONDOR:
return "condor_q -format '%d' JobStatus";
case UNKNOWN:
case FORK:
return "ps -o pid= -o comm= -p ";
case SLURM:
case CUSTOM_SLURM:
// return "sacct -p -o 'JobIDRaw,State,ExitCode,Start,End,Elapsed,CPUTimeRaw,DerivedExitCode,NCPUS,NNodes' -j ";
return "sacct -p -o 'JOBID,State,ExitCode' -n -j ";
default:
return "qstat";
}
}
}
| 2,248 | 0.631228 | 0.630783 | 118 | 18.059322 | 20.464228 | 179 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.898305 | false | false |
13
|
74347b0ce4637846bd40667825aa21a2f1ef8a15
| 10,101,763,131,262 |
813d277b0344b944052138dacbf5ce71fa6586fc
|
/ses/src/main/java/com/fdmgroup/ses/reports/RowDefinition.java
|
1064897f28e20eb6706e1328eca75d9f219e0ef3
|
[] |
no_license
|
dannysalvadori/SES
|
https://github.com/dannysalvadori/SES
|
47108e6b96395e8e1331d1fa22f3f7294ee045b0
|
18521c46f2823e1732c9a5c8c901005fa0c18644
|
refs/heads/master
| 2021-04-03T08:37:12.038000 | 2018-10-09T10:57:30 | 2018-10-09T10:57:30 | 124,666,191 | 0 | 0 | null | false | 2018-10-09T10:57:31 | 2018-03-10T15:00:49 | 2018-10-09T10:34:08 | 2018-10-09T10:57:31 | 448 | 0 | 0 | 0 |
Java
| false | null |
package com.fdmgroup.ses.reports;
import java.util.LinkedHashMap;
import java.util.Map;
public class RowDefinition {
private Map<String, String> columnValueMap = new LinkedHashMap<>(); // Maintains FIFO order
public Map<String, String> getColumnValueMap() {
return columnValueMap;
}
public void putColumnValueMapping(String key, String value) {
columnValueMap.put(key, value);
}
}
|
UTF-8
|
Java
| 417 |
java
|
RowDefinition.java
|
Java
|
[] | null |
[] |
package com.fdmgroup.ses.reports;
import java.util.LinkedHashMap;
import java.util.Map;
public class RowDefinition {
private Map<String, String> columnValueMap = new LinkedHashMap<>(); // Maintains FIFO order
public Map<String, String> getColumnValueMap() {
return columnValueMap;
}
public void putColumnValueMapping(String key, String value) {
columnValueMap.put(key, value);
}
}
| 417 | 0.719424 | 0.719424 | 18 | 21.166666 | 25.528307 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.222222 | false | false |
13
|
5a73eb7a17ec33b0df7a42537ea0da4fdb3a2f97
| 26,199,300,557,780 |
b813704f86897cb201c933a907f0236add91aa5f
|
/TInfoWebServer/src/com/zjw/dao/LSDAO.java
|
cb97724cb04129651d5bdd19f44700b59ba91742
|
[] |
no_license
|
akxiaoli/Android-app
|
https://github.com/akxiaoli/Android-app
|
b57f52ab97a823678b40d60ceb0af7ff78472d5d
|
f2f70b9a3348f22cae7716850acf5cc811e8e1cf
|
refs/heads/master
| 2023-05-30T15:05:27.828000 | 2020-08-23T05:01:44 | 2020-08-23T05:01:44 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.zjw.dao;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import com.zjw.db.DbHelper;
import com.zjw.model.KCInfo;
import com.zjw.model.Lsinfo;
import com.zjw.utils.TimeUtils;
public class LSDAO {
public static int add (String sid,String sl,String bq,String name,String mobile){
String sql="insert into lsinfo(time,kcid,sl,bq,name,mobile)values('"+TimeUtils.getNowTime()+"','"+sid+"','"+sl+"','"+bq+"','"+name +"','"+mobile+"')";
return DbHelper.executeSql(sql);
}
public static List<Lsinfo> getAllInfo(String bq){
String sql="select * from lsinfo";
Connection con=null;
Statement st=null;
ResultSet rs=null;
List<Lsinfo> list =new ArrayList<Lsinfo>();
try{
con = DbHelper.getconnection();
st = con.createStatement();
rs=st.executeQuery(sql);
if(rs!=null){
while(rs.next()){
if (bq.equals(rs.getString("bq"))) {
Lsinfo l=new Lsinfo();
l.setKcid(rs.getString("kcid"));
l.setKcInfo(KCDAO.getInfo(l.getKcid()));
l.setSl(rs.getString("sl"));
l.setTime(rs.getString("time"));
l.setName(rs.getString("name"));
l.setMobile(rs.getString("mobile"));
list.add(l);
}
}
}
}catch(Exception ex){
ex.printStackTrace();
}
finally {
DbHelper.closeConnectionAndStatement(con,st);
}
return list;
}
public static List<Lsinfo> getAllInfoByID(String bq,String kcid){
String sql="select * from lsinfo";
Connection con=null;
Statement st=null;
ResultSet rs=null;
List<Lsinfo> list =new ArrayList<Lsinfo>();
try{
con = DbHelper.getconnection();
st = con.createStatement();
rs=st.executeQuery(sql);
if(rs!=null){
while(rs.next()){
if (bq.equals(rs.getString("bq")) && kcid.equals(rs.getString("kcid"))) {
Lsinfo l=new Lsinfo();
l.setKcid(rs.getString("kcid"));
l.setKcInfo(KCDAO.getInfo(l.getKcid()));
l.setSl(rs.getString("sl"));
l.setTime(rs.getString("time"));
l.setName(rs.getString("name"));
l.setMobile(rs.getString("mobile"));
list.add(l);
}
}
}
}catch(Exception ex){
ex.printStackTrace();
}
finally {
DbHelper.closeConnectionAndStatement(con,st);
}
return list;
}
public static void del(String id){
String sql="DELETE FROM lsinfo WHERE id ='"+id+"'";
DbHelper.executeSql(sql);
}
}
|
UTF-8
|
Java
| 2,372 |
java
|
LSDAO.java
|
Java
|
[] | null |
[] |
package com.zjw.dao;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import com.zjw.db.DbHelper;
import com.zjw.model.KCInfo;
import com.zjw.model.Lsinfo;
import com.zjw.utils.TimeUtils;
public class LSDAO {
public static int add (String sid,String sl,String bq,String name,String mobile){
String sql="insert into lsinfo(time,kcid,sl,bq,name,mobile)values('"+TimeUtils.getNowTime()+"','"+sid+"','"+sl+"','"+bq+"','"+name +"','"+mobile+"')";
return DbHelper.executeSql(sql);
}
public static List<Lsinfo> getAllInfo(String bq){
String sql="select * from lsinfo";
Connection con=null;
Statement st=null;
ResultSet rs=null;
List<Lsinfo> list =new ArrayList<Lsinfo>();
try{
con = DbHelper.getconnection();
st = con.createStatement();
rs=st.executeQuery(sql);
if(rs!=null){
while(rs.next()){
if (bq.equals(rs.getString("bq"))) {
Lsinfo l=new Lsinfo();
l.setKcid(rs.getString("kcid"));
l.setKcInfo(KCDAO.getInfo(l.getKcid()));
l.setSl(rs.getString("sl"));
l.setTime(rs.getString("time"));
l.setName(rs.getString("name"));
l.setMobile(rs.getString("mobile"));
list.add(l);
}
}
}
}catch(Exception ex){
ex.printStackTrace();
}
finally {
DbHelper.closeConnectionAndStatement(con,st);
}
return list;
}
public static List<Lsinfo> getAllInfoByID(String bq,String kcid){
String sql="select * from lsinfo";
Connection con=null;
Statement st=null;
ResultSet rs=null;
List<Lsinfo> list =new ArrayList<Lsinfo>();
try{
con = DbHelper.getconnection();
st = con.createStatement();
rs=st.executeQuery(sql);
if(rs!=null){
while(rs.next()){
if (bq.equals(rs.getString("bq")) && kcid.equals(rs.getString("kcid"))) {
Lsinfo l=new Lsinfo();
l.setKcid(rs.getString("kcid"));
l.setKcInfo(KCDAO.getInfo(l.getKcid()));
l.setSl(rs.getString("sl"));
l.setTime(rs.getString("time"));
l.setName(rs.getString("name"));
l.setMobile(rs.getString("mobile"));
list.add(l);
}
}
}
}catch(Exception ex){
ex.printStackTrace();
}
finally {
DbHelper.closeConnectionAndStatement(con,st);
}
return list;
}
public static void del(String id){
String sql="DELETE FROM lsinfo WHERE id ='"+id+"'";
DbHelper.executeSql(sql);
}
}
| 2,372 | 0.65683 | 0.65683 | 92 | 24.782608 | 22.04039 | 153 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.978261 | false | false |
13
|
5611c19b729dff0ad2486675258f9933e6138cc8
| 25,555,055,437,218 |
d09d0801a4f24f9e81f0178b445d65971036bfce
|
/src/main/java/com/welovecoding/tutorial/data/user/UserService.java
|
701258fefbd687400c411a745cc9f7f852525e4c
|
[] |
no_license
|
bennycode/wlc-webapp
|
https://github.com/bennycode/wlc-webapp
|
48207822cc8ce4f29a7d1d406783486b8036d8ff
|
c5e59d1eb17e164c9a9191c5e1ba5dc812f137d2
|
refs/heads/master
| 2023-05-01T05:19:45.539000 | 2016-01-08T09:48:29 | 2016-01-08T09:48:29 | 15,072,342 | 0 | 0 | null | false | 2023-04-15T16:30:07 | 2013-12-10T09:16:27 | 2017-02-23T07:28:25 | 2023-04-15T16:30:07 | 7,471 | 6 | 1 | 87 |
CSS
| false | false |
package com.welovecoding.tutorial.data.user;
import com.welovecoding.tutorial.data.base.BaseService;
import com.welovecoding.tutorial.data.user.entity.User;
import de.yser.ownsimplecache.OwnCacheServerService;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.logging.Logger;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.ejb.Stateless;
@Stateless
public class UserService extends BaseService<User, UserRepository> {
private static final Logger LOG = Logger.getLogger(UserService.class.getName());
@EJB
private UserRepository repository;
@EJB
private OwnCacheServerService cacheService;
public UserService() {
super(User.class);
}
@PostConstruct
public void init() {
}
public User findByEmail(String email) {
return repository.findByEmail(email);
}
@Override
protected UserRepository getRepository() {
return repository;
}
@Override
protected OwnCacheServerService getCache() {
return cacheService;
}
@Override
protected Set<String> typesToClear() {
return new HashSet<>(Arrays.asList(new String[]{}));
}
@Override
protected void invalidateRelatedCaches() {
//NO-OP
// UserService is not relevant for the REST-Service nor the associated Cache
}
}
|
UTF-8
|
Java
| 1,303 |
java
|
UserService.java
|
Java
|
[] | null |
[] |
package com.welovecoding.tutorial.data.user;
import com.welovecoding.tutorial.data.base.BaseService;
import com.welovecoding.tutorial.data.user.entity.User;
import de.yser.ownsimplecache.OwnCacheServerService;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import java.util.logging.Logger;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.ejb.Stateless;
@Stateless
public class UserService extends BaseService<User, UserRepository> {
private static final Logger LOG = Logger.getLogger(UserService.class.getName());
@EJB
private UserRepository repository;
@EJB
private OwnCacheServerService cacheService;
public UserService() {
super(User.class);
}
@PostConstruct
public void init() {
}
public User findByEmail(String email) {
return repository.findByEmail(email);
}
@Override
protected UserRepository getRepository() {
return repository;
}
@Override
protected OwnCacheServerService getCache() {
return cacheService;
}
@Override
protected Set<String> typesToClear() {
return new HashSet<>(Arrays.asList(new String[]{}));
}
@Override
protected void invalidateRelatedCaches() {
//NO-OP
// UserService is not relevant for the REST-Service nor the associated Cache
}
}
| 1,303 | 0.751343 | 0.751343 | 57 | 21.85965 | 22.000349 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.350877 | false | false |
13
|
fa76a0b895808dfcde99c8a39a8da5b0653e580b
| 16,398,185,164,769 |
991da4b2fe9331ef818f60f75c641614a40a16a7
|
/src/main/java/io/remedymatch/gamification/RmGamificationApplication.java
|
cf78c9de487e67aa93f7c9fd696c879b21c55b9f
|
[
"Apache-2.0"
] |
permissive
|
remedyMatch/rm-gamification
|
https://github.com/remedyMatch/rm-gamification
|
28975b2811102e2b88aee9baa200e7af824c706e
|
458d252f9261a3cde91c6bd6247d2074fbb67935
|
refs/heads/master
| 2022-09-17T05:20:26.957000 | 2020-06-04T19:59:21 | 2020-06-04T19:59:21 | 269,451,568 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package io.remedymatch.gamification;
import io.remedymatch.gamification.properties.*;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableFeignClients
@EnableConfigurationProperties({EngineProperties.class, BackendProperties.class})
public class RmGamificationApplication {
public static void main(String[] args) {
SpringApplication.run(RmGamificationApplication.class, args);
}
}
|
UTF-8
|
Java
| 644 |
java
|
RmGamificationApplication.java
|
Java
|
[] | null |
[] |
package io.remedymatch.gamification;
import io.remedymatch.gamification.properties.*;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableFeignClients
@EnableConfigurationProperties({EngineProperties.class, BackendProperties.class})
public class RmGamificationApplication {
public static void main(String[] args) {
SpringApplication.run(RmGamificationApplication.class, args);
}
}
| 644 | 0.840062 | 0.840062 | 18 | 34.777779 | 28.951216 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false |
13
|
3a4b80bc77d21eb457c91d837ccda0de81133c44
| 19,628,000,563,527 |
b60f8d099b33ed80651c0cf628bb5daf0399f182
|
/LookupMethodDI/src/test/Client.java
|
674aa32cbebe6bceae79248a7380435300f8558b
|
[] |
no_license
|
VishankR/LookupMethodDI
|
https://github.com/VishankR/LookupMethodDI
|
506e8827daaeac0c7b551578bb0f5e1ca1ef15a2
|
379630ecd94ca8d9ecbec930aadaab9605fc9668
|
refs/heads/master
| 2021-04-11T19:55:14.986000 | 2020-03-21T19:49:09 | 2020-03-21T19:49:09 | 249,049,589 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import beans.Truck;
public class Client {
public static void main(String[] args) {
String fileName= "resources/spring.xml";
ApplicationContext context = new ClassPathXmlApplicationContext(fileName);
Truck t = (Truck)context.getBean("t");
System.out.println(t.getTruckEngine().getName());
((ClassPathXmlApplicationContext)context).close();
}
}
|
UTF-8
|
Java
| 504 |
java
|
Client.java
|
Java
|
[] | null |
[] |
package test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import beans.Truck;
public class Client {
public static void main(String[] args) {
String fileName= "resources/spring.xml";
ApplicationContext context = new ClassPathXmlApplicationContext(fileName);
Truck t = (Truck)context.getBean("t");
System.out.println(t.getTruckEngine().getName());
((ClassPathXmlApplicationContext)context).close();
}
}
| 504 | 0.78373 | 0.78373 | 18 | 27 | 26.217043 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.166667 | false | false |
13
|
4c65ab3821d70b8a231b03544001b1f97643633e
| 6,811,818,165,507 |
3c4796528c05aac1083144bede7f32ce08033199
|
/HTMLRenderGenerator/src/main/java/org/ss/generators/table/HTMLProcessingContext.java
|
f87eda0da601f25def3443dac49bd741ee776eb2
|
[] |
no_license
|
shyamsivaraman/TreeRenderingPatterns
|
https://github.com/shyamsivaraman/TreeRenderingPatterns
|
b1959651b1a2edafbdfe68151d98d403106752de
|
7685d3785319eaee63cac8c1ec9d60f38136d820
|
refs/heads/master
| 2020-03-23T17:46:26.230000 | 2018-07-22T07:23:19 | 2018-07-22T07:23:19 | 141,873,652 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.ss.generators.table;
import java.util.HashMap;
public class HTMLProcessingContext {
public enum PROVIDER {LINK_CONFIG_PROVIDER, CSS_CONFIG_PROVIDER};
private HashMap<String, Object> m_EnvMap = new HashMap<String, Object>();
private HashMap<PROVIDER, Provider_I> m_Providers = new HashMap<PROVIDER, Provider_I>();
public <T> T getProvider(PROVIDER providerType, T clazz) {
return (T)m_Providers.get(providerType);
}
public void addProvider(PROVIDER providerType, Provider_I provider) {
m_Providers.put(providerType, provider);
}
public void addEnvObject(String envId, Object envObj) {
this.m_EnvMap.put(envId, envObj);
}
public Object getEnvObject(String envId) {
return this.m_EnvMap.get(envId);
}
public static interface Provider_I { }
/**
* Dictates which columns to link. The 'how to link' is managed by the LinkProcessor
*/
public static class HTMLLinkConfigProvider implements Provider_I {
private short m_linkedCols = -1;
public HTMLLinkConfigProvider() { }
public void setColsToLink(short linkedCols) {
this.m_linkedCols = linkedCols;
}
public short getColsToLink() {
return this.m_linkedCols;
}
}
public static class HTMLCSSConfigProvider implements Provider_I {
private String m_Value;
public HTMLCSSConfigProvider() {}
public HTMLCSSConfigProvider(String val) {
this.m_Value = val;
}
public void print() {
System.out.println("CSS config provider => " + this.m_Value);
}
}
public static void main(String[] args) {
HTMLProcessingContext hpc = new HTMLProcessingContext();
hpc.addProvider(PROVIDER.LINK_CONFIG_PROVIDER, null);
hpc.addProvider(PROVIDER.CSS_CONFIG_PROVIDER, null);
hpc.getProvider(PROVIDER.LINK_CONFIG_PROVIDER, new HTMLLinkConfigProvider());
}
}
|
UTF-8
|
Java
| 1,791 |
java
|
HTMLProcessingContext.java
|
Java
|
[] | null |
[] |
package org.ss.generators.table;
import java.util.HashMap;
public class HTMLProcessingContext {
public enum PROVIDER {LINK_CONFIG_PROVIDER, CSS_CONFIG_PROVIDER};
private HashMap<String, Object> m_EnvMap = new HashMap<String, Object>();
private HashMap<PROVIDER, Provider_I> m_Providers = new HashMap<PROVIDER, Provider_I>();
public <T> T getProvider(PROVIDER providerType, T clazz) {
return (T)m_Providers.get(providerType);
}
public void addProvider(PROVIDER providerType, Provider_I provider) {
m_Providers.put(providerType, provider);
}
public void addEnvObject(String envId, Object envObj) {
this.m_EnvMap.put(envId, envObj);
}
public Object getEnvObject(String envId) {
return this.m_EnvMap.get(envId);
}
public static interface Provider_I { }
/**
* Dictates which columns to link. The 'how to link' is managed by the LinkProcessor
*/
public static class HTMLLinkConfigProvider implements Provider_I {
private short m_linkedCols = -1;
public HTMLLinkConfigProvider() { }
public void setColsToLink(short linkedCols) {
this.m_linkedCols = linkedCols;
}
public short getColsToLink() {
return this.m_linkedCols;
}
}
public static class HTMLCSSConfigProvider implements Provider_I {
private String m_Value;
public HTMLCSSConfigProvider() {}
public HTMLCSSConfigProvider(String val) {
this.m_Value = val;
}
public void print() {
System.out.println("CSS config provider => " + this.m_Value);
}
}
public static void main(String[] args) {
HTMLProcessingContext hpc = new HTMLProcessingContext();
hpc.addProvider(PROVIDER.LINK_CONFIG_PROVIDER, null);
hpc.addProvider(PROVIDER.CSS_CONFIG_PROVIDER, null);
hpc.getProvider(PROVIDER.LINK_CONFIG_PROVIDER, new HTMLLinkConfigProvider());
}
}
| 1,791 | 0.72976 | 0.729202 | 66 | 26.136364 | 26.520939 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.863636 | false | false |
13
|
949b0db3580e0ff8acaba3a4e04ad7967fd582f4
| 32,298,154,096,863 |
35d6fee8edb0661d4b9fe663994bbbccf752048c
|
/src/main/java/com/gwt/sample/server/model/MessageCategory.java
|
713e3d813e1e17c25cf29b22b68d3032cb8d296c
|
[] |
no_license
|
red1orchid/GwtTest
|
https://github.com/red1orchid/GwtTest
|
5dc4799a1ff8215354ef91f93e8f168b7ece666e
|
6995c778c10697bfeda2964d93f0c5d6d44e57c0
|
refs/heads/master
| 2020-07-02T11:58:01.700000 | 2016-11-22T16:26:50 | 2016-11-22T16:26:50 | 74,306,132 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.gwt.sample.server.model;
import org.codehaus.jackson.annotate.JsonAutoDetect;
import javax.persistence.*;
/**
* Created by PerevalovaMA on 22.11.2016.
*/
@Entity
@Table(name="message_categories")
public class MessageCategory {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;
private String name;
public Integer getId() {
return id;
}
public String getName() {
return name;
}
}
|
UTF-8
|
Java
| 469 |
java
|
MessageCategory.java
|
Java
|
[
{
"context": "t;\n\nimport javax.persistence.*;\n\n/**\n * Created by PerevalovaMA on 22.11.2016.\n */\n@Entity\n@Table(name=\"message_c",
"end": 151,
"score": 0.9960439801216125,
"start": 139,
"tag": "USERNAME",
"value": "PerevalovaMA"
}
] | null |
[] |
package com.gwt.sample.server.model;
import org.codehaus.jackson.annotate.JsonAutoDetect;
import javax.persistence.*;
/**
* Created by PerevalovaMA on 22.11.2016.
*/
@Entity
@Table(name="message_categories")
public class MessageCategory {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;
private String name;
public Integer getId() {
return id;
}
public String getName() {
return name;
}
}
| 469 | 0.675906 | 0.658849 | 26 | 17.038462 | 16.493544 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.269231 | false | false |
13
|
65ee0878f4296fd5d6400cab48311b681f2e3f82
| 32,298,154,095,969 |
4fc7a3e39efad6e758d7efad421983066eaab900
|
/UsabilityToolkit/HipsterbilityClientFX/test/de/hsosnabrueck/hipsterbility/clientfx/rest/RestClientHelperTest.java
|
d6f71a9fff3aaabbe1c20a661bb5ca5e8ed2b0e5
|
[
"MIT"
] |
permissive
|
Chromdioxyde/hipsterbility
|
https://github.com/Chromdioxyde/hipsterbility
|
601ea43bbc02749ddc25d6c73ca8b31050521012
|
3f006a7e59085f8a195f21691f2a6b91b72ad49e
|
refs/heads/master
| 2020-12-31T05:24:35.030000 | 2014-11-11T17:51:43 | 2014-11-11T17:51:43 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package de.hsosnabrueck.hipsterbility.clientfx.rest;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import de.hsosnabrueck.hipsterbility.clientfx.Settings;
import de.hsosnabrueck.hipsterbility.clientfx.model.TestSession;
import de.hsosnabrueck.hipsterbility.clientfx.model.files.AudioFile;
import org.junit.Before;
import org.junit.Test;
import javax.ws.rs.client.Entity;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.io.File;
import java.io.IOException;
import java.util.Date;
public class RestClientHelperTest {
RestClientHelper clientHelper;
@Before
public void init(){
clientHelper = new RestClientHelper();
Settings settings = new Settings();
settings.init();
settings.setServer("localhost");
settings.setPort(8080);
settings.setUser("admin");
settings.setPassword("test123");
clientHelper.settings = settings;
try {
clientHelper.checkLogin();
} catch (Exception e) {
e.printStackTrace();
}
}
@Test
public void testClientConnection(){
RestClientHelper client = new RestClientHelper();
// client.init();
}
@Test
public void testPingServer(){
RestClientHelper client = new RestClientHelper();
try {
// assertTrue(client.pingServer("localhost", 8080));
// assertFalse(client.pingServer("localhost", 80));
} catch (Exception e) {
e.printStackTrace();
}
}
@Test
public void fileUpload(){
System.out.println("fileUpload");
File file = new File("test" + File.separator +"testimg.jpg");
System.out.println(file.getAbsolutePath());
try {
System.out.println(file.getCanonicalPath());
System.out.println(file.getFreeSpace());
System.out.println(file.length());
} catch (IOException e) {
e.printStackTrace();
}
System.out.println(file.getPath());
AudioFile audio = new AudioFile();
audio.setType(AudioFile.Type.MICROPHONE);
audio.setTimestamp(new Date());
audio.setFile(file);
TestSession session = new TestSession();
session.setName("test");
try {
System.out.println(clientHelper.checkLogin());
} catch (Exception e) {
e.printStackTrace();
}
ObjectMapper mapper = new ObjectMapper();
try {
System.out.println(mapper.writeValueAsString(session));
System.out.println(mapper.writeValueAsString(audio));
} catch (JsonProcessingException e) {
e.printStackTrace();
}
System.out.println(Entity.json(session));
Response response = clientHelper.getTarget().path("sessions").request(MediaType.APPLICATION_JSON).post(Entity.json(session));
System.out.println(response);
Response r = clientHelper.getTarget().path("sessions").path("1").path("audios").request().post(Entity.json(audio));
System.out.println(r);
}
// @Test
// public void testCreateTest(){
// System.out.println("testCreateTest");
// de.hsosnabrueck.hipsterbility.clientfx.model.Test test = TestObjectFactory.getTestEntity();
// Response r = clientHelper.getTarget().path("tests").request().post(Entity.json(test));
// System.out.println(r);
// }
//
// @Test
// public void createTestWithTasks(){
// System.out.println("createTestWithTasks");
// TestEntity test = TestObjectFactory.getTestEntity();
// test.setTasks(new ArrayList<>());
// for(int i = 0 ; i<10 ;i++) {
// TaskEntity taskEntity = TestObjectFactory.getTaskEntity();
// taskEntity.setOrderNr(i);
// taskEntity.setTest(test);
// test.getTasks().add(taskEntity);
// }
// Response r = clientHelper.getTarget().path("tests").request().post(Entity.json(test));
// System.out.println(r);
// }
}
|
UTF-8
|
Java
| 4,099 |
java
|
RestClientHelperTest.java
|
Java
|
[
{
"context": "s.setUser(\"admin\");\n settings.setPassword(\"test123\");\n clientHelper.settings = settings;\n ",
"end": 950,
"score": 0.9992092251777649,
"start": 943,
"tag": "PASSWORD",
"value": "test123"
},
{
"context": "ion = new TestSession();\n session.setName(\"test\");\n try {\n System.out.println(c",
"end": 2332,
"score": 0.9983274936676025,
"start": 2328,
"tag": "USERNAME",
"value": "test"
}
] | null |
[] |
package de.hsosnabrueck.hipsterbility.clientfx.rest;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import de.hsosnabrueck.hipsterbility.clientfx.Settings;
import de.hsosnabrueck.hipsterbility.clientfx.model.TestSession;
import de.hsosnabrueck.hipsterbility.clientfx.model.files.AudioFile;
import org.junit.Before;
import org.junit.Test;
import javax.ws.rs.client.Entity;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.io.File;
import java.io.IOException;
import java.util.Date;
public class RestClientHelperTest {
RestClientHelper clientHelper;
@Before
public void init(){
clientHelper = new RestClientHelper();
Settings settings = new Settings();
settings.init();
settings.setServer("localhost");
settings.setPort(8080);
settings.setUser("admin");
settings.setPassword("<PASSWORD>");
clientHelper.settings = settings;
try {
clientHelper.checkLogin();
} catch (Exception e) {
e.printStackTrace();
}
}
@Test
public void testClientConnection(){
RestClientHelper client = new RestClientHelper();
// client.init();
}
@Test
public void testPingServer(){
RestClientHelper client = new RestClientHelper();
try {
// assertTrue(client.pingServer("localhost", 8080));
// assertFalse(client.pingServer("localhost", 80));
} catch (Exception e) {
e.printStackTrace();
}
}
@Test
public void fileUpload(){
System.out.println("fileUpload");
File file = new File("test" + File.separator +"testimg.jpg");
System.out.println(file.getAbsolutePath());
try {
System.out.println(file.getCanonicalPath());
System.out.println(file.getFreeSpace());
System.out.println(file.length());
} catch (IOException e) {
e.printStackTrace();
}
System.out.println(file.getPath());
AudioFile audio = new AudioFile();
audio.setType(AudioFile.Type.MICROPHONE);
audio.setTimestamp(new Date());
audio.setFile(file);
TestSession session = new TestSession();
session.setName("test");
try {
System.out.println(clientHelper.checkLogin());
} catch (Exception e) {
e.printStackTrace();
}
ObjectMapper mapper = new ObjectMapper();
try {
System.out.println(mapper.writeValueAsString(session));
System.out.println(mapper.writeValueAsString(audio));
} catch (JsonProcessingException e) {
e.printStackTrace();
}
System.out.println(Entity.json(session));
Response response = clientHelper.getTarget().path("sessions").request(MediaType.APPLICATION_JSON).post(Entity.json(session));
System.out.println(response);
Response r = clientHelper.getTarget().path("sessions").path("1").path("audios").request().post(Entity.json(audio));
System.out.println(r);
}
// @Test
// public void testCreateTest(){
// System.out.println("testCreateTest");
// de.hsosnabrueck.hipsterbility.clientfx.model.Test test = TestObjectFactory.getTestEntity();
// Response r = clientHelper.getTarget().path("tests").request().post(Entity.json(test));
// System.out.println(r);
// }
//
// @Test
// public void createTestWithTasks(){
// System.out.println("createTestWithTasks");
// TestEntity test = TestObjectFactory.getTestEntity();
// test.setTasks(new ArrayList<>());
// for(int i = 0 ; i<10 ;i++) {
// TaskEntity taskEntity = TestObjectFactory.getTaskEntity();
// taskEntity.setOrderNr(i);
// taskEntity.setTest(test);
// test.getTasks().add(taskEntity);
// }
// Response r = clientHelper.getTarget().path("tests").request().post(Entity.json(test));
// System.out.println(r);
// }
}
| 4,102 | 0.628446 | 0.624299 | 118 | 33.745762 | 25.392574 | 133 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.618644 | false | false |
13
|
503ed1ba0093f4f37ee3534c5133f65e988d0476
| 25,323,127,197,247 |
38756bae6e6243d7d1057490832073b6d516c254
|
/Java/MongoTodo/src/main/java/com/mug/todo/TodoItemControler.java
|
1e53cf6744711e7f1c86ac5e11237771e9903593
|
[] |
no_license
|
rkaszczuk/MUG
|
https://github.com/rkaszczuk/MUG
|
f2823f430a5181710f2c9ddef02143d1b7b223fb
|
42a95fc112256ed067c288f60a1bf261ef4de962
|
refs/heads/master
| 2021-01-01T05:37:19.176000 | 2014-11-21T12:17:49 | 2014-11-21T12:17:49 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.mug.todo;
import java.util.*;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.View;
@Controller
public class TodoItemControler {
@Autowired
private TodoItemDAO todoItems;
@RequestMapping(value = "/", method = RequestMethod.GET)
public String index()
{
return "redirect:/items";
}
@RequestMapping(value = "/items", method = RequestMethod.GET)
public String items(ModelMap model)
{
List<TodoItem> result = todoItems.getAll();
model.addAttribute("items",result);
return "/itemlist";
}
@RequestMapping(value = "/itemsbystatus/{status}", method = RequestMethod.GET)
public String getItemByStatus(@PathVariable("status") int status, ModelMap model)
{
List<TodoItem> result = todoItems.getByStatus(status==1?true:false);
model.addAttribute("items",result);
return "/itemlist";
}
@RequestMapping(value = "/changestatus/{item_id}", method = RequestMethod.GET)
public String updateStatus(@PathVariable("item_id") String itemId, ModelMap model)
{
todoItems.changeStatusDone(itemId);
return "redirect:/items";
}
@RequestMapping(value = "/delete/{item_id}", method = RequestMethod.GET)
public String deleteItem(@PathVariable("item_id") String itemId, ModelMap model)
{
todoItems.delete(itemId);
return "redirect:/items";
}
@RequestMapping(value = "/newitem", method = RequestMethod.GET)
public String getCreateItem()
{
return "/newitem";
}
@RequestMapping(value = "/newitem", method = RequestMethod.POST)
public String postCreateItem(HttpServletRequest request,@RequestParam(value="title", required=false) String title,
@RequestParam(value="tags", required=false) String tags )
{
TodoItem item = new TodoItem();
item.setTitle(title);
item.setTags(Arrays.asList(tags.split("\\s*,\\s*")));
todoItems.insert(item);
return "redirect:/items";
}
}
|
UTF-8
|
Java
| 2,369 |
java
|
TodoItemControler.java
|
Java
|
[] | null |
[] |
package com.mug.todo;
import java.util.*;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.View;
@Controller
public class TodoItemControler {
@Autowired
private TodoItemDAO todoItems;
@RequestMapping(value = "/", method = RequestMethod.GET)
public String index()
{
return "redirect:/items";
}
@RequestMapping(value = "/items", method = RequestMethod.GET)
public String items(ModelMap model)
{
List<TodoItem> result = todoItems.getAll();
model.addAttribute("items",result);
return "/itemlist";
}
@RequestMapping(value = "/itemsbystatus/{status}", method = RequestMethod.GET)
public String getItemByStatus(@PathVariable("status") int status, ModelMap model)
{
List<TodoItem> result = todoItems.getByStatus(status==1?true:false);
model.addAttribute("items",result);
return "/itemlist";
}
@RequestMapping(value = "/changestatus/{item_id}", method = RequestMethod.GET)
public String updateStatus(@PathVariable("item_id") String itemId, ModelMap model)
{
todoItems.changeStatusDone(itemId);
return "redirect:/items";
}
@RequestMapping(value = "/delete/{item_id}", method = RequestMethod.GET)
public String deleteItem(@PathVariable("item_id") String itemId, ModelMap model)
{
todoItems.delete(itemId);
return "redirect:/items";
}
@RequestMapping(value = "/newitem", method = RequestMethod.GET)
public String getCreateItem()
{
return "/newitem";
}
@RequestMapping(value = "/newitem", method = RequestMethod.POST)
public String postCreateItem(HttpServletRequest request,@RequestParam(value="title", required=false) String title,
@RequestParam(value="tags", required=false) String tags )
{
TodoItem item = new TodoItem();
item.setTitle(title);
item.setTags(Arrays.asList(tags.split("\\s*,\\s*")));
todoItems.insert(item);
return "redirect:/items";
}
}
| 2,369 | 0.742507 | 0.742085 | 66 | 34.89394 | 28.030355 | 117 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.712121 | false | false |
13
|
6afd6ff15370d9ad2bb9df3fe166a171a1c282d4
| 12,695,923,364,911 |
587524dd489dde9e8adfe2eac02dcb31e3fd0feb
|
/main/java/com/example/levi_/vestibulapp30/Teoria/GeografiaT.java
|
6a84b1d8fce0de3647eb086cf69e5bbfd2bc9620
|
[] |
no_license
|
LeviUSP/Vestibulapp
|
https://github.com/LeviUSP/Vestibulapp
|
03bb84bbc15c2c79a64b960a92960d081c9d6030
|
a904746ad08eac507ec2478910bcab373bba1d9f
|
refs/heads/master
| 2018-07-04T05:14:55.942000 | 2018-05-31T23:11:56 | 2018-05-31T23:11:56 | 135,364,996 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.levi_.vestibulapp30.Teoria;
import android.app.ActivityOptions;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import com.example.levi_.vestibulapp30.R;
public class GeografiaT extends AppCompatActivity {
long animationDuration = 1000; //miliseconds
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_geografia_t);
getSupportActionBar().setTitle("Geografia");
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
final Button geografiabr_Questoes = (Button) findViewById(R.id.button_geografiabr_questoes);
Button geografiabr_Teoria = (Button) findViewById(R.id.button_geografiabr_teoria);
Button geografiageral_Questoes = (Button) findViewById(R.id.button_geografiageral_questoes);
Button geografiageral_Teoria = (Button) findViewById(R.id.button_geografiageral_teoria);
Button geopolitica_Questoes = (Button) findViewById(R.id.button_geopolitica_questoes);
Button geopolitica_Teoria = (Button) findViewById(R.id.button_geopolitica_teoria);
geografiabr_Teoria.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent geografiabrt = new Intent(GeografiaT.this, geografia_brasileira_teoria.class);
Bundle scaleBundle = ActivityOptions.makeScaleUpAnimation(v,0,0,v.getWidth(),v.getHeight()).toBundle();
startActivity(geografiabrt, scaleBundle);
}
});
geografiageral_Teoria.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent geografiageralt = new Intent(GeografiaT.this,geografia_geral_teoria.class);
Bundle scaleBundle = ActivityOptions.makeScaleUpAnimation(v,0,0,v.getWidth(),v.getHeight()).toBundle();
startActivity(geografiageralt, scaleBundle);
}
});
geopolitica_Teoria.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent geopoliticat = new Intent(GeografiaT.this, geopolitica_teoria.class);
Bundle scaleBundle= ActivityOptions.makeScaleUpAnimation(v,0,0,v.getWidth(),v.getHeight()).toBundle();
startActivity(geopoliticat, scaleBundle);
}
});
}
}
|
UTF-8
|
Java
| 2,597 |
java
|
GeografiaT.java
|
Java
|
[] | null |
[] |
package com.example.levi_.vestibulapp30.Teoria;
import android.app.ActivityOptions;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import com.example.levi_.vestibulapp30.R;
public class GeografiaT extends AppCompatActivity {
long animationDuration = 1000; //miliseconds
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_geografia_t);
getSupportActionBar().setTitle("Geografia");
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
final Button geografiabr_Questoes = (Button) findViewById(R.id.button_geografiabr_questoes);
Button geografiabr_Teoria = (Button) findViewById(R.id.button_geografiabr_teoria);
Button geografiageral_Questoes = (Button) findViewById(R.id.button_geografiageral_questoes);
Button geografiageral_Teoria = (Button) findViewById(R.id.button_geografiageral_teoria);
Button geopolitica_Questoes = (Button) findViewById(R.id.button_geopolitica_questoes);
Button geopolitica_Teoria = (Button) findViewById(R.id.button_geopolitica_teoria);
geografiabr_Teoria.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent geografiabrt = new Intent(GeografiaT.this, geografia_brasileira_teoria.class);
Bundle scaleBundle = ActivityOptions.makeScaleUpAnimation(v,0,0,v.getWidth(),v.getHeight()).toBundle();
startActivity(geografiabrt, scaleBundle);
}
});
geografiageral_Teoria.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent geografiageralt = new Intent(GeografiaT.this,geografia_geral_teoria.class);
Bundle scaleBundle = ActivityOptions.makeScaleUpAnimation(v,0,0,v.getWidth(),v.getHeight()).toBundle();
startActivity(geografiageralt, scaleBundle);
}
});
geopolitica_Teoria.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent geopoliticat = new Intent(GeografiaT.this, geopolitica_teoria.class);
Bundle scaleBundle= ActivityOptions.makeScaleUpAnimation(v,0,0,v.getWidth(),v.getHeight()).toBundle();
startActivity(geopoliticat, scaleBundle);
}
});
}
}
| 2,597 | 0.686561 | 0.680786 | 58 | 43.775864 | 36.623455 | 119 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.844828 | false | false |
13
|
c2fe958dcaf6f4b804a6bdca9a0f99bed620d19c
| 5,901,285,111,060 |
567691b12d9da3410642ade87c7bb95c7312ebde
|
/3_MessageQueues_Pipes_Filters/Message.java
|
5bd0b496cc35840ac2c00a2c389975934f47d63f
|
[] |
no_license
|
LYecheng/OO-Architecture
|
https://github.com/LYecheng/OO-Architecture
|
2035059f8d02ee8c9e993a0a12482a011a9a2a32
|
fdb46b6d4eb8502b91cd681f36c604f84cc670c1
|
refs/heads/master
| 2021-01-18T01:45:26.029000 | 2015-06-14T02:12:02 | 2015-06-14T02:12:02 | 34,556,849 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
* Created by LiYecheng on 04/25/15.
*/
public abstract class Message {
abstract String getHeader();
abstract String getBody();
abstract int getID();
abstract void print();
}
|
UTF-8
|
Java
| 201 |
java
|
Message.java
|
Java
|
[
{
"context": "/**\n * Created by LiYecheng on 04/25/15.\n */\n\npublic abstract class Message {",
"end": 27,
"score": 0.9993696808815002,
"start": 18,
"tag": "NAME",
"value": "LiYecheng"
}
] | null |
[] |
/**
* Created by LiYecheng on 04/25/15.
*/
public abstract class Message {
abstract String getHeader();
abstract String getBody();
abstract int getID();
abstract void print();
}
| 201 | 0.641791 | 0.61194 | 15 | 12.466666 | 14.536696 | 36 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.266667 | false | false |
13
|
3c6cec7eb254224c91a02d72b7124a498d6adde1
| 3,856,880,680,929 |
f4a3e9d913fa103b4064b33ef8c13531f7eda625
|
/src/main/java/com/lucasguasselli/projetofurriel/domain/Endereco.java
|
a3af6054cfab12929bcf28cc30cd5695e0ecc6b1
|
[] |
no_license
|
LucasGuasselli/back-end-projetofurriel
|
https://github.com/LucasGuasselli/back-end-projetofurriel
|
44b27d66c1f126b8b2bfaa86b8cfe891733f4fec
|
ca65206c8695cddcd950b40d51a3d6757ad16028
|
refs/heads/master
| 2021-07-13T08:00:09.745000 | 2020-07-26T01:59:03 | 2020-07-26T01:59:03 | 182,301,501 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.lucasguasselli.projetofurriel.domain;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import com.fasterxml.jackson.annotation.JsonIgnore;
@Entity
public class Endereco implements Serializable{
// este serialVersion abaixo se faz necessaria por causa do Serializable (padrao java)
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private int id;
private String logradouro;
private String bairro;
private String localidade;
private int numero;
private String complemento;
// conexao com militar
@JsonIgnore
@OneToOne
@JoinColumn(name="militar_id")
private Militar militar;
//a entidade que possui o join colunm que recebe o objeto ao ser instanciada
public Endereco() {
}
public Endereco(int id) {
this.id = id;
}
public Endereco(String logradouro, String bairro, String localidade, int numero, String complemento) {
super();
this.logradouro = logradouro;
this.bairro = bairro;
this.localidade = localidade;
this.numero = numero;
this.complemento = complemento;
}
public Endereco(String logradouro, String bairro, String localidade, int numero, String complemento, Militar militar) {
super();
this.logradouro = logradouro;
this.bairro = bairro;
this.localidade = localidade;
this.numero = numero;
this.complemento = complemento;
this.militar = militar;
}
public Militar getMilitar() {
return militar;
}
public void setMilitar(Militar militar) {
this.militar = militar;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getLogradouro() {
return logradouro;
}
public void setLogradouro(String logradouro) {
this.logradouro = logradouro;
}
public String getBairro() {
return bairro;
}
public void setBairro(String bairro) {
this.bairro = bairro;
}
public String getLocalidade() {
return localidade;
}
public void setLocalidade(String localidade) {
this.localidade = localidade;
}
public int getNumero() {
return numero;
}
public void setNumero(int numero) {
this.numero = numero;
}
public String getComplemento() {
return complemento;
}
public void setComplemento(String complemento) {
this.complemento = complemento;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + id;
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Endereco other = (Endereco) obj;
if (id != other.id)
return false;
return true;
}
@Override
public String toString() {
return "Endereco [id=" + id + ", logradouro=" + logradouro + ", bairro=" + bairro + ", localidade=" + localidade + ", numero="
+ numero + ", complemento=" + complemento + ", militar=" + militar + "]";
}
}
|
UTF-8
|
Java
| 3,113 |
java
|
Endereco.java
|
Java
|
[
{
"context": "package com.lucasguasselli.projetofurriel.domain;\n\nimport java.io.Serializab",
"end": 26,
"score": 0.9445245265960693,
"start": 12,
"tag": "USERNAME",
"value": "lucasguasselli"
}
] | null |
[] |
package com.lucasguasselli.projetofurriel.domain;
import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import com.fasterxml.jackson.annotation.JsonIgnore;
@Entity
public class Endereco implements Serializable{
// este serialVersion abaixo se faz necessaria por causa do Serializable (padrao java)
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
private int id;
private String logradouro;
private String bairro;
private String localidade;
private int numero;
private String complemento;
// conexao com militar
@JsonIgnore
@OneToOne
@JoinColumn(name="militar_id")
private Militar militar;
//a entidade que possui o join colunm que recebe o objeto ao ser instanciada
public Endereco() {
}
public Endereco(int id) {
this.id = id;
}
public Endereco(String logradouro, String bairro, String localidade, int numero, String complemento) {
super();
this.logradouro = logradouro;
this.bairro = bairro;
this.localidade = localidade;
this.numero = numero;
this.complemento = complemento;
}
public Endereco(String logradouro, String bairro, String localidade, int numero, String complemento, Militar militar) {
super();
this.logradouro = logradouro;
this.bairro = bairro;
this.localidade = localidade;
this.numero = numero;
this.complemento = complemento;
this.militar = militar;
}
public Militar getMilitar() {
return militar;
}
public void setMilitar(Militar militar) {
this.militar = militar;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getLogradouro() {
return logradouro;
}
public void setLogradouro(String logradouro) {
this.logradouro = logradouro;
}
public String getBairro() {
return bairro;
}
public void setBairro(String bairro) {
this.bairro = bairro;
}
public String getLocalidade() {
return localidade;
}
public void setLocalidade(String localidade) {
this.localidade = localidade;
}
public int getNumero() {
return numero;
}
public void setNumero(int numero) {
this.numero = numero;
}
public String getComplemento() {
return complemento;
}
public void setComplemento(String complemento) {
this.complemento = complemento;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + id;
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
Endereco other = (Endereco) obj;
if (id != other.id)
return false;
return true;
}
@Override
public String toString() {
return "Endereco [id=" + id + ", logradouro=" + logradouro + ", bairro=" + bairro + ", localidade=" + localidade + ", numero="
+ numero + ", complemento=" + complemento + ", militar=" + militar + "]";
}
}
| 3,113 | 0.713781 | 0.712496 | 138 | 21.557972 | 22.230028 | 128 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.731884 | false | false |
13
|
f269506fcfa7108e6b8f745caf735c3d33460c86
| 20,504,173,912,159 |
3996c5e03f5ffc18315553ec442bd841f3364482
|
/app/src/main/java/com/example/viewpagertimer/MyFragment.java
|
cef48583ae997b38a88a306338c888cc8e15c340
|
[] |
no_license
|
mosayeb-masoumi/SliderViewpagerTimer
|
https://github.com/mosayeb-masoumi/SliderViewpagerTimer
|
da884a74436c40d450410b323974f7c475227de3
|
cb9243bfdc5601923dcf481699a2c555cfc10568
|
refs/heads/master
| 2023-08-20T15:41:57.881000 | 2021-09-04T07:44:42 | 2021-09-04T07:44:42 | 381,674,765 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.viewpagertimer;
import android.graphics.Color;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import static android.content.ContentValues.TAG;
public class MyFragment extends Fragment {
TextView txt_fragment;
RelativeLayout root;
Button btn;
int position;
public MyFragment() {
// Required empty public constructor
}
public static MyFragment newInstance(int position) {
MyFragment fragment = new MyFragment();
fragment.position = position;
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_my, container, false);
txt_fragment = view.findViewById(R.id.txt_fragment);
root = view.findViewById(R.id.root);
btn = view.findViewById(R.id.btn);
txt_fragment.setText("fragment " + position);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (position % 2 == 0) {
Toast.makeText(getContext(), "fragment "+position + "selected" +" even", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getContext(), "fragment "+position + "selected" +" odd", Toast.LENGTH_SHORT).show();
}
}
});
if (position % 2 == 0) {
root.setBackgroundColor(Color.BLUE);
} else {
root.setBackgroundColor(Color.RED);
}
return view;
}
}
|
UTF-8
|
Java
| 2,035 |
java
|
MyFragment.java
|
Java
|
[] | null |
[] |
package com.example.viewpagertimer;
import android.graphics.Color;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
import static android.content.ContentValues.TAG;
public class MyFragment extends Fragment {
TextView txt_fragment;
RelativeLayout root;
Button btn;
int position;
public MyFragment() {
// Required empty public constructor
}
public static MyFragment newInstance(int position) {
MyFragment fragment = new MyFragment();
fragment.position = position;
return fragment;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_my, container, false);
txt_fragment = view.findViewById(R.id.txt_fragment);
root = view.findViewById(R.id.root);
btn = view.findViewById(R.id.btn);
txt_fragment.setText("fragment " + position);
btn.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (position % 2 == 0) {
Toast.makeText(getContext(), "fragment "+position + "selected" +" even", Toast.LENGTH_SHORT).show();
} else {
Toast.makeText(getContext(), "fragment "+position + "selected" +" odd", Toast.LENGTH_SHORT).show();
}
}
});
if (position % 2 == 0) {
root.setBackgroundColor(Color.BLUE);
} else {
root.setBackgroundColor(Color.RED);
}
return view;
}
}
| 2,035 | 0.63145 | 0.629484 | 79 | 24.772152 | 25.543682 | 120 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.506329 | false | false |
13
|
aba24ea40a6518b5f8fa107f41d0aa0f14a30216
| 5,025,111,740,085 |
542f7a91eba50f634158eaca6840c2dd3cbc921c
|
/on-line-video-service-user/src/main/java/com/video/user/bean/meta/UserOperationType.java
|
9580824ab315457b3c1864501725d7140a549b70
|
[] |
no_license
|
LuisRain/on-line-video
|
https://github.com/LuisRain/on-line-video
|
a640bdff0cf3f08eb9871565b0d97560213f01e7
|
bb46c85ee21a713fbadffc1699a03e9485967c88
|
refs/heads/master
| 2020-04-03T06:52:52.900000 | 2018-09-14T11:49:24 | 2018-09-14T11:49:24 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.video.user.bean.meta;
/**
* @author: master
* @date: 2018/7/22
*/
public enum UserOperationType {
/**
* 登录成功
*/
LOGIN_SUCCEED,
/**
* 登录失败
*/
LOGIN_BUST,
/**
* 登出成功
*/
LOGOUT_SUCCEED,
/**
* 登出失败
*/
LOGOUT_BUST;
}
|
UTF-8
|
Java
| 333 |
java
|
UserOperationType.java
|
Java
|
[
{
"context": "package com.video.user.bean.meta;\n\n/**\n * @author: master\n * @date: 2018/7/22\n */\npublic enum UserOperation",
"end": 57,
"score": 0.9989012479782104,
"start": 51,
"tag": "USERNAME",
"value": "master"
}
] | null |
[] |
package com.video.user.bean.meta;
/**
* @author: master
* @date: 2018/7/22
*/
public enum UserOperationType {
/**
* 登录成功
*/
LOGIN_SUCCEED,
/**
* 登录失败
*/
LOGIN_BUST,
/**
* 登出成功
*/
LOGOUT_SUCCEED,
/**
* 登出失败
*/
LOGOUT_BUST;
}
| 333 | 0.45515 | 0.431894 | 25 | 11.04 | 8.364114 | 33 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | false | false |
13
|
e67d7b9e51e3339b70df17463f9e4d00c9aca246
| 30,425,548,372,280 |
5d220de1fde8a976208583ed682dfd34cf2efe60
|
/src/Multi-Threading/CurrentThreadDemo.java
|
fad5607f17ab12d70c5b665acc289a1566f7c419
|
[] |
no_license
|
prasadbidwai/DataStructures-Algorithms
|
https://github.com/prasadbidwai/DataStructures-Algorithms
|
8ecbe2f04b7ef5128b28c12cd1e0c86840c8f1e3
|
6300469b8bbe1f6b9259aff5e4b11319ff944265
|
refs/heads/master
| 2022-03-12T04:34:53.555000 | 2019-10-20T15:05:45 | 2019-10-20T15:05:45 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
// code to demonstrate the main thread (using current thread)
class CurrentThreadDemo
{
public static void main(String args[]) {
Thread t = Thread.currentThread();
System.out.println("Current thread: " + t);
// change the name of the thread
t.setName("My Thread");
System.out.println("After name change: " + t);
try {
for(int n = 5; n > 0; n--)
{
System.out.println(n);
Thread.sleep(1000);
}
} catch (InterruptedException e)
{
System.out.println("Main thread interrupted");
}
}
}
/*
Output:
c:\Data Structures\Multi-Threading>java CurrentThreadDemo
Current thread: Thread[main,5,main]
After name change: Thread[My Thread,5,main]
5
4
3
2
1
*/
|
UTF-8
|
Java
| 720 |
java
|
CurrentThreadDemo.java
|
Java
|
[
{
"context": ";\r\n\t// change the name of the thread\r\n\tt.setName(\"My Thread\");\r\n\t\r\n\tSystem.out.println(\"After name change: \" ",
"end": 282,
"score": 0.722271740436554,
"start": 273,
"tag": "USERNAME",
"value": "My Thread"
}
] | null |
[] |
// code to demonstrate the main thread (using current thread)
class CurrentThreadDemo
{
public static void main(String args[]) {
Thread t = Thread.currentThread();
System.out.println("Current thread: " + t);
// change the name of the thread
t.setName("My Thread");
System.out.println("After name change: " + t);
try {
for(int n = 5; n > 0; n--)
{
System.out.println(n);
Thread.sleep(1000);
}
} catch (InterruptedException e)
{
System.out.println("Main thread interrupted");
}
}
}
/*
Output:
c:\Data Structures\Multi-Threading>java CurrentThreadDemo
Current thread: Thread[main,5,main]
After name change: Thread[My Thread,5,main]
5
4
3
2
1
*/
| 720 | 0.638889 | 0.620833 | 40 | 16.049999 | 19.010458 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.95 | false | false |
13
|
2cfea72b7219ca7ebbdeb0e7439e5b52ce7b583d
| 1,022,202,241,512 |
9942a1c2c028768483b01d495bba5f8805ac0449
|
/vo/src/main/java/com/qzdsoft/eshop/vo/goods/pc/GoodsQuestionInfo.java
|
1a1353ef5d7468d71038ef069afd14b6cb182a8e
|
[] |
no_license
|
Ysheep/yihuicloud
|
https://github.com/Ysheep/yihuicloud
|
8f16b3045ff40d29b66735d3d86cd9ce2706ce92
|
fcb703a7b583e22b0edbcda2289c488c8923f73b
|
refs/heads/master
| 2021-05-02T02:03:49.283000 | 2018-02-09T08:45:37 | 2018-02-09T08:45:37 | 120,878,581 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.qzdsoft.eshop.vo.goods.pc;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
public class GoodsQuestionInfo {
private Integer questionId;
private String userName;
private String content;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private String ctime;
private List<GoodsAnswerInfo> answer;
private Integer count;
public Integer getCount() {
return count;
}
public Integer getQuestionId() {
return questionId;
}
public void setQuestionId(Integer questionId) {
this.questionId = questionId;
}
public String getUserName() {
return userName.substring(0, 1)+"***"+userName.substring(userName.length()-1, userName.length());
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getCtime() {
return ctime;
}
public void setCtime(String ctime) {
this.ctime = ctime;
}
public List<GoodsAnswerInfo> getAnswer() {
return answer;
}
public void setAnswer(List<GoodsAnswerInfo> answer) {
this.count = answer.size();
this.answer = answer;
}
}
|
UTF-8
|
Java
| 1,220 |
java
|
GoodsQuestionInfo.java
|
Java
|
[
{
"context": "d setUserName(String userName) {\n\t\tthis.userName = userName;\n\t}\n\n\tpublic String getContent() {\n\t\treturn conte",
"end": 795,
"score": 0.8751609325408936,
"start": 787,
"tag": "USERNAME",
"value": "userName"
}
] | null |
[] |
package com.qzdsoft.eshop.vo.goods.pc;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat;
public class GoodsQuestionInfo {
private Integer questionId;
private String userName;
private String content;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private String ctime;
private List<GoodsAnswerInfo> answer;
private Integer count;
public Integer getCount() {
return count;
}
public Integer getQuestionId() {
return questionId;
}
public void setQuestionId(Integer questionId) {
this.questionId = questionId;
}
public String getUserName() {
return userName.substring(0, 1)+"***"+userName.substring(userName.length()-1, userName.length());
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getCtime() {
return ctime;
}
public void setCtime(String ctime) {
this.ctime = ctime;
}
public List<GoodsAnswerInfo> getAnswer() {
return answer;
}
public void setAnswer(List<GoodsAnswerInfo> answer) {
this.count = answer.size();
this.answer = answer;
}
}
| 1,220 | 0.713934 | 0.710656 | 69 | 16.68116 | 19.673784 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.246377 | false | false |
13
|
bee25c8d40b37e4a416666eab2fc23b21098a490
| 22,866,405,942,960 |
2d7e5d0edd13e2559dc649da801496590927df6a
|
/mymoneymanager/src/main/java/com/bij/mymoneymanager/model/SingleEntry.java
|
c7c4c01b9b13553d2ed2c9c8a7c142c1d911bfd2
|
[] |
no_license
|
Mecabos/mymoneymanager
|
https://github.com/Mecabos/mymoneymanager
|
710ecab0d264af7e6e917998a263c22d7347d35f
|
8ae7943ea67798d2043ed4ed12e30d094cac6e58
|
refs/heads/master
| 2023-01-31T04:58:16.626000 | 2020-12-13T11:35:29 | 2020-12-13T11:35:29 | 296,287,811 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.bij.mymoneymanager.model;
import com.bij.mymoneymanager.enumeration.SingleEntryType;
import com.fasterxml.jackson.annotation.JsonBackReference;
import lombok.Data;
import javax.persistence.*;
@Entity
public @Data class SingleEntry {
@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
private Integer id ;
private float value ;
@Enumerated(EnumType.STRING)
private SingleEntryType type;
@ManyToOne
@JoinColumn(nullable=false)
//@JsonBackReference
private Category category;
@ManyToOne
@JoinColumn(nullable=false)
//@JsonBackReference
private DayEntry dayEntry;
}
|
UTF-8
|
Java
| 637 |
java
|
SingleEntry.java
|
Java
|
[] | null |
[] |
package com.bij.mymoneymanager.model;
import com.bij.mymoneymanager.enumeration.SingleEntryType;
import com.fasterxml.jackson.annotation.JsonBackReference;
import lombok.Data;
import javax.persistence.*;
@Entity
public @Data class SingleEntry {
@Id
@GeneratedValue(strategy= GenerationType.IDENTITY)
private Integer id ;
private float value ;
@Enumerated(EnumType.STRING)
private SingleEntryType type;
@ManyToOne
@JoinColumn(nullable=false)
//@JsonBackReference
private Category category;
@ManyToOne
@JoinColumn(nullable=false)
//@JsonBackReference
private DayEntry dayEntry;
}
| 637 | 0.751962 | 0.751962 | 25 | 24.48 | 16.521791 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false |
13
|
935a5cc867fa4594e8cf4c497d7fca10b1bde5f8
| 11,570,641,954,873 |
54e2ab64722096dd16ddfb368df727dad2ef903f
|
/src/main/java/com/zhoulin/concurrency/syncContainer/InterTest.java
|
541cc18ba4e685319056455932d14138b721c01e
|
[] |
no_license
|
2817748290/concurrency
|
https://github.com/2817748290/concurrency
|
7a85d704ab14dcbf29b019c4c7c1d5d45aa09c66
|
322272777559bfe2c609d6936511518229f9ac5c
|
refs/heads/master
| 2020-03-16T14:11:33.210000 | 2018-06-02T03:37:49 | 2018-06-02T03:37:49 | 132,710,003 | 4 | 0 | null | false | 2018-06-02T03:37:50 | 2018-05-09T06:11:47 | 2018-05-28T08:29:56 | 2018-06-02T03:37:50 | 44 | 2 | 0 | 0 |
Java
| false | null |
package com.zhoulin.concurrency.syncContainer;
public interface InterTest extends InterfaceTest {
}
|
UTF-8
|
Java
| 101 |
java
|
InterTest.java
|
Java
|
[] | null |
[] |
package com.zhoulin.concurrency.syncContainer;
public interface InterTest extends InterfaceTest {
}
| 101 | 0.841584 | 0.841584 | 4 | 24.25 | 23.794695 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false |
13
|
a9da19ab7d1157742db55cca305cf09491eea9d9
| 11,570,641,955,333 |
0d79ff9f5677a76a16d6df410755a78f0ce93f01
|
/src/main/java/com/ufostudio/crm/common/entity/Result.java
|
9dc61b246a47572134382b777ce0c7a2868f930b
|
[
"Apache-2.0"
] |
permissive
|
masonleung2016/crm
|
https://github.com/masonleung2016/crm
|
2c25717e03565504530ab96271f97cbd611f3ac7
|
424ebe3ccfda0f339b0a6cef108fc868f668c24a
|
refs/heads/master
| 2021-06-21T16:44:07.361000 | 2020-07-11T00:37:55 | 2020-07-11T00:37:55 | 277,424,196 | 1 | 0 |
Apache-2.0
| false | 2021-01-25T13:54:52 | 2020-07-06T02:30:04 | 2020-07-11T00:37:58 | 2021-01-25T13:54:51 | 378 | 1 | 0 | 4 |
Java
| false | false |
package com.ufostudio.crm.common.entity;
import com.google.gson.Gson;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Map;
/**
* 返回数据封装类
*
* @Author: LCF
* @Date: 2020/7/5 17:43
* @Package: com.ufostudio.crm.common.entity
*/
@ApiModel (value = "接口返回对象", description = "")
public class Result<T> implements java.io.Serializable {
/**
* 是否成功标识
*/
@ApiModelProperty (value = "是否成功标识,0为成功", required = true)
private int status = 0;
// 消息
@ApiModelProperty (value = "消息", required = true)
private String msg = "";
// 返回的数据
@ApiModelProperty (value = "返回的数据", required = true)
private T res;
private Map<String, Object> extMap;
public Result() {
}
/**
* 成功直接返回数据
*/
public Result(T res) {
this.res = res;
}
/**
* 成功直接返回数据 带拓展字段
*/
public Result(T res, Map<String, Object> extMap) {
this.res = res;
this.extMap = extMap;
}
public Result(Map<String, Object> extMap) {
this.extMap = extMap;
}
/**
* 错误代码(有额外信息)
*
* @param errorCodeEnum
* @param extendMsg
*/
public Result(ErrorCodeEnum errorCodeEnum, String extendMsg) {
this.status = errorCodeEnum.getStatus();
String wellNumberSign = "#";
this.msg = errorCodeEnum.getMsg() + wellNumberSign + extendMsg;
}
/**
* 错误
*
* @param errorCodeEnum
*/
public Result(ErrorCodeEnum errorCodeEnum) {
this.status = errorCodeEnum.getStatus();
this.msg = errorCodeEnum.getMsg();
}
public Result(int status, String msg) {
this.status = status;
this.msg = msg;
}
public Result(ErrorCodeEnum errorCodeEnum, T res) {
this.status = errorCodeEnum.getStatus();
this.msg = errorCodeEnum.getMsg();
this.res = res;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public T getRes() {
return res;
}
public void setRes(T res) {
this.res = res;
}
public Map<String, Object> getExtMap() {
return extMap;
}
public void setExtMap(Map<String, Object> extMap) {
this.extMap = extMap;
}
@Override
public String toString() {
return new Gson().toJson(this);
}
}
|
UTF-8
|
Java
| 2,710 |
java
|
Result.java
|
Java
|
[
{
"context": "port java.util.Map;\n\n/**\n * 返回数据封装类\n *\n * @Author: LCF\n * @Date: 2020/7/5 17:43\n * @Package: com.ufostud",
"end": 216,
"score": 0.9996455311775208,
"start": 213,
"tag": "USERNAME",
"value": "LCF"
}
] | null |
[] |
package com.ufostudio.crm.common.entity;
import com.google.gson.Gson;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.Map;
/**
* 返回数据封装类
*
* @Author: LCF
* @Date: 2020/7/5 17:43
* @Package: com.ufostudio.crm.common.entity
*/
@ApiModel (value = "接口返回对象", description = "")
public class Result<T> implements java.io.Serializable {
/**
* 是否成功标识
*/
@ApiModelProperty (value = "是否成功标识,0为成功", required = true)
private int status = 0;
// 消息
@ApiModelProperty (value = "消息", required = true)
private String msg = "";
// 返回的数据
@ApiModelProperty (value = "返回的数据", required = true)
private T res;
private Map<String, Object> extMap;
public Result() {
}
/**
* 成功直接返回数据
*/
public Result(T res) {
this.res = res;
}
/**
* 成功直接返回数据 带拓展字段
*/
public Result(T res, Map<String, Object> extMap) {
this.res = res;
this.extMap = extMap;
}
public Result(Map<String, Object> extMap) {
this.extMap = extMap;
}
/**
* 错误代码(有额外信息)
*
* @param errorCodeEnum
* @param extendMsg
*/
public Result(ErrorCodeEnum errorCodeEnum, String extendMsg) {
this.status = errorCodeEnum.getStatus();
String wellNumberSign = "#";
this.msg = errorCodeEnum.getMsg() + wellNumberSign + extendMsg;
}
/**
* 错误
*
* @param errorCodeEnum
*/
public Result(ErrorCodeEnum errorCodeEnum) {
this.status = errorCodeEnum.getStatus();
this.msg = errorCodeEnum.getMsg();
}
public Result(int status, String msg) {
this.status = status;
this.msg = msg;
}
public Result(ErrorCodeEnum errorCodeEnum, T res) {
this.status = errorCodeEnum.getStatus();
this.msg = errorCodeEnum.getMsg();
this.res = res;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public T getRes() {
return res;
}
public void setRes(T res) {
this.res = res;
}
public Map<String, Object> getExtMap() {
return extMap;
}
public void setExtMap(Map<String, Object> extMap) {
this.extMap = extMap;
}
@Override
public String toString() {
return new Gson().toJson(this);
}
}
| 2,710 | 0.577465 | 0.57277 | 127 | 19.125984 | 18.367205 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.354331 | false | false |
13
|
c665927846bf93526c1b59ac4ebc2da6b0e555de
| 10,557,029,616,973 |
c4f04b0a46a862b6868ce9ec2daec7327c574fb9
|
/DesafioPregunta/app/src/main/java/cl/desafiolatam/desafiopregunta/MainActivity.java
|
820b218a7fd3f6c48267b0158bc0f352582337e8
|
[] |
no_license
|
LeoCofre/PreguntaDinamica
|
https://github.com/LeoCofre/PreguntaDinamica
|
5f2cf755f3c635f308b1e8f48d91582f0ac738a2
|
8c52f544a91e70afe28648349417db168ec687e9
|
refs/heads/master
| 2022-12-09T22:05:39.969000 | 2020-08-27T05:50:12 | 2020-08-27T05:50:12 | 254,760,112 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package cl.desafiolatam.desafiopregunta;
import androidx.appcompat.app.AppCompatActivity;
import android.net.Uri;
import android.os.Bundle;
import android.widget.Toast;
import java.util.List;
import cl.desafiolatam.desafiopregunta.api.Api;
import cl.desafiolatam.desafiopregunta.api.RetrofitClient;
import cl.desafiolatam.desafiopregunta.models.Question;
import cl.desafiolatam.desafiopregunta.models.Result;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class MainActivity extends AppCompatActivity implements MainFragment.OnFragmentInteractionListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Mostrar fragmento en Activity
setContentView(R.layout.activity_main);
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new MainFragment())
.commit();
Api apiService = RetrofitClient.getInsance().create(Api.class);
Call<Result>call=apiService.getAllQuestions();
call.enqueue(new Callback<Result>() {
@Override
public void onResponse(Call<Result> call, Response<Result> response) {
List <Question> questionList = response.body().getResults();
Toast.makeText(MainActivity.this,questionList.get(0).getQuestion(), Toast.LENGTH_SHORT).show();
}
@Override
public void onFailure(Call<Result> call, Throwable t) {
}
});
}
@Override
public void onFragmentInteraction(Uri uri) {
}
@Override
public void onPointerCaptureChanged(boolean hasCapture) {
}
}
|
UTF-8
|
Java
| 1,707 |
java
|
MainActivity.java
|
Java
|
[] | null |
[] |
package cl.desafiolatam.desafiopregunta;
import androidx.appcompat.app.AppCompatActivity;
import android.net.Uri;
import android.os.Bundle;
import android.widget.Toast;
import java.util.List;
import cl.desafiolatam.desafiopregunta.api.Api;
import cl.desafiolatam.desafiopregunta.api.RetrofitClient;
import cl.desafiolatam.desafiopregunta.models.Question;
import cl.desafiolatam.desafiopregunta.models.Result;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class MainActivity extends AppCompatActivity implements MainFragment.OnFragmentInteractionListener {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Mostrar fragmento en Activity
setContentView(R.layout.activity_main);
getSupportFragmentManager().beginTransaction()
.add(R.id.container, new MainFragment())
.commit();
Api apiService = RetrofitClient.getInsance().create(Api.class);
Call<Result>call=apiService.getAllQuestions();
call.enqueue(new Callback<Result>() {
@Override
public void onResponse(Call<Result> call, Response<Result> response) {
List <Question> questionList = response.body().getResults();
Toast.makeText(MainActivity.this,questionList.get(0).getQuestion(), Toast.LENGTH_SHORT).show();
}
@Override
public void onFailure(Call<Result> call, Throwable t) {
}
});
}
@Override
public void onFragmentInteraction(Uri uri) {
}
@Override
public void onPointerCaptureChanged(boolean hasCapture) {
}
}
| 1,707 | 0.697715 | 0.695372 | 56 | 29.482143 | 28.380697 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.464286 | false | false |
13
|
2578361f4a261c45385b6143e7e6974008c32502
| 20,409,684,639,510 |
2486bb1190dd5a496764be078792217cfc36ebb6
|
/Project/Cloud_Final_Project APR 19/Cloud_Final_Project/src/main/java/com/eternity/dao/PersonDAO.java
|
68ec6386f7ee71e703a9d121d08fa0f79a537738
|
[] |
no_license
|
ujjwalgarad/Cloud-Eternity-Website
|
https://github.com/ujjwalgarad/Cloud-Eternity-Website
|
1dff7a521e765d2b0d35d1f084cd24eee30f3af4
|
5a1a907651472e673f67623896e8e45a7767e01c
|
refs/heads/master
| 2021-05-06T02:17:36.569000 | 2018-01-04T01:26:11 | 2018-01-04T01:26:11 | 114,510,097 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.eternity.dao;
import org.hibernate.HibernateException;
import com.eternity.pojo.Address;
import com.eternity.pojo.Person;
public class PersonDAO extends DAO{
public PersonDAO(){
}
public Person create(String firstName, String lastName, String streetName, String city, String zipcode, String state, String country, String email, String telephone)
{
begin();
System.out.println("inside personDAO");
Person p = new Person();
Address ad = new Address();
p.setFirstName(firstName);
p.setLastName(lastName);
p.setEmail(email);
p.setTelephone(telephone);
ad.setStreetName(streetName);
ad.setCity(city);
ad.setZipcode(zipcode);
ad.setState(state);
ad.setCountry(country);
p.setAddress(ad);
getSession().save(p);
commit();
return p;
}
public void addPerson(){
begin();
Person person = new Person();
Address address = new Address();
person.setFirstName("Swapnil");
person.setLastName("Hete");
//person.setEmail("swapnilhete@gmail.com");
//person.setTelephone("8573008322");
//address.setStreetName("32 Clearway Street");
//address.setCity("Boston");
//address.setZipcode("02115");
//address.setState("MA");
//address.setCountry("USA");
//person.setAddress(address);
getSession().save(person);
commit();
getSession().close();
}
}
|
UTF-8
|
Java
| 1,561 |
java
|
PersonDAO.java
|
Java
|
[
{
"context": " PersonDAO(){\n\t\t\n\t\n\t}\n\tpublic Person create(String firstName, String lastName, String streetName, String city,",
"end": 242,
"score": 0.988589882850647,
"start": 233,
"tag": "NAME",
"value": "firstName"
},
{
"context": "\n\t}\n\tpublic Person create(String firstName, String lastName, String streetName, String city, String zipcode, ",
"end": 259,
"score": 0.9948123693466187,
"start": 251,
"tag": "NAME",
"value": "lastName"
},
{
"context": "ddress();\n \n p.setFirstName(firstName);\n p.setLastName(lastName);\n ",
"end": 587,
"score": 0.9941596388816833,
"start": 578,
"tag": "NAME",
"value": "firstName"
},
{
"context": "etFirstName(firstName);\n p.setLastName(lastName);\n p.setEmail(email);\n \t\tp.setTelep",
"end": 624,
"score": 0.9938496947288513,
"start": 616,
"tag": "NAME",
"value": "lastName"
},
{
"context": "ddress = new Address();\n\t\t\n\t\tperson.setFirstName(\"Swapnil\");\n\t\tperson.setLastName(\"Hete\");\n\t\t//person.setEm",
"end": 1152,
"score": 0.9996594190597534,
"start": 1145,
"tag": "NAME",
"value": "Swapnil"
},
{
"context": "on.setFirstName(\"Swapnil\");\n\t\tperson.setLastName(\"Hete\");\n\t\t//person.setEmail(\"swapnilhete@gmail.com\");\n",
"end": 1182,
"score": 0.999835729598999,
"start": 1178,
"tag": "NAME",
"value": "Hete"
},
{
"context": "\tperson.setLastName(\"Hete\");\n\t\t//person.setEmail(\"swapnilhete@gmail.com\");\n\t\t//person.setTelephone(\"8573008322\");\n\t\t//add",
"end": 1228,
"score": 0.9999212622642517,
"start": 1207,
"tag": "EMAIL",
"value": "swapnilhete@gmail.com"
}
] | null |
[] |
package com.eternity.dao;
import org.hibernate.HibernateException;
import com.eternity.pojo.Address;
import com.eternity.pojo.Person;
public class PersonDAO extends DAO{
public PersonDAO(){
}
public Person create(String firstName, String lastName, String streetName, String city, String zipcode, String state, String country, String email, String telephone)
{
begin();
System.out.println("inside personDAO");
Person p = new Person();
Address ad = new Address();
p.setFirstName(firstName);
p.setLastName(lastName);
p.setEmail(email);
p.setTelephone(telephone);
ad.setStreetName(streetName);
ad.setCity(city);
ad.setZipcode(zipcode);
ad.setState(state);
ad.setCountry(country);
p.setAddress(ad);
getSession().save(p);
commit();
return p;
}
public void addPerson(){
begin();
Person person = new Person();
Address address = new Address();
person.setFirstName("Swapnil");
person.setLastName("Hete");
//person.setEmail("<EMAIL>");
//person.setTelephone("8573008322");
//address.setStreetName("32 Clearway Street");
//address.setCity("Boston");
//address.setZipcode("02115");
//address.setState("MA");
//address.setCountry("USA");
//person.setAddress(address);
getSession().save(person);
commit();
getSession().close();
}
}
| 1,547 | 0.595131 | 0.584241 | 68 | 21.955883 | 22.78056 | 166 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.705882 | false | false |
13
|
b102722e4de90dbf42ed7dfc165b271bc6aaa71a
| 21,655,225,171,427 |
9dc015c834810d5955f5beb1701a60ea74c1b41b
|
/basics/src/practice/Square.java
|
898fb3c93f6c4fad289367bcb35c52c37cb65145
|
[] |
no_license
|
aurelijadro/JavaClasswork
|
https://github.com/aurelijadro/JavaClasswork
|
192216a66d7723f73ed35aaa4a6a39d4b0e77c56
|
1a1c2b6ca72e1fd1d1681626fadd9dcb6d40db38
|
refs/heads/master
| 2020-08-12T00:38:26.202000 | 2019-11-17T13:34:01 | 2019-11-17T13:34:01 | 214,656,803 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package practice;
import java.util.Scanner;
public class Square {
public static double calculateArea(double side) {
return Math.pow(side, 2);
}
public static double calculatePerimeter(double side) {
return 4*side;
}
public static double getSideLength() {
Scanner scan = new Scanner(System.in);
System.out.println("Please enter the side length of the square:");
if(scan.hasNextDouble()) {
double side= Double.parseDouble(scan.next());
return side;
}
return Square.getSideLength();
}
public static void printAreaAndPerimeterCalculations() {
double side = Square.getSideLength();
System.out.println("Perimeter of your square is:" + Square.calculatePerimeter(side));
System.out.println("Area of your square is:" + Square.calculateArea(side));
}
}
|
UTF-8
|
Java
| 792 |
java
|
Square.java
|
Java
|
[] | null |
[] |
package practice;
import java.util.Scanner;
public class Square {
public static double calculateArea(double side) {
return Math.pow(side, 2);
}
public static double calculatePerimeter(double side) {
return 4*side;
}
public static double getSideLength() {
Scanner scan = new Scanner(System.in);
System.out.println("Please enter the side length of the square:");
if(scan.hasNextDouble()) {
double side= Double.parseDouble(scan.next());
return side;
}
return Square.getSideLength();
}
public static void printAreaAndPerimeterCalculations() {
double side = Square.getSideLength();
System.out.println("Perimeter of your square is:" + Square.calculatePerimeter(side));
System.out.println("Area of your square is:" + Square.calculateArea(side));
}
}
| 792 | 0.72096 | 0.718434 | 32 | 23.75 | 25.12842 | 87 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.6875 | false | false |
13
|
15d5a41e705aac89b60e283eaf35c3c32fdb9d39
| 32,444,182,963,860 |
0dbe74188a945940450b1a069d1e4a68ec6ae697
|
/mercy/src/test/java/mercy/Test.java
|
78cc1e09910ab43548cc34854aa3f28dece0d479
|
[] |
no_license
|
ljl403291856/MERCY
|
https://github.com/ljl403291856/MERCY
|
6c654d0feaaf5864b8a81994f52f25f07625e1e5
|
5c7c833c664fbe8d2b8bc3ceee1f7521f0051e51
|
refs/heads/master
| 2017-12-13T07:32:47.053000 | 2017-08-23T01:48:41 | 2017-08-23T01:48:41 | 78,193,566 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package mercy;
import javax.annotation.Resource;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.cn.mercy.entity.User;
import com.cn.mercy.service.UserService;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration({"classpath:spring-mybatis.xml"})
public class Test {
@Resource
private UserService userService;
@org.junit.Test
public void tt() {
User user = new User();
user.setId("123452");
user.setName("卢晓娟");
userService.insert(user);
}
}
|
UTF-8
|
Java
| 631 |
java
|
Test.java
|
Java
|
[
{
"context": "User();\r\n\t\tuser.setId(\"123452\");\r\n\t\tuser.setName(\"卢晓娟\");\r\n\t\tuserService.insert(user);\r\n\t}\r\n}\r\n",
"end": 584,
"score": 0.9992067217826843,
"start": 581,
"tag": "NAME",
"value": "卢晓娟"
}
] | null |
[] |
package mercy;
import javax.annotation.Resource;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.cn.mercy.entity.User;
import com.cn.mercy.service.UserService;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration({"classpath:spring-mybatis.xml"})
public class Test {
@Resource
private UserService userService;
@org.junit.Test
public void tt() {
User user = new User();
user.setId("123452");
user.setName("卢晓娟");
userService.insert(user);
}
}
| 631 | 0.7488 | 0.7344 | 25 | 23 | 19.550959 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.04 | false | false |
13
|
2cd26220bc52ef25bad5dfc1039bfc77156e4de5
| 9,878,424,795,617 |
9fc186e6c00466dd760d2835c461ed309ec0e451
|
/src/no/hvl/dat250/main/Main.java
|
87fa49e240d53ae76f329c17e258d380a5d0e066
|
[] |
no_license
|
KristianHaga/DAT250-Group6
|
https://github.com/KristianHaga/DAT250-Group6
|
d9efe7097ea05cce64f9d749b2d9f22ffa66822c
|
634f3544892046c3c30e8ac074a0524f2ccca493
|
refs/heads/master
| 2022-12-24T15:47:36.601000 | 2020-09-15T08:35:15 | 2020-09-15T08:35:15 | 294,057,419 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package no.hvl.dat250.main;
import no.hvl.dat250.dao.DaoPoll;
import no.hvl.dat250.dao.DaoUser;
import no.hvl.dat250.model.User;
import no.hvl.dat250.model.Poll;
import no.hvl.dat250.model.IoTDevice;
import no.hvl.dat250.model.Vote;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.Query;
import java.util.ArrayList;
import java.util.List;
public class Main {
public static void main(String[] args) {
EntityManagerFactory factory = Persistence.createEntityManagerFactory("polls");
EntityManager em = factory.createEntityManager();
DaoPoll daoPoll = new DaoPoll(em);
DaoUser daoUser = new DaoUser(em);
List<User> users = daoUser.findAll();
System.out.println("-------- Users ----------");
for(User user : users) {
System.out.println(user.getUserName() + " " + user.getLastName());
}
System.out.println("-------- Polls ----------");
List<Poll> polls = daoUser.findPollsCreated("Ola");
for(Poll poll : polls) {
System.out.println(poll.getVote().getQuestion());
}
System.out.println("-------------------------");
/*
List<Poll> polls = daoPoll.findPublicPolls();
for(Poll poll : polls) {
System.out.println(poll.getCreator().getUserName());
}
*/
em.close();
}
}
|
UTF-8
|
Java
| 1,463 |
java
|
Main.java
|
Java
|
[] | null |
[] |
package no.hvl.dat250.main;
import no.hvl.dat250.dao.DaoPoll;
import no.hvl.dat250.dao.DaoUser;
import no.hvl.dat250.model.User;
import no.hvl.dat250.model.Poll;
import no.hvl.dat250.model.IoTDevice;
import no.hvl.dat250.model.Vote;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.Query;
import java.util.ArrayList;
import java.util.List;
public class Main {
public static void main(String[] args) {
EntityManagerFactory factory = Persistence.createEntityManagerFactory("polls");
EntityManager em = factory.createEntityManager();
DaoPoll daoPoll = new DaoPoll(em);
DaoUser daoUser = new DaoUser(em);
List<User> users = daoUser.findAll();
System.out.println("-------- Users ----------");
for(User user : users) {
System.out.println(user.getUserName() + " " + user.getLastName());
}
System.out.println("-------- Polls ----------");
List<Poll> polls = daoUser.findPollsCreated("Ola");
for(Poll poll : polls) {
System.out.println(poll.getVote().getQuestion());
}
System.out.println("-------------------------");
/*
List<Poll> polls = daoPoll.findPublicPolls();
for(Poll poll : polls) {
System.out.println(poll.getCreator().getUserName());
}
*/
em.close();
}
}
| 1,463 | 0.621326 | 0.606972 | 49 | 28.87755 | 22.961931 | 87 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.55102 | false | false |
13
|
6444d3064450148fac0c6ffa3cb13205d35963da
| 21,517,786,169,038 |
0c436891f0bafbd6e3a5df4254300990ba3f6fe7
|
/app/src/main/java/com/example/Alharm/alharm/Models/User.java
|
9c55fb077aae98f1bb357f0aaa8de8929e9b87be
|
[] |
no_license
|
ibrahimFakharany/AlHarm
|
https://github.com/ibrahimFakharany/AlHarm
|
fdc6a440b70a8d224ab64136b3e8baf3f70de7f6
|
0466b28765aef3f0edd9180a27c2b96bc245b5a5
|
refs/heads/master
| 2020-03-09T09:02:15.005000 | 2018-04-15T14:39:28 | 2018-04-15T14:39:28 | 128,702,881 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.Alharm.alharm.Models;
import java.io.Serializable;
import java.util.HashMap;
public class User implements Serializable {
private String name;
private String phone;
private String email;
private String password;
private String documentUrl;
private String userType;
private String state;
private String code;
private String firebaseKey;
private User user;
public User(String firebaseKey,
String name,
String phone,
String email,
String password,
String documentUrl,
String userType,
String state,
String code) {
this.firebaseKey = firebaseKey;
this.name = name;
this.phone = phone;
this.email = email;
this.password = password;
this.documentUrl = documentUrl;
this.userType = userType;
this.state = state;
this.code = code;
}
public User(
String name,
String phone,
String email,
String password,
String documentUrl,
String userType,
String state,
String code) {
this.name = name;
this.phone = phone;
this.email = email;
this.password = password;
this.documentUrl = documentUrl;
this.userType = userType;
this.state = state;
this.code = code;
}
public User(String firebaseKey, User user){
this.firebaseKey = firebaseKey;
this.user = user;
}
public User() {
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public String getFirebaseKey() {
return firebaseKey;
}
public void setFirebaseKey(String firebaseKey) {
this.firebaseKey = firebaseKey;
}
public String getDocumentUrl() {
return documentUrl;
}
public void setDocumentUrl(String documentUrl) {
this.documentUrl = documentUrl;
}
public String getUserType() {
return userType;
}
public void setUserType(String userType) {
this.userType = userType;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public HashMap toMap() {
HashMap<String, Object> HashMap = new HashMap<String, Object>();
HashMap.put("name", name);
HashMap.put("phone", phone);
HashMap.put("email", email);
HashMap.put("password", password);
return HashMap;
}
}
|
UTF-8
|
Java
| 3,395 |
java
|
User.java
|
Java
|
[
{
"context": " this.email = email;\n this.password = password;\n this.documentUrl = documentUrl;\n ",
"end": 856,
"score": 0.9984564185142517,
"start": 848,
"tag": "PASSWORD",
"value": "password"
},
{
"context": " this.email = email;\n this.password = password;\n this.documentUrl = documentUrl;\n ",
"end": 1376,
"score": 0.9991021752357483,
"start": 1368,
"tag": "PASSWORD",
"value": "password"
},
{
"context": "t(\"email\", email);\n HashMap.put(\"password\", password);\n\n return HashMap;\n }\n}\n",
"end": 3359,
"score": 0.9835019707679749,
"start": 3351,
"tag": "PASSWORD",
"value": "password"
}
] | null |
[] |
package com.example.Alharm.alharm.Models;
import java.io.Serializable;
import java.util.HashMap;
public class User implements Serializable {
private String name;
private String phone;
private String email;
private String password;
private String documentUrl;
private String userType;
private String state;
private String code;
private String firebaseKey;
private User user;
public User(String firebaseKey,
String name,
String phone,
String email,
String password,
String documentUrl,
String userType,
String state,
String code) {
this.firebaseKey = firebaseKey;
this.name = name;
this.phone = phone;
this.email = email;
this.password = <PASSWORD>;
this.documentUrl = documentUrl;
this.userType = userType;
this.state = state;
this.code = code;
}
public User(
String name,
String phone,
String email,
String password,
String documentUrl,
String userType,
String state,
String code) {
this.name = name;
this.phone = phone;
this.email = email;
this.password = <PASSWORD>;
this.documentUrl = documentUrl;
this.userType = userType;
this.state = state;
this.code = code;
}
public User(String firebaseKey, User user){
this.firebaseKey = firebaseKey;
this.user = user;
}
public User() {
}
public User getUser() {
return user;
}
public void setUser(User user) {
this.user = user;
}
public String getFirebaseKey() {
return firebaseKey;
}
public void setFirebaseKey(String firebaseKey) {
this.firebaseKey = firebaseKey;
}
public String getDocumentUrl() {
return documentUrl;
}
public void setDocumentUrl(String documentUrl) {
this.documentUrl = documentUrl;
}
public String getUserType() {
return userType;
}
public void setUserType(String userType) {
this.userType = userType;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public HashMap toMap() {
HashMap<String, Object> HashMap = new HashMap<String, Object>();
HashMap.put("name", name);
HashMap.put("phone", phone);
HashMap.put("email", email);
HashMap.put("password", <PASSWORD>);
return HashMap;
}
}
| 3,401 | 0.561119 | 0.561119 | 156 | 20.762821 | 15.397765 | 72 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.512821 | false | false |
13
|
e435089da59c18d3a7a978db93b8a26d96683653
| 26,688,926,795,821 |
c4c020cb545a7a2e8ec82831c9cd8ab5bfbe153b
|
/Theory/Lesson_2/java_ngay2/src/giaiphuongtrinhbac1/PhuongTrinhBac1.java
|
34601503964db399dda2cd5280da4077375946bd
|
[] |
no_license
|
azhung/JavaCore
|
https://github.com/azhung/JavaCore
|
20bb1c98d30f66561dc8d2bf851dd226d5826f45
|
3ae933b87f2dc35336cfc6521b1c205281f9af9a
|
refs/heads/master
| 2016-09-05T17:08:50.208000 | 2014-02-09T02:49:15 | 2014-02-09T02:49:15 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package giaiphuongtrinhbac1;
/**
*
* @author Administrator
*/
public class PhuongTrinhBac1 {
//khai báo 2 thuộc tính a,b kiểu số thực
double a,b;
//khai báo phương thức giải phương trình
public void GiaiPT(){
if(a==0){
if(b==0){
System.out.println("Phương trình vô số nghiệm");
}
else{//b khác 0
System.out.println("Phương trình vô nghiệm");
}
}
else{//a khác 0
System.out.println("Nghiệm là: " + (-b/a));
}
}
}
|
UTF-8
|
Java
| 700 |
java
|
PhuongTrinhBac1.java
|
Java
|
[
{
"context": "/\n\npackage giaiphuongtrinhbac1;\n\n/**\n *\n * @author Administrator\n */\npublic class PhuongTrinhBac1 {\n //khai báo",
"end": 162,
"score": 0.9033533930778503,
"start": 149,
"tag": "USERNAME",
"value": "Administrator"
}
] | null |
[] |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package giaiphuongtrinhbac1;
/**
*
* @author Administrator
*/
public class PhuongTrinhBac1 {
//khai báo 2 thuộc tính a,b kiểu số thực
double a,b;
//khai báo phương thức giải phương trình
public void GiaiPT(){
if(a==0){
if(b==0){
System.out.println("Phương trình vô số nghiệm");
}
else{//b khác 0
System.out.println("Phương trình vô nghiệm");
}
}
else{//a khác 0
System.out.println("Nghiệm là: " + (-b/a));
}
}
}
| 700 | 0.531014 | 0.520424 | 29 | 21.793104 | 19.320133 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.310345 | false | false |
13
|
ca656acede57bdd82d44d7982c2f38d12916903c
| 24,730,421,708,359 |
c148e46c70edaf0a516a4bbc4ef614db2d48e9b1
|
/app/src/main/java/fr/mds/mydogtrackermanager/activity/MainActivity.java
|
475d949bee8f17963f6770e682a7db89354ae8d6
|
[] |
no_license
|
TomO35/MyDogTrackerManager
|
https://github.com/TomO35/MyDogTrackerManager
|
7feb03ea7ca705eb2571e470f2144bb3a922f111
|
decc21021e95471d98e1c7d9fcb3c15e243b2ad7
|
refs/heads/master
| 2021-08-31T21:02:51.087000 | 2017-12-22T22:48:09 | 2017-12-22T22:48:09 | 113,445,935 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package fr.mds.mydogtrackermanager.activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.provider.Settings;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.widget.TableLayout;
import java.util.ArrayList;
import java.util.HashMap;
import fr.mds.mydogtrackermanager.R;
import fr.mds.mydogtrackermanager.tools.ViewPagerAdapter;
public class MainActivity extends AppCompatActivity {
private TabLayout tabLayout;
private ViewPager viewPager;
public HashMap<String, ArrayList<Fragment>> listFragments;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
listFragments = new HashMap<>();
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
ConnectivityManager cm = (ConnectivityManager) this.getSystemService(this.CONNECTIVITY_SERVICE);
if (cm.getActiveNetworkInfo() == null){
createNetworkErrorDialog(this);
}
viewPager = findViewById(R.id.viewpager);
ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager(), this);
viewPager.setAdapter(adapter);
tabLayout = findViewById(R.id.tabs);
tabLayout.setupWithViewPager(viewPager);
}
protected void createNetworkErrorDialog(Context context) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setMessage(getResources().getText(R.string.error_connectivity))
.setTitle(getResources().getText(R.string.network_needed))
.setCancelable(false)
.setPositiveButton(getResources().getText(R.string.settings),
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
Intent i = new Intent(Settings.ACTION_WIRELESS_SETTINGS);
startActivity(i);
}
}
)
.setNegativeButton(getResources().getText(R.string.out),
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
}
);
AlertDialog alert = builder.create();
alert.show();
}
}
|
UTF-8
|
Java
| 2,914 |
java
|
MainActivity.java
|
Java
|
[] | null |
[] |
package fr.mds.mydogtrackermanager.activity;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.provider.Settings;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.Toolbar;
import android.widget.TableLayout;
import java.util.ArrayList;
import java.util.HashMap;
import fr.mds.mydogtrackermanager.R;
import fr.mds.mydogtrackermanager.tools.ViewPagerAdapter;
public class MainActivity extends AppCompatActivity {
private TabLayout tabLayout;
private ViewPager viewPager;
public HashMap<String, ArrayList<Fragment>> listFragments;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
listFragments = new HashMap<>();
Toolbar toolbar = findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
ConnectivityManager cm = (ConnectivityManager) this.getSystemService(this.CONNECTIVITY_SERVICE);
if (cm.getActiveNetworkInfo() == null){
createNetworkErrorDialog(this);
}
viewPager = findViewById(R.id.viewpager);
ViewPagerAdapter adapter = new ViewPagerAdapter(getSupportFragmentManager(), this);
viewPager.setAdapter(adapter);
tabLayout = findViewById(R.id.tabs);
tabLayout.setupWithViewPager(viewPager);
}
protected void createNetworkErrorDialog(Context context) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setMessage(getResources().getText(R.string.error_connectivity))
.setTitle(getResources().getText(R.string.network_needed))
.setCancelable(false)
.setPositiveButton(getResources().getText(R.string.settings),
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
Intent i = new Intent(Settings.ACTION_WIRELESS_SETTINGS);
startActivity(i);
}
}
)
.setNegativeButton(getResources().getText(R.string.out),
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
}
);
AlertDialog alert = builder.create();
alert.show();
}
}
| 2,914 | 0.651338 | 0.649966 | 78 | 36.358974 | 25.990618 | 104 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.602564 | false | false |
13
|
89196fa6fcb430e34801e084d21e0dd6c447931d
| 24,730,421,707,127 |
4e53f61a1e8d653a100a6cb2c2c05d380bbf842e
|
/src/AbstractAlgorithm.java
|
53bf721f5e1f1530dc5db4ff0799f01aaf941fea
|
[] |
no_license
|
kai2128/DSA_assignment
|
https://github.com/kai2128/DSA_assignment
|
7b2e3b6b0ce4e7deaa087d443941361ced514ba3
|
2e163aa2a0da0403bce15cd941aec0419e562ac4
|
refs/heads/master
| 2023-07-14T04:49:06.647000 | 2021-08-25T13:33:03 | 2021-08-25T13:33:03 | 399,109,097 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.util.LinkedList;
public abstract class AbstractAlgorithm implements Algorithm{
protected LinkedList<Parcel> parcelList;
protected LinkedList<Truck> truckList = new LinkedList<>();
protected boolean loadParcelToTruck(Truck truck, Parcel parcel){
return truck.loadParcel(parcel);
}
public void removeFromList(Parcel parcel){
// delete parcel from parcel list
parcelList.remove(parcel);
}
public boolean notAllParcelBeingLoaded(){
return parcelList.size() > 0;
}
public void createNewTruck(){
truckList.addLast(new Truck());
}
public void loadParcelIntoNewTruck(Parcel parcel){
Truck newTruck = new Truck();
newTruck.loadParcel(parcel);
truckList.addLast(newTruck);
}
@Override
public void printResult() {
for (Truck truck : truckList) {
System.out.println(truck.printParcelStored());
}
System.out.println("Truck count: " + truckList.size());
}
}
|
UTF-8
|
Java
| 1,024 |
java
|
AbstractAlgorithm.java
|
Java
|
[] | null |
[] |
import java.util.LinkedList;
public abstract class AbstractAlgorithm implements Algorithm{
protected LinkedList<Parcel> parcelList;
protected LinkedList<Truck> truckList = new LinkedList<>();
protected boolean loadParcelToTruck(Truck truck, Parcel parcel){
return truck.loadParcel(parcel);
}
public void removeFromList(Parcel parcel){
// delete parcel from parcel list
parcelList.remove(parcel);
}
public boolean notAllParcelBeingLoaded(){
return parcelList.size() > 0;
}
public void createNewTruck(){
truckList.addLast(new Truck());
}
public void loadParcelIntoNewTruck(Parcel parcel){
Truck newTruck = new Truck();
newTruck.loadParcel(parcel);
truckList.addLast(newTruck);
}
@Override
public void printResult() {
for (Truck truck : truckList) {
System.out.println(truck.printParcelStored());
}
System.out.println("Truck count: " + truckList.size());
}
}
| 1,024 | 0.65625 | 0.655273 | 38 | 25.947369 | 22.419384 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.342105 | false | false |
13
|
23c5d8894e33edc8038d4c89759c0fafce2758a3
| 12,498,354,851,134 |
bad00f14abd413ab7c855edd3a52b7d021244986
|
/app/src/main/java/com/example/lenovo/mymdb/PersonMovieCredits.java
|
dd7b75e96d92974b04ccdc4ae4bf9bfd978b6fd6
|
[] |
no_license
|
PriyanshVerma/MyMDb
|
https://github.com/PriyanshVerma/MyMDb
|
66da7734befc1ed1506ca74961a29d040a71de9f
|
574ee00a2bc4039f91524b1300945b352c43f672
|
refs/heads/master
| 2020-03-24T20:53:05.734000 | 2018-07-31T10:52:59 | 2018-07-31T10:52:59 | 143,001,735 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.lenovo.mymdb;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import java.util.ArrayList;
@SuppressWarnings("unused")
public class PersonMovieCredits {
@SerializedName("cast")
ArrayList<PersonMovieCast> casts;
}
|
UTF-8
|
Java
| 291 |
java
|
PersonMovieCredits.java
|
Java
|
[] | null |
[] |
package com.example.lenovo.mymdb;
import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import java.util.ArrayList;
@SuppressWarnings("unused")
public class PersonMovieCredits {
@SerializedName("cast")
ArrayList<PersonMovieCast> casts;
}
| 291 | 0.786942 | 0.786942 | 13 | 21.307692 | 17.752073 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.384615 | false | false |
13
|
b8c7d761f65cc80b3b5534081ba641a984619ecd
| 661,424,985,832 |
6b9e67eeb8d16aa9f1bd2981149e876176c23083
|
/src/main/java/com/capitole/challenge/model/EnumValidation.java
|
d789fbd33b2134930c814b1f1151331351e3f41c
|
[] |
no_license
|
LittleTooll/Capitole
|
https://github.com/LittleTooll/Capitole
|
db2007622cd531a4ad2885161287d1761d5497d3
|
97956d86aad49d5b6c1dc700d66193ace1ae9ab2
|
refs/heads/master
| 2020-04-01T00:49:13.540000 | 2018-10-12T20:04:19 | 2018-10-12T20:04:19 | 152,714,753 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.capitole.challenge.model;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.experimental.Accessors;
@RequiredArgsConstructor
@Accessors(fluent=true)
@Getter
public enum EnumValidation {
PHONE_NO_EXIST ("A phone from the list does not exist"),
PHONES_EMPTY ("Empty phone list"),
CUSTOMER_EMPTY ("No customer"),
OK ("Created orden");
private final String descripcion;
}
|
UTF-8
|
Java
| 413 |
java
|
EnumValidation.java
|
Java
|
[] | null |
[] |
package com.capitole.challenge.model;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.experimental.Accessors;
@RequiredArgsConstructor
@Accessors(fluent=true)
@Getter
public enum EnumValidation {
PHONE_NO_EXIST ("A phone from the list does not exist"),
PHONES_EMPTY ("Empty phone list"),
CUSTOMER_EMPTY ("No customer"),
OK ("Created orden");
private final String descripcion;
}
| 413 | 0.779661 | 0.779661 | 17 | 23.352942 | 16.14253 | 57 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.882353 | false | false |
13
|
8895e03571af6c0dfe85afb562bab463ca918c5e
| 16,535,624,105,738 |
fbcdc95405ad9272f081b3b35fd5bbc26f356f15
|
/CMDEXE/cmdexe/cmdexe/Controllers/WelcomeController.java
|
0f0e494b85d8ea25fac04a833e45ca3d50e48741
|
[] |
no_license
|
HGalloway/CMDEXE
|
https://github.com/HGalloway/CMDEXE
|
8981bcb85acfe8b76c210871cb1d5af0d675bd55
|
4c0f44525fd0a92c15cc1c0c952655f1ac6d8fae
|
refs/heads/main
| 2023-03-28T09:25:03.509000 | 2021-03-11T08:41:10 | 2021-03-11T08:41:10 | 325,635,978 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package cmdexe.Controllers;
import java.io.IOException;
import cmdexe.Methods;
import cmdexe.Methods.FilesAndFolders;
import cmdexe.SceneBuilder;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
public class WelcomeController {
Methods Methods = new Methods();
FilesAndFolders FilesAndFolders = Methods.new FilesAndFolders();
//Registration Button
@FXML
private void ToRegistrationPage(ActionEvent event) throws IOException{
//WriteWelcomeBooleanToFile();
new SceneBuilder().SetScene(event, true, "Registration.fxml", "Registration", null);
}
//Login Button
@FXML
private void ToLoginPage(ActionEvent event) throws IOException{
WriteWelcomeBooleanToFile();
new SceneBuilder().SetScene(event, true, "Login.fxml", "Login", null);
}
private void WriteWelcomeBooleanToFile() throws IOException {
Methods Methods = new Methods();
FilesAndFolders FilesAndFolders = Methods.new FilesAndFolders();
FilesAndFolders.ReadInFile(System.getProperty("user.dir") + "\\CMDEXE\\cmdexe\\cmdexe", "SystemInformation.dir");
if(FilesAndFolders.LineText.size() == 2) {
FilesAndFolders.WriteToFile(System.getProperty("user.dir") + "\\CMDEXE\\cmdexe\\cmdexe", "SystemInformation.dir", "\nSeenWelcomePage=\"true\"");
}
}
}
|
UTF-8
|
Java
| 1,300 |
java
|
WelcomeController.java
|
Java
|
[] | null |
[] |
package cmdexe.Controllers;
import java.io.IOException;
import cmdexe.Methods;
import cmdexe.Methods.FilesAndFolders;
import cmdexe.SceneBuilder;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
public class WelcomeController {
Methods Methods = new Methods();
FilesAndFolders FilesAndFolders = Methods.new FilesAndFolders();
//Registration Button
@FXML
private void ToRegistrationPage(ActionEvent event) throws IOException{
//WriteWelcomeBooleanToFile();
new SceneBuilder().SetScene(event, true, "Registration.fxml", "Registration", null);
}
//Login Button
@FXML
private void ToLoginPage(ActionEvent event) throws IOException{
WriteWelcomeBooleanToFile();
new SceneBuilder().SetScene(event, true, "Login.fxml", "Login", null);
}
private void WriteWelcomeBooleanToFile() throws IOException {
Methods Methods = new Methods();
FilesAndFolders FilesAndFolders = Methods.new FilesAndFolders();
FilesAndFolders.ReadInFile(System.getProperty("user.dir") + "\\CMDEXE\\cmdexe\\cmdexe", "SystemInformation.dir");
if(FilesAndFolders.LineText.size() == 2) {
FilesAndFolders.WriteToFile(System.getProperty("user.dir") + "\\CMDEXE\\cmdexe\\cmdexe", "SystemInformation.dir", "\nSeenWelcomePage=\"true\"");
}
}
}
| 1,300 | 0.733846 | 0.733077 | 38 | 33.210526 | 33.857407 | 147 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.394737 | false | false |
13
|
ef10a1403993012b963188b4485cc238e4c59eb5
| 28,673,201,737,057 |
1b2572c9dd7884bac43d62b799aece6c5bdf748e
|
/src/br/com/adbv/sgd/dao/EnderecoDao.java
|
b4c3da177d4d6af3aa6377882bdaa57dbe6b022a
|
[] |
no_license
|
saviofreitas/sgd-jsf
|
https://github.com/saviofreitas/sgd-jsf
|
7340ce3d9c7eb2c20b6aa64e58e2cfe85ea662d1
|
b356a4c5b40815581bc98beca48e8270472b09be
|
refs/heads/master
| 2016-09-06T16:27:55.161000 | 2013-06-22T00:06:45 | 2013-06-22T00:06:45 | 8,317,554 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package br.com.adbv.sgd.dao;
import java.util.HashMap;
import java.util.Map;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import br.com.adbv.sgd.model.Endereco;
@Repository("enderecoDao")
@Transactional
public class EnderecoDao {
@PersistenceContext
private EntityManager entityManager;
public Map<String, String> buscarPorCep(String cep) {
Map<String, String> resultado = new HashMap<String, String>();
Session session = ((Session) entityManager.getDelegate());
Endereco endereco = (Endereco) session.createCriteria(Endereco.class)
.add(Restrictions.eq("cep", cep.replaceAll("\\D", "")))
.uniqueResult();
if (endereco == null) {
endereco = new Endereco();
}
resultado.put("logradouro", endereco.getLogradouro());
resultado.put("bairro", endereco.getBairro());
resultado.put("cidade", endereco.getCidade());
resultado.put("uf", endereco.getUf());
return resultado;
}
}
|
UTF-8
|
Java
| 1,144 |
java
|
EnderecoDao.java
|
Java
|
[] | null |
[] |
package br.com.adbv.sgd.dao;
import java.util.HashMap;
import java.util.Map;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;
import br.com.adbv.sgd.model.Endereco;
@Repository("enderecoDao")
@Transactional
public class EnderecoDao {
@PersistenceContext
private EntityManager entityManager;
public Map<String, String> buscarPorCep(String cep) {
Map<String, String> resultado = new HashMap<String, String>();
Session session = ((Session) entityManager.getDelegate());
Endereco endereco = (Endereco) session.createCriteria(Endereco.class)
.add(Restrictions.eq("cep", cep.replaceAll("\\D", "")))
.uniqueResult();
if (endereco == null) {
endereco = new Endereco();
}
resultado.put("logradouro", endereco.getLogradouro());
resultado.put("bairro", endereco.getBairro());
resultado.put("cidade", endereco.getCidade());
resultado.put("uf", endereco.getUf());
return resultado;
}
}
| 1,144 | 0.755245 | 0.755245 | 41 | 26.902439 | 22.299299 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.560976 | false | false |
13
|
f11a3c15cd27e6af09ac943d12f3d3a18794d9da
| 9,552,007,298,356 |
1fd14932c29b69b4531e4ed965670db06e7f021e
|
/RestAPI/src/main/java/model/Employee.java
|
93c6146d23404a078588d6d22a7fca2bab29ec86
|
[] |
no_license
|
gayathribheeshma/SpringBoot
|
https://github.com/gayathribheeshma/SpringBoot
|
e13d04c128aa4d9a249b6e34bee1b1cd9822ba01
|
fdb11a3d3f277d77cfaf3c04630796747bbbfb31
|
refs/heads/master
| 2020-07-01T16:20:13.336000 | 2019-09-19T07:38:42 | 2019-09-19T07:38:42 | 201,223,734 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package model;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlAccessType;
@XmlRootElement(name="employee")
@XmlAccessorType(XmlAccessType.NONE)
public class Employee implements Serializable {
@XmlAttribute
private int Empid;
@XmlElement
private String firsName;
@XmlElement
private String lastName;
@XmlElement
private String email;
public Employee(int empid, String firsName, String lastName, String email) {
super();
Empid = empid;
this.firsName = firsName;
this.lastName = lastName;
this.email = email;
}
public Employee() {
}
public int getEmpid() {
return Empid;
}
public void setEmpid(int empid) {
Empid = empid;
}
public String getFirsName() {
return firsName;
}
public void setFirsName(String firsName) {
this.firsName = firsName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
@Override
public String toString() {
return "Employee [Empid=" + Empid + ", firsName=" + firsName + ", lastName=" + lastName + ", email=" + email
+ "]";
}
}
|
UTF-8
|
Java
| 1,502 |
java
|
Employee.java
|
Java
|
[
{
"context": "{\r\n\t\tsuper();\r\n\t\tEmpid = empid;\r\n\t\tthis.firsName = firsName;\r\n\t\tthis.lastName = lastName;\r\n\t\tthis.email = ema",
"end": 727,
"score": 0.7423111796379089,
"start": 719,
"tag": "NAME",
"value": "firsName"
}
] | null |
[] |
package model;
import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlAccessType;
@XmlRootElement(name="employee")
@XmlAccessorType(XmlAccessType.NONE)
public class Employee implements Serializable {
@XmlAttribute
private int Empid;
@XmlElement
private String firsName;
@XmlElement
private String lastName;
@XmlElement
private String email;
public Employee(int empid, String firsName, String lastName, String email) {
super();
Empid = empid;
this.firsName = firsName;
this.lastName = lastName;
this.email = email;
}
public Employee() {
}
public int getEmpid() {
return Empid;
}
public void setEmpid(int empid) {
Empid = empid;
}
public String getFirsName() {
return firsName;
}
public void setFirsName(String firsName) {
this.firsName = firsName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
@Override
public String toString() {
return "Employee [Empid=" + Empid + ", firsName=" + firsName + ", lastName=" + lastName + ", email=" + email
+ "]";
}
}
| 1,502 | 0.676431 | 0.676431 | 76 | 17.763159 | 19.692951 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.434211 | false | false |
13
|
fa28402eddc7e39ad9681df1f1934ee0301c21af
| 32,143,535,267,641 |
9d3ee7f5b5a3f7ebd532a19e318937836a4d788c
|
/analysis/src/main/java/org/topnetwork/analysis/mq/AccountSyncConsumer.java
|
d10149a1356e73aec1244bd35efb3713d6f958da
|
[] |
no_license
|
telosprotocol/top-infura
|
https://github.com/telosprotocol/top-infura
|
fe93ffd0bb42e0bed8e6f9a311cf1534a8009f48
|
45b92b0a9a9ef649afe692bc342002b5fd50fa21
|
refs/heads/master
| 2023-04-22T04:12:12.180000 | 2021-04-10T01:31:18 | 2021-04-10T01:31:18 | 340,549,870 | 1 | 1 | null | false | 2021-04-30T09:20:03 | 2021-02-20T03:14:47 | 2021-04-19T05:43:21 | 2021-04-30T09:20:03 | 62 | 0 | 1 | 2 |
Java
| false | false |
package org.topnetwork.analysis.mq;
import org.apache.rocketmq.spring.annotation.MessageModel;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.topnetwork.analysis.service.AccountService;
@Component
@RocketMQMessageListener(topic = "${account.rocketmq.topic}", consumerGroup = "account225",
selectorExpression = "${account.rocketmq.tag}",messageModel = MessageModel.CLUSTERING)
public class AccountSyncConsumer implements RocketMQListener<String> {
protected final Logger LOGGER = LoggerFactory.getLogger(getClass());
@Autowired
private AccountService accountService;
@Override
public void onMessage(String accountAddress) {
LOGGER.info("receive account address..." + accountAddress);
try {
accountService.syncFormChain(accountAddress);
} catch (Exception e) {
LOGGER.error("handle account sync error, account address: " + accountAddress);
e.printStackTrace();
throw e;
}
}
}
|
UTF-8
|
Java
| 1,252 |
java
|
AccountSyncConsumer.java
|
Java
|
[] | null |
[] |
package org.topnetwork.analysis.mq;
import org.apache.rocketmq.spring.annotation.MessageModel;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.topnetwork.analysis.service.AccountService;
@Component
@RocketMQMessageListener(topic = "${account.rocketmq.topic}", consumerGroup = "account225",
selectorExpression = "${account.rocketmq.tag}",messageModel = MessageModel.CLUSTERING)
public class AccountSyncConsumer implements RocketMQListener<String> {
protected final Logger LOGGER = LoggerFactory.getLogger(getClass());
@Autowired
private AccountService accountService;
@Override
public void onMessage(String accountAddress) {
LOGGER.info("receive account address..." + accountAddress);
try {
accountService.syncFormChain(accountAddress);
} catch (Exception e) {
LOGGER.error("handle account sync error, account address: " + accountAddress);
e.printStackTrace();
throw e;
}
}
}
| 1,252 | 0.74361 | 0.739617 | 33 | 36.939392 | 29.47823 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.606061 | false | false |
13
|
024e317bff6aad33f0bb1e53a7a892784a57ae3c
| 28,716,151,344,926 |
2edd2ad9f99d948185cb985be493d261c1eced24
|
/src/main/java/week2/QuickSort.java
|
fe062e0b481a1575c6a8b54de73bc6970374b80d
|
[] |
no_license
|
gpletnev/ITMO_PADS
|
https://github.com/gpletnev/ITMO_PADS
|
bfdcbe405014c3469ed48ca4310e0da767b272b1
|
69021a778fb46a8c837db284c89ef32ca7d7cacb
|
refs/heads/master
| 2021-05-16T22:30:06.200000 | 2020-04-08T17:14:26 | 2020-04-08T17:15:44 | 250,496,184 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package week2;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;
public class QuickSort {
static int count = 0;
static void qsort(int[] a, int l, int r) {
int key = a[(r + l) / 2];
System.out.println("key = " + key);
int i = l;
int j = r;
do {
while (a[i] < key) {
i++;
count++;
}
while (key < a[j]) {
j--;
count++;
}
if (i <= j) {
// swap
int temp = a[i];
a[i] = a[j];
a[j] = temp;
i++;
j--;
}
} while (i <= j);
if (l < j)
qsort(a, l, j + 1);
if (i < r)
qsort(a, i, r);
}
static int[] anti_qsort(int n) {
int[] output = new int[n];
for (int i = 0; i < n; i++) {
output[i] = i + 1;
}
for (int i = 2; i < n; i++) {
int m = i / 2;
int temp = output[i];
output[i] = output[m];
output[m] = temp;
}
return output;
}
public static void main(String[] args) {
try {
File file = new File("input.txt");
Scanner scanner = new Scanner(file);
// 1<=n<=1000000
int n = scanner.nextInt();
System.out.println(n);
// int[] input = new int[n];
// for (int i = 1; i <= n; i++) {
// input[i] = scanner.nextInt();
// System.out.print(input[i] + " ");
// }
// System.out.println();
//
// qsort(input, 1, n);
int[] input = anti_qsort(n);
file = new File("output.txt");
FileWriter writer = new FileWriter(file);
for (int i = 0; i < n; i++) {
writer.append(input[i] + " ");
//System.out.print(input[i] + " ");
}
writer.flush();
writer.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
|
UTF-8
|
Java
| 2,193 |
java
|
QuickSort.java
|
Java
|
[] | null |
[] |
package week2;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;
public class QuickSort {
static int count = 0;
static void qsort(int[] a, int l, int r) {
int key = a[(r + l) / 2];
System.out.println("key = " + key);
int i = l;
int j = r;
do {
while (a[i] < key) {
i++;
count++;
}
while (key < a[j]) {
j--;
count++;
}
if (i <= j) {
// swap
int temp = a[i];
a[i] = a[j];
a[j] = temp;
i++;
j--;
}
} while (i <= j);
if (l < j)
qsort(a, l, j + 1);
if (i < r)
qsort(a, i, r);
}
static int[] anti_qsort(int n) {
int[] output = new int[n];
for (int i = 0; i < n; i++) {
output[i] = i + 1;
}
for (int i = 2; i < n; i++) {
int m = i / 2;
int temp = output[i];
output[i] = output[m];
output[m] = temp;
}
return output;
}
public static void main(String[] args) {
try {
File file = new File("input.txt");
Scanner scanner = new Scanner(file);
// 1<=n<=1000000
int n = scanner.nextInt();
System.out.println(n);
// int[] input = new int[n];
// for (int i = 1; i <= n; i++) {
// input[i] = scanner.nextInt();
// System.out.print(input[i] + " ");
// }
// System.out.println();
//
// qsort(input, 1, n);
int[] input = anti_qsort(n);
file = new File("output.txt");
FileWriter writer = new FileWriter(file);
for (int i = 0; i < n; i++) {
writer.append(input[i] + " ");
//System.out.print(input[i] + " ");
}
writer.flush();
writer.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
| 2,193 | 0.372093 | 0.363429 | 93 | 22.580645 | 15.364617 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false |
13
|
1ddb3ab7f5baa0440fb6599a47a05827cfb100b2
| 17,600,775,985,115 |
2a8cc7566b596691ade6d0377015ca17d28e56a9
|
/EDADS/src/main/java/StreamApprox/StreamApproxJob.java
|
6516fb68484c3e6df42634e40387873310d47584
|
[
"Apache-2.0"
] |
permissive
|
rudip7/scotty-window-processor
|
https://github.com/rudip7/scotty-window-processor
|
b3cddc66d33c4465a608d9250f5b61c7aef091db
|
92a3bf1b04f46d9b2f2b0e3978fb2cdf7b1a23cf
|
refs/heads/master
| 2021-07-09T23:28:27.396000 | 2020-11-13T17:05:14 | 2020-11-13T17:05:14 | 215,820,988 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package StreamApprox;
import Benchmark.ParallelThroughputLogger;
import Benchmark.Sources.NormalDistributionSource;
import Benchmark.Sources.UniformDistributionSource;
import Benchmark.Sources.ZipfDistributionSource;
import de.tub.dima.scotty.state.ValueState;
import org.apache.flink.api.common.functions.IterationRuntimeContext;
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.api.common.functions.RichMapFunction;
import org.apache.flink.api.common.functions.RuntimeContext;
import org.apache.flink.api.common.typeinfo.TypeHint;
import org.apache.flink.api.common.typeinfo.TypeInformation;
import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.api.java.tuple.Tuple3;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.streaming.api.TimeCharacteristic;
import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.datastream.SingleOutputStreamOperator;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.streaming.api.functions.AssignerWithPeriodicWatermarks;
import org.apache.flink.streaming.api.functions.sink.SinkFunction;
import org.apache.flink.streaming.api.watermark.Watermark;
import javax.annotation.Nullable;
import java.util.Collections;
import java.util.List;
import static org.apache.flink.streaming.api.windowing.time.Time.seconds;
public class StreamApproxJob {
public StreamApproxJob(ApproxConfiguration config, StreamExecutionEnvironment env, String configString){
StratifiedReservoirSampling oasrs = new StratifiedReservoirSampling(config.sampleSize);
List<Tuple2<Long, Long>> gaps = Collections.emptyList();
DataStreamSource<Tuple3<Integer, Integer, Long>> messageStream = null;
if (config.source == Source.Zipf){
messageStream = env.addSource(new ZipfDistributionSource(config.runtime, config.throughput, gaps));
}else if (config.source == Source.Uniform){
messageStream = env.addSource(new UniformDistributionSource(config.runtime, config.throughput, gaps));
}
messageStream.flatMap(new ParallelThroughputLogger<Tuple3<Integer, Integer, Long>>(1000, configString));
final SingleOutputStreamOperator<Tuple3<Integer, Integer, Long>> timestamped = messageStream
.assignTimestampsAndWatermarks(new TimestampsAndWatermarks());
// separate the values into groups
SingleOutputStreamOperator<Tuple2<Integer, Integer>> mapped = timestamped.map(new RichStratifier());
// build reservoir sample
SingleOutputStreamOperator<Tuple3<Integer, Integer, Double>> sampled = mapped.transform("sampling", TypeInformation.of(new TypeHint<Tuple3<Integer, Integer, Double>>() {
}), new Sampler<Tuple2<Integer, Integer>, Tuple3<Integer, Integer, Double>>(oasrs));
sampled.addSink(new SinkFunction<Tuple3<Integer, Integer, Double>>() {
@Override
public void invoke(Tuple3<Integer, Integer, Double> value, Context context) throws Exception {
}
});
try {
env.execute("StreamApprox-Job");
} catch (Exception e) {
e.printStackTrace();
}
}
public static class TimestampsAndWatermarks implements AssignerWithPeriodicWatermarks<Tuple3<Integer, Integer, Long>> {
private final long maxOutOfOrderness = seconds(20).toMilliseconds(); // 5 seconds
private long currentMaxTimestamp;
private long startTime = System.currentTimeMillis();
@Override
public long extractTimestamp(final Tuple3<Integer, Integer, Long> element, final long previousElementTimestamp) {
long timestamp = element.f2;
currentMaxTimestamp = Math.max(timestamp, currentMaxTimestamp);
return timestamp;
}
@Nullable
@Override
public Watermark getCurrentWatermark() {
return new Watermark(currentMaxTimestamp);
}
}
}
|
UTF-8
|
Java
| 4,115 |
java
|
StreamApproxJob.java
|
Java
|
[] | null |
[] |
package StreamApprox;
import Benchmark.ParallelThroughputLogger;
import Benchmark.Sources.NormalDistributionSource;
import Benchmark.Sources.UniformDistributionSource;
import Benchmark.Sources.ZipfDistributionSource;
import de.tub.dima.scotty.state.ValueState;
import org.apache.flink.api.common.functions.IterationRuntimeContext;
import org.apache.flink.api.common.functions.MapFunction;
import org.apache.flink.api.common.functions.RichMapFunction;
import org.apache.flink.api.common.functions.RuntimeContext;
import org.apache.flink.api.common.typeinfo.TypeHint;
import org.apache.flink.api.common.typeinfo.TypeInformation;
import org.apache.flink.api.java.tuple.Tuple2;
import org.apache.flink.api.java.tuple.Tuple3;
import org.apache.flink.configuration.Configuration;
import org.apache.flink.streaming.api.TimeCharacteristic;
import org.apache.flink.streaming.api.datastream.DataStream;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.datastream.SingleOutputStreamOperator;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
import org.apache.flink.streaming.api.functions.AssignerWithPeriodicWatermarks;
import org.apache.flink.streaming.api.functions.sink.SinkFunction;
import org.apache.flink.streaming.api.watermark.Watermark;
import javax.annotation.Nullable;
import java.util.Collections;
import java.util.List;
import static org.apache.flink.streaming.api.windowing.time.Time.seconds;
public class StreamApproxJob {
public StreamApproxJob(ApproxConfiguration config, StreamExecutionEnvironment env, String configString){
StratifiedReservoirSampling oasrs = new StratifiedReservoirSampling(config.sampleSize);
List<Tuple2<Long, Long>> gaps = Collections.emptyList();
DataStreamSource<Tuple3<Integer, Integer, Long>> messageStream = null;
if (config.source == Source.Zipf){
messageStream = env.addSource(new ZipfDistributionSource(config.runtime, config.throughput, gaps));
}else if (config.source == Source.Uniform){
messageStream = env.addSource(new UniformDistributionSource(config.runtime, config.throughput, gaps));
}
messageStream.flatMap(new ParallelThroughputLogger<Tuple3<Integer, Integer, Long>>(1000, configString));
final SingleOutputStreamOperator<Tuple3<Integer, Integer, Long>> timestamped = messageStream
.assignTimestampsAndWatermarks(new TimestampsAndWatermarks());
// separate the values into groups
SingleOutputStreamOperator<Tuple2<Integer, Integer>> mapped = timestamped.map(new RichStratifier());
// build reservoir sample
SingleOutputStreamOperator<Tuple3<Integer, Integer, Double>> sampled = mapped.transform("sampling", TypeInformation.of(new TypeHint<Tuple3<Integer, Integer, Double>>() {
}), new Sampler<Tuple2<Integer, Integer>, Tuple3<Integer, Integer, Double>>(oasrs));
sampled.addSink(new SinkFunction<Tuple3<Integer, Integer, Double>>() {
@Override
public void invoke(Tuple3<Integer, Integer, Double> value, Context context) throws Exception {
}
});
try {
env.execute("StreamApprox-Job");
} catch (Exception e) {
e.printStackTrace();
}
}
public static class TimestampsAndWatermarks implements AssignerWithPeriodicWatermarks<Tuple3<Integer, Integer, Long>> {
private final long maxOutOfOrderness = seconds(20).toMilliseconds(); // 5 seconds
private long currentMaxTimestamp;
private long startTime = System.currentTimeMillis();
@Override
public long extractTimestamp(final Tuple3<Integer, Integer, Long> element, final long previousElementTimestamp) {
long timestamp = element.f2;
currentMaxTimestamp = Math.max(timestamp, currentMaxTimestamp);
return timestamp;
}
@Nullable
@Override
public Watermark getCurrentWatermark() {
return new Watermark(currentMaxTimestamp);
}
}
}
| 4,115 | 0.744107 | 0.738518 | 98 | 40.989796 | 38.348961 | 177 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.836735 | false | false |
13
|
b4ec828cf9eaac63fecb9a9ae8c4722b40b8377b
| 17,600,775,987,952 |
e2b534588a3337b2a0f8660c8122a6dd3de26528
|
/cosoSueldos/src/cososueldos/horasfinal.java
|
cccba19f20f47e44971660220800b467d6b55002
|
[] |
no_license
|
deive1993/proyectos-java
|
https://github.com/deive1993/proyectos-java
|
9b25a5288f38bc328e54deaa5a26f3fa2f3b7eaa
|
02983301aff871eb6d4a1a8ca2a945fc7682763b
|
refs/heads/master
| 2021-08-23T17:50:10.652000 | 2017-12-05T23:40:55 | 2017-12-05T23:40:55 | 113,244,809 | 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 cososueldos;
/**
*
* @author PC16
*/
public class horasfinal {
public int totalhoras;
public int totalhorasextras;
public int totalhorasfinal;
public int canthorasextras;
public int getTotalhoras() {
return totalhoras;
}
public void setTotalhoras(int totalhoras) {
this.totalhoras = totalhoras;
}
public int getTotalhorasextras() {
return totalhorasextras;
}
public void setTotalhorasextras(int totalhorasextras) {
this.totalhorasextras = totalhorasextras;
}
public int getTotalhorasfinal() {
return totalhorasfinal;
}
public void setTotalhorasfinal(int totalhorasfinal) {
this.totalhorasfinal = totalhorasfinal;
}
public void horastrabajadas (int horas){
if (horas> 160) {
this.canthorasextras = horas - 160;
System.out.println(canthorasextras);
this.totalhorasextras = canthorasextras * 150;
this.totalhoras = 160 * 120;
} else {
}
this.totalhorasfinal = (this.totalhoras + this.totalhorasextras);
System.out.println(this.totalhorasfinal);
}
}
|
UTF-8
|
Java
| 1,610 |
java
|
horasfinal.java
|
Java
|
[
{
"context": "ditor.\n */\npackage cososueldos;\n\n/**\n *\n * @author PC16\n */\npublic class horasfinal {\n \n public int",
"end": 229,
"score": 0.9996024966239929,
"start": 225,
"tag": "USERNAME",
"value": "PC16"
}
] | 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 cososueldos;
/**
*
* @author PC16
*/
public class horasfinal {
public int totalhoras;
public int totalhorasextras;
public int totalhorasfinal;
public int canthorasextras;
public int getTotalhoras() {
return totalhoras;
}
public void setTotalhoras(int totalhoras) {
this.totalhoras = totalhoras;
}
public int getTotalhorasextras() {
return totalhorasextras;
}
public void setTotalhorasextras(int totalhorasextras) {
this.totalhorasextras = totalhorasextras;
}
public int getTotalhorasfinal() {
return totalhorasfinal;
}
public void setTotalhorasfinal(int totalhorasfinal) {
this.totalhorasfinal = totalhorasfinal;
}
public void horastrabajadas (int horas){
if (horas> 160) {
this.canthorasextras = horas - 160;
System.out.println(canthorasextras);
this.totalhorasextras = canthorasextras * 150;
this.totalhoras = 160 * 120;
} else {
}
this.totalhorasfinal = (this.totalhoras + this.totalhorasextras);
System.out.println(this.totalhorasfinal);
}
}
| 1,610 | 0.552174 | 0.541615 | 84 | 18.154762 | 19.325836 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.238095 | false | false |
13
|
c0c9124f988b676f393a9273ab01aa9d3bfae373
| 3,951,369,940,539 |
dcbfe972e35c3a1f041bbe3054bcdc549ff44f65
|
/src/main/java/com/yysj/bangtang/myenum/OperationStatus.java
|
0d0175130905c36c6c59e2ea811eb8f089ed6448
|
[] |
no_license
|
zlserver/bangtang
|
https://github.com/zlserver/bangtang
|
ecd83ed5f7f040b12b6a3a5265eea5bd4af4f28b
|
880147ffaae52831817b7546be6e7d7506c55519
|
refs/heads/master
| 2020-04-06T06:59:09.987000 | 2016-08-27T14:20:34 | 2016-08-27T14:20:34 | 56,689,405 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.yysj.bangtang.myenum;
/**
* 移动端此次操作的状态说明
* @author xcitie
*
*/
public enum OperationStatus {
UNKNOW_EXCEPTION(0,"未知异常"),
SUCCESS(1,"操作成功"),
PARAM_ERROR(2,"请求参数不完整"),
CLIENT_EMAIL_PASS_ERROR(1001,"邮箱格式或者密码有误"),
CLIENT_EMAIL_EXIST(1002,"邮箱已被注册"),
CLIENT_EDIT_PIC_ERROR(1003,"修改用户头像出错"),
CLIENT_EMAIL_INVALIDATE(1004,"邮箱无效"),
CLIENT_RESETCODE_INVALIDATE(1005,"重置码无效"),
CLIENT_PASSWORD_INVALIDATE(1006,"密码不满足要求"),
TOKEN_UNACCORDANCE(2001,"token值不一致"),
IMAGE_TYPE_ERROR(3001,"图片格式有误!"),
IMAGE_COUNT_OUTLIMIT(3002,"图片数量超出了限制!"),
CONTENT_NO_EXIST(4000,"动态不存在!");
private final int status;
private final String message;
private OperationStatus(int status,String message) {
this.message = message;
this.status =status;
}
public String getMessage() {
return message;
}
public int getStatus() {
return status;
}
}
|
UTF-8
|
Java
| 1,095 |
java
|
OperationStatus.java
|
Java
|
[
{
"context": "ngtang.myenum;\r\n\r\n/**\r\n * 移动端此次操作的状态说明\r\n * @author xcitie\r\n *\r\n */\r\npublic enum OperationStatus {\r\n\r\n\tUNKNO",
"end": 76,
"score": 0.9996092915534973,
"start": 70,
"tag": "USERNAME",
"value": "xcitie"
}
] | null |
[] |
package com.yysj.bangtang.myenum;
/**
* 移动端此次操作的状态说明
* @author xcitie
*
*/
public enum OperationStatus {
UNKNOW_EXCEPTION(0,"未知异常"),
SUCCESS(1,"操作成功"),
PARAM_ERROR(2,"请求参数不完整"),
CLIENT_EMAIL_PASS_ERROR(1001,"邮箱格式或者密码有误"),
CLIENT_EMAIL_EXIST(1002,"邮箱已被注册"),
CLIENT_EDIT_PIC_ERROR(1003,"修改用户头像出错"),
CLIENT_EMAIL_INVALIDATE(1004,"邮箱无效"),
CLIENT_RESETCODE_INVALIDATE(1005,"重置码无效"),
CLIENT_PASSWORD_INVALIDATE(1006,"密码不满足要求"),
TOKEN_UNACCORDANCE(2001,"token值不一致"),
IMAGE_TYPE_ERROR(3001,"图片格式有误!"),
IMAGE_COUNT_OUTLIMIT(3002,"图片数量超出了限制!"),
CONTENT_NO_EXIST(4000,"动态不存在!");
private final int status;
private final String message;
private OperationStatus(int status,String message) {
this.message = message;
this.status =status;
}
public String getMessage() {
return message;
}
public int getStatus() {
return status;
}
}
| 1,095 | 0.673267 | 0.625963 | 44 | 18.65909 | 16.412222 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.568182 | false | false |
13
|
06c9e2ffc9ac67d37324fa861099c6886895076d
| 20,340,965,124,232 |
37fe7ad3cc384fda4e1241e75235f28fbd3c80c0
|
/Toy Language Interpreter + Lock Mechanism/src/Model/Values/ReferenceValue.java
|
8d793956166b5a180f582b1d11614572bf6e73a9
|
[] |
no_license
|
giurgiumatei/Methods-of-Advanced-Programming
|
https://github.com/giurgiumatei/Methods-of-Advanced-Programming
|
7a4bfe447d023210504a92033d921d3945738df9
|
82beb4149a27827a6d87001292dc9c35e215b2aa
|
refs/heads/main
| 2023-03-07T01:41:18.033000 | 2021-02-19T15:10:17 | 2021-02-19T15:10:17 | 328,029,306 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package Model.Values;
import Model.Types.ReferenceType;
import Model.Types.Type;
public class ReferenceValue implements Value
{
int address;
Type location_type;
public ReferenceValue(int address, Type location_type)
{
this.address = address;
this.location_type = location_type;
}
@Override
public Type get_type()
{
return new ReferenceType(this.location_type);
}
@Override
public Value clone()
{
return new ReferenceValue(this.address,this.location_type);
}
public int get_address()
{
return address;
}
public Type get_location_type()
{
return location_type;
}
public String toString()
{
return "( " + this.address + ", " + location_type.toString()+ " )";
}
}
|
UTF-8
|
Java
| 861 |
java
|
ReferenceValue.java
|
Java
|
[] | null |
[] |
package Model.Values;
import Model.Types.ReferenceType;
import Model.Types.Type;
public class ReferenceValue implements Value
{
int address;
Type location_type;
public ReferenceValue(int address, Type location_type)
{
this.address = address;
this.location_type = location_type;
}
@Override
public Type get_type()
{
return new ReferenceType(this.location_type);
}
@Override
public Value clone()
{
return new ReferenceValue(this.address,this.location_type);
}
public int get_address()
{
return address;
}
public Type get_location_type()
{
return location_type;
}
public String toString()
{
return "( " + this.address + ", " + location_type.toString()+ " )";
}
}
| 861 | 0.573751 | 0.573751 | 46 | 16.717392 | 19.293684 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.326087 | false | false |
13
|
42a2933e45ae9aa99294bb816660ceb13be99037
| 1,786,706,411,653 |
3429a7f70f1e5560d7703c1c50cb57fe49da40b1
|
/group25cs230a2/group25cs230a2/src/cells/TokenDoor.java
|
e4100394f118f9f5bb3af3f640c84cd4b7149f3a
|
[] |
no_license
|
matthewculley/group25cs230a2
|
https://github.com/matthewculley/group25cs230a2
|
babcbf73e057fce5db05d8dca08dc23543b13a55
|
6379d60ec8f5fcca8278f725c1335c774d715c50
|
refs/heads/master
| 2020-09-08T17:25:53.111000 | 2019-12-09T03:04:06 | 2019-12-09T03:04:06 | 221,194,495 | 0 | 0 | null | false | 2019-12-08T03:53:25 | 2019-11-12T10:47:39 | 2019-12-08T03:51:11 | 2019-12-08T03:53:24 | 4,617 | 0 | 0 | 0 |
Java
| false | false |
package cells;
/**
* A class that defines TokenDoor.
* @author alan
* @version 1.4
*/
public class TokenDoor extends Cell {
private int tokenReq;
/**
* Constructs the TokenDoor with the image name and passable.
* @param tokens The required tokens to unlock the door.
*/
public TokenDoor(int tokens) {
super("tokenDoor.png", false);
tokenReq = tokens;
}
/**
* Constructs the TokenDoor without the required tokens.
*/
public TokenDoor() {
super("tokenDoor.png", false);
}
/**
* Get the required tokens.
* @return Amount of token required.
*/
public int getNeededTokens() {
return tokenReq;
}
/**
* Overrides the method getCellName.
* @return The cell name: door:token and the required tokens.
*/
@Override
public String getCellName() {
return "door:token:" + getNeededTokens();
}
}
|
UTF-8
|
Java
| 850 |
java
|
TokenDoor.java
|
Java
|
[
{
"context": "\n/**\n * A class that defines TokenDoor.\n * @author alan\n * @version 1.4\n */\n\npublic class TokenDoor exten",
"end": 70,
"score": 0.9804729223251343,
"start": 66,
"tag": "USERNAME",
"value": "alan"
}
] | null |
[] |
package cells;
/**
* A class that defines TokenDoor.
* @author alan
* @version 1.4
*/
public class TokenDoor extends Cell {
private int tokenReq;
/**
* Constructs the TokenDoor with the image name and passable.
* @param tokens The required tokens to unlock the door.
*/
public TokenDoor(int tokens) {
super("tokenDoor.png", false);
tokenReq = tokens;
}
/**
* Constructs the TokenDoor without the required tokens.
*/
public TokenDoor() {
super("tokenDoor.png", false);
}
/**
* Get the required tokens.
* @return Amount of token required.
*/
public int getNeededTokens() {
return tokenReq;
}
/**
* Overrides the method getCellName.
* @return The cell name: door:token and the required tokens.
*/
@Override
public String getCellName() {
return "door:token:" + getNeededTokens();
}
}
| 850 | 0.661176 | 0.658824 | 45 | 17.888889 | 18.758373 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.022222 | false | false |
13
|
b9e2b1c710a589427c7727c3cfba0c1f38e259c3
| 35,742,717,860,088 |
90c00a568b7d2f1105b31bfcb1dd772bfbdea07a
|
/app/src/main/java/com/example/user/recyclerviewcardview/MainActivity.java
|
8dd18ba5f3266ce4fdab07eab9287524fe044ecc
|
[] |
no_license
|
SaulRiglez/RecyclerviewCardview
|
https://github.com/SaulRiglez/RecyclerviewCardview
|
5999bd521c99feccf99fae05a9c656dc9b14e2f4
|
66019c3fec0f469ea661b94193d27160593e1b45
|
refs/heads/master
| 2021-01-19T21:47:58.231000 | 2017-02-20T08:45:52 | 2017-02-20T08:45:52 | 82,534,678 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.user.recyclerviewcardview;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.StaggeredGridLayoutManager;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
public class MainActivity extends AppCompatActivity {
RecyclerView myRecycler;
MyCustomAdapter myAdapter;
//Just Testing
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
myRecycler = ((RecyclerView) findViewById(R.id.recyclerView));
myAdapter = new MyCustomAdapter(this, Data.getData());
myRecycler.setAdapter(myAdapter);
myRecycler.setLayoutManager(new LinearLayoutManager(this)); // Vertical Orientation By Default
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
switch (id) {
case R.id.linearViewHorizontal:
LinearLayoutManager mLinearManagerHorizontal = new LinearLayoutManager(this);
mLinearManagerHorizontal.setOrientation(LinearLayoutManager.HORIZONTAL);
myRecycler.setLayoutManager(mLinearManagerHorizontal);
break;
case R.id.linearViewVertical:
LinearLayoutManager mLinearManagerVertical = new LinearLayoutManager(this);
mLinearManagerVertical.setOrientation(LinearLayoutManager.VERTICAL);
myRecycler.setLayoutManager(mLinearManagerVertical);
break;
case R.id.gridView:
GridLayoutManager mGridManagerGrid = new GridLayoutManager(this,4);
myRecycler.setLayoutManager(mGridManagerGrid);
break;
case R.id.staggerViewVertical:
StaggeredGridLayoutManager mStaggeredManagerVertical = new StaggeredGridLayoutManager(2,StaggeredGridLayoutManager.VERTICAL);
mStaggeredManagerVertical.setOrientation(mStaggeredManagerVertical.VERTICAL);
myRecycler.setLayoutManager(mStaggeredManagerVertical);
break;
case R.id.staggerViewHorizontal:
StaggeredGridLayoutManager mStaggeredManagerHorizontal = new StaggeredGridLayoutManager(2,StaggeredGridLayoutManager.HORIZONTAL);
mStaggeredManagerHorizontal.setOrientation(mStaggeredManagerHorizontal.HORIZONTAL);
myRecycler.setLayoutManager(mStaggeredManagerHorizontal);
break;
}
return super.onOptionsItemSelected(item);
}
}
|
UTF-8
|
Java
| 3,291 |
java
|
MainActivity.java
|
Java
|
[] | null |
[] |
package com.example.user.recyclerviewcardview;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.StaggeredGridLayoutManager;
import android.support.v7.widget.Toolbar;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
public class MainActivity extends AppCompatActivity {
RecyclerView myRecycler;
MyCustomAdapter myAdapter;
//Just Testing
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
myRecycler = ((RecyclerView) findViewById(R.id.recyclerView));
myAdapter = new MyCustomAdapter(this, Data.getData());
myRecycler.setAdapter(myAdapter);
myRecycler.setLayoutManager(new LinearLayoutManager(this)); // Vertical Orientation By Default
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent activity in AndroidManifest.xml.
int id = item.getItemId();
switch (id) {
case R.id.linearViewHorizontal:
LinearLayoutManager mLinearManagerHorizontal = new LinearLayoutManager(this);
mLinearManagerHorizontal.setOrientation(LinearLayoutManager.HORIZONTAL);
myRecycler.setLayoutManager(mLinearManagerHorizontal);
break;
case R.id.linearViewVertical:
LinearLayoutManager mLinearManagerVertical = new LinearLayoutManager(this);
mLinearManagerVertical.setOrientation(LinearLayoutManager.VERTICAL);
myRecycler.setLayoutManager(mLinearManagerVertical);
break;
case R.id.gridView:
GridLayoutManager mGridManagerGrid = new GridLayoutManager(this,4);
myRecycler.setLayoutManager(mGridManagerGrid);
break;
case R.id.staggerViewVertical:
StaggeredGridLayoutManager mStaggeredManagerVertical = new StaggeredGridLayoutManager(2,StaggeredGridLayoutManager.VERTICAL);
mStaggeredManagerVertical.setOrientation(mStaggeredManagerVertical.VERTICAL);
myRecycler.setLayoutManager(mStaggeredManagerVertical);
break;
case R.id.staggerViewHorizontal:
StaggeredGridLayoutManager mStaggeredManagerHorizontal = new StaggeredGridLayoutManager(2,StaggeredGridLayoutManager.HORIZONTAL);
mStaggeredManagerHorizontal.setOrientation(mStaggeredManagerHorizontal.HORIZONTAL);
myRecycler.setLayoutManager(mStaggeredManagerHorizontal);
break;
}
return super.onOptionsItemSelected(item);
}
}
| 3,291 | 0.704345 | 0.70161 | 84 | 38.17857 | 33.973083 | 145 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.583333 | false | false |
13
|
d8decf8b0d6a8f4a2626009813a8e2ff6ea5b8f3
| 35,948,876,295,546 |
66f384fce7a6ef50293eaf9ed36303e85c9c9ba9
|
/src/component/bullet/BulletRight.java
|
fe58ef937ea9bfc43d7ecd3602cdcce5c93ad4f5
|
[] |
no_license
|
LucasCasa/FlappyPOO
|
https://github.com/LucasCasa/FlappyPOO
|
3c19210c75abc8a7d60646a9194f186efbf0a621
|
1c08e0845fd580f1e8a5867610eb98f27255f93f
|
refs/heads/master
| 2021-06-27T02:59:58.825000 | 2017-09-15T21:36:10 | 2017-09-15T21:36:10 | 103,324,996 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package component.bullet;
public class BulletRight extends Bullet{
public BulletRight(float x, float y, float speed) {
super(x, y, speed);
}
}
|
UTF-8
|
Java
| 150 |
java
|
BulletRight.java
|
Java
|
[] | null |
[] |
package component.bullet;
public class BulletRight extends Bullet{
public BulletRight(float x, float y, float speed) {
super(x, y, speed);
}
}
| 150 | 0.72 | 0.72 | 9 | 15.666667 | 18.755739 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.111111 | false | false |
13
|
a1a99c97a82ae9c4bec67259c88a4ab142c2a552
| 2,671,469,661,123 |
62c9520588e2ca8e6787dfd10add036091588b64
|
/src/test/java/aslib/document/bra/CPFTest.java
|
df6c94fb46ff1cfd309fe72eeb220b00fc2e18e8
|
[
"MIT"
] |
permissive
|
AdrianoSiqueira/ASLib
|
https://github.com/AdrianoSiqueira/ASLib
|
00702dba2f80693cbbb4f630a7e306d61ab43f6b
|
9986e99bd5d6190ecc49a7aa131380f5b5ffa16a
|
refs/heads/master
| 2022-11-06T16:38:07.650000 | 2022-10-11T23:28:34 | 2022-10-11T23:28:34 | 166,410,558 | 2 | 0 | null | false | 2022-09-18T23:01:20 | 2019-01-18T13:37:45 | 2022-09-18T22:37:11 | 2022-09-18T23:01:19 | 2,097 | 0 | 0 | 0 |
Java
| false | false |
package aslib.document.bra;
import aslib.document.Document;
import aslib.document.NullDocumentException;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* <p style="text-align:justify">
* Tests for the {@link CPF} class.
* </p>
*
* @author Adriano Siqueira
* @version 1.0.2
* @since 12.0.0
*/
class CPFTest {
private final Document document = BrazilianDocument.cpf();
@Test
@DisplayName("Format: Returns '011.111.111/11' when value is '111.111.111/1'")
void format_0() {
assertEquals("011.111.111/11", document.format("111.111.111/1"));
}
@Test
@DisplayName("Format: Returns '111.111.111/11' when value is '111.111.111/111'")
void format_1() {
assertEquals("111.111.111/11", document.format("111.111.111/111"));
}
@Test
@DisplayName("Format: Returns '111.111.111/11' when value is '11111111111'")
void format_2() {
assertEquals("111.111.111/11", document.format("11111111111"));
}
@Test
@DisplayName("Format: Throws 'NullDocumentException' when value is null")
void format_3() {
assertThrows(NullDocumentException.class, () -> document.format(null));
}
@Test
@DisplayName("Generate: Returns new valid document when successful")
void generate_0() {
assertTrue(document.isValid(document.generate()));
}
@Test
@DisplayName("IsValid: Returns 'false' when value is '106.694.192/07'")
void isValid_0() {
assertFalse(document.isValid("106.694.192/07"));
}
@Test
@DisplayName("IsValid: Returns 'true' when value is '106.694.192/06'")
void isValid_1() {
assertTrue(document.isValid("106.694.192/06"));
}
@Test
@DisplayName("IsValid: Throws 'NullDocumentException' when value is null")
void isValid_2() {
assertThrows(NullDocumentException.class, () -> document.isValid(null));
}
}
|
UTF-8
|
Java
| 2,162 |
java
|
CPFTest.java
|
Java
|
[
{
"context": "s for the {@link CPF} class.\n * </p>\n *\n * @author Adriano Siqueira\n * @version 1.0.2\n * @since 12.0.0\n */\nclass CPFT",
"end": 538,
"score": 0.9998903274536133,
"start": 522,
"tag": "NAME",
"value": "Adriano Siqueira"
}
] | null |
[] |
package aslib.document.bra;
import aslib.document.Document;
import aslib.document.NullDocumentException;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* <p style="text-align:justify">
* Tests for the {@link CPF} class.
* </p>
*
* @author <NAME>
* @version 1.0.2
* @since 12.0.0
*/
class CPFTest {
private final Document document = BrazilianDocument.cpf();
@Test
@DisplayName("Format: Returns '011.111.111/11' when value is '111.111.111/1'")
void format_0() {
assertEquals("011.111.111/11", document.format("111.111.111/1"));
}
@Test
@DisplayName("Format: Returns '111.111.111/11' when value is '111.111.111/111'")
void format_1() {
assertEquals("111.111.111/11", document.format("111.111.111/111"));
}
@Test
@DisplayName("Format: Returns '111.111.111/11' when value is '11111111111'")
void format_2() {
assertEquals("111.111.111/11", document.format("11111111111"));
}
@Test
@DisplayName("Format: Throws 'NullDocumentException' when value is null")
void format_3() {
assertThrows(NullDocumentException.class, () -> document.format(null));
}
@Test
@DisplayName("Generate: Returns new valid document when successful")
void generate_0() {
assertTrue(document.isValid(document.generate()));
}
@Test
@DisplayName("IsValid: Returns 'false' when value is '106.694.192/07'")
void isValid_0() {
assertFalse(document.isValid("106.694.192/07"));
}
@Test
@DisplayName("IsValid: Returns 'true' when value is '106.694.192/06'")
void isValid_1() {
assertTrue(document.isValid("106.694.192/06"));
}
@Test
@DisplayName("IsValid: Throws 'NullDocumentException' when value is null")
void isValid_2() {
assertThrows(NullDocumentException.class, () -> document.isValid(null));
}
}
| 2,152 | 0.670213 | 0.581869 | 73 | 28.616438 | 28.594774 | 84 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.315068 | false | false |
13
|
2802457db8a77f78a22132b18879e5d1859b90a9
| 36,807,869,736,087 |
336f981d744e42bb8657d952248859e0030e6eb7
|
/FanXingTest/src/com/taylor/test/tong_pei_fu_xingcan/Circle.java
|
1e4a6bc19c059b895a998f52e4895acd62bd6ce9
|
[] |
no_license
|
RunningShadow-007/WorkCodes
|
https://github.com/RunningShadow-007/WorkCodes
|
5510c8fc3a0f03fb1e2b858fc6524ba9254167e2
|
97883e1cf8a1cff9128d6934c714ab508798bed6
|
refs/heads/master
| 2018-01-08T06:52:11.053000 | 2016-02-26T02:41:22 | 2016-02-26T02:41:22 | 51,811,470 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.taylor.test.tong_pei_fu_xingcan;
public class Circle extends Shape
{
@Override
public void draw (Canvas c)
{
System.out.println ("在画布"+c+"上画了一个圆!");
}
}
|
GB18030
|
Java
| 192 |
java
|
Circle.java
|
Java
|
[] | null |
[] |
package com.taylor.test.tong_pei_fu_xingcan;
public class Circle extends Shape
{
@Override
public void draw (Canvas c)
{
System.out.println ("在画布"+c+"上画了一个圆!");
}
}
| 192 | 0.689655 | 0.689655 | 12 | 13.5 | 16.864656 | 44 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false |
13
|
b6288f32beabf6dbe36e652878fa60d1eed083ed
| 36,696,200,591,856 |
acec495decfe628f9e7577a62eb1235730cb7afb
|
/Library-Management-System-master/src/windows/manager/ModifyBookUI.java
|
4b4fa7d137ad181c513d58b6c535d6fa6930ab57
|
[] |
no_license
|
salma-abd-elaziz/Library-Management-System
|
https://github.com/salma-abd-elaziz/Library-Management-System
|
028b37fd6b5cef86b14cd65fb1f21472c43476a5
|
849e048c828fb0adab7ff0eb85385506092894f1
|
refs/heads/master
| 2021-01-20T14:59:29.889000 | 2017-09-18T18:56:20 | 2017-09-18T18:56:20 | 90,701,517 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package windows.manager;
import driver.Engine;
import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.table.DefaultTableModel;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* Created by mirnafayez on 03/05/17.
*/
public class ModifyBookUI extends JFrame{
ModifyBookController modifyBookController ;
protected Container modifyingContent;
JTable table;
protected JPanel modifyBookPanel;
protected JTextField ISBN_num;
public ModifyBookUI() {
/* this */
super("MODIFY BOOK IN STORE");
this.setVisible(true);
modifyingContent = this.getContentPane();
this.setSize(Engine.WINDOW_WIDTH, Engine.WINDOW_HEIGHT);
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
/*Panel */
modifyBookPanel = new JPanel();
modifyBookPanel.setPreferredSize((Dimension) new Dimension(Engine.WINDOW_WIDTH, Engine.WINDOW_HEIGHT));
modifyBookPanel.setLayout(null);
/* Scroll Pane*/
JScrollPane scrollPane = new JScrollPane();
modifyBookPanel.add(scrollPane);
/* Table*/
table = new JTable();
DefaultTableModel model =(DefaultTableModel) table.getModel();
model.setColumnIdentifiers(new Object[]{ "ISBN","TITLE","Publisher","Prod_year","Price","Category","Copies_num","Min_copies"});//menna
ResultSet rs=null;
try {
rs = Engine.STATEMENT.executeQuery("SELECT * FROM BOOK ");
while (rs.next()){
model.insertRow(table.getRowCount(), new Object[]{ rs.getString("ISBN"),rs.getString("Title"),
rs.getString("Publisher"),rs.getString("Prod_year"),rs.getString("Price"),
rs.getString("Category"),rs.getString("Copies_num"),rs.getString("Min_copies")}); //-------menna
}
} catch (SQLException e1) {
// msg box ;
JOptionPane.showMessageDialog(null, "Book store has no books to modify", "InfoBox: " + "No Books Message", JOptionPane.INFORMATION_MESSAGE);
this.dispose();
}
table.setEnabled(false);
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
// add table to Scrollpane
scrollPane.setViewportView(table);
scrollPane.setBounds(5, 5,Engine.WINDOW_WIDTH-50, Engine.WINDOW_HEIGHT-100);
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
table.setBackground(Color.WHITE);
/**/
JButton startModifyBtn = new JButton("Modify this BOOK");
startModifyBtn.setBounds(Engine.WINDOW_WIDTH -300, Engine.WINDOW_HEIGHT-80, 186, 25);
modifyBookPanel.add(startModifyBtn);
/**/
ISBN_num= new JTextField();
ISBN_num.setBounds(200, Engine.WINDOW_HEIGHT-80, 186, 25);
modifyBookPanel.add(ISBN_num);
this.getContentPane().add(modifyBookPanel, BorderLayout.NORTH);
modifyBookController = new ModifyBookController(this);
startModifyBtn.addActionListener(modifyBookController.getStartModifyingBtnListener());
}
protected void modifying(String ISBN){ /// to be rename
String selectQuery= "SELECT * FROM BOOK WHERE ISBN=book_ISBN";
String getAuthorsQuery="SELECT Author_name from AUTHOR WHERE ISBN = book_ISBN ";
selectQuery=selectQuery.replace("book_ISBN", ISBN);
getAuthorsQuery=getAuthorsQuery.replace("book_ISBN", ISBN);
ResultSet rs2= null;
String authors="";
try {
rs2=Engine.STATEMENT.executeQuery(selectQuery);
rs2.next();
BookInfoForm bf = new BookInfoForm();
modifyingContent.add(bf);
bf.ISBN_v.setText(rs2.getString("ISBN"));
bf.titleTF.setText(rs2.getString("Title"));
bf.publisherTF.setText(rs2.getString("Publisher"));
bf.prodYearTF.setText(rs2.getString("Prod_year"));
bf.priceTF.setText(rs2.getString("Price"));
bf.categoryCB.setSelectedItem(rs2.getString("Category"));
bf.copiesNumTF.setText(rs2.getString("Copies_num"));
bf.minCopiesTF.setText(rs2.getString("Min_copies"));
rs2=Engine.STATEMENT.executeQuery(getAuthorsQuery);
while (rs2.next()){
authors +=rs2.getString("Author_name");
authors+= ",";
}
if(authors.length()>0) { //-------------------------------------------------------------------------------------->
authors = authors.substring(0, authors.length() - 1);
bf.authorsTF.setText(authors);
}
ModifyBookController.updateBookBtnListener ac=(ModifyBookController.updateBookBtnListener)modifyBookController.getUpdateBookBtnListener();
bf.okBtn.addActionListener(ac);
ac.setISBN(ISBN,bf);
} catch (SQLException e1) {
if (e1.getErrorCode() == 1054) { //------------> wrong type + FK
String l = e1.getMessage().replace("Unknown column ", "");
l = l.replace(" in 'field list'", "");
} else if (e1.getErrorCode() == 1452) {
} else {
}
}
}
}
|
UTF-8
|
Java
| 5,393 |
java
|
ModifyBookUI.java
|
Java
|
[
{
"context": ";\nimport java.sql.SQLException;\n\n/**\n * Created by mirnafayez on 03/05/17.\n */\npublic class ModifyBookUI extend",
"end": 383,
"score": 0.9996868968009949,
"start": 373,
"tag": "USERNAME",
"value": "mirnafayez"
}
] | null |
[] |
package windows.manager;
import driver.Engine;
import javax.swing.*;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
import javax.swing.table.DefaultTableModel;
import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* Created by mirnafayez on 03/05/17.
*/
public class ModifyBookUI extends JFrame{
ModifyBookController modifyBookController ;
protected Container modifyingContent;
JTable table;
protected JPanel modifyBookPanel;
protected JTextField ISBN_num;
public ModifyBookUI() {
/* this */
super("MODIFY BOOK IN STORE");
this.setVisible(true);
modifyingContent = this.getContentPane();
this.setSize(Engine.WINDOW_WIDTH, Engine.WINDOW_HEIGHT);
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
/*Panel */
modifyBookPanel = new JPanel();
modifyBookPanel.setPreferredSize((Dimension) new Dimension(Engine.WINDOW_WIDTH, Engine.WINDOW_HEIGHT));
modifyBookPanel.setLayout(null);
/* Scroll Pane*/
JScrollPane scrollPane = new JScrollPane();
modifyBookPanel.add(scrollPane);
/* Table*/
table = new JTable();
DefaultTableModel model =(DefaultTableModel) table.getModel();
model.setColumnIdentifiers(new Object[]{ "ISBN","TITLE","Publisher","Prod_year","Price","Category","Copies_num","Min_copies"});//menna
ResultSet rs=null;
try {
rs = Engine.STATEMENT.executeQuery("SELECT * FROM BOOK ");
while (rs.next()){
model.insertRow(table.getRowCount(), new Object[]{ rs.getString("ISBN"),rs.getString("Title"),
rs.getString("Publisher"),rs.getString("Prod_year"),rs.getString("Price"),
rs.getString("Category"),rs.getString("Copies_num"),rs.getString("Min_copies")}); //-------menna
}
} catch (SQLException e1) {
// msg box ;
JOptionPane.showMessageDialog(null, "Book store has no books to modify", "InfoBox: " + "No Books Message", JOptionPane.INFORMATION_MESSAGE);
this.dispose();
}
table.setEnabled(false);
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
// add table to Scrollpane
scrollPane.setViewportView(table);
scrollPane.setBounds(5, 5,Engine.WINDOW_WIDTH-50, Engine.WINDOW_HEIGHT-100);
table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
table.setBackground(Color.WHITE);
/**/
JButton startModifyBtn = new JButton("Modify this BOOK");
startModifyBtn.setBounds(Engine.WINDOW_WIDTH -300, Engine.WINDOW_HEIGHT-80, 186, 25);
modifyBookPanel.add(startModifyBtn);
/**/
ISBN_num= new JTextField();
ISBN_num.setBounds(200, Engine.WINDOW_HEIGHT-80, 186, 25);
modifyBookPanel.add(ISBN_num);
this.getContentPane().add(modifyBookPanel, BorderLayout.NORTH);
modifyBookController = new ModifyBookController(this);
startModifyBtn.addActionListener(modifyBookController.getStartModifyingBtnListener());
}
protected void modifying(String ISBN){ /// to be rename
String selectQuery= "SELECT * FROM BOOK WHERE ISBN=book_ISBN";
String getAuthorsQuery="SELECT Author_name from AUTHOR WHERE ISBN = book_ISBN ";
selectQuery=selectQuery.replace("book_ISBN", ISBN);
getAuthorsQuery=getAuthorsQuery.replace("book_ISBN", ISBN);
ResultSet rs2= null;
String authors="";
try {
rs2=Engine.STATEMENT.executeQuery(selectQuery);
rs2.next();
BookInfoForm bf = new BookInfoForm();
modifyingContent.add(bf);
bf.ISBN_v.setText(rs2.getString("ISBN"));
bf.titleTF.setText(rs2.getString("Title"));
bf.publisherTF.setText(rs2.getString("Publisher"));
bf.prodYearTF.setText(rs2.getString("Prod_year"));
bf.priceTF.setText(rs2.getString("Price"));
bf.categoryCB.setSelectedItem(rs2.getString("Category"));
bf.copiesNumTF.setText(rs2.getString("Copies_num"));
bf.minCopiesTF.setText(rs2.getString("Min_copies"));
rs2=Engine.STATEMENT.executeQuery(getAuthorsQuery);
while (rs2.next()){
authors +=rs2.getString("Author_name");
authors+= ",";
}
if(authors.length()>0) { //-------------------------------------------------------------------------------------->
authors = authors.substring(0, authors.length() - 1);
bf.authorsTF.setText(authors);
}
ModifyBookController.updateBookBtnListener ac=(ModifyBookController.updateBookBtnListener)modifyBookController.getUpdateBookBtnListener();
bf.okBtn.addActionListener(ac);
ac.setISBN(ISBN,bf);
} catch (SQLException e1) {
if (e1.getErrorCode() == 1054) { //------------> wrong type + FK
String l = e1.getMessage().replace("Unknown column ", "");
l = l.replace(" in 'field list'", "");
} else if (e1.getErrorCode() == 1452) {
} else {
}
}
}
}
| 5,393 | 0.614315 | 0.602633 | 155 | 33.799999 | 33.581371 | 152 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.741935 | false | false |
13
|
c715b97ccde20f53052c27eb0ccda0aecdc1fac4
| 17,257,178,644,330 |
6482753b5eb6357e7fe70e3057195e91682db323
|
/com/google/common/collect/ImmutableClassToInstanceMap.java
|
57dd8f727c91af5a637a93eb08b91cc0e2b741c5
|
[] |
no_license
|
TheShermanTanker/Server-1.16.3
|
https://github.com/TheShermanTanker/Server-1.16.3
|
45cf9996afa4cd4d8963f8fd0588ae4ee9dca93c
|
48cc08cb94c3094ebddb6ccfb4ea25538492bebf
|
refs/heads/master
| 2022-12-19T02:20:01.786000 | 2020-09-18T21:29:40 | 2020-09-18T21:29:40 | 296,730,962 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.google.common.collect;
import com.google.common.primitives.Primitives;
import java.util.Iterator;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import javax.annotation.Nullable;
import com.google.common.base.Preconditions;
import java.util.Map;
import com.google.common.annotations.GwtIncompatible;
import java.io.Serializable;
@GwtIncompatible
public final class ImmutableClassToInstanceMap<B> extends ForwardingMap<Class<? extends B>, B> implements ClassToInstanceMap<B>, Serializable {
private static final ImmutableClassToInstanceMap<Object> EMPTY;
private final ImmutableMap<Class<? extends B>, B> delegate;
public static <B> ImmutableClassToInstanceMap<B> of() {
return (ImmutableClassToInstanceMap<B>)ImmutableClassToInstanceMap.EMPTY;
}
public static <B, T extends B> ImmutableClassToInstanceMap<B> of(final Class<T> type, final T value) {
final ImmutableMap<Class<? extends B>, B> map = ImmutableMap.of(type, value);
return new ImmutableClassToInstanceMap<B>(map);
}
public static <B> Builder<B> builder() {
return new Builder<B>();
}
public static <B, S extends B> ImmutableClassToInstanceMap<B> copyOf(final Map<? extends Class<? extends S>, ? extends S> map) {
if (map instanceof ImmutableClassToInstanceMap) {
final ImmutableClassToInstanceMap<B> cast = (ImmutableClassToInstanceMap<B>)(ImmutableClassToInstanceMap)map;
return cast;
}
return new Builder<B>().putAll((java.util.Map<? extends java.lang.Class<?>, ?>)map).build();
}
private ImmutableClassToInstanceMap(final ImmutableMap<Class<? extends B>, B> delegate) {
this.delegate = delegate;
}
@Override
protected Map<Class<? extends B>, B> delegate() {
return (Map<Class<? extends B>, B>)this.delegate;
}
@Nullable
@Override
public <T extends B> T getInstance(final Class<T> type) {
return (T)this.delegate.get(Preconditions.<Class<T>>checkNotNull(type));
}
@Deprecated
@CanIgnoreReturnValue
@Override
public <T extends B> T putInstance(final Class<T> type, final T value) {
throw new UnsupportedOperationException();
}
Object readResolve() {
return this.isEmpty() ? ImmutableClassToInstanceMap.of() : this;
}
static {
EMPTY = new ImmutableClassToInstanceMap<>(ImmutableMap.<java.lang.Class<?>, Object>of());
}
public static final class Builder<B> {
private final ImmutableMap.Builder<Class<? extends B>, B> mapBuilder;
public Builder() {
this.mapBuilder = ImmutableMap.<Class<? extends B>, B>builder();
}
@CanIgnoreReturnValue
public <T extends B> Builder<B> put(final Class<T> key, final T value) {
this.mapBuilder.put(key, value);
return this;
}
@CanIgnoreReturnValue
public <T extends B> Builder<B> putAll(final Map<? extends Class<? extends T>, ? extends T> map) {
for (final Map.Entry<? extends Class<? extends T>, ? extends T> entry : map.entrySet()) {
final Class<? extends T> type = entry.getKey();
final T value = (T)entry.getValue();
this.mapBuilder.put(type, Builder.<T, B>cast((java.lang.Class<B>)type, value));
}
return this;
}
private static <B, T extends B> T cast(final Class<T> type, final B value) {
return (T)Primitives.<T>wrap(type).cast(value);
}
public ImmutableClassToInstanceMap<B> build() {
final ImmutableMap<Class<? extends B>, B> map = this.mapBuilder.build();
if (map.isEmpty()) {
return ImmutableClassToInstanceMap.<B>of();
}
return new ImmutableClassToInstanceMap<B>(map, null);
}
}
}
|
UTF-8
|
Java
| 3,964 |
java
|
ImmutableClassToInstanceMap.java
|
Java
|
[] | null |
[] |
package com.google.common.collect;
import com.google.common.primitives.Primitives;
import java.util.Iterator;
import com.google.errorprone.annotations.CanIgnoreReturnValue;
import javax.annotation.Nullable;
import com.google.common.base.Preconditions;
import java.util.Map;
import com.google.common.annotations.GwtIncompatible;
import java.io.Serializable;
@GwtIncompatible
public final class ImmutableClassToInstanceMap<B> extends ForwardingMap<Class<? extends B>, B> implements ClassToInstanceMap<B>, Serializable {
private static final ImmutableClassToInstanceMap<Object> EMPTY;
private final ImmutableMap<Class<? extends B>, B> delegate;
public static <B> ImmutableClassToInstanceMap<B> of() {
return (ImmutableClassToInstanceMap<B>)ImmutableClassToInstanceMap.EMPTY;
}
public static <B, T extends B> ImmutableClassToInstanceMap<B> of(final Class<T> type, final T value) {
final ImmutableMap<Class<? extends B>, B> map = ImmutableMap.of(type, value);
return new ImmutableClassToInstanceMap<B>(map);
}
public static <B> Builder<B> builder() {
return new Builder<B>();
}
public static <B, S extends B> ImmutableClassToInstanceMap<B> copyOf(final Map<? extends Class<? extends S>, ? extends S> map) {
if (map instanceof ImmutableClassToInstanceMap) {
final ImmutableClassToInstanceMap<B> cast = (ImmutableClassToInstanceMap<B>)(ImmutableClassToInstanceMap)map;
return cast;
}
return new Builder<B>().putAll((java.util.Map<? extends java.lang.Class<?>, ?>)map).build();
}
private ImmutableClassToInstanceMap(final ImmutableMap<Class<? extends B>, B> delegate) {
this.delegate = delegate;
}
@Override
protected Map<Class<? extends B>, B> delegate() {
return (Map<Class<? extends B>, B>)this.delegate;
}
@Nullable
@Override
public <T extends B> T getInstance(final Class<T> type) {
return (T)this.delegate.get(Preconditions.<Class<T>>checkNotNull(type));
}
@Deprecated
@CanIgnoreReturnValue
@Override
public <T extends B> T putInstance(final Class<T> type, final T value) {
throw new UnsupportedOperationException();
}
Object readResolve() {
return this.isEmpty() ? ImmutableClassToInstanceMap.of() : this;
}
static {
EMPTY = new ImmutableClassToInstanceMap<>(ImmutableMap.<java.lang.Class<?>, Object>of());
}
public static final class Builder<B> {
private final ImmutableMap.Builder<Class<? extends B>, B> mapBuilder;
public Builder() {
this.mapBuilder = ImmutableMap.<Class<? extends B>, B>builder();
}
@CanIgnoreReturnValue
public <T extends B> Builder<B> put(final Class<T> key, final T value) {
this.mapBuilder.put(key, value);
return this;
}
@CanIgnoreReturnValue
public <T extends B> Builder<B> putAll(final Map<? extends Class<? extends T>, ? extends T> map) {
for (final Map.Entry<? extends Class<? extends T>, ? extends T> entry : map.entrySet()) {
final Class<? extends T> type = entry.getKey();
final T value = (T)entry.getValue();
this.mapBuilder.put(type, Builder.<T, B>cast((java.lang.Class<B>)type, value));
}
return this;
}
private static <B, T extends B> T cast(final Class<T> type, final B value) {
return (T)Primitives.<T>wrap(type).cast(value);
}
public ImmutableClassToInstanceMap<B> build() {
final ImmutableMap<Class<? extends B>, B> map = this.mapBuilder.build();
if (map.isEmpty()) {
return ImmutableClassToInstanceMap.<B>of();
}
return new ImmutableClassToInstanceMap<B>(map, null);
}
}
}
| 3,964 | 0.636478 | 0.636478 | 103 | 37.485435 | 34.736137 | 143 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.621359 | false | false |
13
|
9ef07b1ec55a6a0a25c382fa0e14882752829003
| 36,292,473,679,123 |
9858dbbc53003246b73f4d7dca8de1b1a97f7a1d
|
/src/main/java/com/bumao/model/yuquesdk/po/GroupCreatePo.java
|
340a67a3e4ebb0024aac6e34322a2f9669cb07b0
|
[] |
no_license
|
wudision0416/yuque-java-sdk
|
https://github.com/wudision0416/yuque-java-sdk
|
590cd09e4a61a8fd54b746777d35539575152de9
|
d12adda5bc3a168f52fe8720f0bd2323cc627552
|
refs/heads/master
| 2023-05-13T13:48:25.616000 | 2021-06-11T04:54:32 | 2021-06-11T04:54:32 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.bumao.model.yuquesdk.po;
import lombok.Data;
@Data
public class GroupCreatePo {
/**
* 组织名称
*/
private String name;
/**
* login
*/
private String login;
/**
* 介绍
*/
private String description;
}
|
UTF-8
|
Java
| 274 |
java
|
GroupCreatePo.java
|
Java
|
[] | null |
[] |
package com.bumao.model.yuquesdk.po;
import lombok.Data;
@Data
public class GroupCreatePo {
/**
* 组织名称
*/
private String name;
/**
* login
*/
private String login;
/**
* 介绍
*/
private String description;
}
| 274 | 0.549618 | 0.549618 | 19 | 12.789474 | 10.665137 | 36 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.263158 | false | false |
13
|
07dee617692811942fe48f7e9797467e842cb2d5
| 35,347,580,866,043 |
6794356b7c2ee0499e040e14ecf5c4ab33e67931
|
/src/main/java/com/example/blog/rest/models/article/ArticleRequestModel.java
|
a9a5fee5d2e4f6267d00cedb1628a998e3a63dee
|
[] |
no_license
|
tikkerobyan/finishedblog1
|
https://github.com/tikkerobyan/finishedblog1
|
3e9c4298cd6d31b481e7a6c7aeb6b0c8be6dd354
|
bdab5f0e98e56e06d00ef371d77754933597a9db
|
refs/heads/master
| 2021-04-02T20:52:23.664000 | 2020-03-25T17:33:17 | 2020-03-25T17:33:17 | 248,320,229 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.blog.rest.models.article;
import java.io.Serializable;
import java.util.Objects;
public class ArticleRequestModel implements Serializable {
private static final long serialVersionUID = -9191372381262619286L;
private String author;
private String title;
private String content;
private String imgUrl;
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getImgUrl() {
return imgUrl;
}
public void setImgUrl(String imgUrl) {
this.imgUrl = imgUrl;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ArticleRequestModel that = (ArticleRequestModel) o;
return Objects.equals(author, that.author) &&
Objects.equals(title, that.title) &&
Objects.equals(content, that.content) &&
Objects.equals(imgUrl, that.imgUrl);
}
@Override
public int hashCode() {
return Objects.hash(author, title, content, imgUrl);
}
@Override
public String toString() {
return "ArticleRequestModel{" +
"author='" + author + '\'' +
", title='" + title + '\'' +
", content='" + content + '\'' +
", imgUrl='" + imgUrl + '\'' +
'}';
}
}
|
UTF-8
|
Java
| 1,761 |
java
|
ArticleRequestModel.java
|
Java
|
[] | null |
[] |
package com.example.blog.rest.models.article;
import java.io.Serializable;
import java.util.Objects;
public class ArticleRequestModel implements Serializable {
private static final long serialVersionUID = -9191372381262619286L;
private String author;
private String title;
private String content;
private String imgUrl;
public String getAuthor() {
return author;
}
public void setAuthor(String author) {
this.author = author;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getImgUrl() {
return imgUrl;
}
public void setImgUrl(String imgUrl) {
this.imgUrl = imgUrl;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
ArticleRequestModel that = (ArticleRequestModel) o;
return Objects.equals(author, that.author) &&
Objects.equals(title, that.title) &&
Objects.equals(content, that.content) &&
Objects.equals(imgUrl, that.imgUrl);
}
@Override
public int hashCode() {
return Objects.hash(author, title, content, imgUrl);
}
@Override
public String toString() {
return "ArticleRequestModel{" +
"author='" + author + '\'' +
", title='" + title + '\'' +
", content='" + content + '\'' +
", imgUrl='" + imgUrl + '\'' +
'}';
}
}
| 1,761 | 0.571834 | 0.561045 | 71 | 23.802816 | 20.051779 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.478873 | false | false |
13
|
884a6257ee2bf0dbe2ae2413ae64051a7b9896af
| 34,136,400,109,584 |
a1a5aa87d206241123d74aa27bfd94ad2537e56f
|
/src/objetosfinal/ProcesadorBelbin.java
|
e3f068997ac2a2ade01353a803f3c9b037972cf9
|
[] |
no_license
|
eugemoris/Objetos
|
https://github.com/eugemoris/Objetos
|
7869c9339e721d1e1686677ebe2f070fc7f5bcf4
|
14178a2fba97487cef1118ab729e599e52009897
|
refs/heads/master
| 2021-01-20T16:03:21.944000 | 2019-09-15T00:12:47 | 2019-09-15T00:12:47 | 90,809,605 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package objetosfinal;
import org.json.simple.JSONObject;
import java.util.*;
import objetosfinal.ComparadorPair;
import objetosfinal.Pair;
import objetosfinal.ProcesadorEncuesta;
public class ProcesadorBelbin extends ProcesadorEncuesta {
//Procesa los test de Belbin
private Pair implementer;
private Pair coordinator;
private Pair shaper;
private Pair plant;
private Pair resourceInvestigator;
private Pair monitor;
private Pair teamWorker;
private Pair completer;
public ProcesadorBelbin() {
//guarda en Pair el atributo con unas costante cero
this.implementer = new Pair("implementer", 0);
this.coordinator = new Pair("coordinator", 0);
this.shaper = new Pair("shaper", 0);
this.plant = new Pair("plant", 0);
this.resourceInvestigator = new Pair("resourceInvestigator", 0);
this.monitor = new Pair("monitor", 0);
this.teamWorker = new Pair("teamWorker", 0);
this.completer = new Pair("completer", 0);
super.setNombre("belbin");
}
public JSONObject getResultado(JSONObject respuestas) {
//metodo que extiende de su clase abstracta
JSONObject resultado = new JSONObject();
//Las claves son reemplazadas con el numero de la pregunta, por ejemplo "3d"
JSONObject auxiliar = new JSONObject();
Set<String> set = respuestas.keySet();//obtengo todas las preguntas
for (String s : set) {//por cada pregunta
int pos = s.indexOf('[');
if (pos != -1) {
String key = s.substring(pos + 1, pos + 3);//ya que la clave que buscamos ej 3d se encuentra entre []
String valor = (String) respuestas.get(s);
int punto = valor.indexOf('.');
valor = valor.substring(0, punto); //el valor es lo que se encuentra antes del punto
Integer.parseInt(valor);
auxiliar.put(key, valor);
}
}
// El resultado de cada caracteristica es la suma del valor elegido en ciertas preguntas
//Se utiliza lo realizado anteriormente para acceder al valor que selecciono en el test
implementer.setValor(Integer.parseInt((String) auxiliar.get("1g")) + Integer.parseInt((String) auxiliar.get("2a")) + Integer.parseInt((String) auxiliar.get("3h")) + Integer.parseInt((String) auxiliar.get("4d")) + Integer.parseInt((String) auxiliar.get("5b")) + Integer.parseInt((String) auxiliar.get("6f")) + Integer.parseInt((String) auxiliar.get("7e")));
coordinator.setValor(Integer.parseInt((String) auxiliar.get("1d")) + Integer.parseInt((String) auxiliar.get("2b")) + Integer.parseInt((String) auxiliar.get("3a")) + Integer.parseInt((String) auxiliar.get("4h")) + Integer.parseInt((String) auxiliar.get("5f")) + Integer.parseInt((String) auxiliar.get("6c")) + Integer.parseInt((String) auxiliar.get("7g")));
shaper.setValor(Integer.parseInt((String) auxiliar.get("1f")) + Integer.parseInt((String) auxiliar.get("2e")) + Integer.parseInt((String) auxiliar.get("3c")) + Integer.parseInt((String) auxiliar.get("4b")) + Integer.parseInt((String) auxiliar.get("5d")) + Integer.parseInt((String) auxiliar.get("6g")) + Integer.parseInt((String) auxiliar.get("7a")));
plant.setValor(Integer.parseInt((String) auxiliar.get("1c")) + Integer.parseInt((String) auxiliar.get("2g")) + Integer.parseInt((String) auxiliar.get("3d")) + Integer.parseInt((String) auxiliar.get("4e")) + Integer.parseInt((String) auxiliar.get("5h")) + Integer.parseInt((String) auxiliar.get("6a")) + Integer.parseInt((String) auxiliar.get("7f")));
resourceInvestigator.setValor(Integer.parseInt((String) auxiliar.get("1a")) + Integer.parseInt((String) auxiliar.get("2c")) + Integer.parseInt((String) auxiliar.get("3f")) + Integer.parseInt((String) auxiliar.get("4g")) + Integer.parseInt((String) auxiliar.get("5e")) + Integer.parseInt((String) auxiliar.get("6h")) + Integer.parseInt((String) auxiliar.get("7d")));
monitor.setValor(Integer.parseInt((String) auxiliar.get("1h")) + Integer.parseInt((String) auxiliar.get("2d")) + Integer.parseInt((String) auxiliar.get("3g")) + Integer.parseInt((String) auxiliar.get("4c")) + Integer.parseInt((String) auxiliar.get("5a")) + Integer.parseInt((String) auxiliar.get("6e")) + Integer.parseInt((String) auxiliar.get("7b")));
teamWorker.setValor(Integer.parseInt((String) auxiliar.get("1b")) + Integer.parseInt((String) auxiliar.get("2f")) + Integer.parseInt((String) auxiliar.get("3e")) + Integer.parseInt((String) auxiliar.get("4a")) + Integer.parseInt((String) auxiliar.get("5c")) + Integer.parseInt((String) auxiliar.get("6b")) + Integer.parseInt((String) auxiliar.get("7h")));
completer.setValor(Integer.parseInt((String) auxiliar.get("1e")) + Integer.parseInt((String) auxiliar.get("2h")) + Integer.parseInt((String) auxiliar.get("3b")) + Integer.parseInt((String) auxiliar.get("4f")) + Integer.parseInt((String) auxiliar.get("5g")) + Integer.parseInt((String) auxiliar.get("6d")) + Integer.parseInt((String) auxiliar.get("7c")));
//Se agregan los resultado a un Json
resultado.put("implementer", implementer.getValor());
resultado.put("coordinator", coordinator.getValor());
resultado.put("shaper", shaper.getValor());
resultado.put("plant", plant.getValor());
resultado.put("resourceInvestigator", resourceInvestigator.getValor());
resultado.put("monitor", monitor.getValor());
resultado.put("teamWorker", teamWorker.getValor());
resultado.put("completer", completer.getValor());
return resultado;
}
}
|
UTF-8
|
Java
| 5,715 |
java
|
ProcesadorBelbin.java
|
Java
|
[
{
"context": "xtends ProcesadorEncuesta {\r\n//Procesa los test de Belbin\r\n private Pair implementer;\r\n private Pa",
"end": 276,
"score": 0.5294523239135742,
"start": 273,
"tag": "NAME",
"value": "Bel"
}
] | null |
[] |
package objetosfinal;
import org.json.simple.JSONObject;
import java.util.*;
import objetosfinal.ComparadorPair;
import objetosfinal.Pair;
import objetosfinal.ProcesadorEncuesta;
public class ProcesadorBelbin extends ProcesadorEncuesta {
//Procesa los test de Belbin
private Pair implementer;
private Pair coordinator;
private Pair shaper;
private Pair plant;
private Pair resourceInvestigator;
private Pair monitor;
private Pair teamWorker;
private Pair completer;
public ProcesadorBelbin() {
//guarda en Pair el atributo con unas costante cero
this.implementer = new Pair("implementer", 0);
this.coordinator = new Pair("coordinator", 0);
this.shaper = new Pair("shaper", 0);
this.plant = new Pair("plant", 0);
this.resourceInvestigator = new Pair("resourceInvestigator", 0);
this.monitor = new Pair("monitor", 0);
this.teamWorker = new Pair("teamWorker", 0);
this.completer = new Pair("completer", 0);
super.setNombre("belbin");
}
public JSONObject getResultado(JSONObject respuestas) {
//metodo que extiende de su clase abstracta
JSONObject resultado = new JSONObject();
//Las claves son reemplazadas con el numero de la pregunta, por ejemplo "3d"
JSONObject auxiliar = new JSONObject();
Set<String> set = respuestas.keySet();//obtengo todas las preguntas
for (String s : set) {//por cada pregunta
int pos = s.indexOf('[');
if (pos != -1) {
String key = s.substring(pos + 1, pos + 3);//ya que la clave que buscamos ej 3d se encuentra entre []
String valor = (String) respuestas.get(s);
int punto = valor.indexOf('.');
valor = valor.substring(0, punto); //el valor es lo que se encuentra antes del punto
Integer.parseInt(valor);
auxiliar.put(key, valor);
}
}
// El resultado de cada caracteristica es la suma del valor elegido en ciertas preguntas
//Se utiliza lo realizado anteriormente para acceder al valor que selecciono en el test
implementer.setValor(Integer.parseInt((String) auxiliar.get("1g")) + Integer.parseInt((String) auxiliar.get("2a")) + Integer.parseInt((String) auxiliar.get("3h")) + Integer.parseInt((String) auxiliar.get("4d")) + Integer.parseInt((String) auxiliar.get("5b")) + Integer.parseInt((String) auxiliar.get("6f")) + Integer.parseInt((String) auxiliar.get("7e")));
coordinator.setValor(Integer.parseInt((String) auxiliar.get("1d")) + Integer.parseInt((String) auxiliar.get("2b")) + Integer.parseInt((String) auxiliar.get("3a")) + Integer.parseInt((String) auxiliar.get("4h")) + Integer.parseInt((String) auxiliar.get("5f")) + Integer.parseInt((String) auxiliar.get("6c")) + Integer.parseInt((String) auxiliar.get("7g")));
shaper.setValor(Integer.parseInt((String) auxiliar.get("1f")) + Integer.parseInt((String) auxiliar.get("2e")) + Integer.parseInt((String) auxiliar.get("3c")) + Integer.parseInt((String) auxiliar.get("4b")) + Integer.parseInt((String) auxiliar.get("5d")) + Integer.parseInt((String) auxiliar.get("6g")) + Integer.parseInt((String) auxiliar.get("7a")));
plant.setValor(Integer.parseInt((String) auxiliar.get("1c")) + Integer.parseInt((String) auxiliar.get("2g")) + Integer.parseInt((String) auxiliar.get("3d")) + Integer.parseInt((String) auxiliar.get("4e")) + Integer.parseInt((String) auxiliar.get("5h")) + Integer.parseInt((String) auxiliar.get("6a")) + Integer.parseInt((String) auxiliar.get("7f")));
resourceInvestigator.setValor(Integer.parseInt((String) auxiliar.get("1a")) + Integer.parseInt((String) auxiliar.get("2c")) + Integer.parseInt((String) auxiliar.get("3f")) + Integer.parseInt((String) auxiliar.get("4g")) + Integer.parseInt((String) auxiliar.get("5e")) + Integer.parseInt((String) auxiliar.get("6h")) + Integer.parseInt((String) auxiliar.get("7d")));
monitor.setValor(Integer.parseInt((String) auxiliar.get("1h")) + Integer.parseInt((String) auxiliar.get("2d")) + Integer.parseInt((String) auxiliar.get("3g")) + Integer.parseInt((String) auxiliar.get("4c")) + Integer.parseInt((String) auxiliar.get("5a")) + Integer.parseInt((String) auxiliar.get("6e")) + Integer.parseInt((String) auxiliar.get("7b")));
teamWorker.setValor(Integer.parseInt((String) auxiliar.get("1b")) + Integer.parseInt((String) auxiliar.get("2f")) + Integer.parseInt((String) auxiliar.get("3e")) + Integer.parseInt((String) auxiliar.get("4a")) + Integer.parseInt((String) auxiliar.get("5c")) + Integer.parseInt((String) auxiliar.get("6b")) + Integer.parseInt((String) auxiliar.get("7h")));
completer.setValor(Integer.parseInt((String) auxiliar.get("1e")) + Integer.parseInt((String) auxiliar.get("2h")) + Integer.parseInt((String) auxiliar.get("3b")) + Integer.parseInt((String) auxiliar.get("4f")) + Integer.parseInt((String) auxiliar.get("5g")) + Integer.parseInt((String) auxiliar.get("6d")) + Integer.parseInt((String) auxiliar.get("7c")));
//Se agregan los resultado a un Json
resultado.put("implementer", implementer.getValor());
resultado.put("coordinator", coordinator.getValor());
resultado.put("shaper", shaper.getValor());
resultado.put("plant", plant.getValor());
resultado.put("resourceInvestigator", resourceInvestigator.getValor());
resultado.put("monitor", monitor.getValor());
resultado.put("teamWorker", teamWorker.getValor());
resultado.put("completer", completer.getValor());
return resultado;
}
}
| 5,715 | 0.666667 | 0.654418 | 74 | 75.229729 | 103.189346 | 373 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.945946 | false | false |
13
|
21dc0e0b1253f3af971ab2528184425bb40d738d
| 36,584,531,440,458 |
83d638be043d92aad2af51f7e9dd06f2a0d3ec17
|
/src/main/java/com/xoriant/xorpay/encryption/PGPEncryption.java
|
7c5e80fc9eca14a85d8d0c8a1a04a0d99b63495f
|
[] |
no_license
|
lakshsharma07/XorProces
|
https://github.com/lakshsharma07/XorProces
|
78848341fa8d009ef23781d0c1e634aa87ac70f1
|
0ca710dba7551f7e2ec8dbfbafcc8f15f98492d6
|
refs/heads/master
| 2023-08-12T12:21:58.942000 | 2021-10-14T06:42:08 | 2021-10-14T06:42:08 | 416,510,442 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.xoriant.xorpay.encryption;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.security.NoSuchProviderException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.bouncycastle.openpgp.PGPException;
import com.xoriant.xorpay.constants.TagConstants;
import com.xoriant.xorpay.pojo.ConfigPojo;
public class PGPEncryption {
private static final Logger logger = LogManager.getLogger(PGPEncryption.class);
private boolean isArmored = false;
private String client_Id = TagConstants.CLIENT_ID;
private String secret_Key = TagConstants.SECRET_KEY;
private boolean integrityCheck = true;
private String pubKeyFile = TagConstants.PGP_PUB_KEY_FILE;
private String privKeyFile = TagConstants.PGP_PRIV_KEY_FILE;
private String signatureFile = TagConstants.PGP_SIGN_FILE;
public void pgpEncryption(String xmlFile, String profilename, String paymentNumber, ConfigPojo configPojo) throws NoSuchProviderException, IOException, PGPException{
logger.info("PGPEncryption pgpEncryption method Started..");
String PGP_ENCODED_FILE_PATH = configPojo.getPGP();
xmlFile = xmlFile.trim().replaceFirst("^([\\W]+)<", "<");
StringBuilder stringBuilder = new StringBuilder();
if (null != PGP_ENCODED_FILE_PATH) {
try {
File directory = new File(PGP_ENCODED_FILE_PATH);
if (!directory.exists()) {
logger.debug("directoryName::" + PGP_ENCODED_FILE_PATH);
try {
directory.mkdirs();
} catch(SecurityException se) {
logger.error("PGPEncryption Exception while creating PGP directory "+se.toString(),se);
}
} else {
logger.debug("PGP directory already Exists:::");
}
try(BufferedReader br = Files.newBufferedReader(Paths.get(xmlFile))){
String line;
while((line = br.readLine())!=null) {
stringBuilder.append(line);
}
} catch (IOException e) {
logger.error("PGPEncryption Exception while reading file "+e.toString(),e);
}
File file = new File("EncPayload_" + profilename+ "_" + paymentNumber + ".dat");
Path path = Paths.get(PGP_ENCODED_FILE_PATH + file);
FileInputStream pubKeyIs = new FileInputStream(pubKeyFile);
FileOutputStream cipheredFileIs = new FileOutputStream(file);
byte[] bytes;
try {
file.createNewFile();
bytes = PgpHelper.getInstance().encryptFile(cipheredFileIs, xmlFile, PgpHelper.getInstance().readPublicKey(pubKeyIs), isArmored, integrityCheck);
Files.write(path, bytes);
signAndVerify(xmlFile);
} catch (IOException e) {
logger.error("PGPEncryption Exception occured while writing PGP encoded file" + e.toString(), e);
}
} catch (Exception ex) {
logger.error("PGPEncryption " + ex.toString(), ex);
}
}
logger.info("PGPEncryption pgpEncryption method Ended..");
}
private void signAndVerify(String xmlFile) throws Exception{
FileInputStream privKeyIn = new FileInputStream(privKeyFile);
FileInputStream pubKeyIs = new FileInputStream(pubKeyFile);
FileInputStream plainTextInput = new FileInputStream(xmlFile);
FileOutputStream signatureOut = new FileOutputStream(signatureFile);
byte[] bIn = PgpHelper.getInstance().inputStreamToByteArray(plainTextInput);
byte[] sig = PgpHelper.getInstance().createSignature(xmlFile, privKeyIn, signatureOut, secret_Key.toCharArray(), true);
PgpHelper.getInstance().verifySignature(xmlFile, sig, pubKeyIs);
}
}
|
UTF-8
|
Java
| 3,621 |
java
|
PGPEncryption.java
|
Java
|
[] | null |
[] |
package com.xoriant.xorpay.encryption;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.security.NoSuchProviderException;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.bouncycastle.openpgp.PGPException;
import com.xoriant.xorpay.constants.TagConstants;
import com.xoriant.xorpay.pojo.ConfigPojo;
public class PGPEncryption {
private static final Logger logger = LogManager.getLogger(PGPEncryption.class);
private boolean isArmored = false;
private String client_Id = TagConstants.CLIENT_ID;
private String secret_Key = TagConstants.SECRET_KEY;
private boolean integrityCheck = true;
private String pubKeyFile = TagConstants.PGP_PUB_KEY_FILE;
private String privKeyFile = TagConstants.PGP_PRIV_KEY_FILE;
private String signatureFile = TagConstants.PGP_SIGN_FILE;
public void pgpEncryption(String xmlFile, String profilename, String paymentNumber, ConfigPojo configPojo) throws NoSuchProviderException, IOException, PGPException{
logger.info("PGPEncryption pgpEncryption method Started..");
String PGP_ENCODED_FILE_PATH = configPojo.getPGP();
xmlFile = xmlFile.trim().replaceFirst("^([\\W]+)<", "<");
StringBuilder stringBuilder = new StringBuilder();
if (null != PGP_ENCODED_FILE_PATH) {
try {
File directory = new File(PGP_ENCODED_FILE_PATH);
if (!directory.exists()) {
logger.debug("directoryName::" + PGP_ENCODED_FILE_PATH);
try {
directory.mkdirs();
} catch(SecurityException se) {
logger.error("PGPEncryption Exception while creating PGP directory "+se.toString(),se);
}
} else {
logger.debug("PGP directory already Exists:::");
}
try(BufferedReader br = Files.newBufferedReader(Paths.get(xmlFile))){
String line;
while((line = br.readLine())!=null) {
stringBuilder.append(line);
}
} catch (IOException e) {
logger.error("PGPEncryption Exception while reading file "+e.toString(),e);
}
File file = new File("EncPayload_" + profilename+ "_" + paymentNumber + ".dat");
Path path = Paths.get(PGP_ENCODED_FILE_PATH + file);
FileInputStream pubKeyIs = new FileInputStream(pubKeyFile);
FileOutputStream cipheredFileIs = new FileOutputStream(file);
byte[] bytes;
try {
file.createNewFile();
bytes = PgpHelper.getInstance().encryptFile(cipheredFileIs, xmlFile, PgpHelper.getInstance().readPublicKey(pubKeyIs), isArmored, integrityCheck);
Files.write(path, bytes);
signAndVerify(xmlFile);
} catch (IOException e) {
logger.error("PGPEncryption Exception occured while writing PGP encoded file" + e.toString(), e);
}
} catch (Exception ex) {
logger.error("PGPEncryption " + ex.toString(), ex);
}
}
logger.info("PGPEncryption pgpEncryption method Ended..");
}
private void signAndVerify(String xmlFile) throws Exception{
FileInputStream privKeyIn = new FileInputStream(privKeyFile);
FileInputStream pubKeyIs = new FileInputStream(pubKeyFile);
FileInputStream plainTextInput = new FileInputStream(xmlFile);
FileOutputStream signatureOut = new FileOutputStream(signatureFile);
byte[] bIn = PgpHelper.getInstance().inputStreamToByteArray(plainTextInput);
byte[] sig = PgpHelper.getInstance().createSignature(xmlFile, privKeyIn, signatureOut, secret_Key.toCharArray(), true);
PgpHelper.getInstance().verifySignature(xmlFile, sig, pubKeyIs);
}
}
| 3,621 | 0.733223 | 0.732671 | 98 | 35.948978 | 32.781082 | 166 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.081633 | false | false |
13
|
a1f40004e93d2f9d84ca398cf618d026aaf03b93
| 19,859,928,823,918 |
c3519e0dba9599377631491f1cb1086c7a714308
|
/grib/src/main/java/ucar/nc2/grib/grib2/Grib2Parameter.java
|
cb2345c21bc2af35b990707f54dec4a6afd3035e
|
[
"BSD-3-Clause"
] |
permissive
|
usgs/thredds
|
https://github.com/usgs/thredds
|
45fbe0666c635059b65cf0ce5b0307f1a7fd03c0
|
11ef7d2f2df0726859d540e7c08886ebd8bfe664
|
refs/heads/5.0.0-usgs
| 2021-07-09T14:36:52.181000 | 2018-10-15T15:42:14 | 2018-10-15T15:42:14 | 142,071,752 | 0 | 2 |
BSD-3-Clause
| true | 2018-10-15T15:42:16 | 2018-07-23T21:32:58 | 2018-10-02T15:28:02 | 2018-10-15T15:42:15 | 904,123 | 0 | 3 | 1 |
Java
| false | null |
/*
* Copyright (c) 1998-2018 John Caron and University Corporation for Atmospheric Research/Unidata
* See LICENSE for license information.
*/
package ucar.nc2.grib.grib2;
import ucar.nc2.grib.GribTables;
import ucar.nc2.grib.grib2.table.Grib2Customizer;
import ucar.nc2.units.SimpleUnit;
import ucar.nc2.wmo.Util;
import ucar.unidata.util.StringUtil2;
import javax.annotation.concurrent.Immutable;
import java.util.Formatter;
import java.util.List;
/**
* A Grib-2 parameter
*
* @author caron
* @since 1/9/12
*/
@Immutable
public class Grib2Parameter implements GribTables.Parameter, Comparable<Grib2Parameter> {
public final int discipline, category, number;
public final String name, unit, abbrev, desc;
public final Float fill, missing;
public Grib2Parameter(int discipline, int category, int number, String name,
String unit, String abbrev, String desc, float fill,
float missing) {
this.discipline = discipline;
this.category = category;
this.number = number;
this.name = name.trim();
this.abbrev = abbrev;
this.unit = Util.cleanUnit(unit);
this.desc = desc;
this.fill = fill;
this.missing = missing;
}
public Grib2Parameter(int discipline, int category, int number, String name, String unit, String abbrev, String desc) {
this.discipline = discipline;
this.category = category;
this.number = number;
this.name = name.trim();
this.abbrev = abbrev;
this.unit = Util.cleanUnit(unit);
this.desc = desc;
this.fill = null;
this.missing = Float.NaN;
}
public Grib2Parameter(Grib2Parameter from, String name, String unit) {
this.discipline = from.discipline;
this.category = from.category;
this.number = from.number;
this.desc = from.desc;
this.abbrev = from.abbrev;
this.name = name.trim();
this.unit = Util.cleanUnit(unit);
this.fill = null;
this.missing = Float.NaN;
}
public String getId() {
return discipline + "." + category + "." + number;
}
public int compareTo(Grib2Parameter o) {
int c = discipline - o.discipline;
if (c != 0) return c;
c = category - o.category;
if (c != 0) return c;
return number - o.number;
}
@Override
public int getDiscipline() {
return discipline;
}
@Override
public int getCategory() {
return category;
}
@Override
public int getValue() {
return -1;
}
@Override
public int getNumber() {
return number;
}
@Override
public String getName() {
return name;
}
@Override
public String getUnit() {
return unit;
}
@Override
public String getAbbrev() {
return abbrev;
}
@Override
public String getDescription() {
return desc;
}
@Override
public Float getMissing() {
return missing;
}
@Override
public Float getFill() {
return fill;
}
@Override
public String toString() {
return "Grib2Parameter{" +
"discipline=" + discipline +
", category=" + category +
", number=" + number +
", name='" + name + '\'' +
", unit='" + unit + '\'' +
", abbrev='" + abbrev + '\'' +
", desc='" + desc + '\'' +
", fill='" + fill + '\'' +
", missing='" + missing + '\'' +
'}';
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
public static void compareTables(String name1, String name2, List<? extends GribTables.Parameter> test, Grib2Customizer reference, Formatter f) {
int extra = 0;
int udunits = 0;
int conflict = 0;
f.format("Table 1 : %s%n", name1);
f.format("Table 2 : %s%n", name2);
for (GribTables.Parameter p1 : test) {
Grib2Customizer.Parameter p2 = reference.getParameter(p1.getDiscipline(), p1.getCategory(), p1.getNumber());
if (p2 == null) {
if (p1.getCategory() < 192 && p1.getNumber() < 192) {
extra++;
f.format(" WMO missing %s%n", p1);
}
} else {
String p1n = Util.cleanName(p1.getName());
String p2n = Util.cleanName(p2.getName());
if (!p1n.equalsIgnoreCase(p2n)) {
f.format(" p1=%10s %40s %15s %15s %s%n", p1.getId(), p1.getName(), p1.getUnit(), p1.getAbbrev(), p1.getDescription());
f.format(" p2=%10s %40s %15s %15s %s%n%n", p2.getId(), p2.getName(), p2.getUnit(), p2.getAbbrev(), p2.getDescription());
conflict++;
}
if (!p1.getUnit().equalsIgnoreCase(p2.getUnit())) {
String cu1 = Util.cleanUnit(p1.getUnit());
String cu2 = Util.cleanUnit(p2.getUnit());
// eliminate common non-udunits
boolean isUnitless1 = isUnitless(cu1);
boolean isUnitless2 = isUnitless(cu2);
if (isUnitless1 != isUnitless2) {
f.format(" ud=%10s %s != %s for %s (%s)%n%n", p1.getId(), cu1, cu2, p1.getId(), p1.getName());
udunits++;
} else if (!isUnitless1) {
try {
SimpleUnit su1 = SimpleUnit.factoryWithExceptions(cu1);
if (!su1.isCompatible(cu2)) {
f.format(" ud=%10s %s (%s) != %s for %s (%s)%n%n", p1.getId(), cu1, su1, cu2, p1.getId(), p1.getName());
udunits++;
}
} catch (Exception e) {
f.format(" udunits cant parse=%10s %15s %15s%n", p1.getId(), cu1, cu2);
}
}
}
}
}
f.format("Conflicts=%d extra=%d udunits=%d%n%n", conflict, extra, udunits);
f.format("Parameters in %s not in %s%n", name1, name2);
int local = 0;
for (GribTables.Parameter p1 : test) {
Grib2Customizer.Parameter p2 = reference.getParameter(p1.getDiscipline(), p1.getCategory(), p1.getNumber());
if (p2 == null) {
local++;
f.format(" %s%n", p1);
}
}
f.format(" missing=%d%n%n", local);
}
static boolean isUnitless(String unit) {
if (unit == null) return true;
String munge = unit.toLowerCase().trim();
munge = StringUtil2.remove(munge, '(');
return munge.length() == 0 ||
munge.startsWith("numeric") || munge.startsWith("non-dim") || munge.startsWith("see") ||
munge.startsWith("proportion") || munge.startsWith("code") || munge.startsWith("0=") ||
munge.equals("1") ;
}
}
|
UTF-8
|
Java
| 6,634 |
java
|
Grib2Parameter.java
|
Java
|
[
{
"context": "/*\r\n * Copyright (c) 1998-2018 John Caron and University Corporation for Atmospheric Resear",
"end": 41,
"score": 0.9998617172241211,
"start": 31,
"tag": "NAME",
"value": "John Caron"
},
{
"context": "ist;\r\n\r\n/**\r\n * A Grib-2 parameter\r\n *\r\n * @author caron\r\n * @since 1/9/12\r\n */\r\n@Immutable\r\npublic class ",
"end": 521,
"score": 0.8246549367904663,
"start": 516,
"tag": "USERNAME",
"value": "caron"
}
] | null |
[] |
/*
* Copyright (c) 1998-2018 <NAME> and University Corporation for Atmospheric Research/Unidata
* See LICENSE for license information.
*/
package ucar.nc2.grib.grib2;
import ucar.nc2.grib.GribTables;
import ucar.nc2.grib.grib2.table.Grib2Customizer;
import ucar.nc2.units.SimpleUnit;
import ucar.nc2.wmo.Util;
import ucar.unidata.util.StringUtil2;
import javax.annotation.concurrent.Immutable;
import java.util.Formatter;
import java.util.List;
/**
* A Grib-2 parameter
*
* @author caron
* @since 1/9/12
*/
@Immutable
public class Grib2Parameter implements GribTables.Parameter, Comparable<Grib2Parameter> {
public final int discipline, category, number;
public final String name, unit, abbrev, desc;
public final Float fill, missing;
public Grib2Parameter(int discipline, int category, int number, String name,
String unit, String abbrev, String desc, float fill,
float missing) {
this.discipline = discipline;
this.category = category;
this.number = number;
this.name = name.trim();
this.abbrev = abbrev;
this.unit = Util.cleanUnit(unit);
this.desc = desc;
this.fill = fill;
this.missing = missing;
}
public Grib2Parameter(int discipline, int category, int number, String name, String unit, String abbrev, String desc) {
this.discipline = discipline;
this.category = category;
this.number = number;
this.name = name.trim();
this.abbrev = abbrev;
this.unit = Util.cleanUnit(unit);
this.desc = desc;
this.fill = null;
this.missing = Float.NaN;
}
public Grib2Parameter(Grib2Parameter from, String name, String unit) {
this.discipline = from.discipline;
this.category = from.category;
this.number = from.number;
this.desc = from.desc;
this.abbrev = from.abbrev;
this.name = name.trim();
this.unit = Util.cleanUnit(unit);
this.fill = null;
this.missing = Float.NaN;
}
public String getId() {
return discipline + "." + category + "." + number;
}
public int compareTo(Grib2Parameter o) {
int c = discipline - o.discipline;
if (c != 0) return c;
c = category - o.category;
if (c != 0) return c;
return number - o.number;
}
@Override
public int getDiscipline() {
return discipline;
}
@Override
public int getCategory() {
return category;
}
@Override
public int getValue() {
return -1;
}
@Override
public int getNumber() {
return number;
}
@Override
public String getName() {
return name;
}
@Override
public String getUnit() {
return unit;
}
@Override
public String getAbbrev() {
return abbrev;
}
@Override
public String getDescription() {
return desc;
}
@Override
public Float getMissing() {
return missing;
}
@Override
public Float getFill() {
return fill;
}
@Override
public String toString() {
return "Grib2Parameter{" +
"discipline=" + discipline +
", category=" + category +
", number=" + number +
", name='" + name + '\'' +
", unit='" + unit + '\'' +
", abbrev='" + abbrev + '\'' +
", desc='" + desc + '\'' +
", fill='" + fill + '\'' +
", missing='" + missing + '\'' +
'}';
}
//////////////////////////////////////////////////////////////////////////////////////////////////////
public static void compareTables(String name1, String name2, List<? extends GribTables.Parameter> test, Grib2Customizer reference, Formatter f) {
int extra = 0;
int udunits = 0;
int conflict = 0;
f.format("Table 1 : %s%n", name1);
f.format("Table 2 : %s%n", name2);
for (GribTables.Parameter p1 : test) {
Grib2Customizer.Parameter p2 = reference.getParameter(p1.getDiscipline(), p1.getCategory(), p1.getNumber());
if (p2 == null) {
if (p1.getCategory() < 192 && p1.getNumber() < 192) {
extra++;
f.format(" WMO missing %s%n", p1);
}
} else {
String p1n = Util.cleanName(p1.getName());
String p2n = Util.cleanName(p2.getName());
if (!p1n.equalsIgnoreCase(p2n)) {
f.format(" p1=%10s %40s %15s %15s %s%n", p1.getId(), p1.getName(), p1.getUnit(), p1.getAbbrev(), p1.getDescription());
f.format(" p2=%10s %40s %15s %15s %s%n%n", p2.getId(), p2.getName(), p2.getUnit(), p2.getAbbrev(), p2.getDescription());
conflict++;
}
if (!p1.getUnit().equalsIgnoreCase(p2.getUnit())) {
String cu1 = Util.cleanUnit(p1.getUnit());
String cu2 = Util.cleanUnit(p2.getUnit());
// eliminate common non-udunits
boolean isUnitless1 = isUnitless(cu1);
boolean isUnitless2 = isUnitless(cu2);
if (isUnitless1 != isUnitless2) {
f.format(" ud=%10s %s != %s for %s (%s)%n%n", p1.getId(), cu1, cu2, p1.getId(), p1.getName());
udunits++;
} else if (!isUnitless1) {
try {
SimpleUnit su1 = SimpleUnit.factoryWithExceptions(cu1);
if (!su1.isCompatible(cu2)) {
f.format(" ud=%10s %s (%s) != %s for %s (%s)%n%n", p1.getId(), cu1, su1, cu2, p1.getId(), p1.getName());
udunits++;
}
} catch (Exception e) {
f.format(" udunits cant parse=%10s %15s %15s%n", p1.getId(), cu1, cu2);
}
}
}
}
}
f.format("Conflicts=%d extra=%d udunits=%d%n%n", conflict, extra, udunits);
f.format("Parameters in %s not in %s%n", name1, name2);
int local = 0;
for (GribTables.Parameter p1 : test) {
Grib2Customizer.Parameter p2 = reference.getParameter(p1.getDiscipline(), p1.getCategory(), p1.getNumber());
if (p2 == null) {
local++;
f.format(" %s%n", p1);
}
}
f.format(" missing=%d%n%n", local);
}
static boolean isUnitless(String unit) {
if (unit == null) return true;
String munge = unit.toLowerCase().trim();
munge = StringUtil2.remove(munge, '(');
return munge.length() == 0 ||
munge.startsWith("numeric") || munge.startsWith("non-dim") || munge.startsWith("see") ||
munge.startsWith("proportion") || munge.startsWith("code") || munge.startsWith("0=") ||
munge.equals("1") ;
}
}
| 6,630 | 0.55502 | 0.53256 | 227 | 27.215858 | 28.15802 | 147 | false | false | 0 | 0 | 0 | 0 | 102 | 0.015375 | 0.784141 | false | false |
13
|
a4383d7da62c0b71e5dbedffc3ae98b145d599cd
| 34,084,860,493,350 |
3f971a131a6443dbe9ff5d0e332eba52f05315f9
|
/src/test/java/com/ais/challenge/moviemicroservice/MovieMicroserviceApplicationTests.java
|
69794088de34e7b3af1ae3cd0d10e29fa3abfdf0
|
[] |
no_license
|
arthurfnsc/movies-api
|
https://github.com/arthurfnsc/movies-api
|
6af3cbc760b3534a3d8f683a6c21255910b74070
|
8540a010734e270cfea72adce8c17e8bd2df68e4
|
refs/heads/master
| 2022-05-31T18:23:22.090000 | 2020-05-03T20:57:18 | 2020-05-03T20:57:18 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.ais.challenge.moviemicroservice;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.catchThrowable;
@SpringBootTest(classes = MovieMicroserviceApplication.class)
class MovieMicroserviceApplicationTests {
@Test
public void main() {
Throwable thrown = catchThrowable(
() -> MovieMicroserviceApplication.main(new String[] {}));
assertThat(thrown).isNull();
}
}
|
UTF-8
|
Java
| 536 |
java
|
MovieMicroserviceApplicationTests.java
|
Java
|
[] | null |
[] |
package com.ais.challenge.moviemicroservice;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.catchThrowable;
@SpringBootTest(classes = MovieMicroserviceApplication.class)
class MovieMicroserviceApplicationTests {
@Test
public void main() {
Throwable thrown = catchThrowable(
() -> MovieMicroserviceApplication.main(new String[] {}));
assertThat(thrown).isNull();
}
}
| 536 | 0.791045 | 0.791045 | 20 | 25.799999 | 24.772161 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.9 | false | false |
13
|
26231dcaac15ac873835a1b1ee7fb632f6463d6a
| 6,124,623,427,421 |
e44c950b7c51c09fe0ec6fa96aac83802b3d8942
|
/src/LDAModel/LDASampling.java
|
858be0642d759db172f7f9e74a1f352756bd08da
|
[] |
no_license
|
peizhe/LDA
|
https://github.com/peizhe/LDA
|
50069597be58539a4adb3182475d70981aede2f6
|
62ae8f6b5e43056f19abbaffae2c8635dfe9b46d
|
refs/heads/master
| 2021-01-24T23:13:14.285000 | 2015-04-10T13:04:34 | 2015-04-10T13:04:34 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package LDAModel;
import PreProcess.Corpus;
import FollowProcess.FollowWork;
//import weka.clusterers.SimpleKMeans;
/*
* Created on March 15 14:02:14 2015
* author: Xiangfu Song
* email : bintasong@gmail.com
*
*
* */
public class LDASampling{
public static int topicNum = 6;
public static int iteration = 1000;
public static void main(String[] argv){
Corpus corpus =new Corpus(topicNum,50.0/topicNum,0.1);
corpus.addDoc("C:/Users/binta/Desktop/lda_java/LDA/Data/Documents");
System.out.println("add document to memory done");
System.out.printf("the number of words: %d\n",corpus.V);
corpus.init();
System.out.println("init done");
System.out.println("iteration...");
corpus.sampling(iteration);
System.out.println("iteration done");
FollowWork fw = new FollowWork(corpus,"C:/Users/binta/Desktop/lda_java/LDA/Data/LDAResults/document-topic.txt","C:/Users/binta/Desktop/lda_java/LDA/Data/LDAResults/topic-word.txt","C:/Users/binta/Desktop/lda_java/LDA/Data/LDAResults/theta.txt");
fw.sortMKandSave();
fw.sortKWandSave();
fw.writeTheta();
System.out.println("lda done");
}
}
|
UTF-8
|
Java
| 1,121 |
java
|
LDASampling.java
|
Java
|
[
{
"context": "*\n * Created on March 15 14:02:14 2015\n * author: Xiangfu Song \n * email : bintasong@gmail.com\n * \n * \n * */\npub",
"end": 182,
"score": 0.9998154044151306,
"start": 170,
"tag": "NAME",
"value": "Xiangfu Song"
},
{
"context": " 14:02:14 2015\n * author: Xiangfu Song \n * email : bintasong@gmail.com\n * \n * \n * */\npublic class LDASampling{\n\tpublic s",
"end": 214,
"score": 0.999933123588562,
"start": 195,
"tag": "EMAIL",
"value": "bintasong@gmail.com"
}
] | null |
[] |
package LDAModel;
import PreProcess.Corpus;
import FollowProcess.FollowWork;
//import weka.clusterers.SimpleKMeans;
/*
* Created on March 15 14:02:14 2015
* author: <NAME>
* email : <EMAIL>
*
*
* */
public class LDASampling{
public static int topicNum = 6;
public static int iteration = 1000;
public static void main(String[] argv){
Corpus corpus =new Corpus(topicNum,50.0/topicNum,0.1);
corpus.addDoc("C:/Users/binta/Desktop/lda_java/LDA/Data/Documents");
System.out.println("add document to memory done");
System.out.printf("the number of words: %d\n",corpus.V);
corpus.init();
System.out.println("init done");
System.out.println("iteration...");
corpus.sampling(iteration);
System.out.println("iteration done");
FollowWork fw = new FollowWork(corpus,"C:/Users/binta/Desktop/lda_java/LDA/Data/LDAResults/document-topic.txt","C:/Users/binta/Desktop/lda_java/LDA/Data/LDAResults/topic-word.txt","C:/Users/binta/Desktop/lda_java/LDA/Data/LDAResults/theta.txt");
fw.sortMKandSave();
fw.sortKWandSave();
fw.writeTheta();
System.out.println("lda done");
}
}
| 1,103 | 0.722569 | 0.702944 | 35 | 31.028572 | 41.294403 | 247 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.742857 | false | false |
13
|
96fb155b601cfc223a882ef0ed0a7eab60b591db
| 31,129,923,013,418 |
36d46c67ef6e182bb7ae3b91483deb2e17cd0a81
|
/src/main/java/com/caolh/designPattern/_1strategy/impl/Quack.java
|
01214aaa7f028111f2a70941133315dce83787c4
|
[] |
no_license
|
youmustbekiddingme/patternDesign
|
https://github.com/youmustbekiddingme/patternDesign
|
3cd20679fbcf1e0f3c025491c37d8ffca00a1c7f
|
8e032ac72ea03f5dc9efe7e1be53237bafe96e0f
|
refs/heads/master
| 2021-01-23T17:06:41.767000 | 2018-07-05T06:15:51 | 2018-07-05T06:15:51 | 102,760,437 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.caolh.designPattern._1strategy.impl;
import com.caolh.designPattern._1strategy.QuackBehavior;
/**
* Create with IntelliJ IDEA
* User:曹立华
* Date:2017/9/8
* 呱呱叫
*/
public class Quack implements QuackBehavior {
public void quack() {
System.out.println("Quack 呱呱叫");
}
}
|
UTF-8
|
Java
| 321 |
java
|
Quack.java
|
Java
|
[
{
"context": "havior;\n\n/**\n * Create with IntelliJ IDEA\n * User:曹立华\n * Date:2017/9/8\n * 呱呱叫\n */\npublic class Quack im",
"end": 153,
"score": 0.9855376482009888,
"start": 150,
"tag": "NAME",
"value": "曹立华"
}
] | null |
[] |
package com.caolh.designPattern._1strategy.impl;
import com.caolh.designPattern._1strategy.QuackBehavior;
/**
* Create with IntelliJ IDEA
* User:曹立华
* Date:2017/9/8
* 呱呱叫
*/
public class Quack implements QuackBehavior {
public void quack() {
System.out.println("Quack 呱呱叫");
}
}
| 321 | 0.693069 | 0.666667 | 16 | 17.9375 | 19.011408 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.1875 | false | false |
13
|
20c416e8ba023d6e0637bcd3a923be1648992c4d
| 36,610,301,249,287 |
64ddbe6df47bdc46f480afd2810111d85aa86636
|
/restvolley/src/main/java/com/hujiang/restvolley/ThreadPool.java
|
ffad451f2d9acb54a12c45f751b1aeeb2e7f6d5d
|
[
"Apache-2.0"
] |
permissive
|
HujiangTechnology/RestVolley
|
https://github.com/HujiangTechnology/RestVolley
|
c01ca32da70cac0f40d0dee670179872a93802dd
|
6a008ae88fc7b4320eac139b6c5d4bee2c940360
|
refs/heads/master
| 2021-01-17T06:09:14.418000 | 2017-01-09T08:42:17 | 2017-01-09T08:45:09 | 51,735,201 | 264 | 27 | null | false | 2017-10-13T03:46:57 | 2016-02-15T06:25:18 | 2017-08-26T15:45:39 | 2017-10-13T03:46:56 | 772 | 240 | 22 | 0 |
Java
| null | null |
package com.hujiang.restvolley;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
/**
* @author xiaoming.liu
* @version 1.0.0
*/
public final class ThreadPool {
private static final int AWAIT_TERMINATION_TIMEOUT = 10000; //ms
static class DefaultThreadFactory implements ThreadFactory {
private static final AtomicInteger POOL_NUMBER = new AtomicInteger(1);
private final ThreadGroup mGroup;
private final AtomicInteger mThreadNumber = new AtomicInteger(1);
private final String mNamePrefix;
DefaultThreadFactory() {
SecurityManager securityManager = System.getSecurityManager();
mGroup = (securityManager != null) ? securityManager.getThreadGroup() : Thread.currentThread().getThreadGroup();
mNamePrefix = "pool-" + POOL_NUMBER.getAndIncrement() + "-thread-";
}
public Thread newThread(Runnable runnable) {
Thread thread = new Thread(mGroup, runnable, mNamePrefix + mThreadNumber.getAndIncrement(), 0);
thread.setDaemon(true);
thread.setPriority(android.os.Process.THREAD_PRIORITY_BACKGROUND);
return thread;
}
}
private ThreadPoolExecutor mThreadPoolExecutor;
private String mName;
private static final int DEF_CORE_POOL_SIZE = 8;
private static final int DEF_MAX_POOL_SIZE = 128;
private static final int KEEP_ALIVE_TIME = 1;
/**
* constructor.
*
* @param name thread pool name
*/
public ThreadPool(String name) {
this(name, DEF_CORE_POOL_SIZE, DEF_MAX_POOL_SIZE);
}
/**
* constructor.
* @param name thread pool name
* @param corePoolSize core pool size
* @param maxPoolSize max pool size
*/
public ThreadPool(String name, int corePoolSize, int maxPoolSize) {
mName = name;
mThreadPoolExecutor = new ThreadPoolExecutor(DEF_CORE_POOL_SIZE, DEF_MAX_POOL_SIZE
, KEEP_ALIVE_TIME, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), new DefaultThreadFactory());
}
/**
* 获取线程池名称.
*
* @return 任务名
*/
public String getName() {
return mName;
}
/**
* 添加下载任务.
*
* @param task 任务
*/
public synchronized void addTask(Runnable task) {
assertState();
assertTaskValidity(task);
mThreadPoolExecutor.execute(task);
}
/**
* submit task implemented Callable.
* @param task task
* @param <T> type
* @return Future
*/
public synchronized <T> Future<T> submit(Callable<T> task) {
assertState();
assertTaskValidity(task);
return mThreadPoolExecutor.submit(task);
}
/**
* 添加一个 Runnable.
* @param task task
* @return Future
*/
public synchronized Future<?> submit(Runnable task) {
assertState();
assertTaskValidity(task);
return mThreadPoolExecutor.submit(task);
}
private void assertState() {
if (mThreadPoolExecutor.isShutdown()) {
throw new IllegalStateException("this ThreadPool has been shutdown!!");
}
}
private void assertTaskValidity(Object task) {
if (task == null) {
throw new IllegalArgumentException("task must not be null !!");
}
}
/**
* 删除下载任务.
*
* @param task 任务
* @return true 表示在任务队列中找到了此任务
*/
public synchronized boolean removeTask(Runnable task) {
mThreadPoolExecutor.purge();
return mThreadPoolExecutor.remove(task);
}
/**
* 关闭并取消在等待中的任务,尝试关闭正在执行的任务,无法关闭的等待完成,然后结束结束线程池.
*
* @return 被取消的task
* @throws InterruptedException InterruptedException
*/
public synchronized List<Runnable> shutDownNowAndTermination() throws InterruptedException {
List<Runnable> canceledTask = mThreadPoolExecutor.shutdownNow();
mThreadPoolExecutor.awaitTermination(AWAIT_TERMINATION_TIMEOUT, TimeUnit.MILLISECONDS);
return canceledTask;
}
/**
* 关闭并等待任务结束,然后关闭结束线程池.
*
* @throws InterruptedException InterruptedException
*/
public synchronized void shutDownAndTermination() throws InterruptedException {
mThreadPoolExecutor.shutdown();
mThreadPoolExecutor.awaitTermination(AWAIT_TERMINATION_TIMEOUT, TimeUnit.MILLISECONDS);
}
/**
* 是否关闭,关闭后不能加入新的任务.
*
* @return true 表示关闭
*/
public boolean isShutdown() {
return mThreadPoolExecutor.isShutdown();
}
/**
* 是否已经结束.
*
* @return true 表示结束
*/
public boolean isTerminated() {
return mThreadPoolExecutor.isTerminated();
}
}
|
UTF-8
|
Java
| 5,239 |
java
|
ThreadPool.java
|
Java
|
[
{
"context": "l.concurrent.atomic.AtomicInteger;\n\n/**\n * @author xiaoming.liu\n * @version 1.0.0\n */\npublic final class ThreadPo",
"end": 386,
"score": 0.9936367273330688,
"start": 374,
"tag": "NAME",
"value": "xiaoming.liu"
}
] | null |
[] |
package com.hujiang.restvolley;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.Future;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger;
/**
* @author xiaoming.liu
* @version 1.0.0
*/
public final class ThreadPool {
private static final int AWAIT_TERMINATION_TIMEOUT = 10000; //ms
static class DefaultThreadFactory implements ThreadFactory {
private static final AtomicInteger POOL_NUMBER = new AtomicInteger(1);
private final ThreadGroup mGroup;
private final AtomicInteger mThreadNumber = new AtomicInteger(1);
private final String mNamePrefix;
DefaultThreadFactory() {
SecurityManager securityManager = System.getSecurityManager();
mGroup = (securityManager != null) ? securityManager.getThreadGroup() : Thread.currentThread().getThreadGroup();
mNamePrefix = "pool-" + POOL_NUMBER.getAndIncrement() + "-thread-";
}
public Thread newThread(Runnable runnable) {
Thread thread = new Thread(mGroup, runnable, mNamePrefix + mThreadNumber.getAndIncrement(), 0);
thread.setDaemon(true);
thread.setPriority(android.os.Process.THREAD_PRIORITY_BACKGROUND);
return thread;
}
}
private ThreadPoolExecutor mThreadPoolExecutor;
private String mName;
private static final int DEF_CORE_POOL_SIZE = 8;
private static final int DEF_MAX_POOL_SIZE = 128;
private static final int KEEP_ALIVE_TIME = 1;
/**
* constructor.
*
* @param name thread pool name
*/
public ThreadPool(String name) {
this(name, DEF_CORE_POOL_SIZE, DEF_MAX_POOL_SIZE);
}
/**
* constructor.
* @param name thread pool name
* @param corePoolSize core pool size
* @param maxPoolSize max pool size
*/
public ThreadPool(String name, int corePoolSize, int maxPoolSize) {
mName = name;
mThreadPoolExecutor = new ThreadPoolExecutor(DEF_CORE_POOL_SIZE, DEF_MAX_POOL_SIZE
, KEEP_ALIVE_TIME, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), new DefaultThreadFactory());
}
/**
* 获取线程池名称.
*
* @return 任务名
*/
public String getName() {
return mName;
}
/**
* 添加下载任务.
*
* @param task 任务
*/
public synchronized void addTask(Runnable task) {
assertState();
assertTaskValidity(task);
mThreadPoolExecutor.execute(task);
}
/**
* submit task implemented Callable.
* @param task task
* @param <T> type
* @return Future
*/
public synchronized <T> Future<T> submit(Callable<T> task) {
assertState();
assertTaskValidity(task);
return mThreadPoolExecutor.submit(task);
}
/**
* 添加一个 Runnable.
* @param task task
* @return Future
*/
public synchronized Future<?> submit(Runnable task) {
assertState();
assertTaskValidity(task);
return mThreadPoolExecutor.submit(task);
}
private void assertState() {
if (mThreadPoolExecutor.isShutdown()) {
throw new IllegalStateException("this ThreadPool has been shutdown!!");
}
}
private void assertTaskValidity(Object task) {
if (task == null) {
throw new IllegalArgumentException("task must not be null !!");
}
}
/**
* 删除下载任务.
*
* @param task 任务
* @return true 表示在任务队列中找到了此任务
*/
public synchronized boolean removeTask(Runnable task) {
mThreadPoolExecutor.purge();
return mThreadPoolExecutor.remove(task);
}
/**
* 关闭并取消在等待中的任务,尝试关闭正在执行的任务,无法关闭的等待完成,然后结束结束线程池.
*
* @return 被取消的task
* @throws InterruptedException InterruptedException
*/
public synchronized List<Runnable> shutDownNowAndTermination() throws InterruptedException {
List<Runnable> canceledTask = mThreadPoolExecutor.shutdownNow();
mThreadPoolExecutor.awaitTermination(AWAIT_TERMINATION_TIMEOUT, TimeUnit.MILLISECONDS);
return canceledTask;
}
/**
* 关闭并等待任务结束,然后关闭结束线程池.
*
* @throws InterruptedException InterruptedException
*/
public synchronized void shutDownAndTermination() throws InterruptedException {
mThreadPoolExecutor.shutdown();
mThreadPoolExecutor.awaitTermination(AWAIT_TERMINATION_TIMEOUT, TimeUnit.MILLISECONDS);
}
/**
* 是否关闭,关闭后不能加入新的任务.
*
* @return true 表示关闭
*/
public boolean isShutdown() {
return mThreadPoolExecutor.isShutdown();
}
/**
* 是否已经结束.
*
* @return true 表示结束
*/
public boolean isTerminated() {
return mThreadPoolExecutor.isTerminated();
}
}
| 5,239 | 0.645552 | 0.642324 | 173 | 27.653179 | 26.988457 | 124 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.369942 | false | false |
13
|
71b528eacd2624e8f977cd1f5fa86a9d327fef07
| 38,070,590,118,165 |
57e68d99f3be5887b84299b3164fbd2d03aa5ea8
|
/software/messaging/src/test/java/brooklyn/entity/messaging/storm/SoftLayerLiveTest.java
|
ffe0aa55f89251fbd13391e551ad4bcfd8de6e8b
|
[
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] |
permissive
|
ganeshgitrepo/incubator-brooklyn
|
https://github.com/ganeshgitrepo/incubator-brooklyn
|
08d7e41971eaa910ee518c898fb1fb6e60a6ce7e
|
f28d9cc6b9fd21fe3e05dd04553f16d562bf419c
|
refs/heads/master
| 2021-01-17T08:46:31.582000 | 2014-07-03T09:46:32 | 2014-07-03T09:46:32 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package brooklyn.entity.messaging.storm;
import org.testng.annotations.Test;
@Test(groups="Live")
public class SoftLayerLiveTest extends StormAbstractCloudLiveTest {
private static final String NAMED_LOCATION = "softlayer";
@Override
public String getLocation() {
return NAMED_LOCATION;
}
}
|
UTF-8
|
Java
| 320 |
java
|
SoftLayerLiveTest.java
|
Java
|
[] | null |
[] |
package brooklyn.entity.messaging.storm;
import org.testng.annotations.Test;
@Test(groups="Live")
public class SoftLayerLiveTest extends StormAbstractCloudLiveTest {
private static final String NAMED_LOCATION = "softlayer";
@Override
public String getLocation() {
return NAMED_LOCATION;
}
}
| 320 | 0.7375 | 0.7375 | 15 | 20.333334 | 22.237106 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.266667 | false | false |
13
|
e5e862841c5a9c96f61efe4bdf23d18928be71e3
| 16,406,775,084,724 |
dc6b7ff4325559609f2abc07386a5cef6c25558d
|
/src/test/java/StockItemTest.java
|
8378b4e08f99db5c62ab027ad7ec7081ef7245dc
|
[
"MIT"
] |
permissive
|
KKDJOSEPH/Shopping_Cart_Simulation
|
https://github.com/KKDJOSEPH/Shopping_Cart_Simulation
|
eeb965009bcf46232461d0328615e5231b38d14b
|
1e8112f17ce0e9f1a6590f32cca823abfffc2fec
|
refs/heads/main
| 2023-08-19T10:26:13.848000 | 2021-10-07T01:46:15 | 2021-10-07T01:46:15 | 414,428,027 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import static org.junit.jupiter.api.Assertions.*;
import java.util.Objects;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
class StockItemTest {
private StockItem stockItem;
private Products products;
@BeforeEach
void setUp() {
this.products = new Products("KKD", "Joseph", 10.0, 14);
this.stockItem = new StockItem(products, 10);
}
@Test
void getProduct() {
Assertions.assertEquals(products, stockItem.getProduct());
}
@Test
void getQuantity() {
Assertions.assertEquals(10, stockItem.getQuantity());
}
@Test
void setProduct() {
Products product2 = new Products("KKD", "Joseph", 10.0, 14);
stockItem.setProduct(product2);
Assertions.assertEquals(product2, stockItem.getProduct());
}
@Test
void setQuantity() {
stockItem.setQuantity(20);
Assertions.assertEquals(20, stockItem.getQuantity());
}
@Test
void checkQuantity() {
Assertions.assertTrue(stockItem.checkQuantity(0));
Assertions.assertFalse(stockItem.checkQuantity(100));
}
@Test
void testToString() {
String test = "StockItem{" +
"Product=" + stockItem.getProduct() +
", Quantity=" + stockItem.getQuantity() +
'}';
Assertions.assertEquals(test, stockItem.toString());
}
@Test
void testEquals() {
Products product1 = new Products("KKD", "Joseph", 100.0, 14);
this.stockItem = new StockItem(product1, 10);
StockItem stockItem1 = new StockItem(product1, 10);
Assertions.assertTrue(stockItem.equals(stockItem1));
Products product2 = new Products("KKDD", "Joseph", 100.0, 14);
StockItem stockItem2 = new StockItem(product2, 10);
Assertions.assertFalse(stockItem.equals(stockItem2));
Products product3 = new Products("KKD", "JosephD", 100.0, 14);
StockItem stockItem3 = new StockItem(product3, 10);
Assertions.assertFalse(stockItem.equals(stockItem3));
Products product4 = new Products("KKD", "Joseph", 1001.0, 14);
StockItem stockItem4 = new StockItem(product4, 10);
Assertions.assertFalse(stockItem.equals(stockItem4));
Products product5 = new Products("KKD", "Joseph", 100.0, 141);
StockItem stockItem5 = new StockItem(product5, 10);
Assertions.assertFalse(stockItem.equals(stockItem5));
StockItem stockItem6 = new StockItem(product1, 100);
Assertions.assertFalse(stockItem.equals(stockItem6));
}
@Test
void testHashCode() {
int test = Objects.hash(stockItem.getProduct(), stockItem.getQuantity());
Assertions.assertEquals(test, stockItem.hashCode());
}
}
|
UTF-8
|
Java
| 2,602 |
java
|
StockItemTest.java
|
Java
|
[
{
"context": "etUp() {\n this.products = new Products(\"KKD\", \"Joseph\", 10.0, 14);\n this.stockItem = new StockItem(p",
"end": 355,
"score": 0.9986178874969482,
"start": 349,
"tag": "NAME",
"value": "Joseph"
},
{
"context": "() {\n Products product2 = new Products(\"KKD\", \"Joseph\", 10.0, 14);\n stockItem.setProduct(product2);\n",
"end": 697,
"score": 0.9987745881080627,
"start": 691,
"tag": "NAME",
"value": "Joseph"
},
{
"context": "() {\n Products product1 = new Products(\"KKD\", \"Joseph\", 100.0, 14);\n this.stockItem = new StockItem(",
"end": 1408,
"score": 0.9989318251609802,
"start": 1402,
"tag": "NAME",
"value": "Joseph"
},
{
"context": "));\n Products product2 = new Products(\"KKDD\", \"Joseph\", 100.0, 14);\n StockItem stockItem2 = new Stoc",
"end": 1638,
"score": 0.9986740946769714,
"start": 1632,
"tag": "NAME",
"value": "Joseph"
},
{
"context": "2));\n Products product3 = new Products(\"KKD\", \"JosephD\", 100.0, 14);\n StockItem stockItem3 = new Stoc",
"end": 1819,
"score": 0.9997933506965637,
"start": 1812,
"tag": "NAME",
"value": "JosephD"
},
{
"context": "3));\n Products product4 = new Products(\"KKD\", \"Joseph\", 1001.0, 14);\n StockItem stockItem4 = new Sto",
"end": 1999,
"score": 0.9997872710227966,
"start": 1993,
"tag": "NAME",
"value": "Joseph"
},
{
"context": "4));\n Products product5 = new Products(\"KKD\", \"Joseph\", 100.0, 141);\n StockItem stockItem5 = new Sto",
"end": 2180,
"score": 0.9997791647911072,
"start": 2174,
"tag": "NAME",
"value": "Joseph"
}
] | null |
[] |
import static org.junit.jupiter.api.Assertions.*;
import java.util.Objects;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
class StockItemTest {
private StockItem stockItem;
private Products products;
@BeforeEach
void setUp() {
this.products = new Products("KKD", "Joseph", 10.0, 14);
this.stockItem = new StockItem(products, 10);
}
@Test
void getProduct() {
Assertions.assertEquals(products, stockItem.getProduct());
}
@Test
void getQuantity() {
Assertions.assertEquals(10, stockItem.getQuantity());
}
@Test
void setProduct() {
Products product2 = new Products("KKD", "Joseph", 10.0, 14);
stockItem.setProduct(product2);
Assertions.assertEquals(product2, stockItem.getProduct());
}
@Test
void setQuantity() {
stockItem.setQuantity(20);
Assertions.assertEquals(20, stockItem.getQuantity());
}
@Test
void checkQuantity() {
Assertions.assertTrue(stockItem.checkQuantity(0));
Assertions.assertFalse(stockItem.checkQuantity(100));
}
@Test
void testToString() {
String test = "StockItem{" +
"Product=" + stockItem.getProduct() +
", Quantity=" + stockItem.getQuantity() +
'}';
Assertions.assertEquals(test, stockItem.toString());
}
@Test
void testEquals() {
Products product1 = new Products("KKD", "Joseph", 100.0, 14);
this.stockItem = new StockItem(product1, 10);
StockItem stockItem1 = new StockItem(product1, 10);
Assertions.assertTrue(stockItem.equals(stockItem1));
Products product2 = new Products("KKDD", "Joseph", 100.0, 14);
StockItem stockItem2 = new StockItem(product2, 10);
Assertions.assertFalse(stockItem.equals(stockItem2));
Products product3 = new Products("KKD", "JosephD", 100.0, 14);
StockItem stockItem3 = new StockItem(product3, 10);
Assertions.assertFalse(stockItem.equals(stockItem3));
Products product4 = new Products("KKD", "Joseph", 1001.0, 14);
StockItem stockItem4 = new StockItem(product4, 10);
Assertions.assertFalse(stockItem.equals(stockItem4));
Products product5 = new Products("KKD", "Joseph", 100.0, 141);
StockItem stockItem5 = new StockItem(product5, 10);
Assertions.assertFalse(stockItem.equals(stockItem5));
StockItem stockItem6 = new StockItem(product1, 100);
Assertions.assertFalse(stockItem.equals(stockItem6));
}
@Test
void testHashCode() {
int test = Objects.hash(stockItem.getProduct(), stockItem.getQuantity());
Assertions.assertEquals(test, stockItem.hashCode());
}
}
| 2,602 | 0.699078 | 0.662183 | 82 | 30.743902 | 24.416513 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.939024 | false | false |
13
|
4de2a5a861f2abb0c29b6e6645c0e8607c3c2d18
| 23,098,334,138,809 |
c6afeb876cf277fca93525d8173994661e360604
|
/src/main/java/com/my/netflix/home/service/HomeServiceImp.java
|
436afd294e9febf8e8c7ec42fd3fd7de0bc71f82
|
[] |
no_license
|
delilah1004/MyNetflix-Client
|
https://github.com/delilah1004/MyNetflix-Client
|
ee06c9b954919f7f25226142c95cf907f11b5f7e
|
417e4935b2bcf763cd2e90a18eb4045bc40e6c8c
|
refs/heads/master
| 2022-12-20T14:58:06.785000 | 2020-09-24T07:41:21 | 2020-09-24T07:41:21 | 294,278,787 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.my.netflix.home.service;
import java.util.ArrayList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.ModelAndView;
import com.my.netflix.home.api.HomeAPI;
import com.my.netflix.home.model.MainContent;
import com.my.netflix.home.model.MainMovie;
import com.my.netflix.home.model.MainTVProgram;
@Component
public class HomeServiceImp implements HomeService {
@Autowired
HomeAPI homeAPI;
@Override
public void main(ModelAndView mav) {
String check = "Home 메인페이지입니다.";
mav.addObject("check", check);
// 대표 슬라이드
ArrayList<MainContent> mainContents = homeAPI.getMainContents();
mav.addObject("mainContents", mainContents);
// 인기 영화 슬라이드
ArrayList<MainMovie> popularMovies = homeAPI.getBestPopularMovies();
mav.addObject("popularMovies", popularMovies);
// 최신 영화 슬라이드
ArrayList<MainMovie> nowPlayingMovies = homeAPI.getNowPlayingMovies();
mav.addObject("nowPlayingMovies", nowPlayingMovies);
// 인기 TV 프로그램 슬라이드
ArrayList<MainTVProgram> popularTVs = homeAPI.getBestPopularTVPrograms();
mav.addObject("popularTVs", popularTVs);
// 최신 TV 프로그램 슬라이드
ArrayList<MainTVProgram> onTheAirTVs = homeAPI.getOnTheAirTVPrograms();
mav.addObject("onTheAirTVs", onTheAirTVs);
mav.setViewName("home.hm");
}
}
|
UTF-8
|
Java
| 1,456 |
java
|
HomeServiceImp.java
|
Java
|
[] | null |
[] |
package com.my.netflix.home.service;
import java.util.ArrayList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.ModelAndView;
import com.my.netflix.home.api.HomeAPI;
import com.my.netflix.home.model.MainContent;
import com.my.netflix.home.model.MainMovie;
import com.my.netflix.home.model.MainTVProgram;
@Component
public class HomeServiceImp implements HomeService {
@Autowired
HomeAPI homeAPI;
@Override
public void main(ModelAndView mav) {
String check = "Home 메인페이지입니다.";
mav.addObject("check", check);
// 대표 슬라이드
ArrayList<MainContent> mainContents = homeAPI.getMainContents();
mav.addObject("mainContents", mainContents);
// 인기 영화 슬라이드
ArrayList<MainMovie> popularMovies = homeAPI.getBestPopularMovies();
mav.addObject("popularMovies", popularMovies);
// 최신 영화 슬라이드
ArrayList<MainMovie> nowPlayingMovies = homeAPI.getNowPlayingMovies();
mav.addObject("nowPlayingMovies", nowPlayingMovies);
// 인기 TV 프로그램 슬라이드
ArrayList<MainTVProgram> popularTVs = homeAPI.getBestPopularTVPrograms();
mav.addObject("popularTVs", popularTVs);
// 최신 TV 프로그램 슬라이드
ArrayList<MainTVProgram> onTheAirTVs = homeAPI.getOnTheAirTVPrograms();
mav.addObject("onTheAirTVs", onTheAirTVs);
mav.setViewName("home.hm");
}
}
| 1,456 | 0.773599 | 0.773599 | 50 | 26.120001 | 24.454561 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.4 | false | false |
13
|
b8d644a508343769436d6fee3b58d2de4d7909df
| 3,642,132,290,261 |
4d75f7a4774a0c2885d519c794050ff989b49cf6
|
/demo-service/src/main/java/com/han/knowledge/Generic/TestGeneric.java
|
5751c20e4644a1bd710673a9a31f024254fca55e
|
[] |
no_license
|
hyf456/demoTest
|
https://github.com/hyf456/demoTest
|
6b241bb0f0b99a739319e9c78b429935cff2e3dc
|
398cd2cb9c08d8b1357dd093d7ef22e2b7354c01
|
refs/heads/master
| 2023-04-11T04:40:56.212000 | 2023-03-19T04:55:01 | 2023-03-19T04:55:01 | 192,055,555 | 0 | 1 | null | false | 2022-12-10T05:53:00 | 2019-06-15T08:31:40 | 2021-05-18T07:15:47 | 2022-12-10T05:53:00 | 353 | 0 | 1 | 15 |
Java
| false | false |
package com.han.knowledge.Generic;
import org.junit.Test;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
* Created by hanyf on 2017-04-10.
*/
public class TestGeneric {
/**
* 泛型与继承的关系:
* 若类A是类B的子类,那么List<A>就不是List<B>的子接口
*/
@Test
public void test1() {
Object obj = null;
String str = new String("AA");
obj = str;//向上转型
Object[] obj1 = null;
String[] str1 = new String[]{"AAA","BBB"};
obj1 = str1;//向上转型
List<Object> lo = null;
List<String> ls = new ArrayList<String>();
//lo = ls;//错误,List<String>不是List<Object>的子接口
}
/*
* 通配符 ?
* List<A>、List<B>、。。。。都是List<?>的子类
*
* ? extends A :可以存放A及其子类
* ? super A:可以存放A及其父类
*/
@Test
public void test2() {
List<?> list = null;
List<Object> lo = new ArrayList<Object>();
List<String> ls = new ArrayList<String>();
list = lo;
list = ls;
show1(lo);
List<? extends Number> ln = null;
List<Integer> lin = new ArrayList<Integer>();
ln = lin;
List<Object> lob = new ArrayList<Object>();
//ln = lob;//错误,? extends A :可以存放A及其子类
List<? super Number> ln2 = null;
ln2 = lob;
//ln2 = lin;//错误,? super A:可以存放A及其父类
}
public <T> void show1(List<T/*此处T相当于传进来的类型*/> list) {
}
public void show2(List<?/*此处?相当于传进来的类型的父接口类型*/> list) {
}
@Test
public void test3() {
List<String> ls = new ArrayList<String>();
ls.add("aa");
ls.add("bb");
ls.add("cc");
List<?> li = ls;
//可以读取声明为通配符的集合对象
Iterator it = li.iterator();
while(it.hasNext()) {
Object o = it.next();
System.out.println(o);
}
//不能写进声明为通配符的集合对象,除了唯一例外的null
//li.add("dd");//错误
//li.add(12);//错误
li.add(null);
List<String> lstr = (List<String>)li;//强转回原来的类型就可以写进
lstr.add("ll");
System.out.println(lstr);
}
}
|
UTF-8
|
Java
| 2,428 |
java
|
TestGeneric.java
|
Java
|
[
{
"context": "terator;\nimport java.util.List;\n\n/**\n * Created by hanyf on 2017-04-10.\n */\npublic class TestGeneric {\n\n ",
"end": 162,
"score": 0.9996606707572937,
"start": 157,
"tag": "USERNAME",
"value": "hanyf"
}
] | null |
[] |
package com.han.knowledge.Generic;
import org.junit.Test;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
/**
* Created by hanyf on 2017-04-10.
*/
public class TestGeneric {
/**
* 泛型与继承的关系:
* 若类A是类B的子类,那么List<A>就不是List<B>的子接口
*/
@Test
public void test1() {
Object obj = null;
String str = new String("AA");
obj = str;//向上转型
Object[] obj1 = null;
String[] str1 = new String[]{"AAA","BBB"};
obj1 = str1;//向上转型
List<Object> lo = null;
List<String> ls = new ArrayList<String>();
//lo = ls;//错误,List<String>不是List<Object>的子接口
}
/*
* 通配符 ?
* List<A>、List<B>、。。。。都是List<?>的子类
*
* ? extends A :可以存放A及其子类
* ? super A:可以存放A及其父类
*/
@Test
public void test2() {
List<?> list = null;
List<Object> lo = new ArrayList<Object>();
List<String> ls = new ArrayList<String>();
list = lo;
list = ls;
show1(lo);
List<? extends Number> ln = null;
List<Integer> lin = new ArrayList<Integer>();
ln = lin;
List<Object> lob = new ArrayList<Object>();
//ln = lob;//错误,? extends A :可以存放A及其子类
List<? super Number> ln2 = null;
ln2 = lob;
//ln2 = lin;//错误,? super A:可以存放A及其父类
}
public <T> void show1(List<T/*此处T相当于传进来的类型*/> list) {
}
public void show2(List<?/*此处?相当于传进来的类型的父接口类型*/> list) {
}
@Test
public void test3() {
List<String> ls = new ArrayList<String>();
ls.add("aa");
ls.add("bb");
ls.add("cc");
List<?> li = ls;
//可以读取声明为通配符的集合对象
Iterator it = li.iterator();
while(it.hasNext()) {
Object o = it.next();
System.out.println(o);
}
//不能写进声明为通配符的集合对象,除了唯一例外的null
//li.add("dd");//错误
//li.add(12);//错误
li.add(null);
List<String> lstr = (List<String>)li;//强转回原来的类型就可以写进
lstr.add("ll");
System.out.println(lstr);
}
}
| 2,428 | 0.515429 | 0.504339 | 90 | 22.044445 | 17.268412 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.477778 | false | false |
13
|
07096f0bbd9cd09517e47c948903408ea689903e
| 16,887,811,408,360 |
21431168259fc7dd1714d6f346bdcf80614da7a4
|
/src/casade/lang/CurrentLanguage.java
|
f6dc5e78ce901541a99ac193296233eb4636cefd
|
[] |
no_license
|
xgarnet/CASADE
|
https://github.com/xgarnet/CASADE
|
a3d0fd4f2035961d95308860f77ae2c75deb8895
|
55f6f692cb8c4ad24f133bb9554f5fd3ad400abd
|
refs/heads/master
| 2020-03-30T20:09:14.829000 | 2017-02-22T22:18:36 | 2017-02-22T22:18:36 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package casade.lang;
public enum CurrentLanguage {
German,
Russian,
English
}
|
UTF-8
|
Java
| 86 |
java
|
CurrentLanguage.java
|
Java
|
[] | null |
[] |
package casade.lang;
public enum CurrentLanguage {
German,
Russian,
English
}
| 86 | 0.72093 | 0.72093 | 7 | 11.285714 | 9.557559 | 29 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.857143 | false | false |
13
|
71177e549d28c9e70208bf414723b8069b9fc7a0
| 1,236,950,583,940 |
5a72f0fbb5a815c7f856d62c3d0a1cf47b4977bc
|
/src/main/java/com/tms/workflow/service/CounterPartyService.java
|
02b966b64953047db62439d241c1db6e8b676318
|
[] |
no_license
|
binaymishra/tms-work-flow
|
https://github.com/binaymishra/tms-work-flow
|
edc794626978b6bf9abda4011c2e088a7c005510
|
ee21983360a9c52535397ee8c8b8a9a2e3dab11b
|
refs/heads/master
| 2020-12-07T00:33:34.732000 | 2017-06-28T03:31:06 | 2017-06-28T03:31:06 | 95,509,196 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.tms.workflow.service;
public interface CounterPartyService {
}
|
UTF-8
|
Java
| 82 |
java
|
CounterPartyService.java
|
Java
|
[] | null |
[] |
package com.tms.workflow.service;
public interface CounterPartyService {
}
| 82 | 0.756098 | 0.756098 | 5 | 14.4 | 17.304335 | 38 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | false | false |
13
|
5f19e0ea813d32b3f42d801180fd187b69793460
| 2,302,102,500,952 |
1ebd8f0107db2296ff82ea1a4f8b22efcbab022e
|
/src/main/java/com/cmig/magtask/service/ITbBatchOrderService.java
|
753e159973f06668f859ad3fc1331a34718ddacc
|
[] |
no_license
|
HappyAndy/mag-task
|
https://github.com/HappyAndy/mag-task
|
b9e7294424441860b194df1914a1b7d7e7547327
|
1a845e4489ec4c9b381beaffee09a78446458b5d
|
refs/heads/master
| 2021-05-07T07:39:39.823000 | 2017-11-01T14:41:43 | 2017-11-01T14:41:43 | 109,142,508 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.cmig.magtask.service;
import com.cmig.magtask.entity.JobAndTrigger;
import com.cmig.magtask.entity.TbBatchOrder;
import com.github.pagehelper.PageInfo;
public interface ITbBatchOrderService {
public TbBatchOrder getFirstUnDealBatch();
}
|
UTF-8
|
Java
| 253 |
java
|
ITbBatchOrderService.java
|
Java
|
[] | null |
[] |
package com.cmig.magtask.service;
import com.cmig.magtask.entity.JobAndTrigger;
import com.cmig.magtask.entity.TbBatchOrder;
import com.github.pagehelper.PageInfo;
public interface ITbBatchOrderService {
public TbBatchOrder getFirstUnDealBatch();
}
| 253 | 0.83004 | 0.83004 | 10 | 24.299999 | 19.9 | 45 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6 | false | false |
9
|
13181440e2d073c6bc243b02a2470b26aa02d3da
| 27,384,711,507,873 |
dc05ccfa0fb23ed3c75b844c11c59f94605ee090
|
/ItAcademy/src/com/jcourse/zaykov/task5/exceptions/MyException.java
|
be6222fb9cdc83b4ebc4ef10cb791cd561f0825f
|
[] |
no_license
|
dizan/jCourses
|
https://github.com/dizan/jCourses
|
cbe6a26fc4c6543adc1f90cc91956cc18810f17c
|
bf9d8eebf10ebbc8b9ed0ff070958edc1cb1117c
|
refs/heads/master
| 2016-09-08T00:48:46.271000 | 2013-03-08T08:07:46 | 2013-03-08T08:07:46 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.jcourse.zaykov.task5.exceptions;
/**
* Created with IntelliJ IDEA.
* User: Dizan
* Date: 16.02.13
* Time: 14:03
* To change this template use File | Settings | File Templates.
*/
public class MyException extends Exception {
MyException(String s){
super(s);
}
}
|
UTF-8
|
Java
| 297 |
java
|
MyException.java
|
Java
|
[
{
"context": "ions;\n\n/**\n * Created with IntelliJ IDEA.\n * User: Dizan\n * Date: 16.02.13\n * Time: 14:03\n * To change thi",
"end": 95,
"score": 0.6071106791496277,
"start": 90,
"tag": "NAME",
"value": "Dizan"
}
] | null |
[] |
package com.jcourse.zaykov.task5.exceptions;
/**
* Created with IntelliJ IDEA.
* User: Dizan
* Date: 16.02.13
* Time: 14:03
* To change this template use File | Settings | File Templates.
*/
public class MyException extends Exception {
MyException(String s){
super(s);
}
}
| 297 | 0.666667 | 0.62963 | 15 | 18.799999 | 18.719687 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.266667 | false | false |
9
|
2d5462da4178029e08f9904acb2d657d73cdb5b3
| 19,679,540,165,192 |
48d3d3330540bd6161d0a08a9dca4fbd7d856fda
|
/dal/src/main/java/com/mhdss/shop/dal/dao/base/ShopExpressDAO.java
|
d210dd5884ba181454b9281fdea965e1b01e68d3
|
[] |
no_license
|
biubiubangFE/E-commerce-service
|
https://github.com/biubiubangFE/E-commerce-service
|
ec517099354fae792629046d129523617aecfd7f
|
dab96ad82949d68e47e734e1f2e8c57166926d98
|
refs/heads/master
| 2020-04-25T22:40:31.463000 | 2019-03-04T03:34:22 | 2019-03-04T03:34:22 | 173,119,456 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.mhdss.shop.dal.dao.base;
import com.mhdss.shop.dal.dao.BaseDAO;
import com.mhdss.shop.dal.dataobject.base.ShopExpressDO;
import com.mhdss.shop.dal.query.base.ShopExpressQuery;
public interface ShopExpressDAO extends BaseDAO<ShopExpressDO, ShopExpressQuery> {
}
|
UTF-8
|
Java
| 274 |
java
|
ShopExpressDAO.java
|
Java
|
[] | null |
[] |
package com.mhdss.shop.dal.dao.base;
import com.mhdss.shop.dal.dao.BaseDAO;
import com.mhdss.shop.dal.dataobject.base.ShopExpressDO;
import com.mhdss.shop.dal.query.base.ShopExpressQuery;
public interface ShopExpressDAO extends BaseDAO<ShopExpressDO, ShopExpressQuery> {
}
| 274 | 0.824818 | 0.824818 | 8 | 33.375 | 28.735594 | 82 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.625 | false | false |
9
|
05af6067cead00e32cb24d32609dbc23df44e4d1
| 9,534,827,411,312 |
4232b7ebf7d0fe0529a089e442ce135f51988b8c
|
/uniForm/src/com/uniform/si/info/controller/SiInfoController.java
|
3124757678c1c5ddfbc4ac1f952e7a8ac3fd3d50
|
[] |
no_license
|
kimhayoungee/uniform
|
https://github.com/kimhayoungee/uniform
|
5f51fedf7cddfbbd2f5b765ab448c3b8a37e9057
|
04a7ce2eeb082e87ecb5b3ce01e455e4a6eb9c43
|
refs/heads/main
| 2023-04-10T19:50:13.768000 | 2021-04-21T13:57:13 | 2021-04-21T13:57:13 | 351,706,568 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.uniform.si.info.controller;
import java.io.File;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.uniform.common.info.service.CommonInfoService;
import com.uniform.common.utils.ChaebunUtil;
import com.uniform.common.utils.FileUtil;
import com.uniform.common.utils.InfoUtil;
import com.uniform.em.common.vo.EmCommonVO;
import com.uniform.si.info.service.SiInfoService;
import com.uniform.si.info.vo.SiInfoVO;
@Controller
@RequestMapping("/si")
public class SiInfoController {
private Logger logger = Logger.getLogger(SiInfoController.class);
@Autowired
private CommonInfoService commonInfoService;
@Autowired
private SiInfoService siInfoService;
@RequestMapping("/goSiMain")
public ModelAndView siMain(@ModelAttribute SiInfoVO sivo,HttpServletRequest request){
logger.info("siMain 호출 성공");
EmCommonVO ecvo = new EmCommonVO();
List<SiInfoVO> list = null;
HttpSession hs = request.getSession();
String i_no = (String)hs.getAttribute("i_no");
ecvo.setI_no(i_no);
EmCommonVO miniVO = commonInfoService.miniInfo(ecvo);
list = siInfoService.studentList(sivo);
ModelAndView mav = new ModelAndView();
mav.addObject("miniVO",miniVO);
mav.addObject("siList",list);
mav.setViewName("si/siMain");
return mav;
}// end of siMain() 함수
@RequestMapping("/goInsertSi")
public ModelAndView goInsertSi(){
logger.info("goInsertSi 호출 성공");
ModelAndView mav = new ModelAndView();
mav.setViewName("si/insertSi");
return mav;
}// end of goInsertSi() 함수
@ResponseBody
@RequestMapping(value="/imgUpload",produces="application/text; charset=utf-8")
public String imgUpload(HttpServletRequest request){
logger.info("imgUpload 호출 성공");
String upload = "/si/img";
String si_img = "";
try{
si_img = FileUtil.fileUpload(request, upload);
System.out.println("등록한 사진 이름 >>> : " + si_img);
}catch(Exception e){
System.out.println("에러났다 >>> : " + e.getMessage());
}
return si_img;
}// end of imgUpload() 함수
@ResponseBody
@RequestMapping(value="/insertSi",produces="application/text; charset=utf-8")
public String insertSi(@ModelAttribute SiInfoVO sivo){
logger.info("insertSi 호출 성공");
String result = "";
SiInfoVO chaebunVO = siInfoService.siChaebun();
String no = chaebunVO.getI_no();
String i_no = ChaebunUtil.getChaebun(no, "si");
sivo.setI_no(i_no);
int cnt = siInfoService.insertSi(sivo);
if(cnt==2){
result = "성공";
}else{
result = "알 수 없는 이유로 실패 했습니다. 문의 주세요";
}
return result;
}// end of insertSi() 함수
@RequestMapping("/goDetailSi")
public ModelAndView goDetailSi(@ModelAttribute SiInfoVO sivo){
logger.info("goDetailSi 호출 성공");
SiInfoVO detailVO = siInfoService.detailSi(sivo);
detailVO = InfoUtil.siSetting(detailVO);
ModelAndView mav = new ModelAndView();
mav.addObject("detailVO",detailVO);
mav.setViewName("si/detailSi");
return mav;
}// end of goDetailSi() 함수
@RequestMapping("/goUpdateSi")
public ModelAndView goUpdateSi(@ModelAttribute SiInfoVO sivo){
logger.info("goUpdateSi 호출 성공");
SiInfoVO cDetailVO = siInfoService.cDetailSi(sivo);
ModelAndView mav = new ModelAndView();
mav.addObject("cDetailVO",cDetailVO);
mav.setViewName("si/updateSi");
return mav;
}// end of goUpdateSi() 함수
@ResponseBody
@RequestMapping(value="/uploadFile",produces="application/text; charset=utf-8")
public String uploadFile(HttpServletRequest request){
logger.info("uploadFile 호출 성공");
String si_img = "";
String upload = "/si/img";
try{
si_img = FileUtil.fileUpload(request, upload);
System.out.println("업로드한 파일 이름 >>> : " + si_img);
}catch(Exception e){
System.out.println("에러났다 >>> : " + e.getMessage());
}
return si_img;
}// end of uploadFile() 함수
@ResponseBody
@RequestMapping(value="/updateSi",produces="application/text; charset=utf-8")
public String updateSi(@ModelAttribute SiInfoVO sivo){
logger.info("updateSi 호출 성공");
String result = "";
int cnt = siInfoService.updateStudent(sivo);
if(cnt==2){
result = "성공";
}else{
result = "알 수 없는 이유로 실패 했습니다. 문의 주세요";
}
return result;
}// end of updateSi() 함수
@ResponseBody
@RequestMapping(value="/deleteSi",produces="application/text; charset=utf-8")
public String deleteSi(@ModelAttribute SiInfoVO sivo){
logger.info("deleteSi 호출 성공");
// String path = "C:/L_work/java142Uniform/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/uniForm";
String path = "D:/00.BITCAMP/java142Uniform/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/uniForm";
// String path = "C:/Users/이상훈/Desktop/java142Uniform/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/uniForm";
String delete = "/si/img/";
String result = "";
System.out.println("들어온거 >>>> : " + sivo.getI_no() + " : " + sivo.getSi_img());
int cnt = siInfoService.deleteSi(sivo);
if(cnt==1){
File f = new File(path + delete + sivo.getSi_img());
System.out.println("파일 맞습니까? >>> : " + f.isFile() + " : " + f);
boolean fileBool = f.delete();
if(fileBool){
result = "성공";
}else{
result = "알 수 없는 이유로 실패 했습니다. 문의 주세요";
}
}else{
result = "알 수 없는 이유로 실패 했습니다. 문의 주세요";
}
return result;
}// end of deleteSi() 함수
}// end of SiInfoController class
|
UHC
|
Java
| 6,124 |
java
|
SiInfoController.java
|
Java
|
[
{
"context": "/wtpwebapps/uniForm\";\n//\t\tString path = \"C:/Users/이상훈/Desktop/java142Uniform/.metadata/.plugins/org.ecl",
"end": 5099,
"score": 0.9263412356376648,
"start": 5096,
"tag": "USERNAME",
"value": "이상훈"
}
] | null |
[] |
package com.uniform.si.info.controller;
import java.io.File;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import com.uniform.common.info.service.CommonInfoService;
import com.uniform.common.utils.ChaebunUtil;
import com.uniform.common.utils.FileUtil;
import com.uniform.common.utils.InfoUtil;
import com.uniform.em.common.vo.EmCommonVO;
import com.uniform.si.info.service.SiInfoService;
import com.uniform.si.info.vo.SiInfoVO;
@Controller
@RequestMapping("/si")
public class SiInfoController {
private Logger logger = Logger.getLogger(SiInfoController.class);
@Autowired
private CommonInfoService commonInfoService;
@Autowired
private SiInfoService siInfoService;
@RequestMapping("/goSiMain")
public ModelAndView siMain(@ModelAttribute SiInfoVO sivo,HttpServletRequest request){
logger.info("siMain 호출 성공");
EmCommonVO ecvo = new EmCommonVO();
List<SiInfoVO> list = null;
HttpSession hs = request.getSession();
String i_no = (String)hs.getAttribute("i_no");
ecvo.setI_no(i_no);
EmCommonVO miniVO = commonInfoService.miniInfo(ecvo);
list = siInfoService.studentList(sivo);
ModelAndView mav = new ModelAndView();
mav.addObject("miniVO",miniVO);
mav.addObject("siList",list);
mav.setViewName("si/siMain");
return mav;
}// end of siMain() 함수
@RequestMapping("/goInsertSi")
public ModelAndView goInsertSi(){
logger.info("goInsertSi 호출 성공");
ModelAndView mav = new ModelAndView();
mav.setViewName("si/insertSi");
return mav;
}// end of goInsertSi() 함수
@ResponseBody
@RequestMapping(value="/imgUpload",produces="application/text; charset=utf-8")
public String imgUpload(HttpServletRequest request){
logger.info("imgUpload 호출 성공");
String upload = "/si/img";
String si_img = "";
try{
si_img = FileUtil.fileUpload(request, upload);
System.out.println("등록한 사진 이름 >>> : " + si_img);
}catch(Exception e){
System.out.println("에러났다 >>> : " + e.getMessage());
}
return si_img;
}// end of imgUpload() 함수
@ResponseBody
@RequestMapping(value="/insertSi",produces="application/text; charset=utf-8")
public String insertSi(@ModelAttribute SiInfoVO sivo){
logger.info("insertSi 호출 성공");
String result = "";
SiInfoVO chaebunVO = siInfoService.siChaebun();
String no = chaebunVO.getI_no();
String i_no = ChaebunUtil.getChaebun(no, "si");
sivo.setI_no(i_no);
int cnt = siInfoService.insertSi(sivo);
if(cnt==2){
result = "성공";
}else{
result = "알 수 없는 이유로 실패 했습니다. 문의 주세요";
}
return result;
}// end of insertSi() 함수
@RequestMapping("/goDetailSi")
public ModelAndView goDetailSi(@ModelAttribute SiInfoVO sivo){
logger.info("goDetailSi 호출 성공");
SiInfoVO detailVO = siInfoService.detailSi(sivo);
detailVO = InfoUtil.siSetting(detailVO);
ModelAndView mav = new ModelAndView();
mav.addObject("detailVO",detailVO);
mav.setViewName("si/detailSi");
return mav;
}// end of goDetailSi() 함수
@RequestMapping("/goUpdateSi")
public ModelAndView goUpdateSi(@ModelAttribute SiInfoVO sivo){
logger.info("goUpdateSi 호출 성공");
SiInfoVO cDetailVO = siInfoService.cDetailSi(sivo);
ModelAndView mav = new ModelAndView();
mav.addObject("cDetailVO",cDetailVO);
mav.setViewName("si/updateSi");
return mav;
}// end of goUpdateSi() 함수
@ResponseBody
@RequestMapping(value="/uploadFile",produces="application/text; charset=utf-8")
public String uploadFile(HttpServletRequest request){
logger.info("uploadFile 호출 성공");
String si_img = "";
String upload = "/si/img";
try{
si_img = FileUtil.fileUpload(request, upload);
System.out.println("업로드한 파일 이름 >>> : " + si_img);
}catch(Exception e){
System.out.println("에러났다 >>> : " + e.getMessage());
}
return si_img;
}// end of uploadFile() 함수
@ResponseBody
@RequestMapping(value="/updateSi",produces="application/text; charset=utf-8")
public String updateSi(@ModelAttribute SiInfoVO sivo){
logger.info("updateSi 호출 성공");
String result = "";
int cnt = siInfoService.updateStudent(sivo);
if(cnt==2){
result = "성공";
}else{
result = "알 수 없는 이유로 실패 했습니다. 문의 주세요";
}
return result;
}// end of updateSi() 함수
@ResponseBody
@RequestMapping(value="/deleteSi",produces="application/text; charset=utf-8")
public String deleteSi(@ModelAttribute SiInfoVO sivo){
logger.info("deleteSi 호출 성공");
// String path = "C:/L_work/java142Uniform/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/uniForm";
String path = "D:/00.BITCAMP/java142Uniform/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/uniForm";
// String path = "C:/Users/이상훈/Desktop/java142Uniform/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/uniForm";
String delete = "/si/img/";
String result = "";
System.out.println("들어온거 >>>> : " + sivo.getI_no() + " : " + sivo.getSi_img());
int cnt = siInfoService.deleteSi(sivo);
if(cnt==1){
File f = new File(path + delete + sivo.getSi_img());
System.out.println("파일 맞습니까? >>> : " + f.isFile() + " : " + f);
boolean fileBool = f.delete();
if(fileBool){
result = "성공";
}else{
result = "알 수 없는 이유로 실패 했습니다. 문의 주세요";
}
}else{
result = "알 수 없는 이유로 실패 했습니다. 문의 주세요";
}
return result;
}// end of deleteSi() 함수
}// end of SiInfoController class
| 6,124 | 0.70197 | 0.697996 | 209 | 26.693779 | 24.223284 | 127 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.15311 | false | false |
9
|
a06e3ff320946deecdddcb1d4be224a767ec3dc0
| 31,430,570,689,326 |
0c519027fa48edbeebec017b814488fa61d5181a
|
/src/de/ethasia/exorions/ioadapters/presenters/RealGatewaysFactory.java
|
6d820055c95a9b1a4edda567809ffd028195759e
|
[
"MIT"
] |
permissive
|
TheYaumrDevR/Exorions
|
https://github.com/TheYaumrDevR/Exorions
|
65b2a53cbd70ecc4b591daa83da60f225a8f2876
|
8384df470c53fcbf6268da6f2f850b898ebcf254
|
refs/heads/master
| 2020-04-12T22:59:26.927000 | 2019-12-09T07:44:00 | 2019-12-09T07:44:00 | 162,804,744 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package de.ethasia.exorions.ioadapters.presenters;
import de.ethasia.exorions.interactors.interfaces.GatewaysFactory;
import de.ethasia.exorions.ioadapters.gateways.MapDefinitionsGatewayImpl;
import de.ethasia.exorions.interactors.crosslayer.MapDefinitionsGateway;
public class RealGatewaysFactory extends GatewaysFactory {
//<editor-fold defaultstate="collapsed" desc="GatewaysFactory Overrides">
@Override
public MapDefinitionsGateway createMapMetaDataGateway() {
return new MapDefinitionsGatewayImpl();
}
//</editor-fold>
}
|
UTF-8
|
Java
| 591 |
java
|
RealGatewaysFactory.java
|
Java
|
[] | null |
[] |
package de.ethasia.exorions.ioadapters.presenters;
import de.ethasia.exorions.interactors.interfaces.GatewaysFactory;
import de.ethasia.exorions.ioadapters.gateways.MapDefinitionsGatewayImpl;
import de.ethasia.exorions.interactors.crosslayer.MapDefinitionsGateway;
public class RealGatewaysFactory extends GatewaysFactory {
//<editor-fold defaultstate="collapsed" desc="GatewaysFactory Overrides">
@Override
public MapDefinitionsGateway createMapMetaDataGateway() {
return new MapDefinitionsGatewayImpl();
}
//</editor-fold>
}
| 591 | 0.758037 | 0.758037 | 17 | 32.882355 | 29.773424 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.294118 | false | false |
9
|
828c550928dd39ffcff85fcb46299902c4f9a782
| 5,523,327,963,986 |
276936fa27e2d8a168cd6bca71022bba72d44be7
|
/2017_TeamProject_Spring/src/main/java/dao/MemberDao.java
|
f84f2f2b2808e6b0489b1821e46c040af2276aee
|
[] |
no_license
|
jijonam/projectfile_2
|
https://github.com/jijonam/projectfile_2
|
caccca50dd36f49ceca520612374432937f5d787
|
9a21977ff3e20e0e27df01be145113dbb734eeaf
|
refs/heads/master
| 2021-01-20T00:11:14.118000 | 2017-09-09T08:59:52 | 2017-09-09T08:59:52 | 101,272,807 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package dao;
import java.util.List;
import org.apache.ibatis.session.SqlSession;
import vo.MemberVo;
public class MemberDao {
SqlSession sqlSession;
public SqlSession getSqlSession() {
return sqlSession;
}
public void setSqlSession(SqlSession sqlSession) {
this.sqlSession = sqlSession;
}
public List<MemberVo> selectList() {
List<MemberVo> list = null;
//1.ÀÛ¾÷°´Ã¼ ȹµæ
list = sqlSession.selectList("member_list");
return list;
}
public MemberVo selectOne(String email){
// TODO Auto-generated method stub
MemberVo vo = null;
//2.ÀÛ¾÷
vo = sqlSession.selectOne("member_one", email);
return vo;
}
public int insert(MemberVo vo) {
// TODO Auto-generated method stub
int res = 0;
//2.ÀÛ¾÷
res = sqlSession.insert("member_insert",vo);
return res;
}
}
|
WINDOWS-1252
|
Java
| 876 |
java
|
MemberDao.java
|
Java
|
[] | null |
[] |
package dao;
import java.util.List;
import org.apache.ibatis.session.SqlSession;
import vo.MemberVo;
public class MemberDao {
SqlSession sqlSession;
public SqlSession getSqlSession() {
return sqlSession;
}
public void setSqlSession(SqlSession sqlSession) {
this.sqlSession = sqlSession;
}
public List<MemberVo> selectList() {
List<MemberVo> list = null;
//1.ÀÛ¾÷°´Ã¼ ȹµæ
list = sqlSession.selectList("member_list");
return list;
}
public MemberVo selectOne(String email){
// TODO Auto-generated method stub
MemberVo vo = null;
//2.ÀÛ¾÷
vo = sqlSession.selectOne("member_one", email);
return vo;
}
public int insert(MemberVo vo) {
// TODO Auto-generated method stub
int res = 0;
//2.ÀÛ¾÷
res = sqlSession.insert("member_insert",vo);
return res;
}
}
| 876 | 0.65771 | 0.647196 | 48 | 15.833333 | 16.633717 | 51 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.270833 | false | false |
9
|
68d3b0d600292088c8b4181a085b6379fef96ba2
| 9,603,546,889,871 |
31ec10fc7ad04c78c140f4b7e1e3b271d48a2c44
|
/app/src/main/java/com/parallelspace/parallelspace/Chadim_Home.java
|
f38c40195eb87984ab86d56ce65d38064a32e73a
|
[] |
no_license
|
ayubbaba/ParallelSpace
|
https://github.com/ayubbaba/ParallelSpace
|
08bf04c5208b29545f335aca5a079a460fc17387
|
8c77a59fae10d4d49c18d58ca54fb37286ebe525
|
refs/heads/master
| 2017-07-20T13:24:26.396000 | 2017-02-24T10:43:55 | 2017-02-24T10:43:55 | 83,030,242 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.parallelspace.parallelspace;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.NavigationView;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.GravityCompat;
import android.support.v4.view.ViewPager;
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.MenuItem;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import fragments.Chat_Fragements;
public class Chadim_Home extends AppCompatActivity {
@BindView(R.id.chadim_home_toolbar)
Toolbar chadim_home_toolbar;
@BindView(R.id.home_screen_tablayout)
TabLayout home_screen_tablayout;
@BindView(R.id.tab_pager)
ViewPager tab_pager;
@BindView(R.id.nav_view)
NavigationView nav_view;
@BindView(R.id.drawer)
DrawerLayout drawer;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.chat_homescreen);
ButterKnife.bind(this);
setSupportActionBar(chadim_home_toolbar);
assert getSupportActionBar() != null;
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setTitle("Home Screen");
chadim_home_toolbar.setTitleTextColor(getResources().getColor(R.color.green));
setupviewpager(tab_pager);
home_screen_tablayout.setupWithViewPager(tab_pager);
nav_view.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(MenuItem menuItem) {
if (menuItem.getItemId() == R.id.home) {
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
}
} else if (menuItem.getItemId() == R.id.frd_req) {
startActivity(new Intent(getApplicationContext(), Friend_request.class));
} else if (menuItem.getItemId() == R.id.rooms) {
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
TabLayout.Tab roomtab=home_screen_tablayout.getTabAt(2);
roomtab.select();
}
} else if (menuItem.getItemId() == R.id.groups) {
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
TabLayout.Tab grouptab=home_screen_tablayout.getTabAt(1);
grouptab.select();
}
} else if (menuItem.getItemId() == R.id.settings) {
startActivity(new Intent(getApplicationContext(), Setting.class));
} else if (menuItem.getItemId() == R.id.about_us) {
Intent userguideintent = new Intent(getApplicationContext(), Terms.class);
userguideintent.putExtra("toolbarname", "aboutus");
startActivity(userguideintent);
} else if (menuItem.getItemId() == R.id.user_guide) {
Intent userguideintent = new Intent(getApplicationContext(), Terms.class);
userguideintent.putExtra("toolbarname", "userguide");
startActivity(userguideintent);
} else if (menuItem.getItemId() == R.id.terms) {
Intent userguideintent = new Intent(getApplicationContext(), Terms.class);
userguideintent.putExtra("toolbarname", "terms");
startActivity(userguideintent);
}
return false;
}
});
ActionBarDrawerToggle mDrawerToggle = new ActionBarDrawerToggle(this, drawer, chadim_home_toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.setDrawerListener(mDrawerToggle);
mDrawerToggle.syncState();
}
@Override
public void onBackPressed() {
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer);
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else {
Intent closeapp = new Intent(Intent.ACTION_MAIN);
closeapp.addCategory(Intent.CATEGORY_HOME);
closeapp.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(closeapp);
}
}
private void setupviewpager(ViewPager viewPager) {
TabLayoutPager tabLayoutPager = new TabLayoutPager(getSupportFragmentManager());
tabLayoutPager.addFragment(new Chat_Fragements(), "chats");
tabLayoutPager.addFragment(new Chat_Fragements(), "groups");
tabLayoutPager.addFragment(new Chat_Fragements(), "rooms");
/*tabLayoutPager.addFragment(new Friends_Fragements(), "Friends");
tabLayoutPager.addFragment(new Group_Fragements(), "groups");*/
viewPager.setAdapter(tabLayoutPager);
}
class TabLayoutPager extends FragmentPagerAdapter {
private final List<Fragment> mFragmentList = new ArrayList<>();
private final List<String> mFragmentTitleList = new ArrayList<>();
public TabLayoutPager(FragmentManager manager) {
super(manager);
}
@Override
public Fragment getItem(int position) {
return mFragmentList.get(position);
}
@Override
public int getCount() {
return mFragmentList.size();
}
public void addFragment(Fragment fragment, String title) {
mFragmentList.add(fragment);
mFragmentTitleList.add(title);
}
@Override
public CharSequence getPageTitle(int position) {
return mFragmentTitleList.get(position);
}
}
}
|
UTF-8
|
Java
| 6,314 |
java
|
Chadim_Home.java
|
Java
|
[] | null |
[] |
package com.parallelspace.parallelspace;
import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.NavigationView;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.GravityCompat;
import android.support.v4.view.ViewPager;
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.MenuItem;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import fragments.Chat_Fragements;
public class Chadim_Home extends AppCompatActivity {
@BindView(R.id.chadim_home_toolbar)
Toolbar chadim_home_toolbar;
@BindView(R.id.home_screen_tablayout)
TabLayout home_screen_tablayout;
@BindView(R.id.tab_pager)
ViewPager tab_pager;
@BindView(R.id.nav_view)
NavigationView nav_view;
@BindView(R.id.drawer)
DrawerLayout drawer;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.chat_homescreen);
ButterKnife.bind(this);
setSupportActionBar(chadim_home_toolbar);
assert getSupportActionBar() != null;
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setTitle("Home Screen");
chadim_home_toolbar.setTitleTextColor(getResources().getColor(R.color.green));
setupviewpager(tab_pager);
home_screen_tablayout.setupWithViewPager(tab_pager);
nav_view.setNavigationItemSelectedListener(new NavigationView.OnNavigationItemSelectedListener() {
@Override
public boolean onNavigationItemSelected(MenuItem menuItem) {
if (menuItem.getItemId() == R.id.home) {
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
}
} else if (menuItem.getItemId() == R.id.frd_req) {
startActivity(new Intent(getApplicationContext(), Friend_request.class));
} else if (menuItem.getItemId() == R.id.rooms) {
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
TabLayout.Tab roomtab=home_screen_tablayout.getTabAt(2);
roomtab.select();
}
} else if (menuItem.getItemId() == R.id.groups) {
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
TabLayout.Tab grouptab=home_screen_tablayout.getTabAt(1);
grouptab.select();
}
} else if (menuItem.getItemId() == R.id.settings) {
startActivity(new Intent(getApplicationContext(), Setting.class));
} else if (menuItem.getItemId() == R.id.about_us) {
Intent userguideintent = new Intent(getApplicationContext(), Terms.class);
userguideintent.putExtra("toolbarname", "aboutus");
startActivity(userguideintent);
} else if (menuItem.getItemId() == R.id.user_guide) {
Intent userguideintent = new Intent(getApplicationContext(), Terms.class);
userguideintent.putExtra("toolbarname", "userguide");
startActivity(userguideintent);
} else if (menuItem.getItemId() == R.id.terms) {
Intent userguideintent = new Intent(getApplicationContext(), Terms.class);
userguideintent.putExtra("toolbarname", "terms");
startActivity(userguideintent);
}
return false;
}
});
ActionBarDrawerToggle mDrawerToggle = new ActionBarDrawerToggle(this, drawer, chadim_home_toolbar, R.string.navigation_drawer_open, R.string.navigation_drawer_close);
drawer.setDrawerListener(mDrawerToggle);
mDrawerToggle.syncState();
}
@Override
public void onBackPressed() {
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer);
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else {
Intent closeapp = new Intent(Intent.ACTION_MAIN);
closeapp.addCategory(Intent.CATEGORY_HOME);
closeapp.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(closeapp);
}
}
private void setupviewpager(ViewPager viewPager) {
TabLayoutPager tabLayoutPager = new TabLayoutPager(getSupportFragmentManager());
tabLayoutPager.addFragment(new Chat_Fragements(), "chats");
tabLayoutPager.addFragment(new Chat_Fragements(), "groups");
tabLayoutPager.addFragment(new Chat_Fragements(), "rooms");
/*tabLayoutPager.addFragment(new Friends_Fragements(), "Friends");
tabLayoutPager.addFragment(new Group_Fragements(), "groups");*/
viewPager.setAdapter(tabLayoutPager);
}
class TabLayoutPager extends FragmentPagerAdapter {
private final List<Fragment> mFragmentList = new ArrayList<>();
private final List<String> mFragmentTitleList = new ArrayList<>();
public TabLayoutPager(FragmentManager manager) {
super(manager);
}
@Override
public Fragment getItem(int position) {
return mFragmentList.get(position);
}
@Override
public int getCount() {
return mFragmentList.size();
}
public void addFragment(Fragment fragment, String title) {
mFragmentList.add(fragment);
mFragmentTitleList.add(title);
}
@Override
public CharSequence getPageTitle(int position) {
return mFragmentTitleList.get(position);
}
}
}
| 6,314 | 0.641907 | 0.640165 | 151 | 40.814571 | 28.561867 | 174 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.649007 | false | false |
9
|
8cb324dc145a4ed5280389a66f29d73ce82eb50d
| 4,389,456,597,707 |
b69d72bd7d66ec1d70402c0defa9b0f0b064be91
|
/java8开发/src/homework03/Test01.java
|
5eff8cb50f2b8ffb445d39b5b9e864f85c0f1c93
|
[] |
no_license
|
KILLER2017/eclipse-workspace
|
https://github.com/KILLER2017/eclipse-workspace
|
ba9a538b62727b80a04f4da04f5eb2b7295be810
|
33ade5b8f2bf3afd2688276caf5c316fa69fe3b5
|
refs/heads/master
| 2021-01-23T00:52:49.857000 | 2017-05-30T16:36:24 | 2017-05-30T16:36:24 | 92,851,808 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package homework03;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
@SuppressWarnings("serial")
public class Test01 extends JFrame{
private JPanel pCenter,pNorth,pSouth;
private JLabel[] lblDayInfo;
private JLabel lblMsg;
private JButton nextMonth,previousMonth;
private int iToday = 1,selectedDay = -1;
public Test01() {
super("日历");
// 实例化所有组件
pCenter = new JPanel();
pNorth = new JPanel();
pSouth = new JPanel();
lblDayInfo = new JLabel[49];
lblMsg = new JLabel();
nextMonth = new JButton("下一月");
previousMonth = new JButton("上一月");
// 为面板、窗体设置布局管理器
this.setLayout(new BorderLayout());
pCenter.setLayout(new GridLayout(7,7));
pNorth.setLayout(new FlowLayout());
pSouth.setLayout(new FlowLayout());
for(int i =0;i < lblDayInfo.length;i++)
{
switch(i)
{
case 0:lblDayInfo[i] = new JLabel("星期日");break;
case 1:lblDayInfo[i] = new JLabel("星期一");break;
case 2:lblDayInfo[i] = new JLabel("星期二");break;
case 3:lblDayInfo[i] = new JLabel("星期三");break;
case 4:lblDayInfo[i] = new JLabel("星期四");break;
case 5:lblDayInfo[i] = new JLabel("星期五");break;
case 6:lblDayInfo[i] = new JLabel("星期六");break;
default:{
if(i<38)
lblDayInfo[i] = new JLabel(""+(i-6));
else
lblDayInfo[i] = new JLabel(""+(i-37));
}
}
lblDayInfo[i].setVerticalAlignment(SwingConstants.TOP);
lblDayInfo[i].setFont(new Font("微软雅黑",Font.BOLD, 24));
lblDayInfo[i].setForeground(Color.gray);
lblDayInfo[i].addMouseListener(new ClickDayInfo());
}
this.setBackground(Color.white);
pNorth.setBackground(Color.white);
pCenter.setBackground(Color.white);
pSouth.setBackground(Color.WHITE);
lblDayInfo[15].setBorder(BorderFactory.createLineBorder(Color.white));
lblMsg.setSize(100,100);
System.out.println(lblDayInfo.length);
try{
for(int i =0;i < lblDayInfo.length;i++)
{
pCenter.add(lblDayInfo[i]);
}
} catch(Exception e) {
e.printStackTrace();
}
pNorth.add(previousMonth);
pNorth.add(nextMonth);
pSouth.add(lblMsg);
this.add(pCenter,BorderLayout.CENTER);
this.add(pNorth, BorderLayout.NORTH);
this.add(pSouth,BorderLayout.SOUTH);
// 设置窗体大小
this.setSize(900,700);
// 设置窗体显示位置
this.setLocationRelativeTo(null);
// 设置窗体不能改变大小
this.setResizable(false);
// 设置窗体的默认关闭按钮
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// 设置窗体初始为可见
this.setVisible(true);
}
class ClickDayInfo implements MouseListener {
@Override
public void mouseClicked(MouseEvent e) {
// TODO 自动生成的方法存根
System.out.println("标签被点击");
if(selectedDay != -1)
lblDayInfo[selectedDay].setBackground(Color.white);
((JLabel) e.getSource()).setBackground(Color.yellow);
int dayNum = Integer.valueOf(((JLabel) e.getSource()).getText()).intValue();
lblDayInfo[dayNum+6].setOpaque(true);
lblDayInfo[dayNum+6].setBackground(Color.yellow);
selectedDay = dayNum+6;
}
@Override
public void mouseEntered(MouseEvent e) {
// TODO 自动生成的方法存根
}
@Override
public void mouseExited(MouseEvent e) {
// TODO 自动生成的方法存根
}
@Override
public void mousePressed(MouseEvent e) {
// TODO 自动生成的方法存根
}
@Override
public void mouseReleased(MouseEvent e) {
// TODO 自动生成的方法存根
}
}
public static void main(String[] args) {
// TODO 自动生成的方法存根
new Test01();
}
}
|
GB18030
|
Java
| 4,176 |
java
|
Test01.java
|
Java
|
[] | null |
[] |
package homework03;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;
@SuppressWarnings("serial")
public class Test01 extends JFrame{
private JPanel pCenter,pNorth,pSouth;
private JLabel[] lblDayInfo;
private JLabel lblMsg;
private JButton nextMonth,previousMonth;
private int iToday = 1,selectedDay = -1;
public Test01() {
super("日历");
// 实例化所有组件
pCenter = new JPanel();
pNorth = new JPanel();
pSouth = new JPanel();
lblDayInfo = new JLabel[49];
lblMsg = new JLabel();
nextMonth = new JButton("下一月");
previousMonth = new JButton("上一月");
// 为面板、窗体设置布局管理器
this.setLayout(new BorderLayout());
pCenter.setLayout(new GridLayout(7,7));
pNorth.setLayout(new FlowLayout());
pSouth.setLayout(new FlowLayout());
for(int i =0;i < lblDayInfo.length;i++)
{
switch(i)
{
case 0:lblDayInfo[i] = new JLabel("星期日");break;
case 1:lblDayInfo[i] = new JLabel("星期一");break;
case 2:lblDayInfo[i] = new JLabel("星期二");break;
case 3:lblDayInfo[i] = new JLabel("星期三");break;
case 4:lblDayInfo[i] = new JLabel("星期四");break;
case 5:lblDayInfo[i] = new JLabel("星期五");break;
case 6:lblDayInfo[i] = new JLabel("星期六");break;
default:{
if(i<38)
lblDayInfo[i] = new JLabel(""+(i-6));
else
lblDayInfo[i] = new JLabel(""+(i-37));
}
}
lblDayInfo[i].setVerticalAlignment(SwingConstants.TOP);
lblDayInfo[i].setFont(new Font("微软雅黑",Font.BOLD, 24));
lblDayInfo[i].setForeground(Color.gray);
lblDayInfo[i].addMouseListener(new ClickDayInfo());
}
this.setBackground(Color.white);
pNorth.setBackground(Color.white);
pCenter.setBackground(Color.white);
pSouth.setBackground(Color.WHITE);
lblDayInfo[15].setBorder(BorderFactory.createLineBorder(Color.white));
lblMsg.setSize(100,100);
System.out.println(lblDayInfo.length);
try{
for(int i =0;i < lblDayInfo.length;i++)
{
pCenter.add(lblDayInfo[i]);
}
} catch(Exception e) {
e.printStackTrace();
}
pNorth.add(previousMonth);
pNorth.add(nextMonth);
pSouth.add(lblMsg);
this.add(pCenter,BorderLayout.CENTER);
this.add(pNorth, BorderLayout.NORTH);
this.add(pSouth,BorderLayout.SOUTH);
// 设置窗体大小
this.setSize(900,700);
// 设置窗体显示位置
this.setLocationRelativeTo(null);
// 设置窗体不能改变大小
this.setResizable(false);
// 设置窗体的默认关闭按钮
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// 设置窗体初始为可见
this.setVisible(true);
}
class ClickDayInfo implements MouseListener {
@Override
public void mouseClicked(MouseEvent e) {
// TODO 自动生成的方法存根
System.out.println("标签被点击");
if(selectedDay != -1)
lblDayInfo[selectedDay].setBackground(Color.white);
((JLabel) e.getSource()).setBackground(Color.yellow);
int dayNum = Integer.valueOf(((JLabel) e.getSource()).getText()).intValue();
lblDayInfo[dayNum+6].setOpaque(true);
lblDayInfo[dayNum+6].setBackground(Color.yellow);
selectedDay = dayNum+6;
}
@Override
public void mouseEntered(MouseEvent e) {
// TODO 自动生成的方法存根
}
@Override
public void mouseExited(MouseEvent e) {
// TODO 自动生成的方法存根
}
@Override
public void mousePressed(MouseEvent e) {
// TODO 自动生成的方法存根
}
@Override
public void mouseReleased(MouseEvent e) {
// TODO 自动生成的方法存根
}
}
public static void main(String[] args) {
// TODO 自动生成的方法存根
new Test01();
}
}
| 4,176 | 0.658126 | 0.645704 | 157 | 22.611465 | 18.152802 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.579618 | false | false |
9
|
3d160b5025a0a57614353c33fbaad83e406c355d
| 33,200,097,213,103 |
6f672fb72caedccb841ee23f53e32aceeaf1895e
|
/wish-source/src/com/contextlogic/wish/ui/fragment/cartmodal/CheckoutCartManager$3.java
|
bb4bc2b34e65d184020209dab46acb7ae001dd20
|
[] |
no_license
|
cha63506/CompSecurity
|
https://github.com/cha63506/CompSecurity
|
5c69743f660b9899146ed3cf21eceabe3d5f4280
|
eee7e74f4088b9c02dd711c061fc04fb1e4e2654
|
refs/heads/master
| 2018-03-23T04:15:18.480000 | 2015-12-19T01:29:58 | 2015-12-19T01:29:58 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: braces fieldsfirst space lnc
package com.contextlogic.wish.ui.fragment.cartmodal;
import com.contextlogic.wish.api.data.WishCart;
import com.contextlogic.wish.api.data.WishShippingInfo;
import com.contextlogic.wish.api.data.WishUpsellOffer;
import com.contextlogic.wish.api.data.WishUserBillingInfo;
// Referenced classes of package com.contextlogic.wish.ui.fragment.cartmodal:
// CheckoutCartManager
class this._cls0
implements com.contextlogic.wish.api.service.essCallback
{
final CheckoutCartManager this$0;
public void onServiceSucceeded(WishCart wishcart, WishShippingInfo wishshippinginfo, WishUserBillingInfo wishuserbillinginfo, WishUpsellOffer wishupselloffer)
{
boolean flag1 = true;
CheckoutCartManager.access$202(CheckoutCartManager.this, wishupselloffer);
CheckoutCartManager checkoutcartmanager = CheckoutCartManager.this;
boolean flag;
if (wishupselloffer != null)
{
flag = true;
} else
{
flag = false;
}
CheckoutCartManager.access$302(checkoutcartmanager, flag);
checkoutcartmanager = CheckoutCartManager.this;
if (wishcart != null)
{
wishupselloffer = wishcart.getCartEducationModalSpec();
} else
{
wishupselloffer = null;
}
CheckoutCartManager.access$402(checkoutcartmanager, wishupselloffer);
wishupselloffer = CheckoutCartManager.this;
if (CheckoutCartManager.access$400(CheckoutCartManager.this) != null)
{
flag = flag1;
} else
{
flag = false;
}
CheckoutCartManager.access$502(wishupselloffer, flag);
hideLoadingSpinner();
CheckoutCartManager.access$000(CheckoutCartManager.this, wishcart, wishshippinginfo, wishuserbillinginfo);
}
k()
{
this$0 = CheckoutCartManager.this;
super();
}
}
|
UTF-8
|
Java
| 2,098 |
java
|
CheckoutCartManager$3.java
|
Java
|
[
{
"context": "// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.\n// Jad home page: http://www.geocities.com/kpdus",
"end": 61,
"score": 0.9995923042297363,
"start": 45,
"tag": "NAME",
"value": "Pavel Kouznetsov"
}
] | null |
[] |
// Decompiled by Jad v1.5.8e. Copyright 2001 <NAME>.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: braces fieldsfirst space lnc
package com.contextlogic.wish.ui.fragment.cartmodal;
import com.contextlogic.wish.api.data.WishCart;
import com.contextlogic.wish.api.data.WishShippingInfo;
import com.contextlogic.wish.api.data.WishUpsellOffer;
import com.contextlogic.wish.api.data.WishUserBillingInfo;
// Referenced classes of package com.contextlogic.wish.ui.fragment.cartmodal:
// CheckoutCartManager
class this._cls0
implements com.contextlogic.wish.api.service.essCallback
{
final CheckoutCartManager this$0;
public void onServiceSucceeded(WishCart wishcart, WishShippingInfo wishshippinginfo, WishUserBillingInfo wishuserbillinginfo, WishUpsellOffer wishupselloffer)
{
boolean flag1 = true;
CheckoutCartManager.access$202(CheckoutCartManager.this, wishupselloffer);
CheckoutCartManager checkoutcartmanager = CheckoutCartManager.this;
boolean flag;
if (wishupselloffer != null)
{
flag = true;
} else
{
flag = false;
}
CheckoutCartManager.access$302(checkoutcartmanager, flag);
checkoutcartmanager = CheckoutCartManager.this;
if (wishcart != null)
{
wishupselloffer = wishcart.getCartEducationModalSpec();
} else
{
wishupselloffer = null;
}
CheckoutCartManager.access$402(checkoutcartmanager, wishupselloffer);
wishupselloffer = CheckoutCartManager.this;
if (CheckoutCartManager.access$400(CheckoutCartManager.this) != null)
{
flag = flag1;
} else
{
flag = false;
}
CheckoutCartManager.access$502(wishupselloffer, flag);
hideLoadingSpinner();
CheckoutCartManager.access$000(CheckoutCartManager.this, wishcart, wishshippinginfo, wishuserbillinginfo);
}
k()
{
this$0 = CheckoutCartManager.this;
super();
}
}
| 2,088 | 0.680648 | 0.666349 | 62 | 32.838711 | 31.77146 | 162 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.564516 | false | false |
9
|
e991ed21355c86a6a68149e5c9f35e88b781c852
| 28,973,849,402,238 |
aa22f5bdad69a6bdc9e8bef269ed14783c159bae
|
/HelloWorld.java
|
89befd95a2f3170069acb9aaf6ba6ec89df87718
|
[] |
no_license
|
jyzhou/ProgrammingAssignment2
|
https://github.com/jyzhou/ProgrammingAssignment2
|
3fc6071e218fb7f6ac34b58a4d0de641d695d84d
|
ccdb1e8ad521e44eb9635574711f402332922210
|
refs/heads/master
| 2021-01-11T11:09:05.174000 | 2016-03-19T10:07:02 | 2016-03-19T10:07:02 | 46,631,399 | 0 | 0 | null | true | 2015-11-21T19:59:28 | 2015-11-21T19:59:28 | 2015-11-21T16:57:07 | 2015-11-21T19:49:33 | 6,670 | 0 | 0 | 0 | null | null | null |
public class HelloWorld{
public HelloWorld(){
System.out.println("Hello World, Git and Azure!");
}
public static void main(String[] args){
HelloWorld HW = new HelloWorld();
}
}
|
UTF-8
|
Java
| 197 |
java
|
HelloWorld.java
|
Java
|
[] | null |
[] |
public class HelloWorld{
public HelloWorld(){
System.out.println("Hello World, Git and Azure!");
}
public static void main(String[] args){
HelloWorld HW = new HelloWorld();
}
}
| 197 | 0.654822 | 0.654822 | 10 | 18.6 | 18.964176 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false |
9
|
5bf4995a1141f6576f0c33f7dfde75766dfd6348
| 12,618,613,954,993 |
6e03d0b447fab8a5b9d6e801efd143846d614bdd
|
/app/src/main/java/com/sen5/test/mvp/view/IUserLoginView.java
|
864a66eafc8881a73bca44f892726ea9ec6681e7
|
[] |
no_license
|
Pickerchen/MaterialDesig_android
|
https://github.com/Pickerchen/MaterialDesig_android
|
6cf9ba9a5c65dac046b638b25cff32c8f1c314e2
|
efd0a47ad6bb64a9b60cf721be3d776d7f3f052f
|
refs/heads/master
| 2021-01-22T20:13:40.452000 | 2017-03-17T10:42:39 | 2017-03-17T10:42:39 | 85,300,486 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.sen5.test.mvp.view;
/**
* Created by chenqianghua on 2017/2/9.
*/
public interface IUserLoginView {
public void clear();
public String getUserName();
public String getPassWord();
public void showSuccess();
public void showFail();
public void showProgressBar();
public void disMissProgressBar();
}
|
UTF-8
|
Java
| 341 |
java
|
IUserLoginView.java
|
Java
|
[
{
"context": "package com.sen5.test.mvp.view;\n\n/**\n * Created by chenqianghua on 2017/2/9.\n */\n\npublic interface IUserLoginView",
"end": 63,
"score": 0.991306722164154,
"start": 51,
"tag": "USERNAME",
"value": "chenqianghua"
}
] | null |
[] |
package com.sen5.test.mvp.view;
/**
* Created by chenqianghua on 2017/2/9.
*/
public interface IUserLoginView {
public void clear();
public String getUserName();
public String getPassWord();
public void showSuccess();
public void showFail();
public void showProgressBar();
public void disMissProgressBar();
}
| 341 | 0.692082 | 0.671554 | 15 | 21.733334 | 14.793993 | 39 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.533333 | false | false |
9
|
19f894728df74426c1ac1435801bbf7405c63163
| 33,208,687,165,992 |
22d98242f8e17578ad87f91110f81bd92dad3467
|
/midai-pay-posw-api/src/main/java/com/midai/pay/dealtotal/vo/DealtotalVo.java
|
11e3d8ac68d9311507d91c947a628c5649f9a4be
|
[] |
no_license
|
star1cjl/midai-pay
|
https://github.com/star1cjl/midai-pay
|
372c1c7ea4b6301857b1ad3c97d6e42ca8eb14ae
|
295f0ea06cfc1a30a42bcac6290d5a8d2e20127a
|
refs/heads/master
| 2021-05-04T14:51:59.143000 | 2017-11-07T01:59:14 | 2017-11-07T01:59:14 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.midai.pay.dealtotal.vo;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* ClassName:User <br/>
* Function: TODO ADD FUNCTION. <br/>
* Reason: TODO ADD REASON. <br/>
* Date: 2016年9月21日 <br/>
* @author zt
* @version
* @since JDK 1.7
* @see
*/
@Data
@ApiModel
public class DealtotalVo {
@ApiModelProperty(value="交易流水号")
private String hostTransSsn;
@ApiModelProperty(value="返回码")
private String respCdLoc;
@ApiModelProperty(value="返回信息")
private String respCdLocDsp;
@ApiModelProperty(value="商户小票号")
private String mchntCodeIn;
@ApiModelProperty(value="商户名称")
private String mchntName;
@ApiModelProperty(value="代理商名称")
private String agentName;
@ApiModelProperty(value="交易方式(1-mpos, 2-无卡, 3-大pos)")
private String payMode;
@ApiModelProperty(value="交易时间")
private Date transTime;
/* @ApiModelProperty(value="交易总数")
private Integer cc;*/
@ApiModelProperty(value="交易金额")
private String transAmt;
@ApiModelProperty(value="银行卡号")
private String transCardNo;
@ApiModelProperty(value="卡类型")
private String cardKind;
@ApiModelProperty(value="交易类型(消费-0200,消费冲正-0400,余额查询-0210,提现申请-0500,转账-0700,信用卡还款-0600,退款-0220) ")
private String transCode;
@ApiModelProperty(value="商户手机号")
private String mobile;
@ApiModelProperty(value="机身号")
private String deviceNoIn;
@ApiModelProperty(value="发卡行")
private String cardIssName;
@ApiModelProperty(value="发卡行编号")
private String cardIssId;
@ApiModelProperty(value="商户类型")
private String specialFeeType;
@ApiModelProperty(value="交易状态")
private String transStatus;
@ApiModelProperty(value="大商户")
private String mchntCodeOut;
@ApiModelProperty(value="通道机构")
private String routInstIdCd;
@ApiModelProperty(value="代理商编号")
private String agentId;
@ApiModelProperty(value="通道借记卡结算手续费(固定值)%")
private Double instFeeRate;
@ApiModelProperty(value="通道贷记卡结算手续费(固定值)%")
private Double instDfeeRate;
@ApiModelProperty(value="结算手续费(固定值)")
private Double instaFeeRate;
@ApiModelProperty(value="借记卡结算手续费(封顶值)")
private Double instFeeMax;
@ApiModelProperty(value="商户扣率")
private Double mchntRate;
@ApiModelProperty(value="商户单笔扣率")
private Double mchntSingleFee;
@ApiModelProperty(value="结算金额")
private String tixianAmt;
@ApiModelProperty(value="提现手续费")
private String tixianFeeamt;
@ApiModelProperty(value="通道返回码")
private String channelCode;
@ApiModelProperty(value="打款流水号")
private String tixiLogno;
@ApiModelProperty(value="卡类型")
private String cardKindState;
@ApiModelProperty(value="通道手续费")
private String transFee;
@ApiModelProperty(value="通道结算金额")
private String channelMoney;
@ApiModelProperty(value="利润")
private String profits;
@ApiModelProperty(value="顶级代理商")
private String inscode;
@ApiModelProperty(value="商户编号")
private String mercNo;
}
|
UTF-8
|
Java
| 3,476 |
java
|
DealtotalVo.java
|
Java
|
[
{
"context": " <br/>\n * Date: 2016年9月21日 <br/>\n * @author zt\n * @version \n * @since JDK 1.7\n * @see \t \n*/\n",
"end": 317,
"score": 0.9995791912078857,
"start": 315,
"tag": "USERNAME",
"value": "zt"
}
] | null |
[] |
package com.midai.pay.dealtotal.vo;
import java.util.Date;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* ClassName:User <br/>
* Function: TODO ADD FUNCTION. <br/>
* Reason: TODO ADD REASON. <br/>
* Date: 2016年9月21日 <br/>
* @author zt
* @version
* @since JDK 1.7
* @see
*/
@Data
@ApiModel
public class DealtotalVo {
@ApiModelProperty(value="交易流水号")
private String hostTransSsn;
@ApiModelProperty(value="返回码")
private String respCdLoc;
@ApiModelProperty(value="返回信息")
private String respCdLocDsp;
@ApiModelProperty(value="商户小票号")
private String mchntCodeIn;
@ApiModelProperty(value="商户名称")
private String mchntName;
@ApiModelProperty(value="代理商名称")
private String agentName;
@ApiModelProperty(value="交易方式(1-mpos, 2-无卡, 3-大pos)")
private String payMode;
@ApiModelProperty(value="交易时间")
private Date transTime;
/* @ApiModelProperty(value="交易总数")
private Integer cc;*/
@ApiModelProperty(value="交易金额")
private String transAmt;
@ApiModelProperty(value="银行卡号")
private String transCardNo;
@ApiModelProperty(value="卡类型")
private String cardKind;
@ApiModelProperty(value="交易类型(消费-0200,消费冲正-0400,余额查询-0210,提现申请-0500,转账-0700,信用卡还款-0600,退款-0220) ")
private String transCode;
@ApiModelProperty(value="商户手机号")
private String mobile;
@ApiModelProperty(value="机身号")
private String deviceNoIn;
@ApiModelProperty(value="发卡行")
private String cardIssName;
@ApiModelProperty(value="发卡行编号")
private String cardIssId;
@ApiModelProperty(value="商户类型")
private String specialFeeType;
@ApiModelProperty(value="交易状态")
private String transStatus;
@ApiModelProperty(value="大商户")
private String mchntCodeOut;
@ApiModelProperty(value="通道机构")
private String routInstIdCd;
@ApiModelProperty(value="代理商编号")
private String agentId;
@ApiModelProperty(value="通道借记卡结算手续费(固定值)%")
private Double instFeeRate;
@ApiModelProperty(value="通道贷记卡结算手续费(固定值)%")
private Double instDfeeRate;
@ApiModelProperty(value="结算手续费(固定值)")
private Double instaFeeRate;
@ApiModelProperty(value="借记卡结算手续费(封顶值)")
private Double instFeeMax;
@ApiModelProperty(value="商户扣率")
private Double mchntRate;
@ApiModelProperty(value="商户单笔扣率")
private Double mchntSingleFee;
@ApiModelProperty(value="结算金额")
private String tixianAmt;
@ApiModelProperty(value="提现手续费")
private String tixianFeeamt;
@ApiModelProperty(value="通道返回码")
private String channelCode;
@ApiModelProperty(value="打款流水号")
private String tixiLogno;
@ApiModelProperty(value="卡类型")
private String cardKindState;
@ApiModelProperty(value="通道手续费")
private String transFee;
@ApiModelProperty(value="通道结算金额")
private String channelMoney;
@ApiModelProperty(value="利润")
private String profits;
@ApiModelProperty(value="顶级代理商")
private String inscode;
@ApiModelProperty(value="商户编号")
private String mercNo;
}
| 3,476 | 0.724058 | 0.710839 | 139 | 20.769785 | 16.173216 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.194245 | false | false |
9
|
9b2be89a70686b9de9331b1089b02893767e422d
| 25,709,674,293,372 |
fcbcd439a88eef8c951947fb4e6750e69f9b2d07
|
/src/main/java/controller/InvoiceDeleteServlet.java
|
f05061fd2bde1059f5848d0638bfa5f8bf14ba89
|
[] |
no_license
|
gewyckler/java25_JSP_bill_dealer
|
https://github.com/gewyckler/java25_JSP_bill_dealer
|
9905ee3813f53d311ea16c6d1d6283b5a9bfb4d3
|
6c7d25ad6ea04dea92c3a6a34d594aac7d943dd6
|
refs/heads/master
| 2022-07-15T18:59:15.030000 | 2019-10-10T11:37:37 | 2019-10-10T11:37:37 | 209,598,272 | 0 | 0 | null | false | 2022-06-21T01:54:14 | 2019-09-19T16:17:41 | 2019-10-10T11:37:44 | 2022-06-21T01:54:14 | 18,113 | 0 | 0 | 3 |
Java
| false | false |
package controller;
import services.InvoiceService;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/invoiceDelete")
public class InvoiceDeleteServlet extends HttpServlet {
InvoiceService invoiceService = new InvoiceService();
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
Long invoiceIdToDelete = Long.valueOf(req.getParameter("invoiceId"));
invoiceService.removeInvoiceById(invoiceIdToDelete);
resp.sendRedirect("/invoiceList");
}
}
|
UTF-8
|
Java
| 761 |
java
|
InvoiceDeleteServlet.java
|
Java
|
[] | null |
[] |
package controller;
import services.InvoiceService;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@WebServlet("/invoiceDelete")
public class InvoiceDeleteServlet extends HttpServlet {
InvoiceService invoiceService = new InvoiceService();
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
Long invoiceIdToDelete = Long.valueOf(req.getParameter("invoiceId"));
invoiceService.removeInvoiceById(invoiceIdToDelete);
resp.sendRedirect("/invoiceList");
}
}
| 761 | 0.795007 | 0.795007 | 22 | 33.590908 | 28.18552 | 113 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.636364 | false | false |
9
|
76c4b7888013cb7b0dad60e0b155fa8a9466a451
| 5,025,111,748,549 |
716f24977b8382352ccaa2da0c5be3bf3fc1ef50
|
/src/main/java/com/seemingwang/machineLearning/Utils/Structure/Activator.java
|
1de922fad9ba17ecbcb9e6f4c718e4c2bed08d87
|
[] |
no_license
|
seemingwang/MagicFlow
|
https://github.com/seemingwang/MagicFlow
|
7a876c29fc0cbfd863cd58956ba54fa1a4e9cadc
|
66ec51aaf73658ba4247dad06d9153086c651cb5
|
refs/heads/master
| 2022-12-10T10:55:46.794000 | 2020-09-21T03:34:00 | 2020-09-21T03:34:00 | 288,890,826 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.seemingwang.machineLearning.Utils.Structure;
public enum Activator {
relu,sigmoid;
}
|
UTF-8
|
Java
| 102 |
java
|
Activator.java
|
Java
|
[] | null |
[] |
package com.seemingwang.machineLearning.Utils.Structure;
public enum Activator {
relu,sigmoid;
}
| 102 | 0.784314 | 0.784314 | 5 | 19.4 | 20.362711 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6 | false | false |
9
|
532e7323c89f82b53428c4cad95fe3fb1a2cf33e
| 29,403,346,175,230 |
ddba618be2ee3922cf36a505db37f32e8465a704
|
/mistakes/trunk/mistakes/src/main/java/com/xuexin/mistakes/service/impl/CpContentsServiceImpl.java
|
f9b00fb096c4c11ffc3eef88250306c9f0ad2940
|
[] |
no_license
|
panxiong/projects
|
https://github.com/panxiong/projects
|
da0b9783271c548da7b585b1306a97c5c59b900a
|
482031d5ef58ca0d1a21df93796ac5039afe8e8f
|
refs/heads/master
| 2017-12-20T18:34:24.738000 | 2016-12-14T03:49:32 | 2016-12-14T03:49:32 | 76,312,295 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
* Copyright (C) 2013 北京学信科技有限公司
*
* @className:com.xuexin.bizserver.service.impl.UserServiceImpl
* @version:v1.0.0
* @author:李大鹏
*
* Modification History:
* Date Author Version Description
* -----------------------------------------------------------------
* 2013-6-14 李大鹏 v1.0.0 create
*
*/
package com.xuexin.mistakes.service.impl;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xuexin.commons.utils.ListUtils;
import com.xuexin.mistakes.entity.CpContents;
import com.xuexin.mistakes.mapper.CpContentsMapper;
import com.xuexin.mistakes.service.CpContentsService;
@Service
public class CpContentsServiceImpl implements CpContentsService {
private static final Logger Log = LoggerFactory.getLogger(CpContentsService.class);
public static final String XUEXIN_IMG_PARTURL = ".xuexin.org.cn/";// 图片替换路径
@Autowired
private CpContentsMapper cpContentsMapper;
/**
* 获取午餐故事屋树
*
* @return
* @version:v1.0
* @author:zxl
* @date:2016-8-23 下午1:28:04
*/
@Override
public CpContents getCpContents() {
CpContents cpContents = cpContentsMapper.getLshRootByName();
if (cpContents == null) { return null; }
List<CpContents> fistList = cpContentsMapper.findLshFirstLeafByRootId(cpContents.getContentsID());
List<CpContents> leafList = null;
List<CpContents> lastList = null;
if (!ListUtils.isNull(fistList)) {
cpContents.setLeafList(fistList);
leafList = cpContentsMapper.findLshLeafsByPid(fistList);
}
if (!ListUtils.isNull(leafList)) {
setLeaf(fistList, leafList);
lastList = cpContentsMapper.findLshLeafsByPid(leafList);
}
if (!ListUtils.isNull(lastList)) {
setLeaf(leafList, lastList);
}
return cpContents;
}
/**
* 填充叶子子节点
*
* @param list 叶子上一级节点
* @param leafList 叶子子节点
* @version:v1.0
* @author:zxl
* @date:2016-8-23 下午1:59:04
*/
private void setLeaf(List<CpContents> list, List<CpContents> leafList) {
int j = 0;
for (CpContents o : list) {
List<CpContents> fistList = new ArrayList<CpContents>();
for (int i = j; i < leafList.size(); i++) {
if (o.getContentsID() - leafList.get(i).getContentsPID() == 0) {
fistList.add(leafList.get(i));
j++;
} else {
break;
}
}
o.setLeafList(fistList);
}
}
}
|
UTF-8
|
Java
| 2,574 |
java
|
CpContentsServiceImpl.java
|
Java
|
[
{
"context": "pl.UserServiceImpl\n * @version:v1.0.0 \n * @author:李大鹏\n * \n * Modification History:\n * Date Auth",
"end": 138,
"score": 0.9997922778129578,
"start": 135,
"tag": "NAME",
"value": "李大鹏"
},
{
"context": "--------------------------------\n * 2013-6-14 李大鹏 v1.0.0 create\n *\n */",
"end": 309,
"score": 0.9993020296096802,
"start": 306,
"tag": "NAME",
"value": "李大鹏"
},
{
"context": "事屋树\n\t *\n\t * @return\n\t * @version:v1.0\n\t * @author:zxl\n\t * @date:2016-8-23 下午1:28:04\n\t */\n\t@Override\n\tpu",
"end": 1181,
"score": 0.9994526505470276,
"start": 1178,
"tag": "USERNAME",
"value": "zxl"
},
{
"context": "ram leafList\t\t叶子子节点\n\t * @version:v1.0\n\t * @author:zxl\n\t * @date:2016-8-23 下午1:59:04\n\t */\n\tprivate void ",
"end": 2020,
"score": 0.9995911717414856,
"start": 2017,
"tag": "USERNAME",
"value": "zxl"
}
] | null |
[] |
/**
* Copyright (C) 2013 北京学信科技有限公司
*
* @className:com.xuexin.bizserver.service.impl.UserServiceImpl
* @version:v1.0.0
* @author:李大鹏
*
* Modification History:
* Date Author Version Description
* -----------------------------------------------------------------
* 2013-6-14 李大鹏 v1.0.0 create
*
*/
package com.xuexin.mistakes.service.impl;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xuexin.commons.utils.ListUtils;
import com.xuexin.mistakes.entity.CpContents;
import com.xuexin.mistakes.mapper.CpContentsMapper;
import com.xuexin.mistakes.service.CpContentsService;
@Service
public class CpContentsServiceImpl implements CpContentsService {
private static final Logger Log = LoggerFactory.getLogger(CpContentsService.class);
public static final String XUEXIN_IMG_PARTURL = ".xuexin.org.cn/";// 图片替换路径
@Autowired
private CpContentsMapper cpContentsMapper;
/**
* 获取午餐故事屋树
*
* @return
* @version:v1.0
* @author:zxl
* @date:2016-8-23 下午1:28:04
*/
@Override
public CpContents getCpContents() {
CpContents cpContents = cpContentsMapper.getLshRootByName();
if (cpContents == null) { return null; }
List<CpContents> fistList = cpContentsMapper.findLshFirstLeafByRootId(cpContents.getContentsID());
List<CpContents> leafList = null;
List<CpContents> lastList = null;
if (!ListUtils.isNull(fistList)) {
cpContents.setLeafList(fistList);
leafList = cpContentsMapper.findLshLeafsByPid(fistList);
}
if (!ListUtils.isNull(leafList)) {
setLeaf(fistList, leafList);
lastList = cpContentsMapper.findLshLeafsByPid(leafList);
}
if (!ListUtils.isNull(lastList)) {
setLeaf(leafList, lastList);
}
return cpContents;
}
/**
* 填充叶子子节点
*
* @param list 叶子上一级节点
* @param leafList 叶子子节点
* @version:v1.0
* @author:zxl
* @date:2016-8-23 下午1:59:04
*/
private void setLeaf(List<CpContents> list, List<CpContents> leafList) {
int j = 0;
for (CpContents o : list) {
List<CpContents> fistList = new ArrayList<CpContents>();
for (int i = j; i < leafList.size(); i++) {
if (o.getContentsID() - leafList.get(i).getContentsPID() == 0) {
fistList.add(leafList.get(i));
j++;
} else {
break;
}
}
o.setLeafList(fistList);
}
}
}
| 2,574 | 0.680308 | 0.660454 | 90 | 26.422222 | 23.693871 | 100 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.677778 | false | false |
9
|
6f1429cd6b0f59bef66315a81a3e5b44dc2d8873
| 9,268,539,447,855 |
ba8c5eb3c984cd457054211e7411fc5b0ecbe704
|
/SocialMediaWeb/src/org/archcorner/services/BlogService.java
|
0f4f1aab76474e9ae40ab165fcdc15993d436842
|
[
"Apache-2.0"
] |
permissive
|
bhagvank/socialis-media-web
|
https://github.com/bhagvank/socialis-media-web
|
350cb151fabcb29b12f29a1998972d5b9bf16bf5
|
792126162ac85a863371af72b762ffa20c496f97
|
refs/heads/master
| 2021-05-04T11:08:47.817000 | 2018-12-23T14:27:02 | 2018-12-23T14:27:02 | 45,099,496 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
*
*/
package org.archcorner.services;
import java.util.List;
import org.archcorner.dal.dao.BlogDAO;
import org.archcorner.pojo.Blog;
/**
* @author bhagvan_kommadi
*
*/
public class BlogService {
public int getHighestId()
{
BlogDAO blogDAO = new BlogDAO();
return blogDAO.getHighestId();
}
public void updateBlog(Blog blog)
{
BlogDAO blogDAO = new BlogDAO();
blogDAO.updateBlog(blog);
}
public void deleteBlog(Blog blog)
{
BlogDAO blogDAO = new BlogDAO();
blogDAO.deleteBlog(blog);
}
public void saveBlog(Blog blog)
{
BlogDAO blogDAO = new BlogDAO();
blogDAO.saveBlog(blog);
}
public List<Blog> getBlogs(int siteIdNo)
{
BlogDAO blogDAO = new BlogDAO();
return blogDAO.getBlogs(siteIdNo);
}
public Blog getBlog(int blogIdNo)
{
BlogDAO blogDAO = new BlogDAO();
return blogDAO.getBlog(blogIdNo);
}
}
|
UTF-8
|
Java
| 864 |
java
|
BlogService.java
|
Java
|
[
{
"context": ";\nimport org.archcorner.pojo.Blog;\n\n/**\n * @author bhagvan_kommadi\n *\n */\npublic class BlogService {\n\t\n\tpublic int g",
"end": 174,
"score": 0.9926949143409729,
"start": 159,
"tag": "USERNAME",
"value": "bhagvan_kommadi"
}
] | null |
[] |
/**
*
*/
package org.archcorner.services;
import java.util.List;
import org.archcorner.dal.dao.BlogDAO;
import org.archcorner.pojo.Blog;
/**
* @author bhagvan_kommadi
*
*/
public class BlogService {
public int getHighestId()
{
BlogDAO blogDAO = new BlogDAO();
return blogDAO.getHighestId();
}
public void updateBlog(Blog blog)
{
BlogDAO blogDAO = new BlogDAO();
blogDAO.updateBlog(blog);
}
public void deleteBlog(Blog blog)
{
BlogDAO blogDAO = new BlogDAO();
blogDAO.deleteBlog(blog);
}
public void saveBlog(Blog blog)
{
BlogDAO blogDAO = new BlogDAO();
blogDAO.saveBlog(blog);
}
public List<Blog> getBlogs(int siteIdNo)
{
BlogDAO blogDAO = new BlogDAO();
return blogDAO.getBlogs(siteIdNo);
}
public Blog getBlog(int blogIdNo)
{
BlogDAO blogDAO = new BlogDAO();
return blogDAO.getBlog(blogIdNo);
}
}
| 864 | 0.69213 | 0.69213 | 50 | 16.280001 | 15.252593 | 41 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.18 | false | false |
9
|
ccdc904104a6368b556f811bd58369485963816f
| 23,716,809,430,550 |
524f9181083a8c88a16aef343fbe5c5c7f9c2976
|
/PortGo/app/src/main/java/com/portgo/util/OkHttpHelper.java
|
b4d3c9531179c6823ce67898a169c1bba433004c
|
[
"BSD-2-Clause"
] |
permissive
|
GhislainAdon/portsip-softphone-android
|
https://github.com/GhislainAdon/portsip-softphone-android
|
079d9d420ca280fcca97ab3812591b2849896b3f
|
600acb3cb820bef276cb45b47378e4400c21a1a5
|
refs/heads/master
| 2023-02-16T16:39:27.063000 | 2021-01-19T04:08:55 | 2021-01-19T04:08:55 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.portgo.util;
import android.content.Context;
import androidx.annotation.NonNull;
import android.text.TextUtils;
import android.util.Log;
import android.util.Patterns;
import com.portgo.BuildConfig;
import com.portgo.R;
import com.portgo.manager.UserAccount;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import okhttp3.HttpUrl;
import static com.portgo.util.OkHttpUpDownLoader.TYPE_GET;
public class OkHttpHelper {
//192.168.1.136 deng zhuo
public static final String HTTPSHEAD ="https://";
public static final String HTTPHEAD ="http://";
// public static final String OFFLINE_MESSAGE_BASEURL = "http://192.168.1.136:8899";
// public static final String FILE_BASEURL = "http://192.168.1.136:9333";
public static final int OFFLINE_MESSAGE_BASEURL_HTTP_PORT = 8899;//https=8900 http=8899
public static final int OFFLINE_MESSAGE_BASEURL_HTTPS_PORT = 8900;//https=8900 http=8899
public static final int FILE_BASEURL_HTTP_PORT = 9333;//https=8900 http=9333
public static final int FILE_BASEURL_HTTPS_PORT = 8887;//https=8900 http=9333
public static final String KEY_ACCESSTOKEN ="access_token";
public static final String SCHEAM_VERIFY = "/api/account/extension/sip/verify";//
public static final String VERIFY_KEY_DOMAIN = "domain";//
public static final String VERIFY_KEY_NAME = "extension_number";//
public static final String VERIFY_KEY_PWD = "sip_password";//
public static final String VERIFY_RESULT_KEY_EXTENSIONID="id";//
public static final String VERIFY_RESULT_KEY_EXPIRES = "expires";
public static final String SCHEAM_UPDATE = "/api/comm_message/update";//
public static final String UPDATE_KEY_MSGID = "msg_ids";//
public static final String SCHEAM_CONTACT_LIST = "/api/comm_message/contact_list";//
public static final String UPDATE_KEY_PAG="pagination";
public static final String UPDATE_KEY_STATUS = "status";
public static final String CONTACT_RESULT_KEY_COUNT = "count";
public static final String CONTACT_RESULT_KEY_EXTENSIONS = "extensions";
public static final String CONTACT_RESULT_KEY_EXTENSION_NUM = "extension_number";
public static final String SCHEAM_UNREAD_COUNT = "/api/comm_message/unread_count/show";//
public static final String UNREAD_KEY_SEND = "sender_extension";
public static final String UNREAD_KEY_RECEIVER = "receiver_extension";
public static final String UNREAD_RESULT_KEY_COUNT = "count";
//未读数目接口参数名
public static final String SCHEAM_LIST = "/api/comm_message/list";
public static final String LIST_KEY_SENDER = "sender_extension";
public static final String LIST_KEY_RECEIVER ="receiver_extension";
public static final String LIST_KEY_PAG ="pagination";
public static final String LIST_KEY_MESSAGEID ="specify_msg_id";
public static final String LIST_KEY_LIMITED_COUNT ="limit_count";
public static final String LIST_KEY_MOD ="list_mode";
public static final String LIST_KEY_TIME_STAR ="time_start";
public static final String LIST_KEY_TIME_STOP ="time_end";
public static final int DEFAULT_LIST_KEY_LIMITED_COUNT =100;
public static final String SCHEAM_LIST_MOD_MORMAL ="NORMAL";
public static final String SCHEAM_LIST_MOD_AFTER ="SPECIFY_LIST_AFTER";
public static final String SCHEAM_LIST_MOD_BEFORE ="SPECIFY_LIST_BEFOR";
public static final String SCHEAM_LIST_MOD_TIME ="TIME_DISTANCE";
public static final String SCHEAM_FILE_UPLOAD = "/submit";
public static final String UPLOAD_KEY_MEDIATYPE = "media_type";
public static final String FILEUPDATE_RESULT_KEY_FID = "fid";
public static final String FILEUPDATE_RESULT_KEY_fILENAME = "fileName";
public static final String FILEUPDATE_RESULT_KEY_ETAG = "eTag";
public static final String FILEUPDATE_RESULT_KEY_SIZE = "size";
public static final String FILEUPDATE_RESULT_KEY_URL = "fileUrl";
public static final String FILEUPDATE_RESULT_KEY_ID = "id";
public static final String FILEUPDATE_RESULT_KEY_FILEID = "fileid";
public static final String LIST_RESULT_KEY_MESSAGE_SENDID = "sender_extension_id";
public static final String SCHEAM_FILE_DOWNLOAD = "/submit";
public static final String SCHEAM_FILE_DELETE = "/delete";
public static final String DELETE_KEY_TENENTID = "tenantid";
public static final String DELETE_KEY_FILEID = "fid";
public static enum OKHTTP_ACTION{
OFFLINE_VERIFY,
OFFLINE_CONTACT,
OFFLINE_UNREADCOUNT,
OFFLINE_LIST_NORMAL,
OFFLINE_LIST_AFTER,
OFFLINE_LIST_BETWEEN,
OFFLINE_UPDATE,
FILE_UPLOAD,
FILE_DOWNLOAD,
FILE_DELETE,
}
static String getMessageUrl(@NonNull String scheam){
String url = HTTPSHEAD + SIP_SERVER + ":" + OFFLINE_MESSAGE_BASEURL_HTTPS_PORT + scheam;
if (!Patterns.WEB_URL.matcher(url).matches()) {
url =null;
}
return url;
}
static public String getFileUrl(@NonNull String scheam){
String url = HTTPHEAD+SIP_SERVER+":"+FILE_BASEURL_HTTP_PORT+scheam;
if (!Patterns.WEB_URL.matcher(url).matches()) {
url =null;
}
return url;
}
public static String upLoadFile(long messageid, String mediatype, String fileAbsPath, OkHttpUpDownLoader.ReqCallBack callBack){
if(TextUtils.isEmpty(mediatype)){
mediatype = "";
}
HashMap headParamsMap = new HashMap<String,String>();
headParamsMap.put(UPLOAD_KEY_MEDIATYPE,mediatype);
HashMap<String ,Object> fromparams = new HashMap();
File file = new File(fileAbsPath);
fromparams.put("file",file);
OkHttpUpDownLoader httpUpDownLoader= OkHttpUpDownLoader.getInstance();
String url = getFileUrl(SCHEAM_FILE_UPLOAD);
return httpUpDownLoader.upLoadFile(new OkHttpUpDownLoader.DownLoadParams(OKHTTP_ACTION.FILE_UPLOAD,messageid,mediatype),url,headParamsMap,fromparams,callBack);
}
public static String downLoadFile(String fileUrl, long messageid, String fileName, String destFileDir, OkHttpUpDownLoader.ReqCallBack callBack){
if(TextUtils.isEmpty(fileUrl)|| TextUtils.isEmpty(destFileDir))
return null;
HttpUrl parsed = HttpUrl.parse(fileUrl);
if (parsed == null){
fileUrl="http://"+fileUrl;
parsed = HttpUrl.parse(fileUrl);
if (parsed == null){
return null;
}
}
OkHttpUpDownLoader httpUpDownLoader= OkHttpUpDownLoader.getInstance();
return httpUpDownLoader.downLoadFile(new OkHttpUpDownLoader.DownLoadParams(OKHTTP_ACTION.FILE_DOWNLOAD,messageid,fileName),fileUrl, destFileDir, callBack);
}
static String SIP_SERVER = "";
static final String SIP_GETWAY_SERVER = "gateway.oncall.vn";
static final String SIP_FILE_SERVER = "file.oncall.vn";
public static void setAccount(@NonNull UserAccount account){
OkHttpUpDownLoader httpUpDownLoader= OkHttpUpDownLoader.getInstance();
httpUpDownLoader.setAccount(account);
if(account==null){
return;
}
SIP_SERVER = account.getRealm();//
if(TextUtils.isEmpty(SIP_SERVER)){
SIP_SERVER = account.getDomain();
}
}
public static String deleteFile(String fileId, long messageid, OkHttpUpDownLoader.ReqCallBack callBack){
String url = getFileUrl(SCHEAM_FILE_DELETE);
HashMap headParamsMap = new HashMap<String,String>();
headParamsMap.put(DELETE_KEY_TENENTID,"");
HashMap params = new HashMap<String,String>();
params.put(DELETE_KEY_FILEID,fileId);
OkHttpUpDownLoader httpUpDownLoader= OkHttpUpDownLoader.getInstance();
return httpUpDownLoader.requestAsyn(new OkHttpUpDownLoader.DownLoadParams(OKHTTP_ACTION.FILE_DELETE),url,TYPE_GET,headParamsMap,params,callBack);
}
public static String offlineMsgUpdate(List<Long> msgIds, OkHttpUpDownLoader.ReqCallBack callBack){
if(msgIds==null||msgIds.isEmpty())
return null;
HashMap headParamsMap = new HashMap<String,String>();
JSONObject root = new JSONObject();
JSONArray messages = new JSONArray();
try {
for (Long messageID : msgIds) {
messages.put(messageID);
}
root.put("msg_ids", messages);
}catch (JSONException e) {
e.printStackTrace();
}
String url = getMessageUrl (SCHEAM_UPDATE);
if(url!=null) {
OkHttpUpDownLoader httpUpDownLoader = OkHttpUpDownLoader.getInstance();
return httpUpDownLoader.requestPostByAsynWithJSON(new OkHttpUpDownLoader.DownLoadParams(OKHTTP_ACTION.OFFLINE_UPDATE), url, headParamsMap, root, callBack);
}else{
return "";
}
}
public static String offlineMsgListNormal(String pagination , String sender, String receiver, OkHttpUpDownLoader.ReqCallBack callBack){
String url = getMessageUrl (SCHEAM_LIST);
if(url!=null) {
HashMap headParamsMap = new HashMap<String, String>();
HashMap params = new HashMap<String, String>();
params.put(LIST_KEY_SENDER, sender);
params.put(LIST_KEY_RECEIVER, receiver);
params.put(LIST_KEY_PAG, pagination);
params.put(LIST_KEY_MOD, SCHEAM_LIST_MOD_MORMAL);
OkHttpUpDownLoader httpUpDownLoader = OkHttpUpDownLoader.getInstance();
return httpUpDownLoader.requestAsyn(new OkHttpUpDownLoader.DownLoadParams(OKHTTP_ACTION.OFFLINE_LIST_NORMAL), url, TYPE_GET, headParamsMap, params, callBack);
}else{
return "";
}
}
public static String offlineMsgListAfter(long messageid , String sender, String receiver, OkHttpUpDownLoader.ReqCallBack callBack){
String url = getMessageUrl (SCHEAM_LIST);
if(url!=null) {
HashMap headParamsMap = new HashMap<String, String>();
HashMap params = new HashMap<String, String>();
params.put(LIST_KEY_SENDER, sender);
params.put(LIST_KEY_RECEIVER, receiver);
params.put(LIST_KEY_MESSAGEID, "" + messageid);
params.put(LIST_KEY_LIMITED_COUNT, "" + DEFAULT_LIST_KEY_LIMITED_COUNT);
params.put(LIST_KEY_MOD, SCHEAM_LIST_MOD_AFTER);
OkHttpUpDownLoader httpUpDownLoader = OkHttpUpDownLoader.getInstance();
return httpUpDownLoader.requestAsyn(new OkHttpUpDownLoader.DownLoadParams(OKHTTP_ACTION.OFFLINE_LIST_AFTER), url, TYPE_GET, headParamsMap, params, callBack);
}else{
return "";
}
}
public static String offlineMsgListByTime(String sender, String receiver, OkHttpUpDownLoader.ReqCallBack callBack){
String url = getMessageUrl (SCHEAM_LIST);
if(url!=null) {
HashMap headParamsMap = new HashMap<String, String>();
HashMap params = new HashMap<String, String>();
params.put(LIST_KEY_SENDER, sender);
params.put(LIST_KEY_RECEIVER, receiver);
params.put(LIST_KEY_MOD, SCHEAM_LIST_MOD_TIME);
long curTime = new Date().getTime() / 1000;
long halfMoth = curTime - 7 * 24 * 3600;
params.put(LIST_KEY_TIME_STAR, "" + halfMoth);
params.put(LIST_KEY_TIME_STOP, "" + curTime);
OkHttpUpDownLoader httpUpDownLoader = OkHttpUpDownLoader.getInstance();
return httpUpDownLoader.requestAsyn(new OkHttpUpDownLoader.DownLoadParams(OKHTTP_ACTION.OFFLINE_LIST_BETWEEN), url, TYPE_GET, headParamsMap, params, callBack);
}else{
return "";
}
}
public static String offlineMsgContactList(String pag, String status, OkHttpUpDownLoader.ReqCallBack callBack){
String url = getMessageUrl (SCHEAM_CONTACT_LIST);
if(url!=null) {
HashMap headParamsMap = new HashMap<String, String>();
HashMap params = new HashMap<String, String>();
params.put(UPDATE_KEY_PAG, pag);
params.put(UPDATE_KEY_STATUS, status);
OkHttpUpDownLoader httpUpDownLoader = OkHttpUpDownLoader.getInstance();
return httpUpDownLoader.requestAsyn(new OkHttpUpDownLoader.DownLoadParams(OKHTTP_ACTION.OFFLINE_CONTACT), url, TYPE_GET, headParamsMap, params, callBack);
}else{
return "";
}
}
public static String offlineMsgUnreadCount(String send, String receiver, OkHttpUpDownLoader.ReqCallBack callBack){
String url = getMessageUrl (SCHEAM_UNREAD_COUNT);
if(url!=null) {
OkHttpUpDownLoader httpUpDownLoader = OkHttpUpDownLoader.getInstance();
HashMap headParamsMap = new HashMap<String, String>();
HashMap params = new HashMap<String, String>();
params.put(UNREAD_KEY_SEND, send);
params.put(UNREAD_KEY_RECEIVER, receiver);
return httpUpDownLoader.requestAsyn(new OkHttpUpDownLoader.DownLoadParams(OKHTTP_ACTION.OFFLINE_UNREADCOUNT), url, TYPE_GET, headParamsMap, params, callBack);
}else{
return "";
}
}
public static String getFilePath(Context context){
String dirName = context.getString(R.string.prefrence_record_filepath_default);
String filePath = context.getExternalFilesDir(dirName).getAbsolutePath();
return filePath;
}
public static void cancellAll(){
OkHttpUpDownLoader httpUpDownLoader= OkHttpUpDownLoader.getInstance();
httpUpDownLoader.cancellAll();
}
}
|
UTF-8
|
Java
| 14,154 |
java
|
OkHttpHelper.java
|
Java
|
[
{
"context": "r.TYPE_GET;\r\n\r\npublic class OkHttpHelper {\r\n //192.168.1.136 deng zhuo\r\n public static final String HTTPSHE",
"end": 674,
"score": 0.9996510744094849,
"start": 661,
"tag": "IP_ADDRESS",
"value": "192.168.1.136"
},
{
"context": "\r\npublic class OkHttpHelper {\r\n //192.168.1.136 deng zhuo\r\n public static final String HTTPSHEAD =\"https",
"end": 684,
"score": 0.9208595156669617,
"start": 675,
"tag": "NAME",
"value": "deng zhuo"
},
{
"context": "c final String OFFLINE_MESSAGE_BASEURL = \"http://192.168.1.136:8899\";\r\n// public static final Str",
"end": 863,
"score": 0.8541587591171265,
"start": 862,
"tag": "IP_ADDRESS",
"value": "1"
},
{
"context": "inal String OFFLINE_MESSAGE_BASEURL = \"http://192.168.1.136:8899\";\r\n// public static final String",
"end": 865,
"score": 0.754241943359375,
"start": 865,
"tag": "IP_ADDRESS",
"value": ""
},
{
"context": "l String OFFLINE_MESSAGE_BASEURL = \"http://192.168.1.136:8899\";\r\n// public static final String FILE_",
"end": 871,
"score": 0.9611474275588989,
"start": 868,
"tag": "IP_ADDRESS",
"value": "8.1"
},
{
"context": "ublic static final String FILE_BASEURL = \"http://192.168.1.136:9333\";\r\n public static final int OFFLINE_MESSA",
"end": 954,
"score": 0.9994144439697266,
"start": 941,
"tag": "IP_ADDRESS",
"value": "192.168.1.136"
},
{
"context": "\n public static final String VERIFY_KEY_PWD = \"sip_password\";//\r\n\r\n public static final String VERIFY_RESU",
"end": 1669,
"score": 0.8688655495643616,
"start": 1657,
"tag": "PASSWORD",
"value": "sip_password"
},
{
"context": "tic final String FILEUPDATE_RESULT_KEY_URL = \"fileUrl\";\r\n public static final String FILEUPDATE_RESU",
"end": 4195,
"score": 0.5219370126724243,
"start": 4192,
"tag": "KEY",
"value": "Url"
},
{
"context": "atic final String FILEUPDATE_RESULT_KEY_FILEID = \"fileid\";\r\n\r\n public static final String LIST_RESULT_",
"end": 4333,
"score": 0.7046423554420471,
"start": 4327,
"tag": "KEY",
"value": "fileid"
},
{
"context": " public static final String DELETE_KEY_FILEID = \"fid\";\r\n\r\n public static enum OKHTTP_ACTION{\r\n ",
"end": 4685,
"score": 0.582379937171936,
"start": 4682,
"tag": "KEY",
"value": "fid"
}
] | null |
[] |
package com.portgo.util;
import android.content.Context;
import androidx.annotation.NonNull;
import android.text.TextUtils;
import android.util.Log;
import android.util.Patterns;
import com.portgo.BuildConfig;
import com.portgo.R;
import com.portgo.manager.UserAccount;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import okhttp3.HttpUrl;
import static com.portgo.util.OkHttpUpDownLoader.TYPE_GET;
public class OkHttpHelper {
//192.168.1.136 <NAME>
public static final String HTTPSHEAD ="https://";
public static final String HTTPHEAD ="http://";
// public static final String OFFLINE_MESSAGE_BASEURL = "http://192.168.1.136:8899";
// public static final String FILE_BASEURL = "http://192.168.1.136:9333";
public static final int OFFLINE_MESSAGE_BASEURL_HTTP_PORT = 8899;//https=8900 http=8899
public static final int OFFLINE_MESSAGE_BASEURL_HTTPS_PORT = 8900;//https=8900 http=8899
public static final int FILE_BASEURL_HTTP_PORT = 9333;//https=8900 http=9333
public static final int FILE_BASEURL_HTTPS_PORT = 8887;//https=8900 http=9333
public static final String KEY_ACCESSTOKEN ="access_token";
public static final String SCHEAM_VERIFY = "/api/account/extension/sip/verify";//
public static final String VERIFY_KEY_DOMAIN = "domain";//
public static final String VERIFY_KEY_NAME = "extension_number";//
public static final String VERIFY_KEY_PWD = "<PASSWORD>";//
public static final String VERIFY_RESULT_KEY_EXTENSIONID="id";//
public static final String VERIFY_RESULT_KEY_EXPIRES = "expires";
public static final String SCHEAM_UPDATE = "/api/comm_message/update";//
public static final String UPDATE_KEY_MSGID = "msg_ids";//
public static final String SCHEAM_CONTACT_LIST = "/api/comm_message/contact_list";//
public static final String UPDATE_KEY_PAG="pagination";
public static final String UPDATE_KEY_STATUS = "status";
public static final String CONTACT_RESULT_KEY_COUNT = "count";
public static final String CONTACT_RESULT_KEY_EXTENSIONS = "extensions";
public static final String CONTACT_RESULT_KEY_EXTENSION_NUM = "extension_number";
public static final String SCHEAM_UNREAD_COUNT = "/api/comm_message/unread_count/show";//
public static final String UNREAD_KEY_SEND = "sender_extension";
public static final String UNREAD_KEY_RECEIVER = "receiver_extension";
public static final String UNREAD_RESULT_KEY_COUNT = "count";
//未读数目接口参数名
public static final String SCHEAM_LIST = "/api/comm_message/list";
public static final String LIST_KEY_SENDER = "sender_extension";
public static final String LIST_KEY_RECEIVER ="receiver_extension";
public static final String LIST_KEY_PAG ="pagination";
public static final String LIST_KEY_MESSAGEID ="specify_msg_id";
public static final String LIST_KEY_LIMITED_COUNT ="limit_count";
public static final String LIST_KEY_MOD ="list_mode";
public static final String LIST_KEY_TIME_STAR ="time_start";
public static final String LIST_KEY_TIME_STOP ="time_end";
public static final int DEFAULT_LIST_KEY_LIMITED_COUNT =100;
public static final String SCHEAM_LIST_MOD_MORMAL ="NORMAL";
public static final String SCHEAM_LIST_MOD_AFTER ="SPECIFY_LIST_AFTER";
public static final String SCHEAM_LIST_MOD_BEFORE ="SPECIFY_LIST_BEFOR";
public static final String SCHEAM_LIST_MOD_TIME ="TIME_DISTANCE";
public static final String SCHEAM_FILE_UPLOAD = "/submit";
public static final String UPLOAD_KEY_MEDIATYPE = "media_type";
public static final String FILEUPDATE_RESULT_KEY_FID = "fid";
public static final String FILEUPDATE_RESULT_KEY_fILENAME = "fileName";
public static final String FILEUPDATE_RESULT_KEY_ETAG = "eTag";
public static final String FILEUPDATE_RESULT_KEY_SIZE = "size";
public static final String FILEUPDATE_RESULT_KEY_URL = "fileUrl";
public static final String FILEUPDATE_RESULT_KEY_ID = "id";
public static final String FILEUPDATE_RESULT_KEY_FILEID = "fileid";
public static final String LIST_RESULT_KEY_MESSAGE_SENDID = "sender_extension_id";
public static final String SCHEAM_FILE_DOWNLOAD = "/submit";
public static final String SCHEAM_FILE_DELETE = "/delete";
public static final String DELETE_KEY_TENENTID = "tenantid";
public static final String DELETE_KEY_FILEID = "fid";
public static enum OKHTTP_ACTION{
OFFLINE_VERIFY,
OFFLINE_CONTACT,
OFFLINE_UNREADCOUNT,
OFFLINE_LIST_NORMAL,
OFFLINE_LIST_AFTER,
OFFLINE_LIST_BETWEEN,
OFFLINE_UPDATE,
FILE_UPLOAD,
FILE_DOWNLOAD,
FILE_DELETE,
}
static String getMessageUrl(@NonNull String scheam){
String url = HTTPSHEAD + SIP_SERVER + ":" + OFFLINE_MESSAGE_BASEURL_HTTPS_PORT + scheam;
if (!Patterns.WEB_URL.matcher(url).matches()) {
url =null;
}
return url;
}
static public String getFileUrl(@NonNull String scheam){
String url = HTTPHEAD+SIP_SERVER+":"+FILE_BASEURL_HTTP_PORT+scheam;
if (!Patterns.WEB_URL.matcher(url).matches()) {
url =null;
}
return url;
}
public static String upLoadFile(long messageid, String mediatype, String fileAbsPath, OkHttpUpDownLoader.ReqCallBack callBack){
if(TextUtils.isEmpty(mediatype)){
mediatype = "";
}
HashMap headParamsMap = new HashMap<String,String>();
headParamsMap.put(UPLOAD_KEY_MEDIATYPE,mediatype);
HashMap<String ,Object> fromparams = new HashMap();
File file = new File(fileAbsPath);
fromparams.put("file",file);
OkHttpUpDownLoader httpUpDownLoader= OkHttpUpDownLoader.getInstance();
String url = getFileUrl(SCHEAM_FILE_UPLOAD);
return httpUpDownLoader.upLoadFile(new OkHttpUpDownLoader.DownLoadParams(OKHTTP_ACTION.FILE_UPLOAD,messageid,mediatype),url,headParamsMap,fromparams,callBack);
}
public static String downLoadFile(String fileUrl, long messageid, String fileName, String destFileDir, OkHttpUpDownLoader.ReqCallBack callBack){
if(TextUtils.isEmpty(fileUrl)|| TextUtils.isEmpty(destFileDir))
return null;
HttpUrl parsed = HttpUrl.parse(fileUrl);
if (parsed == null){
fileUrl="http://"+fileUrl;
parsed = HttpUrl.parse(fileUrl);
if (parsed == null){
return null;
}
}
OkHttpUpDownLoader httpUpDownLoader= OkHttpUpDownLoader.getInstance();
return httpUpDownLoader.downLoadFile(new OkHttpUpDownLoader.DownLoadParams(OKHTTP_ACTION.FILE_DOWNLOAD,messageid,fileName),fileUrl, destFileDir, callBack);
}
static String SIP_SERVER = "";
static final String SIP_GETWAY_SERVER = "gateway.oncall.vn";
static final String SIP_FILE_SERVER = "file.oncall.vn";
public static void setAccount(@NonNull UserAccount account){
OkHttpUpDownLoader httpUpDownLoader= OkHttpUpDownLoader.getInstance();
httpUpDownLoader.setAccount(account);
if(account==null){
return;
}
SIP_SERVER = account.getRealm();//
if(TextUtils.isEmpty(SIP_SERVER)){
SIP_SERVER = account.getDomain();
}
}
public static String deleteFile(String fileId, long messageid, OkHttpUpDownLoader.ReqCallBack callBack){
String url = getFileUrl(SCHEAM_FILE_DELETE);
HashMap headParamsMap = new HashMap<String,String>();
headParamsMap.put(DELETE_KEY_TENENTID,"");
HashMap params = new HashMap<String,String>();
params.put(DELETE_KEY_FILEID,fileId);
OkHttpUpDownLoader httpUpDownLoader= OkHttpUpDownLoader.getInstance();
return httpUpDownLoader.requestAsyn(new OkHttpUpDownLoader.DownLoadParams(OKHTTP_ACTION.FILE_DELETE),url,TYPE_GET,headParamsMap,params,callBack);
}
public static String offlineMsgUpdate(List<Long> msgIds, OkHttpUpDownLoader.ReqCallBack callBack){
if(msgIds==null||msgIds.isEmpty())
return null;
HashMap headParamsMap = new HashMap<String,String>();
JSONObject root = new JSONObject();
JSONArray messages = new JSONArray();
try {
for (Long messageID : msgIds) {
messages.put(messageID);
}
root.put("msg_ids", messages);
}catch (JSONException e) {
e.printStackTrace();
}
String url = getMessageUrl (SCHEAM_UPDATE);
if(url!=null) {
OkHttpUpDownLoader httpUpDownLoader = OkHttpUpDownLoader.getInstance();
return httpUpDownLoader.requestPostByAsynWithJSON(new OkHttpUpDownLoader.DownLoadParams(OKHTTP_ACTION.OFFLINE_UPDATE), url, headParamsMap, root, callBack);
}else{
return "";
}
}
public static String offlineMsgListNormal(String pagination , String sender, String receiver, OkHttpUpDownLoader.ReqCallBack callBack){
String url = getMessageUrl (SCHEAM_LIST);
if(url!=null) {
HashMap headParamsMap = new HashMap<String, String>();
HashMap params = new HashMap<String, String>();
params.put(LIST_KEY_SENDER, sender);
params.put(LIST_KEY_RECEIVER, receiver);
params.put(LIST_KEY_PAG, pagination);
params.put(LIST_KEY_MOD, SCHEAM_LIST_MOD_MORMAL);
OkHttpUpDownLoader httpUpDownLoader = OkHttpUpDownLoader.getInstance();
return httpUpDownLoader.requestAsyn(new OkHttpUpDownLoader.DownLoadParams(OKHTTP_ACTION.OFFLINE_LIST_NORMAL), url, TYPE_GET, headParamsMap, params, callBack);
}else{
return "";
}
}
public static String offlineMsgListAfter(long messageid , String sender, String receiver, OkHttpUpDownLoader.ReqCallBack callBack){
String url = getMessageUrl (SCHEAM_LIST);
if(url!=null) {
HashMap headParamsMap = new HashMap<String, String>();
HashMap params = new HashMap<String, String>();
params.put(LIST_KEY_SENDER, sender);
params.put(LIST_KEY_RECEIVER, receiver);
params.put(LIST_KEY_MESSAGEID, "" + messageid);
params.put(LIST_KEY_LIMITED_COUNT, "" + DEFAULT_LIST_KEY_LIMITED_COUNT);
params.put(LIST_KEY_MOD, SCHEAM_LIST_MOD_AFTER);
OkHttpUpDownLoader httpUpDownLoader = OkHttpUpDownLoader.getInstance();
return httpUpDownLoader.requestAsyn(new OkHttpUpDownLoader.DownLoadParams(OKHTTP_ACTION.OFFLINE_LIST_AFTER), url, TYPE_GET, headParamsMap, params, callBack);
}else{
return "";
}
}
public static String offlineMsgListByTime(String sender, String receiver, OkHttpUpDownLoader.ReqCallBack callBack){
String url = getMessageUrl (SCHEAM_LIST);
if(url!=null) {
HashMap headParamsMap = new HashMap<String, String>();
HashMap params = new HashMap<String, String>();
params.put(LIST_KEY_SENDER, sender);
params.put(LIST_KEY_RECEIVER, receiver);
params.put(LIST_KEY_MOD, SCHEAM_LIST_MOD_TIME);
long curTime = new Date().getTime() / 1000;
long halfMoth = curTime - 7 * 24 * 3600;
params.put(LIST_KEY_TIME_STAR, "" + halfMoth);
params.put(LIST_KEY_TIME_STOP, "" + curTime);
OkHttpUpDownLoader httpUpDownLoader = OkHttpUpDownLoader.getInstance();
return httpUpDownLoader.requestAsyn(new OkHttpUpDownLoader.DownLoadParams(OKHTTP_ACTION.OFFLINE_LIST_BETWEEN), url, TYPE_GET, headParamsMap, params, callBack);
}else{
return "";
}
}
public static String offlineMsgContactList(String pag, String status, OkHttpUpDownLoader.ReqCallBack callBack){
String url = getMessageUrl (SCHEAM_CONTACT_LIST);
if(url!=null) {
HashMap headParamsMap = new HashMap<String, String>();
HashMap params = new HashMap<String, String>();
params.put(UPDATE_KEY_PAG, pag);
params.put(UPDATE_KEY_STATUS, status);
OkHttpUpDownLoader httpUpDownLoader = OkHttpUpDownLoader.getInstance();
return httpUpDownLoader.requestAsyn(new OkHttpUpDownLoader.DownLoadParams(OKHTTP_ACTION.OFFLINE_CONTACT), url, TYPE_GET, headParamsMap, params, callBack);
}else{
return "";
}
}
public static String offlineMsgUnreadCount(String send, String receiver, OkHttpUpDownLoader.ReqCallBack callBack){
String url = getMessageUrl (SCHEAM_UNREAD_COUNT);
if(url!=null) {
OkHttpUpDownLoader httpUpDownLoader = OkHttpUpDownLoader.getInstance();
HashMap headParamsMap = new HashMap<String, String>();
HashMap params = new HashMap<String, String>();
params.put(UNREAD_KEY_SEND, send);
params.put(UNREAD_KEY_RECEIVER, receiver);
return httpUpDownLoader.requestAsyn(new OkHttpUpDownLoader.DownLoadParams(OKHTTP_ACTION.OFFLINE_UNREADCOUNT), url, TYPE_GET, headParamsMap, params, callBack);
}else{
return "";
}
}
public static String getFilePath(Context context){
String dirName = context.getString(R.string.prefrence_record_filepath_default);
String filePath = context.getExternalFilesDir(dirName).getAbsolutePath();
return filePath;
}
public static void cancellAll(){
OkHttpUpDownLoader httpUpDownLoader= OkHttpUpDownLoader.getInstance();
httpUpDownLoader.cancellAll();
}
}
| 14,149 | 0.664686 | 0.657541 | 318 | 42.452831 | 37.689346 | 171 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.933962 | false | false |
9
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.