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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
a04528d793549fc19ae231d0300c2ee70297fb6b
| 10,565,619,560,607 |
bce04c103ef55f565b2c51a194ef557a053d61a1
|
/src/main/java/com/github/jimmyfm/client/JSExportClass.java
|
6a65b31034d05d62dae21c6ce6d828f96a390536
|
[] |
no_license
|
jimmyfm/GWT_JsInterop
|
https://github.com/jimmyfm/GWT_JsInterop
|
68e19fd3e1c0851736d47a4ca70e51c7335874bb
|
3e22c5d2b59e3f4486af1142b2b0abf02e546203
|
refs/heads/master
| 2021-01-10T09:12:02.347000 | 2016-03-11T04:17:53 | 2016-03-11T04:17:53 | 53,638,870 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.github.jimmyfm.client;
import com.google.gwt.core.client.js.JsExport;
@JsExport
public class JSExportClass
{
public String plain = "public string";
public static String staticField = "static field";
public static final String staticFinalField = "static final field";
public final String staticFinal = "static final";
}
|
UTF-8
|
Java
| 337 |
java
|
JSExportClass.java
|
Java
|
[
{
"context": "package com.github.jimmyfm.client;\n\nimport com.google.gwt.core.client.js.J",
"end": 24,
"score": 0.8043330311775208,
"start": 19,
"tag": "USERNAME",
"value": "jimmy"
}
] | null |
[] |
package com.github.jimmyfm.client;
import com.google.gwt.core.client.js.JsExport;
@JsExport
public class JSExportClass
{
public String plain = "public string";
public static String staticField = "static field";
public static final String staticFinalField = "static final field";
public final String staticFinal = "static final";
}
| 337 | 0.777448 | 0.777448 | 12 | 27.083334 | 23.228785 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.833333 | false | false |
12
|
7ca61dcfd71fa44f049d52f493f20efc7eb19424
| 15,221,364,156,424 |
390688f1aec8af2808cad9bc0420986eaa42a073
|
/src/edu/upenn/cis455/webserver/response/IfModifiedResponse.java
|
122c3a68cbebb6516bd7b0295a49892a33a540fb
|
[] |
no_license
|
psvishnu91/MapReduceFramework
|
https://github.com/psvishnu91/MapReduceFramework
|
c5f15237fb827e8f4ad06c93604589b781ed2d52
|
0e19d39ce51c83f62418ce94b43f546d77f98b7d
|
refs/heads/master
| 2015-08-22T22:59:53 | 2015-04-20T06:17:05 | 2015-04-20T06:17:05 | 33,416,346 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package edu.upenn.cis455.webserver.response;
import java.io.IOException;
import java.util.Date;
import java.util.Map;
import edu.upenn.cis455.webserver.HttpServer;
import edu.upenn.cis455.webserver.HttpStatusCodesDirectory;
import edu.upenn.cis455.webserver.HttpStatusTypes;
import edu.upenn.cis455.webserver.ThreadDaemon;
import edu.upenn.cis455.webserver.parsers.DateParser;
import edu.upenn.cis455.webserver.parsers.FilesReader;
import edu.upenn.cis455.webserver.request.HttpStatusWrapper;
import edu.upenn.cis455.webserver.request.Request;
public class IfModifiedResponse extends ResponseGenerator {
FilesReader resourceReader;
ThreadDaemon threadInfo;
IfModifiedResponse(Request request, HttpStatusWrapper error,
ThreadDaemon threadInfo) {
super(request, error);
if(HttpServer.toPrint)
System.out.println("In success generator constructor");
init(threadInfo);
}
IfModifiedResponse(Request request,
HttpStatusWrapper error,
ThreadDaemon threadInfo, int toCloseConnection) {
super(request, error, toCloseConnection);
if(HttpServer.toPrint)
System.out.println("In success generator constructor");
init(threadInfo);
}
void init(ThreadDaemon threadInfo)
{
resourceReader = request.getResourceReader();
this.threadInfo = threadInfo;
}
/**
* The wrapper method which chooses the type of response.
*/
@Override
byte[] generateResponse() {
byte[] response;
if(request==null|| request.getHeaders()==null)
{
String errorMsg = "The request is incomplete";
error = new HttpStatusWrapper(HttpStatusTypes.BAD_REQUEST, errorMsg);
ErrorResponse errResGen = new ErrorResponse(request, error);
response = errResGen.generateResponse();
}
else if (request.getHeaders().checkIfModifiedHeaderExist())
{
if(HttpServer.toPrint)
System.out.println("It is send if modified type of request");
response = generateModifiedResponse();
}
else
{
String errorMsg = "Error occurred while providing response";
error = new HttpStatusWrapper(HttpStatusTypes.INTERNAL_SERVER_ERROR, errorMsg);
ErrorResponse errResGen = new ErrorResponse(request, error);
response = errResGen.generateResponse();
}
return response;
}
byte[] generateModifiedResponse()
{
final String UNMOD = "if-unmodified-since";
final String MOD = "if-modified-since";
Map<String, Date> userDateHeads =
request.getUserDateHeaders() ;
Date lastMod = resourceReader.lastModifiedDate();
// error code if the file requested doesnt match
// the date requested
int error_code ;
// If the request is reply if unmodified
if(userDateHeads.containsKey(UNMOD))
{
Date unmodDate = userDateHeads.get(UNMOD);
if(HttpServer.toPrint)
System.out.println("It is of type unmodified since\nLastmod : "+lastMod+"\nunmoddate : "+unmodDate);
// last modified is before if unmodified
// date
if(lastMod.compareTo(unmodDate)<0)
{
SuccessResponse success = new SuccessResponse(request, error, threadInfo);
return success.generateResponse();
}
// modified after the date
else
{
if(HttpServer.toPrint)
System.out.println("Precondition failed");
error_code = HttpStatusTypes.PRECONDITION_FAILED.getErrorCode();
}
}
// If modified
else
{
if(HttpServer.toPrint)
System.out.println("It is of type modified since");
Date modDate = userDateHeads.get(MOD);
// last modified after if modified date
if(lastMod.compareTo(modDate)>0)
{
SuccessResponse success = new SuccessResponse(request, error, threadInfo);
return success.generateResponse();
}
else
{
if(HttpServer.toPrint)
System.out.println("not modified");
error_code = HttpStatusTypes.NOT_MODIFIED.getErrorCode();
}
}
StringBuilder response = new StringBuilder();
// add http version
response.append(responseHttpVersion());
response.append(" ");
response.append(error_code);
response.append(" ");
response.append(HttpStatusCodesDirectory.getName(error_code));
response.append(CRLF);
response.append(defaultHeaders());
//blank line
response.append(CRLF);
String responseString = response.toString();
return FilesReader.toByte(responseString);
}
/**
* File headers like content
* type, content length and last
* modified string.
* @return headerstring
* @throws IOException
*/
String fileHeaders() throws IOException
{
StringBuilder heads = new StringBuilder();
heads.append("content-type: ");
heads.append(resourceReader.printFileType());
heads.append(CRLF);
heads.append("content-length: ");
heads.append(resourceReader.length());
heads.append(CRLF);
heads.append("last-modified: ");
heads.append(DateParser.formatDate( resourceReader.lastModifiedDate() ));
heads.append(CRLF);
return heads.toString();
}
}
|
UTF-8
|
Java
| 4,814 |
java
|
IfModifiedResponse.java
|
Java
|
[] | null |
[] |
package edu.upenn.cis455.webserver.response;
import java.io.IOException;
import java.util.Date;
import java.util.Map;
import edu.upenn.cis455.webserver.HttpServer;
import edu.upenn.cis455.webserver.HttpStatusCodesDirectory;
import edu.upenn.cis455.webserver.HttpStatusTypes;
import edu.upenn.cis455.webserver.ThreadDaemon;
import edu.upenn.cis455.webserver.parsers.DateParser;
import edu.upenn.cis455.webserver.parsers.FilesReader;
import edu.upenn.cis455.webserver.request.HttpStatusWrapper;
import edu.upenn.cis455.webserver.request.Request;
public class IfModifiedResponse extends ResponseGenerator {
FilesReader resourceReader;
ThreadDaemon threadInfo;
IfModifiedResponse(Request request, HttpStatusWrapper error,
ThreadDaemon threadInfo) {
super(request, error);
if(HttpServer.toPrint)
System.out.println("In success generator constructor");
init(threadInfo);
}
IfModifiedResponse(Request request,
HttpStatusWrapper error,
ThreadDaemon threadInfo, int toCloseConnection) {
super(request, error, toCloseConnection);
if(HttpServer.toPrint)
System.out.println("In success generator constructor");
init(threadInfo);
}
void init(ThreadDaemon threadInfo)
{
resourceReader = request.getResourceReader();
this.threadInfo = threadInfo;
}
/**
* The wrapper method which chooses the type of response.
*/
@Override
byte[] generateResponse() {
byte[] response;
if(request==null|| request.getHeaders()==null)
{
String errorMsg = "The request is incomplete";
error = new HttpStatusWrapper(HttpStatusTypes.BAD_REQUEST, errorMsg);
ErrorResponse errResGen = new ErrorResponse(request, error);
response = errResGen.generateResponse();
}
else if (request.getHeaders().checkIfModifiedHeaderExist())
{
if(HttpServer.toPrint)
System.out.println("It is send if modified type of request");
response = generateModifiedResponse();
}
else
{
String errorMsg = "Error occurred while providing response";
error = new HttpStatusWrapper(HttpStatusTypes.INTERNAL_SERVER_ERROR, errorMsg);
ErrorResponse errResGen = new ErrorResponse(request, error);
response = errResGen.generateResponse();
}
return response;
}
byte[] generateModifiedResponse()
{
final String UNMOD = "if-unmodified-since";
final String MOD = "if-modified-since";
Map<String, Date> userDateHeads =
request.getUserDateHeaders() ;
Date lastMod = resourceReader.lastModifiedDate();
// error code if the file requested doesnt match
// the date requested
int error_code ;
// If the request is reply if unmodified
if(userDateHeads.containsKey(UNMOD))
{
Date unmodDate = userDateHeads.get(UNMOD);
if(HttpServer.toPrint)
System.out.println("It is of type unmodified since\nLastmod : "+lastMod+"\nunmoddate : "+unmodDate);
// last modified is before if unmodified
// date
if(lastMod.compareTo(unmodDate)<0)
{
SuccessResponse success = new SuccessResponse(request, error, threadInfo);
return success.generateResponse();
}
// modified after the date
else
{
if(HttpServer.toPrint)
System.out.println("Precondition failed");
error_code = HttpStatusTypes.PRECONDITION_FAILED.getErrorCode();
}
}
// If modified
else
{
if(HttpServer.toPrint)
System.out.println("It is of type modified since");
Date modDate = userDateHeads.get(MOD);
// last modified after if modified date
if(lastMod.compareTo(modDate)>0)
{
SuccessResponse success = new SuccessResponse(request, error, threadInfo);
return success.generateResponse();
}
else
{
if(HttpServer.toPrint)
System.out.println("not modified");
error_code = HttpStatusTypes.NOT_MODIFIED.getErrorCode();
}
}
StringBuilder response = new StringBuilder();
// add http version
response.append(responseHttpVersion());
response.append(" ");
response.append(error_code);
response.append(" ");
response.append(HttpStatusCodesDirectory.getName(error_code));
response.append(CRLF);
response.append(defaultHeaders());
//blank line
response.append(CRLF);
String responseString = response.toString();
return FilesReader.toByte(responseString);
}
/**
* File headers like content
* type, content length and last
* modified string.
* @return headerstring
* @throws IOException
*/
String fileHeaders() throws IOException
{
StringBuilder heads = new StringBuilder();
heads.append("content-type: ");
heads.append(resourceReader.printFileType());
heads.append(CRLF);
heads.append("content-length: ");
heads.append(resourceReader.length());
heads.append(CRLF);
heads.append("last-modified: ");
heads.append(DateParser.formatDate( resourceReader.lastModifiedDate() ));
heads.append(CRLF);
return heads.toString();
}
}
| 4,814 | 0.732239 | 0.726215 | 174 | 26.660919 | 22.790525 | 104 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.327586 | false | false |
12
|
27f7707e2a199525bca22c4cf6d13d425751a5ec
| 14,370,960,597,902 |
ec8f4cf382d7033dd8ba0042a28a5559997920f5
|
/interviewJava/interview/others/add2numbers.java
|
bad6cd7bb2bf87e58e3fea80188a6fdc8746145b
|
[] |
no_license
|
jiguosong/coding_practice
|
https://github.com/jiguosong/coding_practice
|
7d5b008fbf0cb4181497020fef97e68669f969b0
|
4313bd943c7755ed8127626cad194d7a60d05a14
|
refs/heads/master
| 2020-12-14T06:09:52.598000 | 2016-12-31T21:40:26 | 2016-12-31T21:40:26 | 68,734,717 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package others;
import java.util.*;
import others.ListNode;
public class add2numbers {
public ListNode addTwoNumbers(ListNode l1, ListNode l2) {
if (l1 == null && l2 == null) return null;
if (l1 == null && l2 != null) return l2;
if (l2 == null && l1 != null) return l1;
int sum, digit, carry;
ListNode p1, p2, curr;
ListNode head = new ListNode(0);
curr = head;
p1 = l1; p2 = l2;
digit = 0;
carry = 0;
while(p1 != null && p2 != null) {
sum = p1.val+p2.val + carry;
digit = sum%10;
carry = sum/10;
ListNode tmp = new ListNode(digit);
curr.next = tmp;
p1 = p1.next;
p2 = p2.next;
curr = curr.next;
}
if (p1 != null) curr.next = p1;
else if (p2 != null) curr.next = p2;
return head.next;
}
}
|
UTF-8
|
Java
| 928 |
java
|
add2numbers.java
|
Java
|
[] | null |
[] |
package others;
import java.util.*;
import others.ListNode;
public class add2numbers {
public ListNode addTwoNumbers(ListNode l1, ListNode l2) {
if (l1 == null && l2 == null) return null;
if (l1 == null && l2 != null) return l2;
if (l2 == null && l1 != null) return l1;
int sum, digit, carry;
ListNode p1, p2, curr;
ListNode head = new ListNode(0);
curr = head;
p1 = l1; p2 = l2;
digit = 0;
carry = 0;
while(p1 != null && p2 != null) {
sum = p1.val+p2.val + carry;
digit = sum%10;
carry = sum/10;
ListNode tmp = new ListNode(digit);
curr.next = tmp;
p1 = p1.next;
p2 = p2.next;
curr = curr.next;
}
if (p1 != null) curr.next = p1;
else if (p2 != null) curr.next = p2;
return head.next;
}
}
| 928 | 0.477371 | 0.438578 | 37 | 24.108109 | 15.077787 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.162162 | false | false |
12
|
c95caa0471dc68b20d619e97560d48e1620ebb66
| 8,400,956,092,588 |
2f497ce75def604941afb50657fbaca772bdabcd
|
/2018, 2019/src/n04504_배수찾기.java
|
f320cb2e23feef37cc8784ca7268853783ec767d
|
[] |
no_license
|
winseung76/BOJ
|
https://github.com/winseung76/BOJ
|
2bbf7d0fdb475f76c83d6f868781e314e910941e
|
cee1d2ab42e926c436709b02080dd0aef80162bc
|
refs/heads/master
| 2023-06-25T11:17:55.596000 | 2021-07-04T08:21:06 | 2021-07-04T08:21:06 | 343,604,770 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.util.Scanner;
public class n04504_¹è¼öã±â {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int x;
while ((x = sc.nextInt()) != 0) {
if (x % n == 0)
System.out.println(x + " is a multiple of " + n + ".");
else if (x % n != 0)
System.out.println(x + " is NOT a multiple of " + n + ".");
}
}
}
|
WINDOWS-1252
|
Java
| 409 |
java
|
n04504_배수찾기.java
|
Java
|
[] | null |
[] |
import java.util.Scanner;
public class n04504_¹è¼öã±â {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int x;
while ((x = sc.nextInt()) != 0) {
if (x % n == 0)
System.out.println(x + " is a multiple of " + n + ".");
else if (x % n != 0)
System.out.println(x + " is NOT a multiple of " + n + ".");
}
}
}
| 409 | 0.531172 | 0.506234 | 16 | 23.0625 | 19.803625 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2 | false | false |
12
|
79e07d3a3a9f5836116314d11623ed33d22a6161
| 24,481,313,630,950 |
792a7d28814b2bfaf07a883bdff1db795bb3ae10
|
/FALL2020/ASMPK011202-fake/app/src/main/java/com/example/asmpk01120/service/MyService.java
|
4efc21a0f8c20ccffaa3a108717fe1e1b894660e
|
[] |
no_license
|
vanhai2000/ASM_MOB204_PK01120_PK01537
|
https://github.com/vanhai2000/ASM_MOB204_PK01120_PK01537
|
14f57a08a22a484c7b194d0c3cf5602d2a093e24
|
adf689e0eadd9d0f77691e721fd065e068389756
|
refs/heads/master
| 2023-01-09T06:41:11.556000 | 2020-11-03T23:32:21 | 2020-11-03T23:32:21 | 297,357,353 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.asmpk01120.service;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.IBinder;
import android.util.Log;
import com.example.asmpk01120.MainActivity;
import com.example.asmpk01120.R;
import static android.content.ContentValues.TAG;
public class MyService extends Service {
MediaPlayer mediaPlayer;
public MyService() {
}
@Override
public IBinder onBind(Intent intent) {
// TODO: Return the communication channel to the service.
throw new UnsupportedOperationException("Not yet implemented");
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
String off = intent.getExtras().getString("extra");
// if (off != null){
// if (off.equals("off")){
// }
// }else {
Log.d(TAG, "MyService.java: RUN!" );
int notifi = intent.getIntExtra("notifi",0);
String mess = intent.getStringExtra("mess");
Intent intent1 = new Intent(this, MainActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent1, 0);
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
Notification.Builder builder = new Notification.Builder(this);
builder.setSmallIcon(android.R.drawable.ic_dialog_info)
.setContentTitle("It's time!")
.setContentText(mess)
.setWhen(System.currentTimeMillis())
.setAutoCancel(true)
.setContentIntent(pendingIntent)
.setPriority(Notification.PRIORITY_MAX)
.setDefaults(Notification.DEFAULT_ALL);
//notifi
notificationManager.notify(notifi, builder.build());
mediaPlayer = MediaPlayer.create(this, R.raw.ambao);
mediaPlayer.start();
// }
return START_STICKY;
}
}
|
UTF-8
|
Java
| 2,186 |
java
|
MyService.java
|
Java
|
[] | null |
[] |
package com.example.asmpk01120.service;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.IBinder;
import android.util.Log;
import com.example.asmpk01120.MainActivity;
import com.example.asmpk01120.R;
import static android.content.ContentValues.TAG;
public class MyService extends Service {
MediaPlayer mediaPlayer;
public MyService() {
}
@Override
public IBinder onBind(Intent intent) {
// TODO: Return the communication channel to the service.
throw new UnsupportedOperationException("Not yet implemented");
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
String off = intent.getExtras().getString("extra");
// if (off != null){
// if (off.equals("off")){
// }
// }else {
Log.d(TAG, "MyService.java: RUN!" );
int notifi = intent.getIntExtra("notifi",0);
String mess = intent.getStringExtra("mess");
Intent intent1 = new Intent(this, MainActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent1, 0);
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
Notification.Builder builder = new Notification.Builder(this);
builder.setSmallIcon(android.R.drawable.ic_dialog_info)
.setContentTitle("It's time!")
.setContentText(mess)
.setWhen(System.currentTimeMillis())
.setAutoCancel(true)
.setContentIntent(pendingIntent)
.setPriority(Notification.PRIORITY_MAX)
.setDefaults(Notification.DEFAULT_ALL);
//notifi
notificationManager.notify(notifi, builder.build());
mediaPlayer = MediaPlayer.create(this, R.raw.ambao);
mediaPlayer.start();
// }
return START_STICKY;
}
}
| 2,186 | 0.647301 | 0.638152 | 65 | 32.630768 | 26.515928 | 123 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.584615 | false | false |
12
|
d59a33226d7f23145cd7db35bf21dd6fa14e60f1
| 34,333,968,621,072 |
13290447cc42358b9892c989e5ebdeab3accd201
|
/Court/src/court/CivilCase.java
|
d468b312d54023cf9b88b4d78165edec76c6c21d
|
[] |
no_license
|
KoshniCharOf/OOP_Tasks
|
https://github.com/KoshniCharOf/OOP_Tasks
|
5f6791a3fb28cce153ceff1276d82e392c275e8f
|
cf925fddfd8a2eea624126030ec77b6e6bf9014e
|
refs/heads/master
| 2021-01-22T19:58:56.906000 | 2017-08-20T23:27:22 | 2017-08-20T23:27:22 | 100,655,908 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package court;
import java.util.TreeSet;
import citizens.Accused;
import citizens.Accuser;
import citizens.Witness;
import jurists.Lawyer;
/**
* Ако делото е гражданско, съдебните заседатели са 3.
* Ако делото е гражданско, обвинителя е гражданин;
*
*/
public class CivilCase extends Case {
private Accuser accuser;
public CivilCase(Accused accused, TreeSet<Witness> witnesses, Accuser accuser, Court court) {
super(accused, witnesses,court);
asignJuri(3);
this.accuser = accuser;
this.accuser.setCasse(this);
this.accuser.hireLawers(court.getLawyers());
this.jurists.addAll(accuser.getLawers());
}
// 2. Ако делото е гражданско, всеки адвокат на обвинителя задава по 3 въпроса на обвиняемия,
//след което задава по 2 въпроса на всеки от свидетелите.
@Override
public void askingAccusedAndWitnesses() {
System.out.println("CIVIL CASE N: "+this.hashCode());
System.out.println("=====Lawers of Accuser=====");
for (Lawyer lawer : this.accuser.getLawers()) {
for (int i = 0; i < 3; i++) {
lawer.ask(this.accused);
}
for (Witness wit : this.witnesses) {
for (int i = 0; i < 2; i++) {
lawer.ask(wit);
}
}
}
}
}
|
UTF-8
|
Java
| 1,389 |
java
|
CivilCase.java
|
Java
|
[] | null |
[] |
package court;
import java.util.TreeSet;
import citizens.Accused;
import citizens.Accuser;
import citizens.Witness;
import jurists.Lawyer;
/**
* Ако делото е гражданско, съдебните заседатели са 3.
* Ако делото е гражданско, обвинителя е гражданин;
*
*/
public class CivilCase extends Case {
private Accuser accuser;
public CivilCase(Accused accused, TreeSet<Witness> witnesses, Accuser accuser, Court court) {
super(accused, witnesses,court);
asignJuri(3);
this.accuser = accuser;
this.accuser.setCasse(this);
this.accuser.hireLawers(court.getLawyers());
this.jurists.addAll(accuser.getLawers());
}
// 2. Ако делото е гражданско, всеки адвокат на обвинителя задава по 3 въпроса на обвиняемия,
//след което задава по 2 въпроса на всеки от свидетелите.
@Override
public void askingAccusedAndWitnesses() {
System.out.println("CIVIL CASE N: "+this.hashCode());
System.out.println("=====Lawers of Accuser=====");
for (Lawyer lawer : this.accuser.getLawers()) {
for (int i = 0; i < 3; i++) {
lawer.ask(this.accused);
}
for (Witness wit : this.witnesses) {
for (int i = 0; i < 2; i++) {
lawer.ask(wit);
}
}
}
}
}
| 1,389 | 0.68262 | 0.675063 | 51 | 22.352942 | 23.515388 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.960784 | false | false |
12
|
03c4161ea79078fca0d13900e8192d3d3a558fe8
| 10,153,302,744,480 |
10a3e673185a1f373d1f4599fcf4ac81856ad0e7
|
/e3-content/e3-content-service/src/test/java/cn/ynx/e3mall/content/redis/RedisClientTest.java
|
df49c5f70fd1d1e697e98dd0bded2397b7c51a97
|
[] |
no_license
|
yangshuo665321/e3mall
|
https://github.com/yangshuo665321/e3mall
|
52d83350a6d59b96837ea7a43cad9f26ce4cd5ea
|
3608cadedfd219e64d7eee38cf42a313179c83b3
|
refs/heads/master
| 2020-04-10T00:51:16.773000 | 2018-12-17T08:18:37 | 2018-12-17T08:18:37 | 160,698,145 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package cn.ynx.e3mall.content.redis;
import cn.ynx.e3mall.common.redis.JedisClient;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class RedisClientTest {
@Test
public void testJedisClient() throws Exception {
//初始化Spring容器
ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:spring/applicationContext-redis.xml");
//从容器中获得JedisClient对象
JedisClient jedisClient = applicationContext.getBean(JedisClient.class);
jedisClient.set("first", "100");
String result = jedisClient.get("first");
System.out.println(result);
}
}
|
UTF-8
|
Java
| 763 |
java
|
RedisClientTest.java
|
Java
|
[] | null |
[] |
package cn.ynx.e3mall.content.redis;
import cn.ynx.e3mall.common.redis.JedisClient;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class RedisClientTest {
@Test
public void testJedisClient() throws Exception {
//初始化Spring容器
ApplicationContext applicationContext = new ClassPathXmlApplicationContext("classpath:spring/applicationContext-redis.xml");
//从容器中获得JedisClient对象
JedisClient jedisClient = applicationContext.getBean(JedisClient.class);
jedisClient.set("first", "100");
String result = jedisClient.get("first");
System.out.println(result);
}
}
| 763 | 0.748982 | 0.742198 | 22 | 32.5 | 32.399143 | 132 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false |
12
|
0a0258c7a4b9a84dfc7d4223a704b17669deac94
| 31,937,376,841,324 |
293b615e4156acd2802cd5c4c431be1d63c29221
|
/COMicroservice-provider-bill/src/main/java/com/highFine/provider/bill/about/controller/AboutController.java
|
ea76ee6cd28aafcefb25cae3c0facfc4b4a3ac95
|
[] |
no_license
|
HisunBillTeam/BillExchange
|
https://github.com/HisunBillTeam/BillExchange
|
720da46723876a4f340f7f27b38e79d5ae1e1dec
|
78660901e907907bc0b14c5526346a109ee9b318
|
refs/heads/BillExchange
| 2021-01-08T21:42:55.325000 | 2020-03-07T13:31:27 | 2020-03-07T13:31:27 | 242,150,345 | 3 | 1 | null | false | 2021-01-05T21:03:56 | 2020-02-21T13:53:46 | 2020-05-31T15:12:17 | 2021-01-05T21:03:54 | 3,823 | 1 | 0 | 7 |
Vue
| false | false |
package com.highFine.provider.bill.about.controller;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.apache.ibatis.annotations.Update;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.highFine.common.util.exception.BusinessException;
import com.highFine.common.util.exception.ErrorCode;
import com.highFine.provider.bill.about.service.AboutService;
import com.highFine.provider.bill.entity.BaseInfo;
import com.highFine.provider.bill.entity.BillAboutUs;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@RestController
@RequestMapping(value = "/bill")
@Api(value = "WEB - AboutController")
public class AboutController {
private final Logger log = LoggerFactory.getLogger(getClass());
@Autowired
private AboutService aboutservice;
@Autowired
private HttpServletRequest request;
/**
* 关于我们的所有数据
*
* @return
*/
@GetMapping(value = "/aboutus/listall")
@ApiOperation(httpMethod = "GET", value = "查询全部关于我们信息")
public List<BillAboutUs> listall() {
return aboutservice.listAll();
}
/**
* 根据主键找出内容
* @return
*/
@GetMapping(value = "/aboutus/getById/{id}")
@ApiOperation(httpMethod = "GET", value = "根据id获取票据基本信息")
public BillAboutUs getById(@PathVariable Integer id) {
return aboutservice.findbypId(id);
}
/**
* 增加关于我们
*
* @param request
* @return
*/
@PostMapping(value = "/aboutus/add")
@ApiOperation(httpMethod = "POST", value = "新增票据基本信息")
public void add(@RequestBody BillAboutUs aboutUs) {
log.info("用户:" + request.getHeader("loginName") + "新增票据基本信息:" + aboutUs.toString());
try {
aboutservice.save(aboutUs);
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException("新增票据基本信息!!!", ErrorCode.GLOBAL);
}
}
/**
* 删除关于我们
*
* @param request
* @return
*/
@DeleteMapping(value = "/aboutus/del/{frid}")
@ApiOperation(httpMethod = "DELETE", value = "根据主键删除数据")
public void del(@PathVariable int frid) {
log.info("用户:" + request.getHeader("loginName") + "根据主键删除数据");
try {
aboutservice.deletebyId(frid);
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException("删除数据异常!!!", ErrorCode.GLOBAL);
}
}
/**
* 修改关于我们
*
* @param request
* @return
*/
/**
* 增加关于我们
*
* @param request
* @return
*/
@PutMapping(value = "/aboutus/update")
@ApiOperation(httpMethod = "PUT", value = "修改票据基本信息")
public void update(@RequestBody BillAboutUs aboutUs) {
log.info("用户:" + request.getHeader("loginName") + "修改票据基本信息:" + aboutUs.toString());
try {
aboutservice.save(aboutUs);
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException("修改票据基本信息!!!", ErrorCode.GLOBAL);
}
}
}
|
UTF-8
|
Java
| 3,549 |
java
|
AboutController.java
|
Java
|
[] | null |
[] |
package com.highFine.provider.bill.about.controller;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.apache.ibatis.annotations.Update;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.highFine.common.util.exception.BusinessException;
import com.highFine.common.util.exception.ErrorCode;
import com.highFine.provider.bill.about.service.AboutService;
import com.highFine.provider.bill.entity.BaseInfo;
import com.highFine.provider.bill.entity.BillAboutUs;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@RestController
@RequestMapping(value = "/bill")
@Api(value = "WEB - AboutController")
public class AboutController {
private final Logger log = LoggerFactory.getLogger(getClass());
@Autowired
private AboutService aboutservice;
@Autowired
private HttpServletRequest request;
/**
* 关于我们的所有数据
*
* @return
*/
@GetMapping(value = "/aboutus/listall")
@ApiOperation(httpMethod = "GET", value = "查询全部关于我们信息")
public List<BillAboutUs> listall() {
return aboutservice.listAll();
}
/**
* 根据主键找出内容
* @return
*/
@GetMapping(value = "/aboutus/getById/{id}")
@ApiOperation(httpMethod = "GET", value = "根据id获取票据基本信息")
public BillAboutUs getById(@PathVariable Integer id) {
return aboutservice.findbypId(id);
}
/**
* 增加关于我们
*
* @param request
* @return
*/
@PostMapping(value = "/aboutus/add")
@ApiOperation(httpMethod = "POST", value = "新增票据基本信息")
public void add(@RequestBody BillAboutUs aboutUs) {
log.info("用户:" + request.getHeader("loginName") + "新增票据基本信息:" + aboutUs.toString());
try {
aboutservice.save(aboutUs);
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException("新增票据基本信息!!!", ErrorCode.GLOBAL);
}
}
/**
* 删除关于我们
*
* @param request
* @return
*/
@DeleteMapping(value = "/aboutus/del/{frid}")
@ApiOperation(httpMethod = "DELETE", value = "根据主键删除数据")
public void del(@PathVariable int frid) {
log.info("用户:" + request.getHeader("loginName") + "根据主键删除数据");
try {
aboutservice.deletebyId(frid);
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException("删除数据异常!!!", ErrorCode.GLOBAL);
}
}
/**
* 修改关于我们
*
* @param request
* @return
*/
/**
* 增加关于我们
*
* @param request
* @return
*/
@PutMapping(value = "/aboutus/update")
@ApiOperation(httpMethod = "PUT", value = "修改票据基本信息")
public void update(@RequestBody BillAboutUs aboutUs) {
log.info("用户:" + request.getHeader("loginName") + "修改票据基本信息:" + aboutUs.toString());
try {
aboutservice.save(aboutUs);
} catch (Exception e) {
e.printStackTrace();
throw new BusinessException("修改票据基本信息!!!", ErrorCode.GLOBAL);
}
}
}
| 3,549 | 0.727634 | 0.727023 | 118 | 26.754238 | 23.377861 | 86 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.381356 | false | false |
12
|
b99868c30025ff6c491f9f7b49d0ba22c7e5c0c7
| 1,735,166,848,016 |
9d97e9fed25022de2c7ba6b80d63c6e4f98f4e97
|
/TaniaJaman.java
|
59b62ba37789d15c06663c65a2bf93bb50e8c8f6
|
[] |
no_license
|
mkhan004/PracticeProject
|
https://github.com/mkhan004/PracticeProject
|
d1531f3ab6b9140a5b3cd5ecabb640095fca515b
|
2cee668f2c506edfef13b076dee7dfa993416943
|
refs/heads/master
| 2020-05-22T01:27:51.888000 | 2016-11-26T18:42:12 | 2016-11-26T18:42:12 | 55,321,626 | 2 | 4 | null | false | 2016-12-03T19:11:57 | 2016-04-02T23:54:14 | 2016-11-05T17:00:25 | 2016-12-03T19:11:57 | 97 | 0 | 3 | 1 |
Java
| null | null |
public class TaniaJaman{
public static void main(String[]args){
System.out.println("This is a String");
System.out.println(getText("My name is Shermin"));
}
public static String getText(String text){
String reverse ="";
for(int i=text.length()-1;i>=0;i--){
reverse +=text.charAt(i);
}
return reverse;
}
|
UTF-8
|
Java
| 348 |
java
|
TaniaJaman.java
|
Java
|
[
{
"context": "\");\n System.out.println(getText(\"My name is Shermin\"));\n\n\n\n}\n\npublic static String getText(String tex",
"end": 170,
"score": 0.999821662902832,
"start": 163,
"tag": "NAME",
"value": "Shermin"
}
] | null |
[] |
public class TaniaJaman{
public static void main(String[]args){
System.out.println("This is a String");
System.out.println(getText("My name is Shermin"));
}
public static String getText(String text){
String reverse ="";
for(int i=text.length()-1;i>=0;i--){
reverse +=text.charAt(i);
}
return reverse;
}
| 348 | 0.626437 | 0.62069 | 18 | 18.333334 | 19.470776 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.444444 | false | false |
12
|
50db6ea546f9991b7caa3246772b632c1b496fdb
| 14,826,227,140,666 |
ed9c07e35f260539c10fe85537f3bf8223a0bd38
|
/BiblioJava/src/view/Affichage.java
|
bcea09b1cddbc19cb444f1bb366524fade25be8a
|
[] |
no_license
|
kilianpoulin/Library-Management
|
https://github.com/kilianpoulin/Library-Management
|
66c3ac5f702813cd618f6f5401ede46a35007f87
|
418b94122a2207565217799bedc10f3f1b9e4648
|
refs/heads/master
| 2021-04-15T18:01:31.435000 | 2018-04-28T19:29:53 | 2018-04-28T19:29:53 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package view;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import model.Document;
import model.Livre;
/**
* Cette classe contient des méthodes servant à l'affichage d'une partie d'une bibliothèque
* (un certain nombre de documents).
* @author Kilian
*/
public interface Affichage {
/**
* Convertie l'affichage d'une liste de documents en string.
* @param docs
* La liste de documents à afficher
* @return
* un élement de type String affichant plusieurs documents.
*/
public static String afficherDocument(Collection<Document> docs){
StringBuilder biblio = new StringBuilder();
for(Document document : docs){
biblio.append(document);
}
return biblio.toString();
}
/**
* Limite l'affichage à la liste d'auteurs.
* @param docs
* La liste de documents à afficher
* @return
* un élement de type String affichant tous les auteurs.
*/
public static String afficherAuteur(Collection<Document> docs){
StringBuilder biblio = new StringBuilder();
int tmp = 1;
List<String> auteurs = new ArrayList();
for(Document document : docs){
if(document instanceof Livre){
Livre livre = (Livre) document;
for(String a : auteurs){
if(livre.getAuteur().compareTo(a) == 0){
tmp = 0;
break;
}
}
if(tmp == 1)
auteurs.add(livre.getAuteur());
tmp = 1;
}
}
for(String a : auteurs){
biblio.append(a);
}
return biblio.toString();
}
}
|
UTF-8
|
Java
| 1,979 |
java
|
Affichage.java
|
Java
|
[
{
"context": "\n * (un certain nombre de documents).\r\n * @author Kilian\r\n */\r\npublic interface Affichage {\r\n\r\n /**\r\n ",
"end": 302,
"score": 0.9995288252830505,
"start": 296,
"tag": "NAME",
"value": "Kilian"
}
] | null |
[] |
package view;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import model.Document;
import model.Livre;
/**
* Cette classe contient des méthodes servant à l'affichage d'une partie d'une bibliothèque
* (un certain nombre de documents).
* @author Kilian
*/
public interface Affichage {
/**
* Convertie l'affichage d'une liste de documents en string.
* @param docs
* La liste de documents à afficher
* @return
* un élement de type String affichant plusieurs documents.
*/
public static String afficherDocument(Collection<Document> docs){
StringBuilder biblio = new StringBuilder();
for(Document document : docs){
biblio.append(document);
}
return biblio.toString();
}
/**
* Limite l'affichage à la liste d'auteurs.
* @param docs
* La liste de documents à afficher
* @return
* un élement de type String affichant tous les auteurs.
*/
public static String afficherAuteur(Collection<Document> docs){
StringBuilder biblio = new StringBuilder();
int tmp = 1;
List<String> auteurs = new ArrayList();
for(Document document : docs){
if(document instanceof Livre){
Livre livre = (Livre) document;
for(String a : auteurs){
if(livre.getAuteur().compareTo(a) == 0){
tmp = 0;
break;
}
}
if(tmp == 1)
auteurs.add(livre.getAuteur());
tmp = 1;
}
}
for(String a : auteurs){
biblio.append(a);
}
return biblio.toString();
}
}
| 1,979 | 0.501776 | 0.499239 | 62 | 29.790323 | 21.391993 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.322581 | false | false |
12
|
d1485915711292c3ad6d9dc209b3026014f17ae6
| 10,256,381,964,808 |
cabb1be82ece5b6bfe1df3b368182d2aad61360e
|
/retrofit2/ServiceMethod.java
|
781ffbd5dfc7440d56e421fb37c816c460c8089b
|
[] |
no_license
|
sooraj2102/nagarro_hack_app
|
https://github.com/sooraj2102/nagarro_hack_app
|
4f1d7c488c1acf7439081b1c379db044d4f9966b
|
3c7de860e75018fea2572ae06b3bdd2f7bf8b907
|
refs/heads/master
| 2021-07-01T12:56:33.829000 | 2020-10-01T09:56:23 | 2020-10-01T09:56:23 | 148,969,210 | 0 | 3 | null | false | 2020-10-01T09:56:24 | 2018-09-16T06:18:35 | 2020-10-01T09:06:40 | 2020-10-01T09:56:23 | 2,006 | 0 | 3 | 0 |
Java
| false | false |
package retrofit2;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.net.URI;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import okhttp3.Call.Factory;
import okhttp3.Headers.Builder;
import okhttp3.HttpUrl;
import okhttp3.MediaType;
import okhttp3.MultipartBody.Part;
import okhttp3.Request;
import okhttp3.ResponseBody;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.HEAD;
import retrofit2.http.HTTP;
import retrofit2.http.Header;
import retrofit2.http.HeaderMap;
import retrofit2.http.Multipart;
import retrofit2.http.OPTIONS;
import retrofit2.http.PATCH;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Part;
import retrofit2.http.PartMap;
import retrofit2.http.Path;
import retrofit2.http.Query;
import retrofit2.http.QueryMap;
import retrofit2.http.QueryName;
import retrofit2.http.Url;
final class ServiceMethod<R, T>
{
static final String PARAM = "[a-zA-Z][a-zA-Z0-9_-]*";
static final Pattern PARAM_NAME_REGEX;
static final Pattern PARAM_URL_REGEX = Pattern.compile("\\{([a-zA-Z][a-zA-Z0-9_-]*)\\}");
private final HttpUrl baseUrl;
final CallAdapter<R, T> callAdapter;
final Call.Factory callFactory;
private final MediaType contentType;
private final boolean hasBody;
private final okhttp3.Headers headers;
private final String httpMethod;
private final boolean isFormEncoded;
private final boolean isMultipart;
private final ParameterHandler<?>[] parameterHandlers;
private final String relativeUrl;
private final Converter<ResponseBody, R> responseConverter;
static
{
PARAM_NAME_REGEX = Pattern.compile("[a-zA-Z][a-zA-Z0-9_-]*");
}
ServiceMethod(Builder<R, T> paramBuilder)
{
this.callFactory = paramBuilder.retrofit.callFactory();
this.callAdapter = paramBuilder.callAdapter;
this.baseUrl = paramBuilder.retrofit.baseUrl();
this.responseConverter = paramBuilder.responseConverter;
this.httpMethod = paramBuilder.httpMethod;
this.relativeUrl = paramBuilder.relativeUrl;
this.headers = paramBuilder.headers;
this.contentType = paramBuilder.contentType;
this.hasBody = paramBuilder.hasBody;
this.isFormEncoded = paramBuilder.isFormEncoded;
this.isMultipart = paramBuilder.isMultipart;
this.parameterHandlers = paramBuilder.parameterHandlers;
}
static Class<?> boxIfPrimitive(Class<?> paramClass)
{
if (Boolean.TYPE == paramClass)
paramClass = Boolean.class;
do
{
return paramClass;
if (Byte.TYPE == paramClass)
return Byte.class;
if (Character.TYPE == paramClass)
return Character.class;
if (Double.TYPE == paramClass)
return Double.class;
if (Float.TYPE == paramClass)
return Float.class;
if (Integer.TYPE == paramClass)
return Integer.class;
if (Long.TYPE == paramClass)
return Long.class;
}
while (Short.TYPE != paramClass);
return Short.class;
}
static Set<String> parsePathParameters(String paramString)
{
Matcher localMatcher = PARAM_URL_REGEX.matcher(paramString);
LinkedHashSet localLinkedHashSet = new LinkedHashSet();
while (localMatcher.find())
localLinkedHashSet.add(localMatcher.group(1));
return localLinkedHashSet;
}
Request toRequest(Object[] paramArrayOfObject)
throws IOException
{
RequestBuilder localRequestBuilder = new RequestBuilder(this.httpMethod, this.baseUrl, this.relativeUrl, this.headers, this.contentType, this.hasBody, this.isFormEncoded, this.isMultipart);
ParameterHandler[] arrayOfParameterHandler = this.parameterHandlers;
if (paramArrayOfObject != null);
for (int i = paramArrayOfObject.length; i != arrayOfParameterHandler.length; i = 0)
throw new IllegalArgumentException("Argument count (" + i + ") doesn't match expected count (" + arrayOfParameterHandler.length + ")");
for (int j = 0; j < i; j++)
arrayOfParameterHandler[j].apply(localRequestBuilder, paramArrayOfObject[j]);
return localRequestBuilder.build();
}
R toResponse(ResponseBody paramResponseBody)
throws IOException
{
return this.responseConverter.convert(paramResponseBody);
}
static final class Builder<T, R>
{
CallAdapter<T, R> callAdapter;
MediaType contentType;
boolean gotBody;
boolean gotField;
boolean gotPart;
boolean gotPath;
boolean gotQuery;
boolean gotUrl;
boolean hasBody;
okhttp3.Headers headers;
String httpMethod;
boolean isFormEncoded;
boolean isMultipart;
final Method method;
final Annotation[] methodAnnotations;
final Annotation[][] parameterAnnotationsArray;
ParameterHandler<?>[] parameterHandlers;
final Type[] parameterTypes;
String relativeUrl;
Set<String> relativeUrlParamNames;
Converter<ResponseBody, T> responseConverter;
Type responseType;
final Retrofit retrofit;
Builder(Retrofit paramRetrofit, Method paramMethod)
{
this.retrofit = paramRetrofit;
this.method = paramMethod;
this.methodAnnotations = paramMethod.getAnnotations();
this.parameterTypes = paramMethod.getGenericParameterTypes();
this.parameterAnnotationsArray = paramMethod.getParameterAnnotations();
}
private CallAdapter<T, R> createCallAdapter()
{
// Byte code:
// 0: aload_0
// 1: getfield 55 retrofit2/ServiceMethod$Builder:method Ljava/lang/reflect/Method;
// 4: invokevirtual 83 java/lang/reflect/Method:getGenericReturnType ()Ljava/lang/reflect/Type;
// 7: astore_1
// 8: aload_1
// 9: invokestatic 89 retrofit2/Utils:hasUnresolvableType (Ljava/lang/reflect/Type;)Z
// 12: ifeq +18 -> 30
// 15: aload_0
// 16: ldc 91
// 18: iconst_1
// 19: anewarray 5 java/lang/Object
// 22: dup
// 23: iconst_0
// 24: aload_1
// 25: aastore
// 26: invokespecial 95 retrofit2/ServiceMethod$Builder:methodError (Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/RuntimeException;
// 29: athrow
// 30: aload_1
// 31: getstatic 101 java/lang/Void:TYPE Ljava/lang/Class;
// 34: if_acmpne +14 -> 48
// 37: aload_0
// 38: ldc 103
// 40: iconst_0
// 41: anewarray 5 java/lang/Object
// 44: invokespecial 95 retrofit2/ServiceMethod$Builder:methodError (Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/RuntimeException;
// 47: athrow
// 48: aload_0
// 49: getfield 55 retrofit2/ServiceMethod$Builder:method Ljava/lang/reflect/Method;
// 52: invokevirtual 61 java/lang/reflect/Method:getAnnotations ()[Ljava/lang/annotation/Annotation;
// 55: astore_2
// 56: aload_0
// 57: getfield 53 retrofit2/ServiceMethod$Builder:retrofit Lretrofit2/Retrofit;
// 60: aload_1
// 61: aload_2
// 62: invokevirtual 108 retrofit2/Retrofit:callAdapter (Ljava/lang/reflect/Type;[Ljava/lang/annotation/Annotation;)Lretrofit2/CallAdapter;
// 65: astore 4
// 67: aload 4
// 69: areturn
// 70: astore_3
// 71: aload_0
// 72: aload_3
// 73: ldc 110
// 75: iconst_1
// 76: anewarray 5 java/lang/Object
// 79: dup
// 80: iconst_0
// 81: aload_1
// 82: aastore
// 83: invokespecial 113 retrofit2/ServiceMethod$Builder:methodError (Ljava/lang/Throwable;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/RuntimeException;
// 86: athrow
//
// Exception table:
// from to target type
// 56 67 70 java/lang/RuntimeException
}
private Converter<ResponseBody, T> createResponseConverter()
{
Annotation[] arrayOfAnnotation = this.method.getAnnotations();
Object[] arrayOfObject;
try
{
Converter localConverter = this.retrofit.responseBodyConverter(this.responseType, arrayOfAnnotation);
return localConverter;
}
catch (RuntimeException localRuntimeException)
{
arrayOfObject = new Object[1];
arrayOfObject[0] = this.responseType;
}
throw methodError(localRuntimeException, "Unable to create converter for %s", arrayOfObject);
}
private RuntimeException methodError(String paramString, Object[] paramArrayOfObject)
{
return methodError(null, paramString, paramArrayOfObject);
}
private RuntimeException methodError(Throwable paramThrowable, String paramString, Object[] paramArrayOfObject)
{
String str = String.format(paramString, paramArrayOfObject);
return new IllegalArgumentException(str + "\n for method " + this.method.getDeclaringClass().getSimpleName() + "." + this.method.getName(), paramThrowable);
}
private RuntimeException parameterError(int paramInt, String paramString, Object[] paramArrayOfObject)
{
return methodError(paramString + " (parameter #" + (paramInt + 1) + ")", paramArrayOfObject);
}
private RuntimeException parameterError(Throwable paramThrowable, int paramInt, String paramString, Object[] paramArrayOfObject)
{
return methodError(paramThrowable, paramString + " (parameter #" + (paramInt + 1) + ")", paramArrayOfObject);
}
private okhttp3.Headers parseHeaders(String[] paramArrayOfString)
{
Headers.Builder localBuilder = new Headers.Builder();
int i = paramArrayOfString.length;
int j = 0;
if (j < i)
{
String str1 = paramArrayOfString[j];
int k = str1.indexOf(':');
if ((k == -1) || (k == 0) || (k == -1 + str1.length()))
throw methodError("@Headers value must be in the form \"Name: Value\". Found: \"%s\"", new Object[] { str1 });
String str2 = str1.substring(0, k);
String str3 = str1.substring(k + 1).trim();
if ("Content-Type".equalsIgnoreCase(str2))
{
MediaType localMediaType = MediaType.parse(str3);
if (localMediaType == null)
throw methodError("Malformed content type: %s", new Object[] { str3 });
this.contentType = localMediaType;
}
while (true)
{
j++;
break;
localBuilder.add(str2, str3);
}
}
return localBuilder.build();
}
private void parseHttpMethodAndPath(String paramString1, String paramString2, boolean paramBoolean)
{
if (this.httpMethod != null)
{
Object[] arrayOfObject = new Object[2];
arrayOfObject[0] = this.httpMethod;
arrayOfObject[1] = paramString1;
throw methodError("Only one HTTP method is allowed. Found: %s and %s.", arrayOfObject);
}
this.httpMethod = paramString1;
this.hasBody = paramBoolean;
if (paramString2.isEmpty())
return;
int i = paramString2.indexOf('?');
if ((i != -1) && (i < -1 + paramString2.length()))
{
String str = paramString2.substring(i + 1);
if (ServiceMethod.PARAM_URL_REGEX.matcher(str).find())
throw methodError("URL query string \"%s\" must not have replace block. For dynamic query parameters use @Query.", new Object[] { str });
}
this.relativeUrl = paramString2;
this.relativeUrlParamNames = ServiceMethod.parsePathParameters(paramString2);
}
private void parseMethodAnnotation(Annotation paramAnnotation)
{
if ((paramAnnotation instanceof DELETE))
parseHttpMethodAndPath("DELETE", ((DELETE)paramAnnotation).value(), false);
do
{
while (true)
{
return;
if ((paramAnnotation instanceof GET))
{
parseHttpMethodAndPath("GET", ((GET)paramAnnotation).value(), false);
return;
}
if (!(paramAnnotation instanceof HEAD))
break;
parseHttpMethodAndPath("HEAD", ((HEAD)paramAnnotation).value(), false);
if (Void.class.equals(this.responseType))
continue;
throw methodError("HEAD method must use Void as response type.", new Object[0]);
}
if ((paramAnnotation instanceof PATCH))
{
parseHttpMethodAndPath("PATCH", ((PATCH)paramAnnotation).value(), true);
return;
}
if ((paramAnnotation instanceof POST))
{
parseHttpMethodAndPath("POST", ((POST)paramAnnotation).value(), true);
return;
}
if ((paramAnnotation instanceof PUT))
{
parseHttpMethodAndPath("PUT", ((PUT)paramAnnotation).value(), true);
return;
}
if ((paramAnnotation instanceof OPTIONS))
{
parseHttpMethodAndPath("OPTIONS", ((OPTIONS)paramAnnotation).value(), false);
return;
}
if ((paramAnnotation instanceof HTTP))
{
HTTP localHTTP = (HTTP)paramAnnotation;
parseHttpMethodAndPath(localHTTP.method(), localHTTP.path(), localHTTP.hasBody());
return;
}
if ((paramAnnotation instanceof retrofit2.http.Headers))
{
String[] arrayOfString = ((retrofit2.http.Headers)paramAnnotation).value();
if (arrayOfString.length == 0)
throw methodError("@Headers annotation is empty.", new Object[0]);
this.headers = parseHeaders(arrayOfString);
return;
}
if (!(paramAnnotation instanceof Multipart))
continue;
if (this.isFormEncoded)
throw methodError("Only one encoding annotation is allowed.", new Object[0]);
this.isMultipart = true;
return;
}
while (!(paramAnnotation instanceof FormUrlEncoded));
if (this.isMultipart)
throw methodError("Only one encoding annotation is allowed.", new Object[0]);
this.isFormEncoded = true;
}
private ParameterHandler<?> parseParameter(int paramInt, Type paramType, Annotation[] paramArrayOfAnnotation)
{
Object localObject = null;
int i = paramArrayOfAnnotation.length;
int j = 0;
if (j < i)
{
ParameterHandler localParameterHandler = parseParameterAnnotation(paramInt, paramType, paramArrayOfAnnotation, paramArrayOfAnnotation[j]);
if (localParameterHandler == null);
while (true)
{
j++;
break;
if (localObject != null)
throw parameterError(paramInt, "Multiple Retrofit annotations found, only one allowed.", new Object[0]);
localObject = localParameterHandler;
}
}
if (localObject == null)
throw parameterError(paramInt, "No Retrofit annotation found.", new Object[0]);
return localObject;
}
private ParameterHandler<?> parseParameterAnnotation(int paramInt, Type paramType, Annotation[] paramArrayOfAnnotation, Annotation paramAnnotation)
{
if ((paramAnnotation instanceof Url))
{
if (this.gotUrl)
throw parameterError(paramInt, "Multiple @Url method annotations found.", new Object[0]);
if (this.gotPath)
throw parameterError(paramInt, "@Path parameters may not be used with @Url.", new Object[0]);
if (this.gotQuery)
throw parameterError(paramInt, "A @Url parameter must not come after a @Query", new Object[0]);
if (this.relativeUrl != null)
{
Object[] arrayOfObject2 = new Object[1];
arrayOfObject2[0] = this.httpMethod;
throw parameterError(paramInt, "@Url cannot be used with @%s URL", arrayOfObject2);
}
this.gotUrl = true;
if ((paramType == HttpUrl.class) || (paramType == String.class) || (paramType == URI.class) || (((paramType instanceof Class)) && ("android.net.Uri".equals(((Class)paramType).getName()))))
return new ParameterHandler.RelativeUrl();
throw parameterError(paramInt, "@Url must be okhttp3.HttpUrl, String, java.net.URI, or android.net.Uri type.", new Object[0]);
}
if ((paramAnnotation instanceof Path))
{
if (this.gotQuery)
throw parameterError(paramInt, "A @Path parameter must not come after a @Query.", new Object[0]);
if (this.gotUrl)
throw parameterError(paramInt, "@Path parameters may not be used with @Url.", new Object[0]);
if (this.relativeUrl == null)
{
Object[] arrayOfObject1 = new Object[1];
arrayOfObject1[0] = this.httpMethod;
throw parameterError(paramInt, "@Path can only be used with relative url on @%s", arrayOfObject1);
}
this.gotPath = true;
Path localPath = (Path)paramAnnotation;
String str5 = localPath.value();
validatePathName(paramInt, str5);
Converter localConverter21 = this.retrofit.stringConverter(paramType, paramArrayOfAnnotation);
ParameterHandler.Path localPath1 = new ParameterHandler.Path(str5, localConverter21, localPath.encoded());
return localPath1;
}
if ((paramAnnotation instanceof Query))
{
Query localQuery = (Query)paramAnnotation;
String str4 = localQuery.value();
boolean bool3 = localQuery.encoded();
Class localClass13 = Utils.getRawType(paramType);
this.gotQuery = true;
if (Iterable.class.isAssignableFrom(localClass13))
{
if (!(paramType instanceof ParameterizedType))
throw parameterError(paramInt, localClass13.getSimpleName() + " must include generic type (e.g., " + localClass13.getSimpleName() + "<String>)", new Object[0]);
Type localType17 = Utils.getParameterUpperBound(0, (ParameterizedType)paramType);
Converter localConverter20 = this.retrofit.stringConverter(localType17, paramArrayOfAnnotation);
ParameterHandler.Query localQuery3 = new ParameterHandler.Query(str4, localConverter20, bool3);
return localQuery3.iterable();
}
if (localClass13.isArray())
{
Class localClass14 = ServiceMethod.boxIfPrimitive(localClass13.getComponentType());
Converter localConverter19 = this.retrofit.stringConverter(localClass14, paramArrayOfAnnotation);
ParameterHandler.Query localQuery2 = new ParameterHandler.Query(str4, localConverter19, bool3);
return localQuery2.array();
}
Converter localConverter18 = this.retrofit.stringConverter(paramType, paramArrayOfAnnotation);
ParameterHandler.Query localQuery1 = new ParameterHandler.Query(str4, localConverter18, bool3);
return localQuery1;
}
if ((paramAnnotation instanceof QueryName))
{
boolean bool2 = ((QueryName)paramAnnotation).encoded();
Class localClass11 = Utils.getRawType(paramType);
this.gotQuery = true;
if (Iterable.class.isAssignableFrom(localClass11))
{
if (!(paramType instanceof ParameterizedType))
throw parameterError(paramInt, localClass11.getSimpleName() + " must include generic type (e.g., " + localClass11.getSimpleName() + "<String>)", new Object[0]);
Type localType16 = Utils.getParameterUpperBound(0, (ParameterizedType)paramType);
Converter localConverter17 = this.retrofit.stringConverter(localType16, paramArrayOfAnnotation);
ParameterHandler.QueryName localQueryName3 = new ParameterHandler.QueryName(localConverter17, bool2);
return localQueryName3.iterable();
}
if (localClass11.isArray())
{
Class localClass12 = ServiceMethod.boxIfPrimitive(localClass11.getComponentType());
Converter localConverter16 = this.retrofit.stringConverter(localClass12, paramArrayOfAnnotation);
ParameterHandler.QueryName localQueryName2 = new ParameterHandler.QueryName(localConverter16, bool2);
return localQueryName2.array();
}
Converter localConverter15 = this.retrofit.stringConverter(paramType, paramArrayOfAnnotation);
ParameterHandler.QueryName localQueryName1 = new ParameterHandler.QueryName(localConverter15, bool2);
return localQueryName1;
}
if ((paramAnnotation instanceof QueryMap))
{
Class localClass10 = Utils.getRawType(paramType);
if (!Map.class.isAssignableFrom(localClass10))
throw parameterError(paramInt, "@QueryMap parameter type must be Map.", new Object[0]);
Type localType13 = Utils.getSupertype(paramType, localClass10, Map.class);
if (!(localType13 instanceof ParameterizedType))
throw parameterError(paramInt, "Map must include generic types (e.g., Map<String, String>)", new Object[0]);
ParameterizedType localParameterizedType4 = (ParameterizedType)localType13;
Type localType14 = Utils.getParameterUpperBound(0, localParameterizedType4);
if (String.class != localType14)
throw parameterError(paramInt, "@QueryMap keys must be of type String: " + localType14, new Object[0]);
Type localType15 = Utils.getParameterUpperBound(1, localParameterizedType4);
Converter localConverter14 = this.retrofit.stringConverter(localType15, paramArrayOfAnnotation);
ParameterHandler.QueryMap localQueryMap = new ParameterHandler.QueryMap(localConverter14, ((QueryMap)paramAnnotation).encoded());
return localQueryMap;
}
if ((paramAnnotation instanceof Header))
{
String str3 = ((Header)paramAnnotation).value();
Class localClass8 = Utils.getRawType(paramType);
if (Iterable.class.isAssignableFrom(localClass8))
{
if (!(paramType instanceof ParameterizedType))
throw parameterError(paramInt, localClass8.getSimpleName() + " must include generic type (e.g., " + localClass8.getSimpleName() + "<String>)", new Object[0]);
Type localType12 = Utils.getParameterUpperBound(0, (ParameterizedType)paramType);
Converter localConverter13 = this.retrofit.stringConverter(localType12, paramArrayOfAnnotation);
ParameterHandler.Header localHeader3 = new ParameterHandler.Header(str3, localConverter13);
return localHeader3.iterable();
}
if (localClass8.isArray())
{
Class localClass9 = ServiceMethod.boxIfPrimitive(localClass8.getComponentType());
Converter localConverter12 = this.retrofit.stringConverter(localClass9, paramArrayOfAnnotation);
ParameterHandler.Header localHeader2 = new ParameterHandler.Header(str3, localConverter12);
return localHeader2.array();
}
Converter localConverter11 = this.retrofit.stringConverter(paramType, paramArrayOfAnnotation);
ParameterHandler.Header localHeader1 = new ParameterHandler.Header(str3, localConverter11);
return localHeader1;
}
if ((paramAnnotation instanceof HeaderMap))
{
Class localClass7 = Utils.getRawType(paramType);
if (!Map.class.isAssignableFrom(localClass7))
throw parameterError(paramInt, "@HeaderMap parameter type must be Map.", new Object[0]);
Type localType9 = Utils.getSupertype(paramType, localClass7, Map.class);
if (!(localType9 instanceof ParameterizedType))
throw parameterError(paramInt, "Map must include generic types (e.g., Map<String, String>)", new Object[0]);
ParameterizedType localParameterizedType3 = (ParameterizedType)localType9;
Type localType10 = Utils.getParameterUpperBound(0, localParameterizedType3);
if (String.class != localType10)
throw parameterError(paramInt, "@HeaderMap keys must be of type String: " + localType10, new Object[0]);
Type localType11 = Utils.getParameterUpperBound(1, localParameterizedType3);
Converter localConverter10 = this.retrofit.stringConverter(localType11, paramArrayOfAnnotation);
ParameterHandler.HeaderMap localHeaderMap = new ParameterHandler.HeaderMap(localConverter10);
return localHeaderMap;
}
if ((paramAnnotation instanceof Field))
{
if (!this.isFormEncoded)
throw parameterError(paramInt, "@Field parameters can only be used with form encoding.", new Object[0]);
Field localField = (Field)paramAnnotation;
String str2 = localField.value();
boolean bool1 = localField.encoded();
this.gotField = true;
Class localClass5 = Utils.getRawType(paramType);
if (Iterable.class.isAssignableFrom(localClass5))
{
if (!(paramType instanceof ParameterizedType))
throw parameterError(paramInt, localClass5.getSimpleName() + " must include generic type (e.g., " + localClass5.getSimpleName() + "<String>)", new Object[0]);
Type localType8 = Utils.getParameterUpperBound(0, (ParameterizedType)paramType);
Converter localConverter9 = this.retrofit.stringConverter(localType8, paramArrayOfAnnotation);
ParameterHandler.Field localField3 = new ParameterHandler.Field(str2, localConverter9, bool1);
return localField3.iterable();
}
if (localClass5.isArray())
{
Class localClass6 = ServiceMethod.boxIfPrimitive(localClass5.getComponentType());
Converter localConverter8 = this.retrofit.stringConverter(localClass6, paramArrayOfAnnotation);
ParameterHandler.Field localField2 = new ParameterHandler.Field(str2, localConverter8, bool1);
return localField2.array();
}
Converter localConverter7 = this.retrofit.stringConverter(paramType, paramArrayOfAnnotation);
ParameterHandler.Field localField1 = new ParameterHandler.Field(str2, localConverter7, bool1);
return localField1;
}
if ((paramAnnotation instanceof FieldMap))
{
if (!this.isFormEncoded)
throw parameterError(paramInt, "@FieldMap parameters can only be used with form encoding.", new Object[0]);
Class localClass4 = Utils.getRawType(paramType);
if (!Map.class.isAssignableFrom(localClass4))
throw parameterError(paramInt, "@FieldMap parameter type must be Map.", new Object[0]);
Type localType5 = Utils.getSupertype(paramType, localClass4, Map.class);
if (!(localType5 instanceof ParameterizedType))
throw parameterError(paramInt, "Map must include generic types (e.g., Map<String, String>)", new Object[0]);
ParameterizedType localParameterizedType2 = (ParameterizedType)localType5;
Type localType6 = Utils.getParameterUpperBound(0, localParameterizedType2);
if (String.class != localType6)
throw parameterError(paramInt, "@FieldMap keys must be of type String: " + localType6, new Object[0]);
Type localType7 = Utils.getParameterUpperBound(1, localParameterizedType2);
Converter localConverter6 = this.retrofit.stringConverter(localType7, paramArrayOfAnnotation);
this.gotField = true;
ParameterHandler.FieldMap localFieldMap = new ParameterHandler.FieldMap(localConverter6, ((FieldMap)paramAnnotation).encoded());
return localFieldMap;
}
if ((paramAnnotation instanceof Part))
{
if (!this.isMultipart)
throw parameterError(paramInt, "@Part parameters can only be used with multipart encoding.", new Object[0]);
Part localPart = (Part)paramAnnotation;
this.gotPart = true;
String str1 = localPart.value();
Class localClass2 = Utils.getRawType(paramType);
if (str1.isEmpty())
{
if (Iterable.class.isAssignableFrom(localClass2))
{
if (!(paramType instanceof ParameterizedType))
throw parameterError(paramInt, localClass2.getSimpleName() + " must include generic type (e.g., " + localClass2.getSimpleName() + "<String>)", new Object[0]);
if (!MultipartBody.Part.class.isAssignableFrom(Utils.getRawType(Utils.getParameterUpperBound(0, (ParameterizedType)paramType))))
throw parameterError(paramInt, "@Part annotation must supply a name or use MultipartBody.Part parameter type.", new Object[0]);
return ParameterHandler.RawPart.INSTANCE.iterable();
}
if (localClass2.isArray())
{
if (!MultipartBody.Part.class.isAssignableFrom(localClass2.getComponentType()))
throw parameterError(paramInt, "@Part annotation must supply a name or use MultipartBody.Part parameter type.", new Object[0]);
return ParameterHandler.RawPart.INSTANCE.array();
}
if (MultipartBody.Part.class.isAssignableFrom(localClass2))
return ParameterHandler.RawPart.INSTANCE;
throw parameterError(paramInt, "@Part annotation must supply a name or use MultipartBody.Part parameter type.", new Object[0]);
}
String[] arrayOfString = new String[4];
arrayOfString[0] = "Content-Disposition";
arrayOfString[1] = ("form-data; name=\"" + str1 + "\"");
arrayOfString[2] = "Content-Transfer-Encoding";
arrayOfString[3] = localPart.encoding();
okhttp3.Headers localHeaders = okhttp3.Headers.of(arrayOfString);
if (Iterable.class.isAssignableFrom(localClass2))
{
if (!(paramType instanceof ParameterizedType))
throw parameterError(paramInt, localClass2.getSimpleName() + " must include generic type (e.g., " + localClass2.getSimpleName() + "<String>)", new Object[0]);
Type localType4 = Utils.getParameterUpperBound(0, (ParameterizedType)paramType);
if (MultipartBody.Part.class.isAssignableFrom(Utils.getRawType(localType4)))
throw parameterError(paramInt, "@Part parameters using the MultipartBody.Part must not include a part name in the annotation.", new Object[0]);
Converter localConverter5 = this.retrofit.requestBodyConverter(localType4, paramArrayOfAnnotation, this.methodAnnotations);
ParameterHandler.Part localPart3 = new ParameterHandler.Part(localHeaders, localConverter5);
return localPart3.iterable();
}
if (localClass2.isArray())
{
Class localClass3 = ServiceMethod.boxIfPrimitive(localClass2.getComponentType());
if (MultipartBody.Part.class.isAssignableFrom(localClass3))
throw parameterError(paramInt, "@Part parameters using the MultipartBody.Part must not include a part name in the annotation.", new Object[0]);
Converter localConverter4 = this.retrofit.requestBodyConverter(localClass3, paramArrayOfAnnotation, this.methodAnnotations);
ParameterHandler.Part localPart2 = new ParameterHandler.Part(localHeaders, localConverter4);
return localPart2.array();
}
if (MultipartBody.Part.class.isAssignableFrom(localClass2))
throw parameterError(paramInt, "@Part parameters using the MultipartBody.Part must not include a part name in the annotation.", new Object[0]);
Converter localConverter3 = this.retrofit.requestBodyConverter(paramType, paramArrayOfAnnotation, this.methodAnnotations);
ParameterHandler.Part localPart1 = new ParameterHandler.Part(localHeaders, localConverter3);
return localPart1;
}
if ((paramAnnotation instanceof PartMap))
{
if (!this.isMultipart)
throw parameterError(paramInt, "@PartMap parameters can only be used with multipart encoding.", new Object[0]);
this.gotPart = true;
Class localClass1 = Utils.getRawType(paramType);
if (!Map.class.isAssignableFrom(localClass1))
throw parameterError(paramInt, "@PartMap parameter type must be Map.", new Object[0]);
Type localType1 = Utils.getSupertype(paramType, localClass1, Map.class);
if (!(localType1 instanceof ParameterizedType))
throw parameterError(paramInt, "Map must include generic types (e.g., Map<String, String>)", new Object[0]);
ParameterizedType localParameterizedType1 = (ParameterizedType)localType1;
Type localType2 = Utils.getParameterUpperBound(0, localParameterizedType1);
if (String.class != localType2)
throw parameterError(paramInt, "@PartMap keys must be of type String: " + localType2, new Object[0]);
Type localType3 = Utils.getParameterUpperBound(1, localParameterizedType1);
if (MultipartBody.Part.class.isAssignableFrom(Utils.getRawType(localType3)))
throw parameterError(paramInt, "@PartMap values cannot be MultipartBody.Part. Use @Part List<Part> or a different value type instead.", new Object[0]);
Converter localConverter2 = this.retrofit.requestBodyConverter(localType3, paramArrayOfAnnotation, this.methodAnnotations);
PartMap localPartMap = (PartMap)paramAnnotation;
ParameterHandler.PartMap localPartMap1 = new ParameterHandler.PartMap(localConverter2, localPartMap.encoding());
return localPartMap1;
}
if ((paramAnnotation instanceof Body))
{
if ((this.isFormEncoded) || (this.isMultipart))
throw parameterError(paramInt, "@Body parameters cannot be used with form or multi-part encoding.", new Object[0]);
if (this.gotBody)
throw parameterError(paramInt, "Multiple @Body method annotations found.", new Object[0]);
try
{
Converter localConverter1 = this.retrofit.requestBodyConverter(paramType, paramArrayOfAnnotation, this.methodAnnotations);
this.gotBody = true;
ParameterHandler.Body localBody = new ParameterHandler.Body(localConverter1);
return localBody;
}
catch (RuntimeException localRuntimeException)
{
throw parameterError(localRuntimeException, paramInt, "Unable to create @Body converter for %s", new Object[] { paramType });
}
}
return null;
}
private void validatePathName(int paramInt, String paramString)
{
if (!ServiceMethod.PARAM_NAME_REGEX.matcher(paramString).matches())
{
Object[] arrayOfObject2 = new Object[2];
arrayOfObject2[0] = ServiceMethod.PARAM_URL_REGEX.pattern();
arrayOfObject2[1] = paramString;
throw parameterError(paramInt, "@Path parameter name must match %s. Found: %s", arrayOfObject2);
}
if (!this.relativeUrlParamNames.contains(paramString))
{
Object[] arrayOfObject1 = new Object[2];
arrayOfObject1[0] = this.relativeUrl;
arrayOfObject1[1] = paramString;
throw parameterError(paramInt, "URL \"%s\" does not contain \"{%s}\".", arrayOfObject1);
}
}
public ServiceMethod build()
{
this.callAdapter = createCallAdapter();
this.responseType = this.callAdapter.responseType();
if ((this.responseType == Response.class) || (this.responseType == okhttp3.Response.class))
throw methodError("'" + Utils.getRawType(this.responseType).getName() + "' is not a valid response body type. Did you mean ResponseBody?", new Object[0]);
this.responseConverter = createResponseConverter();
Annotation[] arrayOfAnnotation1 = this.methodAnnotations;
int i = arrayOfAnnotation1.length;
for (int j = 0; j < i; j++)
parseMethodAnnotation(arrayOfAnnotation1[j]);
if (this.httpMethod == null)
throw methodError("HTTP method annotation is required (e.g., @GET, @POST, etc.).", new Object[0]);
if (!this.hasBody)
{
if (this.isMultipart)
throw methodError("Multipart can only be specified on HTTP methods with request body (e.g., @POST).", new Object[0]);
if (this.isFormEncoded)
throw methodError("FormUrlEncoded can only be specified on HTTP methods with request body (e.g., @POST).", new Object[0]);
}
int k = this.parameterAnnotationsArray.length;
this.parameterHandlers = new ParameterHandler[k];
for (int m = 0; m < k; m++)
{
Type localType = this.parameterTypes[m];
if (Utils.hasUnresolvableType(localType))
throw parameterError(m, "Parameter type must not include a type variable or wildcard: %s", new Object[] { localType });
Annotation[] arrayOfAnnotation2 = this.parameterAnnotationsArray[m];
if (arrayOfAnnotation2 == null)
throw parameterError(m, "No Retrofit annotation found.", new Object[0]);
this.parameterHandlers[m] = parseParameter(m, localType, arrayOfAnnotation2);
}
if ((this.relativeUrl == null) && (!this.gotUrl))
{
Object[] arrayOfObject = new Object[1];
arrayOfObject[0] = this.httpMethod;
throw methodError("Missing either @%s URL or @Url parameter.", arrayOfObject);
}
if ((!this.isFormEncoded) && (!this.isMultipart) && (!this.hasBody) && (this.gotBody))
throw methodError("Non-body HTTP method cannot contain @Body.", new Object[0]);
if ((this.isFormEncoded) && (!this.gotField))
throw methodError("Form-encoded method must contain at least one @Field.", new Object[0]);
if ((this.isMultipart) && (!this.gotPart))
throw methodError("Multipart method must contain at least one @Part.", new Object[0]);
return new ServiceMethod(this);
}
}
}
/* Location: /home/satyam/AndroidStudioProjects/app/dex2jar-0.0.9.15/classes-dex2jar.jar
* Qualified Name: retrofit2.ServiceMethod
* JD-Core Version: 0.6.0
*/
|
UTF-8
|
Java
| 37,637 |
java
|
ServiceMethod.java
|
Java
|
[] | null |
[] |
package retrofit2;
import java.io.IOException;
import java.lang.annotation.Annotation;
import java.lang.reflect.Method;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.net.URI;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import okhttp3.Call.Factory;
import okhttp3.Headers.Builder;
import okhttp3.HttpUrl;
import okhttp3.MediaType;
import okhttp3.MultipartBody.Part;
import okhttp3.Request;
import okhttp3.ResponseBody;
import retrofit2.http.Body;
import retrofit2.http.DELETE;
import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.HEAD;
import retrofit2.http.HTTP;
import retrofit2.http.Header;
import retrofit2.http.HeaderMap;
import retrofit2.http.Multipart;
import retrofit2.http.OPTIONS;
import retrofit2.http.PATCH;
import retrofit2.http.POST;
import retrofit2.http.PUT;
import retrofit2.http.Part;
import retrofit2.http.PartMap;
import retrofit2.http.Path;
import retrofit2.http.Query;
import retrofit2.http.QueryMap;
import retrofit2.http.QueryName;
import retrofit2.http.Url;
final class ServiceMethod<R, T>
{
static final String PARAM = "[a-zA-Z][a-zA-Z0-9_-]*";
static final Pattern PARAM_NAME_REGEX;
static final Pattern PARAM_URL_REGEX = Pattern.compile("\\{([a-zA-Z][a-zA-Z0-9_-]*)\\}");
private final HttpUrl baseUrl;
final CallAdapter<R, T> callAdapter;
final Call.Factory callFactory;
private final MediaType contentType;
private final boolean hasBody;
private final okhttp3.Headers headers;
private final String httpMethod;
private final boolean isFormEncoded;
private final boolean isMultipart;
private final ParameterHandler<?>[] parameterHandlers;
private final String relativeUrl;
private final Converter<ResponseBody, R> responseConverter;
static
{
PARAM_NAME_REGEX = Pattern.compile("[a-zA-Z][a-zA-Z0-9_-]*");
}
ServiceMethod(Builder<R, T> paramBuilder)
{
this.callFactory = paramBuilder.retrofit.callFactory();
this.callAdapter = paramBuilder.callAdapter;
this.baseUrl = paramBuilder.retrofit.baseUrl();
this.responseConverter = paramBuilder.responseConverter;
this.httpMethod = paramBuilder.httpMethod;
this.relativeUrl = paramBuilder.relativeUrl;
this.headers = paramBuilder.headers;
this.contentType = paramBuilder.contentType;
this.hasBody = paramBuilder.hasBody;
this.isFormEncoded = paramBuilder.isFormEncoded;
this.isMultipart = paramBuilder.isMultipart;
this.parameterHandlers = paramBuilder.parameterHandlers;
}
static Class<?> boxIfPrimitive(Class<?> paramClass)
{
if (Boolean.TYPE == paramClass)
paramClass = Boolean.class;
do
{
return paramClass;
if (Byte.TYPE == paramClass)
return Byte.class;
if (Character.TYPE == paramClass)
return Character.class;
if (Double.TYPE == paramClass)
return Double.class;
if (Float.TYPE == paramClass)
return Float.class;
if (Integer.TYPE == paramClass)
return Integer.class;
if (Long.TYPE == paramClass)
return Long.class;
}
while (Short.TYPE != paramClass);
return Short.class;
}
static Set<String> parsePathParameters(String paramString)
{
Matcher localMatcher = PARAM_URL_REGEX.matcher(paramString);
LinkedHashSet localLinkedHashSet = new LinkedHashSet();
while (localMatcher.find())
localLinkedHashSet.add(localMatcher.group(1));
return localLinkedHashSet;
}
Request toRequest(Object[] paramArrayOfObject)
throws IOException
{
RequestBuilder localRequestBuilder = new RequestBuilder(this.httpMethod, this.baseUrl, this.relativeUrl, this.headers, this.contentType, this.hasBody, this.isFormEncoded, this.isMultipart);
ParameterHandler[] arrayOfParameterHandler = this.parameterHandlers;
if (paramArrayOfObject != null);
for (int i = paramArrayOfObject.length; i != arrayOfParameterHandler.length; i = 0)
throw new IllegalArgumentException("Argument count (" + i + ") doesn't match expected count (" + arrayOfParameterHandler.length + ")");
for (int j = 0; j < i; j++)
arrayOfParameterHandler[j].apply(localRequestBuilder, paramArrayOfObject[j]);
return localRequestBuilder.build();
}
R toResponse(ResponseBody paramResponseBody)
throws IOException
{
return this.responseConverter.convert(paramResponseBody);
}
static final class Builder<T, R>
{
CallAdapter<T, R> callAdapter;
MediaType contentType;
boolean gotBody;
boolean gotField;
boolean gotPart;
boolean gotPath;
boolean gotQuery;
boolean gotUrl;
boolean hasBody;
okhttp3.Headers headers;
String httpMethod;
boolean isFormEncoded;
boolean isMultipart;
final Method method;
final Annotation[] methodAnnotations;
final Annotation[][] parameterAnnotationsArray;
ParameterHandler<?>[] parameterHandlers;
final Type[] parameterTypes;
String relativeUrl;
Set<String> relativeUrlParamNames;
Converter<ResponseBody, T> responseConverter;
Type responseType;
final Retrofit retrofit;
Builder(Retrofit paramRetrofit, Method paramMethod)
{
this.retrofit = paramRetrofit;
this.method = paramMethod;
this.methodAnnotations = paramMethod.getAnnotations();
this.parameterTypes = paramMethod.getGenericParameterTypes();
this.parameterAnnotationsArray = paramMethod.getParameterAnnotations();
}
private CallAdapter<T, R> createCallAdapter()
{
// Byte code:
// 0: aload_0
// 1: getfield 55 retrofit2/ServiceMethod$Builder:method Ljava/lang/reflect/Method;
// 4: invokevirtual 83 java/lang/reflect/Method:getGenericReturnType ()Ljava/lang/reflect/Type;
// 7: astore_1
// 8: aload_1
// 9: invokestatic 89 retrofit2/Utils:hasUnresolvableType (Ljava/lang/reflect/Type;)Z
// 12: ifeq +18 -> 30
// 15: aload_0
// 16: ldc 91
// 18: iconst_1
// 19: anewarray 5 java/lang/Object
// 22: dup
// 23: iconst_0
// 24: aload_1
// 25: aastore
// 26: invokespecial 95 retrofit2/ServiceMethod$Builder:methodError (Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/RuntimeException;
// 29: athrow
// 30: aload_1
// 31: getstatic 101 java/lang/Void:TYPE Ljava/lang/Class;
// 34: if_acmpne +14 -> 48
// 37: aload_0
// 38: ldc 103
// 40: iconst_0
// 41: anewarray 5 java/lang/Object
// 44: invokespecial 95 retrofit2/ServiceMethod$Builder:methodError (Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/RuntimeException;
// 47: athrow
// 48: aload_0
// 49: getfield 55 retrofit2/ServiceMethod$Builder:method Ljava/lang/reflect/Method;
// 52: invokevirtual 61 java/lang/reflect/Method:getAnnotations ()[Ljava/lang/annotation/Annotation;
// 55: astore_2
// 56: aload_0
// 57: getfield 53 retrofit2/ServiceMethod$Builder:retrofit Lretrofit2/Retrofit;
// 60: aload_1
// 61: aload_2
// 62: invokevirtual 108 retrofit2/Retrofit:callAdapter (Ljava/lang/reflect/Type;[Ljava/lang/annotation/Annotation;)Lretrofit2/CallAdapter;
// 65: astore 4
// 67: aload 4
// 69: areturn
// 70: astore_3
// 71: aload_0
// 72: aload_3
// 73: ldc 110
// 75: iconst_1
// 76: anewarray 5 java/lang/Object
// 79: dup
// 80: iconst_0
// 81: aload_1
// 82: aastore
// 83: invokespecial 113 retrofit2/ServiceMethod$Builder:methodError (Ljava/lang/Throwable;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/RuntimeException;
// 86: athrow
//
// Exception table:
// from to target type
// 56 67 70 java/lang/RuntimeException
}
private Converter<ResponseBody, T> createResponseConverter()
{
Annotation[] arrayOfAnnotation = this.method.getAnnotations();
Object[] arrayOfObject;
try
{
Converter localConverter = this.retrofit.responseBodyConverter(this.responseType, arrayOfAnnotation);
return localConverter;
}
catch (RuntimeException localRuntimeException)
{
arrayOfObject = new Object[1];
arrayOfObject[0] = this.responseType;
}
throw methodError(localRuntimeException, "Unable to create converter for %s", arrayOfObject);
}
private RuntimeException methodError(String paramString, Object[] paramArrayOfObject)
{
return methodError(null, paramString, paramArrayOfObject);
}
private RuntimeException methodError(Throwable paramThrowable, String paramString, Object[] paramArrayOfObject)
{
String str = String.format(paramString, paramArrayOfObject);
return new IllegalArgumentException(str + "\n for method " + this.method.getDeclaringClass().getSimpleName() + "." + this.method.getName(), paramThrowable);
}
private RuntimeException parameterError(int paramInt, String paramString, Object[] paramArrayOfObject)
{
return methodError(paramString + " (parameter #" + (paramInt + 1) + ")", paramArrayOfObject);
}
private RuntimeException parameterError(Throwable paramThrowable, int paramInt, String paramString, Object[] paramArrayOfObject)
{
return methodError(paramThrowable, paramString + " (parameter #" + (paramInt + 1) + ")", paramArrayOfObject);
}
private okhttp3.Headers parseHeaders(String[] paramArrayOfString)
{
Headers.Builder localBuilder = new Headers.Builder();
int i = paramArrayOfString.length;
int j = 0;
if (j < i)
{
String str1 = paramArrayOfString[j];
int k = str1.indexOf(':');
if ((k == -1) || (k == 0) || (k == -1 + str1.length()))
throw methodError("@Headers value must be in the form \"Name: Value\". Found: \"%s\"", new Object[] { str1 });
String str2 = str1.substring(0, k);
String str3 = str1.substring(k + 1).trim();
if ("Content-Type".equalsIgnoreCase(str2))
{
MediaType localMediaType = MediaType.parse(str3);
if (localMediaType == null)
throw methodError("Malformed content type: %s", new Object[] { str3 });
this.contentType = localMediaType;
}
while (true)
{
j++;
break;
localBuilder.add(str2, str3);
}
}
return localBuilder.build();
}
private void parseHttpMethodAndPath(String paramString1, String paramString2, boolean paramBoolean)
{
if (this.httpMethod != null)
{
Object[] arrayOfObject = new Object[2];
arrayOfObject[0] = this.httpMethod;
arrayOfObject[1] = paramString1;
throw methodError("Only one HTTP method is allowed. Found: %s and %s.", arrayOfObject);
}
this.httpMethod = paramString1;
this.hasBody = paramBoolean;
if (paramString2.isEmpty())
return;
int i = paramString2.indexOf('?');
if ((i != -1) && (i < -1 + paramString2.length()))
{
String str = paramString2.substring(i + 1);
if (ServiceMethod.PARAM_URL_REGEX.matcher(str).find())
throw methodError("URL query string \"%s\" must not have replace block. For dynamic query parameters use @Query.", new Object[] { str });
}
this.relativeUrl = paramString2;
this.relativeUrlParamNames = ServiceMethod.parsePathParameters(paramString2);
}
private void parseMethodAnnotation(Annotation paramAnnotation)
{
if ((paramAnnotation instanceof DELETE))
parseHttpMethodAndPath("DELETE", ((DELETE)paramAnnotation).value(), false);
do
{
while (true)
{
return;
if ((paramAnnotation instanceof GET))
{
parseHttpMethodAndPath("GET", ((GET)paramAnnotation).value(), false);
return;
}
if (!(paramAnnotation instanceof HEAD))
break;
parseHttpMethodAndPath("HEAD", ((HEAD)paramAnnotation).value(), false);
if (Void.class.equals(this.responseType))
continue;
throw methodError("HEAD method must use Void as response type.", new Object[0]);
}
if ((paramAnnotation instanceof PATCH))
{
parseHttpMethodAndPath("PATCH", ((PATCH)paramAnnotation).value(), true);
return;
}
if ((paramAnnotation instanceof POST))
{
parseHttpMethodAndPath("POST", ((POST)paramAnnotation).value(), true);
return;
}
if ((paramAnnotation instanceof PUT))
{
parseHttpMethodAndPath("PUT", ((PUT)paramAnnotation).value(), true);
return;
}
if ((paramAnnotation instanceof OPTIONS))
{
parseHttpMethodAndPath("OPTIONS", ((OPTIONS)paramAnnotation).value(), false);
return;
}
if ((paramAnnotation instanceof HTTP))
{
HTTP localHTTP = (HTTP)paramAnnotation;
parseHttpMethodAndPath(localHTTP.method(), localHTTP.path(), localHTTP.hasBody());
return;
}
if ((paramAnnotation instanceof retrofit2.http.Headers))
{
String[] arrayOfString = ((retrofit2.http.Headers)paramAnnotation).value();
if (arrayOfString.length == 0)
throw methodError("@Headers annotation is empty.", new Object[0]);
this.headers = parseHeaders(arrayOfString);
return;
}
if (!(paramAnnotation instanceof Multipart))
continue;
if (this.isFormEncoded)
throw methodError("Only one encoding annotation is allowed.", new Object[0]);
this.isMultipart = true;
return;
}
while (!(paramAnnotation instanceof FormUrlEncoded));
if (this.isMultipart)
throw methodError("Only one encoding annotation is allowed.", new Object[0]);
this.isFormEncoded = true;
}
private ParameterHandler<?> parseParameter(int paramInt, Type paramType, Annotation[] paramArrayOfAnnotation)
{
Object localObject = null;
int i = paramArrayOfAnnotation.length;
int j = 0;
if (j < i)
{
ParameterHandler localParameterHandler = parseParameterAnnotation(paramInt, paramType, paramArrayOfAnnotation, paramArrayOfAnnotation[j]);
if (localParameterHandler == null);
while (true)
{
j++;
break;
if (localObject != null)
throw parameterError(paramInt, "Multiple Retrofit annotations found, only one allowed.", new Object[0]);
localObject = localParameterHandler;
}
}
if (localObject == null)
throw parameterError(paramInt, "No Retrofit annotation found.", new Object[0]);
return localObject;
}
private ParameterHandler<?> parseParameterAnnotation(int paramInt, Type paramType, Annotation[] paramArrayOfAnnotation, Annotation paramAnnotation)
{
if ((paramAnnotation instanceof Url))
{
if (this.gotUrl)
throw parameterError(paramInt, "Multiple @Url method annotations found.", new Object[0]);
if (this.gotPath)
throw parameterError(paramInt, "@Path parameters may not be used with @Url.", new Object[0]);
if (this.gotQuery)
throw parameterError(paramInt, "A @Url parameter must not come after a @Query", new Object[0]);
if (this.relativeUrl != null)
{
Object[] arrayOfObject2 = new Object[1];
arrayOfObject2[0] = this.httpMethod;
throw parameterError(paramInt, "@Url cannot be used with @%s URL", arrayOfObject2);
}
this.gotUrl = true;
if ((paramType == HttpUrl.class) || (paramType == String.class) || (paramType == URI.class) || (((paramType instanceof Class)) && ("android.net.Uri".equals(((Class)paramType).getName()))))
return new ParameterHandler.RelativeUrl();
throw parameterError(paramInt, "@Url must be okhttp3.HttpUrl, String, java.net.URI, or android.net.Uri type.", new Object[0]);
}
if ((paramAnnotation instanceof Path))
{
if (this.gotQuery)
throw parameterError(paramInt, "A @Path parameter must not come after a @Query.", new Object[0]);
if (this.gotUrl)
throw parameterError(paramInt, "@Path parameters may not be used with @Url.", new Object[0]);
if (this.relativeUrl == null)
{
Object[] arrayOfObject1 = new Object[1];
arrayOfObject1[0] = this.httpMethod;
throw parameterError(paramInt, "@Path can only be used with relative url on @%s", arrayOfObject1);
}
this.gotPath = true;
Path localPath = (Path)paramAnnotation;
String str5 = localPath.value();
validatePathName(paramInt, str5);
Converter localConverter21 = this.retrofit.stringConverter(paramType, paramArrayOfAnnotation);
ParameterHandler.Path localPath1 = new ParameterHandler.Path(str5, localConverter21, localPath.encoded());
return localPath1;
}
if ((paramAnnotation instanceof Query))
{
Query localQuery = (Query)paramAnnotation;
String str4 = localQuery.value();
boolean bool3 = localQuery.encoded();
Class localClass13 = Utils.getRawType(paramType);
this.gotQuery = true;
if (Iterable.class.isAssignableFrom(localClass13))
{
if (!(paramType instanceof ParameterizedType))
throw parameterError(paramInt, localClass13.getSimpleName() + " must include generic type (e.g., " + localClass13.getSimpleName() + "<String>)", new Object[0]);
Type localType17 = Utils.getParameterUpperBound(0, (ParameterizedType)paramType);
Converter localConverter20 = this.retrofit.stringConverter(localType17, paramArrayOfAnnotation);
ParameterHandler.Query localQuery3 = new ParameterHandler.Query(str4, localConverter20, bool3);
return localQuery3.iterable();
}
if (localClass13.isArray())
{
Class localClass14 = ServiceMethod.boxIfPrimitive(localClass13.getComponentType());
Converter localConverter19 = this.retrofit.stringConverter(localClass14, paramArrayOfAnnotation);
ParameterHandler.Query localQuery2 = new ParameterHandler.Query(str4, localConverter19, bool3);
return localQuery2.array();
}
Converter localConverter18 = this.retrofit.stringConverter(paramType, paramArrayOfAnnotation);
ParameterHandler.Query localQuery1 = new ParameterHandler.Query(str4, localConverter18, bool3);
return localQuery1;
}
if ((paramAnnotation instanceof QueryName))
{
boolean bool2 = ((QueryName)paramAnnotation).encoded();
Class localClass11 = Utils.getRawType(paramType);
this.gotQuery = true;
if (Iterable.class.isAssignableFrom(localClass11))
{
if (!(paramType instanceof ParameterizedType))
throw parameterError(paramInt, localClass11.getSimpleName() + " must include generic type (e.g., " + localClass11.getSimpleName() + "<String>)", new Object[0]);
Type localType16 = Utils.getParameterUpperBound(0, (ParameterizedType)paramType);
Converter localConverter17 = this.retrofit.stringConverter(localType16, paramArrayOfAnnotation);
ParameterHandler.QueryName localQueryName3 = new ParameterHandler.QueryName(localConverter17, bool2);
return localQueryName3.iterable();
}
if (localClass11.isArray())
{
Class localClass12 = ServiceMethod.boxIfPrimitive(localClass11.getComponentType());
Converter localConverter16 = this.retrofit.stringConverter(localClass12, paramArrayOfAnnotation);
ParameterHandler.QueryName localQueryName2 = new ParameterHandler.QueryName(localConverter16, bool2);
return localQueryName2.array();
}
Converter localConverter15 = this.retrofit.stringConverter(paramType, paramArrayOfAnnotation);
ParameterHandler.QueryName localQueryName1 = new ParameterHandler.QueryName(localConverter15, bool2);
return localQueryName1;
}
if ((paramAnnotation instanceof QueryMap))
{
Class localClass10 = Utils.getRawType(paramType);
if (!Map.class.isAssignableFrom(localClass10))
throw parameterError(paramInt, "@QueryMap parameter type must be Map.", new Object[0]);
Type localType13 = Utils.getSupertype(paramType, localClass10, Map.class);
if (!(localType13 instanceof ParameterizedType))
throw parameterError(paramInt, "Map must include generic types (e.g., Map<String, String>)", new Object[0]);
ParameterizedType localParameterizedType4 = (ParameterizedType)localType13;
Type localType14 = Utils.getParameterUpperBound(0, localParameterizedType4);
if (String.class != localType14)
throw parameterError(paramInt, "@QueryMap keys must be of type String: " + localType14, new Object[0]);
Type localType15 = Utils.getParameterUpperBound(1, localParameterizedType4);
Converter localConverter14 = this.retrofit.stringConverter(localType15, paramArrayOfAnnotation);
ParameterHandler.QueryMap localQueryMap = new ParameterHandler.QueryMap(localConverter14, ((QueryMap)paramAnnotation).encoded());
return localQueryMap;
}
if ((paramAnnotation instanceof Header))
{
String str3 = ((Header)paramAnnotation).value();
Class localClass8 = Utils.getRawType(paramType);
if (Iterable.class.isAssignableFrom(localClass8))
{
if (!(paramType instanceof ParameterizedType))
throw parameterError(paramInt, localClass8.getSimpleName() + " must include generic type (e.g., " + localClass8.getSimpleName() + "<String>)", new Object[0]);
Type localType12 = Utils.getParameterUpperBound(0, (ParameterizedType)paramType);
Converter localConverter13 = this.retrofit.stringConverter(localType12, paramArrayOfAnnotation);
ParameterHandler.Header localHeader3 = new ParameterHandler.Header(str3, localConverter13);
return localHeader3.iterable();
}
if (localClass8.isArray())
{
Class localClass9 = ServiceMethod.boxIfPrimitive(localClass8.getComponentType());
Converter localConverter12 = this.retrofit.stringConverter(localClass9, paramArrayOfAnnotation);
ParameterHandler.Header localHeader2 = new ParameterHandler.Header(str3, localConverter12);
return localHeader2.array();
}
Converter localConverter11 = this.retrofit.stringConverter(paramType, paramArrayOfAnnotation);
ParameterHandler.Header localHeader1 = new ParameterHandler.Header(str3, localConverter11);
return localHeader1;
}
if ((paramAnnotation instanceof HeaderMap))
{
Class localClass7 = Utils.getRawType(paramType);
if (!Map.class.isAssignableFrom(localClass7))
throw parameterError(paramInt, "@HeaderMap parameter type must be Map.", new Object[0]);
Type localType9 = Utils.getSupertype(paramType, localClass7, Map.class);
if (!(localType9 instanceof ParameterizedType))
throw parameterError(paramInt, "Map must include generic types (e.g., Map<String, String>)", new Object[0]);
ParameterizedType localParameterizedType3 = (ParameterizedType)localType9;
Type localType10 = Utils.getParameterUpperBound(0, localParameterizedType3);
if (String.class != localType10)
throw parameterError(paramInt, "@HeaderMap keys must be of type String: " + localType10, new Object[0]);
Type localType11 = Utils.getParameterUpperBound(1, localParameterizedType3);
Converter localConverter10 = this.retrofit.stringConverter(localType11, paramArrayOfAnnotation);
ParameterHandler.HeaderMap localHeaderMap = new ParameterHandler.HeaderMap(localConverter10);
return localHeaderMap;
}
if ((paramAnnotation instanceof Field))
{
if (!this.isFormEncoded)
throw parameterError(paramInt, "@Field parameters can only be used with form encoding.", new Object[0]);
Field localField = (Field)paramAnnotation;
String str2 = localField.value();
boolean bool1 = localField.encoded();
this.gotField = true;
Class localClass5 = Utils.getRawType(paramType);
if (Iterable.class.isAssignableFrom(localClass5))
{
if (!(paramType instanceof ParameterizedType))
throw parameterError(paramInt, localClass5.getSimpleName() + " must include generic type (e.g., " + localClass5.getSimpleName() + "<String>)", new Object[0]);
Type localType8 = Utils.getParameterUpperBound(0, (ParameterizedType)paramType);
Converter localConverter9 = this.retrofit.stringConverter(localType8, paramArrayOfAnnotation);
ParameterHandler.Field localField3 = new ParameterHandler.Field(str2, localConverter9, bool1);
return localField3.iterable();
}
if (localClass5.isArray())
{
Class localClass6 = ServiceMethod.boxIfPrimitive(localClass5.getComponentType());
Converter localConverter8 = this.retrofit.stringConverter(localClass6, paramArrayOfAnnotation);
ParameterHandler.Field localField2 = new ParameterHandler.Field(str2, localConverter8, bool1);
return localField2.array();
}
Converter localConverter7 = this.retrofit.stringConverter(paramType, paramArrayOfAnnotation);
ParameterHandler.Field localField1 = new ParameterHandler.Field(str2, localConverter7, bool1);
return localField1;
}
if ((paramAnnotation instanceof FieldMap))
{
if (!this.isFormEncoded)
throw parameterError(paramInt, "@FieldMap parameters can only be used with form encoding.", new Object[0]);
Class localClass4 = Utils.getRawType(paramType);
if (!Map.class.isAssignableFrom(localClass4))
throw parameterError(paramInt, "@FieldMap parameter type must be Map.", new Object[0]);
Type localType5 = Utils.getSupertype(paramType, localClass4, Map.class);
if (!(localType5 instanceof ParameterizedType))
throw parameterError(paramInt, "Map must include generic types (e.g., Map<String, String>)", new Object[0]);
ParameterizedType localParameterizedType2 = (ParameterizedType)localType5;
Type localType6 = Utils.getParameterUpperBound(0, localParameterizedType2);
if (String.class != localType6)
throw parameterError(paramInt, "@FieldMap keys must be of type String: " + localType6, new Object[0]);
Type localType7 = Utils.getParameterUpperBound(1, localParameterizedType2);
Converter localConverter6 = this.retrofit.stringConverter(localType7, paramArrayOfAnnotation);
this.gotField = true;
ParameterHandler.FieldMap localFieldMap = new ParameterHandler.FieldMap(localConverter6, ((FieldMap)paramAnnotation).encoded());
return localFieldMap;
}
if ((paramAnnotation instanceof Part))
{
if (!this.isMultipart)
throw parameterError(paramInt, "@Part parameters can only be used with multipart encoding.", new Object[0]);
Part localPart = (Part)paramAnnotation;
this.gotPart = true;
String str1 = localPart.value();
Class localClass2 = Utils.getRawType(paramType);
if (str1.isEmpty())
{
if (Iterable.class.isAssignableFrom(localClass2))
{
if (!(paramType instanceof ParameterizedType))
throw parameterError(paramInt, localClass2.getSimpleName() + " must include generic type (e.g., " + localClass2.getSimpleName() + "<String>)", new Object[0]);
if (!MultipartBody.Part.class.isAssignableFrom(Utils.getRawType(Utils.getParameterUpperBound(0, (ParameterizedType)paramType))))
throw parameterError(paramInt, "@Part annotation must supply a name or use MultipartBody.Part parameter type.", new Object[0]);
return ParameterHandler.RawPart.INSTANCE.iterable();
}
if (localClass2.isArray())
{
if (!MultipartBody.Part.class.isAssignableFrom(localClass2.getComponentType()))
throw parameterError(paramInt, "@Part annotation must supply a name or use MultipartBody.Part parameter type.", new Object[0]);
return ParameterHandler.RawPart.INSTANCE.array();
}
if (MultipartBody.Part.class.isAssignableFrom(localClass2))
return ParameterHandler.RawPart.INSTANCE;
throw parameterError(paramInt, "@Part annotation must supply a name or use MultipartBody.Part parameter type.", new Object[0]);
}
String[] arrayOfString = new String[4];
arrayOfString[0] = "Content-Disposition";
arrayOfString[1] = ("form-data; name=\"" + str1 + "\"");
arrayOfString[2] = "Content-Transfer-Encoding";
arrayOfString[3] = localPart.encoding();
okhttp3.Headers localHeaders = okhttp3.Headers.of(arrayOfString);
if (Iterable.class.isAssignableFrom(localClass2))
{
if (!(paramType instanceof ParameterizedType))
throw parameterError(paramInt, localClass2.getSimpleName() + " must include generic type (e.g., " + localClass2.getSimpleName() + "<String>)", new Object[0]);
Type localType4 = Utils.getParameterUpperBound(0, (ParameterizedType)paramType);
if (MultipartBody.Part.class.isAssignableFrom(Utils.getRawType(localType4)))
throw parameterError(paramInt, "@Part parameters using the MultipartBody.Part must not include a part name in the annotation.", new Object[0]);
Converter localConverter5 = this.retrofit.requestBodyConverter(localType4, paramArrayOfAnnotation, this.methodAnnotations);
ParameterHandler.Part localPart3 = new ParameterHandler.Part(localHeaders, localConverter5);
return localPart3.iterable();
}
if (localClass2.isArray())
{
Class localClass3 = ServiceMethod.boxIfPrimitive(localClass2.getComponentType());
if (MultipartBody.Part.class.isAssignableFrom(localClass3))
throw parameterError(paramInt, "@Part parameters using the MultipartBody.Part must not include a part name in the annotation.", new Object[0]);
Converter localConverter4 = this.retrofit.requestBodyConverter(localClass3, paramArrayOfAnnotation, this.methodAnnotations);
ParameterHandler.Part localPart2 = new ParameterHandler.Part(localHeaders, localConverter4);
return localPart2.array();
}
if (MultipartBody.Part.class.isAssignableFrom(localClass2))
throw parameterError(paramInt, "@Part parameters using the MultipartBody.Part must not include a part name in the annotation.", new Object[0]);
Converter localConverter3 = this.retrofit.requestBodyConverter(paramType, paramArrayOfAnnotation, this.methodAnnotations);
ParameterHandler.Part localPart1 = new ParameterHandler.Part(localHeaders, localConverter3);
return localPart1;
}
if ((paramAnnotation instanceof PartMap))
{
if (!this.isMultipart)
throw parameterError(paramInt, "@PartMap parameters can only be used with multipart encoding.", new Object[0]);
this.gotPart = true;
Class localClass1 = Utils.getRawType(paramType);
if (!Map.class.isAssignableFrom(localClass1))
throw parameterError(paramInt, "@PartMap parameter type must be Map.", new Object[0]);
Type localType1 = Utils.getSupertype(paramType, localClass1, Map.class);
if (!(localType1 instanceof ParameterizedType))
throw parameterError(paramInt, "Map must include generic types (e.g., Map<String, String>)", new Object[0]);
ParameterizedType localParameterizedType1 = (ParameterizedType)localType1;
Type localType2 = Utils.getParameterUpperBound(0, localParameterizedType1);
if (String.class != localType2)
throw parameterError(paramInt, "@PartMap keys must be of type String: " + localType2, new Object[0]);
Type localType3 = Utils.getParameterUpperBound(1, localParameterizedType1);
if (MultipartBody.Part.class.isAssignableFrom(Utils.getRawType(localType3)))
throw parameterError(paramInt, "@PartMap values cannot be MultipartBody.Part. Use @Part List<Part> or a different value type instead.", new Object[0]);
Converter localConverter2 = this.retrofit.requestBodyConverter(localType3, paramArrayOfAnnotation, this.methodAnnotations);
PartMap localPartMap = (PartMap)paramAnnotation;
ParameterHandler.PartMap localPartMap1 = new ParameterHandler.PartMap(localConverter2, localPartMap.encoding());
return localPartMap1;
}
if ((paramAnnotation instanceof Body))
{
if ((this.isFormEncoded) || (this.isMultipart))
throw parameterError(paramInt, "@Body parameters cannot be used with form or multi-part encoding.", new Object[0]);
if (this.gotBody)
throw parameterError(paramInt, "Multiple @Body method annotations found.", new Object[0]);
try
{
Converter localConverter1 = this.retrofit.requestBodyConverter(paramType, paramArrayOfAnnotation, this.methodAnnotations);
this.gotBody = true;
ParameterHandler.Body localBody = new ParameterHandler.Body(localConverter1);
return localBody;
}
catch (RuntimeException localRuntimeException)
{
throw parameterError(localRuntimeException, paramInt, "Unable to create @Body converter for %s", new Object[] { paramType });
}
}
return null;
}
private void validatePathName(int paramInt, String paramString)
{
if (!ServiceMethod.PARAM_NAME_REGEX.matcher(paramString).matches())
{
Object[] arrayOfObject2 = new Object[2];
arrayOfObject2[0] = ServiceMethod.PARAM_URL_REGEX.pattern();
arrayOfObject2[1] = paramString;
throw parameterError(paramInt, "@Path parameter name must match %s. Found: %s", arrayOfObject2);
}
if (!this.relativeUrlParamNames.contains(paramString))
{
Object[] arrayOfObject1 = new Object[2];
arrayOfObject1[0] = this.relativeUrl;
arrayOfObject1[1] = paramString;
throw parameterError(paramInt, "URL \"%s\" does not contain \"{%s}\".", arrayOfObject1);
}
}
public ServiceMethod build()
{
this.callAdapter = createCallAdapter();
this.responseType = this.callAdapter.responseType();
if ((this.responseType == Response.class) || (this.responseType == okhttp3.Response.class))
throw methodError("'" + Utils.getRawType(this.responseType).getName() + "' is not a valid response body type. Did you mean ResponseBody?", new Object[0]);
this.responseConverter = createResponseConverter();
Annotation[] arrayOfAnnotation1 = this.methodAnnotations;
int i = arrayOfAnnotation1.length;
for (int j = 0; j < i; j++)
parseMethodAnnotation(arrayOfAnnotation1[j]);
if (this.httpMethod == null)
throw methodError("HTTP method annotation is required (e.g., @GET, @POST, etc.).", new Object[0]);
if (!this.hasBody)
{
if (this.isMultipart)
throw methodError("Multipart can only be specified on HTTP methods with request body (e.g., @POST).", new Object[0]);
if (this.isFormEncoded)
throw methodError("FormUrlEncoded can only be specified on HTTP methods with request body (e.g., @POST).", new Object[0]);
}
int k = this.parameterAnnotationsArray.length;
this.parameterHandlers = new ParameterHandler[k];
for (int m = 0; m < k; m++)
{
Type localType = this.parameterTypes[m];
if (Utils.hasUnresolvableType(localType))
throw parameterError(m, "Parameter type must not include a type variable or wildcard: %s", new Object[] { localType });
Annotation[] arrayOfAnnotation2 = this.parameterAnnotationsArray[m];
if (arrayOfAnnotation2 == null)
throw parameterError(m, "No Retrofit annotation found.", new Object[0]);
this.parameterHandlers[m] = parseParameter(m, localType, arrayOfAnnotation2);
}
if ((this.relativeUrl == null) && (!this.gotUrl))
{
Object[] arrayOfObject = new Object[1];
arrayOfObject[0] = this.httpMethod;
throw methodError("Missing either @%s URL or @Url parameter.", arrayOfObject);
}
if ((!this.isFormEncoded) && (!this.isMultipart) && (!this.hasBody) && (this.gotBody))
throw methodError("Non-body HTTP method cannot contain @Body.", new Object[0]);
if ((this.isFormEncoded) && (!this.gotField))
throw methodError("Form-encoded method must contain at least one @Field.", new Object[0]);
if ((this.isMultipart) && (!this.gotPart))
throw methodError("Multipart method must contain at least one @Part.", new Object[0]);
return new ServiceMethod(this);
}
}
}
/* Location: /home/satyam/AndroidStudioProjects/app/dex2jar-0.0.9.15/classes-dex2jar.jar
* Qualified Name: retrofit2.ServiceMethod
* JD-Core Version: 0.6.0
*/
| 37,637 | 0.67609 | 0.658421 | 786 | 46.885498 | 39.310432 | 196 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.959288 | false | false |
12
|
37607fa49b2422276d9b4a970e53e253454daed5
| 2,138,893,714,430 |
0612a474904ab3ce22f084672d72b5781c754114
|
/west.twouse.language.yuml.resource.yuml/src-gen/west/twouse/language/yuml/resource/yuml/grammar/YumlChoice.java
|
7b7dcf1880fb37d7f9dfa26e890285bf21141efa
|
[] |
no_license
|
harendra-kumar/twouse
|
https://github.com/harendra-kumar/twouse
|
170683464f100e5da3cfa2ba2017014bcef5cadd
|
0505d5dedd8c605f117158a5d8dea19a9ca37d6b
|
refs/heads/master
| 2021-01-10T11:33:21.651000 | 2010-12-10T09:12:13 | 2010-12-10T09:12:13 | 50,262,555 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
* <copyright>
* </copyright>
*
*
*/
package west.twouse.language.yuml.resource.yuml.grammar;
public class YumlChoice extends west.twouse.language.yuml.resource.yuml.grammar.YumlSyntaxElement {
public YumlChoice(west.twouse.language.yuml.resource.yuml.grammar.YumlCardinality cardinality, west.twouse.language.yuml.resource.yuml.grammar.YumlSyntaxElement... choices) {
super(cardinality, choices);
}
public String toString() {
return west.twouse.language.yuml.resource.yuml.util.YumlStringUtil.explode(getChildren(), "|");
}
}
|
UTF-8
|
Java
| 551 |
java
|
YumlChoice.java
|
Java
|
[] | null |
[] |
/**
* <copyright>
* </copyright>
*
*
*/
package west.twouse.language.yuml.resource.yuml.grammar;
public class YumlChoice extends west.twouse.language.yuml.resource.yuml.grammar.YumlSyntaxElement {
public YumlChoice(west.twouse.language.yuml.resource.yuml.grammar.YumlCardinality cardinality, west.twouse.language.yuml.resource.yuml.grammar.YumlSyntaxElement... choices) {
super(cardinality, choices);
}
public String toString() {
return west.twouse.language.yuml.resource.yuml.util.YumlStringUtil.explode(getChildren(), "|");
}
}
| 551 | 0.760436 | 0.760436 | 19 | 28 | 45.979401 | 175 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.947368 | false | false |
12
|
c558f3bae1972e10e3c249e3f471badac403281a
| 21,586,505,685,163 |
c5fea56f5cbc103ba13634ee68880621767a8cfd
|
/src/main/java/com/piwko/booking/api/swagger/LocationApi.java
|
128a588743e06b914f7478cb77c6ac5be13684fb
|
[] |
no_license
|
marcinpiwko/booking
|
https://github.com/marcinpiwko/booking
|
ebdc75e850fbc5ef81dca87e91d2f46fb4d0094c
|
7843fa0d38946e34a627b8fab1378c2af73c661d
|
refs/heads/master
| 2023-02-01T07:44:46.433000 | 2020-12-20T09:25:19 | 2020-12-20T09:25:19 | 284,445,220 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.piwko.booking.api.swagger;
import com.piwko.booking.api.form.common.ErrorResponse;
import com.piwko.booking.api.form.common.IdResponse;
import com.piwko.booking.api.form.get.GetLocationForm;
import com.piwko.booking.api.form.get.GetLocationsForm;
import com.piwko.booking.api.form.patch.PatchLocationForm;
import com.piwko.booking.api.form.post.PostLocationForm;
import com.piwko.booking.util.exception.ResourceNotFoundException;
import com.piwko.booking.util.exception.ResourceNotUniqueException;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.Optional;
@Tag(name = "locations", description = "The location API")
@RequestMapping("/locations")
public interface LocationApi {
@Operation(summary = "Get location for specified id", description = "Get location for specified id", tags = "locations")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Successful", content = @Content(schema = @Schema(implementation = GetLocationForm.class))),
@ApiResponse(responseCode = "404", description = "Not found", content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
})
@GetMapping(value = "/{id}", produces = "application/json")
ResponseEntity<GetLocationForm> getLocation(@PathVariable("id") Long id) throws ResourceNotFoundException;
@Operation(summary = "Get locations", description = "Get locations", tags = "locations")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Successful", content = @Content(schema = @Schema(implementation = GetLocationsForm.class)))
})
@GetMapping(produces = "application/json")
ResponseEntity<GetLocationsForm> getLocations(@RequestParam Optional<Integer> page, @RequestParam Optional<Integer> size, @RequestParam Optional<String> sortBy, @RequestParam Optional<String> companyCode);
@Operation(summary = "Create new location", description = "Create new location", tags = "locations", security = @SecurityRequirement(name = "bearerAuth"))
@ApiResponses(value = {
@ApiResponse(responseCode = "201", description = "Created", content = @Content(schema = @Schema(implementation = IdResponse.class))),
@ApiResponse(responseCode = "409", description = "Not unique", content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
})
@PreAuthorize("hasAnyRole('ROLE_COMPANY_USER', 'ROLE_ADMIN')")
@PostMapping(consumes = "application/json", produces = "application/json")
ResponseEntity<IdResponse> createLocation(@Valid @RequestBody PostLocationForm postLocationForm) throws ResourceNotUniqueException, ResourceNotFoundException;
@Operation(summary = "Modify location for specified id", description = "Modify location for specified id", tags = "locations", security = @SecurityRequirement(name = "bearerAuth"))
@ApiResponses(value = {
@ApiResponse(responseCode = "204", description = "No content"),
@ApiResponse(responseCode = "404", description = "Not found", content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(responseCode = "409", description = "Not unique", content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
})
@PreAuthorize("hasAnyRole('ROLE_COMPANY_USER', 'ROLE_ADMIN')")
@PatchMapping(value = "/{id}", consumes = "application/json")
ResponseEntity<Void> modifyLocation(@PathVariable("id") Long id, @Valid @RequestBody PatchLocationForm patchLocationForm) throws ResourceNotFoundException, ResourceNotUniqueException;
@Operation(summary = "Delete location for specified id", description = "Delete location for specified id", tags = "locations", security = @SecurityRequirement(name = "bearerAuth"))
@ApiResponses(value = {
@ApiResponse(responseCode = "204", description = "No content"),
@ApiResponse(responseCode = "404", description = "Not found", content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
})
@PreAuthorize("hasAnyRole('ROLE_COMPANY_USER', 'ROLE_ADMIN')")
@DeleteMapping(value = "/{id}")
ResponseEntity<Void> deleteLocation(@PathVariable("id") Long id) throws ResourceNotFoundException;
@Operation(summary = "Refresh location cache", description = "Refresh location cache", tags = "locations", security = @SecurityRequirement(name = "bearerAuth"))
@ApiResponses(value = { @ApiResponse(responseCode = "204", description = "No content")})
@PreAuthorize("hasRole('ROLE_ADMIN')")
@PostMapping(value = "/refresh")
ResponseEntity<Void> refreshLocations();
}
|
UTF-8
|
Java
| 5,180 |
java
|
LocationApi.java
|
Java
|
[] | null |
[] |
package com.piwko.booking.api.swagger;
import com.piwko.booking.api.form.common.ErrorResponse;
import com.piwko.booking.api.form.common.IdResponse;
import com.piwko.booking.api.form.get.GetLocationForm;
import com.piwko.booking.api.form.get.GetLocationsForm;
import com.piwko.booking.api.form.patch.PatchLocationForm;
import com.piwko.booking.api.form.post.PostLocationForm;
import com.piwko.booking.util.exception.ResourceNotFoundException;
import com.piwko.booking.util.exception.ResourceNotUniqueException;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.media.Content;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import io.swagger.v3.oas.annotations.responses.ApiResponses;
import io.swagger.v3.oas.annotations.security.SecurityRequirement;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.Optional;
@Tag(name = "locations", description = "The location API")
@RequestMapping("/locations")
public interface LocationApi {
@Operation(summary = "Get location for specified id", description = "Get location for specified id", tags = "locations")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Successful", content = @Content(schema = @Schema(implementation = GetLocationForm.class))),
@ApiResponse(responseCode = "404", description = "Not found", content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
})
@GetMapping(value = "/{id}", produces = "application/json")
ResponseEntity<GetLocationForm> getLocation(@PathVariable("id") Long id) throws ResourceNotFoundException;
@Operation(summary = "Get locations", description = "Get locations", tags = "locations")
@ApiResponses(value = {
@ApiResponse(responseCode = "200", description = "Successful", content = @Content(schema = @Schema(implementation = GetLocationsForm.class)))
})
@GetMapping(produces = "application/json")
ResponseEntity<GetLocationsForm> getLocations(@RequestParam Optional<Integer> page, @RequestParam Optional<Integer> size, @RequestParam Optional<String> sortBy, @RequestParam Optional<String> companyCode);
@Operation(summary = "Create new location", description = "Create new location", tags = "locations", security = @SecurityRequirement(name = "bearerAuth"))
@ApiResponses(value = {
@ApiResponse(responseCode = "201", description = "Created", content = @Content(schema = @Schema(implementation = IdResponse.class))),
@ApiResponse(responseCode = "409", description = "Not unique", content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
})
@PreAuthorize("hasAnyRole('ROLE_COMPANY_USER', 'ROLE_ADMIN')")
@PostMapping(consumes = "application/json", produces = "application/json")
ResponseEntity<IdResponse> createLocation(@Valid @RequestBody PostLocationForm postLocationForm) throws ResourceNotUniqueException, ResourceNotFoundException;
@Operation(summary = "Modify location for specified id", description = "Modify location for specified id", tags = "locations", security = @SecurityRequirement(name = "bearerAuth"))
@ApiResponses(value = {
@ApiResponse(responseCode = "204", description = "No content"),
@ApiResponse(responseCode = "404", description = "Not found", content = @Content(schema = @Schema(implementation = ErrorResponse.class))),
@ApiResponse(responseCode = "409", description = "Not unique", content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
})
@PreAuthorize("hasAnyRole('ROLE_COMPANY_USER', 'ROLE_ADMIN')")
@PatchMapping(value = "/{id}", consumes = "application/json")
ResponseEntity<Void> modifyLocation(@PathVariable("id") Long id, @Valid @RequestBody PatchLocationForm patchLocationForm) throws ResourceNotFoundException, ResourceNotUniqueException;
@Operation(summary = "Delete location for specified id", description = "Delete location for specified id", tags = "locations", security = @SecurityRequirement(name = "bearerAuth"))
@ApiResponses(value = {
@ApiResponse(responseCode = "204", description = "No content"),
@ApiResponse(responseCode = "404", description = "Not found", content = @Content(schema = @Schema(implementation = ErrorResponse.class)))
})
@PreAuthorize("hasAnyRole('ROLE_COMPANY_USER', 'ROLE_ADMIN')")
@DeleteMapping(value = "/{id}")
ResponseEntity<Void> deleteLocation(@PathVariable("id") Long id) throws ResourceNotFoundException;
@Operation(summary = "Refresh location cache", description = "Refresh location cache", tags = "locations", security = @SecurityRequirement(name = "bearerAuth"))
@ApiResponses(value = { @ApiResponse(responseCode = "204", description = "No content")})
@PreAuthorize("hasRole('ROLE_ADMIN')")
@PostMapping(value = "/refresh")
ResponseEntity<Void> refreshLocations();
}
| 5,180 | 0.740154 | 0.732432 | 77 | 66.272728 | 55.396713 | 209 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.038961 | false | false |
12
|
73138ce6265fe19edf1473fe9b3c1dfd8c4e5245
| 7,017,976,561,831 |
30bd785324ad489cb56aceff9ece670d555f60f1
|
/MyFirstApp/app/src/main/java/com/example/andressaribeiro/myfirstapp/app/ListaRendimentoActivity.java
|
ff8c2459d7a9f4a8e8db2d131f06195781a3616f
|
[] |
no_license
|
andressamesquita/Praticando-Android
|
https://github.com/andressamesquita/Praticando-Android
|
823c1f602f34a10e1e433381e9076ff1477f6a48
|
e96a56b1f1d9552c088fa5c6447446b70158b14a
|
refs/heads/master
| 2021-04-03T06:53:20.300000 | 2018-03-08T13:30:12 | 2018-03-08T13:30:12 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.andressaribeiro.myfirstapp.app;
import android.content.Intent;
import android.content.SharedPreferences;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.widget.Toast;
import com.example.andressaribeiro.myfirstapp.App;
import com.example.andressaribeiro.myfirstapp.R;
import com.example.andressaribeiro.myfirstapp.adapters.ListaDisciplinasRVAdapter;
import com.example.andressaribeiro.myfirstapp.adapters.ListaRendimentoRVAdapter;
import com.example.andressaribeiro.myfirstapp.model.Aluno;
import com.example.andressaribeiro.myfirstapp.model.BoletimBimestral;
import com.example.andressaribeiro.myfirstapp.model.Disciplina;
import com.example.andressaribeiro.myfirstapp.model.Disciplina_;
import java.util.List;
import io.objectbox.Box;
import io.objectbox.query.QueryBuilder;
public class ListaRendimentoActivity extends AppCompatActivity {
Box<Disciplina> disciplinaBox;
Box<BoletimBimestral>boletimBimestralBox;
RecyclerView rvRendimento;
private Aluno alunoLogado;
private Box<Aluno> alunoBox;
private long idBoletimBimestral;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_lista_rendimento);
alunoBox = ((App)getApplication()).getBoxStore().boxFor(Aluno.class);
disciplinaBox = ((App) getApplication()).getBoxStore().boxFor(Disciplina.class);
rvRendimento = findViewById(R.id.rv_rendimento);
alunoLogado = obterAlunoLogado();
idBoletimBimestral = pegarIdBoletimBimestral();
}
private long pegarIdBoletimBimestral() {
Intent intent = getIntent();
long idBoletim = intent.getLongExtra("boletimBimestralId",-1);
return idBoletim;
}
@Override
protected void onResume() {
super.onResume();
QueryBuilder<Disciplina> builder = disciplinaBox.query();
builder.equal(Disciplina_.alunoToOneId,alunoLogado.getId());
List<Disciplina> disciplinas = builder.build().find();
//Adapter
ListaRendimentoRVAdapter adapter = new ListaRendimentoRVAdapter(this,disciplinas,disciplinaBox,boletimBimestralBox, alunoLogado);
rvRendimento.setAdapter(adapter);
//layoutManager
rvRendimento.setLayoutManager(new LinearLayoutManager(this));
}
private Aluno obterAlunoLogado(){
final SharedPreferences preferences = getSharedPreferences("anotaai.file", MODE_PRIVATE);
long id = preferences.getLong("alunoId", -1);
return alunoBox.get(id);
}
}
|
UTF-8
|
Java
| 2,721 |
java
|
ListaRendimentoActivity.java
|
Java
|
[] | null |
[] |
package com.example.andressaribeiro.myfirstapp.app;
import android.content.Intent;
import android.content.SharedPreferences;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.widget.Toast;
import com.example.andressaribeiro.myfirstapp.App;
import com.example.andressaribeiro.myfirstapp.R;
import com.example.andressaribeiro.myfirstapp.adapters.ListaDisciplinasRVAdapter;
import com.example.andressaribeiro.myfirstapp.adapters.ListaRendimentoRVAdapter;
import com.example.andressaribeiro.myfirstapp.model.Aluno;
import com.example.andressaribeiro.myfirstapp.model.BoletimBimestral;
import com.example.andressaribeiro.myfirstapp.model.Disciplina;
import com.example.andressaribeiro.myfirstapp.model.Disciplina_;
import java.util.List;
import io.objectbox.Box;
import io.objectbox.query.QueryBuilder;
public class ListaRendimentoActivity extends AppCompatActivity {
Box<Disciplina> disciplinaBox;
Box<BoletimBimestral>boletimBimestralBox;
RecyclerView rvRendimento;
private Aluno alunoLogado;
private Box<Aluno> alunoBox;
private long idBoletimBimestral;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_lista_rendimento);
alunoBox = ((App)getApplication()).getBoxStore().boxFor(Aluno.class);
disciplinaBox = ((App) getApplication()).getBoxStore().boxFor(Disciplina.class);
rvRendimento = findViewById(R.id.rv_rendimento);
alunoLogado = obterAlunoLogado();
idBoletimBimestral = pegarIdBoletimBimestral();
}
private long pegarIdBoletimBimestral() {
Intent intent = getIntent();
long idBoletim = intent.getLongExtra("boletimBimestralId",-1);
return idBoletim;
}
@Override
protected void onResume() {
super.onResume();
QueryBuilder<Disciplina> builder = disciplinaBox.query();
builder.equal(Disciplina_.alunoToOneId,alunoLogado.getId());
List<Disciplina> disciplinas = builder.build().find();
//Adapter
ListaRendimentoRVAdapter adapter = new ListaRendimentoRVAdapter(this,disciplinas,disciplinaBox,boletimBimestralBox, alunoLogado);
rvRendimento.setAdapter(adapter);
//layoutManager
rvRendimento.setLayoutManager(new LinearLayoutManager(this));
}
private Aluno obterAlunoLogado(){
final SharedPreferences preferences = getSharedPreferences("anotaai.file", MODE_PRIVATE);
long id = preferences.getLong("alunoId", -1);
return alunoBox.get(id);
}
}
| 2,721 | 0.755237 | 0.753399 | 76 | 34.802631 | 28.972773 | 137 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.697368 | false | false |
12
|
da48f4d01e29f40b4dc998ffa2ca5fe28f78b644
| 11,931,419,218,268 |
808a1062e3c815adbb3d34f0d7049fd188f642ac
|
/src/institucion/Views/Loggin/Access.java
|
91768c95421a42cf2c62b5c8619781082e48f9e7
|
[
"MIT"
] |
permissive
|
DevLatBo/Instituto
|
https://github.com/DevLatBo/Instituto
|
1d5e812593ae0d5134864a8ff68523ee3dcc1d2d
|
37ef0218364cf5c36377d9cbc7e670176698bba5
|
refs/heads/master
| 2022-04-29T11:16:51.219000 | 2019-02-25T05:58:56 | 2019-02-25T05:58:56 | null | 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 institucion.Views.Loggin;
import institucion.Controllers.CtrlLoggin;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JOptionPane;
import javax.swing.Timer;
import javax.swing.border.Border;
import javax.swing.border.LineBorder;
/**
*
* @author Oscar
*/
public class Access extends javax.swing.JFrame implements ActionListener{
/**
* Creates new form Access
*/
private CtrlLoggin ctrlL;
public Access() {
this.setUndecorated(true);
initComponents();
this.setLocationRelativeTo(null);
Timer t = new Timer(10000, this);
t.start();
ctrlL = new CtrlLoggin();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
lblCode = new javax.swing.JLabel();
txtCode = new javax.swing.JTextField();
btnMark = new javax.swing.JButton();
lblTitle = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowOpened(java.awt.event.WindowEvent evt) {
formWindowOpened(evt);
}
});
jPanel1.setBackground(new java.awt.Color(0, 0, 102));
lblCode.setFont(new java.awt.Font("Lao UI", 1, 14)); // NOI18N
lblCode.setForeground(new java.awt.Color(255, 255, 255));
lblCode.setText("Código:");
btnMark.setBackground(new java.awt.Color(0, 0, 51));
btnMark.setFont(new java.awt.Font("Lao UI", 1, 14)); // NOI18N
btnMark.setForeground(new java.awt.Color(255, 255, 255));
btnMark.setText("Marcar");
btnMark.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
btnMark.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
btnMarkMouseClicked(evt);
}
});
lblTitle.setFont(new java.awt.Font("Lao UI", 1, 18)); // NOI18N
lblTitle.setForeground(new java.awt.Color(255, 255, 255));
lblTitle.setText("ASISTENCIA");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap(32, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(lblTitle)
.addGap(141, 141, 141))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(lblCode)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txtCode, javax.swing.GroupLayout.PREFERRED_SIZE, 177, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(12, 12, 12)
.addComponent(btnMark, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(24, 24, 24))))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addGap(15, 15, 15)
.addComponent(lblTitle)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 27, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblCode)
.addComponent(txtCode, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnMark, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(32, 32, 32))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
Border border = new LineBorder(Color.WHITE, 1);
btnMark.setBorder(border);
}//GEN-LAST:event_formWindowOpened
private void btnMarkMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnMarkMouseClicked
String usercode = txtCode.getText();
int validation = ctrlL.validateCode(usercode);
switch(validation){
case 1:
this.dispose();
break;
case 0:
JOptionPane.showMessageDialog(this,
"Código No Valido",
"Error",
JOptionPane.ERROR_MESSAGE);
txtCode.setText("");
break;
}
}//GEN-LAST:event_btnMarkMouseClicked
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Access.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Access.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Access.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Access.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Access().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnMark;
private javax.swing.JPanel jPanel1;
private javax.swing.JLabel lblCode;
private javax.swing.JLabel lblTitle;
private javax.swing.JTextField txtCode;
// End of variables declaration//GEN-END:variables
@Override
public void actionPerformed(ActionEvent e) {
this.dispose();
}
}
|
UTF-8
|
Java
| 8,674 |
java
|
Access.java
|
Java
|
[
{
"context": " javax.swing.border.LineBorder;\n\n/**\n *\n * @author Oscar\n */\npublic class Access extends javax.swing.JFram",
"end": 514,
"score": 0.9986690878868103,
"start": 509,
"tag": "NAME",
"value": "Oscar"
},
{
"context": "t.Color(255, 255, 255));\n btnMark.setText(\"Marcar\");\n btnMark.setCursor(new java.awt.Cursor(",
"end": 2265,
"score": 0.98389732837677,
"start": 2259,
"tag": "NAME",
"value": "Marcar"
}
] | 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 institucion.Views.Loggin;
import institucion.Controllers.CtrlLoggin;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JOptionPane;
import javax.swing.Timer;
import javax.swing.border.Border;
import javax.swing.border.LineBorder;
/**
*
* @author Oscar
*/
public class Access extends javax.swing.JFrame implements ActionListener{
/**
* Creates new form Access
*/
private CtrlLoggin ctrlL;
public Access() {
this.setUndecorated(true);
initComponents();
this.setLocationRelativeTo(null);
Timer t = new Timer(10000, this);
t.start();
ctrlL = new CtrlLoggin();
}
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
lblCode = new javax.swing.JLabel();
txtCode = new javax.swing.JTextField();
btnMark = new javax.swing.JButton();
lblTitle = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowOpened(java.awt.event.WindowEvent evt) {
formWindowOpened(evt);
}
});
jPanel1.setBackground(new java.awt.Color(0, 0, 102));
lblCode.setFont(new java.awt.Font("Lao UI", 1, 14)); // NOI18N
lblCode.setForeground(new java.awt.Color(255, 255, 255));
lblCode.setText("Código:");
btnMark.setBackground(new java.awt.Color(0, 0, 51));
btnMark.setFont(new java.awt.Font("Lao UI", 1, 14)); // NOI18N
btnMark.setForeground(new java.awt.Color(255, 255, 255));
btnMark.setText("Marcar");
btnMark.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
btnMark.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
btnMarkMouseClicked(evt);
}
});
lblTitle.setFont(new java.awt.Font("Lao UI", 1, 18)); // NOI18N
lblTitle.setForeground(new java.awt.Color(255, 255, 255));
lblTitle.setText("ASISTENCIA");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addContainerGap(32, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(lblTitle)
.addGap(141, 141, 141))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(lblCode)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(txtCode, javax.swing.GroupLayout.PREFERRED_SIZE, 177, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(12, 12, 12)
.addComponent(btnMark, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(24, 24, 24))))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addGap(15, 15, 15)
.addComponent(lblTitle)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 27, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(lblCode)
.addComponent(txtCode, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(btnMark, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(32, 32, 32))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
Border border = new LineBorder(Color.WHITE, 1);
btnMark.setBorder(border);
}//GEN-LAST:event_formWindowOpened
private void btnMarkMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_btnMarkMouseClicked
String usercode = txtCode.getText();
int validation = ctrlL.validateCode(usercode);
switch(validation){
case 1:
this.dispose();
break;
case 0:
JOptionPane.showMessageDialog(this,
"Código No Valido",
"Error",
JOptionPane.ERROR_MESSAGE);
txtCode.setText("");
break;
}
}//GEN-LAST:event_btnMarkMouseClicked
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Access.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Access.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Access.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(Access.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Access().setVisible(true);
}
});
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton btnMark;
private javax.swing.JPanel jPanel1;
private javax.swing.JLabel lblCode;
private javax.swing.JLabel lblTitle;
private javax.swing.JTextField txtCode;
// End of variables declaration//GEN-END:variables
@Override
public void actionPerformed(ActionEvent e) {
this.dispose();
}
}
| 8,674 | 0.634571 | 0.620387 | 195 | 43.471794 | 34.897549 | 160 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.697436 | false | false |
12
|
ffec7ae9eabcf4b411cc815c5d679890542978e0
| 5,875,515,321,499 |
d3bb609ee61043202ca5b37112f79a4915c42773
|
/Reinos/src/Elfos/ReyElfo.java
|
b8eb02b1aa9fec3a801bb6e19c705c662b462dbc
|
[] |
no_license
|
GuillermoMorales/parcialpoo
|
https://github.com/GuillermoMorales/parcialpoo
|
235767f6c994ec886494e52a4fc270086dd00f44
|
a1eca99fecff1e8174d861f47a7b058d1e94b787
|
refs/heads/master
| 2020-03-20T02:26:57.394000 | 2018-06-13T20:57:00 | 2018-06-13T20:57:00 | 137,113,068 | 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 Elfos;
/**
*
* @author Guille
*/
public class ReyElfo implements Elfo{
@Override
public void attack() {
System.out.println("El Rey Elfo ataca con una supernova, elimina a la "
+ "mitad de los orcos");
}
@Override
public void defends() {
System.out.println("El Rey Elfo ha utilizado resurreción,revive a todos"
+ "sus elfos muertos por 5 min");
}
}
|
UTF-8
|
Java
| 649 |
java
|
ReyElfo.java
|
Java
|
[
{
"context": "ditor.\r\n */\r\npackage Elfos;\r\n\r\n/**\r\n *\r\n * @author Guille\r\n */\r\npublic class ReyElfo implements Elfo{\r\n\r\n ",
"end": 234,
"score": 0.9606838822364807,
"start": 228,
"tag": "NAME",
"value": "Guille"
}
] | 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 Elfos;
/**
*
* @author Guille
*/
public class ReyElfo implements Elfo{
@Override
public void attack() {
System.out.println("El Rey Elfo ataca con una supernova, elimina a la "
+ "mitad de los orcos");
}
@Override
public void defends() {
System.out.println("El Rey Elfo ha utilizado resurreción,revive a todos"
+ "sus elfos muertos por 5 min");
}
}
| 649 | 0.606481 | 0.604938 | 25 | 23.92 | 26.113476 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.32 | false | false |
12
|
72f3f47e9d7bbc7d86c07e31144e2559e252e5be
| 15,410,342,660,127 |
4e7583151de184b1caa387dc667f31e2062ee4b3
|
/app/src/main/java/net/pingfang/signalr/chat/fragment/PhoneFragment.java
|
d95a533e2043ad20d03b673472e744be4ac5e309
|
[] |
no_license
|
andyshao/signalr-chat
|
https://github.com/andyshao/signalr-chat
|
ea3a5ea1e7dc32ad412216a7df599b99a30d8c76
|
1956b97a7d864ed706bdd64d481cd19b77ff1528
|
refs/heads/master
| 2020-06-18T02:07:57.136000 | 2015-08-21T10:19:03 | 2015-08-21T10:19:03 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package net.pingfang.signalr.chat.fragment;
import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import net.pingfang.signalr.chat.R;
import net.pingfang.signalr.chat.util.CommonTools;
import net.pingfang.signalr.chat.util.OnFragmentInteractionListener;
import net.pingfang.signalr.chat.util.OnRegisterInteractionListener;
/**
* A simple {@link Fragment} subclass.
* Activities that contain this fragment must implement the
* {@link OnRegisterInteractionListener} interface
* to handle interaction events.
* Use the {@link PhoneFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class PhoneFragment extends Fragment implements View.OnClickListener{
EditText et_phone_reg;
Button btn_captcha_req;
EditText et_validate_code;
Button btn_captcha_submit;
private OnRegisterInteractionListener mListener;
public static PhoneFragment newInstance() {
PhoneFragment fragment = new PhoneFragment();
return fragment;
}
public PhoneFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_phone, container, false);
et_phone_reg = (EditText) view.findViewById(R.id.et_phone_reg);
btn_captcha_req = (Button) view.findViewById(R.id.btn_captcha_req);
btn_captcha_req.setOnClickListener(this);
et_validate_code = (EditText) view.findViewById(R.id.et_validate_code);
btn_captcha_submit = (Button) view.findViewById(R.id.btn_captcha_submit);
btn_captcha_submit.setOnClickListener(this);
return view;
}
@Override
public void onClick(View view) {
int viewId = view.getId();
String phoneNo = et_phone_reg.getText().toString().trim();
switch(viewId) {
case R.id.btn_captcha_req:
if(CommonTools.isPhoneNumber(phoneNo)) {
mListener.loadVC(phoneNo);
}
break;
case R.id.btn_captcha_submit:
String vc = et_validate_code.getText().toString().trim();
if(CommonTools.isPhoneNumber(phoneNo) && CommonTools.isAvailableVc(vc)) {
mListener.submitC(phoneNo,vc);
}
break;
}
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
try {
mListener = (OnRegisterInteractionListener) activity;
} catch (ClassCastException e) {
throw new ClassCastException(activity.toString()
+ " must implement OnFragmentInteractionListener");
}
}
@Override
public void onDetach() {
super.onDetach();
mListener = null;
}
}
|
UTF-8
|
Java
| 3,152 |
java
|
PhoneFragment.java
|
Java
|
[] | null |
[] |
package net.pingfang.signalr.chat.fragment;
import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import net.pingfang.signalr.chat.R;
import net.pingfang.signalr.chat.util.CommonTools;
import net.pingfang.signalr.chat.util.OnFragmentInteractionListener;
import net.pingfang.signalr.chat.util.OnRegisterInteractionListener;
/**
* A simple {@link Fragment} subclass.
* Activities that contain this fragment must implement the
* {@link OnRegisterInteractionListener} interface
* to handle interaction events.
* Use the {@link PhoneFragment#newInstance} factory method to
* create an instance of this fragment.
*/
public class PhoneFragment extends Fragment implements View.OnClickListener{
EditText et_phone_reg;
Button btn_captcha_req;
EditText et_validate_code;
Button btn_captcha_submit;
private OnRegisterInteractionListener mListener;
public static PhoneFragment newInstance() {
PhoneFragment fragment = new PhoneFragment();
return fragment;
}
public PhoneFragment() {
// Required empty public constructor
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_phone, container, false);
et_phone_reg = (EditText) view.findViewById(R.id.et_phone_reg);
btn_captcha_req = (Button) view.findViewById(R.id.btn_captcha_req);
btn_captcha_req.setOnClickListener(this);
et_validate_code = (EditText) view.findViewById(R.id.et_validate_code);
btn_captcha_submit = (Button) view.findViewById(R.id.btn_captcha_submit);
btn_captcha_submit.setOnClickListener(this);
return view;
}
@Override
public void onClick(View view) {
int viewId = view.getId();
String phoneNo = et_phone_reg.getText().toString().trim();
switch(viewId) {
case R.id.btn_captcha_req:
if(CommonTools.isPhoneNumber(phoneNo)) {
mListener.loadVC(phoneNo);
}
break;
case R.id.btn_captcha_submit:
String vc = et_validate_code.getText().toString().trim();
if(CommonTools.isPhoneNumber(phoneNo) && CommonTools.isAvailableVc(vc)) {
mListener.submitC(phoneNo,vc);
}
break;
}
}
@Override
public void onAttach(Activity activity) {
super.onAttach(activity);
try {
mListener = (OnRegisterInteractionListener) activity;
} catch (ClassCastException e) {
throw new ClassCastException(activity.toString()
+ " must implement OnFragmentInteractionListener");
}
}
@Override
public void onDetach() {
super.onDetach();
mListener = null;
}
}
| 3,152 | 0.663071 | 0.662754 | 95 | 32.178947 | 24.520658 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.494737 | false | false |
12
|
ed1e9a8177a0214bd6ae91c5d1f77f36f3a0f0df
| 7,705,171,344,668 |
98724df7ab2ac72ab95a6679fc63a970f7017b8d
|
/RestClient/src/org/rest/client/deprecated/ImportListingDialog.java
|
9475ec0d03dc1f3c35273c14e3b9d438e7decdd9
|
[
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] |
permissive
|
zkewal/chrome-rest-client
|
https://github.com/zkewal/chrome-rest-client
|
028124ad9890f77052ae05fad301d43b25974421
|
38c88784db417f3bfc1de621090276f397b6bd08
|
refs/heads/master
| 2021-01-01T04:04:53.385000 | 2014-11-21T20:39:55 | 2014-11-21T20:39:55 | 58,084,949 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.rest.client.deprecated;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import org.rest.client.ui.ImportExportView.Presenter;
import org.rest.client.ui.desktop.StatusNotification;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.cell.client.Cell.Context;
import com.google.gwt.cell.client.CheckboxCell;
import com.google.gwt.cell.client.DateCell;
import com.google.gwt.cell.client.TextCell;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.NativeEvent;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.cellview.client.CellTable;
import com.google.gwt.user.cellview.client.Column;
import com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler;
import com.google.gwt.user.cellview.client.Header;
import com.google.gwt.user.cellview.client.SimplePager;
import com.google.gwt.user.cellview.client.SimplePager.TextLocation;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.view.client.DefaultSelectionEventManager;
import com.google.gwt.view.client.ListDataProvider;
import com.google.gwt.view.client.MultiSelectionModel;
import com.google.gwt.view.client.ProvidesKey;
import com.google.gwt.view.client.SelectionModel;
/**
*
* @author Paweł Psztyć
*
*/
public class ImportListingDialog {
interface Binder extends UiBinder<DialogBox, ImportListingDialog> {
Binder BINDER = GWT.create(Binder.class);
}
@UiField(provided = true)
CellTable<SuggestionImportItem> cellTable;
/**
* The pager used to change the range of data.
*/
@UiField(provided = true) SimplePager pager;
@UiField DialogBox dialog;
@UiField Button save;
private final List<SuggestionImportItem> resultList = new ArrayList<SuggestionImportItem>();
/**
* The key provider that provides the unique ID of a contact.
*/
public static final ProvidesKey<SuggestionImportItem> KEY_PROVIDER = new ProvidesKey<SuggestionImportItem>() {
public Object getKey(SuggestionImportItem item) {
return item == null ? null : item.getKey();
}
};
/**
* The provider that holds the list of contacts in the database.
*/
private ListDataProvider<SuggestionImportItem> dataProvider = new ListDataProvider<SuggestionImportItem>();
private Presenter listener;
public ImportListingDialog(Presenter listener) {
this.listener = listener;
// Set a key provider that provides a unique key for each item.
cellTable = new CellTable<SuggestionImportItem>(KEY_PROVIDER);
cellTable.setWidth("100%", true);
// Attach a column sort handler to the ListDataProvider to sort the
// list.
ListHandler<SuggestionImportItem> sortHandler = new ListHandler<SuggestionImportItem>(
dataProvider.getList());
cellTable.addColumnSortHandler(sortHandler);
// Create a Pager to control the table.
SimplePager.Resources pagerResources = GWT
.create(SimplePager.Resources.class);
pager = new SimplePager(TextLocation.CENTER, pagerResources, false, 0,
true);
pager.setDisplay(cellTable);
// Add a selection model so we can select cells.
final SelectionModel<SuggestionImportItem> selectionModel = new MultiSelectionModel<SuggestionImportItem>(
KEY_PROVIDER);
cellTable.setSelectionModel(selectionModel,
DefaultSelectionEventManager
.<SuggestionImportItem> createCheckboxManager());
// Initialize the columns.
initTableColumns(selectionModel, sortHandler);
// Add the CellList to the adapter in the database.
dataProvider.addDataDisplay(cellTable);
Binder.BINDER.createAndBindUi(this);
//dialog.setPreviewingAllNativeEvents(true);
//dialog.setSize("720px", "440px");
}
public static class ToggleSelectionCheckboxHeader extends Header<Boolean> {
private boolean value;
private TableToggleSelectionValueChange changeValue;
public ToggleSelectionCheckboxHeader(CheckboxCell cell, TableToggleSelectionValueChange changeValue) {
super(cell);
this.changeValue = changeValue;
}
@Override
public Boolean getValue() {
return value;
}
@Override
public void onBrowserEvent(Context context, Element elem,
NativeEvent event) {
Event evt = Event.as(event);
int eventType = evt.getTypeInt();
switch (eventType) {
case Event.ONCHANGE:
value = !value;
if (changeValue != null)
changeValue.changedValue(context.getColumn(), value);
break;
}
super.onBrowserEvent(context, elem, event);
}
@Override
public void render(Context context, SafeHtmlBuilder sb) {
super.render(context, sb.appendEscaped(""));
}
}
public interface TableToggleSelectionValueChange {
void changedValue(int columnIndex, Boolean value);
}
private void initTableColumns(
final SelectionModel<SuggestionImportItem> selectionModel,
ListHandler<SuggestionImportItem> sortHandler) {
// Checkbox column. This table will uses a checkbox column for
// selection.
// Alternatively, you can call cellTable.setSelectionEnabled(true) to
// enable
// mouse selection.
CheckboxCell cell = new CheckboxCell();
ToggleSelectionCheckboxHeader checkboxHeader = new ToggleSelectionCheckboxHeader(cell,
new TableToggleSelectionValueChange() {
@Override
public void changedValue(int columnIndex, Boolean value) {
Log.debug("changedValue");
List<SuggestionImportItem> list = dataProvider.getList();
SelectionModel<? super SuggestionImportItem> _selectionModel = cellTable.getSelectionModel();
for(SuggestionImportItem _item : list){
_selectionModel.setSelected(_item, value);
}
if(value){
resultList.addAll(list);
} else {
resultList.clear();
}
}
});
Column<SuggestionImportItem, Boolean> checkColumn = new Column<SuggestionImportItem, Boolean>(
new CheckboxCell(true, false)) {
@Override
public Boolean getValue(SuggestionImportItem object) {
// Get the value from the selection model.
boolean isSelected = selectionModel.isSelected(object);
if(isSelected){
if(!resultList.contains(object)){
resultList.add(object);
}
} else {
if(resultList.contains(object)){
resultList.remove(object);
}
}
return isSelected;
}
};
cellTable.addColumn(checkColumn,checkboxHeader);
cellTable.setColumnWidth(checkColumn, 40, Unit.PX);
// name.
Column<SuggestionImportItem, String> nameColumn = new Column<SuggestionImportItem, String>(
new TextCell()) {
@Override
public String getValue(SuggestionImportItem object) {
return object.getName();
}
};
nameColumn.setSortable(true);
sortHandler.setComparator(nameColumn, new Comparator<SuggestionImportItem>() {
public int compare(SuggestionImportItem o1, SuggestionImportItem o2) {
return o1.getName().compareTo(o2.getName());
}
});
cellTable.addColumn(nameColumn, "Name");
// cellTable.setColumnWidth(nameColumn, 200, Unit.PX);
// URL column
Column<SuggestionImportItem, String> urlColumn = new Column<SuggestionImportItem, String>(
new TextCell()) {
@Override
public String getValue(SuggestionImportItem object) {
return object.getUrl();
}
};
urlColumn.setSortable(true);
sortHandler.setComparator(urlColumn, new Comparator<SuggestionImportItem>() {
public int compare(SuggestionImportItem o1, SuggestionImportItem o2) {
return o1.getUrl().compareTo(o2.getUrl());
}
});
cellTable.addColumn(urlColumn, "URL");
// cellTable.setColumnWidth(urlColumn, 100, Unit.PX);
// Date column
Column<SuggestionImportItem, Date> dateColumn = new Column<SuggestionImportItem, Date>(
new DateCell(
DateTimeFormat
.getFormat(PredefinedFormat.DATE_TIME_MEDIUM))) {
@Override
public Date getValue(SuggestionImportItem object) {
return object.getCreated();
}
};
dateColumn.setSortable(true);
sortHandler.setComparator(dateColumn, new Comparator<SuggestionImportItem>() {
public int compare(SuggestionImportItem o1, SuggestionImportItem o2) {
return o1.getCreated().compareTo(o2.getCreated());
}
});
cellTable.addColumn(dateColumn, "Created");
cellTable.setColumnWidth(dateColumn, 160, Unit.PX);
}
public void append(List<SuggestionImportItem> result) {
dataProvider.getList().addAll(result);
}
public void show() {
dialog.show();
dialog.center();
}
@UiHandler("cancel")
void onDismiss(ClickEvent event) {
dialog.hide();
}
@UiHandler("save")
void onSave(ClickEvent event) {
if(resultList.size() == 0){
StatusNotification.notify("Select at least one element from list.", StatusNotification.TYPE_NORMAL, StatusNotification.TIME_SHORT);
return;
}
int size = resultList.size();
if(size > 30){
//
// App Engine supports query with 30 subqueries. In one time can import 30 elements.
//
StatusNotification.notify("You can select max 30 items to import", StatusNotification.TYPE_ERROR, StatusNotification.TIME_SHORT);
return;
}
String[] keys = new String[size];
for(int i=0; i<size; i++){
SuggestionImportItem item = resultList.get(i);
keys[i] = item.getKey();
}
dialog.hide();
listener.doServerImport(keys);
}
}
|
UTF-8
|
Java
| 9,889 |
java
|
ImportListingDialog.java
|
Java
|
[
{
"context": "ui.desktop.StatusNotification;\r\n\r\nimport com.allen_sauer.gwt.log.client.Log;\r\nimport com.google.gwt.c",
"end": 276,
"score": 0.6069263219833374,
"start": 276,
"tag": "USERNAME",
"value": ""
},
{
"context": ".view.client.SelectionModel;\r\n/**\r\n * \r\n * @author Paweł Psztyć\r\n *\r\n */\r\npublic class ImportListingDialog {\r\n\r\n\t",
"end": 1844,
"score": 0.9997727870941162,
"start": 1832,
"tag": "NAME",
"value": "Paweł Psztyć"
}
] | null |
[] |
package org.rest.client.deprecated;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
import org.rest.client.ui.ImportExportView.Presenter;
import org.rest.client.ui.desktop.StatusNotification;
import com.allen_sauer.gwt.log.client.Log;
import com.google.gwt.cell.client.Cell.Context;
import com.google.gwt.cell.client.CheckboxCell;
import com.google.gwt.cell.client.DateCell;
import com.google.gwt.cell.client.TextCell;
import com.google.gwt.core.client.GWT;
import com.google.gwt.dom.client.Element;
import com.google.gwt.dom.client.NativeEvent;
import com.google.gwt.dom.client.Style.Unit;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.i18n.client.DateTimeFormat;
import com.google.gwt.i18n.client.DateTimeFormat.PredefinedFormat;
import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.uibinder.client.UiHandler;
import com.google.gwt.user.cellview.client.CellTable;
import com.google.gwt.user.cellview.client.Column;
import com.google.gwt.user.cellview.client.ColumnSortEvent.ListHandler;
import com.google.gwt.user.cellview.client.Header;
import com.google.gwt.user.cellview.client.SimplePager;
import com.google.gwt.user.cellview.client.SimplePager.TextLocation;
import com.google.gwt.user.client.Event;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.DialogBox;
import com.google.gwt.view.client.DefaultSelectionEventManager;
import com.google.gwt.view.client.ListDataProvider;
import com.google.gwt.view.client.MultiSelectionModel;
import com.google.gwt.view.client.ProvidesKey;
import com.google.gwt.view.client.SelectionModel;
/**
*
* @author <NAME>
*
*/
public class ImportListingDialog {
interface Binder extends UiBinder<DialogBox, ImportListingDialog> {
Binder BINDER = GWT.create(Binder.class);
}
@UiField(provided = true)
CellTable<SuggestionImportItem> cellTable;
/**
* The pager used to change the range of data.
*/
@UiField(provided = true) SimplePager pager;
@UiField DialogBox dialog;
@UiField Button save;
private final List<SuggestionImportItem> resultList = new ArrayList<SuggestionImportItem>();
/**
* The key provider that provides the unique ID of a contact.
*/
public static final ProvidesKey<SuggestionImportItem> KEY_PROVIDER = new ProvidesKey<SuggestionImportItem>() {
public Object getKey(SuggestionImportItem item) {
return item == null ? null : item.getKey();
}
};
/**
* The provider that holds the list of contacts in the database.
*/
private ListDataProvider<SuggestionImportItem> dataProvider = new ListDataProvider<SuggestionImportItem>();
private Presenter listener;
public ImportListingDialog(Presenter listener) {
this.listener = listener;
// Set a key provider that provides a unique key for each item.
cellTable = new CellTable<SuggestionImportItem>(KEY_PROVIDER);
cellTable.setWidth("100%", true);
// Attach a column sort handler to the ListDataProvider to sort the
// list.
ListHandler<SuggestionImportItem> sortHandler = new ListHandler<SuggestionImportItem>(
dataProvider.getList());
cellTable.addColumnSortHandler(sortHandler);
// Create a Pager to control the table.
SimplePager.Resources pagerResources = GWT
.create(SimplePager.Resources.class);
pager = new SimplePager(TextLocation.CENTER, pagerResources, false, 0,
true);
pager.setDisplay(cellTable);
// Add a selection model so we can select cells.
final SelectionModel<SuggestionImportItem> selectionModel = new MultiSelectionModel<SuggestionImportItem>(
KEY_PROVIDER);
cellTable.setSelectionModel(selectionModel,
DefaultSelectionEventManager
.<SuggestionImportItem> createCheckboxManager());
// Initialize the columns.
initTableColumns(selectionModel, sortHandler);
// Add the CellList to the adapter in the database.
dataProvider.addDataDisplay(cellTable);
Binder.BINDER.createAndBindUi(this);
//dialog.setPreviewingAllNativeEvents(true);
//dialog.setSize("720px", "440px");
}
public static class ToggleSelectionCheckboxHeader extends Header<Boolean> {
private boolean value;
private TableToggleSelectionValueChange changeValue;
public ToggleSelectionCheckboxHeader(CheckboxCell cell, TableToggleSelectionValueChange changeValue) {
super(cell);
this.changeValue = changeValue;
}
@Override
public Boolean getValue() {
return value;
}
@Override
public void onBrowserEvent(Context context, Element elem,
NativeEvent event) {
Event evt = Event.as(event);
int eventType = evt.getTypeInt();
switch (eventType) {
case Event.ONCHANGE:
value = !value;
if (changeValue != null)
changeValue.changedValue(context.getColumn(), value);
break;
}
super.onBrowserEvent(context, elem, event);
}
@Override
public void render(Context context, SafeHtmlBuilder sb) {
super.render(context, sb.appendEscaped(""));
}
}
public interface TableToggleSelectionValueChange {
void changedValue(int columnIndex, Boolean value);
}
private void initTableColumns(
final SelectionModel<SuggestionImportItem> selectionModel,
ListHandler<SuggestionImportItem> sortHandler) {
// Checkbox column. This table will uses a checkbox column for
// selection.
// Alternatively, you can call cellTable.setSelectionEnabled(true) to
// enable
// mouse selection.
CheckboxCell cell = new CheckboxCell();
ToggleSelectionCheckboxHeader checkboxHeader = new ToggleSelectionCheckboxHeader(cell,
new TableToggleSelectionValueChange() {
@Override
public void changedValue(int columnIndex, Boolean value) {
Log.debug("changedValue");
List<SuggestionImportItem> list = dataProvider.getList();
SelectionModel<? super SuggestionImportItem> _selectionModel = cellTable.getSelectionModel();
for(SuggestionImportItem _item : list){
_selectionModel.setSelected(_item, value);
}
if(value){
resultList.addAll(list);
} else {
resultList.clear();
}
}
});
Column<SuggestionImportItem, Boolean> checkColumn = new Column<SuggestionImportItem, Boolean>(
new CheckboxCell(true, false)) {
@Override
public Boolean getValue(SuggestionImportItem object) {
// Get the value from the selection model.
boolean isSelected = selectionModel.isSelected(object);
if(isSelected){
if(!resultList.contains(object)){
resultList.add(object);
}
} else {
if(resultList.contains(object)){
resultList.remove(object);
}
}
return isSelected;
}
};
cellTable.addColumn(checkColumn,checkboxHeader);
cellTable.setColumnWidth(checkColumn, 40, Unit.PX);
// name.
Column<SuggestionImportItem, String> nameColumn = new Column<SuggestionImportItem, String>(
new TextCell()) {
@Override
public String getValue(SuggestionImportItem object) {
return object.getName();
}
};
nameColumn.setSortable(true);
sortHandler.setComparator(nameColumn, new Comparator<SuggestionImportItem>() {
public int compare(SuggestionImportItem o1, SuggestionImportItem o2) {
return o1.getName().compareTo(o2.getName());
}
});
cellTable.addColumn(nameColumn, "Name");
// cellTable.setColumnWidth(nameColumn, 200, Unit.PX);
// URL column
Column<SuggestionImportItem, String> urlColumn = new Column<SuggestionImportItem, String>(
new TextCell()) {
@Override
public String getValue(SuggestionImportItem object) {
return object.getUrl();
}
};
urlColumn.setSortable(true);
sortHandler.setComparator(urlColumn, new Comparator<SuggestionImportItem>() {
public int compare(SuggestionImportItem o1, SuggestionImportItem o2) {
return o1.getUrl().compareTo(o2.getUrl());
}
});
cellTable.addColumn(urlColumn, "URL");
// cellTable.setColumnWidth(urlColumn, 100, Unit.PX);
// Date column
Column<SuggestionImportItem, Date> dateColumn = new Column<SuggestionImportItem, Date>(
new DateCell(
DateTimeFormat
.getFormat(PredefinedFormat.DATE_TIME_MEDIUM))) {
@Override
public Date getValue(SuggestionImportItem object) {
return object.getCreated();
}
};
dateColumn.setSortable(true);
sortHandler.setComparator(dateColumn, new Comparator<SuggestionImportItem>() {
public int compare(SuggestionImportItem o1, SuggestionImportItem o2) {
return o1.getCreated().compareTo(o2.getCreated());
}
});
cellTable.addColumn(dateColumn, "Created");
cellTable.setColumnWidth(dateColumn, 160, Unit.PX);
}
public void append(List<SuggestionImportItem> result) {
dataProvider.getList().addAll(result);
}
public void show() {
dialog.show();
dialog.center();
}
@UiHandler("cancel")
void onDismiss(ClickEvent event) {
dialog.hide();
}
@UiHandler("save")
void onSave(ClickEvent event) {
if(resultList.size() == 0){
StatusNotification.notify("Select at least one element from list.", StatusNotification.TYPE_NORMAL, StatusNotification.TIME_SHORT);
return;
}
int size = resultList.size();
if(size > 30){
//
// App Engine supports query with 30 subqueries. In one time can import 30 elements.
//
StatusNotification.notify("You can select max 30 items to import", StatusNotification.TYPE_ERROR, StatusNotification.TIME_SHORT);
return;
}
String[] keys = new String[size];
for(int i=0; i<size; i++){
SuggestionImportItem item = resultList.get(i);
keys[i] = item.getKey();
}
dialog.hide();
listener.doServerImport(keys);
}
}
| 9,881 | 0.725599 | 0.720846 | 290 | 32.093105 | 27.290928 | 134 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.572414 | false | false |
12
|
84c7019824845544c362098631e460ee2223271e
| 26,250,840,176,860 |
f6715daaa6563bc56c5f453fb1038d190ccdc2a6
|
/OCAJP7/7324_06/src/main/java/packt/NewMain.java
|
732e26fab08462363d363ef1d2fbcecc10ea4d7c
|
[] |
no_license
|
tanchinsheng/java
|
https://github.com/tanchinsheng/java
|
48395fbd94f64301c0a25281ffaee930e9515230
|
9e2b81a0ef62cfd29e35e4ae7a96614bc8e526dd
|
refs/heads/master
| 2020-05-17T11:52:29.644000 | 2016-02-12T03:18:23 | 2016-02-12T03:18:23 | 14,190,209 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package packt;
/**
*
* @author cstan
*/
public class NewMain {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
int number = 10;
Employee employee = new Employee();
employee.setAge(11);
changeValues(number, employee);
System.out.println(number);
System.out.println(employee.getAge());
}
private static void changeValues(int num, Employee employee) {
num = 20;
employee.setAge(22);
employee = new Employee();
employee.setAge(33);
}
}
|
UTF-8
|
Java
| 775 |
java
|
NewMain.java
|
Java
|
[
{
"context": " the editor.\n */\npackage packt;\n\n/**\n *\n * @author cstan\n */\npublic class NewMain {\n\n /**\n * @param",
"end": 224,
"score": 0.9995739459991455,
"start": 219,
"tag": "USERNAME",
"value": "cstan"
}
] | 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 packt;
/**
*
* @author cstan
*/
public class NewMain {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
int number = 10;
Employee employee = new Employee();
employee.setAge(11);
changeValues(number, employee);
System.out.println(number);
System.out.println(employee.getAge());
}
private static void changeValues(int num, Employee employee) {
num = 20;
employee.setAge(22);
employee = new Employee();
employee.setAge(33);
}
}
| 775 | 0.618065 | 0.605161 | 33 | 22.484848 | 21.211948 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.484848 | false | false |
12
|
1c0bb4d8239b827d3cb8348ea1c1ac6b7ee5b1ac
| 17,660,905,544,873 |
9a78fe755b6ffe368444b7a0eb223b34ce4fe942
|
/TimeConversion/Solution.java
|
37a888a6958fd13aac6b95d588021cd656ed4163
|
[] |
no_license
|
margaritaG/hackerrank
|
https://github.com/margaritaG/hackerrank
|
587d1db59cbace5e0ebb20b6416655195e30dfa4
|
f842ee6808e07caa5476c4eb0be362619e23c800
|
refs/heads/master
| 2016-09-13T23:07:09.186000 | 2016-05-24T14:48:23 | 2016-05-24T14:48:23 | 59,576,080 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package TimeConversion;
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
// Key idea: If suffix is 'AM', keep the hours untouched.
// (Special case: 12AM -> 0).
// If suffix is 'PM', increase hours by 12.
// (Special case: 12PM -> 12).
// Pad hours with a '0' if needed and print hours:minutes:seconds.
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String line = in.nextLine();
String[] parts = line.split(":");
int hours = Integer.parseInt(parts[0]);
String suffix = parts[2].substring(2);
if (suffix.equals("AM")) {
hours = hours % 12;
} else {
hours = hours + 12;
if (hours == 24)
hours = 12;
}
parts[0] = String.format("%02d", hours);
parts[2] = parts[2].substring(0,2);
System.out.println(parts[0] + ":" + parts[1] + ":" + parts[2]);
in.close();
}
}
|
UTF-8
|
Java
| 1,083 |
java
|
Solution.java
|
Java
|
[] | null |
[] |
package TimeConversion;
import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;
public class Solution {
// Key idea: If suffix is 'AM', keep the hours untouched.
// (Special case: 12AM -> 0).
// If suffix is 'PM', increase hours by 12.
// (Special case: 12PM -> 12).
// Pad hours with a '0' if needed and print hours:minutes:seconds.
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
String line = in.nextLine();
String[] parts = line.split(":");
int hours = Integer.parseInt(parts[0]);
String suffix = parts[2].substring(2);
if (suffix.equals("AM")) {
hours = hours % 12;
} else {
hours = hours + 12;
if (hours == 24)
hours = 12;
}
parts[0] = String.format("%02d", hours);
parts[2] = parts[2].substring(0,2);
System.out.println(parts[0] + ":" + parts[1] + ":" + parts[2]);
in.close();
}
}
| 1,083 | 0.524469 | 0.495845 | 40 | 26.1 | 18.499729 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.7 | false | false |
12
|
176f5d21c26938d69032372c152fce78195c2010
| 30,537,217,536,088 |
b798bd648781aa6943ac48442c6879976cd1f29f
|
/1 - Implementação/Biblioteca/src/testes/TituloTeste.java
|
ae148eda3fd799dd2094ad4b6d115a78f4f49eb8
|
[
"MIT"
] |
permissive
|
UFMG-EngSoft/tp_biblioteca
|
https://github.com/UFMG-EngSoft/tp_biblioteca
|
1e83f9efa3fee5156bf127ff505873fe106a685a
|
8a8853bacfdb32e0598bb4007454374189a6e2bc
|
refs/heads/master
| 2022-12-31T21:44:50.935000 | 2020-10-24T15:58:41 | 2020-10-24T15:58:41 | 299,505,612 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package testes;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
import biblioteca.exemplar.Titulo;
public class TituloTeste {
@Test
public void testeInstanciaTitulo() {
int id = 157;
int numeroExemplares = 50;
int periodoMaximoEmprestimo = 15;
String descricao = "Livro dos três porquinhos!";
boolean disponivel = true;
String nome = "Os Três Porquinhos";
Titulo titulo = new Titulo(id, numeroExemplares, periodoMaximoEmprestimo, descricao, disponivel, nome);
assertEquals(id, titulo.getId());
assertEquals(numeroExemplares, titulo.getNumeroExemplares());
assertEquals(periodoMaximoEmprestimo, titulo.getPeriodoMaximoEmprestimo());
assertEquals(descricao, titulo.getDescricao());
assertEquals(disponivel, titulo.isDisponivel());
assertEquals(nome, titulo.getNome());
}
}
|
UTF-8
|
Java
| 949 |
java
|
TituloTeste.java
|
Java
|
[
{
"context": "boolean disponivel = true;\n String nome = \"Os Três Porquinhos\";\n Titulo titulo = new Titulo(id, numeroEx",
"end": 461,
"score": 0.9555608630180359,
"start": 443,
"tag": "NAME",
"value": "Os Três Porquinhos"
}
] | null |
[] |
package testes;
import static org.junit.jupiter.api.Assertions.assertEquals;
import org.junit.jupiter.api.Test;
import biblioteca.exemplar.Titulo;
public class TituloTeste {
@Test
public void testeInstanciaTitulo() {
int id = 157;
int numeroExemplares = 50;
int periodoMaximoEmprestimo = 15;
String descricao = "Livro dos três porquinhos!";
boolean disponivel = true;
String nome = "<NAME>";
Titulo titulo = new Titulo(id, numeroExemplares, periodoMaximoEmprestimo, descricao, disponivel, nome);
assertEquals(id, titulo.getId());
assertEquals(numeroExemplares, titulo.getNumeroExemplares());
assertEquals(periodoMaximoEmprestimo, titulo.getPeriodoMaximoEmprestimo());
assertEquals(descricao, titulo.getDescricao());
assertEquals(disponivel, titulo.isDisponivel());
assertEquals(nome, titulo.getNome());
}
}
| 936 | 0.694826 | 0.687434 | 27 | 34.111111 | 27.503984 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.037037 | false | false |
12
|
e8c1ec9a02316a457f53e106b113ff9ac925d69f
| 33,028,298,554,728 |
cc5bd611c0906eebf2b36549ed199c8767c2fcd9
|
/MyEclipseWorkspaces/MyEclipse 10/Chap17_OOP_ports/src/interfacedemo3/CommonHandSet.java
|
4620e6a625dee748ac60808ecf85311bf1438940
|
[] |
no_license
|
Adam-Lowee/JavaWorkspaces
|
https://github.com/Adam-Lowee/JavaWorkspaces
|
83de2a3c8a4df58e01bdec3b3680d1fabec457b8
|
74dab67fad813998cec555426f68204c8582b1ce
|
refs/heads/master
| 2018-12-18T23:46:22.763000 | 2018-09-15T02:18:55 | 2018-09-15T02:18:55 | 148,009,082 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package interfacedemo3;
//¿É²¥·ÅÒôÀÖ
public class CommonHandSet extends HandSet implements PlayMusic {
public CommonHandSet(String brand, String type) {
super(brand, type);
// TODO Auto-generated constructor stub
}
@Override
public void play(String incontent) {
// TODO Auto-generated method stub
System.out.println("playing"+incontent+"music");
}
@Override
public void sendInfo() {
// TODO Auto-generated method stub
System.out.println("send something");
}
@Override
public void info() {
// TODO Auto-generated method stub
System.out.println(getType()+getBrand());
}
@Override
public void call() {
// TODO Auto-generated method stub
System.out.println("call someone");
}
}
|
WINDOWS-1252
|
Java
| 732 |
java
|
CommonHandSet.java
|
Java
|
[] | null |
[] |
package interfacedemo3;
//¿É²¥·ÅÒôÀÖ
public class CommonHandSet extends HandSet implements PlayMusic {
public CommonHandSet(String brand, String type) {
super(brand, type);
// TODO Auto-generated constructor stub
}
@Override
public void play(String incontent) {
// TODO Auto-generated method stub
System.out.println("playing"+incontent+"music");
}
@Override
public void sendInfo() {
// TODO Auto-generated method stub
System.out.println("send something");
}
@Override
public void info() {
// TODO Auto-generated method stub
System.out.println(getType()+getBrand());
}
@Override
public void call() {
// TODO Auto-generated method stub
System.out.println("call someone");
}
}
| 732 | 0.706371 | 0.703601 | 36 | 19.055555 | 18.392246 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.333333 | false | false |
12
|
8a6417f885cacb78cde376bbbc2e6050633756ec
| 29,334,626,700,711 |
4f3efb67ba10c6b649806e65a6a4d719f6e50f63
|
/app/src/main/java/com/example/madmini/RatingList.java
|
fc0831df5aa9daa6f0c919c23640e139f7e39bbd
|
[] |
no_license
|
Sl-niko/MAD-project
|
https://github.com/Sl-niko/MAD-project
|
d1d30f3efc854bab78986058425376c3de5c7309
|
d8c9c733432bcfb9f62ecff5f874dcea17f418d0
|
refs/heads/master
| 2023-05-09T07:23:00.475000 | 2021-05-25T18:40:59 | 2021-05-25T18:40:59 | 370,793,797 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.madmini;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.RecyclerView;
import com.example.madmini.Model.Rating;
import java.util.List;
import ViewHolder.Rating_RecycleView_Config;
public class RatingList extends AppCompatActivity {
private RecyclerView sRecyclerView;
@SuppressLint("RestrictedApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_rating_list);
getSupportActionBar().setTitle(" ");
getSupportActionBar().setDefaultDisplayHomeAsUpEnabled(true);
sRecyclerView = (RecyclerView) findViewById(R.id.RecyclerView_rating);
new RatingFirebaseDatabaseHelper().readRatings(new RatingFirebaseDatabaseHelper.DataStatus() {
@Override
public void DataIsLoaded(List<Rating> ratings
, List<String> keys) {
findViewById(R.id.loading_rating_progressBar).setVisibility(View.GONE);
new Rating_RecycleView_Config().setConfig(sRecyclerView, RatingList.this,
ratings, keys);
}
@Override
public void DataIsInserted() {
}
@Override
public void DataIsUpdated() {
}
@Override
public void DataIsDeleted() {
}
});
}
}
|
UTF-8
|
Java
| 1,548 |
java
|
RatingList.java
|
Java
|
[] | null |
[] |
package com.example.madmini;
import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.View;
import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.RecyclerView;
import com.example.madmini.Model.Rating;
import java.util.List;
import ViewHolder.Rating_RecycleView_Config;
public class RatingList extends AppCompatActivity {
private RecyclerView sRecyclerView;
@SuppressLint("RestrictedApi")
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_rating_list);
getSupportActionBar().setTitle(" ");
getSupportActionBar().setDefaultDisplayHomeAsUpEnabled(true);
sRecyclerView = (RecyclerView) findViewById(R.id.RecyclerView_rating);
new RatingFirebaseDatabaseHelper().readRatings(new RatingFirebaseDatabaseHelper.DataStatus() {
@Override
public void DataIsLoaded(List<Rating> ratings
, List<String> keys) {
findViewById(R.id.loading_rating_progressBar).setVisibility(View.GONE);
new Rating_RecycleView_Config().setConfig(sRecyclerView, RatingList.this,
ratings, keys);
}
@Override
public void DataIsInserted() {
}
@Override
public void DataIsUpdated() {
}
@Override
public void DataIsDeleted() {
}
});
}
}
| 1,548 | 0.655685 | 0.655685 | 55 | 27.163637 | 26.273916 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false |
12
|
dd0e2c314910b2792189c88bdd367775d312824a
| 10,883,447,155,936 |
85a721430ec52fb989a6c2afea2396d7cdead0ba
|
/Eclispe_Workspace/src/com/gforg/misc/NextHigherNumberWithSameNumberOfSetBits.java
|
520fb4db2bc78638990d6a2235c4fae3fd0c4689
|
[] |
no_license
|
akiankit/JavaCodes
|
https://github.com/akiankit/JavaCodes
|
395c003ed75a748118fe42041e1d0175b7e98762
|
e5f549cca8e2134a46deb527a1ba12467e7ca5f0
|
refs/heads/master
| 2021-01-01T20:12:38.745000 | 2018-02-25T11:02:13 | 2018-02-25T11:02:13 | 40,881,053 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.gforg.misc;
public class NextHigherNumberWithSameNumberOfSetBits {
public static void main(String[] args) {
// for(int i=1;i<=10;i++)
// System.out.println("i="+i+"Next Highest="+nextHighestNumberWithSameBitsCount(i));
System.out.println(nextHighestNumberWithSameBitsCount(1918));
}
public static int nextHighestNumberWithSameBitsCount(int n) {
int m = 1;
int three = 3;
// In case number is one less than exact power of 2
if ((n & (n + 1)) == 0) {
return (n + 1) | n >> 1;
} else if ((n & n - 1) == 0) {// If number is power of 2 then just double it.
return n << 1;
} else {
//Other wise search for patter "01" and change it to "10"
boolean oneFound = false;
boolean patternFound = false;
int count = 0;
int temp = n;
while (temp != 0) {
if ((n & m) == m) {
oneFound = true;
} else if (oneFound && (n & m) == 0) {
patternFound = true;
break;
} else {
oneFound = false;
}
m = m << 1;
count++;
temp = temp>>1;
}
// If pattern "01" is found then change it to "10" using XOR operation.
if (patternFound) {
return n ^ (three << (count - 1));
} else {
// If pattern "01" is not found that means number is of the form "1100"
// In that case we can get result by ((1<<4) | (1100>>3))
// shift 1 by number of bits in number(which is 4 here) and
// shift number by position of first 1(which is 3 here) and
// then take OR of these two
count = 0;
m = 1;
while ((n & m) != m) {
m <<= 1;
count++;
}
int rightPart = n >> (count + 1);
m = 1;
while (n != 0) {
n = n >> 1;
m = m << 1;
}
return m | rightPart;
}
}
}
}
|
UTF-8
|
Java
| 2,286 |
java
|
NextHigherNumberWithSameNumberOfSetBits.java
|
Java
|
[] | null |
[] |
package com.gforg.misc;
public class NextHigherNumberWithSameNumberOfSetBits {
public static void main(String[] args) {
// for(int i=1;i<=10;i++)
// System.out.println("i="+i+"Next Highest="+nextHighestNumberWithSameBitsCount(i));
System.out.println(nextHighestNumberWithSameBitsCount(1918));
}
public static int nextHighestNumberWithSameBitsCount(int n) {
int m = 1;
int three = 3;
// In case number is one less than exact power of 2
if ((n & (n + 1)) == 0) {
return (n + 1) | n >> 1;
} else if ((n & n - 1) == 0) {// If number is power of 2 then just double it.
return n << 1;
} else {
//Other wise search for patter "01" and change it to "10"
boolean oneFound = false;
boolean patternFound = false;
int count = 0;
int temp = n;
while (temp != 0) {
if ((n & m) == m) {
oneFound = true;
} else if (oneFound && (n & m) == 0) {
patternFound = true;
break;
} else {
oneFound = false;
}
m = m << 1;
count++;
temp = temp>>1;
}
// If pattern "01" is found then change it to "10" using XOR operation.
if (patternFound) {
return n ^ (three << (count - 1));
} else {
// If pattern "01" is not found that means number is of the form "1100"
// In that case we can get result by ((1<<4) | (1100>>3))
// shift 1 by number of bits in number(which is 4 here) and
// shift number by position of first 1(which is 3 here) and
// then take OR of these two
count = 0;
m = 1;
while ((n & m) != m) {
m <<= 1;
count++;
}
int rightPart = n >> (count + 1);
m = 1;
while (n != 0) {
n = n >> 1;
m = m << 1;
}
return m | rightPart;
}
}
}
}
| 2,286 | 0.419073 | 0.394138 | 63 | 35.26984 | 22.762547 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.52381 | false | false |
12
|
1ea96499db90a3e711706d4be39df78014f7d6da
| 10,883,447,152,440 |
94216ccb177fe21864232fa7a4ab73bb5eb1f749
|
/helloWorld.java
|
f5be7e1de62175f337310dc4a37493d1acd6dfe2
|
[] |
no_license
|
sm0lvoicc/java-c-1
|
https://github.com/sm0lvoicc/java-c-1
|
92e4f03c3dd7b06263abdb70b53f87009dae604a
|
3acb0b4fe96de25ef6fd23eedddb614332523966
|
refs/heads/main
| 2023-05-10T13:53:08.688000 | 2021-06-20T18:27:17 | 2021-06-20T18:27:17 | 378,709,616 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
public class helloWorld /*class name and the folder name should be the same*/
{
public static void main(String[] args) //declaring a public function, the main one
{
System.out.println("Hello World");
/*
System is your system, so its outputting a printing of a line in a new line which will be Hello World
*/
}
}
|
UTF-8
|
Java
| 334 |
java
|
helloWorld.java
|
Java
|
[] | null |
[] |
public class helloWorld /*class name and the folder name should be the same*/
{
public static void main(String[] args) //declaring a public function, the main one
{
System.out.println("Hello World");
/*
System is your system, so its outputting a printing of a line in a new line which will be Hello World
*/
}
}
| 334 | 0.691617 | 0.691617 | 10 | 32.400002 | 38.792267 | 105 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.3 | false | false |
12
|
fcf4c0a72285368129b31016dc09621ce7cb5331
| 16,054,587,785,590 |
774d36285e48bd429017b6901a59b8e3a51d6add
|
/sources/p093e/p094a/p095a/C3323p.java
|
eff8141d24a505437d3a0cba66e1d7cceeb3b0f9
|
[] |
no_license
|
jorge-luque/hb
|
https://github.com/jorge-luque/hb
|
83c086851a409e7e476298ffdf6ba0c8d06911db
|
b467a9af24164f7561057e5bcd19cdbc8647d2e5
|
refs/heads/master
| 2023-08-25T09:32:18.793000 | 2020-10-02T11:02:01 | 2020-10-02T11:02:01 | 300,586,541 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package p093e.p094a.p095a;
import android.content.Context;
import android.provider.Settings;
import com.tapjoy.TapjoyConstants;
/* renamed from: e.a.a.p */
/* compiled from: AndroidIdUtil */
public class C3323p {
/* renamed from: a */
public static String m11054a(Context context) {
return Settings.Secure.getString(context.getContentResolver(), TapjoyConstants.TJC_ANDROID_ID);
}
}
|
UTF-8
|
Java
| 405 |
java
|
C3323p.java
|
Java
|
[] | null |
[] |
package p093e.p094a.p095a;
import android.content.Context;
import android.provider.Settings;
import com.tapjoy.TapjoyConstants;
/* renamed from: e.a.a.p */
/* compiled from: AndroidIdUtil */
public class C3323p {
/* renamed from: a */
public static String m11054a(Context context) {
return Settings.Secure.getString(context.getContentResolver(), TapjoyConstants.TJC_ANDROID_ID);
}
}
| 405 | 0.733333 | 0.688889 | 14 | 27.928572 | 25.563547 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false |
12
|
2e43a21e07e986399a30c3d61c2dd924788749c2
| 10,376,641,020,929 |
2df63cb7796c4f541262a1910250fed779638f33
|
/sell/src/main/java/com/hujing/wechat/sell/controller/SellerUserController.java
|
93383dcde5bb8141bc9c324908deb4c74ed08951
|
[] |
no_license
|
zzhujing/sell
|
https://github.com/zzhujing/sell
|
25268067f9dd3e8696a689557b18f73f952bf2a8
|
591224781d538c2bd6b80893d509b4733f441fb9
|
refs/heads/master
| 2020-04-26T09:12:54.230000 | 2019-03-02T12:58:07 | 2019-03-02T12:58:07 | 172,488,503 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.hujing.wechat.sell.controller;
import com.hujing.wechat.sell.config.ProjectUrlProperties;
import com.hujing.wechat.sell.constant.CookieConstant;
import com.hujing.wechat.sell.constant.RedisConstant;
import com.hujing.wechat.sell.enums.ResultEnum;
import com.hujing.wechat.sell.po.SellerInfo;
import com.hujing.wechat.sell.service.SellerInfoService;
import com.hujing.wechat.sell.util.CookieUtils;
import com.hujing.wechat.sell.util.KeyGenerator;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
/**
* @author hj
* @time 2019-03-02 11:51
* @description 卖家用户控制器
*/
@RequestMapping("/seller")
@Controller
@Slf4j
public class SellerUserController {
@Autowired
SellerInfoService sellerInfoService;
@Autowired
private StringRedisTemplate redisTemplate;
@Autowired
ProjectUrlProperties projectUrlProperties;
/**
* 登录
*
* @param openid
* @return
*/
@GetMapping("/login")
public String login(@RequestParam String openid, Model model, HttpServletRequest request, HttpServletResponse response) {
//1.根据openid查询是否有该数据
Optional<SellerInfo> sellerInfo = sellerInfoService.findByOpenid(openid);
if (!sellerInfo.isPresent()) {
model.addAttribute("msg", ResultEnum.LOGIN_FAIL.getMsg());
model.addAttribute("returnUrl", "/sell/wechat/qrAuthorize");
return "common/error";
}
//2.添加到redis中
String token = KeyGenerator.generate();
Integer expire = RedisConstant.EXPIRE;
redisTemplate.opsForValue().set(String.format(RedisConstant.TOKEN_PREFIX,token), openid, expire, TimeUnit.SECONDS);
//3.设置到cookie中
CookieUtils.setCookie(request, response, CookieConstant.COOKIE_NAME, token, expire, "utf-8");
return "redirect:" + projectUrlProperties.getSell() + "/sell/seller/order/list";
}
/**
* 登出
* @param request
* @param response
* @param model
* @return
*/
@GetMapping("/logout")
public String logout(HttpServletRequest request, HttpServletResponse response,Model model) {
String cookieValue = CookieUtils.getCookieValue(request, CookieConstant.COOKIE_NAME, "utf-8");
//1.清除redis
redisTemplate.opsForValue().getOperations().delete(String.format(RedisConstant.TOKEN_PREFIX, cookieValue));
//2.清除cookie
CookieUtils.deleteCookie(request,response,CookieConstant.COOKIE_NAME);
return "redirect:" + projectUrlProperties.getSell() + "/sell/seller/order/list";
}
}
|
UTF-8
|
Java
| 3,145 |
java
|
SellerUserController.java
|
Java
|
[
{
"context": "ort java.util.concurrent.TimeUnit;\n\n/**\n * @author hj\n * @time 2019-03-02 11:51\n * @description 卖家用户控制器",
"end": 1067,
"score": 0.9995476603507996,
"start": 1065,
"tag": "USERNAME",
"value": "hj"
}
] | null |
[] |
package com.hujing.wechat.sell.controller;
import com.hujing.wechat.sell.config.ProjectUrlProperties;
import com.hujing.wechat.sell.constant.CookieConstant;
import com.hujing.wechat.sell.constant.RedisConstant;
import com.hujing.wechat.sell.enums.ResultEnum;
import com.hujing.wechat.sell.po.SellerInfo;
import com.hujing.wechat.sell.service.SellerInfoService;
import com.hujing.wechat.sell.util.CookieUtils;
import com.hujing.wechat.sell.util.KeyGenerator;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
/**
* @author hj
* @time 2019-03-02 11:51
* @description 卖家用户控制器
*/
@RequestMapping("/seller")
@Controller
@Slf4j
public class SellerUserController {
@Autowired
SellerInfoService sellerInfoService;
@Autowired
private StringRedisTemplate redisTemplate;
@Autowired
ProjectUrlProperties projectUrlProperties;
/**
* 登录
*
* @param openid
* @return
*/
@GetMapping("/login")
public String login(@RequestParam String openid, Model model, HttpServletRequest request, HttpServletResponse response) {
//1.根据openid查询是否有该数据
Optional<SellerInfo> sellerInfo = sellerInfoService.findByOpenid(openid);
if (!sellerInfo.isPresent()) {
model.addAttribute("msg", ResultEnum.LOGIN_FAIL.getMsg());
model.addAttribute("returnUrl", "/sell/wechat/qrAuthorize");
return "common/error";
}
//2.添加到redis中
String token = KeyGenerator.generate();
Integer expire = RedisConstant.EXPIRE;
redisTemplate.opsForValue().set(String.format(RedisConstant.TOKEN_PREFIX,token), openid, expire, TimeUnit.SECONDS);
//3.设置到cookie中
CookieUtils.setCookie(request, response, CookieConstant.COOKIE_NAME, token, expire, "utf-8");
return "redirect:" + projectUrlProperties.getSell() + "/sell/seller/order/list";
}
/**
* 登出
* @param request
* @param response
* @param model
* @return
*/
@GetMapping("/logout")
public String logout(HttpServletRequest request, HttpServletResponse response,Model model) {
String cookieValue = CookieUtils.getCookieValue(request, CookieConstant.COOKIE_NAME, "utf-8");
//1.清除redis
redisTemplate.opsForValue().getOperations().delete(String.format(RedisConstant.TOKEN_PREFIX, cookieValue));
//2.清除cookie
CookieUtils.deleteCookie(request,response,CookieConstant.COOKIE_NAME);
return "redirect:" + projectUrlProperties.getSell() + "/sell/seller/order/list";
}
}
| 3,145 | 0.730107 | 0.722962 | 86 | 34.790699 | 31.119095 | 125 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.674419 | false | false |
12
|
e2d5b9652d2a2864f9e1fc372129d544363d74fb
| 6,262,062,354,691 |
40486322a348b50a8c1724027c3d78289d40c715
|
/PartyProject/MyParty/src/databaseHandler/MyJsonParser.java
|
b6bdba3a472dda5b95ed46a704aedc11c423d636
|
[] |
no_license
|
rcrozon/PartyProject
|
https://github.com/rcrozon/PartyProject
|
cdddf28f4f2373aef8e99a447bb2edb23df71142
|
3950b78653374a8305a8b67624d78d15af8f1021
|
refs/heads/master
| 2021-01-01T17:06:35.389000 | 2014-03-24T09:51:55 | 2014-03-24T09:51:55 | 16,799,279 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package databaseHandler;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.ActionBar.Tab;
import android.content.Context;
import android.util.Log;
import entities.Client;
import entities.Concert;
public class MyJsonParser {
private Context context;
public MyJsonParser(Context context) {
this.context = context;
}
public Boolean reponseIsClient(String reponse){
JSONArray rep;
try {
rep = new JSONArray(reponse);
}
catch (JSONException e) {
Log.i("SERVER", "FAUX");
return false;
}
Log.i("SERVER", "VRAI");
return true;
}
public Boolean reponseIsJson(String reponse){
String r = reponse.substring(8);
DatabaseHandler dt = new DatabaseHandler(context);
String decode = dt.decodePassword(r);
if (decode == null)
return false;
JSONArray rep;
try {
rep = new JSONArray(decode);
} catch (JSONException e) {
return false;
}
return true;
}
public List<Client> getClientFromJson(String json) {
String r = json.substring(8);
List<Client> cl = new ArrayList<Client>();
DatabaseHandler dt = new DatabaseHandler(context);
String decode = dt.decodePassword(r);
JSONArray rep;
try {
rep = new JSONArray(decode);
for (int i = 0 ; i<rep.length() ; i++){
JSONObject infoClient = rep.getJSONObject(i);
//String infoStr = client.getString("Client");
//JSONObject infoClient = new JSONObject(infoStr);
int id = Integer.parseInt(infoClient.getString(Tables.CLIENT_NAME_ID));
String username = infoClient.getString(Tables.CLIENT_NAME_USERNAME);
String mail = infoClient.getString(Tables.CLIENT_NAME_MAIL);
/*TODO Crypter MDP*/
String password = infoClient.getString(Tables.CLIENT_NAME_PASSWORD);
String firstName = infoClient.getString(Tables.CLIENT_NAME_FIRSTNAME);
String lastName = infoClient.getString(Tables.CLIENT_NAME_LASTNAME);
int admin = Integer.parseInt(infoClient.getString(Tables.CLIENT_NAME_ADMIN));
/* if (admin == 1){
DatabaseHandler dataBase = new DatabaseHandler(context);
dataBase.open();
Client c = dataBase.getClientWithId(id);
if (c != null){
password= c.getPassword();
}
else{
password= "errorTEst";
}
}*/
String dateCreated = infoClient.getString(Tables.CLIENT_NAME_DATE_CREATE);
Client clientObj = new Client(id, firstName, lastName, mail, username, password, admin, dateCreated);
Log.i("ADMIN", "INFO: "+clientObj.testToString());
cl.add(clientObj);
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
cl=null;
}
return cl;
}
public List<Concert> getConcertFromJson(String json) {
String r = json.substring(8);
List<Concert> cl = new ArrayList<Concert>();
DatabaseHandler dt = new DatabaseHandler(context);
String decode = dt.decodePassword(r);
JSONArray rep;
try {
rep = new JSONArray(decode);
for (int i = 0 ; i<rep.length() ; i++){
JSONObject infoConcert = rep.getJSONObject(i);
//String infoStr = concert.getString("Concert");
//JSONObject infoConcert = new JSONObject(infoStr);
int id = Integer.parseInt(infoConcert.getString(Tables.CONCERT_NAME_ID));
String begin = infoConcert.getString(Tables.CONCERT_NAME_START_DATE);
String end = infoConcert.getString(Tables.CONCERT_NAME_END_DATE);
String location = infoConcert.getString(Tables.CONCERT_NAME_LOCATION);
String imgPath = infoConcert.getString(Tables.CONCERT_NAME_IMAGE);
int nbSeets = Integer.parseInt(infoConcert.getString(Tables.CONCERT_NAME_NB_SEAT));
String fullBool = infoConcert.getString(Tables.CONCERT_NAME_FULL);
int full;
if (fullBool.equalsIgnoreCase("false")){
full = 0;
}
else{
full = 1;
}
int idCreator = Integer.parseInt(infoConcert.getString(Tables.CONCERT_NAME_ID_CREATOR));
int idTarif = Integer.parseInt(infoConcert.getString(Tables.CONCERT_NAME_ID_TARIF));
String creationDate = infoConcert.getString(Tables.CONCERT_NAME_CREATED);
String title = infoConcert.getString(Tables.CONCERT_NAME_TITLE_CONCERT);
String onlineBool = infoConcert.getString(Tables.CONCERT_NAME_ONLINE);
int online;
if (onlineBool.equalsIgnoreCase("false")){
online = 0;
}
else{
online = 1;
}
Concert concertObj = new Concert(id, imgPath, title, begin, end, creationDate, location, nbSeets, full,idTarif, idCreator, online);
cl.add(concertObj);
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
cl=null;
}
return cl;
}
public Boolean getReservationAndInsert(String json) {
String r = json.substring(8);
DatabaseHandler dataBase = new DatabaseHandler(context);
dataBase.open();
String decode = dataBase.decodePassword(r);
JSONArray rep;
try {
rep = new JSONArray(decode);
for (int i = 0 ; i<rep.length() ; i++){
JSONObject infoReservation= rep.getJSONObject(i);
//String infoStr = reservation.getString("Reservation");
//JSONObject infoReservation = new JSONObject(infoStr);
int id = Integer.parseInt(infoReservation.getString(Tables.RES_NAME_ID));
int id_concert = Integer.parseInt(infoReservation.getString(Tables.RES_NAME_ID_CONCERT));
int id_client = Integer.parseInt(infoReservation.getString(Tables.RES_NAME_ID_CLIENT));
int id_tarif = Integer.parseInt(infoReservation.getString(Tables.RES_NAME_ID_TARIF));
int scan = Integer.parseInt(infoReservation.getString(Tables.RES_NAME_SCAN));
dataBase.insertRes(id, id_concert, id_client, id_tarif, scan);
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return false;
}
return true;
}
public Boolean getAssocTariffsAndInsert(String json) {
String r = json.substring(8);
DatabaseHandler dataBase = new DatabaseHandler(context);
dataBase.open();
String decode = dataBase.decodePassword(r);
JSONArray rep;
try {
rep = new JSONArray(decode);
for (int i = 0 ; i<rep.length() ; i++){
JSONObject infoAssocTarrif = rep.getJSONObject(i);
int id = Integer.parseInt(infoAssocTarrif.getString(Tables.ASSOC_TARIFF_NAME_ID));
int id_concert = Integer.parseInt(infoAssocTarrif.getString(Tables.ASSOC_TARIFF_NAME_ID_CONCERT));
int id_tariff = Integer.parseInt(infoAssocTarrif.getString(Tables.ASSOC_TARIFF_NAME_ID_TARIFF));
Log.i("ASSOC", "id :" +id+"idtarrif :"+id_tariff+"id_concert :"+id_concert);
dataBase.insertAssocTariff(id, id_tariff, id_concert);
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return false;
}
return true;
}
public Boolean getAssocArtistsAndInsert(String json) {
String r = json.substring(8);
DatabaseHandler dataBase = new DatabaseHandler(context);
dataBase.open();
String decode = dataBase.decodePassword(r);
JSONArray rep;
try {
rep = new JSONArray(decode);
for (int i = 0 ; i<rep.length() ; i++){
JSONObject infoAssocArtist = rep.getJSONObject(i);
int id = Integer.parseInt(infoAssocArtist.getString(Tables.ASSOC_ARTIST_NAME_ID));
int id_concert = Integer.parseInt(infoAssocArtist.getString(Tables.ASSOC_ARTIST_NAME_ID_CONCERT));
int id_artist = Integer.parseInt(infoAssocArtist.getString(Tables.ASSOC_ARTIST_NAME_ID_ARTISTS));
Log.i("ASSOC", "id :" +id+"idartist:"+id_artist+"id_concert :"+id_concert);
dataBase.insertAssocArtist(id, id_artist, id_concert);
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return false;
}
return true;
}
public Boolean getAssocStylesAndInsert(String json) {
String r = json.substring(8);
DatabaseHandler dataBase = new DatabaseHandler(context);
dataBase.open();
String decode = dataBase.decodePassword(r);
JSONArray rep;
try {
rep = new JSONArray(decode);
for (int i = 0 ; i<rep.length() ; i++){
JSONObject infoAssocStyles = rep.getJSONObject(i);
int id = Integer.parseInt(infoAssocStyles.getString(Tables.ASSOC_STYLES_NAME_ID));
int id_style = Integer.parseInt(infoAssocStyles.getString(Tables.ASSOC_STYLES_NAME_ID_STYLES));
int id_concert = Integer.parseInt(infoAssocStyles.getString(Tables.ASSOC_STYLES_NAME_ID_CONCERT));
Log.i("ASSOC", "id :" +id+"idstyle :"+id_style+"id_concert :"+id_concert);
dataBase.insertAssocStyle(id, id_style, id_concert);
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return false;
}
return true;
}
public Boolean getStylesAndInsert(String json) {
String r = json.substring(8);
DatabaseHandler dataBase = new DatabaseHandler(context);
dataBase.open();
String decode = dataBase.decodePassword(r);
JSONArray rep;
try {
rep = new JSONArray(decode);
for (int i = 0 ; i<rep.length() ; i++){
JSONObject infoStyles = rep.getJSONObject(i);
int id = Integer.parseInt(infoStyles.getString(Tables.STYLE_NAME_ID));
String name = infoStyles.getString(Tables.STYLE_NAME_STYLE_NAME);
Log.i("ASSOC", "idStyle :" +id+"Name :"+name);
dataBase.insertStyle(id, name);
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return false;
}
return true;
}
public Boolean getArtistsAndInsert(String json) {
String r = json.substring(8);
DatabaseHandler dataBase = new DatabaseHandler(context);
dataBase.open();
String decode = dataBase.decodePassword(r);
JSONArray rep;
try {
rep = new JSONArray(decode);
for (int i = 0 ; i<rep.length() ; i++){
JSONObject infoArtists = rep.getJSONObject(i);
int id = Integer.parseInt(infoArtists.getString(Tables.ARTIST_NAME_ID));
String name = infoArtists.getString(Tables.ARTIST_NAME_ARTIST_NAME);
Log.i("ASSOC", "idArtist :" +id+"Name :"+name);
dataBase.insertArtist(id, name);
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return false;
}
return true;
}
public Boolean getTariffsAndInsert(String json){
String r = json.substring(8);
DatabaseHandler dataBase = new DatabaseHandler(context);
dataBase.open();
String decode = dataBase.decodePassword(r);
JSONArray rep;
try {
rep = new JSONArray(decode);
for (int i = 0 ; i<rep.length() ; i++){
JSONObject infoTarrif = rep.getJSONObject(i);
int id = Integer.parseInt(infoTarrif.getString(Tables.TARIFF_NAME_ID));
String label = infoTarrif.getString(Tables.TARIFF_NAME_LABEL);
Double price = infoTarrif.getDouble(Tables.TARIFF_NAME_PRICE);
dataBase.insertTariff(id, label, price);
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return false;
}
return true;
}
}
|
UTF-8
|
Java
| 10,838 |
java
|
MyJsonParser.java
|
Java
|
[
{
"context": "getPassword();\n\t\t\t\t\t}\n\t\t\t\t\telse{\n\t\t\t\t\t\tpassword= \"errorTEst\";\n\t\t\t\t\t}\n\n\t\t\t\t}*/\n\n\t\t\t\tString dateCreated = infoC",
"end": 2295,
"score": 0.9991239905357361,
"start": 2286,
"tag": "PASSWORD",
"value": "errorTEst"
},
{
"context": "ATE_CREATE);\n\t\t\t\tClient clientObj = new Client(id, firstName, lastName, mail, username, password, admin, dateC",
"end": 2441,
"score": 0.9829960465431213,
"start": 2432,
"tag": "NAME",
"value": "firstName"
},
{
"context": ";\n\t\t\t\tClient clientObj = new Client(id, firstName, lastName, mail, username, password, admin, dateCreated);\n\t",
"end": 2451,
"score": 0.9735125303268433,
"start": 2443,
"tag": "NAME",
"value": "lastName"
}
] | null |
[] |
package databaseHandler;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.app.ActionBar.Tab;
import android.content.Context;
import android.util.Log;
import entities.Client;
import entities.Concert;
public class MyJsonParser {
private Context context;
public MyJsonParser(Context context) {
this.context = context;
}
public Boolean reponseIsClient(String reponse){
JSONArray rep;
try {
rep = new JSONArray(reponse);
}
catch (JSONException e) {
Log.i("SERVER", "FAUX");
return false;
}
Log.i("SERVER", "VRAI");
return true;
}
public Boolean reponseIsJson(String reponse){
String r = reponse.substring(8);
DatabaseHandler dt = new DatabaseHandler(context);
String decode = dt.decodePassword(r);
if (decode == null)
return false;
JSONArray rep;
try {
rep = new JSONArray(decode);
} catch (JSONException e) {
return false;
}
return true;
}
public List<Client> getClientFromJson(String json) {
String r = json.substring(8);
List<Client> cl = new ArrayList<Client>();
DatabaseHandler dt = new DatabaseHandler(context);
String decode = dt.decodePassword(r);
JSONArray rep;
try {
rep = new JSONArray(decode);
for (int i = 0 ; i<rep.length() ; i++){
JSONObject infoClient = rep.getJSONObject(i);
//String infoStr = client.getString("Client");
//JSONObject infoClient = new JSONObject(infoStr);
int id = Integer.parseInt(infoClient.getString(Tables.CLIENT_NAME_ID));
String username = infoClient.getString(Tables.CLIENT_NAME_USERNAME);
String mail = infoClient.getString(Tables.CLIENT_NAME_MAIL);
/*TODO Crypter MDP*/
String password = infoClient.getString(Tables.CLIENT_NAME_PASSWORD);
String firstName = infoClient.getString(Tables.CLIENT_NAME_FIRSTNAME);
String lastName = infoClient.getString(Tables.CLIENT_NAME_LASTNAME);
int admin = Integer.parseInt(infoClient.getString(Tables.CLIENT_NAME_ADMIN));
/* if (admin == 1){
DatabaseHandler dataBase = new DatabaseHandler(context);
dataBase.open();
Client c = dataBase.getClientWithId(id);
if (c != null){
password= c.getPassword();
}
else{
password= "<PASSWORD>";
}
}*/
String dateCreated = infoClient.getString(Tables.CLIENT_NAME_DATE_CREATE);
Client clientObj = new Client(id, firstName, lastName, mail, username, password, admin, dateCreated);
Log.i("ADMIN", "INFO: "+clientObj.testToString());
cl.add(clientObj);
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
cl=null;
}
return cl;
}
public List<Concert> getConcertFromJson(String json) {
String r = json.substring(8);
List<Concert> cl = new ArrayList<Concert>();
DatabaseHandler dt = new DatabaseHandler(context);
String decode = dt.decodePassword(r);
JSONArray rep;
try {
rep = new JSONArray(decode);
for (int i = 0 ; i<rep.length() ; i++){
JSONObject infoConcert = rep.getJSONObject(i);
//String infoStr = concert.getString("Concert");
//JSONObject infoConcert = new JSONObject(infoStr);
int id = Integer.parseInt(infoConcert.getString(Tables.CONCERT_NAME_ID));
String begin = infoConcert.getString(Tables.CONCERT_NAME_START_DATE);
String end = infoConcert.getString(Tables.CONCERT_NAME_END_DATE);
String location = infoConcert.getString(Tables.CONCERT_NAME_LOCATION);
String imgPath = infoConcert.getString(Tables.CONCERT_NAME_IMAGE);
int nbSeets = Integer.parseInt(infoConcert.getString(Tables.CONCERT_NAME_NB_SEAT));
String fullBool = infoConcert.getString(Tables.CONCERT_NAME_FULL);
int full;
if (fullBool.equalsIgnoreCase("false")){
full = 0;
}
else{
full = 1;
}
int idCreator = Integer.parseInt(infoConcert.getString(Tables.CONCERT_NAME_ID_CREATOR));
int idTarif = Integer.parseInt(infoConcert.getString(Tables.CONCERT_NAME_ID_TARIF));
String creationDate = infoConcert.getString(Tables.CONCERT_NAME_CREATED);
String title = infoConcert.getString(Tables.CONCERT_NAME_TITLE_CONCERT);
String onlineBool = infoConcert.getString(Tables.CONCERT_NAME_ONLINE);
int online;
if (onlineBool.equalsIgnoreCase("false")){
online = 0;
}
else{
online = 1;
}
Concert concertObj = new Concert(id, imgPath, title, begin, end, creationDate, location, nbSeets, full,idTarif, idCreator, online);
cl.add(concertObj);
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
cl=null;
}
return cl;
}
public Boolean getReservationAndInsert(String json) {
String r = json.substring(8);
DatabaseHandler dataBase = new DatabaseHandler(context);
dataBase.open();
String decode = dataBase.decodePassword(r);
JSONArray rep;
try {
rep = new JSONArray(decode);
for (int i = 0 ; i<rep.length() ; i++){
JSONObject infoReservation= rep.getJSONObject(i);
//String infoStr = reservation.getString("Reservation");
//JSONObject infoReservation = new JSONObject(infoStr);
int id = Integer.parseInt(infoReservation.getString(Tables.RES_NAME_ID));
int id_concert = Integer.parseInt(infoReservation.getString(Tables.RES_NAME_ID_CONCERT));
int id_client = Integer.parseInt(infoReservation.getString(Tables.RES_NAME_ID_CLIENT));
int id_tarif = Integer.parseInt(infoReservation.getString(Tables.RES_NAME_ID_TARIF));
int scan = Integer.parseInt(infoReservation.getString(Tables.RES_NAME_SCAN));
dataBase.insertRes(id, id_concert, id_client, id_tarif, scan);
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return false;
}
return true;
}
public Boolean getAssocTariffsAndInsert(String json) {
String r = json.substring(8);
DatabaseHandler dataBase = new DatabaseHandler(context);
dataBase.open();
String decode = dataBase.decodePassword(r);
JSONArray rep;
try {
rep = new JSONArray(decode);
for (int i = 0 ; i<rep.length() ; i++){
JSONObject infoAssocTarrif = rep.getJSONObject(i);
int id = Integer.parseInt(infoAssocTarrif.getString(Tables.ASSOC_TARIFF_NAME_ID));
int id_concert = Integer.parseInt(infoAssocTarrif.getString(Tables.ASSOC_TARIFF_NAME_ID_CONCERT));
int id_tariff = Integer.parseInt(infoAssocTarrif.getString(Tables.ASSOC_TARIFF_NAME_ID_TARIFF));
Log.i("ASSOC", "id :" +id+"idtarrif :"+id_tariff+"id_concert :"+id_concert);
dataBase.insertAssocTariff(id, id_tariff, id_concert);
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return false;
}
return true;
}
public Boolean getAssocArtistsAndInsert(String json) {
String r = json.substring(8);
DatabaseHandler dataBase = new DatabaseHandler(context);
dataBase.open();
String decode = dataBase.decodePassword(r);
JSONArray rep;
try {
rep = new JSONArray(decode);
for (int i = 0 ; i<rep.length() ; i++){
JSONObject infoAssocArtist = rep.getJSONObject(i);
int id = Integer.parseInt(infoAssocArtist.getString(Tables.ASSOC_ARTIST_NAME_ID));
int id_concert = Integer.parseInt(infoAssocArtist.getString(Tables.ASSOC_ARTIST_NAME_ID_CONCERT));
int id_artist = Integer.parseInt(infoAssocArtist.getString(Tables.ASSOC_ARTIST_NAME_ID_ARTISTS));
Log.i("ASSOC", "id :" +id+"idartist:"+id_artist+"id_concert :"+id_concert);
dataBase.insertAssocArtist(id, id_artist, id_concert);
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return false;
}
return true;
}
public Boolean getAssocStylesAndInsert(String json) {
String r = json.substring(8);
DatabaseHandler dataBase = new DatabaseHandler(context);
dataBase.open();
String decode = dataBase.decodePassword(r);
JSONArray rep;
try {
rep = new JSONArray(decode);
for (int i = 0 ; i<rep.length() ; i++){
JSONObject infoAssocStyles = rep.getJSONObject(i);
int id = Integer.parseInt(infoAssocStyles.getString(Tables.ASSOC_STYLES_NAME_ID));
int id_style = Integer.parseInt(infoAssocStyles.getString(Tables.ASSOC_STYLES_NAME_ID_STYLES));
int id_concert = Integer.parseInt(infoAssocStyles.getString(Tables.ASSOC_STYLES_NAME_ID_CONCERT));
Log.i("ASSOC", "id :" +id+"idstyle :"+id_style+"id_concert :"+id_concert);
dataBase.insertAssocStyle(id, id_style, id_concert);
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return false;
}
return true;
}
public Boolean getStylesAndInsert(String json) {
String r = json.substring(8);
DatabaseHandler dataBase = new DatabaseHandler(context);
dataBase.open();
String decode = dataBase.decodePassword(r);
JSONArray rep;
try {
rep = new JSONArray(decode);
for (int i = 0 ; i<rep.length() ; i++){
JSONObject infoStyles = rep.getJSONObject(i);
int id = Integer.parseInt(infoStyles.getString(Tables.STYLE_NAME_ID));
String name = infoStyles.getString(Tables.STYLE_NAME_STYLE_NAME);
Log.i("ASSOC", "idStyle :" +id+"Name :"+name);
dataBase.insertStyle(id, name);
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return false;
}
return true;
}
public Boolean getArtistsAndInsert(String json) {
String r = json.substring(8);
DatabaseHandler dataBase = new DatabaseHandler(context);
dataBase.open();
String decode = dataBase.decodePassword(r);
JSONArray rep;
try {
rep = new JSONArray(decode);
for (int i = 0 ; i<rep.length() ; i++){
JSONObject infoArtists = rep.getJSONObject(i);
int id = Integer.parseInt(infoArtists.getString(Tables.ARTIST_NAME_ID));
String name = infoArtists.getString(Tables.ARTIST_NAME_ARTIST_NAME);
Log.i("ASSOC", "idArtist :" +id+"Name :"+name);
dataBase.insertArtist(id, name);
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return false;
}
return true;
}
public Boolean getTariffsAndInsert(String json){
String r = json.substring(8);
DatabaseHandler dataBase = new DatabaseHandler(context);
dataBase.open();
String decode = dataBase.decodePassword(r);
JSONArray rep;
try {
rep = new JSONArray(decode);
for (int i = 0 ; i<rep.length() ; i++){
JSONObject infoTarrif = rep.getJSONObject(i);
int id = Integer.parseInt(infoTarrif.getString(Tables.TARIFF_NAME_ID));
String label = infoTarrif.getString(Tables.TARIFF_NAME_LABEL);
Double price = infoTarrif.getDouble(Tables.TARIFF_NAME_PRICE);
dataBase.insertTariff(id, label, price);
}
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return false;
}
return true;
}
}
| 10,839 | 0.697638 | 0.695423 | 352 | 29.792614 | 27.347296 | 135 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 3.068182 | false | false |
12
|
f1af28c8cce81de3f91d07aa8d145fce1af18719
| 25,099,788,910,598 |
a4956432f81fbf6b7efa58435c76cd7272f3c6b8
|
/cafeteria/cafeteria-client-app/app/src/main/java/com/example/joao/cafeteria_client_app/Cafeteria/VoucherList.java
|
824250a8b7c9927987d0318ccf4d115a88bb0d25
|
[] |
no_license
|
joaofpereira/feup-cmov
|
https://github.com/joaofpereira/feup-cmov
|
7bf5bddc23b5797adb7e80b59f1386778589d969
|
e88c4e2dcbd7a6726fc0b4f06ce14782697487f7
|
refs/heads/master
| 2021-01-20T11:45:05.206000 | 2016-12-08T00:20:37 | 2016-12-08T00:20:37 | 71,115,283 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.joao.cafeteria_client_app.Cafeteria;
import android.util.Log;
import java.util.ArrayList;
import java.util.List;
public class VoucherList{
private static VoucherList instance = null;
private List<Voucher> vouchers;
public VoucherList() {
this.vouchers = new ArrayList<>();
}
public List<Voucher> getVouchers() {
return this.vouchers;
}
public void setVouchers(List<Voucher> vouchers) {
this.vouchers = vouchers;
}
public Voucher getVoucherByID(int id) {
for (Voucher v : vouchers)
if(v.getId() == id)
return v;
return null;
}
public static VoucherList getInstance() {
if (instance == null) {
instance = new VoucherList();
}
return instance;
}
public void deleteVoucher(int id){
for(int i = 0 ; i < vouchers.size(); i++){
if(vouchers.get(i).getId() == id)
vouchers.remove(i);
}
}
public String toString() {
String res = new String();
for(Voucher v : vouchers)
res += "serial number: " + v.getSerial() + "\n";
return res;
}
}
|
UTF-8
|
Java
| 1,207 |
java
|
VoucherList.java
|
Java
|
[
{
"context": "package com.example.joao.cafeteria_client_app.Cafeteria;\n\nimport android.u",
"end": 24,
"score": 0.8773677349090576,
"start": 20,
"tag": "USERNAME",
"value": "joao"
}
] | null |
[] |
package com.example.joao.cafeteria_client_app.Cafeteria;
import android.util.Log;
import java.util.ArrayList;
import java.util.List;
public class VoucherList{
private static VoucherList instance = null;
private List<Voucher> vouchers;
public VoucherList() {
this.vouchers = new ArrayList<>();
}
public List<Voucher> getVouchers() {
return this.vouchers;
}
public void setVouchers(List<Voucher> vouchers) {
this.vouchers = vouchers;
}
public Voucher getVoucherByID(int id) {
for (Voucher v : vouchers)
if(v.getId() == id)
return v;
return null;
}
public static VoucherList getInstance() {
if (instance == null) {
instance = new VoucherList();
}
return instance;
}
public void deleteVoucher(int id){
for(int i = 0 ; i < vouchers.size(); i++){
if(vouchers.get(i).getId() == id)
vouchers.remove(i);
}
}
public String toString() {
String res = new String();
for(Voucher v : vouchers)
res += "serial number: " + v.getSerial() + "\n";
return res;
}
}
| 1,207 | 0.56338 | 0.562552 | 55 | 20.945454 | 18.381233 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.345455 | false | false |
12
|
1176089e8e63fcfa3d861839f398f705c3d37d44
| 16,810,502,057,927 |
b606119f5f1949893e780c23c23c200ba198c718
|
/src/ch04/CalculateNextArray.java
|
5d09fea7f93d0ca87fe87120aaadec79dc3e4aa0
|
[] |
no_license
|
3mol/DataSructure_note_resource
|
https://github.com/3mol/DataSructure_note_resource
|
207cfa83aa403ee1f984837ffa5d5d327484ae14
|
9a14cec649979a461ba9bdcd2a23d315a97df658
|
refs/heads/master
| 2020-04-20T00:40:53.774000 | 2019-01-31T13:16:56 | 2019-01-31T13:16:56 | 168,527,156 | 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 ch04;
/**
*
* @author Administrator
*/
public class CalculateNextArray extends SeqString {
public static void main(String[] args) {
int[] next,nextval;
String s="ababaab";
CalculateNextArray cna=new CalculateNextArray();
next=cna.getNext(new SeqString(s));
System.out.println(s+"的next数组值为:");
for(int j=0;j<next.length;j++)
System.out.print(next[j]);
System.out.println();
nextval=cna.getNextVal(new SeqString(s));
System.out.println(s+"的nextval数组值为:");
for(int j=0;j<nextval.length;j++)
System.out.print(nextval[j]);
System.out.println();
}
}
|
UTF-8
|
Java
| 805 |
java
|
CalculateNextArray.java
|
Java
|
[
{
"context": " the editor.\n */\npackage ch04;\n\n\n/**\n *\n * @author Administrator\n */\npublic class CalculateNextArray extends SeqSt",
"end": 148,
"score": 0.9822981953620911,
"start": 135,
"tag": "NAME",
"value": "Administrator"
}
] | null |
[] |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ch04;
/**
*
* @author Administrator
*/
public class CalculateNextArray extends SeqString {
public static void main(String[] args) {
int[] next,nextval;
String s="ababaab";
CalculateNextArray cna=new CalculateNextArray();
next=cna.getNext(new SeqString(s));
System.out.println(s+"的next数组值为:");
for(int j=0;j<next.length;j++)
System.out.print(next[j]);
System.out.println();
nextval=cna.getNextVal(new SeqString(s));
System.out.println(s+"的nextval数组值为:");
for(int j=0;j<nextval.length;j++)
System.out.print(nextval[j]);
System.out.println();
}
}
| 805 | 0.609756 | 0.604621 | 29 | 25.862068 | 19.141441 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.655172 | false | false |
12
|
f3be71f4e69c810af6836d3451c91f348828d588
| 34,952,443,908,931 |
cf05ded1829fca1188b2619eaa15415059b94333
|
/yuanlinjinguan/kernel/core-base/src/main/java/com/zjzmjr/core/base/util/PropertiesValueUtil.java
|
47ecefe7a1d2c2d7c4771c94e40c240473e777d1
|
[] |
no_license
|
microspeed2018/project
|
https://github.com/microspeed2018/project
|
bf2499fa3c5508aed39ffd067c9f23808b3f6d59
|
06ac9129275b336543b2ba7fedc6b0b2e54d61d1
|
refs/heads/master
| 2021-04-27T20:00:13.985000 | 2018-02-28T07:18:00 | 2018-02-28T07:18:00 | 122,367,753 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.zjzmjr.core.base.util;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* 类里面的变量处理的工具类
*
* @author oms
* @version $Id: PropertiesValueUtil.java, v 0.1 2016-11-10 下午2:50:51 oms Exp $
* @param <T>
*/
public class PropertiesValueUtil {
private static final Logger logger = LoggerFactory.getLogger(PropertiesValueUtil.class);
/**
* 设置类里面所有的BigDecimal类型的变量,给予初期值
*
* @param bean
*/
@SuppressWarnings("rawtypes")
public static void setBigDecimalValue(Object bean) {
Class clazz = bean.getClass();
Field[] fields = clazz.getDeclaredFields();
Class typeClazz = null;
try {
for (Field field : fields) {
typeClazz = field.getType();
if ("java.math.BigDecimal".equals(typeClazz.getName())) {
field.setAccessible(true);
field.set(bean, BigDecimal.ZERO);
}
}
} catch (IllegalArgumentException e) {
logger.error("", e);
} catch (IllegalAccessException e) {
logger.error("", e);
}
}
/**
* 暂时没有写完全的类方法
*
* @param srcClazz
* @param destClazz
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public <T, V> void copyBeans(T srcClazz, V destClazz) {
Class<T> copySrc = (Class<T>) srcClazz.getClass();
Class<V> destSrc = (Class<V>) destClazz.getClass();
Field[] srcFields = copySrc.getDeclaredFields();
Field[] destFields = destSrc.getDeclaredFields();
Class typeClazz = null;
try {
for (Field field : srcFields) {
typeClazz = field.getType();
for (Field destField : destFields) {
if(field.getName().equals(destField.getName())){
// 暂未写完全
if ("java.math.BigDecimal".equals(typeClazz.getName())) {
field.setAccessible(true);
field.set(destClazz, BigDecimal.ZERO);
}
}
}
}
} catch (IllegalArgumentException e) {
logger.error("", e);
} catch (IllegalAccessException e) {
logger.error("", e);
}
}
}
|
UTF-8
|
Java
| 2,508 |
java
|
PropertiesValueUtil.java
|
Java
|
[
{
"context": "LoggerFactory;\n\n/**\n * 类里面的变量处理的工具类\n * \n * @author oms\n * @version $Id: PropertiesValueUtil.java, v 0.1 ",
"end": 194,
"score": 0.9997254610061646,
"start": 191,
"tag": "USERNAME",
"value": "oms"
}
] | null |
[] |
package com.zjzmjr.core.base.util;
import java.lang.reflect.Field;
import java.math.BigDecimal;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* 类里面的变量处理的工具类
*
* @author oms
* @version $Id: PropertiesValueUtil.java, v 0.1 2016-11-10 下午2:50:51 oms Exp $
* @param <T>
*/
public class PropertiesValueUtil {
private static final Logger logger = LoggerFactory.getLogger(PropertiesValueUtil.class);
/**
* 设置类里面所有的BigDecimal类型的变量,给予初期值
*
* @param bean
*/
@SuppressWarnings("rawtypes")
public static void setBigDecimalValue(Object bean) {
Class clazz = bean.getClass();
Field[] fields = clazz.getDeclaredFields();
Class typeClazz = null;
try {
for (Field field : fields) {
typeClazz = field.getType();
if ("java.math.BigDecimal".equals(typeClazz.getName())) {
field.setAccessible(true);
field.set(bean, BigDecimal.ZERO);
}
}
} catch (IllegalArgumentException e) {
logger.error("", e);
} catch (IllegalAccessException e) {
logger.error("", e);
}
}
/**
* 暂时没有写完全的类方法
*
* @param srcClazz
* @param destClazz
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
public <T, V> void copyBeans(T srcClazz, V destClazz) {
Class<T> copySrc = (Class<T>) srcClazz.getClass();
Class<V> destSrc = (Class<V>) destClazz.getClass();
Field[] srcFields = copySrc.getDeclaredFields();
Field[] destFields = destSrc.getDeclaredFields();
Class typeClazz = null;
try {
for (Field field : srcFields) {
typeClazz = field.getType();
for (Field destField : destFields) {
if(field.getName().equals(destField.getName())){
// 暂未写完全
if ("java.math.BigDecimal".equals(typeClazz.getName())) {
field.setAccessible(true);
field.set(destClazz, BigDecimal.ZERO);
}
}
}
}
} catch (IllegalArgumentException e) {
logger.error("", e);
} catch (IllegalAccessException e) {
logger.error("", e);
}
}
}
| 2,508 | 0.529046 | 0.521992 | 79 | 29.506329 | 22.380978 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.43038 | false | false |
12
|
8dc983d1cdd489f139d549a1d8da37399e0d4a39
| 34,797,825,087,780 |
cab1bdb8044cfc0dce60eef696c060b0d99936cd
|
/src/com/sparsity/sparksee/tutorial/utils/CommunityExport.java
|
5c82ccc19a78204888aed414e599b320a6e65a25
|
[] |
no_license
|
SparsityTechnologies/sparksee-handson
|
https://github.com/SparsityTechnologies/sparksee-handson
|
d6038a37534658467a78cffc6598783fa87dde4a
|
fe3bd5b620d6e4d89819f5d30b403a98ced6064f
|
refs/heads/master
| 2020-05-23T10:20:11.457000 | 2017-02-01T09:55:01 | 2017-02-01T09:55:01 | 80,422,121 | 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 com.sparsity.sparksee.tutorial.utils;
import com.sparsity.sparksee.gdb.EdgeExport;
import com.sparsity.sparksee.gdb.ExportManager;
import com.sparsity.sparksee.gdb.Graph;
import com.sparsity.sparksee.gdb.GraphExport;
import com.sparsity.sparksee.gdb.NodeExport;
import com.sparsity.sparksee.gdb.NodeShape;
import com.sparsity.sparksee.gdb.Type;
import com.sparsity.sparksee.gdb.Value;
import java.awt.Color;
/**
* Update this Export implementation to update the resulting
* visualization.
*
* @see ExportManager
* @see NodeExport
* @see EdgeExport
* @see GraphExport
*/
public class CommunityExport extends ExportManager {
private Graph g = null;
private int userType = Type.InvalidType;
private int nicknameType = Type.InvalidType;
private int labelType = Type.InvalidType;
private int knowsType = Type.InvalidType;
Color colorArray[] = new Color[12];
@Override
public void prepare(Graph graph) {
g = graph;
userType = g.findType("User");
if( userType != Type.InvalidType ) {
nicknameType = g.findAttribute(userType, "nickname");
labelType = g.findAttribute(userType,"label");
}
knowsType = g.findType("knows");
colorArray[0] = Color.RED;
colorArray[1] = Color.BLUE;
colorArray[2] = Color.CYAN;
colorArray[3] = Color.GRAY;
colorArray[4] = Color.ORANGE;
colorArray[5] = Color.MAGENTA;
colorArray[6] = Color.PINK;
colorArray[7] = Color.YELLOW;
colorArray[8] = Color.decode("#008080");
colorArray[9] = Color.LIGHT_GRAY;
colorArray[10] = Color.DARK_GRAY;
colorArray[11] = Color.GREEN;
}
@Override
public void release() {
}
@Override
public boolean getGraph(GraphExport ge) {
ge.setDefaults();
return true;
}
@Override
public boolean getNodeType(int nodetype, NodeExport ne) {
return false;
}
@Override
public boolean getEdgeType(int i, EdgeExport ee) {
return false;
}
@Override
public boolean getNode(long nodeOID, NodeExport ne) {
ne.setDefaults();
int nodeType = g.getObjectType(nodeOID);
if (userType == nodeType ) {
if(g.getAttribute(nodeOID,labelType).getInteger() == -1) return false;
ne.setShape(NodeShape.Round);
Value v = g.getAttribute(nodeOID, labelType);
ne.setColor(colorArray[v.getInteger() % 12]);
ne.setLabel(g.getAttribute(nodeOID, nicknameType ).getString()+"["+v.getInteger()+"]");
return true;
}
return false;
}
@Override
public boolean getEdge(long edgeOID, EdgeExport ee) {
ee.setDefaults();
Type t = g.getType(g.getObjectType(edgeOID));
ee.setLabel(" ");
ee.setWidth(1);
ee.setAsDirected(false);
return true;
}
@Override
public boolean enableType(int i) {
return i == userType || i == knowsType;
}
}
|
UTF-8
|
Java
| 3,622 |
java
|
CommunityExport.java
|
Java
|
[] | 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 com.sparsity.sparksee.tutorial.utils;
import com.sparsity.sparksee.gdb.EdgeExport;
import com.sparsity.sparksee.gdb.ExportManager;
import com.sparsity.sparksee.gdb.Graph;
import com.sparsity.sparksee.gdb.GraphExport;
import com.sparsity.sparksee.gdb.NodeExport;
import com.sparsity.sparksee.gdb.NodeShape;
import com.sparsity.sparksee.gdb.Type;
import com.sparsity.sparksee.gdb.Value;
import java.awt.Color;
/**
* Update this Export implementation to update the resulting
* visualization.
*
* @see ExportManager
* @see NodeExport
* @see EdgeExport
* @see GraphExport
*/
public class CommunityExport extends ExportManager {
private Graph g = null;
private int userType = Type.InvalidType;
private int nicknameType = Type.InvalidType;
private int labelType = Type.InvalidType;
private int knowsType = Type.InvalidType;
Color colorArray[] = new Color[12];
@Override
public void prepare(Graph graph) {
g = graph;
userType = g.findType("User");
if( userType != Type.InvalidType ) {
nicknameType = g.findAttribute(userType, "nickname");
labelType = g.findAttribute(userType,"label");
}
knowsType = g.findType("knows");
colorArray[0] = Color.RED;
colorArray[1] = Color.BLUE;
colorArray[2] = Color.CYAN;
colorArray[3] = Color.GRAY;
colorArray[4] = Color.ORANGE;
colorArray[5] = Color.MAGENTA;
colorArray[6] = Color.PINK;
colorArray[7] = Color.YELLOW;
colorArray[8] = Color.decode("#008080");
colorArray[9] = Color.LIGHT_GRAY;
colorArray[10] = Color.DARK_GRAY;
colorArray[11] = Color.GREEN;
}
@Override
public void release() {
}
@Override
public boolean getGraph(GraphExport ge) {
ge.setDefaults();
return true;
}
@Override
public boolean getNodeType(int nodetype, NodeExport ne) {
return false;
}
@Override
public boolean getEdgeType(int i, EdgeExport ee) {
return false;
}
@Override
public boolean getNode(long nodeOID, NodeExport ne) {
ne.setDefaults();
int nodeType = g.getObjectType(nodeOID);
if (userType == nodeType ) {
if(g.getAttribute(nodeOID,labelType).getInteger() == -1) return false;
ne.setShape(NodeShape.Round);
Value v = g.getAttribute(nodeOID, labelType);
ne.setColor(colorArray[v.getInteger() % 12]);
ne.setLabel(g.getAttribute(nodeOID, nicknameType ).getString()+"["+v.getInteger()+"]");
return true;
}
return false;
}
@Override
public boolean getEdge(long edgeOID, EdgeExport ee) {
ee.setDefaults();
Type t = g.getType(g.getObjectType(edgeOID));
ee.setLabel(" ");
ee.setWidth(1);
ee.setAsDirected(false);
return true;
}
@Override
public boolean enableType(int i) {
return i == userType || i == knowsType;
}
}
| 3,622 | 0.565986 | 0.558807 | 114 | 30.771931 | 21.341845 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.587719 | false | false |
12
|
5a9706018a45876169e11f163d64a1fd356a531c
| 19,009,525,311,669 |
fddf8dc978b53476a8d958517d3360e7f4301790
|
/EndlessRunner/src/shaders/ShaderTerreno.java
|
74b2bc238f427add5926581b56d14a6d747df5bf
|
[] |
no_license
|
jufracaqui/3D-OpenGL-Engine
|
https://github.com/jufracaqui/3D-OpenGL-Engine
|
cbab9309a5cbcebf598d2838ab4b8d06c03edb95
|
4a2d969904551eb353a0d6d8a8a0ac3c4ae07c7e
|
refs/heads/master
| 2020-03-09T04:03:01.380000 | 2018-04-08T01:03:48 | 2018-04-08T01:03:48 | 128,578,655 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package shaders;
import org.lwjglx.util.vector.Matrix4f;
import org.lwjglx.util.vector.Vector3f;
import entidades.Camara;
import entidades.Luz;
import utiles.Maths;
public class ShaderTerreno extends Shader{
private static final String ARCHIVO_VERTEX = "src/shaders/vertexShaderTerreno.txt";
private static final String ARCHIVO_FRAGMENT = "src/shaders/fragmentShaderTerreno.txt";
private int posicion_matrizTransformada, posicion_matrizProyeccion, posicion_matrizVision,
posicion_posicionLuz, posicion_colorLuz, posicion_cantidadBrillo, posicion_reflectividad,
posicion_colorCielo, posicion_texturaFondo, posicion_texturaR, posicion_texturaG, posicion_texturaB,
posicion_mapaFundido;
public ShaderTerreno() {
super(ARCHIVO_VERTEX, ARCHIVO_FRAGMENT);
}
@Override
protected void obtenerPosicionesUniformes() {
posicion_matrizTransformada = super.obtenerPosicionUniforme("matrizTransformada");
posicion_matrizProyeccion = super.obtenerPosicionUniforme("matrizProyeccion");
posicion_matrizVision = super.obtenerPosicionUniforme("matrizVision");
posicion_posicionLuz = super.obtenerPosicionUniforme("posicionLuz");
posicion_colorLuz = super.obtenerPosicionUniforme("colorLuz");
posicion_cantidadBrillo = super.obtenerPosicionUniforme("cantidadBrillo");
posicion_reflectividad = super.obtenerPosicionUniforme("reflectividad");
posicion_colorCielo = super.obtenerPosicionUniforme("colorCielo");
posicion_texturaFondo = super.obtenerPosicionUniforme("texturaFondo");
posicion_texturaR = super.obtenerPosicionUniforme("texturaR");
posicion_texturaG = super.obtenerPosicionUniforme("texturaG");
posicion_texturaB = super.obtenerPosicionUniforme("texturaB");
posicion_mapaFundido = super.obtenerPosicionUniforme("mapaFundido");
}
@Override
protected void bindearAtributos() {
super.bindearAtributos(0, "posicion");
super.bindearAtributos(1, "coordenadasTextura");
super.bindearAtributos(2, "normal");
}
public void conectarUnidadesTexturas(){
super.cargarInt(posicion_texturaFondo, 0);
super.cargarInt(posicion_texturaR, 1);
super.cargarInt(posicion_texturaG, 2);
super.cargarInt(posicion_texturaB, 3);
super.cargarInt(posicion_mapaFundido, 4);
}
public void cargarColorCielo(float r, float g, float b){
super.cargarVector(posicion_colorCielo, new Vector3f(r, g, b));
}
public void cargarVariablesBrillo(float cantidadBrillo, float reflectividad){
super.cargarFloat(posicion_cantidadBrillo, cantidadBrillo);
super.cargarFloat(posicion_reflectividad, reflectividad);
}
public void cargarMatrizTransformada(Matrix4f matriz){
super.cargarMatriz(posicion_matrizTransformada, matriz);
}
public void cargarLuz(Luz luz){
super.cargarVector(posicion_posicionLuz, luz.getPosicion());
super.cargarVector(posicion_colorLuz, luz.getColor());
}
public void cargarMatrizVision(Camara camara){
Matrix4f matrizVision = Maths.createViewMatrix(camara);
super.cargarMatriz(posicion_matrizVision, matrizVision);
}
public void cargarMatrizProyectada(Matrix4f proyeccion){
super.cargarMatriz(posicion_matrizProyeccion, proyeccion);
}
}
|
UTF-8
|
Java
| 3,120 |
java
|
ShaderTerreno.java
|
Java
|
[] | null |
[] |
package shaders;
import org.lwjglx.util.vector.Matrix4f;
import org.lwjglx.util.vector.Vector3f;
import entidades.Camara;
import entidades.Luz;
import utiles.Maths;
public class ShaderTerreno extends Shader{
private static final String ARCHIVO_VERTEX = "src/shaders/vertexShaderTerreno.txt";
private static final String ARCHIVO_FRAGMENT = "src/shaders/fragmentShaderTerreno.txt";
private int posicion_matrizTransformada, posicion_matrizProyeccion, posicion_matrizVision,
posicion_posicionLuz, posicion_colorLuz, posicion_cantidadBrillo, posicion_reflectividad,
posicion_colorCielo, posicion_texturaFondo, posicion_texturaR, posicion_texturaG, posicion_texturaB,
posicion_mapaFundido;
public ShaderTerreno() {
super(ARCHIVO_VERTEX, ARCHIVO_FRAGMENT);
}
@Override
protected void obtenerPosicionesUniformes() {
posicion_matrizTransformada = super.obtenerPosicionUniforme("matrizTransformada");
posicion_matrizProyeccion = super.obtenerPosicionUniforme("matrizProyeccion");
posicion_matrizVision = super.obtenerPosicionUniforme("matrizVision");
posicion_posicionLuz = super.obtenerPosicionUniforme("posicionLuz");
posicion_colorLuz = super.obtenerPosicionUniforme("colorLuz");
posicion_cantidadBrillo = super.obtenerPosicionUniforme("cantidadBrillo");
posicion_reflectividad = super.obtenerPosicionUniforme("reflectividad");
posicion_colorCielo = super.obtenerPosicionUniforme("colorCielo");
posicion_texturaFondo = super.obtenerPosicionUniforme("texturaFondo");
posicion_texturaR = super.obtenerPosicionUniforme("texturaR");
posicion_texturaG = super.obtenerPosicionUniforme("texturaG");
posicion_texturaB = super.obtenerPosicionUniforme("texturaB");
posicion_mapaFundido = super.obtenerPosicionUniforme("mapaFundido");
}
@Override
protected void bindearAtributos() {
super.bindearAtributos(0, "posicion");
super.bindearAtributos(1, "coordenadasTextura");
super.bindearAtributos(2, "normal");
}
public void conectarUnidadesTexturas(){
super.cargarInt(posicion_texturaFondo, 0);
super.cargarInt(posicion_texturaR, 1);
super.cargarInt(posicion_texturaG, 2);
super.cargarInt(posicion_texturaB, 3);
super.cargarInt(posicion_mapaFundido, 4);
}
public void cargarColorCielo(float r, float g, float b){
super.cargarVector(posicion_colorCielo, new Vector3f(r, g, b));
}
public void cargarVariablesBrillo(float cantidadBrillo, float reflectividad){
super.cargarFloat(posicion_cantidadBrillo, cantidadBrillo);
super.cargarFloat(posicion_reflectividad, reflectividad);
}
public void cargarMatrizTransformada(Matrix4f matriz){
super.cargarMatriz(posicion_matrizTransformada, matriz);
}
public void cargarLuz(Luz luz){
super.cargarVector(posicion_posicionLuz, luz.getPosicion());
super.cargarVector(posicion_colorLuz, luz.getColor());
}
public void cargarMatrizVision(Camara camara){
Matrix4f matrizVision = Maths.createViewMatrix(camara);
super.cargarMatriz(posicion_matrizVision, matrizVision);
}
public void cargarMatrizProyectada(Matrix4f proyeccion){
super.cargarMatriz(posicion_matrizProyeccion, proyeccion);
}
}
| 3,120 | 0.798077 | 0.79359 | 83 | 36.590363 | 30.202145 | 101 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.108434 | false | false |
12
|
e215e813aac8a174a1aad11a021d014d74aa49bd
| 2,250,562,923,677 |
4e4279e4c43890d105c7dbe7dc96c3c623c1ec0b
|
/afiliados-tests/test-aff-inscription-consumer-ws/src/test/java/uol/test/step/das/DASServiceWhenSteps.java
|
c881eaf67199e4bdfe699c11e2f834f7a3feb8cb
|
[] |
no_license
|
proctiger/automation
|
https://github.com/proctiger/automation
|
d7550988bb9528dab9af08867a22d6c8e295df18
|
8a2d8169d21ec6ae9a52c89b27164b05a76ce7b6
|
refs/heads/master
| 2016-09-15T22:25:05.094000 | 2013-11-27T13:50:43 | 2013-11-27T13:50:43 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package uol.test.step.das;
import java.util.HashMap;
import java.util.Map;
import cucumber.api.java.pt.Quando;
public class DASServiceWhenSteps extends AbstractDASServiceSteps{
@Quando("^salvar o valor <(.+)> na variavel <(.+)> para a assinatura <(.+)>$")
public void persist(String value, String key, Long idtInscription) throws Exception {
System.out.println("\n -> Quando salvar o valor <"+value+"> na variavel <"+key+"> para a assinatura <"+idtInscription+">\n");
Map<String, String> map = new HashMap<String, String>(1);
map.put(key, value);
subscriptionService.persistExtraInscriptionData(idtInscription, map);
System.out.println("\n <- Quando salvar o valor <"+value+"> na variavel <"+key+"> para a assinatura <"+idtInscription+">\n");
}
}
|
UTF-8
|
Java
| 797 |
java
|
DASServiceWhenSteps.java
|
Java
|
[] | null |
[] |
package uol.test.step.das;
import java.util.HashMap;
import java.util.Map;
import cucumber.api.java.pt.Quando;
public class DASServiceWhenSteps extends AbstractDASServiceSteps{
@Quando("^salvar o valor <(.+)> na variavel <(.+)> para a assinatura <(.+)>$")
public void persist(String value, String key, Long idtInscription) throws Exception {
System.out.println("\n -> Quando salvar o valor <"+value+"> na variavel <"+key+"> para a assinatura <"+idtInscription+">\n");
Map<String, String> map = new HashMap<String, String>(1);
map.put(key, value);
subscriptionService.persistExtraInscriptionData(idtInscription, map);
System.out.println("\n <- Quando salvar o valor <"+value+"> na variavel <"+key+"> para a assinatura <"+idtInscription+">\n");
}
}
| 797 | 0.683814 | 0.68256 | 17 | 45 | 42.650425 | 130 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.352941 | false | false |
12
|
c674f8c4ee37528c5f9b4e2e59d3f0256401388f
| 2,250,562,923,142 |
13817ea0d2b2408040c866ffa88980f25d7cd956
|
/app/src/main/java/com/example/wuzihao/myfood/MyFoodMenu.java
|
619d0192426748d0b929b6d3586b9899714c48ed
|
[] |
no_license
|
j6y3cl6/MyFood
|
https://github.com/j6y3cl6/MyFood
|
ce6372f5a7e673cb237cbdf646c7942684bba3ee
|
ab6e0639386870b0942d57546bcc633b86016e09
|
refs/heads/master
| 2020-12-24T12:39:30.249000 | 2016-11-19T03:54:14 | 2016-11-19T03:54:14 | 72,972,304 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.wuzihao.myfood;
/**
* Created by wuzihao on 2016/11/16.
*/
public class MyFoodMenu {
private String name;
private String tag;
private String addr;
public MyFoodMenu(String name,String tag,String addr){
this.name = name;
this.tag = tag;
this.addr = addr;
}
public String getName(){
return this.name;
}
public String getTag(){
return this.tag;
}
public String getAddr(){
return this.addr;
}
public void setName(String name){
this.name = name;
}
public void setTag(String tag){
this.tag = tag;
}
public void setAddr(String addr){
this.addr = addr;
}
}
|
UTF-8
|
Java
| 716 |
java
|
MyFoodMenu.java
|
Java
|
[
{
"context": "age com.example.wuzihao.myfood;\n\n/**\n * Created by wuzihao on 2016/11/16.\n */\n\npublic class MyFoodMenu {\n ",
"end": 62,
"score": 0.9996095895767212,
"start": 55,
"tag": "USERNAME",
"value": "wuzihao"
}
] | null |
[] |
package com.example.wuzihao.myfood;
/**
* Created by wuzihao on 2016/11/16.
*/
public class MyFoodMenu {
private String name;
private String tag;
private String addr;
public MyFoodMenu(String name,String tag,String addr){
this.name = name;
this.tag = tag;
this.addr = addr;
}
public String getName(){
return this.name;
}
public String getTag(){
return this.tag;
}
public String getAddr(){
return this.addr;
}
public void setName(String name){
this.name = name;
}
public void setTag(String tag){
this.tag = tag;
}
public void setAddr(String addr){
this.addr = addr;
}
}
| 716 | 0.581006 | 0.569832 | 37 | 18.351351 | 14.302176 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.405405 | false | false |
12
|
0a573c78261d27960cfebc4c102c9b002c68cda0
| 27,745,488,755,681 |
c90870d96098739728ed49e92c6c333fbaef09e1
|
/src/main/java/fr/istic/mutantGenerator/MutantGenerator.java
|
ab377176c58bc74067255f1c607ee1f2cab4fcb8
|
[] |
no_license
|
gbrossault/VV_MutationTesting_1718
|
https://github.com/gbrossault/VV_MutationTesting_1718
|
e096f08a85a5af1db3450d33eaa5e4545c66a812
|
fd9b4ec806a9554f4e275983415ac16070a1d63b
|
refs/heads/master
| 2021-08-31T20:44:08.992000 | 2017-12-22T21:02:21 | 2017-12-22T21:02:21 | 115,115,869 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package fr.istic.mutantGenerator;
import java.io.IOException;
import java.util.List;
import fr.istic.classFinder.ClassLoader;
import fr.istic.mutationTarget.MutationTarget;
import javassist.CannotCompileException;
import javassist.CtClass;
import javassist.CtMethod;
import javassist.NotFoundException;
import javassist.bytecode.BadBytecode;
import javassist.bytecode.CodeAttribute;
import javassist.bytecode.CodeIterator;
public class MutantGenerator {
public String scannedPackage;
public void mutateProjectForOperation(List<MutationTarget> targets, String path, String mutantPath) throws NotFoundException, BadBytecode, IOException {
FileTools.copyFolderToFolder(path,"", path, mutantPath);
ClassLoader loader = new ClassLoader(mutantPath);
for(MutationTarget target : targets) {
CtClass ctclass = loader.getCtClass(target.getPackageName(), target.getCtClassName().replace(".class", ""));
CtMethod ctMethod = loader.getMethodByName(ctclass, target.getCtMethodName());
CodeAttribute ca = ctMethod.getMethodInfo().getCodeAttribute();
CodeIterator ci = ca.iterator();
while (ci.hasNext()) {
int index = ci.next();
if(index == target.getTargetIndex()){
int valueOfIndex8Bit = ci.byteAt(index);
if(valueOfIndex8Bit==target.getCurrentInstructions()) {
ci.writeByte(target.getMutatedInstructions(), index);
break;
}
}
}
}
}
public void mutateProjectForVoidMetho(List<MutationTarget> targets, String path, String mutantPath) throws NotFoundException, BadBytecode, IOException, CannotCompileException {
FileTools.copyFolderToFolder(path,"", path, mutantPath);
ClassLoader loader = new ClassLoader(mutantPath);
for(MutationTarget target : targets) {
CtClass ctclass = loader.getCtClass(target.getPackageName(), target.getCtClassName().replace(".class", ""));
CtMethod ctMethod = loader.getMethodByName(ctclass, target.getCtMethodName());
ctMethod.setBody("");
}
}
}
|
UTF-8
|
Java
| 2,143 |
java
|
MutantGenerator.java
|
Java
|
[] | null |
[] |
package fr.istic.mutantGenerator;
import java.io.IOException;
import java.util.List;
import fr.istic.classFinder.ClassLoader;
import fr.istic.mutationTarget.MutationTarget;
import javassist.CannotCompileException;
import javassist.CtClass;
import javassist.CtMethod;
import javassist.NotFoundException;
import javassist.bytecode.BadBytecode;
import javassist.bytecode.CodeAttribute;
import javassist.bytecode.CodeIterator;
public class MutantGenerator {
public String scannedPackage;
public void mutateProjectForOperation(List<MutationTarget> targets, String path, String mutantPath) throws NotFoundException, BadBytecode, IOException {
FileTools.copyFolderToFolder(path,"", path, mutantPath);
ClassLoader loader = new ClassLoader(mutantPath);
for(MutationTarget target : targets) {
CtClass ctclass = loader.getCtClass(target.getPackageName(), target.getCtClassName().replace(".class", ""));
CtMethod ctMethod = loader.getMethodByName(ctclass, target.getCtMethodName());
CodeAttribute ca = ctMethod.getMethodInfo().getCodeAttribute();
CodeIterator ci = ca.iterator();
while (ci.hasNext()) {
int index = ci.next();
if(index == target.getTargetIndex()){
int valueOfIndex8Bit = ci.byteAt(index);
if(valueOfIndex8Bit==target.getCurrentInstructions()) {
ci.writeByte(target.getMutatedInstructions(), index);
break;
}
}
}
}
}
public void mutateProjectForVoidMetho(List<MutationTarget> targets, String path, String mutantPath) throws NotFoundException, BadBytecode, IOException, CannotCompileException {
FileTools.copyFolderToFolder(path,"", path, mutantPath);
ClassLoader loader = new ClassLoader(mutantPath);
for(MutationTarget target : targets) {
CtClass ctclass = loader.getCtClass(target.getPackageName(), target.getCtClassName().replace(".class", ""));
CtMethod ctMethod = loader.getMethodByName(ctclass, target.getCtMethodName());
ctMethod.setBody("");
}
}
}
| 2,143 | 0.699953 | 0.69902 | 50 | 41.860001 | 37.626591 | 180 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.68 | false | false |
12
|
77efa04bfc704e1b7b3a350171cc144a7c69e82d
| 26,456,998,557,349 |
e7215419d756917e715d548496acdfec595f4e39
|
/i06comparaletraarray/MiTarea.java
|
50bb94017282230ce5dc1091e71c35ddfe2cae7f
|
[] |
no_license
|
fakus18/Java_fx
|
https://github.com/fakus18/Java_fx
|
d9d4562510e2c3e851e4ed9c4f6945b06854570e
|
53eb49f0de4cddf49832966d04f48dc6992e7ed1
|
refs/heads/main
| 2022-12-31T09:36:34.396000 | 2020-10-29T12:23:07 | 2020-10-29T12:23:07 | 306,289,097 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package i06comparaletraarray;
import java.util.ArrayList;
import javafx.concurrent.Task;
public class MiTarea extends Task< ArrayList<Contacto>> {
private String nombre_buscado;
public MiTarea(String nombew_buscado) {
this.nombre_buscado = nombew_buscado;
}
@Override
protected ArrayList<Contacto> call() throws Exception {
ArrayList<Contacto> lista_contactos = AccesoDatos.buscarContacto(nombre_buscado);
updateMessage("Buscado: " + lista_contactos);
return lista_contactos;
};
}
|
UTF-8
|
Java
| 568 |
java
|
MiTarea.java
|
Java
|
[] | null |
[] |
package i06comparaletraarray;
import java.util.ArrayList;
import javafx.concurrent.Task;
public class MiTarea extends Task< ArrayList<Contacto>> {
private String nombre_buscado;
public MiTarea(String nombew_buscado) {
this.nombre_buscado = nombew_buscado;
}
@Override
protected ArrayList<Contacto> call() throws Exception {
ArrayList<Contacto> lista_contactos = AccesoDatos.buscarContacto(nombre_buscado);
updateMessage("Buscado: " + lista_contactos);
return lista_contactos;
};
}
| 568 | 0.679577 | 0.676056 | 23 | 22.695652 | 24.938942 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.391304 | false | false |
12
|
8f44e5fccaa0efb750980e44086e753a9be69f5c
| 1,159,641,201,676 |
ad8cb30031963eaa8a67fe91146043ae59238603
|
/wlgdo-common/src/main/java/Ognl.java
|
3ced1154c00912a4d66066db6232307e1d2baac4
|
[] |
no_license
|
wligang/wlgdo
|
https://github.com/wligang/wlgdo
|
82b69c0c7cea1ee075477b771d74c208d335d218
|
0b67c566243aad55bd6c7855bed968fb67cc2c76
|
refs/heads/master
| 2022-03-26T22:31:34.700000 | 2019-12-23T15:53:03 | 2019-12-23T15:53:03 | 113,079,396 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.util.Collection;
import java.util.Date;
import java.util.Map;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
public class Ognl {
/**
* 使用ognl扩展 该功能为,根据传入的值, 如果值为0,则 ... 。 如果值为1,则 ... 。
* @return
*/
public static boolean isSolve(Object o, String soleState) {
if (o == null) {
return false;
}
String str = null;
if (o instanceof String[]) {
String[] objects = (String[]) o;
str = objects[0];
} else if (o instanceof Character) {
Character c = (Character) o;
str = Character.toString(c);
} else if (o instanceof String) {
String s = (String) o;
str = s;
}
if (soleState.equals(str)) {
return true;
} else {
return false;
}
}
/**
* 可以用于判断 Map,Collection,String,Array是否为空
*
* @param o
* @return
*/
public static boolean isEmpty(Object o) throws IllegalArgumentException {
if (o == null)
return true;
if (o instanceof String) {
return StringUtils.isEmpty((String) o);
} else if (o instanceof Collection) {
return CollectionUtils.isEmpty((Collection<?>) o);
} else if (o.getClass().isArray()) {
return ArrayUtils.isEmpty((Object[]) o);
} else if (o instanceof Map) {
MapUtils.isEmpty((Map<?, ?>) o);
} else if (o instanceof Date) {
return o == null;
} else if (o instanceof Number) {
return o == null;
} else if (o instanceof Boolean) {
return o == null;
} else {
throw new IllegalArgumentException(
"Illegal argument type,must be : Map,Collection,Array,String. but was:" + o.getClass());
}
return false;
}
/**
* 可以用于判断 Map,Collection,String,Array是否不为空
*
* @param o
* @return
*/
public static boolean isNotEmpty(Object o) {
return !isEmpty(o);
}
public static boolean isNotEmpty(Object... objects) {
if (objects == null)
return false;
for (Object obj : objects) {
if (isEmpty(obj)) {
return false;
}
;
}
return true;
}
public static boolean isNotBlank(Object o) {
return !isBlank(o);
}
public static boolean isBlank(Object o) {
return StringUtils.isBlank((String) o);
}
public static boolean isBlank(String str) {
return StringUtils.isBlank(str);
}
}
|
UTF-8
|
Java
| 2,392 |
java
|
Ognl.java
|
Java
|
[] | null |
[] |
import java.util.Collection;
import java.util.Date;
import java.util.Map;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
public class Ognl {
/**
* 使用ognl扩展 该功能为,根据传入的值, 如果值为0,则 ... 。 如果值为1,则 ... 。
* @return
*/
public static boolean isSolve(Object o, String soleState) {
if (o == null) {
return false;
}
String str = null;
if (o instanceof String[]) {
String[] objects = (String[]) o;
str = objects[0];
} else if (o instanceof Character) {
Character c = (Character) o;
str = Character.toString(c);
} else if (o instanceof String) {
String s = (String) o;
str = s;
}
if (soleState.equals(str)) {
return true;
} else {
return false;
}
}
/**
* 可以用于判断 Map,Collection,String,Array是否为空
*
* @param o
* @return
*/
public static boolean isEmpty(Object o) throws IllegalArgumentException {
if (o == null)
return true;
if (o instanceof String) {
return StringUtils.isEmpty((String) o);
} else if (o instanceof Collection) {
return CollectionUtils.isEmpty((Collection<?>) o);
} else if (o.getClass().isArray()) {
return ArrayUtils.isEmpty((Object[]) o);
} else if (o instanceof Map) {
MapUtils.isEmpty((Map<?, ?>) o);
} else if (o instanceof Date) {
return o == null;
} else if (o instanceof Number) {
return o == null;
} else if (o instanceof Boolean) {
return o == null;
} else {
throw new IllegalArgumentException(
"Illegal argument type,must be : Map,Collection,Array,String. but was:" + o.getClass());
}
return false;
}
/**
* 可以用于判断 Map,Collection,String,Array是否不为空
*
* @param o
* @return
*/
public static boolean isNotEmpty(Object o) {
return !isEmpty(o);
}
public static boolean isNotEmpty(Object... objects) {
if (objects == null)
return false;
for (Object obj : objects) {
if (isEmpty(obj)) {
return false;
}
;
}
return true;
}
public static boolean isNotBlank(Object o) {
return !isBlank(o);
}
public static boolean isBlank(Object o) {
return StringUtils.isBlank((String) o);
}
public static boolean isBlank(String str) {
return StringUtils.isBlank(str);
}
}
| 2,392 | 0.651528 | 0.649345 | 103 | 21.233009 | 18.791758 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.038835 | false | false |
12
|
b73fd6ac5e5a6bebfdfe797def225d3de1bfda71
| 7,885,559,975,703 |
cc8ffa15702f8a516cb53926886e226627687ca5
|
/app/src/main/java/com/jzbwlkj/leifeng/ui/activity/DaiQainActivity.java
|
ba554f905ec544935ef86d0acc1b65206ec0e1f5
|
[] |
no_license
|
gaoyuan117/LeiFeng
|
https://github.com/gaoyuan117/LeiFeng
|
00324e28cf9fe0245970c92b03b358df1ba7b0cc
|
4124d256ec42e95b5ce68050146fa6bb1d7103c2
|
refs/heads/master
| 2020-03-25T10:58:16.977000 | 2018-07-16T10:25:04 | 2018-07-16T10:25:07 | 129,888,307 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.jzbwlkj.leifeng.ui.activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.jzbwlkj.leifeng.BaseApp;
import com.jzbwlkj.leifeng.R;
import com.jzbwlkj.leifeng.base.BaseActivity;
import com.jzbwlkj.leifeng.retrofit.BaseObjObserver;
import com.jzbwlkj.leifeng.retrofit.CommonBean;
import com.jzbwlkj.leifeng.retrofit.HttpResult;
import com.jzbwlkj.leifeng.retrofit.RetrofitClient;
import com.jzbwlkj.leifeng.retrofit.RxUtils;
import com.jzbwlkj.leifeng.ui.adapter.AcManagementDetailsAdapter;
import com.jzbwlkj.leifeng.ui.adapter.DaiQianAdapter;
import com.jzbwlkj.leifeng.ui.adapter.ZhiYuanZheAdapter;
import com.jzbwlkj.leifeng.ui.bean.JoinProjectUserBean;
import com.jzbwlkj.leifeng.ui.bean.UserBean;
import com.jzbwlkj.leifeng.utils.FormatUtils;
import com.jzbwlkj.leifeng.view.CustomDatePicker;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
public class DaiQainActivity extends BaseActivity {
@BindView(R.id.iv_back)
ImageView ivBack;
@BindView(R.id.exit_layout)
LinearLayout exitLayout;
@BindView(R.id.tv_left_title)
TextView tvLeftTitle;
@BindView(R.id.center_title_tv)
TextView centerTitleTv;
@BindView(R.id.tv_right_text)
TextView tvRightText;
@BindView(R.id.iv_right2)
ImageView ivRight2;
@BindView(R.id.img_right)
ImageView imgRight;
@BindView(R.id.title_linLayout)
LinearLayout titleLinLayout;
@BindView(R.id.recyclerView)
RecyclerView recyclerView;
@BindView(R.id.refresh)
SwipeRefreshLayout refresh;
private List<JoinProjectUserBean> mList = new ArrayList<>();
private DaiQianAdapter adapter;
private int id;
private String now;
private int type = 0;//1 签到时间 2 签退时间
private JoinProjectUserBean userBean;//时间选择器返回的时间
private CustomDatePicker customDatePicker1;
private TextView tvStart;
private TextView tvEnd;
private TextView tvDaiqain;
private String tt;
private Handler handler = new Handler(){
@Override
public void handleMessage(Message msg) {
switch (msg.what){
case 1:
tvStart.setText("签到时间:"+tt);
break;
case 2:
tvEnd.setText("签退时间:"+tt);
break;
}
}
};
@Override
public int getLayoutId() {
id = getIntent().getIntExtra("id", 0);
return R.layout.activity_daiqian;
}
@Override
public void initView() {
centerTitleTv.setText("队员代签");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.CHINA);
long aa = System.currentTimeMillis() - (7 * 24 * 60 * 60 * 1000);
now = sdf.format(new Date(aa));
initTimeDialog();
initAadapter();
refresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
mList.clear();
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
refresh.setRefreshing(false);
}
}, 1000);
getNetData();
}
});
}
@Override
public void initData() {
getNetData();
}
@Override
public void configViews() {
}
@OnClick(R.id.iv_back)
public void onViewClicked() {
finish();
}
/**
* 获取网络数据
*/
private void getNetData() {
RetrofitClient.getInstance().createApi().userListT(BaseApp.token, String.valueOf(id))
.compose(RxUtils.<HttpResult<List<JoinProjectUserBean>>>io_main())
.subscribe(new BaseObjObserver<List<JoinProjectUserBean>>(this, "已加入") {
@Override
protected void onHandleSuccess(List<JoinProjectUserBean> joinProjectBeans) {
if (joinProjectBeans.size() > 0) {
mList.addAll(joinProjectBeans);
adapter.notifyDataSetChanged();
}
}
});
}
/**
* 初始化adapter
*/
private void initAadapter() {
adapter = new DaiQianAdapter(R.layout.item_qiandao, mList, this);
adapter.setEnableLoadMore(true);
adapter.setOnLoadMoreListener(new BaseQuickAdapter.RequestLoadMoreListener() {
@Override
public void onLoadMoreRequested() {
getNetData();
}
}, recyclerView);
adapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() {
@Override
public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
tvStart = view.findViewById(R.id.tv_qiandao);
tvEnd = view.findViewById(R.id.tv_qiantui);
userBean = mList.get(position);
JoinProjectUserBean.SignInfoBean bean = userBean.getSign_info();
switch (view.getId()) {
case R.id.tv_qiandao:
type = 1;
customDatePicker1.show(now);
break;
case R.id.tv_qiantui:
type = 2;
customDatePicker1.show(now);
break;
case R.id.tv_daiqian:
JoinProjectUserBean.SignInfoBean signInfoBean =userBean.getSign_info();
if(signInfoBean == null){
showToastMsg("您还没有选择签到,签退时间");
return;
}
String ss = signInfoBean.getData_s();
String ee = signInfoBean.getData_e();
postData(String.valueOf(id), ss, ee, String.valueOf(userBean.getUid()));
break;
}
}
});
adapter.disableLoadMoreIfNotFullPage();
recyclerView.setLayoutManager(new LinearLayoutManager(activity, LinearLayoutManager.VERTICAL, false));
recyclerView.addItemDecoration(rvDivider(1));
recyclerView.setAdapter(adapter);
}
/**
* 提交审核结果1 已审核 -1 已拒绝
*/
private void postData(String id, String start, String end, String uid) {
Log.i("sun","activity_id=="+id+"==uid=="+uid+"==ss=="+start+"==ee=="+end);
RetrofitClient.getInstance().createApi().daiqian(BaseApp.token, id, uid, start, end)
.compose(RxUtils.<HttpResult<CommonBean>>io_main())
.subscribe(new BaseObjObserver<CommonBean>(getActivity(), "代签") {
@Override
protected void onHandleSuccess(CommonBean commonBean) {
showToastMsg("当前队员代签已完成");
mList.clear();
getNetData();
}
});
}
/**
* 初始化时间选择器
*/
private void initTimeDialog() {
customDatePicker1 = new CustomDatePicker(this, new CustomDatePicker.ResultHandler() {
@Override
public void handle(String time) { // 回调接口,获得选中的时间
tt = time;
JoinProjectUserBean.SignInfoBean bean = userBean.getSign_info();
if(bean == null){
bean = new JoinProjectUserBean.SignInfoBean();
}
if(type == 1){
bean.setData_s(time);
}else if(type == 2){
bean.setData_e(time);
}
userBean.setSign_info(bean);
handler.sendEmptyMessage(type);
// adapter.notifyDataSetChanged();
}
}, now, "3000-12-31 00:00"); // 初始化日期格式请用:yyyy-MM-dd HH:mm,否则不能正常运行
customDatePicker1.showSpecificTime(true); // 不显示时和分
customDatePicker1.setIsLoop(false); // 不允许循环滚动
}
@Override
protected void onDestroy() {
super.onDestroy();
handler.removeCallbacksAndMessages(null);
}
}
|
UTF-8
|
Java
| 8,991 |
java
|
DaiQainActivity.java
|
Java
|
[] | null |
[] |
package com.jzbwlkj.leifeng.ui.activity;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.jzbwlkj.leifeng.BaseApp;
import com.jzbwlkj.leifeng.R;
import com.jzbwlkj.leifeng.base.BaseActivity;
import com.jzbwlkj.leifeng.retrofit.BaseObjObserver;
import com.jzbwlkj.leifeng.retrofit.CommonBean;
import com.jzbwlkj.leifeng.retrofit.HttpResult;
import com.jzbwlkj.leifeng.retrofit.RetrofitClient;
import com.jzbwlkj.leifeng.retrofit.RxUtils;
import com.jzbwlkj.leifeng.ui.adapter.AcManagementDetailsAdapter;
import com.jzbwlkj.leifeng.ui.adapter.DaiQianAdapter;
import com.jzbwlkj.leifeng.ui.adapter.ZhiYuanZheAdapter;
import com.jzbwlkj.leifeng.ui.bean.JoinProjectUserBean;
import com.jzbwlkj.leifeng.ui.bean.UserBean;
import com.jzbwlkj.leifeng.utils.FormatUtils;
import com.jzbwlkj.leifeng.view.CustomDatePicker;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
public class DaiQainActivity extends BaseActivity {
@BindView(R.id.iv_back)
ImageView ivBack;
@BindView(R.id.exit_layout)
LinearLayout exitLayout;
@BindView(R.id.tv_left_title)
TextView tvLeftTitle;
@BindView(R.id.center_title_tv)
TextView centerTitleTv;
@BindView(R.id.tv_right_text)
TextView tvRightText;
@BindView(R.id.iv_right2)
ImageView ivRight2;
@BindView(R.id.img_right)
ImageView imgRight;
@BindView(R.id.title_linLayout)
LinearLayout titleLinLayout;
@BindView(R.id.recyclerView)
RecyclerView recyclerView;
@BindView(R.id.refresh)
SwipeRefreshLayout refresh;
private List<JoinProjectUserBean> mList = new ArrayList<>();
private DaiQianAdapter adapter;
private int id;
private String now;
private int type = 0;//1 签到时间 2 签退时间
private JoinProjectUserBean userBean;//时间选择器返回的时间
private CustomDatePicker customDatePicker1;
private TextView tvStart;
private TextView tvEnd;
private TextView tvDaiqain;
private String tt;
private Handler handler = new Handler(){
@Override
public void handleMessage(Message msg) {
switch (msg.what){
case 1:
tvStart.setText("签到时间:"+tt);
break;
case 2:
tvEnd.setText("签退时间:"+tt);
break;
}
}
};
@Override
public int getLayoutId() {
id = getIntent().getIntExtra("id", 0);
return R.layout.activity_daiqian;
}
@Override
public void initView() {
centerTitleTv.setText("队员代签");
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.CHINA);
long aa = System.currentTimeMillis() - (7 * 24 * 60 * 60 * 1000);
now = sdf.format(new Date(aa));
initTimeDialog();
initAadapter();
refresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
mList.clear();
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
refresh.setRefreshing(false);
}
}, 1000);
getNetData();
}
});
}
@Override
public void initData() {
getNetData();
}
@Override
public void configViews() {
}
@OnClick(R.id.iv_back)
public void onViewClicked() {
finish();
}
/**
* 获取网络数据
*/
private void getNetData() {
RetrofitClient.getInstance().createApi().userListT(BaseApp.token, String.valueOf(id))
.compose(RxUtils.<HttpResult<List<JoinProjectUserBean>>>io_main())
.subscribe(new BaseObjObserver<List<JoinProjectUserBean>>(this, "已加入") {
@Override
protected void onHandleSuccess(List<JoinProjectUserBean> joinProjectBeans) {
if (joinProjectBeans.size() > 0) {
mList.addAll(joinProjectBeans);
adapter.notifyDataSetChanged();
}
}
});
}
/**
* 初始化adapter
*/
private void initAadapter() {
adapter = new DaiQianAdapter(R.layout.item_qiandao, mList, this);
adapter.setEnableLoadMore(true);
adapter.setOnLoadMoreListener(new BaseQuickAdapter.RequestLoadMoreListener() {
@Override
public void onLoadMoreRequested() {
getNetData();
}
}, recyclerView);
adapter.setOnItemChildClickListener(new BaseQuickAdapter.OnItemChildClickListener() {
@Override
public void onItemChildClick(BaseQuickAdapter adapter, View view, int position) {
tvStart = view.findViewById(R.id.tv_qiandao);
tvEnd = view.findViewById(R.id.tv_qiantui);
userBean = mList.get(position);
JoinProjectUserBean.SignInfoBean bean = userBean.getSign_info();
switch (view.getId()) {
case R.id.tv_qiandao:
type = 1;
customDatePicker1.show(now);
break;
case R.id.tv_qiantui:
type = 2;
customDatePicker1.show(now);
break;
case R.id.tv_daiqian:
JoinProjectUserBean.SignInfoBean signInfoBean =userBean.getSign_info();
if(signInfoBean == null){
showToastMsg("您还没有选择签到,签退时间");
return;
}
String ss = signInfoBean.getData_s();
String ee = signInfoBean.getData_e();
postData(String.valueOf(id), ss, ee, String.valueOf(userBean.getUid()));
break;
}
}
});
adapter.disableLoadMoreIfNotFullPage();
recyclerView.setLayoutManager(new LinearLayoutManager(activity, LinearLayoutManager.VERTICAL, false));
recyclerView.addItemDecoration(rvDivider(1));
recyclerView.setAdapter(adapter);
}
/**
* 提交审核结果1 已审核 -1 已拒绝
*/
private void postData(String id, String start, String end, String uid) {
Log.i("sun","activity_id=="+id+"==uid=="+uid+"==ss=="+start+"==ee=="+end);
RetrofitClient.getInstance().createApi().daiqian(BaseApp.token, id, uid, start, end)
.compose(RxUtils.<HttpResult<CommonBean>>io_main())
.subscribe(new BaseObjObserver<CommonBean>(getActivity(), "代签") {
@Override
protected void onHandleSuccess(CommonBean commonBean) {
showToastMsg("当前队员代签已完成");
mList.clear();
getNetData();
}
});
}
/**
* 初始化时间选择器
*/
private void initTimeDialog() {
customDatePicker1 = new CustomDatePicker(this, new CustomDatePicker.ResultHandler() {
@Override
public void handle(String time) { // 回调接口,获得选中的时间
tt = time;
JoinProjectUserBean.SignInfoBean bean = userBean.getSign_info();
if(bean == null){
bean = new JoinProjectUserBean.SignInfoBean();
}
if(type == 1){
bean.setData_s(time);
}else if(type == 2){
bean.setData_e(time);
}
userBean.setSign_info(bean);
handler.sendEmptyMessage(type);
// adapter.notifyDataSetChanged();
}
}, now, "3000-12-31 00:00"); // 初始化日期格式请用:yyyy-MM-dd HH:mm,否则不能正常运行
customDatePicker1.showSpecificTime(true); // 不显示时和分
customDatePicker1.setIsLoop(false); // 不允许循环滚动
}
@Override
protected void onDestroy() {
super.onDestroy();
handler.removeCallbacksAndMessages(null);
}
}
| 8,991 | 0.586685 | 0.580727 | 255 | 33.22353 | 23.891277 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.596078 | false | false |
12
|
6de73cc7d0ea8165a0d5e0aef8c88e5fd6e0eaea
| 26,010,321,985,845 |
f7a858625495de0e9b715e68cb03aebd2ef19990
|
/shorindocs-outlogger/src/main/java/com/shorindo/docs/outlogger/OutlineViewModel.java
|
5eaf6919691b431f78745f91aec1e62723b4fcf3
|
[] |
no_license
|
shorindo/shorindocs
|
https://github.com/shorindo/shorindocs
|
c81c9873ee023e32a647d7289e8e6be74812a018
|
0db3a4619de755b5841d9178a589924342a8079b
|
refs/heads/develop
| 2022-07-04T00:55:50.662000 | 2021-06-27T22:07:24 | 2021-06-27T22:07:24 | 62,425,919 | 0 | 0 | null | false | 2022-06-21T01:05:35 | 2016-07-02T00:07:27 | 2021-06-27T22:07:31 | 2022-06-21T01:05:34 | 2,204 | 0 | 0 | 2 |
Java
| false | false |
package com.shorindo.docs.outlogger;
import java.util.ArrayList;
import java.util.List;
public class OutlineViewModel {
private String text;
private List<OutlineViewModel> children = new ArrayList<>();
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public void addChild(OutlineViewModel child) {
children.add(child);
}
public List<OutlineViewModel> getChildren() {
return children;
}
public void setChildren(List<OutlineViewModel> children) {
this.children = children;
}
}
|
UTF-8
|
Java
| 612 |
java
|
OutlineViewModel.java
|
Java
|
[] | null |
[] |
package com.shorindo.docs.outlogger;
import java.util.ArrayList;
import java.util.List;
public class OutlineViewModel {
private String text;
private List<OutlineViewModel> children = new ArrayList<>();
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public void addChild(OutlineViewModel child) {
children.add(child);
}
public List<OutlineViewModel> getChildren() {
return children;
}
public void setChildren(List<OutlineViewModel> children) {
this.children = children;
}
}
| 612 | 0.663399 | 0.663399 | 24 | 24.5 | 18.670387 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.416667 | false | false |
12
|
4c9556ef9a508c1326b575eca4aa1586553a6a51
| 12,292,196,450,454 |
f81a9fbcbc3109d3cc7b9775e85c6d3a99a4b31b
|
/src/main/java/fast/security/UserDetailsServiceImpl.java
|
85e3ed4bbf134e5628db820ed32fed274db8afed
|
[] |
no_license
|
BohdanLevchenko/SpringSecurityExample
|
https://github.com/BohdanLevchenko/SpringSecurityExample
|
f28d3ba66d1c287b135ae9101481c3ea0bc99cac
|
1bf8875019b6a5fc9fc87a641961c630915d12f5
|
refs/heads/master
| 2022-12-22T20:56:01.178000 | 2021-05-12T12:32:00 | 2021-05-12T12:32:00 | 207,977,455 | 0 | 0 | null | false | 2022-12-16T14:50:03 | 2019-09-12T06:10:34 | 2021-05-12T12:32:03 | 2022-12-16T14:50:00 | 49 | 0 | 0 | 2 |
Java
| false | false |
package fast.security;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.Collections;
@Service
public class UserDetailsServiceImpl implements UserDetailsService {
private final PasswordEncoder passwordEncoder;
public UserDetailsServiceImpl(PasswordEncoder passwordEncoder) {
this.passwordEncoder = passwordEncoder;
}
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
if (username.equals("admin")) {
return new User(
username,
passwordEncoder.encode("password"),
Collections.singletonList(new SimpleGrantedAuthority("ROLE_ADMIN")));
}
throw new UsernameNotFoundException("User " + username + " does not exist");
}
}
|
UTF-8
|
Java
| 1,323 |
java
|
UserDetailsServiceImpl.java
|
Java
|
[
{
"context": "eNotFoundException {\n if (username.equals(\"admin\")) {\n return new User(\n ",
"end": 1009,
"score": 0.9960870146751404,
"start": 1004,
"tag": "USERNAME",
"value": "admin"
},
{
"context": "name,\n passwordEncoder.encode(\"password\"),\n Collections.singletonList(",
"end": 1126,
"score": 0.9978583455085754,
"start": 1118,
"tag": "PASSWORD",
"value": "password"
}
] | null |
[] |
package fast.security;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.Collections;
@Service
public class UserDetailsServiceImpl implements UserDetailsService {
private final PasswordEncoder passwordEncoder;
public UserDetailsServiceImpl(PasswordEncoder passwordEncoder) {
this.passwordEncoder = passwordEncoder;
}
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
if (username.equals("admin")) {
return new User(
username,
passwordEncoder.encode("<PASSWORD>"),
Collections.singletonList(new SimpleGrantedAuthority("ROLE_ADMIN")));
}
throw new UsernameNotFoundException("User " + username + " does not exist");
}
}
| 1,325 | 0.763416 | 0.763416 | 34 | 37.911766 | 30.722063 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false |
12
|
1bde472b1628f76b68866365cf5bc005737a886a
| 2,954,937,569,583 |
13c2d3db2d49c40c74c2e6420a9cd89377f1c934
|
/program_data/JavaProgramData/103/721.java
|
b61796538080edd39aa339cb26c695e681d4e11c
|
[
"MIT"
] |
permissive
|
qiuchili/ggnn_graph_classification
|
https://github.com/qiuchili/ggnn_graph_classification
|
c2090fefe11f8bf650e734442eb96996a54dc112
|
291ff02404555511b94a4f477c6974ebd62dcf44
|
refs/heads/master
| 2021-10-18T14:54:26.154000 | 2018-10-21T23:34:14 | 2018-10-21T23:34:14 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
public class letterCount
{
public char c;
public int count;
}
package <missing>;
public class GlobalMembers
{
public static String str = new String(new char[MAXLENGTH]);
public static letterCount[] lc = tangible.Arrays.initializeWithDefaultletterCountInstances(MAXLENGTH); //?????
//??
//C++ TO JAVA CONVERTER TODO TASK: The following statement was not recognized, possibly due to an unrecognized macro:
fgets(str, MAXLENGTH, stdin);
//???????????
//C++ TO JAVA CONVERTER TODO TASK: The following method format was not recognized, possibly due to an unrecognized macro:
for (i = 0; i < MAXLENGTH; i++)
{
if (str.charAt(i) == '\n')
{
break;
}
if (str.charAt(i) >= 97 && str.charAt(i) <= 122)
{
str = tangible.StringFunctions.changeCharacter(str, i, str.charAt(i) - 32);
}
}
//???????
//C++ TO JAVA CONVERTER TODO TASK: The following statement was not recognized, possibly due to an unrecognized macro:
j = 0; //????????
//C++ TO JAVA CONVERTER TODO TASK: The following statement was not recognized, possibly due to an unrecognized macro:
i = 0; //?????
public static lc[j].c = str.charAt(0);
public static lc[j].count = 1;
//C++ TO JAVA CONVERTER TODO TASK: The following method format was not recognized, possibly due to an unrecognized macro:
while (true)
{
if (str.charAt(i) == str.charAt(i + 1))
{
lc[j].count++;
i++;
}
else
{
if (str.charAt(i + 1) == '\n')
{
break;
}
j++;
lc[j].c = str.charAt(i + 1);
lc[j].count = 1;
i++;
}
}
//??
//C++ TO JAVA CONVERTER TODO TASK: The following method format was not recognized, possibly due to an unrecognized macro:
for (int i = 0; i <= j; i++)
{
System.out.printf("(%c,%d)", lc[i].c, lc[i].count);
}
//C++ TO JAVA CONVERTER TODO TASK: The following statement was not recognized, possibly due to an unrecognized macro:
printf("\n");
public static return 0 ;
}
}
|
UTF-8
|
Java
| 1,947 |
java
|
721.java
|
Java
|
[] | null |
[] |
public class letterCount
{
public char c;
public int count;
}
package <missing>;
public class GlobalMembers
{
public static String str = new String(new char[MAXLENGTH]);
public static letterCount[] lc = tangible.Arrays.initializeWithDefaultletterCountInstances(MAXLENGTH); //?????
//??
//C++ TO JAVA CONVERTER TODO TASK: The following statement was not recognized, possibly due to an unrecognized macro:
fgets(str, MAXLENGTH, stdin);
//???????????
//C++ TO JAVA CONVERTER TODO TASK: The following method format was not recognized, possibly due to an unrecognized macro:
for (i = 0; i < MAXLENGTH; i++)
{
if (str.charAt(i) == '\n')
{
break;
}
if (str.charAt(i) >= 97 && str.charAt(i) <= 122)
{
str = tangible.StringFunctions.changeCharacter(str, i, str.charAt(i) - 32);
}
}
//???????
//C++ TO JAVA CONVERTER TODO TASK: The following statement was not recognized, possibly due to an unrecognized macro:
j = 0; //????????
//C++ TO JAVA CONVERTER TODO TASK: The following statement was not recognized, possibly due to an unrecognized macro:
i = 0; //?????
public static lc[j].c = str.charAt(0);
public static lc[j].count = 1;
//C++ TO JAVA CONVERTER TODO TASK: The following method format was not recognized, possibly due to an unrecognized macro:
while (true)
{
if (str.charAt(i) == str.charAt(i + 1))
{
lc[j].count++;
i++;
}
else
{
if (str.charAt(i + 1) == '\n')
{
break;
}
j++;
lc[j].c = str.charAt(i + 1);
lc[j].count = 1;
i++;
}
}
//??
//C++ TO JAVA CONVERTER TODO TASK: The following method format was not recognized, possibly due to an unrecognized macro:
for (int i = 0; i <= j; i++)
{
System.out.printf("(%c,%d)", lc[i].c, lc[i].count);
}
//C++ TO JAVA CONVERTER TODO TASK: The following statement was not recognized, possibly due to an unrecognized macro:
printf("\n");
public static return 0 ;
}
}
| 1,947 | 0.6302 | 0.620955 | 71 | 26.408451 | 36.23576 | 121 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.450704 | false | false |
12
|
c9bfdf02a176671358ef836a8f6d50159a5d76e4
| 39,264,591,048,319 |
23567693379926b9532497438b21168dd31a1a6d
|
/src/entity/project/src/main/java/mobi/handytec/entity/project/ProjectPk.java
|
c257fde85bae1c22476add3c522784e7f170e895
|
[] |
no_license
|
handytec/project
|
https://github.com/handytec/project
|
45bb6a8b96618f4811a491c391d08651e817123f
|
84f7cb6213560012e4a7c9b5175a433dc63f1eb2
|
refs/heads/master
| 2015-08-02T00:40:56.905000 | 2015-06-17T10:33:34 | 2015-06-17T10:33:34 | 5,737,068 | 0 | 0 | null | false | 2014-03-20T23:58:21 | 2012-09-09T11:32:50 | 2014-03-20T23:58:21 | 2014-03-20T23:50:15 | 11,816 | 0 | 0 | 0 |
Java
| null | null |
package mobi.handytec.entity.project;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import mobi.handytec.core.schema.AbstractCompanyKey;
/**
* PrimaryKey class for the PROJECT database table.
*
* @author Handytec
* @version 3.0
*/
@Embeddable
public class ProjectPk extends AbstractCompanyKey {
/**
* Project Id
*/
@Column(name = "PROJECT_ID", nullable = false)
private String projectId;
public ProjectPk() {
}
public ProjectPk(String projectId) {
this.projectId = projectId;
}
public String getProjectId() {
return this.projectId;
}
public void setProjectId(String projectId) {
this.projectId = projectId;
}
@Override
public String toString() {
return "PK[" + this.getCompanyId() + ", " + this.getProjectId() + "]";
}
}
|
UTF-8
|
Java
| 858 |
java
|
ProjectPk.java
|
Java
|
[
{
"context": "ass for the PROJECT database table.\n * \n * @author Handytec\n * @version 3.0\n */\n@Embeddable\npublic class Proj",
"end": 243,
"score": 0.6649908423423767,
"start": 235,
"tag": "USERNAME",
"value": "Handytec"
}
] | null |
[] |
package mobi.handytec.entity.project;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import mobi.handytec.core.schema.AbstractCompanyKey;
/**
* PrimaryKey class for the PROJECT database table.
*
* @author Handytec
* @version 3.0
*/
@Embeddable
public class ProjectPk extends AbstractCompanyKey {
/**
* Project Id
*/
@Column(name = "PROJECT_ID", nullable = false)
private String projectId;
public ProjectPk() {
}
public ProjectPk(String projectId) {
this.projectId = projectId;
}
public String getProjectId() {
return this.projectId;
}
public void setProjectId(String projectId) {
this.projectId = projectId;
}
@Override
public String toString() {
return "PK[" + this.getCompanyId() + ", " + this.getProjectId() + "]";
}
}
| 858 | 0.649184 | 0.646853 | 42 | 19.428572 | 19.801567 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.261905 | false | false |
12
|
705e0bb8e2919b26b7ee676e0fae1255cc9b4689
| 39,711,267,625,765 |
b1215c8df41c83e3b98f311310a5bb5719020c8a
|
/C195 Appointment Scheduler - Benjamin Shelton/src/c195/Utilities/Authenticator.java
|
d9bbcb4f56c16712fd6428e91286d873b20f6621
|
[] |
no_license
|
shelton-benjamin/JavaFX-appointment_scheduler
|
https://github.com/shelton-benjamin/JavaFX-appointment_scheduler
|
3fb73ec6f3e8621d204f539081127e06ad59d475
|
7a6ff6bdfba84daaa4c9f8a19db0818abf8f8208
|
refs/heads/master
| 2020-03-28T19:54:14.829000 | 2019-01-20T17:56:18 | 2019-01-20T17:56:18 | 149,020,051 | 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 c195.Utilities;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
*
* @author Benjamin
* class takes username, password, and result set provided by login screen
* and determines if given username and password match a user in the database
*/
public class Authenticator {
public Authenticator() {
}
public static boolean authenticate(String username, String password, ResultSet rs) throws SQLException{
while (rs.next()) {
String correctUsername = rs.getString("userName");
String correctPassword = rs.getString("password");
if (correctUsername.equals(username) && correctPassword.equals(password)) {
return true;
}
}
return false;
}
}
|
UTF-8
|
Java
| 1,038 |
java
|
Authenticator.java
|
Java
|
[
{
"context": "port java.sql.SQLException;\r\n\r\n/**\r\n *\r\n * @author Benjamin\r\n * class takes username, password, and result se",
"end": 306,
"score": 0.9969487190246582,
"start": 298,
"tag": "NAME",
"value": "Benjamin"
}
] | 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 c195.Utilities;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
*
* @author Benjamin
* class takes username, password, and result set provided by login screen
* and determines if given username and password match a user in the database
*/
public class Authenticator {
public Authenticator() {
}
public static boolean authenticate(String username, String password, ResultSet rs) throws SQLException{
while (rs.next()) {
String correctUsername = rs.getString("userName");
String correctPassword = rs.getString("password");
if (correctUsername.equals(username) && correctPassword.equals(password)) {
return true;
}
}
return false;
}
}
| 1,038 | 0.618497 | 0.615607 | 39 | 24.615385 | 28.844957 | 107 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.358974 | false | false |
12
|
17d36d61f5c9a62bdd844d7c85bda80de33ece02
| 35,253,091,615,502 |
ff8474da68dee211a7e3c6c5ff351de9335f1fbe
|
/Boss/src/com/boss/gui/GUI.java
|
2e84fd705f9756a5f050eb906e22450085567b63
|
[] |
no_license
|
PandoraPlugins/CustomBosses
|
https://github.com/PandoraPlugins/CustomBosses
|
9e353913032637c01fed8399598ad89182c39377
|
380866e9c9941e8a58c3e2aceac95148932c3de3
|
refs/heads/master
| 2023-05-29T20:59:23.120000 | 2020-11-13T03:41:32 | 2020-11-13T03:41:32 | 311,849,872 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.boss.gui;
import org.bukkit.Bukkit;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.inventory.InventoryOpenEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import com.boss.main.Boss;
import com.boss.messages.GenericMessages;
import com.boss.utils.MessageUtils;
public abstract class GUI implements Listener{
Player player;
Inventory inv;
public GUI(Player player) {
this.player = player;
Boss.instance.getServer().getPluginManager().registerEvents(this, Boss.instance);
inv = Bukkit.createInventory(player, size(), MessageUtils.translateAlternateColorCodes(name()));
}
@EventHandler()
public void onOpen(InventoryOpenEvent e) {
if(!e.getPlayer().hasPermission(permission())) {
MessageUtils.sendMessage(player, GenericMessages.INAVLID_PERMISSION);
e.setCancelled(true);
return;
}
onOpenInventory(e);
}
@EventHandler()
public void onClose(InventoryCloseEvent e) {
this.onCloseInventory(e);
this.close();
}
@EventHandler()
public void onClick(InventoryClickEvent e) {
e.setCancelled(!canTakeItems());
if(e.getCurrentItem() == null) {
return;
}
this.onClickInventory(e);
}
public abstract String name();
public abstract String permission();
public abstract int size();
public abstract Sound sound();
public abstract float soundLevel();
public abstract boolean canTakeItems();
public abstract void onClickInventory(InventoryClickEvent e);
public abstract void onOpenInventory(InventoryOpenEvent e);
public abstract void onCloseInventory(InventoryCloseEvent e);
public abstract void Contents(Inventory inv);
public void open() {
player.getWorld().playSound(player.getLocation(), sound(), soundLevel(), soundLevel());
Contents(inv);
player.openInventory(inv);
}
public void addItem(int index, ItemStack item) {
inv.setItem(index, item);
}
public void fill(ItemStack stack) {
for(int i = 0; i < this.size(); i++) {
if(this.inv.getItem(i) == null) {
this.inv.setItem(i, stack);
}
}
}
public void close() {
HandlerList.unregisterAll(this);
player.closeInventory();
}
}
|
UTF-8
|
Java
| 2,481 |
java
|
GUI.java
|
Java
|
[] | null |
[] |
package com.boss.gui;
import org.bukkit.Bukkit;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
import org.bukkit.event.inventory.InventoryOpenEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import com.boss.main.Boss;
import com.boss.messages.GenericMessages;
import com.boss.utils.MessageUtils;
public abstract class GUI implements Listener{
Player player;
Inventory inv;
public GUI(Player player) {
this.player = player;
Boss.instance.getServer().getPluginManager().registerEvents(this, Boss.instance);
inv = Bukkit.createInventory(player, size(), MessageUtils.translateAlternateColorCodes(name()));
}
@EventHandler()
public void onOpen(InventoryOpenEvent e) {
if(!e.getPlayer().hasPermission(permission())) {
MessageUtils.sendMessage(player, GenericMessages.INAVLID_PERMISSION);
e.setCancelled(true);
return;
}
onOpenInventory(e);
}
@EventHandler()
public void onClose(InventoryCloseEvent e) {
this.onCloseInventory(e);
this.close();
}
@EventHandler()
public void onClick(InventoryClickEvent e) {
e.setCancelled(!canTakeItems());
if(e.getCurrentItem() == null) {
return;
}
this.onClickInventory(e);
}
public abstract String name();
public abstract String permission();
public abstract int size();
public abstract Sound sound();
public abstract float soundLevel();
public abstract boolean canTakeItems();
public abstract void onClickInventory(InventoryClickEvent e);
public abstract void onOpenInventory(InventoryOpenEvent e);
public abstract void onCloseInventory(InventoryCloseEvent e);
public abstract void Contents(Inventory inv);
public void open() {
player.getWorld().playSound(player.getLocation(), sound(), soundLevel(), soundLevel());
Contents(inv);
player.openInventory(inv);
}
public void addItem(int index, ItemStack item) {
inv.setItem(index, item);
}
public void fill(ItemStack stack) {
for(int i = 0; i < this.size(); i++) {
if(this.inv.getItem(i) == null) {
this.inv.setItem(i, stack);
}
}
}
public void close() {
HandlerList.unregisterAll(this);
player.closeInventory();
}
}
| 2,481 | 0.71705 | 0.716646 | 92 | 24.967392 | 22.082579 | 98 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.76087 | false | false |
12
|
98f8c107cc18812bd74094fb4bab60194e3e9ed4
| 35,278,861,418,745 |
76184f75561b9693d20853596f418af4e4e9f8e7
|
/service/src/main/java/com/moneysupermarket/componentcatalog/service/scanners/gradle/internal/utils/InheritingHashMap.java
|
403ffe94cbd61353976626fff1a1b5788ce7b421
|
[
"MIT"
] |
permissive
|
simondean/component-catalog
|
https://github.com/simondean/component-catalog
|
0595a3c706b56a80525748f72b9dbf09cc396174
|
d914de803abcdeb1b97e8e09d56d50f6e85bd6d0
|
refs/heads/main
| 2023-08-15T09:57:49.283000 | 2021-10-20T21:51:37 | 2021-10-20T21:51:37 | 393,506,073 | 0 | 0 |
MIT
| true | 2021-08-24T17:26:06 | 2021-08-06T21:20:53 | 2021-08-24T09:23:49 | 2021-08-24T17:26:05 | 1,317 | 0 | 0 | 0 | null | false | false |
package com.moneysupermarket.componentcatalog.service.scanners.gradle.internal.utils;
import lombok.RequiredArgsConstructor;
import java.util.HashMap;
import java.util.Map;
import static java.util.Objects.isNull;
import static java.util.Objects.nonNull;
@RequiredArgsConstructor
public class InheritingHashMap<K, V> extends HashMap<K, V> {
private final Map<K, V> parent;
public InheritingHashMap() {
this.parent = null;
}
@Override
public V get(Object key) {
V value = super.get(key);
if (isNull(value) && nonNull(parent)) {
value = parent.get(key);
}
return value;
}
@Override
public V getOrDefault(Object key, V defaultValue) {
V value = get(key);
return nonNull(value) ? value : defaultValue;
}
}
|
UTF-8
|
Java
| 815 |
java
|
InheritingHashMap.java
|
Java
|
[] | null |
[] |
package com.moneysupermarket.componentcatalog.service.scanners.gradle.internal.utils;
import lombok.RequiredArgsConstructor;
import java.util.HashMap;
import java.util.Map;
import static java.util.Objects.isNull;
import static java.util.Objects.nonNull;
@RequiredArgsConstructor
public class InheritingHashMap<K, V> extends HashMap<K, V> {
private final Map<K, V> parent;
public InheritingHashMap() {
this.parent = null;
}
@Override
public V get(Object key) {
V value = super.get(key);
if (isNull(value) && nonNull(parent)) {
value = parent.get(key);
}
return value;
}
@Override
public V getOrDefault(Object key, V defaultValue) {
V value = get(key);
return nonNull(value) ? value : defaultValue;
}
}
| 815 | 0.66135 | 0.66135 | 36 | 21.638889 | 21.178019 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.472222 | false | false |
12
|
0fd1aba3909e1c3bd251b176af76ef8fa305bc53
| 5,755,256,240,129 |
35c90d8d8d906b440d602ba23e284dc5a09d27f4
|
/src/Solutions/recursion/ClimbingStairs.java
|
114ef7970e99c2a80b8c4077446c4d87988d6bbe
|
[] |
no_license
|
muhammadali1995/Emperical
|
https://github.com/muhammadali1995/Emperical
|
069312123c15a58489638502ae927875da8e7ecc
|
ef196d04e29dc2cb9f6c137308f3f02acc790e56
|
refs/heads/master
| 2021-05-10T09:54:48.508000 | 2021-02-11T13:30:18 | 2021-02-11T13:30:18 | 118,942,762 | 0 | 0 | null | false | 2018-05-31T06:04:31 | 2018-01-25T17:07:42 | 2018-05-31T02:13:41 | 2018-05-31T06:04:30 | 27 | 0 | 0 | 0 |
Java
| false | null |
package Solutions.recursion;
import java.util.HashMap;
public class ClimbingStairs {
private HashMap<Integer, Integer> cache = new HashMap<>();
public int climbStairs(int n) {
if (n == 1 || n == 0 || n == 2) {
return n;
} else {
return climb(n - 1) + climb(n - 2);
}
}
public int climb(int n){
int result;
if (cache.containsKey(n)){
return cache.get(n);
} else if (n==1||n==0|| n==2){
result = n;
} else {
result = climb(n-1) + climb(n-2);
}
cache.put(n, result);
return result;
}
}
|
UTF-8
|
Java
| 650 |
java
|
ClimbingStairs.java
|
Java
|
[] | null |
[] |
package Solutions.recursion;
import java.util.HashMap;
public class ClimbingStairs {
private HashMap<Integer, Integer> cache = new HashMap<>();
public int climbStairs(int n) {
if (n == 1 || n == 0 || n == 2) {
return n;
} else {
return climb(n - 1) + climb(n - 2);
}
}
public int climb(int n){
int result;
if (cache.containsKey(n)){
return cache.get(n);
} else if (n==1||n==0|| n==2){
result = n;
} else {
result = climb(n-1) + climb(n-2);
}
cache.put(n, result);
return result;
}
}
| 650 | 0.473846 | 0.458462 | 28 | 22.214285 | 16.226868 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.75 | false | false |
12
|
5089541948eb12fbf20aa9ff3136eef8b5ddc402
| 7,095,286,035,102 |
82c17c986789740f689a722f518440d15b6569cf
|
/05.Communication_and_Events/Exercises/src/problem7/core/Database.java
|
1830fb398db12e2dc9897dfaa806d270e0d89b61
|
[] |
no_license
|
elitasheva/Object-Oriented-Programming-Advanced
|
https://github.com/elitasheva/Object-Oriented-Programming-Advanced
|
99e77451a9140d4aef87e2bc3a0f3de900572c49
|
c6cd8248c6e9e1e0e0d0bc31b79181679bb754cd
|
refs/heads/master
| 2021-01-12T13:56:14.805000 | 2016-09-22T14:03:09 | 2016-09-22T14:03:09 | 68,926,183 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package problem7.core;
import problem7.interfaces.Data;
import problem7.interfaces.Observable;
import problem7.interfaces.Observer;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Set;
public class Database implements Data {
HashMap<String, Observer> observers;
HashMap<String, Observable> obsevables;
public Database() {
this.observers = new HashMap<>();
this.obsevables = new HashMap<>();
}
@Override
public void addObserver(Observer observer) {
this.observers.put(observer.getId(), observer);
}
@Override
public Observer getObserver(String id) {
return this.observers.get(id);
}
@Override
public void addOservable(Observable observable) {
this.obsevables.put(observable.getId(), observable);
}
@Override
public Observable getObservable(String id) {
return this.obsevables.get(id);
}
@Override
public void subscribeObserver(Observer observer) {
for (String id : obsevables.keySet()) {
this.obsevables.get(id).addObserver(observer);
}
}
@Override
public Set<String> getObservers() {
return this.observers.keySet();
}
}
|
UTF-8
|
Java
| 1,229 |
java
|
Database.java
|
Java
|
[] | null |
[] |
package problem7.core;
import problem7.interfaces.Data;
import problem7.interfaces.Observable;
import problem7.interfaces.Observer;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Set;
public class Database implements Data {
HashMap<String, Observer> observers;
HashMap<String, Observable> obsevables;
public Database() {
this.observers = new HashMap<>();
this.obsevables = new HashMap<>();
}
@Override
public void addObserver(Observer observer) {
this.observers.put(observer.getId(), observer);
}
@Override
public Observer getObserver(String id) {
return this.observers.get(id);
}
@Override
public void addOservable(Observable observable) {
this.obsevables.put(observable.getId(), observable);
}
@Override
public Observable getObservable(String id) {
return this.obsevables.get(id);
}
@Override
public void subscribeObserver(Observer observer) {
for (String id : obsevables.keySet()) {
this.obsevables.get(id).addObserver(observer);
}
}
@Override
public Set<String> getObservers() {
return this.observers.keySet();
}
}
| 1,229 | 0.667209 | 0.663954 | 51 | 23.09804 | 19.68104 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.411765 | false | false |
12
|
87d8cb31aa9ec3fb71e6fa4ddb29ec5b860b5e18
| 36,867,999,304,024 |
b06174ccb6dd4915c6c1e82c6952114c6cb2b194
|
/src/main/java/tiy/webapp/ChocolateInput.java
|
ef9eaf18189770ad82d9f03df5cddd6d2c94ea72
|
[] |
no_license
|
ayoosabb21/ChocolateWeb
|
https://github.com/ayoosabb21/ChocolateWeb
|
b0102df319e4f9a50c89bcdf07ab864972af0f3a
|
3bf75dcb1ed53a783593412b867597621a71cd35
|
refs/heads/master
| 2021-01-09T08:54:24.161000 | 2016-06-09T20:19:36 | 2016-06-09T20:19:36 | 60,800,015 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package tiy.webapp;
/**
* Created by willi on 6/6/2016.
*/
public class ChocolateInput {
public int smalls;
public int bigs;
public int goal;
public ChocolateInput() {
}
public ChocolateInput (int smalls, int bigs, int goal) {
this.smalls = smalls;
this.bigs = bigs;
this.goal = goal;
}
}
|
UTF-8
|
Java
| 350 |
java
|
ChocolateInput.java
|
Java
|
[
{
"context": "package tiy.webapp;\n\n/**\n * Created by willi on 6/6/2016.\n */\npublic class ChocolateInput {\n\n ",
"end": 44,
"score": 0.9895391464233398,
"start": 39,
"tag": "USERNAME",
"value": "willi"
}
] | null |
[] |
package tiy.webapp;
/**
* Created by willi on 6/6/2016.
*/
public class ChocolateInput {
public int smalls;
public int bigs;
public int goal;
public ChocolateInput() {
}
public ChocolateInput (int smalls, int bigs, int goal) {
this.smalls = smalls;
this.bigs = bigs;
this.goal = goal;
}
}
| 350 | 0.591429 | 0.574286 | 22 | 14.863636 | 15.448729 | 60 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.409091 | false | false |
12
|
464e300d6cf86a5d2d93ce0954d68f567e019bef
| 33,749,853,075,313 |
8b083a6f24d8a52bb09c659151ca3171a1127b53
|
/app/src/main/java/com/cloud7831/strongereveryday/Objects/WorkoutSet.java
|
4f0c7de6568812854463212a250556c948058db5
|
[] |
no_license
|
Cloud7831/StrongerEveryday
|
https://github.com/Cloud7831/StrongerEveryday
|
e3ec1574caee2499a09084002b94d5b1e5bf61d8
|
a18321220419c6c8199ae15b3ec7cde6327753bb
|
refs/heads/master
| 2020-05-23T21:17:20.371000 | 2019-08-28T23:16:11 | 2019-08-28T23:16:11 | 186,950,059 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.cloud7831.strongereveryday.Objects;
public class WorkoutSet {
// A workout set is a collection of exercises.
// A workout set can be user made, but there are also some basic ones, such as Abs, Chest, etc.
private int daysLastCompleted; // The amount of days that have gone by since this workout set has been completed.
private String workoutName; // E.g. Abs, Chest, Legs, etc.
private int colour; // Colour of the WorkoutSet when displayed in a list.
// private ExerciseID[] exercises;
public WorkoutSet(String name, int days){
// TODO: Create a database to store the basic info of WorkoutSets so that they can appear in the Workout List.
// TODO: WorkoutSets themselves contain more information (Which exercises are in them, etc)
// TODO: that doesn't need to be shown in a list.
// TODO: A WorkoutSet is stored as a JSON.
// TODO: A WorkoutSet contains a list of Exercises.
// TODO: A WorkoutSet can contain a WorkoutSet (can't be recursive, though.)
daysLastCompleted = days;
workoutName = name;
this.colour = colour;
}
public String getWorkoutName(){
return workoutName;
}
public int getDaysLastCompleted(){
return daysLastCompleted;
}
}
|
UTF-8
|
Java
| 1,300 |
java
|
WorkoutSet.java
|
Java
|
[] | null |
[] |
package com.cloud7831.strongereveryday.Objects;
public class WorkoutSet {
// A workout set is a collection of exercises.
// A workout set can be user made, but there are also some basic ones, such as Abs, Chest, etc.
private int daysLastCompleted; // The amount of days that have gone by since this workout set has been completed.
private String workoutName; // E.g. Abs, Chest, Legs, etc.
private int colour; // Colour of the WorkoutSet when displayed in a list.
// private ExerciseID[] exercises;
public WorkoutSet(String name, int days){
// TODO: Create a database to store the basic info of WorkoutSets so that they can appear in the Workout List.
// TODO: WorkoutSets themselves contain more information (Which exercises are in them, etc)
// TODO: that doesn't need to be shown in a list.
// TODO: A WorkoutSet is stored as a JSON.
// TODO: A WorkoutSet contains a list of Exercises.
// TODO: A WorkoutSet can contain a WorkoutSet (can't be recursive, though.)
daysLastCompleted = days;
workoutName = name;
this.colour = colour;
}
public String getWorkoutName(){
return workoutName;
}
public int getDaysLastCompleted(){
return daysLastCompleted;
}
}
| 1,300 | 0.677692 | 0.674615 | 36 | 35.111111 | 35.293827 | 118 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.555556 | false | false |
12
|
f9fb77a3ee46b4a94e744988fdae0f4bd25d2f3a
| 37,787,122,301,942 |
306ae282a36c2d2e70350f509da2c191766312f3
|
/src/algos/warmup/ExtraLongFactorials.java
|
187b011945e1c5c5da417a2d88ed773b2c48981b
|
[] |
no_license
|
suruSharma/hackerrank
|
https://github.com/suruSharma/hackerrank
|
c6679b2628f02be204cb87c841580b57513edc83
|
442899fe04da9df55525dc0965922e67855d27cb
|
refs/heads/master
| 2021-01-10T03:10:17.809000 | 2015-11-13T20:22:27 | 2015-11-13T20:22:27 | 45,281,374 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package algos.warmup;
import java.math.BigInteger;
import java.util.Scanner;
public class ExtraLongFactorials {
public static void main(String[] args) {
/*
* Enter your code here. Read input from STDIN. Print output to STDOUT. Your
* class should be named Solution.
*/
Scanner in = new Scanner(System.in);
int n = in.nextInt();
BigInteger result = fact(n);
System.out.println(result);
}
static BigInteger fact(int n) {
if (n == 0 || n == 1) {
return new BigInteger("1");
} else {
return new BigInteger(n + "").multiply(fact((n - 1)));
}
}
}
|
UTF-8
|
Java
| 611 |
java
|
ExtraLongFactorials.java
|
Java
|
[] | null |
[] |
package algos.warmup;
import java.math.BigInteger;
import java.util.Scanner;
public class ExtraLongFactorials {
public static void main(String[] args) {
/*
* Enter your code here. Read input from STDIN. Print output to STDOUT. Your
* class should be named Solution.
*/
Scanner in = new Scanner(System.in);
int n = in.nextInt();
BigInteger result = fact(n);
System.out.println(result);
}
static BigInteger fact(int n) {
if (n == 0 || n == 1) {
return new BigInteger("1");
} else {
return new BigInteger(n + "").multiply(fact((n - 1)));
}
}
}
| 611 | 0.618658 | 0.612111 | 25 | 23.440001 | 19.867723 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.44 | false | false |
12
|
3ac246c8f59ba1e505ae5560bc4151862598f464
| 39,522,289,082,890 |
1cb5856765c5ea327e824f72dd4b80075c955e7e
|
/src/main/java/com/decipher/agriculture/dao/farm/impl/FarmDaoImpl.java
|
71c5ddaf8b0186c9caaa41ae9f6571ea02096b6c
|
[] |
no_license
|
soni112/planting-profits-private
|
https://github.com/soni112/planting-profits-private
|
96d461adbf613dfb4c8df42a41c833d15e115f12
|
a90530aeb6128b3ec46639cd55b8058664356852
|
refs/heads/master
| 2023-01-09T16:20:36.367000 | 2019-05-01T13:35:18 | 2019-05-01T13:35:18 | 218,706,519 | 0 | 0 | null | false | 2023-01-02T22:12:53 | 2019-10-31T07:16:20 | 2019-10-31T07:32:59 | 2023-01-02T22:12:50 | 26,829 | 0 | 0 | 26 |
Java
| false | false |
package com.decipher.agriculture.dao.farm.impl;
import com.decipher.agriculture.data.farm.FarmData;
import com.decipher.agriculture.dao.farm.FarmDao;
import com.decipher.agriculture.data.farm.Farm;
import com.decipher.agriculture.data.farm.FarmInfo;
import com.decipher.agriculture.service.farm.FarmInfoService;
import com.decipher.agriculture.service.farm.impl.UploadExcelServiceImpl;
import com.decipher.util.PlantingProfitLogger;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import javax.transaction.Transactional;
import java.util.ArrayList;
import java.util.List;
/**
* Created by abhishek on 30/11/16.
*/
@Repository
@Transactional
public class FarmDaoImpl implements FarmDao {
@Autowired
private FarmInfoService farmInfoService;
@Autowired
private SessionFactory sessionFactory;
@Override
public boolean isFarmExitsWithNameAndUserId(String farmName, int accountId) {
Session session = sessionFactory.openSession();
Object object = null;
PlantingProfitLogger.info("Trying to find farm with name : " + farmName + " for account id : " + accountId);
try {
Query userQuery = session.createQuery("from Farm where farmName=:farmName and account.id=:accountId and saveFlag=:saveFlag");
userQuery.setParameter("farmName", farmName);
userQuery.setParameter("accountId", accountId);
userQuery.setParameter("saveFlag", true);
object = userQuery.uniqueResult();
PlantingProfitLogger.info("Farm with name : " + farmName + " exists");
} catch (Exception e) {
PlantingProfitLogger.error("Error while trying ot find farm with name : " + farmName, e);
} finally {
session.close();
}
return object != null;
}
@Override
public Farm getFarmById(int farmId) {
Session session = sessionFactory.openSession();
Transaction transaction = session.getTransaction();
Farm farm = null;
PlantingProfitLogger.info("Trying to get farm by id : " + farmId);
try {
transaction.begin();
Query query = session.createQuery("from Farm where id=:id");
query.setParameter("id", farmId);
farm = (Farm) query.uniqueResult();
if (farm != null)
initializeLazy(farm);
transaction.commit();
} catch (Exception e) {
PlantingProfitLogger.error("Error while getting farm for id : " + farmId, e);
transaction.rollback();
} finally {
session.close();
}
PlantingProfitLogger.info("Completed getting farm by id : " + farmId);
return farm;
}
@Override
public int saveFarm(Farm farm) {
Session session = sessionFactory.openSession();
Transaction transaction = session.getTransaction();
PlantingProfitLogger.info("Trying to save farm named : " + farm.getFarmName());
int farmId = 0;
try {
transaction.begin();
farmId = (int) session.save(farm);
session.flush();
transaction.commit();
} catch (Exception e) {
transaction.rollback();
PlantingProfitLogger.error("Error while saving farm ", e);
return farmId;
} finally {
session.close();
}
PlantingProfitLogger.info("Successfully saved farm named : " + farm.getFarmName());
return farmId;
}
@Override
public void deleteFarm(Farm farm) {
Session session = sessionFactory.openSession();
Transaction transaction = session.getTransaction();
PlantingProfitLogger.info("Started deletion of farm : " + farm.getFarmName());
try {
transaction.begin();
session.delete(farm);
session.flush();
transaction.commit();
} catch (Exception e) {
transaction.rollback();
PlantingProfitLogger.error("Error deletion of farm : " + farm.getFarmName(), e);
} finally {
session.close();
}
PlantingProfitLogger.info("Completed deletion of farm : " + farm.getFarmName());
}
@Override
public boolean deleteAllFarmsForUser(int accountId) {
Session session = sessionFactory.openSession();
Transaction transaction = session.getTransaction();
PlantingProfitLogger.info("Started deletion of farm for user id : " + accountId);
boolean flag = false;
try {
transaction.begin();
Query query = session.createQuery("delete from Farm where account.id=:accountId");
query.setParameter("accountId", accountId);
int i = query.executeUpdate();
if (i > 0) {
flag = true;
}
session.flush();
transaction.commit();
} catch (Exception e) {
transaction.rollback();
PlantingProfitLogger.error("Error deletion of farm for user id : " + accountId, e);
flag = false;
} finally {
session.close();
}
PlantingProfitLogger.info("Completed deletion of farm for user id : " + accountId);
return flag;
}
@Override
public boolean deleteFarmByIds(String farmIdsString) {
Session session = sessionFactory.openSession();
Transaction transaction = session.getTransaction();
PlantingProfitLogger.info("Started deletion of farms with ids : " + farmIdsString);
boolean flag = false;
try {
transaction.begin();
Query query = session.createSQLQuery("CALL removeSelectedFarmsAndAllRecord(:farmId)");
query.setParameter("farmId", farmIdsString);
query.executeUpdate();
flag = true;
session.flush();
transaction.commit();
} catch (Exception e) {
transaction.rollback();
PlantingProfitLogger.error("Error deletion of farms with ids : " + farmIdsString, e);
flag = false;
} finally {
session.close();
}
PlantingProfitLogger.info("Completed deletion of farms with ids : " + farmIdsString);
return flag;
}
@Override
public boolean updateFarm(Farm farm) {
Session session = sessionFactory.openSession();
Transaction transaction = session.getTransaction();
boolean flag;
PlantingProfitLogger.info("Started updating farm : " + farm.getFarmName());
try {
transaction.begin();
session.update(farm);
session.flush();
transaction.commit();
flag = true;
} catch (Exception e) {
transaction.rollback();
PlantingProfitLogger.error("Error while updating farm : " + farm.getFarmName(), e);
flag = false;
} finally {
session.close();
}
PlantingProfitLogger.info("Completed updating farm : " + farm.getFarmName());
return flag;
}
@Override
public FarmInfo getBaselineFarmDetails(int farmId) {
Session session = sessionFactory.openSession();
PlantingProfitLogger.info("Getting baseline details for farmId : " + farmId);
FarmInfo farmInfo = null;
try {
Query query = session.createQuery("from FarmInfo where farm.id=:farmId and baselineFlag= true");
// Query query = session.createQuery("from Farm as farm inner join farm.farmInfoList as farmList on farmList.baselineFlag = true where farm.id=:farmId");
query.setParameter("farmId", farmId);
farmInfo = (FarmInfo) query.uniqueResult();
if (farmInfo != null) {
farmInfoService.initializeLazy(farmInfo);
}
} catch (Exception e) {
PlantingProfitLogger.error("Error while getting baseline details for farmId : " + farmId, e);
} finally {
session.close();
}
PlantingProfitLogger.info("Completed getting baseline details for farm id : " + farmId);
return farmInfo;
}
@Override
@SuppressWarnings("unchecked")
public List<Farm> getAllFarmsForUser(int userId) {
Session session = sessionFactory.openSession();
Transaction transaction = session.getTransaction();
List<Farm> farmList = new ArrayList<>();
try {
transaction.begin();
Query query = session.createQuery("from Farm where account.id=:userId");
query.setParameter("userId", userId);
List list = query.list();
if (list != null && !list.isEmpty()) {
farmList.addAll(list);
for (Farm farm : farmList) {
initializeLazy(farm);
}
}
transaction.commit();
} catch (Exception e) {
PlantingProfitLogger.error("Error while getting farms for account ", e);
transaction.rollback();
}
/*UploadExcelServiceImpl uploadExcelService = new UploadExcelServiceImpl();
uploadExcelService.saveStateNameAndLink();
ArrayList stateNameList = uploadExcelService.getStateName();
ArrayList stateLinkList = uploadExcelService.getStateLink();
if(session.createQuery("from FarmData").list().size() > 1){
PlantingProfitLogger.info("Excel Data already available in db");
}else {
for (int i = 0; i <= stateNameList.size() - 1; i++) {
Transaction transaction1 = session.getTransaction();
transaction1.begin();
String stateName = (String) stateNameList.get(i);
String stateLink = (String) stateLinkList.get(i);
FarmData farmData = new FarmData();
farmData.setState(stateName);
farmData.setStateAgStatistics(stateLink);
session.saveOrUpdate(farmData);
PlantingProfitLogger.info("Trying to save State Name : " + farmData.getState());
PlantingProfitLogger.info("Successfully saved state Link : " + farmData.getStateAgStatistics());
transaction1.commit();
}
}*/
finally {
session.close();
}
return farmList;
}
private void initializeLazy(Farm farm) {
// if(farm.getFarmInfoList().size() != 0)
// Hibernate.initialize(farm.getFarmInfoList());
// if(farm.getFarmCustomStrategy().size() != 0)
// Hibernate.initialize(farm.getFarmCustomStrategy());
}
}
|
UTF-8
|
Java
| 10,859 |
java
|
FarmDaoImpl.java
|
Java
|
[
{
"context": "rayList;\nimport java.util.List;\n\n/**\n * Created by abhishek on 30/11/16.\n */\n@Repository\n@Transactional\npubli",
"end": 795,
"score": 0.9992555379867554,
"start": 787,
"tag": "USERNAME",
"value": "abhishek"
}
] | null |
[] |
package com.decipher.agriculture.dao.farm.impl;
import com.decipher.agriculture.data.farm.FarmData;
import com.decipher.agriculture.dao.farm.FarmDao;
import com.decipher.agriculture.data.farm.Farm;
import com.decipher.agriculture.data.farm.FarmInfo;
import com.decipher.agriculture.service.farm.FarmInfoService;
import com.decipher.agriculture.service.farm.impl.UploadExcelServiceImpl;
import com.decipher.util.PlantingProfitLogger;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.Transaction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import javax.transaction.Transactional;
import java.util.ArrayList;
import java.util.List;
/**
* Created by abhishek on 30/11/16.
*/
@Repository
@Transactional
public class FarmDaoImpl implements FarmDao {
@Autowired
private FarmInfoService farmInfoService;
@Autowired
private SessionFactory sessionFactory;
@Override
public boolean isFarmExitsWithNameAndUserId(String farmName, int accountId) {
Session session = sessionFactory.openSession();
Object object = null;
PlantingProfitLogger.info("Trying to find farm with name : " + farmName + " for account id : " + accountId);
try {
Query userQuery = session.createQuery("from Farm where farmName=:farmName and account.id=:accountId and saveFlag=:saveFlag");
userQuery.setParameter("farmName", farmName);
userQuery.setParameter("accountId", accountId);
userQuery.setParameter("saveFlag", true);
object = userQuery.uniqueResult();
PlantingProfitLogger.info("Farm with name : " + farmName + " exists");
} catch (Exception e) {
PlantingProfitLogger.error("Error while trying ot find farm with name : " + farmName, e);
} finally {
session.close();
}
return object != null;
}
@Override
public Farm getFarmById(int farmId) {
Session session = sessionFactory.openSession();
Transaction transaction = session.getTransaction();
Farm farm = null;
PlantingProfitLogger.info("Trying to get farm by id : " + farmId);
try {
transaction.begin();
Query query = session.createQuery("from Farm where id=:id");
query.setParameter("id", farmId);
farm = (Farm) query.uniqueResult();
if (farm != null)
initializeLazy(farm);
transaction.commit();
} catch (Exception e) {
PlantingProfitLogger.error("Error while getting farm for id : " + farmId, e);
transaction.rollback();
} finally {
session.close();
}
PlantingProfitLogger.info("Completed getting farm by id : " + farmId);
return farm;
}
@Override
public int saveFarm(Farm farm) {
Session session = sessionFactory.openSession();
Transaction transaction = session.getTransaction();
PlantingProfitLogger.info("Trying to save farm named : " + farm.getFarmName());
int farmId = 0;
try {
transaction.begin();
farmId = (int) session.save(farm);
session.flush();
transaction.commit();
} catch (Exception e) {
transaction.rollback();
PlantingProfitLogger.error("Error while saving farm ", e);
return farmId;
} finally {
session.close();
}
PlantingProfitLogger.info("Successfully saved farm named : " + farm.getFarmName());
return farmId;
}
@Override
public void deleteFarm(Farm farm) {
Session session = sessionFactory.openSession();
Transaction transaction = session.getTransaction();
PlantingProfitLogger.info("Started deletion of farm : " + farm.getFarmName());
try {
transaction.begin();
session.delete(farm);
session.flush();
transaction.commit();
} catch (Exception e) {
transaction.rollback();
PlantingProfitLogger.error("Error deletion of farm : " + farm.getFarmName(), e);
} finally {
session.close();
}
PlantingProfitLogger.info("Completed deletion of farm : " + farm.getFarmName());
}
@Override
public boolean deleteAllFarmsForUser(int accountId) {
Session session = sessionFactory.openSession();
Transaction transaction = session.getTransaction();
PlantingProfitLogger.info("Started deletion of farm for user id : " + accountId);
boolean flag = false;
try {
transaction.begin();
Query query = session.createQuery("delete from Farm where account.id=:accountId");
query.setParameter("accountId", accountId);
int i = query.executeUpdate();
if (i > 0) {
flag = true;
}
session.flush();
transaction.commit();
} catch (Exception e) {
transaction.rollback();
PlantingProfitLogger.error("Error deletion of farm for user id : " + accountId, e);
flag = false;
} finally {
session.close();
}
PlantingProfitLogger.info("Completed deletion of farm for user id : " + accountId);
return flag;
}
@Override
public boolean deleteFarmByIds(String farmIdsString) {
Session session = sessionFactory.openSession();
Transaction transaction = session.getTransaction();
PlantingProfitLogger.info("Started deletion of farms with ids : " + farmIdsString);
boolean flag = false;
try {
transaction.begin();
Query query = session.createSQLQuery("CALL removeSelectedFarmsAndAllRecord(:farmId)");
query.setParameter("farmId", farmIdsString);
query.executeUpdate();
flag = true;
session.flush();
transaction.commit();
} catch (Exception e) {
transaction.rollback();
PlantingProfitLogger.error("Error deletion of farms with ids : " + farmIdsString, e);
flag = false;
} finally {
session.close();
}
PlantingProfitLogger.info("Completed deletion of farms with ids : " + farmIdsString);
return flag;
}
@Override
public boolean updateFarm(Farm farm) {
Session session = sessionFactory.openSession();
Transaction transaction = session.getTransaction();
boolean flag;
PlantingProfitLogger.info("Started updating farm : " + farm.getFarmName());
try {
transaction.begin();
session.update(farm);
session.flush();
transaction.commit();
flag = true;
} catch (Exception e) {
transaction.rollback();
PlantingProfitLogger.error("Error while updating farm : " + farm.getFarmName(), e);
flag = false;
} finally {
session.close();
}
PlantingProfitLogger.info("Completed updating farm : " + farm.getFarmName());
return flag;
}
@Override
public FarmInfo getBaselineFarmDetails(int farmId) {
Session session = sessionFactory.openSession();
PlantingProfitLogger.info("Getting baseline details for farmId : " + farmId);
FarmInfo farmInfo = null;
try {
Query query = session.createQuery("from FarmInfo where farm.id=:farmId and baselineFlag= true");
// Query query = session.createQuery("from Farm as farm inner join farm.farmInfoList as farmList on farmList.baselineFlag = true where farm.id=:farmId");
query.setParameter("farmId", farmId);
farmInfo = (FarmInfo) query.uniqueResult();
if (farmInfo != null) {
farmInfoService.initializeLazy(farmInfo);
}
} catch (Exception e) {
PlantingProfitLogger.error("Error while getting baseline details for farmId : " + farmId, e);
} finally {
session.close();
}
PlantingProfitLogger.info("Completed getting baseline details for farm id : " + farmId);
return farmInfo;
}
@Override
@SuppressWarnings("unchecked")
public List<Farm> getAllFarmsForUser(int userId) {
Session session = sessionFactory.openSession();
Transaction transaction = session.getTransaction();
List<Farm> farmList = new ArrayList<>();
try {
transaction.begin();
Query query = session.createQuery("from Farm where account.id=:userId");
query.setParameter("userId", userId);
List list = query.list();
if (list != null && !list.isEmpty()) {
farmList.addAll(list);
for (Farm farm : farmList) {
initializeLazy(farm);
}
}
transaction.commit();
} catch (Exception e) {
PlantingProfitLogger.error("Error while getting farms for account ", e);
transaction.rollback();
}
/*UploadExcelServiceImpl uploadExcelService = new UploadExcelServiceImpl();
uploadExcelService.saveStateNameAndLink();
ArrayList stateNameList = uploadExcelService.getStateName();
ArrayList stateLinkList = uploadExcelService.getStateLink();
if(session.createQuery("from FarmData").list().size() > 1){
PlantingProfitLogger.info("Excel Data already available in db");
}else {
for (int i = 0; i <= stateNameList.size() - 1; i++) {
Transaction transaction1 = session.getTransaction();
transaction1.begin();
String stateName = (String) stateNameList.get(i);
String stateLink = (String) stateLinkList.get(i);
FarmData farmData = new FarmData();
farmData.setState(stateName);
farmData.setStateAgStatistics(stateLink);
session.saveOrUpdate(farmData);
PlantingProfitLogger.info("Trying to save State Name : " + farmData.getState());
PlantingProfitLogger.info("Successfully saved state Link : " + farmData.getStateAgStatistics());
transaction1.commit();
}
}*/
finally {
session.close();
}
return farmList;
}
private void initializeLazy(Farm farm) {
// if(farm.getFarmInfoList().size() != 0)
// Hibernate.initialize(farm.getFarmInfoList());
// if(farm.getFarmCustomStrategy().size() != 0)
// Hibernate.initialize(farm.getFarmCustomStrategy());
}
}
| 10,859 | 0.607883 | 0.606409 | 285 | 37.101753 | 28.981909 | 164 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.645614 | false | false |
12
|
0b48f2482f3e934b39717898bd0336a51d114fbd
| 37,434,934,980,799 |
2564ba2a5fc25fefc595acfc11784501f882ee32
|
/app/src/main/java/com/example/das/CAT2/RegisterActivity.java
|
e2b89233f99e00cf9d32ac66ef429cac1df7a845
|
[] |
no_license
|
kingDarius254/094385
|
https://github.com/kingDarius254/094385
|
68c06bc223808788ed5c8732cb8db88c3b7ab6af
|
4b6ecb18545749578e684409f9d20dce83bc5957
|
refs/heads/master
| 2020-03-22T11:13:27.437000 | 2018-07-06T08:44:20 | 2018-07-06T08:44:20 | 139,956,385 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.das.CAT2;
import android.app.Activity;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
import com.example.das.CAT2.R;
public class RegisterActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
}
public void registerAccount(View view) {
// validate the form
EditText fullnameField = (EditText)findViewById(R.id.userFullName);
EditText userEmailField = (EditText)findViewById(R.id.userEmail);
EditText usernameField = (EditText)findViewById(R.id.username);
EditText passwordField = (EditText)findViewById(R.id.password);
EditText confirmPasswordField = (EditText)findViewById(R.id.passwordConfirm);
String fullName = fullnameField.getText().toString();
String userEmail = userEmailField.getText().toString();
String username = usernameField.getText().toString();
String password = passwordField.getText().toString();
String confirmPassword = confirmPasswordField.getText().toString();
try {
if(!confirmPassword.equals(password)) {
Toast.makeText(this, "Passwords do not match.", Toast.LENGTH_LONG).show();
}
else {
UserHelper.CreateUser(fullName, userEmail, username, password);
setResult(Activity.RESULT_OK, getIntent());
this.finish();
}
} catch (Exception e) {
Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();
}
}
public void cancel(View view) {
setResult(Activity.RESULT_CANCELED, getIntent());
}
}
|
UTF-8
|
Java
| 1,870 |
java
|
RegisterActivity.java
|
Java
|
[
{
"context": "tText usernameField = (EditText)findViewById(R.id.username);\n EditText passwordField = (EditText)find",
"end": 781,
"score": 0.7692629098892212,
"start": 773,
"tag": "USERNAME",
"value": "username"
},
{
"context": "ld.getText().toString();\n String username = usernameField.getText().toString();\n String passwor",
"end": 1103,
"score": 0.6766926646232605,
"start": 1095,
"tag": "USERNAME",
"value": "username"
}
] | null |
[] |
package com.example.das.CAT2;
import android.app.Activity;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;
import com.example.das.CAT2.R;
public class RegisterActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_register);
}
public void registerAccount(View view) {
// validate the form
EditText fullnameField = (EditText)findViewById(R.id.userFullName);
EditText userEmailField = (EditText)findViewById(R.id.userEmail);
EditText usernameField = (EditText)findViewById(R.id.username);
EditText passwordField = (EditText)findViewById(R.id.password);
EditText confirmPasswordField = (EditText)findViewById(R.id.passwordConfirm);
String fullName = fullnameField.getText().toString();
String userEmail = userEmailField.getText().toString();
String username = usernameField.getText().toString();
String password = passwordField.getText().toString();
String confirmPassword = confirmPasswordField.getText().toString();
try {
if(!confirmPassword.equals(password)) {
Toast.makeText(this, "Passwords do not match.", Toast.LENGTH_LONG).show();
}
else {
UserHelper.CreateUser(fullName, userEmail, username, password);
setResult(Activity.RESULT_OK, getIntent());
this.finish();
}
} catch (Exception e) {
Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();
}
}
public void cancel(View view) {
setResult(Activity.RESULT_CANCELED, getIntent());
}
}
| 1,870 | 0.667914 | 0.66631 | 49 | 37.163265 | 27.203951 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.714286 | false | false |
12
|
2f18f3da8d2333f00bc6e031edbafe03680f9b50
| 37,434,934,981,508 |
b897a8386f187e265207aac3fa8ee514221ff86f
|
/CarApp/src/main/java/com/demo/CarApp/controller/IBaseController.java
|
546e4f49f76147da5f3b88d8067d436087385f7c
|
[] |
no_license
|
devmjm/spring-rest-service-tutorial-complete
|
https://github.com/devmjm/spring-rest-service-tutorial-complete
|
20ba2abd288d21c5f4d19a0db51f879b888ab990
|
b87cd61e94506bf4320f785ba954811c9a7fba7d
|
refs/heads/master
| 2021-01-01T16:58:18.964000 | 2017-08-04T21:17:51 | 2017-08-04T21:17:51 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.demo.CarApp.controller;
public interface IBaseController {
}
|
UTF-8
|
Java
| 75 |
java
|
IBaseController.java
|
Java
|
[] | null |
[] |
package com.demo.CarApp.controller;
public interface IBaseController {
}
| 75 | 0.8 | 0.8 | 5 | 14 | 16.745148 | 35 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | false | false |
12
|
ed07a819cc3ac2b4b5d63cc302de1682624b1847
| 31,404,800,919,904 |
89ffe1c8875e802d20b3ab7c48c48e92ebf2af63
|
/Sources/[Java] JavaRAT/RAT-master/src/master/DeserializerCompte.java
|
6e06110a6cebd9462904cc1ba8875837baee3292
|
[] |
no_license
|
Gutem/RatSources
|
https://github.com/Gutem/RatSources
|
619c74b39894b03691a17bc3943d3dbb3bad4570
|
f7def063f6997b7808a9601ecf669940e1f1de79
|
refs/heads/master
| 2022-01-30T23:05:02.182000 | 2022-01-18T00:54:12 | 2022-01-18T00:54:12 | 258,354,145 | 1 | 1 | null | true | 2020-04-23T23:22:12 | 2020-04-23T23:22:12 | 2020-04-20T04:50:59 | 2018-03-14T08:08:31 | 352,044 | 0 | 0 | 0 | null | false | false |
package master;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
public class DeserializerCompte {
private static ObjectInputStream ois;
/**
* Permet de charger un compte
* @param args
* @return
*/
public static Compte charger(String args) {
Compte compte = null;
File fichier = new File(args);
try {
if (!fichier.canRead()) {
System.out.println("Problème de fichier\n");
}
ois = new ObjectInputStream(new FileInputStream(fichier));
compte = (Compte) ois.readObject();
} catch (IOException e) {
System.out.println(" Erreur lors de la lecture du fichier. ");
} catch (ClassNotFoundException e) {
System.out.println(" Erreur d ’objet.");
}
return (compte);
}
}
|
WINDOWS-1252
|
Java
| 782 |
java
|
DeserializerCompte.java
|
Java
|
[] | null |
[] |
package master;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
public class DeserializerCompte {
private static ObjectInputStream ois;
/**
* Permet de charger un compte
* @param args
* @return
*/
public static Compte charger(String args) {
Compte compte = null;
File fichier = new File(args);
try {
if (!fichier.canRead()) {
System.out.println("Problème de fichier\n");
}
ois = new ObjectInputStream(new FileInputStream(fichier));
compte = (Compte) ois.readObject();
} catch (IOException e) {
System.out.println(" Erreur lors de la lecture du fichier. ");
} catch (ClassNotFoundException e) {
System.out.println(" Erreur d ’objet.");
}
return (compte);
}
}
| 782 | 0.690629 | 0.690629 | 34 | 21.911764 | 18.2666 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.735294 | false | false |
12
|
fca172ab0e51931ba160cf7c5246a73b0d1ed875
| 31,404,800,920,182 |
090f21b7b1a03febc7bdc7c7c264f14ad568de87
|
/src/controller/Threads.java
|
4056f79c6ad007d1e3b52b814e84b1928fb0c2f6
|
[] |
no_license
|
thiago-sant/SegundaTarefaThreads
|
https://github.com/thiago-sant/SegundaTarefaThreads
|
3ae261a54dd5cd222d6cf998d2048b168b0e18db
|
35f91466a3f0a850b090b57ddff92bd38448b2db
|
refs/heads/master
| 2023-03-21T10:44:20.004000 | 2021-03-09T23:28:30 | 2021-03-09T23:28:30 | 346,172,669 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package controller;
public class Threads extends Thread {
private int IdThread;
public Threads (int IdThread) {
this.IdThread = IdThread;
}
@Override
public void run() {
IdThread();
}
public void IdThread() {
System.out.println("O ID da Thread é: "+ IdThread);
}
}
|
WINDOWS-1252
|
Java
| 306 |
java
|
Threads.java
|
Java
|
[] | null |
[] |
package controller;
public class Threads extends Thread {
private int IdThread;
public Threads (int IdThread) {
this.IdThread = IdThread;
}
@Override
public void run() {
IdThread();
}
public void IdThread() {
System.out.println("O ID da Thread é: "+ IdThread);
}
}
| 306 | 0.632787 | 0.632787 | 19 | 14.157895 | 15.006186 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.210526 | false | false |
12
|
8755060ddb05be6e5e6f052051a14c515fc73273
| 8,581,344,716,747 |
544829bfafb988b14911312b4da973f6b4c0c428
|
/YTrip/src/com/oldyang/ui/view/selectitem/SelectItemView.java
|
55f6559b1bc004002f733df498235c39cde62339
|
[] |
no_license
|
yanglun/YTrip
|
https://github.com/yanglun/YTrip
|
925d49d4f7998c6ec065424e224b7f1f89623542
|
8e3de1cc7b3137e7f277d6f098bb83c44843eb45
|
refs/heads/master
| 2021-01-10T21:18:50.126000 | 2014-05-14T01:37:02 | 2014-05-14T01:37:02 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
* @author 杨铁心
* @version 创建时间:2014-5-13 下午3:03:18
*/
package com.oldyang.ui.view.selectitem;
import com.oldyang.R;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
public class SelectItemView extends LinearLayout
{
private boolean bSelected = false;
private TextView tv_option_item_name;
private ImageView iv_item_selected;
public SelectItemView(Context context)
{
super(context);
init();
}
public SelectItemView(Context context, AttributeSet attrs)
{
super(context, attrs);
init();
}
void init()
{
LayoutInflater.from(getContext()).inflate(R.layout.ytrip_select_item_view, this, true);
tv_option_item_name = (TextView) this.findViewById(R.id.tv_option_item_name);
iv_item_selected = (ImageView) this.findViewById(R.id.iv_item_selected);
if (bSelected)
{
iv_item_selected.setVisibility(View.VISIBLE);
}
else
{
iv_item_selected.setVisibility(View.INVISIBLE);
}
}
public void setOptionItemName(String name)
{
tv_option_item_name.setText(name);
}
public void click()
{
bSelected = !bSelected;
if (bSelected)
{
iv_item_selected.setVisibility(View.VISIBLE);
}
else
{
iv_item_selected.setVisibility(View.INVISIBLE);
}
}
public void setUnChecked(){
bSelected = false;
iv_item_selected.setVisibility(View.INVISIBLE);
}
}
|
UTF-8
|
Java
| 1,747 |
java
|
SelectItemView.java
|
Java
|
[
{
"context": "/**\n * @author 杨铁心\n * @version 创建时间:2014-5-13 下午3:03:18\n */\n\npackage",
"end": 19,
"score": 0.9998177289962769,
"start": 16,
"tag": "NAME",
"value": "杨铁心"
}
] | null |
[] |
/**
* @author 杨铁心
* @version 创建时间:2014-5-13 下午3:03:18
*/
package com.oldyang.ui.view.selectitem;
import com.oldyang.R;
import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
public class SelectItemView extends LinearLayout
{
private boolean bSelected = false;
private TextView tv_option_item_name;
private ImageView iv_item_selected;
public SelectItemView(Context context)
{
super(context);
init();
}
public SelectItemView(Context context, AttributeSet attrs)
{
super(context, attrs);
init();
}
void init()
{
LayoutInflater.from(getContext()).inflate(R.layout.ytrip_select_item_view, this, true);
tv_option_item_name = (TextView) this.findViewById(R.id.tv_option_item_name);
iv_item_selected = (ImageView) this.findViewById(R.id.iv_item_selected);
if (bSelected)
{
iv_item_selected.setVisibility(View.VISIBLE);
}
else
{
iv_item_selected.setVisibility(View.INVISIBLE);
}
}
public void setOptionItemName(String name)
{
tv_option_item_name.setText(name);
}
public void click()
{
bSelected = !bSelected;
if (bSelected)
{
iv_item_selected.setVisibility(View.VISIBLE);
}
else
{
iv_item_selected.setVisibility(View.INVISIBLE);
}
}
public void setUnChecked(){
bSelected = false;
iv_item_selected.setVisibility(View.INVISIBLE);
}
}
| 1,747 | 0.627678 | 0.62073 | 73 | 22.657534 | 22.249039 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.424658 | false | false |
12
|
a142245008cbe2a017cc05fde300a1eb7b69ca99
| 11,536,282,179,522 |
3568c9772fad54ffe71683de31525464642f3cf9
|
/word8/src/main/java/eu/doppel_helix/jna/tlb/word8/Hyperlinks.java
|
0f058b91711c1311aad54b3ab66bf42451394273
|
[
"MIT"
] |
permissive
|
NoonRightsWarriorBehindHovering/COMTypelibraries
|
https://github.com/NoonRightsWarriorBehindHovering/COMTypelibraries
|
c853c41bb495031702d0ad7a4d215ab894c12bbd
|
c17acfca689305c0e23d4ff9d8ee437e0ee3d437
|
refs/heads/master
| 2023-06-21T20:52:51.519000 | 2020-03-13T22:33:48 | 2020-03-13T22:33:48 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package eu.doppel_helix.jna.tlb.word8;
import com.sun.jna.platform.win32.COM.util.annotation.ComInterface;
import com.sun.jna.platform.win32.COM.util.annotation.ComMethod;
import com.sun.jna.platform.win32.COM.util.annotation.ComProperty;
import com.sun.jna.platform.win32.COM.util.IDispatch;
import com.sun.jna.platform.win32.COM.util.IUnknown;
import com.sun.jna.platform.win32.COM.util.IRawDispatchHandle;
import com.sun.jna.platform.win32.Variant.VARIANT;
/**
* <p>uuid({0002099C-0000-0000-C000-000000000046})</p>
*/
@ComInterface(iid="{0002099C-0000-0000-C000-000000000046}")
public interface Hyperlinks extends IUnknown, IRawDispatchHandle, IDispatch {
/**
* <p>id(0x3e8)</p>
* <p>vtableId(7)</p>
*/
@ComProperty(name = "Application", dispId = 0x3e8)
Application getApplication();
/**
* <p>id(0x3e9)</p>
* <p>vtableId(8)</p>
*/
@ComProperty(name = "Creator", dispId = 0x3e9)
Integer getCreator();
/**
* <p>id(0x3ea)</p>
* <p>vtableId(9)</p>
*/
@ComProperty(name = "Parent", dispId = 0x3ea)
com.sun.jna.platform.win32.COM.util.IDispatch getParent();
/**
* <p>id(0x1)</p>
* <p>vtableId(10)</p>
*/
@ComProperty(name = "Count", dispId = 0x1)
Integer getCount();
/**
* <p>id(0x0)</p>
* <p>vtableId(12)</p>
* @param Index [in] {@code Object}
*/
@ComMethod(name = "Item", dispId = 0x0)
Hyperlink Item(Object Index);
/**
* <p>id(0x64)</p>
* <p>vtableId(13)</p>
* @param Anchor [in] {@code com.sun.jna.platform.win32.COM.util.IDispatch}
* @param Address [in, optional] {@code Object}
* @param SubAddress [in, optional] {@code Object}
*/
@ComMethod(name = "_Add", dispId = 0x64)
Hyperlink _Add(com.sun.jna.platform.win32.COM.util.IDispatch Anchor,
Object Address,
Object SubAddress);
/**
* <p>id(0x65)</p>
* <p>vtableId(14)</p>
* @param Anchor [in] {@code com.sun.jna.platform.win32.COM.util.IDispatch}
* @param Address [in, optional] {@code Object}
* @param SubAddress [in, optional] {@code Object}
* @param ScreenTip [in, optional] {@code Object}
* @param TextToDisplay [in, optional] {@code Object}
* @param Target [in, optional] {@code Object}
*/
@ComMethod(name = "Add", dispId = 0x65)
Hyperlink Add(com.sun.jna.platform.win32.COM.util.IDispatch Anchor,
Object Address,
Object SubAddress,
Object ScreenTip,
Object TextToDisplay,
Object Target);
}
|
UTF-8
|
Java
| 2,671 |
java
|
Hyperlinks.java
|
Java
|
[] | null |
[] |
package eu.doppel_helix.jna.tlb.word8;
import com.sun.jna.platform.win32.COM.util.annotation.ComInterface;
import com.sun.jna.platform.win32.COM.util.annotation.ComMethod;
import com.sun.jna.platform.win32.COM.util.annotation.ComProperty;
import com.sun.jna.platform.win32.COM.util.IDispatch;
import com.sun.jna.platform.win32.COM.util.IUnknown;
import com.sun.jna.platform.win32.COM.util.IRawDispatchHandle;
import com.sun.jna.platform.win32.Variant.VARIANT;
/**
* <p>uuid({0002099C-0000-0000-C000-000000000046})</p>
*/
@ComInterface(iid="{0002099C-0000-0000-C000-000000000046}")
public interface Hyperlinks extends IUnknown, IRawDispatchHandle, IDispatch {
/**
* <p>id(0x3e8)</p>
* <p>vtableId(7)</p>
*/
@ComProperty(name = "Application", dispId = 0x3e8)
Application getApplication();
/**
* <p>id(0x3e9)</p>
* <p>vtableId(8)</p>
*/
@ComProperty(name = "Creator", dispId = 0x3e9)
Integer getCreator();
/**
* <p>id(0x3ea)</p>
* <p>vtableId(9)</p>
*/
@ComProperty(name = "Parent", dispId = 0x3ea)
com.sun.jna.platform.win32.COM.util.IDispatch getParent();
/**
* <p>id(0x1)</p>
* <p>vtableId(10)</p>
*/
@ComProperty(name = "Count", dispId = 0x1)
Integer getCount();
/**
* <p>id(0x0)</p>
* <p>vtableId(12)</p>
* @param Index [in] {@code Object}
*/
@ComMethod(name = "Item", dispId = 0x0)
Hyperlink Item(Object Index);
/**
* <p>id(0x64)</p>
* <p>vtableId(13)</p>
* @param Anchor [in] {@code com.sun.jna.platform.win32.COM.util.IDispatch}
* @param Address [in, optional] {@code Object}
* @param SubAddress [in, optional] {@code Object}
*/
@ComMethod(name = "_Add", dispId = 0x64)
Hyperlink _Add(com.sun.jna.platform.win32.COM.util.IDispatch Anchor,
Object Address,
Object SubAddress);
/**
* <p>id(0x65)</p>
* <p>vtableId(14)</p>
* @param Anchor [in] {@code com.sun.jna.platform.win32.COM.util.IDispatch}
* @param Address [in, optional] {@code Object}
* @param SubAddress [in, optional] {@code Object}
* @param ScreenTip [in, optional] {@code Object}
* @param TextToDisplay [in, optional] {@code Object}
* @param Target [in, optional] {@code Object}
*/
@ComMethod(name = "Add", dispId = 0x65)
Hyperlink Add(com.sun.jna.platform.win32.COM.util.IDispatch Anchor,
Object Address,
Object SubAddress,
Object ScreenTip,
Object TextToDisplay,
Object Target);
}
| 2,671 | 0.596031 | 0.546612 | 83 | 31.180723 | 21.996244 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.457831 | false | false |
12
|
a283905205ddcbc5d10a6e8edb2a68896c8ed007
| 30,399,778,528,210 |
9b3021219332fef06a9ac62d31c4d5dc83068ddf
|
/Twitter_thread_per_client_server/src/ServerStomp/ReceiptFramInterface.java
|
d295a38a3d419a08b9bbe67a7e5213564cf1be78
|
[] |
no_license
|
ofrioster/assi4
|
https://github.com/ofrioster/assi4
|
61da012bbfda0ac0426dfc6018f3a085bb96cda4
|
1c533713b38956ce53a8d598b234e3c67590660b
|
refs/heads/master
| 2020-04-11T04:44:22.228000 | 2014-01-28T16:07:02 | 2014-01-28T16:07:02 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package ServerStomp;
public interface ReceiptFramInterface {
}
|
UTF-8
|
Java
| 65 |
java
|
ReceiptFramInterface.java
|
Java
|
[] | null |
[] |
package ServerStomp;
public interface ReceiptFramInterface {
}
| 65 | 0.815385 | 0.815385 | 5 | 12 | 15.504838 | 39 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | false | false |
12
|
a1e4fc24ddf877ae3f838555c5d7da9c7eb7218e
| 23,605,140,295,232 |
57c415c64bdf1402a166dd04f75fb148648f3c89
|
/app/src/main/java/com/ysl/mymvp/evelautor/PointEvelautor.java
|
47a9b29403d3c7329a0c9379b4c735e0570c84c7
|
[] |
no_license
|
SongLinYang12138/androidmvp-master
|
https://github.com/SongLinYang12138/androidmvp-master
|
4e4df3a43ec11dfa9cc08b68d2dec02f27abd04c
|
588c3261975ef0d6db8d189e4ad57fef29856ac5
|
refs/heads/master
| 2021-09-07T20:03:08.627000 | 2018-02-28T08:43:55 | 2018-02-28T08:43:55 | 111,084,324 | 3 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.ysl.mymvp.evelautor;
import android.animation.TypeEvaluator;
import android.graphics.Color;
import android.graphics.Paint;
/**
* Created by ysl on 2017/7/14.
*/
public class PointEvelautor implements TypeEvaluator<Paint> {
private int[] color = new int[]{Color.BLUE, Color.BLACK, Color.GRAY, Color.WHITE, Color.RED};
@Override
public Paint evaluate(float v, Paint startValue, Paint endValue) {
int position = (int) ((Math.random() * 4));
Paint paint = new Paint();
paint.setColor(color[position]);
return startValue;
}
}
|
UTF-8
|
Java
| 591 |
java
|
PointEvelautor.java
|
Java
|
[
{
"context": "\nimport android.graphics.Paint;\n\n/**\n * Created by ysl on 2017/7/14.\n */\npublic class PointEvelautor imp",
"end": 158,
"score": 0.9995635747909546,
"start": 155,
"tag": "USERNAME",
"value": "ysl"
}
] | null |
[] |
package com.ysl.mymvp.evelautor;
import android.animation.TypeEvaluator;
import android.graphics.Color;
import android.graphics.Paint;
/**
* Created by ysl on 2017/7/14.
*/
public class PointEvelautor implements TypeEvaluator<Paint> {
private int[] color = new int[]{Color.BLUE, Color.BLACK, Color.GRAY, Color.WHITE, Color.RED};
@Override
public Paint evaluate(float v, Paint startValue, Paint endValue) {
int position = (int) ((Math.random() * 4));
Paint paint = new Paint();
paint.setColor(color[position]);
return startValue;
}
}
| 591 | 0.678511 | 0.664975 | 25 | 22.639999 | 25.898077 | 97 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6 | false | false |
12
|
94b3c01ec4c1d8036c166b894662ada8a22f6421
| 21,612,275,487,645 |
6a4f4adbc292b633221efd58b5935dd30f84b05e
|
/src/test/java/org/isi/CalculatorSonarAppApplicationTests.java
|
630e50694ac0d81a88fecd52180f6a1e19e506b9
|
[] |
no_license
|
aliarabat/calculator-sonar-app
|
https://github.com/aliarabat/calculator-sonar-app
|
aefc86c0f58d1d16c93f3f0852b11532bef899b3
|
cef6c17ef41b33bf63079cbc78c1541ef534d812
|
refs/heads/master
| 2021-04-05T02:03:28.260000 | 2020-03-19T14:40:05 | 2020-03-19T14:40:05 | 248,511,799 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.isi;
import static org.assertj.core.api.Assertions.assertThat;
import org.isi.dao.ProductRepository;
import org.isi.model.Product;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class CalculatorSonarAppApplicationTests {
@Autowired
ProductRepository pRepository;
@Test
void productExist() {
Product pFounded = pRepository.getOne((long) 1);
assertThat(pFounded).isNotNull();
}
@Test
void productDoesntExist() {
Product pFounded = pRepository.getOne((long) 4);
assertThat(pFounded).isNotNull();
}
}
|
UTF-8
|
Java
| 660 |
java
|
CalculatorSonarAppApplicationTests.java
|
Java
|
[] | null |
[] |
package org.isi;
import static org.assertj.core.api.Assertions.assertThat;
import org.isi.dao.ProductRepository;
import org.isi.model.Product;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class CalculatorSonarAppApplicationTests {
@Autowired
ProductRepository pRepository;
@Test
void productExist() {
Product pFounded = pRepository.getOne((long) 1);
assertThat(pFounded).isNotNull();
}
@Test
void productDoesntExist() {
Product pFounded = pRepository.getOne((long) 4);
assertThat(pFounded).isNotNull();
}
}
| 660 | 0.784849 | 0.781818 | 29 | 21.758621 | 20.724224 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.965517 | false | false |
12
|
48474d9c717197e699eeb047e799ec8be84b6d16
| 2,070,174,277,101 |
d6a9964b2fc4d137170af51cb41aa474954a21aa
|
/src/main/java/com/bwssystems/HABridge/plugins/fibaro/json/DeviceProperties.java
|
cdac20d324332b4711569d03ac8d5c293dae8ad8
|
[
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] |
permissive
|
bwssytems/ha-bridge
|
https://github.com/bwssytems/ha-bridge
|
b48da9eff92e11184f149840e141ea6f9cc4856a
|
483b165f2a3b1fcde8d0bd152819022b90610417
|
refs/heads/master
| 2023-09-04T22:29:12.486000 | 2022-02-10T15:32:19 | 2022-02-10T15:32:19 | 39,848,099 | 1,604 | 283 |
Apache-2.0
| false | 2023-09-14T07:38:29 | 2015-07-28T17:27:11 | 2023-08-25T02:36:48 | 2023-09-14T07:38:28 | 3,290 | 1,441 | 200 | 148 |
Java
| false | false |
package com.bwssystems.HABridge.plugins.fibaro.json;
import com.google.gson.annotations.SerializedName;
public class DeviceProperties {
@SerializedName("value")
private String value;
@SerializedName("saveLogs")
private String saveLogs;
@SerializedName("userDescription")
private String userDescription;
public String getValue() {
return value;
}
public String getSaveLogs() {
return saveLogs;
}
public String getUserDescription() {
return userDescription;
}
}
|
UTF-8
|
Java
| 512 |
java
|
DeviceProperties.java
|
Java
|
[] | null |
[] |
package com.bwssystems.HABridge.plugins.fibaro.json;
import com.google.gson.annotations.SerializedName;
public class DeviceProperties {
@SerializedName("value")
private String value;
@SerializedName("saveLogs")
private String saveLogs;
@SerializedName("userDescription")
private String userDescription;
public String getValue() {
return value;
}
public String getSaveLogs() {
return saveLogs;
}
public String getUserDescription() {
return userDescription;
}
}
| 512 | 0.726563 | 0.726563 | 23 | 21.26087 | 16.39782 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.695652 | false | false |
12
|
1ca9bfd0d9d9656432376ffa639132c9e528f783
| 21,225,728,406,105 |
70cef0958e1436f08e7464c70e21188953966438
|
/jphp-android-ext/src-jvm/main/java/org/venity/jphp/ext/android/fx/classes/event/UXMouseEvent.java
|
09b652012451b3dbc21baf7632abae36266a922f
|
[
"Apache-2.0"
] |
permissive
|
VenityStudio/android
|
https://github.com/VenityStudio/android
|
ef8593bfa771af0d8098313b83ad881ede1bb245
|
9b6a779f037820a6adef72a0cf4726c5358573f9
|
refs/heads/master
| 2018-10-25T10:15:52.641000 | 2018-09-11T05:15:14 | 2018-09-11T05:15:14 | 144,194,366 | 6 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.venity.jphp.ext.android.fx.classes.event;
import javafx.scene.input.MouseButton;
import javafx.scene.input.MouseDragEvent;
import javafx.scene.input.MouseEvent;
import org.venity.jphp.ext.android.fx.JavaFXExtension;
import php.runtime.annotation.Reflection;
import php.runtime.annotation.Reflection.Getter;
import php.runtime.annotation.Reflection.Name;
import php.runtime.annotation.Reflection.Property;
import php.runtime.annotation.Reflection.Signature;
import php.runtime.env.Environment;
import php.runtime.reflection.ClassEntity;
@Reflection.Abstract
@Name(JavaFXExtension.NS + "event\\UXMouseEvent")
public class UXMouseEvent extends UXEvent {
interface WrappedInterface {
@Property double x();
@Property double y();
@Property double screenX();
@Property double screenY();
@Property int clickCount();
@Property MouseButton button();
@Property boolean dragDetect();
@Property boolean stillSincePress();
@Property boolean shiftDown();
@Property boolean controlDown();
@Property boolean altDown();
@Property boolean metaDown();
@Property boolean shortcutDown();
@Property boolean primaryButtonDown();
@Property boolean secondaryButtonDown();
@Property boolean middleButtonDown();
}
public UXMouseEvent(Environment env, MouseEvent wrappedObject) {
super(env, wrappedObject);
}
public UXMouseEvent(Environment env, MouseDragEvent wrappedObject) {
super(env, wrappedObject);
}
public UXMouseEvent(Environment env, ClassEntity clazz) {
super(env, clazz);
}
@Override
public MouseEvent getWrappedObject() {
return (MouseEvent) super.getWrappedObject();
}
@Getter
public double[] getPosition() {
return new double[] { getWrappedObject().getX(), getWrappedObject().getY() };
}
@Signature
public boolean isDoubleClick() {
return getWrappedObject().getClickCount() >= 2;
}
}
|
UTF-8
|
Java
| 2,039 |
java
|
UXMouseEvent.java
|
Java
|
[] | null |
[] |
package org.venity.jphp.ext.android.fx.classes.event;
import javafx.scene.input.MouseButton;
import javafx.scene.input.MouseDragEvent;
import javafx.scene.input.MouseEvent;
import org.venity.jphp.ext.android.fx.JavaFXExtension;
import php.runtime.annotation.Reflection;
import php.runtime.annotation.Reflection.Getter;
import php.runtime.annotation.Reflection.Name;
import php.runtime.annotation.Reflection.Property;
import php.runtime.annotation.Reflection.Signature;
import php.runtime.env.Environment;
import php.runtime.reflection.ClassEntity;
@Reflection.Abstract
@Name(JavaFXExtension.NS + "event\\UXMouseEvent")
public class UXMouseEvent extends UXEvent {
interface WrappedInterface {
@Property double x();
@Property double y();
@Property double screenX();
@Property double screenY();
@Property int clickCount();
@Property MouseButton button();
@Property boolean dragDetect();
@Property boolean stillSincePress();
@Property boolean shiftDown();
@Property boolean controlDown();
@Property boolean altDown();
@Property boolean metaDown();
@Property boolean shortcutDown();
@Property boolean primaryButtonDown();
@Property boolean secondaryButtonDown();
@Property boolean middleButtonDown();
}
public UXMouseEvent(Environment env, MouseEvent wrappedObject) {
super(env, wrappedObject);
}
public UXMouseEvent(Environment env, MouseDragEvent wrappedObject) {
super(env, wrappedObject);
}
public UXMouseEvent(Environment env, ClassEntity clazz) {
super(env, clazz);
}
@Override
public MouseEvent getWrappedObject() {
return (MouseEvent) super.getWrappedObject();
}
@Getter
public double[] getPosition() {
return new double[] { getWrappedObject().getX(), getWrappedObject().getY() };
}
@Signature
public boolean isDoubleClick() {
return getWrappedObject().getClickCount() >= 2;
}
}
| 2,039 | 0.698382 | 0.697891 | 68 | 28.985294 | 21.573059 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.602941 | false | false |
12
|
fb7a50441825160c933fdefe3b72d6e3c28768f5
| 15,212,774,195,747 |
350be8bd99ef21df7447d133d92a8f9054681074
|
/core-java/strings/StringBufferMethods.java
|
4c7630ddeff5121c0f89ee66aa92c23f21731fab
|
[] |
no_license
|
learning-zone/java-interview-questions
|
https://github.com/learning-zone/java-interview-questions
|
9a4136073f4cb7fdbbc94a52b1cc335e94425271
|
e8df17f0dd202d16298a14d7924943b7876a3690
|
refs/heads/master
| 2022-10-23T15:42:08.009000 | 2022-10-13T02:48:46 | 2022-10-13T02:48:46 | 174,074,983 | 1,182 | 571 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package strings;
public class StringBufferMethods {
public static void main(String[] args) {
StringBuffer str = new StringBuffer("Hello");
int len = str.length();
System.out.println("Length of String Hello: " + len);
int cap = str.capacity();
System.out.println("Capacity of String Hello: " + cap);
str.append(" World");
System.out.println("Appended String: " + str);
str.insert(5, " for");
System.out.println("After Insert String: " + str);
str.insert(0, 5);
System.out.println("After inserting 5 at first position: "+str);
str.insert(3, true);
System.out.println("After inseting true at 3rd position: "+ str);
char arr[] = {'p', 'r', 'a', 'd', 'e', 'e', 'p'};
// insert character array at offset 9
str.insert(0, arr);
System.out.println(str);
str.reverse();
System.out.println("Reverse String: " + str);
str.delete(0, 5);
System.out.println("After Delete: " + str);
str.deleteCharAt(7);
System.out.println("After delete: " + str);
str.replace(5, 8, "Happy");
System.out.println("After Replace: "+str);
}
}
|
UTF-8
|
Java
| 1,141 |
java
|
StringBufferMethods.java
|
Java
|
[] | null |
[] |
package strings;
public class StringBufferMethods {
public static void main(String[] args) {
StringBuffer str = new StringBuffer("Hello");
int len = str.length();
System.out.println("Length of String Hello: " + len);
int cap = str.capacity();
System.out.println("Capacity of String Hello: " + cap);
str.append(" World");
System.out.println("Appended String: " + str);
str.insert(5, " for");
System.out.println("After Insert String: " + str);
str.insert(0, 5);
System.out.println("After inserting 5 at first position: "+str);
str.insert(3, true);
System.out.println("After inseting true at 3rd position: "+ str);
char arr[] = {'p', 'r', 'a', 'd', 'e', 'e', 'p'};
// insert character array at offset 9
str.insert(0, arr);
System.out.println(str);
str.reverse();
System.out.println("Reverse String: " + str);
str.delete(0, 5);
System.out.println("After Delete: " + str);
str.deleteCharAt(7);
System.out.println("After delete: " + str);
str.replace(5, 8, "Happy");
System.out.println("After Replace: "+str);
}
}
| 1,141 | 0.604733 | 0.593339 | 47 | 23.276596 | 20.996151 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.680851 | false | false |
12
|
7e1e03a97c03025cbb2a5f620ea9a5313fc72e0c
| 5,832,565,590,504 |
40c39e01919231cbf46f2432d7d9485eae1d36d8
|
/UnivIndonesia/app/src/main/java/com/example/univindonesia/ActivityProfil.java
|
3d1b0a6cd77683aff52df21cdcc9a37d969ac33b
|
[] |
no_license
|
AdeSuryaning/PemrogramanPerangkatBergerak
|
https://github.com/AdeSuryaning/PemrogramanPerangkatBergerak
|
d2fe14132b80370de59a8fb8acd8c8c34f6b5ef6
|
996a811ee24e82fba8a072453181f640d0c59905
|
refs/heads/master
| 2020-12-04T12:56:28.790000 | 2020-01-25T14:53:55 | 2020-01-25T14:53:55 | 231,772,769 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.univindonesia;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
public class ActivityProfil extends AppCompatActivity implements View.OnClickListener {
Button button_back;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_profil);
button_back = findViewById(R.id.button_back);
button_back.setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.button_back:
Intent backIntent = new Intent(ActivityProfil.this, MainActivity.class);
startActivity(backIntent);
break;
}
}
}
|
UTF-8
|
Java
| 902 |
java
|
ActivityProfil.java
|
Java
|
[] | null |
[] |
package com.example.univindonesia;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
public class ActivityProfil extends AppCompatActivity implements View.OnClickListener {
Button button_back;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_profil);
button_back = findViewById(R.id.button_back);
button_back.setOnClickListener(this);
}
@Override
public void onClick(View v) {
switch (v.getId()) {
case R.id.button_back:
Intent backIntent = new Intent(ActivityProfil.this, MainActivity.class);
startActivity(backIntent);
break;
}
}
}
| 902 | 0.684035 | 0.684035 | 34 | 25.529411 | 23.567469 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.470588 | false | false |
12
|
6b8032d630fd8285c26386d91db810be04150802
| 19,198,503,866,799 |
e921703f9a60c42f054ebd0a277a8630e30277ec
|
/EpitechMessengerApp/app/src/main/java/com/gautier_lefebvre/epitechmessengerapp/entity/Message.java
|
e720872c3751b1ec82bc48c9514660878f215588
|
[] |
no_license
|
gerybaudry/android-retro-picture
|
https://github.com/gerybaudry/android-retro-picture
|
fa156b6636190c4629267531a78042b5ba38bfe6
|
d8e5014307eecc46d6367d8c776c9cbbe5b91a8b
|
refs/heads/master
| 2021-01-10T11:18:40.874000 | 2016-03-04T18:34:17 | 2016-03-04T18:34:17 | 51,207,432 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.gautier_lefebvre.epitechmessengerapp.entity;
public class Message {
public final User sender;
public final String content;
public final String date;
public boolean isRead;
public Message(User sender, String content, String date, boolean r) {
this.sender = sender;
this.content = content;
this.date = date;
this.isRead = r;
}
}
|
UTF-8
|
Java
| 397 |
java
|
Message.java
|
Java
|
[
{
"context": "package com.gautier_lefebvre.epitechmessengerapp.entity;\n\npublic class Message",
"end": 28,
"score": 0.928634524345398,
"start": 12,
"tag": "USERNAME",
"value": "gautier_lefebvre"
}
] | null |
[] |
package com.gautier_lefebvre.epitechmessengerapp.entity;
public class Message {
public final User sender;
public final String content;
public final String date;
public boolean isRead;
public Message(User sender, String content, String date, boolean r) {
this.sender = sender;
this.content = content;
this.date = date;
this.isRead = r;
}
}
| 397 | 0.664987 | 0.664987 | 15 | 25.466667 | 19.376503 | 73 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.8 | false | false |
12
|
d8ee328f82fcfe8897aee51550d839127916b074
| 12,970,801,299,123 |
09534c278861e04441712475790c08fe0b92f279
|
/app/src/main/java/com/walktour/service/phoneinfo/utils/MobileUtil.java
|
030faae9bc562bbac54ad272340c3d076ac94f1d
|
[] |
no_license
|
copslock/Walktour4
|
https://github.com/copslock/Walktour4
|
077eee3500387abd9a8b74727dd3c5727cc11384
|
46b7e77e2a5e54c4f2a83f23448f7031c8b37537
|
refs/heads/master
| 2023-07-17T13:05:58.825000 | 2019-08-20T07:12:35 | 2019-08-20T07:12:35 | 397,678,508 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.walktour.service.phoneinfo.utils;
import android.annotation.TargetApi;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.os.Environment;
import android.telephony.CellIdentityLte;
import android.telephony.CellInfo;
import android.telephony.CellInfoGsm;
import android.telephony.CellInfoLte;
import android.telephony.SignalStrength;
import android.telephony.TelephonyManager;
import com.walktour.Utils.StringUtil;
import com.walktour.Utils.WalkStruct;
import com.walktour.Utils.WalkStruct.CurrentNetState;
import com.walktour.base.util.LogUtil;
import java.io.File;
/**
* 获取收集基本信息工具类
*
* @author jianchao.wang
*
*/
public class MobileUtil {
/** 日志标识 */
private static final String TAG = "MobileUtil";
/**
* LTE网络,不区分电信和移动
*
* @param telephonyManager
* @return
*/
public static boolean isLteNetWork(TelephonyManager telephonyManager) {
int netType = telephonyManager.getNetworkType();
return netType == TelephonyManager.NETWORK_TYPE_LTE;
}
/**
* 电信3G网络
*
* @param telephonyManager
* @return
*/
public static boolean isEvdoNetwork(TelephonyManager telephonyManager) {
int netType = telephonyManager.getNetworkType();
return netType == TelephonyManager.NETWORK_TYPE_EVDO_0 || netType == TelephonyManager.NETWORK_TYPE_EVDO_A
|| netType == TelephonyManager.NETWORK_TYPE_EVDO_B || netType == TelephonyManager.NETWORK_TYPE_EHRPD;
}
/**
* 判断Mobile网络是否开启
*
* @param context
* @return
*/
public static boolean isMobileConnected(Context context) {
if (context != null) {
ConnectivityManager mConnectivityManager = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo mMobileNetworkInfo = mConnectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
if (mMobileNetworkInfo != null) {
return mMobileNetworkInfo.isAvailable();
}
}
return false;
}
/**
* 判断Wifi网络是否开启
*
* @param context
* @return
*/
public static boolean isWifiConnected(Context context) {
if (context != null) {
ConnectivityManager mConnectivityManager = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo mWiFiNetworkInfo = mConnectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
if (mWiFiNetworkInfo != null) {
return mWiFiNetworkInfo.isAvailable()&&mWiFiNetworkInfo.getState()==NetworkInfo.State.CONNECTED;
}
}
return false;
}
/***
* 获取信号强度值
*
* @param context
* @param signal
* @return
*/
public static int getSignalStrengthDbm(Context context, SignalStrength signal) {
int signalStrenghInt = -1;
if (signal.isGsm()) {// GSM
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
try {
String[] sarray = signal.toString().split(" ");
if (tm.getNetworkType() == TelephonyManager.NETWORK_TYPE_LTE) {// LTE网络
if (signal.toString().contains("gw|lte")) {
signalStrenghInt = Integer.parseInt(sarray[11]);
} else {
signalStrenghInt = Integer.parseInt(sarray[9]);
}
} else {
if (!signal.toString().contains("gw|lte") && !signal.toString().contains("gsm|lte")
&& signal.getGsmSignalStrength() == 99) {
return signal.getGsmSignalStrength();
}
signalStrenghInt = -113 + 2 * (signal.getGsmSignalStrength());
if (signalStrenghInt < -1 && signalStrenghInt > -113) {// 信号强度正确
} else {
if (sarray[sarray.length - 2].equals("gsm|lte") && Integer.parseInt(sarray[sarray.length - 3]) < -1
&& (Integer.parseInt(sarray[sarray.length - 3]) > -113)) {// ??????
signalStrenghInt = Integer.parseInt(sarray[sarray.length - 3]);
} else if (sarray[sarray.length - 1].equals("gsm|lte")) { // sony
if (StringUtil.isInteger(sarray[sarray.length - 2])) {
int value = Integer.parseInt(sarray[sarray.length - 2]);
if (value < -1 && value > -113)
signalStrenghInt = value;
} else if (StringUtil.isInteger(sarray[sarray.length - 3])) {
int value = Integer.parseInt(sarray[sarray.length - 3]);
if (value < -1 && value > -113)
signalStrenghInt = value;
}
} else if (signal.toString().contains("gw|lte")) {// ???D2????????
int i = 1;
while (i < sarray.length - 1) {
if (!StringUtil.isInteger(sarray[i]))
continue;
signalStrenghInt = Integer.parseInt(sarray[i]);
if (signalStrenghInt < -1 && signalStrenghInt > -113) {
break;
}
i += 1;
}
} else {
}
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
signalStrenghInt = signalStrenghInt == 99 || (signalStrenghInt >= -113 && signalStrenghInt <= -1)
? signalStrenghInt : -1;
return signalStrenghInt;
} else if (signal.getCdmaDbm() != -1) {// CDMA
// CDMA
signalStrenghInt = signal.getCdmaDbm();
signalStrenghInt = signalStrenghInt == 99 || (signalStrenghInt >= -113 && signalStrenghInt <= -1)
? signalStrenghInt : -1;
return signalStrenghInt;
} else if (signal.getEvdoDbm() != -1) {// EVDO
// EVDO
signalStrenghInt = signal.getEvdoDbm();
signalStrenghInt = signalStrenghInt == 99 || (signalStrenghInt >= -113 && signalStrenghInt <= -1)
? signalStrenghInt : -1;
return signalStrenghInt;
} else {
return -1;
}
}
/**
* 判断sd卡是否存在
*
* @return
*/
public static boolean isSDCardAvailable() {
boolean flag = false;
try {
flag = Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED);
} catch (Exception ex) {
flag = false;
}
return flag;
}
/**
* 获取sd卡路径
*
* @param context
* 上下文
* @return
*/
public static String getSDPath(Context context) {
File sdDir = null;
if (isSDCardAvailable()) {
sdDir = Environment.getExternalStorageDirectory();// 获取根目录
return sdDir.toString();
}
return null;
}
/***
* 获取网络制式
*
* @param telephonyManager
* @return
*/
public static WalkStruct.CurrentNetState getNetworkType(TelephonyManager telephonyManager) {
String operator = telephonyManager.getSimOperator();
switch (telephonyManager.getNetworkType()) {
case TelephonyManager.NETWORK_TYPE_EDGE:
case TelephonyManager.NETWORK_TYPE_GPRS:
return CurrentNetState.GSM;
case TelephonyManager.NETWORK_TYPE_HSDPA:
case TelephonyManager.NETWORK_TYPE_HSUPA:
case TelephonyManager.NETWORK_TYPE_HSPA:
if (operator != null && (operator.equals("46000") || operator.equals("46002") || operator.equals("46007"))) {
return CurrentNetState.TDSCDMA;
}
return CurrentNetState.WCDMA;
case TelephonyManager.NETWORK_TYPE_UMTS:
case TelephonyManager.NETWORK_TYPE_HSPAP:
return CurrentNetState.WCDMA;
case TelephonyManager.NETWORK_TYPE_CDMA:
case TelephonyManager.NETWORK_TYPE_1xRTT:
case TelephonyManager.NETWORK_TYPE_EVDO_0:
case TelephonyManager.NETWORK_TYPE_EVDO_A:
case TelephonyManager.NETWORK_TYPE_EVDO_B:
return CurrentNetState.CDMA;
case TelephonyManager.NETWORK_TYPE_LTE:
return CurrentNetState.LTE;
case TelephonyManager.NETWORK_TYPE_EHRPD:
return CurrentNetState.CDMA;
case 16:
case 17:
return CurrentNetState.TDSCDMA;
default:
return CurrentNetState.Unknown;
}
}
/***
* 获取手机的IMEI号
*
* @param context
* 上下文
*
* @return
*/
public static synchronized String getIMEI(Context context) {
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
return tm.getDeviceId();
}
/***
* 获取手机的IMSI号
*
* @param context
* 上下文
*
* @return
*/
public static String getIMSI(Context context) {
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
return tm.getSubscriberId();
}
/**
* 获取SIM MCC MNC
*
* @param context
* 上下文
* @return
*/
public static String getSIM_MCCMNC(Context context) {
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
String mccmnc = "";
if (telephonyManager.getSimState() == TelephonyManager.SIM_STATE_READY)
mccmnc = telephonyManager.getSimOperator();
if (mccmnc != null && !mccmnc.equals(""))
return mccmnc;
return "";
}
/**
* 获取SIM MCC
*
* @param context
* 上下文
* @return
*/
public static int getSIM_MCC(Context context) {
String mccmnc = getSIM_MCCMNC(context);
if (!mccmnc.equals(""))
return Integer.parseInt(mccmnc.substring(0, 3));
return -1;
}
/**
* 获取SIM MNC
*
* @param context
* 上下文
* @return
*/
public static int getSIM_MNC(Context context) {
String mccmnc = getSIM_MCCMNC(context);
if (!mccmnc.equals(""))
return Integer.parseInt(mccmnc.substring(3));
return -1;
}
/***
* 获取LTE 小区信息
*
* @param context
* @return
*/
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public static CellIdentityLte getCellIdentityLte(Context context) {
CellIdentityLte lte = null;
int currentVersion = android.os.Build.VERSION.SDK_INT;
if (currentVersion >= 17) {
try {
final TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
if (null != tm.getAllCellInfo()) {
for (final CellInfo info : tm.getAllCellInfo()) {
if (info instanceof CellInfoLte) {
lte = ((CellInfoLte) info).getCellIdentity();
break;
} else if (info instanceof CellInfoGsm) {
}
}
}
} catch (Exception e) {
LogUtil.e(TAG, "Unable to obtain LTE cell signal information", e);
}
}
return lte;
}
/** SIM卡是中国移动 */
public static boolean isChinaMobile(Context context) {
String imsi = getSIM_MCCMNC(context);
if (imsi == null) return false;
return imsi.startsWith("46000") || imsi.startsWith("46002") || imsi.startsWith("46007");
}
/** SIM卡是中国联通 */
public static boolean isChinaUnicom(Context context) {
String imsi = getSIM_MCCMNC(context);
if (imsi == null) return false;
return imsi.startsWith("46001");
}
/** SIM卡是中国电信 */
public static boolean isChinaTelecom(Context context) {
String imsi = getSIM_MCCMNC(context);
if (imsi == null) return false;
return imsi.startsWith("46003") || imsi.startsWith("46011") || imsi.startsWith("46005");
}
}
|
UTF-8
|
Java
| 10,649 |
java
|
MobileUtil.java
|
Java
|
[
{
"context": "rt java.io.File;\n\n/**\n * 获取收集基本信息工具类\n *\n * @author jianchao.wang\n *\n */\npublic class MobileUtil {\n\t/** 日志标识 */\n\tpr",
"end": 720,
"score": 0.9467630386352539,
"start": 707,
"tag": "NAME",
"value": "jianchao.wang"
}
] | null |
[] |
package com.walktour.service.phoneinfo.utils;
import android.annotation.TargetApi;
import android.content.Context;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.Build;
import android.os.Environment;
import android.telephony.CellIdentityLte;
import android.telephony.CellInfo;
import android.telephony.CellInfoGsm;
import android.telephony.CellInfoLte;
import android.telephony.SignalStrength;
import android.telephony.TelephonyManager;
import com.walktour.Utils.StringUtil;
import com.walktour.Utils.WalkStruct;
import com.walktour.Utils.WalkStruct.CurrentNetState;
import com.walktour.base.util.LogUtil;
import java.io.File;
/**
* 获取收集基本信息工具类
*
* @author jianchao.wang
*
*/
public class MobileUtil {
/** 日志标识 */
private static final String TAG = "MobileUtil";
/**
* LTE网络,不区分电信和移动
*
* @param telephonyManager
* @return
*/
public static boolean isLteNetWork(TelephonyManager telephonyManager) {
int netType = telephonyManager.getNetworkType();
return netType == TelephonyManager.NETWORK_TYPE_LTE;
}
/**
* 电信3G网络
*
* @param telephonyManager
* @return
*/
public static boolean isEvdoNetwork(TelephonyManager telephonyManager) {
int netType = telephonyManager.getNetworkType();
return netType == TelephonyManager.NETWORK_TYPE_EVDO_0 || netType == TelephonyManager.NETWORK_TYPE_EVDO_A
|| netType == TelephonyManager.NETWORK_TYPE_EVDO_B || netType == TelephonyManager.NETWORK_TYPE_EHRPD;
}
/**
* 判断Mobile网络是否开启
*
* @param context
* @return
*/
public static boolean isMobileConnected(Context context) {
if (context != null) {
ConnectivityManager mConnectivityManager = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo mMobileNetworkInfo = mConnectivityManager.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
if (mMobileNetworkInfo != null) {
return mMobileNetworkInfo.isAvailable();
}
}
return false;
}
/**
* 判断Wifi网络是否开启
*
* @param context
* @return
*/
public static boolean isWifiConnected(Context context) {
if (context != null) {
ConnectivityManager mConnectivityManager = (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo mWiFiNetworkInfo = mConnectivityManager.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
if (mWiFiNetworkInfo != null) {
return mWiFiNetworkInfo.isAvailable()&&mWiFiNetworkInfo.getState()==NetworkInfo.State.CONNECTED;
}
}
return false;
}
/***
* 获取信号强度值
*
* @param context
* @param signal
* @return
*/
public static int getSignalStrengthDbm(Context context, SignalStrength signal) {
int signalStrenghInt = -1;
if (signal.isGsm()) {// GSM
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
try {
String[] sarray = signal.toString().split(" ");
if (tm.getNetworkType() == TelephonyManager.NETWORK_TYPE_LTE) {// LTE网络
if (signal.toString().contains("gw|lte")) {
signalStrenghInt = Integer.parseInt(sarray[11]);
} else {
signalStrenghInt = Integer.parseInt(sarray[9]);
}
} else {
if (!signal.toString().contains("gw|lte") && !signal.toString().contains("gsm|lte")
&& signal.getGsmSignalStrength() == 99) {
return signal.getGsmSignalStrength();
}
signalStrenghInt = -113 + 2 * (signal.getGsmSignalStrength());
if (signalStrenghInt < -1 && signalStrenghInt > -113) {// 信号强度正确
} else {
if (sarray[sarray.length - 2].equals("gsm|lte") && Integer.parseInt(sarray[sarray.length - 3]) < -1
&& (Integer.parseInt(sarray[sarray.length - 3]) > -113)) {// ??????
signalStrenghInt = Integer.parseInt(sarray[sarray.length - 3]);
} else if (sarray[sarray.length - 1].equals("gsm|lte")) { // sony
if (StringUtil.isInteger(sarray[sarray.length - 2])) {
int value = Integer.parseInt(sarray[sarray.length - 2]);
if (value < -1 && value > -113)
signalStrenghInt = value;
} else if (StringUtil.isInteger(sarray[sarray.length - 3])) {
int value = Integer.parseInt(sarray[sarray.length - 3]);
if (value < -1 && value > -113)
signalStrenghInt = value;
}
} else if (signal.toString().contains("gw|lte")) {// ???D2????????
int i = 1;
while (i < sarray.length - 1) {
if (!StringUtil.isInteger(sarray[i]))
continue;
signalStrenghInt = Integer.parseInt(sarray[i]);
if (signalStrenghInt < -1 && signalStrenghInt > -113) {
break;
}
i += 1;
}
} else {
}
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
signalStrenghInt = signalStrenghInt == 99 || (signalStrenghInt >= -113 && signalStrenghInt <= -1)
? signalStrenghInt : -1;
return signalStrenghInt;
} else if (signal.getCdmaDbm() != -1) {// CDMA
// CDMA
signalStrenghInt = signal.getCdmaDbm();
signalStrenghInt = signalStrenghInt == 99 || (signalStrenghInt >= -113 && signalStrenghInt <= -1)
? signalStrenghInt : -1;
return signalStrenghInt;
} else if (signal.getEvdoDbm() != -1) {// EVDO
// EVDO
signalStrenghInt = signal.getEvdoDbm();
signalStrenghInt = signalStrenghInt == 99 || (signalStrenghInt >= -113 && signalStrenghInt <= -1)
? signalStrenghInt : -1;
return signalStrenghInt;
} else {
return -1;
}
}
/**
* 判断sd卡是否存在
*
* @return
*/
public static boolean isSDCardAvailable() {
boolean flag = false;
try {
flag = Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED);
} catch (Exception ex) {
flag = false;
}
return flag;
}
/**
* 获取sd卡路径
*
* @param context
* 上下文
* @return
*/
public static String getSDPath(Context context) {
File sdDir = null;
if (isSDCardAvailable()) {
sdDir = Environment.getExternalStorageDirectory();// 获取根目录
return sdDir.toString();
}
return null;
}
/***
* 获取网络制式
*
* @param telephonyManager
* @return
*/
public static WalkStruct.CurrentNetState getNetworkType(TelephonyManager telephonyManager) {
String operator = telephonyManager.getSimOperator();
switch (telephonyManager.getNetworkType()) {
case TelephonyManager.NETWORK_TYPE_EDGE:
case TelephonyManager.NETWORK_TYPE_GPRS:
return CurrentNetState.GSM;
case TelephonyManager.NETWORK_TYPE_HSDPA:
case TelephonyManager.NETWORK_TYPE_HSUPA:
case TelephonyManager.NETWORK_TYPE_HSPA:
if (operator != null && (operator.equals("46000") || operator.equals("46002") || operator.equals("46007"))) {
return CurrentNetState.TDSCDMA;
}
return CurrentNetState.WCDMA;
case TelephonyManager.NETWORK_TYPE_UMTS:
case TelephonyManager.NETWORK_TYPE_HSPAP:
return CurrentNetState.WCDMA;
case TelephonyManager.NETWORK_TYPE_CDMA:
case TelephonyManager.NETWORK_TYPE_1xRTT:
case TelephonyManager.NETWORK_TYPE_EVDO_0:
case TelephonyManager.NETWORK_TYPE_EVDO_A:
case TelephonyManager.NETWORK_TYPE_EVDO_B:
return CurrentNetState.CDMA;
case TelephonyManager.NETWORK_TYPE_LTE:
return CurrentNetState.LTE;
case TelephonyManager.NETWORK_TYPE_EHRPD:
return CurrentNetState.CDMA;
case 16:
case 17:
return CurrentNetState.TDSCDMA;
default:
return CurrentNetState.Unknown;
}
}
/***
* 获取手机的IMEI号
*
* @param context
* 上下文
*
* @return
*/
public static synchronized String getIMEI(Context context) {
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
return tm.getDeviceId();
}
/***
* 获取手机的IMSI号
*
* @param context
* 上下文
*
* @return
*/
public static String getIMSI(Context context) {
TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
return tm.getSubscriberId();
}
/**
* 获取SIM MCC MNC
*
* @param context
* 上下文
* @return
*/
public static String getSIM_MCCMNC(Context context) {
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
String mccmnc = "";
if (telephonyManager.getSimState() == TelephonyManager.SIM_STATE_READY)
mccmnc = telephonyManager.getSimOperator();
if (mccmnc != null && !mccmnc.equals(""))
return mccmnc;
return "";
}
/**
* 获取SIM MCC
*
* @param context
* 上下文
* @return
*/
public static int getSIM_MCC(Context context) {
String mccmnc = getSIM_MCCMNC(context);
if (!mccmnc.equals(""))
return Integer.parseInt(mccmnc.substring(0, 3));
return -1;
}
/**
* 获取SIM MNC
*
* @param context
* 上下文
* @return
*/
public static int getSIM_MNC(Context context) {
String mccmnc = getSIM_MCCMNC(context);
if (!mccmnc.equals(""))
return Integer.parseInt(mccmnc.substring(3));
return -1;
}
/***
* 获取LTE 小区信息
*
* @param context
* @return
*/
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
public static CellIdentityLte getCellIdentityLte(Context context) {
CellIdentityLte lte = null;
int currentVersion = android.os.Build.VERSION.SDK_INT;
if (currentVersion >= 17) {
try {
final TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
if (null != tm.getAllCellInfo()) {
for (final CellInfo info : tm.getAllCellInfo()) {
if (info instanceof CellInfoLte) {
lte = ((CellInfoLte) info).getCellIdentity();
break;
} else if (info instanceof CellInfoGsm) {
}
}
}
} catch (Exception e) {
LogUtil.e(TAG, "Unable to obtain LTE cell signal information", e);
}
}
return lte;
}
/** SIM卡是中国移动 */
public static boolean isChinaMobile(Context context) {
String imsi = getSIM_MCCMNC(context);
if (imsi == null) return false;
return imsi.startsWith("46000") || imsi.startsWith("46002") || imsi.startsWith("46007");
}
/** SIM卡是中国联通 */
public static boolean isChinaUnicom(Context context) {
String imsi = getSIM_MCCMNC(context);
if (imsi == null) return false;
return imsi.startsWith("46001");
}
/** SIM卡是中国电信 */
public static boolean isChinaTelecom(Context context) {
String imsi = getSIM_MCCMNC(context);
if (imsi == null) return false;
return imsi.startsWith("46003") || imsi.startsWith("46011") || imsi.startsWith("46005");
}
}
| 10,649 | 0.676928 | 0.664093 | 374 | 26.708555 | 26.632738 | 113 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.582888 | false | false |
12
|
335d9090007059cb98c1568257c22d3281ddd197
| 15,298,673,566,145 |
5ccbb44f9d131c1524bd38e2a50d18ab3d355104
|
/src/main/java/org/apache/flink/pb3/canal/CanalRowDeserializationSchema.java
|
b7769d16c9e454649ae04a267c0b380e6775ef37
|
[] |
no_license
|
complone/flink-format-flink
|
https://github.com/complone/flink-format-flink
|
f1a6f63608df0c430ba4500866be0927fa915ec7
|
f314282dcdfb52234c793a9fb96f7b451fb2a89c
|
refs/heads/main
| 2023-08-27T00:17:54.206000 | 2021-11-12T06:17:20 | 2021-11-12T06:17:20 | 427,252,698 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.apache.flink.pb3.canal;
import java.io.IOException;
import org.apache.flink.api.common.serialization.DeserializationSchema;
import org.apache.flink.api.common.typeinfo.TypeInformation;
import org.apache.flink.formats.json.TimestampFormat;
import org.apache.flink.pb.PbRowDeserializationSchema;
import org.apache.flink.table.data.ArrayData;
import org.apache.flink.table.data.GenericRowData;
import org.apache.flink.table.data.RowData;
import org.apache.flink.table.types.DataType;
import org.apache.flink.table.types.logical.RowType;
import org.apache.flink.table.types.utils.TypeConversions;
import org.apache.flink.types.RowKind;
import org.apache.flink.util.Collector;
import scala.math.Ordering;
public class CanalRowDeserializationSchema implements DeserializationSchema<RowData> {
private static final long serialVersionUID = -21213443439L;
private static final String OP_INSERT = "INSERT";
private static final String OP_UPDATE = "UPDATE";
private static final String OP_DELETE = "DELETE";
private final PbRowDeserializationSchema pbRowDeserializationSchema;
private final String messageClassName;
private final boolean ignoreParseErrors;
private final int fieldCount;
//TypeInformations的消息格式化成元组或者其他类型
public CanalRowDeserializationSchema(RowType rowType,String messageClassName,boolean ignoreParseErrors,
TimestampFormat timeStampFormat,String[] needSerializationClass) {
this.messageClassName = messageClassName;
this.fieldCount = rowType.getFieldCount();
this.ignoreParseErrors = ignoreParseErrors;
this.pbRowDeserializationSchema = new PbRowDeserializationSchema(rowType,messageClassName,needSerializationClass,ignoreParseErrors,false);
}
@Override
public RowData deserialize(byte[] message) throws IOException {
RowData row = this.pbRowDeserializationSchema.deserialize(message);
return row;
}
@Override
public void deserialize(byte[] message, Collector<RowData> out) throws IOException {
// String type = row.getString(2).toString();
// ArrayData data;
// RowData insert;
// if ("INSERT".equals(type)){
// data = row.getArray(0);
//
// for(int i=0;i<data.size();i++){
// insert = data.getRow(i,this.fieldCount);
// insert.setRowKind(RowKind.DELETE);
// }
// }
// //changelog是delete的话 ,不能允许下一条change是更新操作
// else if(!"UPDATE".equals(type)){
// if ("DELETE".equals(type)){
// data = row.getArray(0);
// for (int i=0;i<data.size();++i){
// insert = data.getRow(i,this.fieldCount);
// insert.setRowKind(RowKind.DELETE);
// }
// }else if(!ignoreParseErrors){
// throw new IOException(java.lang.String.format("Unknown \"type\" value \"%s\". The Canal JSON message is '%s'",type,new java.lang.String(message)));
// }else {
// //修改前,删除前的canal增量数据
// data = row.getArray(0);
// //修改后,新增后的canal增量数据
// ArrayData old = row.getArray(1);
// for (int i =0;i<data.size();i++){
// GenericRowData after = (GenericRowData) data.getRow(i,this.fieldCount);
// GenericRowData before = (GenericRowData) old.getRow(i,this.fieldCount);
//
// //修改前,删除前的增量数据进行解析
// for (int f=0;f<this.fieldCount;f++){
// if (before.isNullAt(f)){
// before.setField(f,after.getField(f));
// }
// }
//
// before.setRowKind(RowKind.UPDATE_BEFORE);
// after.setRowKind(RowKind.UPDATE_AFTER);
// }
// }
// }
DeserializationSchema.super.deserialize(message,out);
}
@Override
public boolean isEndOfStream(RowData rowData) {
return false;
}
@Override
public TypeInformation<RowData> getProducedType() {
return null;
}
}
|
UTF-8
|
Java
| 3,897 |
java
|
CanalRowDeserializationSchema.java
|
Java
|
[] | null |
[] |
package org.apache.flink.pb3.canal;
import java.io.IOException;
import org.apache.flink.api.common.serialization.DeserializationSchema;
import org.apache.flink.api.common.typeinfo.TypeInformation;
import org.apache.flink.formats.json.TimestampFormat;
import org.apache.flink.pb.PbRowDeserializationSchema;
import org.apache.flink.table.data.ArrayData;
import org.apache.flink.table.data.GenericRowData;
import org.apache.flink.table.data.RowData;
import org.apache.flink.table.types.DataType;
import org.apache.flink.table.types.logical.RowType;
import org.apache.flink.table.types.utils.TypeConversions;
import org.apache.flink.types.RowKind;
import org.apache.flink.util.Collector;
import scala.math.Ordering;
public class CanalRowDeserializationSchema implements DeserializationSchema<RowData> {
private static final long serialVersionUID = -21213443439L;
private static final String OP_INSERT = "INSERT";
private static final String OP_UPDATE = "UPDATE";
private static final String OP_DELETE = "DELETE";
private final PbRowDeserializationSchema pbRowDeserializationSchema;
private final String messageClassName;
private final boolean ignoreParseErrors;
private final int fieldCount;
//TypeInformations的消息格式化成元组或者其他类型
public CanalRowDeserializationSchema(RowType rowType,String messageClassName,boolean ignoreParseErrors,
TimestampFormat timeStampFormat,String[] needSerializationClass) {
this.messageClassName = messageClassName;
this.fieldCount = rowType.getFieldCount();
this.ignoreParseErrors = ignoreParseErrors;
this.pbRowDeserializationSchema = new PbRowDeserializationSchema(rowType,messageClassName,needSerializationClass,ignoreParseErrors,false);
}
@Override
public RowData deserialize(byte[] message) throws IOException {
RowData row = this.pbRowDeserializationSchema.deserialize(message);
return row;
}
@Override
public void deserialize(byte[] message, Collector<RowData> out) throws IOException {
// String type = row.getString(2).toString();
// ArrayData data;
// RowData insert;
// if ("INSERT".equals(type)){
// data = row.getArray(0);
//
// for(int i=0;i<data.size();i++){
// insert = data.getRow(i,this.fieldCount);
// insert.setRowKind(RowKind.DELETE);
// }
// }
// //changelog是delete的话 ,不能允许下一条change是更新操作
// else if(!"UPDATE".equals(type)){
// if ("DELETE".equals(type)){
// data = row.getArray(0);
// for (int i=0;i<data.size();++i){
// insert = data.getRow(i,this.fieldCount);
// insert.setRowKind(RowKind.DELETE);
// }
// }else if(!ignoreParseErrors){
// throw new IOException(java.lang.String.format("Unknown \"type\" value \"%s\". The Canal JSON message is '%s'",type,new java.lang.String(message)));
// }else {
// //修改前,删除前的canal增量数据
// data = row.getArray(0);
// //修改后,新增后的canal增量数据
// ArrayData old = row.getArray(1);
// for (int i =0;i<data.size();i++){
// GenericRowData after = (GenericRowData) data.getRow(i,this.fieldCount);
// GenericRowData before = (GenericRowData) old.getRow(i,this.fieldCount);
//
// //修改前,删除前的增量数据进行解析
// for (int f=0;f<this.fieldCount;f++){
// if (before.isNullAt(f)){
// before.setField(f,after.getField(f));
// }
// }
//
// before.setRowKind(RowKind.UPDATE_BEFORE);
// after.setRowKind(RowKind.UPDATE_AFTER);
// }
// }
// }
DeserializationSchema.super.deserialize(message,out);
}
@Override
public boolean isEndOfStream(RowData rowData) {
return false;
}
@Override
public TypeInformation<RowData> getProducedType() {
return null;
}
}
| 3,897 | 0.697204 | 0.691611 | 102 | 35.813725 | 29.057323 | 157 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.72549 | false | false |
12
|
83960c6eb454f2775fb7e08e6eb39c8ee0efaf97
| 2,250,562,865,571 |
b1b2a7650c7e96d389c4f8a2c1ff4a2b5d9977ca
|
/aula6/src/exercicio_mercado/Program.java
|
ef47a95ba02307d5c8696a650f4ca70651802876
|
[] |
no_license
|
trizisbea/serratec-poo
|
https://github.com/trizisbea/serratec-poo
|
da8736d82496ba2c7ab911ed9d7c17e7d6148fb3
|
2821d1bd2a2b26ab7f533aa836d11fa780b20cf4
|
refs/heads/main
| 2023-08-18T19:30:03.252000 | 2021-10-07T21:27:25 | 2021-10-07T21:27:25 | 411,045,990 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package exercicio_mercado;
public class Program {
public static void main(String[] args) {
BebidaAlcoolica b1 = new BebidaAlcoolica("Cerveja", 12, 10);
BebidaAlcoolica b2 = new BebidaAlcoolica("Vinho", 150, 25);
Eletrodomestico e1 = new Eletrodomestico("TV", 2000, 220);
Eletrodomestico e2 = new Eletrodomestico("Geladeira", 2352.64, 220);
Eletrodomestico e3 = new Eletrodomestico("Radio", 837.59, 110);
Carrinho carrinho = new Carrinho();
carrinho.addItem(new Item(5, b1));
carrinho.addItem(new Item(3, b2));
carrinho.addItem(new Item(9, e1));
carrinho.addItem(new Item(3, e2));
carrinho.addItem(new Item(1, e3));
System.out.println(b1.toString());
System.out.println("Valor da venda: " + b1.Vender(5));
System.out.println(b2.toString());
System.out.println("Valor da venda: " + b2.Vender(3));
System.out.println(e1.toString());
System.out.println("Valor da venda: " + e1.Vender(9));
System.out.println(e2.toString());
System.out.println("Valor da venda: " + e2.Vender(3));
System.out.println(e3.toString());
System.out.println("Valor da venda: " + e3.Vender(1));
//System.out.println("Valor total da venda: " + (b1.Vender(5) + b2.Vender(3) + e1.Vender(9) + e2.Vender(3) + e3.Vender(1)));
System.out.println("\nTotal da compra: " + carrinho.getValorTotal());
}
}
|
UTF-8
|
Java
| 1,344 |
java
|
Program.java
|
Java
|
[
{
"context": " {\n\t\t\n\t\tBebidaAlcoolica b1 = new BebidaAlcoolica(\"Cerveja\", 12, 10);\n\t\tBebidaAlcoolica b2 = new BebidaAlcoo",
"end": 148,
"score": 0.9033257961273193,
"start": 141,
"tag": "NAME",
"value": "Cerveja"
},
{
"context": " 10);\n\t\tBebidaAlcoolica b2 = new BebidaAlcoolica(\"Vinho\", 150, 25);\n\t\tEletrodomestico e1 = new Eletrodome",
"end": 209,
"score": 0.8929008841514587,
"start": 204,
"tag": "NAME",
"value": "Vinho"
}
] | null |
[] |
package exercicio_mercado;
public class Program {
public static void main(String[] args) {
BebidaAlcoolica b1 = new BebidaAlcoolica("Cerveja", 12, 10);
BebidaAlcoolica b2 = new BebidaAlcoolica("Vinho", 150, 25);
Eletrodomestico e1 = new Eletrodomestico("TV", 2000, 220);
Eletrodomestico e2 = new Eletrodomestico("Geladeira", 2352.64, 220);
Eletrodomestico e3 = new Eletrodomestico("Radio", 837.59, 110);
Carrinho carrinho = new Carrinho();
carrinho.addItem(new Item(5, b1));
carrinho.addItem(new Item(3, b2));
carrinho.addItem(new Item(9, e1));
carrinho.addItem(new Item(3, e2));
carrinho.addItem(new Item(1, e3));
System.out.println(b1.toString());
System.out.println("Valor da venda: " + b1.Vender(5));
System.out.println(b2.toString());
System.out.println("Valor da venda: " + b2.Vender(3));
System.out.println(e1.toString());
System.out.println("Valor da venda: " + e1.Vender(9));
System.out.println(e2.toString());
System.out.println("Valor da venda: " + e2.Vender(3));
System.out.println(e3.toString());
System.out.println("Valor da venda: " + e3.Vender(1));
//System.out.println("Valor total da venda: " + (b1.Vender(5) + b2.Vender(3) + e1.Vender(9) + e2.Vender(3) + e3.Vender(1)));
System.out.println("\nTotal da compra: " + carrinho.getValorTotal());
}
}
| 1,344 | 0.671875 | 0.61756 | 40 | 32.599998 | 28.160078 | 126 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.65 | false | false |
12
|
9338a11157fde1e89ededf93a556e4f993f7f2cf
| 11,012,296,206,753 |
7c83aa282b111c0c711f2c00320b412c375baeca
|
/test/ezClient/adminMVC/AdminControllerTest.java
|
5ebfa7dea8a121b2b6f21caab207086396ade1b2
|
[] |
no_license
|
xbladetm/skunkworks
|
https://github.com/xbladetm/skunkworks
|
61ead34bee0d3ec144329d18f27f61dbbd1d715e
|
4b98967cdc37bb48ca8f4ca639d0309cd162b7a8
|
refs/heads/master
| 2016-09-05T19:25:59.356000 | 2013-07-10T02:57:15 | 2013-07-10T02:57: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 ezClient.adminMVC;
import org.junit.Test;
import static org.junit.Assert.*;
/**
*
* @author Andrés
*/
public class AdminControllerTest {
public AdminControllerTest() {
}
/**
* Test of addModel method, of class AdminController.
*/
@Test
public void testAddModel() {
System.out.println("addModel");
AdminModel m = null;
AdminController instance = new AdminController();
instance.addModel(m);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
/**
* Test of addView method, of class AdminController.
*/
@Test
public void testAddView() {
System.out.println("addView");
AdminView v = null;
AdminController instance = new AdminController();
instance.addView(v);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
/**
* Test of runView method, of class AdminController.
*/
@Test
public void testRunView() {
System.out.println("runView");
AdminController instance = new AdminController();
instance.runView();
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
}
|
UTF-8
|
Java
| 1,385 |
java
|
AdminControllerTest.java
|
Java
|
[
{
"context": " static org.junit.Assert.*;\r\n\r\n/**\r\n *\r\n * @author Andrés\r\n */\r\npublic class AdminControllerTest {\r\n\t\r\n\tpubli",
"end": 221,
"score": 0.9675330519676208,
"start": 215,
"tag": "NAME",
"value": "Andrés"
}
] | null |
[] |
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package ezClient.adminMVC;
import org.junit.Test;
import static org.junit.Assert.*;
/**
*
* @author Andrés
*/
public class AdminControllerTest {
public AdminControllerTest() {
}
/**
* Test of addModel method, of class AdminController.
*/
@Test
public void testAddModel() {
System.out.println("addModel");
AdminModel m = null;
AdminController instance = new AdminController();
instance.addModel(m);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
/**
* Test of addView method, of class AdminController.
*/
@Test
public void testAddView() {
System.out.println("addView");
AdminView v = null;
AdminController instance = new AdminController();
instance.addView(v);
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
/**
* Test of runView method, of class AdminController.
*/
@Test
public void testRunView() {
System.out.println("runView");
AdminController instance = new AdminController();
instance.runView();
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
}
| 1,385 | 0.672688 | 0.672688 | 56 | 22.75 | 21.958769 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.375 | false | false |
12
|
7b8727e1fca0ef75fa1a5540c6bca7892918d37e
| 26,628,797,303,605 |
9484d2886b16ee5382c360bea717d5788e9e0181
|
/Ninitas_y_ninitas_Web_/Ninitas_y_ninitas/src/dao/Dao_Persona.java
|
bfd655a8881562b5bfe2ee737c57077afebab44b
|
[] |
no_license
|
cristhiandc98a/Proyecto_final_eclipse
|
https://github.com/cristhiandc98a/Proyecto_final_eclipse
|
23858d2740b629cf52d883a24c74ad10f41f49da
|
f50d95f97bbf7a05df89a888caea24dc6e432591
|
refs/heads/master
| 2020-12-14T18:24:21.006000 | 2020-01-19T04:24:47 | 2020-01-19T04:24:47 | 234,839,171 | 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 dao;
import dato.Dato_Conexion_SQL;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
*
* @author cristhiandc98
*/
public class Dao_Persona {
Dato_Conexion_SQL cn = new Dato_Conexion_SQL();
ResultSet rs ;
String ultimo;
int posi = 0;
public String ultimoCodigoPersona(String pref){
try{
PreparedStatement ps = cn.conectorDB().prepareStatement("select_ultimo_cod_persona ?");
ps.setString(1, pref);
rs = ps.executeQuery();
while(rs.next()){
int ultPosi = Integer.parseInt(rs.getString(2));
if(posi<= ultPosi){
posi = ultPosi;
ultimo = rs.getString(1);}}
posi = 0;
return ultimo;}
catch(SQLException e){return "";}}
public static void main(String[] args) {
Dao_Persona u = new Dao_Persona();
System.out.println(u.ultimoCodigoPersona("T"));
}
}
|
UTF-8
|
Java
| 1,241 |
java
|
Dao_Persona.java
|
Java
|
[
{
"context": "port java.sql.SQLException;\r\n\r\n/**\r\n *\r\n * @author cristhiandc98\r\n */\r\npublic class Dao_Persona {\r\n \r\n Dato_Co",
"end": 368,
"score": 0.9956080913543701,
"start": 355,
"tag": "USERNAME",
"value": "cristhiandc98"
}
] | 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 dao;
import dato.Dato_Conexion_SQL;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
*
* @author cristhiandc98
*/
public class Dao_Persona {
Dato_Conexion_SQL cn = new Dato_Conexion_SQL();
ResultSet rs ;
String ultimo;
int posi = 0;
public String ultimoCodigoPersona(String pref){
try{
PreparedStatement ps = cn.conectorDB().prepareStatement("select_ultimo_cod_persona ?");
ps.setString(1, pref);
rs = ps.executeQuery();
while(rs.next()){
int ultPosi = Integer.parseInt(rs.getString(2));
if(posi<= ultPosi){
posi = ultPosi;
ultimo = rs.getString(1);}}
posi = 0;
return ultimo;}
catch(SQLException e){return "";}}
public static void main(String[] args) {
Dao_Persona u = new Dao_Persona();
System.out.println(u.ultimoCodigoPersona("T"));
}
}
| 1,241 | 0.581789 | 0.576148 | 41 | 28.268293 | 22.647915 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.585366 | false | false |
12
|
8d2008104753c4f5e6b4bd095ef1203616f7176c
| 9,062,381,063,585 |
fadacdc78fbeb34e5b3d890d725df8176cc25ba2
|
/src/main/java/com/example/demo/controller/EtatCommandeController.java
|
c40c9360e065e08afdd1e81ba1e5404ed643dc74
|
[] |
no_license
|
aissaouiloubna/backendspring
|
https://github.com/aissaouiloubna/backendspring
|
54c2ec2494772ce7103e5588887bed8fefa4a9b1
|
8db4c62ab0b1130e8b81cbbace6ebcd2cd67a331
|
refs/heads/master
| 2023-05-13T20:57:07.537000 | 2021-06-08T13:40:09 | 2021-06-08T13:40:09 | 375,023,013 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.demo.controller;
import com.example.demo.dao.EtatCommandeRepository;
import com.example.demo.exception.RessourceNotFoundException;
import com.example.demo.model.EtatCommandes;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.time.LocalDate;
import java.util.List;
@RestController
@RequestMapping("api/Ecommande")
public class EtatCommandeController {
@Autowired
private EtatCommandeRepository etatCommandeRepository;
// get all
@GetMapping
public List<EtatCommandes> getAllEtatCommandes() {
return this.etatCommandeRepository.findAll();
}
// get by id
@GetMapping("/{id}")
public EtatCommandes getEtatCommandesById(@PathVariable(value = "id") long id) {
return this.etatCommandeRepository.findById(id)
.orElseThrow(() -> new RessourceNotFoundException("etat Commande not Found"));
}
// get by qr
@CrossOrigin(origins ="http://localhost:3000")
@GetMapping("/qr/{qr}")
public List<EtatCommandes> findByQr(@PathVariable long qr ) {
return this.etatCommandeRepository.findByQr(qr);
}
//create
@CrossOrigin(origins ="http://localhost:3000")
@PostMapping
public EtatCommandes createMenus(@RequestBody EtatCommandes etatcommandes) {
return this.etatCommandeRepository.save(etatcommandes);
}
}
|
UTF-8
|
Java
| 1,419 |
java
|
EtatCommandeController.java
|
Java
|
[] | null |
[] |
package com.example.demo.controller;
import com.example.demo.dao.EtatCommandeRepository;
import com.example.demo.exception.RessourceNotFoundException;
import com.example.demo.model.EtatCommandes;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.time.LocalDate;
import java.util.List;
@RestController
@RequestMapping("api/Ecommande")
public class EtatCommandeController {
@Autowired
private EtatCommandeRepository etatCommandeRepository;
// get all
@GetMapping
public List<EtatCommandes> getAllEtatCommandes() {
return this.etatCommandeRepository.findAll();
}
// get by id
@GetMapping("/{id}")
public EtatCommandes getEtatCommandesById(@PathVariable(value = "id") long id) {
return this.etatCommandeRepository.findById(id)
.orElseThrow(() -> new RessourceNotFoundException("etat Commande not Found"));
}
// get by qr
@CrossOrigin(origins ="http://localhost:3000")
@GetMapping("/qr/{qr}")
public List<EtatCommandes> findByQr(@PathVariable long qr ) {
return this.etatCommandeRepository.findByQr(qr);
}
//create
@CrossOrigin(origins ="http://localhost:3000")
@PostMapping
public EtatCommandes createMenus(@RequestBody EtatCommandes etatcommandes) {
return this.etatCommandeRepository.save(etatcommandes);
}
}
| 1,419 | 0.730092 | 0.724454 | 46 | 29.847826 | 26.506741 | 94 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.282609 | false | false |
12
|
d936090b04d946eb3fe083e6006403f077e2370d
| 6,846,177,870,027 |
41cc36935c49268dc48a9815c9a656e95ee1a939
|
/src/main/java/com/gorbatenko/budget/service/BudgetItemService.java
|
57383e90ab05ad34f474c45720bdc21482d0df02
|
[] |
no_license
|
mailgva/Budget
|
https://github.com/mailgva/Budget
|
edee2f6854f39ebf23b290536b97f409fa06b967
|
db59b82b1fd14a162ffb73b7b1fea4d2dc78a50a
|
refs/heads/master
| 2023-08-31T13:18:54.705000 | 2023-08-07T20:05:39 | 2023-08-07T20:05:39 | 184,575,676 | 0 | 1 | null | false | 2023-03-01T20:42:27 | 2019-05-02T12:19:17 | 2022-01-10T17:55:24 | 2023-03-01T20:41:52 | 563 | 0 | 0 | 0 |
Java
| false | false |
package com.gorbatenko.budget.service;
import com.gorbatenko.budget.model.BudgetItem;
import com.gorbatenko.budget.model.Currency;
import com.gorbatenko.budget.model.Kind;
import com.gorbatenko.budget.model.Type;
import com.gorbatenko.budget.repository.BudgetItemRepository;
import com.gorbatenko.budget.repository.CurrencyRepository;
import com.gorbatenko.budget.repository.KindRepository;
import com.gorbatenko.budget.util.*;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.Period;
import java.util.*;
import java.util.stream.Collectors;
import static com.gorbatenko.budget.util.BaseUtil.setTimeZoneOffset;
import static java.util.stream.Collectors.groupingBy;
@Service
public class BudgetItemService {
private BudgetItemRepository budgetItemRepository;
private KindRepository kindRepository;
private CurrencyRepository currencyRepository;
public BudgetItemService(BudgetItemRepository budgetItemRepository, KindRepository kindRepository, CurrencyRepository currencyRepository) {
this.budgetItemRepository = budgetItemRepository;
this.kindRepository = kindRepository;
this.currencyRepository = currencyRepository;
}
public BudgetItem save(BudgetItem budgetItem) {
return budgetItemRepository.save(budgetItem);
}
public void saveAll(List<BudgetItem> budgetItems) {
budgetItemRepository.saveAll(budgetItems);
}
public List<KindTotals> getTotalsByKindsForPeriod(LocalDateTime startDate, LocalDateTime endDate, TypePeriod period) {
return budgetItemRepository.getTotalsByKindsForPeriod(startDate, endDate, period);
}
public List<BudgetItem> getByCurrencyId(String id) {
return budgetItemRepository.getByCurrencyId(id);
}
public List<BudgetItem> getByKindId(String id) {
return budgetItemRepository.getByKindId(id);
}
public List<BudgetItem> getPopularByTypeForPeriod(LocalDateTime startDate, LocalDateTime endDate, String typeName) {
return budgetItemRepository.getFilteredData(startDate, endDate, null, typeName, null, null, null, TypePeriod.SELECTED_PERIOD);
}
public List<BudgetItem> getBeforeDate(LocalDateTime endDate) {
return budgetItemRepository.getFilteredData(null, endDate, null, null, null, null, null, TypePeriod.SELECTED_PERIOD);
}
public List<BudgetItem> getAll() {
return budgetItemRepository.getAll();
}
public BudgetItem getById(String id) {
return budgetItemRepository.getById(id);
}
public List<CurrencyCount> getCurrencyCounts() {
return budgetItemRepository.getCurrencyCounts();
}
public List<BudgetItem> getByUserId(String id) {
return budgetItemRepository.getFilteredData(null,null, id, null, null, null, null, TypePeriod.ALL_TIME);
}
public List<BudgetItem> getForSelectedPeriod(LocalDateTime startLocalDate, LocalDateTime endLocalDate) {
return budgetItemRepository.getFilteredData(startLocalDate, endLocalDate, null, null, null, null, null, TypePeriod.SELECTED_PERIOD);
}
public Double getSumPriceByCurrencyAndType(Currency currency, Type type) {
return budgetItemRepository.getSumPriceByCurrencyAndType(currency, type);
}
public Double getSumPriceByDefaultCurrencyAndType(Type type) {
return budgetItemRepository.getSumPriceByDefaultCurrencyAndType(type);
}
public LocalDateTime getMaxDate() {
return budgetItemRepository.getMaxDate();
}
public String getLastCurrencyIdByDate(LocalDate date) {
return budgetItemRepository.getLastCurrencyIdByDate(date);
}
public void deleteById(String id) {
budgetItemRepository.deleteById(id);
}
public GroupStatisticData groupStatisticCollectData(TypePeriod period, LocalDate startDate, LocalDate endDate, String sortType) {
GroupStatisticData result = new GroupStatisticData();
LocalDate now = LocalDate.now();
LocalDateTime offSetStartDate;
LocalDateTime offSetEndDate;
TreeMap<Type, Map<Kind, Double>> mapKind;
if ((startDate == null) || (period.equals(TypePeriod.CURRENT_MONTH))) {
offSetStartDate = LocalDateTime.of(LocalDate.of(now.getYear(), now.getMonth(), 1), LocalTime.MIN);
startDate = offSetStartDate.toLocalDate();
offSetEndDate = LocalDateTime.of(LocalDate.of(now.getYear(), now.getMonth(), now.lengthOfMonth()), LocalTime.MAX);
endDate = offSetEndDate.toLocalDate();
}
if (period.equals(TypePeriod.CURRENT_YEAR)) {
offSetStartDate = LocalDateTime.of(LocalDate.of(now.getYear(), 1, 1), LocalTime.MIN);
startDate = offSetStartDate.toLocalDate();
offSetEndDate = LocalDateTime.of(LocalDate.of(now.getYear(), 12, 31), LocalTime.MAX);
endDate = offSetEndDate.toLocalDate();
}
offSetStartDate = setTimeZoneOffset(startDate);
offSetEndDate = setTimeZoneOffset(endDate);
List<KindTotals> totals = getTotalsByKindsForPeriod(offSetStartDate, offSetEndDate, period);
if (period.equals(TypePeriod.ALL_TIME) && totals.size() > 0) {
offSetStartDate = totals.stream()
.map(total -> total.getMinCreateDateTime())
.min(LocalDateTime::compareTo)
.get();
}
if (sortType.isEmpty() || sortType.equalsIgnoreCase("byName")) {
mapKind = new TreeMap(totals.stream()
.collect(groupingBy(
total ->
total.getKind().getType(), (
groupingBy(
KindTotals::getKind,
TreeMap::new,
Collectors.summingDouble(KindTotals::getSumPrice)))
)));
} else { /* sort by price */
mapKind = new TreeMap(totals.stream()
.collect(groupingBy(
total ->
total.getKind().getType(), (
groupingBy(
KindTotals::getKind,
HashMap::new,
Collectors.summingDouble(KindTotals::getSumPrice))))
));
for (Map.Entry<Type, Map<Kind, Double>> entry : mapKind.entrySet()) {
entry.setValue(
entry.getValue().entrySet()
.stream()
.sorted((s1, s2) -> s2.getValue().compareTo(s1.getValue()))
.collect(Collectors.toMap(
Map.Entry::getKey,
Map.Entry::getValue,
(oldValue, newValue) -> oldValue, LinkedHashMap::new)));
}
}
if (period.equals(TypePeriod.ALL_TIME)) {
startDate = totals.stream()
.map(KindTotals::getMinCreateDateTime)
.min(LocalDateTime::compareTo)
.get()
.toLocalDate();
endDate = totals.stream()
.map(KindTotals::getMaxCreateDateTime)
.max(LocalDateTime::compareTo)
.get()
.toLocalDate();
}
GroupPeriod groupPeriod = getGroupPeriod(startDate, endDate);
Map<String, Double> mapDateProfit =
budgetItemRepository.getSumPriceForPeriodByDateAndDefaultCurrency(offSetStartDate, offSetEndDate, Type.PROFIT, period, groupPeriod);
Map<String, Double> mapDateSpending =
budgetItemRepository.getSumPriceForPeriodByDateAndDefaultCurrency(offSetStartDate, offSetEndDate, Type.SPENDING, period, groupPeriod);
TreeMap<String, TreeMap<Type, Double>> totalMap = new TreeMap<>();
for(Map.Entry<String, Double> entry : mapDateProfit.entrySet()) {
TreeMap<Type, Double> map = totalMap.getOrDefault(entry.getKey(), new TreeMap<>());
double value = map.getOrDefault(Type.PROFIT, 0.00D) + entry.getValue();
map.put(Type.PROFIT, value);
totalMap.put(entry.getKey(), map);
}
for(Map.Entry<String, Double> entry : mapDateSpending.entrySet()) {
TreeMap<Type, Double> map = totalMap.getOrDefault(entry.getKey(), new TreeMap<>());
double value = map.getOrDefault(Type.SPENDING, 0.00D) + entry.getValue();
map.put(Type.SPENDING, value);
totalMap.put(entry.getKey(), map);
}
Map<Kind, Long> mapKindCount = totals.stream()
.collect(Collectors.toMap(KindTotals::getKind, KindTotals::getCount));
Double maxPriceProfit = totals.stream()
.filter(total -> total.getKind().getType().equals(Type.PROFIT))
.map(total -> total.getSumPrice())
.max(Double::compareTo)
.orElse(0.0);
Double maxPriceSpending = totals.stream()
.filter(total -> total.getKind().getType().equals(Type.SPENDING))
.map(total -> total.getSumPrice())
.max(Double::compareTo)
.orElse(0.0);
Map<Type, Double> mapMaxPrice = new HashMap<>();
mapMaxPrice.put(Type.PROFIT, maxPriceProfit);
mapMaxPrice.put(Type.SPENDING, maxPriceSpending);
Double profit = totals.stream()
.filter(total -> total.getKind().getType().equals(Type.PROFIT))
.mapToDouble(KindTotals::getSumPrice)
.sum();
Double spending = totals.stream()
.filter(total -> total.getKind().getType().equals(Type.SPENDING))
.mapToDouble(KindTotals::getSumPrice)
.sum();
result.setStartDate(startDate);
result.setEndDate(endDate);
result.setOffSetStartDate(offSetStartDate);
result.setOffSetEndDate(offSetEndDate);
result.setMapKind(mapKind);
result.setMapKindCount(mapKindCount);
result.setMapMaxPrice(mapMaxPrice);
result.setTotalMap(totalMap);
result.setProfit(profit);
result.setSpending(spending);
return result;
}
public StatisticData statisticCollectData(LocalDate startDate, LocalDate endDate, String userId, String typeStr,
String kindId, String priceStr, String description, TypePeriod period) {
StatisticData result = new StatisticData();
List<com.gorbatenko.budget.model.doc.User> users = new HashSet<>(budgetItemRepository.getUsersForAllPeriod())
.stream()
.sorted(Comparator.comparing(com.gorbatenko.budget.model.doc.User::getName))
.collect(Collectors.toList());
LocalDateTime offSetStartDate;
LocalDateTime offSetEndDate;
LocalDate now = LocalDate.now();
if (startDate == null) {
offSetStartDate = LocalDateTime.of(LocalDate.of(now.getYear(), now.getMonth(), 1), LocalTime.MIN);
startDate = offSetStartDate.toLocalDate();
}
offSetStartDate = setTimeZoneOffset(startDate);
if (endDate == null) {
offSetEndDate = LocalDateTime.of(LocalDate.of(now.getYear(), now.getMonth(), now.lengthOfMonth()), LocalTime.MAX);
endDate = offSetEndDate.toLocalDate();
}
offSetEndDate = setTimeZoneOffset(endDate);
List<BudgetItem> listBudgetItems = budgetItemRepository.getFilteredData(offSetStartDate, offSetEndDate, userId, typeStr, kindId, priceStr, description, period);
result.setStartDate(startDate);
result.setEndDate(endDate);
result.setOffSetStartDate(offSetStartDate);
result.setOffSetEndDate(offSetEndDate);
result.setListBudgetItems(listBudgetItems);
result.setUsers(users);
return result;
}
public DynamicStatisticData dynamicStatisticCollectData(LocalDate startDate, LocalDate endDate,
String kindId, Type type, GroupPeriod groupPeriod) {
DynamicStatisticData result = new DynamicStatisticData();
LocalDateTime offSetStartDate;
LocalDateTime offSetEndDate;
offSetStartDate = setTimeZoneOffset(startDate);
offSetEndDate = setTimeZoneOffset(endDate).plusDays(1);
String positionName;
double positionSum;
List<BudgetItem> listBudgetItems;
if (groupPeriod == GroupPeriod.BY_DEFAULT) {
groupPeriod = getGroupPeriod(startDate, endDate);
}
if (!kindId.isEmpty()) {
Kind kind = kindRepository.getById(kindId);
listBudgetItems =
budgetItemRepository.getFilteredData(offSetStartDate, offSetEndDate, null, null, kind.getId(), null, null, TypePeriod.SELECTED_PERIOD);
positionName = kind.getName();
} else {
listBudgetItems =
budgetItemRepository.getFilteredData(offSetStartDate, offSetEndDate, null, type.name(), null, null, null, TypePeriod.SELECTED_PERIOD);
positionName = type.getValue();
}
Map<String, Double> mapKind = listBudgetItems.stream()
.collect(groupingBy(
(groupPeriod.equals(GroupPeriod.BY_DAYS) ? BudgetItem::getStrDate :
groupPeriod.equals(GroupPeriod.BY_MONTHS) ? BudgetItem::getStrYearMonth : BudgetItem::getStrYear),
Collectors.summingDouble(BudgetItem::getPrice)));
positionSum = listBudgetItems.stream()
.mapToDouble(BudgetItem::getPrice).sum();
result.setStartDate(startDate);
result.setEndDate(endDate);
result.setOffSetStartDate(offSetStartDate);
result.setOffSetEndDate(offSetEndDate);
result.setMapKindSort(new TreeMap<>(mapKind));
result.setPositionName(positionName);
result.setPositionSum(positionSum);
return result;
}
private GroupPeriod getGroupPeriod(LocalDate startDate, LocalDate endDate) {
if ((endDate.getYear() == startDate.getYear()) &&
(endDate.getMonth().equals(startDate.getMonth()))) {
return GroupPeriod.BY_DAYS;
} else {
Period age = Period.between(startDate, endDate);
if (age.getMonths() <= 12 && age.getYears() < 1) {
return GroupPeriod.BY_MONTHS;
}
return GroupPeriod.BY_YEARS;
}
}
}
|
UTF-8
|
Java
| 14,867 |
java
|
BudgetItemService.java
|
Java
|
[] | null |
[] |
package com.gorbatenko.budget.service;
import com.gorbatenko.budget.model.BudgetItem;
import com.gorbatenko.budget.model.Currency;
import com.gorbatenko.budget.model.Kind;
import com.gorbatenko.budget.model.Type;
import com.gorbatenko.budget.repository.BudgetItemRepository;
import com.gorbatenko.budget.repository.CurrencyRepository;
import com.gorbatenko.budget.repository.KindRepository;
import com.gorbatenko.budget.util.*;
import org.springframework.stereotype.Service;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.Period;
import java.util.*;
import java.util.stream.Collectors;
import static com.gorbatenko.budget.util.BaseUtil.setTimeZoneOffset;
import static java.util.stream.Collectors.groupingBy;
@Service
public class BudgetItemService {
private BudgetItemRepository budgetItemRepository;
private KindRepository kindRepository;
private CurrencyRepository currencyRepository;
public BudgetItemService(BudgetItemRepository budgetItemRepository, KindRepository kindRepository, CurrencyRepository currencyRepository) {
this.budgetItemRepository = budgetItemRepository;
this.kindRepository = kindRepository;
this.currencyRepository = currencyRepository;
}
public BudgetItem save(BudgetItem budgetItem) {
return budgetItemRepository.save(budgetItem);
}
public void saveAll(List<BudgetItem> budgetItems) {
budgetItemRepository.saveAll(budgetItems);
}
public List<KindTotals> getTotalsByKindsForPeriod(LocalDateTime startDate, LocalDateTime endDate, TypePeriod period) {
return budgetItemRepository.getTotalsByKindsForPeriod(startDate, endDate, period);
}
public List<BudgetItem> getByCurrencyId(String id) {
return budgetItemRepository.getByCurrencyId(id);
}
public List<BudgetItem> getByKindId(String id) {
return budgetItemRepository.getByKindId(id);
}
public List<BudgetItem> getPopularByTypeForPeriod(LocalDateTime startDate, LocalDateTime endDate, String typeName) {
return budgetItemRepository.getFilteredData(startDate, endDate, null, typeName, null, null, null, TypePeriod.SELECTED_PERIOD);
}
public List<BudgetItem> getBeforeDate(LocalDateTime endDate) {
return budgetItemRepository.getFilteredData(null, endDate, null, null, null, null, null, TypePeriod.SELECTED_PERIOD);
}
public List<BudgetItem> getAll() {
return budgetItemRepository.getAll();
}
public BudgetItem getById(String id) {
return budgetItemRepository.getById(id);
}
public List<CurrencyCount> getCurrencyCounts() {
return budgetItemRepository.getCurrencyCounts();
}
public List<BudgetItem> getByUserId(String id) {
return budgetItemRepository.getFilteredData(null,null, id, null, null, null, null, TypePeriod.ALL_TIME);
}
public List<BudgetItem> getForSelectedPeriod(LocalDateTime startLocalDate, LocalDateTime endLocalDate) {
return budgetItemRepository.getFilteredData(startLocalDate, endLocalDate, null, null, null, null, null, TypePeriod.SELECTED_PERIOD);
}
public Double getSumPriceByCurrencyAndType(Currency currency, Type type) {
return budgetItemRepository.getSumPriceByCurrencyAndType(currency, type);
}
public Double getSumPriceByDefaultCurrencyAndType(Type type) {
return budgetItemRepository.getSumPriceByDefaultCurrencyAndType(type);
}
public LocalDateTime getMaxDate() {
return budgetItemRepository.getMaxDate();
}
public String getLastCurrencyIdByDate(LocalDate date) {
return budgetItemRepository.getLastCurrencyIdByDate(date);
}
public void deleteById(String id) {
budgetItemRepository.deleteById(id);
}
public GroupStatisticData groupStatisticCollectData(TypePeriod period, LocalDate startDate, LocalDate endDate, String sortType) {
GroupStatisticData result = new GroupStatisticData();
LocalDate now = LocalDate.now();
LocalDateTime offSetStartDate;
LocalDateTime offSetEndDate;
TreeMap<Type, Map<Kind, Double>> mapKind;
if ((startDate == null) || (period.equals(TypePeriod.CURRENT_MONTH))) {
offSetStartDate = LocalDateTime.of(LocalDate.of(now.getYear(), now.getMonth(), 1), LocalTime.MIN);
startDate = offSetStartDate.toLocalDate();
offSetEndDate = LocalDateTime.of(LocalDate.of(now.getYear(), now.getMonth(), now.lengthOfMonth()), LocalTime.MAX);
endDate = offSetEndDate.toLocalDate();
}
if (period.equals(TypePeriod.CURRENT_YEAR)) {
offSetStartDate = LocalDateTime.of(LocalDate.of(now.getYear(), 1, 1), LocalTime.MIN);
startDate = offSetStartDate.toLocalDate();
offSetEndDate = LocalDateTime.of(LocalDate.of(now.getYear(), 12, 31), LocalTime.MAX);
endDate = offSetEndDate.toLocalDate();
}
offSetStartDate = setTimeZoneOffset(startDate);
offSetEndDate = setTimeZoneOffset(endDate);
List<KindTotals> totals = getTotalsByKindsForPeriod(offSetStartDate, offSetEndDate, period);
if (period.equals(TypePeriod.ALL_TIME) && totals.size() > 0) {
offSetStartDate = totals.stream()
.map(total -> total.getMinCreateDateTime())
.min(LocalDateTime::compareTo)
.get();
}
if (sortType.isEmpty() || sortType.equalsIgnoreCase("byName")) {
mapKind = new TreeMap(totals.stream()
.collect(groupingBy(
total ->
total.getKind().getType(), (
groupingBy(
KindTotals::getKind,
TreeMap::new,
Collectors.summingDouble(KindTotals::getSumPrice)))
)));
} else { /* sort by price */
mapKind = new TreeMap(totals.stream()
.collect(groupingBy(
total ->
total.getKind().getType(), (
groupingBy(
KindTotals::getKind,
HashMap::new,
Collectors.summingDouble(KindTotals::getSumPrice))))
));
for (Map.Entry<Type, Map<Kind, Double>> entry : mapKind.entrySet()) {
entry.setValue(
entry.getValue().entrySet()
.stream()
.sorted((s1, s2) -> s2.getValue().compareTo(s1.getValue()))
.collect(Collectors.toMap(
Map.Entry::getKey,
Map.Entry::getValue,
(oldValue, newValue) -> oldValue, LinkedHashMap::new)));
}
}
if (period.equals(TypePeriod.ALL_TIME)) {
startDate = totals.stream()
.map(KindTotals::getMinCreateDateTime)
.min(LocalDateTime::compareTo)
.get()
.toLocalDate();
endDate = totals.stream()
.map(KindTotals::getMaxCreateDateTime)
.max(LocalDateTime::compareTo)
.get()
.toLocalDate();
}
GroupPeriod groupPeriod = getGroupPeriod(startDate, endDate);
Map<String, Double> mapDateProfit =
budgetItemRepository.getSumPriceForPeriodByDateAndDefaultCurrency(offSetStartDate, offSetEndDate, Type.PROFIT, period, groupPeriod);
Map<String, Double> mapDateSpending =
budgetItemRepository.getSumPriceForPeriodByDateAndDefaultCurrency(offSetStartDate, offSetEndDate, Type.SPENDING, period, groupPeriod);
TreeMap<String, TreeMap<Type, Double>> totalMap = new TreeMap<>();
for(Map.Entry<String, Double> entry : mapDateProfit.entrySet()) {
TreeMap<Type, Double> map = totalMap.getOrDefault(entry.getKey(), new TreeMap<>());
double value = map.getOrDefault(Type.PROFIT, 0.00D) + entry.getValue();
map.put(Type.PROFIT, value);
totalMap.put(entry.getKey(), map);
}
for(Map.Entry<String, Double> entry : mapDateSpending.entrySet()) {
TreeMap<Type, Double> map = totalMap.getOrDefault(entry.getKey(), new TreeMap<>());
double value = map.getOrDefault(Type.SPENDING, 0.00D) + entry.getValue();
map.put(Type.SPENDING, value);
totalMap.put(entry.getKey(), map);
}
Map<Kind, Long> mapKindCount = totals.stream()
.collect(Collectors.toMap(KindTotals::getKind, KindTotals::getCount));
Double maxPriceProfit = totals.stream()
.filter(total -> total.getKind().getType().equals(Type.PROFIT))
.map(total -> total.getSumPrice())
.max(Double::compareTo)
.orElse(0.0);
Double maxPriceSpending = totals.stream()
.filter(total -> total.getKind().getType().equals(Type.SPENDING))
.map(total -> total.getSumPrice())
.max(Double::compareTo)
.orElse(0.0);
Map<Type, Double> mapMaxPrice = new HashMap<>();
mapMaxPrice.put(Type.PROFIT, maxPriceProfit);
mapMaxPrice.put(Type.SPENDING, maxPriceSpending);
Double profit = totals.stream()
.filter(total -> total.getKind().getType().equals(Type.PROFIT))
.mapToDouble(KindTotals::getSumPrice)
.sum();
Double spending = totals.stream()
.filter(total -> total.getKind().getType().equals(Type.SPENDING))
.mapToDouble(KindTotals::getSumPrice)
.sum();
result.setStartDate(startDate);
result.setEndDate(endDate);
result.setOffSetStartDate(offSetStartDate);
result.setOffSetEndDate(offSetEndDate);
result.setMapKind(mapKind);
result.setMapKindCount(mapKindCount);
result.setMapMaxPrice(mapMaxPrice);
result.setTotalMap(totalMap);
result.setProfit(profit);
result.setSpending(spending);
return result;
}
public StatisticData statisticCollectData(LocalDate startDate, LocalDate endDate, String userId, String typeStr,
String kindId, String priceStr, String description, TypePeriod period) {
StatisticData result = new StatisticData();
List<com.gorbatenko.budget.model.doc.User> users = new HashSet<>(budgetItemRepository.getUsersForAllPeriod())
.stream()
.sorted(Comparator.comparing(com.gorbatenko.budget.model.doc.User::getName))
.collect(Collectors.toList());
LocalDateTime offSetStartDate;
LocalDateTime offSetEndDate;
LocalDate now = LocalDate.now();
if (startDate == null) {
offSetStartDate = LocalDateTime.of(LocalDate.of(now.getYear(), now.getMonth(), 1), LocalTime.MIN);
startDate = offSetStartDate.toLocalDate();
}
offSetStartDate = setTimeZoneOffset(startDate);
if (endDate == null) {
offSetEndDate = LocalDateTime.of(LocalDate.of(now.getYear(), now.getMonth(), now.lengthOfMonth()), LocalTime.MAX);
endDate = offSetEndDate.toLocalDate();
}
offSetEndDate = setTimeZoneOffset(endDate);
List<BudgetItem> listBudgetItems = budgetItemRepository.getFilteredData(offSetStartDate, offSetEndDate, userId, typeStr, kindId, priceStr, description, period);
result.setStartDate(startDate);
result.setEndDate(endDate);
result.setOffSetStartDate(offSetStartDate);
result.setOffSetEndDate(offSetEndDate);
result.setListBudgetItems(listBudgetItems);
result.setUsers(users);
return result;
}
public DynamicStatisticData dynamicStatisticCollectData(LocalDate startDate, LocalDate endDate,
String kindId, Type type, GroupPeriod groupPeriod) {
DynamicStatisticData result = new DynamicStatisticData();
LocalDateTime offSetStartDate;
LocalDateTime offSetEndDate;
offSetStartDate = setTimeZoneOffset(startDate);
offSetEndDate = setTimeZoneOffset(endDate).plusDays(1);
String positionName;
double positionSum;
List<BudgetItem> listBudgetItems;
if (groupPeriod == GroupPeriod.BY_DEFAULT) {
groupPeriod = getGroupPeriod(startDate, endDate);
}
if (!kindId.isEmpty()) {
Kind kind = kindRepository.getById(kindId);
listBudgetItems =
budgetItemRepository.getFilteredData(offSetStartDate, offSetEndDate, null, null, kind.getId(), null, null, TypePeriod.SELECTED_PERIOD);
positionName = kind.getName();
} else {
listBudgetItems =
budgetItemRepository.getFilteredData(offSetStartDate, offSetEndDate, null, type.name(), null, null, null, TypePeriod.SELECTED_PERIOD);
positionName = type.getValue();
}
Map<String, Double> mapKind = listBudgetItems.stream()
.collect(groupingBy(
(groupPeriod.equals(GroupPeriod.BY_DAYS) ? BudgetItem::getStrDate :
groupPeriod.equals(GroupPeriod.BY_MONTHS) ? BudgetItem::getStrYearMonth : BudgetItem::getStrYear),
Collectors.summingDouble(BudgetItem::getPrice)));
positionSum = listBudgetItems.stream()
.mapToDouble(BudgetItem::getPrice).sum();
result.setStartDate(startDate);
result.setEndDate(endDate);
result.setOffSetStartDate(offSetStartDate);
result.setOffSetEndDate(offSetEndDate);
result.setMapKindSort(new TreeMap<>(mapKind));
result.setPositionName(positionName);
result.setPositionSum(positionSum);
return result;
}
private GroupPeriod getGroupPeriod(LocalDate startDate, LocalDate endDate) {
if ((endDate.getYear() == startDate.getYear()) &&
(endDate.getMonth().equals(startDate.getMonth()))) {
return GroupPeriod.BY_DAYS;
} else {
Period age = Period.between(startDate, endDate);
if (age.getMonths() <= 12 && age.getYears() < 1) {
return GroupPeriod.BY_MONTHS;
}
return GroupPeriod.BY_YEARS;
}
}
}
| 14,867 | 0.626623 | 0.624807 | 353 | 41.116146 | 35.419392 | 168 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.818697 | false | false |
12
|
3f506f16d6aa31911c1125c731c4097b8fc1ceb3
| 23,708,219,484,623 |
718735f4f90e7b57555de8268050b5878db9a206
|
/src/main/java/com/henu/main/entities/Message.java
|
2a9c8fb7b42190cfb997c4a42e44f0fdbff8f33b
|
[] |
no_license
|
sunmyuan/zhichengpingshen
|
https://github.com/sunmyuan/zhichengpingshen
|
c061b5cd7e0839824329c6c97cf4adbd18f77c1b
|
1997291e18051595aec4175340f9bb6079c1764b
|
refs/heads/master
| 2020-09-24T12:19:11.675000 | 2019-12-04T03:05:49 | 2019-12-04T03:05:49 | 225,758,219 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.henu.main.entities;
import com.alibaba.fastjson.annotation.JSONField;
import javax.persistence.Id;
import javax.persistence.Table;
@Table(name = "message")
public class Message {
@Id
@JSONField(ordinal = 1)
private Long id;
@JSONField(ordinal = 2)
private Long userId;
@JSONField(ordinal = 3)
private Long userPId;
@JSONField(ordinal = 4)
private String tableName;
@JSONField(ordinal = 5)
private String status;
@JSONField(ordinal = 6)
private String message;
@JSONField(ordinal = 7)
private String caozuoren;
@Override
public String toString() {
return "Message{" +
"id=" + id +
", userId=" + userId +
", userPId=" + userPId +
", tableName='" + tableName + '\'' +
", status='" + status + '\'' +
", message='" + message + '\'' +
", caozuoren='" + caozuoren + '\'' +
'}';
}
public String getCaozuoren() {
return caozuoren;
}
public void setCaozuoren(String caozuoren) {
this.caozuoren = caozuoren;
}
public Message(Long id, Long userId, Long userPId, String tableName, String status, String message, String caozuoren) {
this.id = id;
this.userId = userId;
this.userPId = userPId;
this.tableName = tableName;
this.status = status;
this.message = message;
this.caozuoren = caozuoren;
}
public Message(Long id, Long userId, Long userPId, String tableName, String status, String message) {
this.id = id;
this.userId = userId;
this.userPId = userPId;
this.tableName = tableName;
this.status = status;
this.message = message;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public Long getUserPId() {
return userPId;
}
public void setUserPId(Long userPId) {
this.userPId = userPId;
}
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public Message() {
}
}
|
UTF-8
|
Java
| 2,681 |
java
|
Message.java
|
Java
|
[] | null |
[] |
package com.henu.main.entities;
import com.alibaba.fastjson.annotation.JSONField;
import javax.persistence.Id;
import javax.persistence.Table;
@Table(name = "message")
public class Message {
@Id
@JSONField(ordinal = 1)
private Long id;
@JSONField(ordinal = 2)
private Long userId;
@JSONField(ordinal = 3)
private Long userPId;
@JSONField(ordinal = 4)
private String tableName;
@JSONField(ordinal = 5)
private String status;
@JSONField(ordinal = 6)
private String message;
@JSONField(ordinal = 7)
private String caozuoren;
@Override
public String toString() {
return "Message{" +
"id=" + id +
", userId=" + userId +
", userPId=" + userPId +
", tableName='" + tableName + '\'' +
", status='" + status + '\'' +
", message='" + message + '\'' +
", caozuoren='" + caozuoren + '\'' +
'}';
}
public String getCaozuoren() {
return caozuoren;
}
public void setCaozuoren(String caozuoren) {
this.caozuoren = caozuoren;
}
public Message(Long id, Long userId, Long userPId, String tableName, String status, String message, String caozuoren) {
this.id = id;
this.userId = userId;
this.userPId = userPId;
this.tableName = tableName;
this.status = status;
this.message = message;
this.caozuoren = caozuoren;
}
public Message(Long id, Long userId, Long userPId, String tableName, String status, String message) {
this.id = id;
this.userId = userId;
this.userPId = userPId;
this.tableName = tableName;
this.status = status;
this.message = message;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public Long getUserPId() {
return userPId;
}
public void setUserPId(Long userPId) {
this.userPId = userPId;
}
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public Message() {
}
}
| 2,681 | 0.565834 | 0.563223 | 118 | 21.720339 | 19.419493 | 123 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.474576 | false | false |
12
|
4751cbc48d081197f408bdb058bff2e4003c7f79
| 33,225,867,055,331 |
c42c3cc814034028e1c6f7d44ce26b64e9338e13
|
/src/main/java/co/com/emcali/sidapweb/controller/ReporteParadasController.java
|
8ff20cb078bff343931654431687aa83fb9b000c
|
[] |
no_license
|
jlriofrio/stefanini
|
https://github.com/jlriofrio/stefanini
|
ad10ca4b3619d9477ff8deef372c6edf1bfe16d6
|
742f561792b80c1eccec510b7a5338fbd94cc759
|
refs/heads/master
| 2021-03-06T12:39:03.468000 | 2020-03-19T04:58:42 | 2020-03-19T04:58:42 | 246,200,657 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package co.com.emcali.sidapweb.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import co.com.emcali.sidapweb.dto.ReporteParadasDTO;
import co.com.emcali.sidapweb.service.ReporteParadasService;
@RestController
@RequestMapping("/paradas")
public class ReporteParadasController {
@Autowired
private ReporteParadasService reporteParadasService;
@GetMapping(value = "/porMes")
public ResponseEntity<List<ReporteParadasDTO>> findByMes(@RequestParam(name = "mes") String mes) {
return ResponseEntity.ok(reporteParadasService.findByMes(mes));
}
@GetMapping(value = "/porAnio")
public ResponseEntity<List<ReporteParadasDTO>> findByAnio(@RequestParam(name = "anio") String anio) {
return ResponseEntity.ok(reporteParadasService.findByAnio(anio));
}
@GetMapping(value = "/porPlanta")
public ResponseEntity<List<ReporteParadasDTO>> findByPlanta(@RequestParam(name = "planta") String planta) {
return ResponseEntity.ok(reporteParadasService.findByPlanta(planta));
}
}
|
UTF-8
|
Java
| 1,331 |
java
|
ReporteParadasController.java
|
Java
|
[] | null |
[] |
package co.com.emcali.sidapweb.controller;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import co.com.emcali.sidapweb.dto.ReporteParadasDTO;
import co.com.emcali.sidapweb.service.ReporteParadasService;
@RestController
@RequestMapping("/paradas")
public class ReporteParadasController {
@Autowired
private ReporteParadasService reporteParadasService;
@GetMapping(value = "/porMes")
public ResponseEntity<List<ReporteParadasDTO>> findByMes(@RequestParam(name = "mes") String mes) {
return ResponseEntity.ok(reporteParadasService.findByMes(mes));
}
@GetMapping(value = "/porAnio")
public ResponseEntity<List<ReporteParadasDTO>> findByAnio(@RequestParam(name = "anio") String anio) {
return ResponseEntity.ok(reporteParadasService.findByAnio(anio));
}
@GetMapping(value = "/porPlanta")
public ResponseEntity<List<ReporteParadasDTO>> findByPlanta(@RequestParam(name = "planta") String planta) {
return ResponseEntity.ok(reporteParadasService.findByPlanta(planta));
}
}
| 1,331 | 0.809166 | 0.809166 | 37 | 34.972973 | 32.128532 | 108 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false |
12
|
d144301fedbc5f075065d447e732b51b52dcd47b
| 6,871,947,729,135 |
aada16d3956dc91bd3a1cc3e35c3d5d79f804491
|
/src/main/java/com/dao/BillDao.java
|
72a4155a128d774300259b74478470601f25d5b4
|
[] |
no_license
|
wdnmd-rgb/accounting
|
https://github.com/wdnmd-rgb/accounting
|
504d7db7a9232f5d6e0c97e7e1679b5459d2c87f
|
2724a3e6530c7cffff974ec2a955efdbb770180a
|
refs/heads/master
| 2023-01-03T08:43:56.908000 | 2020-10-27T04:45:58 | 2020-10-27T04:45:58 | 307,587,947 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.dao;
import com.entity.Bill;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* (Bill)表数据库访问层
*
* @author makejava
* @since 2020-10-26 19:50:49
*/
@Mapper
public interface BillDao {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
Bill queryById(Integer id);
/**
* 通过实体作为筛选条件查询
*
* @param bill 实例对象
* @return 对象列表
*/
List<Bill> queryAll(Bill bill);
/**
* 通过实体作为筛选条件查询
*
* @param bill 实例对象
* @return 条数
*/
int queryAllNum(Bill bill);
/**
* 新增数据
*
* @param bill 实例对象
* @return 影响行数
*/
int insert(Bill bill);
/**
* 修改数据
*
* @param bill 实例对象
* @return 影响行数
*/
int update(Bill bill);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 影响行数
*/
int deleteById(Integer id);
}
|
UTF-8
|
Java
| 1,150 |
java
|
BillDao.java
|
Java
|
[
{
"context": "ava.util.List;\n\n/**\n * (Bill)表数据库访问层\n *\n * @author makejava\n * @since 2020-10-26 19:50:49\n */\n@Mapper\npublic ",
"end": 199,
"score": 0.9993634223937988,
"start": 191,
"tag": "USERNAME",
"value": "makejava"
}
] | null |
[] |
package com.dao;
import com.entity.Bill;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* (Bill)表数据库访问层
*
* @author makejava
* @since 2020-10-26 19:50:49
*/
@Mapper
public interface BillDao {
/**
* 通过ID查询单条数据
*
* @param id 主键
* @return 实例对象
*/
Bill queryById(Integer id);
/**
* 通过实体作为筛选条件查询
*
* @param bill 实例对象
* @return 对象列表
*/
List<Bill> queryAll(Bill bill);
/**
* 通过实体作为筛选条件查询
*
* @param bill 实例对象
* @return 条数
*/
int queryAllNum(Bill bill);
/**
* 新增数据
*
* @param bill 实例对象
* @return 影响行数
*/
int insert(Bill bill);
/**
* 修改数据
*
* @param bill 实例对象
* @return 影响行数
*/
int update(Bill bill);
/**
* 通过主键删除数据
*
* @param id 主键
* @return 影响行数
*/
int deleteById(Integer id);
}
| 1,150 | 0.521967 | 0.507322 | 69 | 12.869565 | 11.10283 | 44 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.15942 | false | false |
12
|
a23a5c7eedeb42c67863567b2f21c80ec0e26981
| 16,784,732,247,992 |
811f47f6ea7b9a0fabafab90f5a18299060f6523
|
/src/common/protocols/RemoteNameNode.java
|
0bfc73927611a4ad43c7629dcb8e8e98c6ee1e8d
|
[] |
no_license
|
blole/yahas
|
https://github.com/blole/yahas
|
d7c2ad72d63d5b298d08d5bc7509d485d8db04fc
|
46cedab3a0ae367d3f58b0b51178cc1d72e600bb
|
refs/heads/master
| 2020-12-24T14:27:36.640000 | 2015-03-17T12:00:03 | 2015-03-17T12:00:03 | 32,387,369 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package common.protocols;
/**
* Interface that represents a NameNode.
*
* @author Bjorn, Govind, Jerry, Karan
*
*/
public interface RemoteNameNode extends ClientNameNodeProtocol,
DataNodeNameNodeProtocol {
}
|
UTF-8
|
Java
| 218 |
java
|
RemoteNameNode.java
|
Java
|
[
{
"context": "terface that represents a NameNode.\n * \n * @author Bjorn, Govind, Jerry, Karan\n * \n */\npublic interface Rem",
"end": 92,
"score": 0.971167266368866,
"start": 87,
"tag": "NAME",
"value": "Bjorn"
},
{
"context": " that represents a NameNode.\n * \n * @author Bjorn, Govind, Jerry, Karan\n * \n */\npublic interface RemoteNameN",
"end": 100,
"score": 0.9152787923812866,
"start": 94,
"tag": "NAME",
"value": "Govind"
},
{
"context": "presents a NameNode.\n * \n * @author Bjorn, Govind, Jerry, Karan\n * \n */\npublic interface RemoteNameNode ext",
"end": 107,
"score": 0.9721196293830872,
"start": 102,
"tag": "NAME",
"value": "Jerry"
},
{
"context": "s a NameNode.\n * \n * @author Bjorn, Govind, Jerry, Karan\n * \n */\npublic interface RemoteNameNode extends C",
"end": 114,
"score": 0.9236840009689331,
"start": 109,
"tag": "NAME",
"value": "Karan"
}
] | null |
[] |
package common.protocols;
/**
* Interface that represents a NameNode.
*
* @author Bjorn, Govind, Jerry, Karan
*
*/
public interface RemoteNameNode extends ClientNameNodeProtocol,
DataNodeNameNodeProtocol {
}
| 218 | 0.747706 | 0.747706 | 11 | 18.818182 | 20.368505 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.636364 | false | false |
12
|
24cdb44a0fba778e306e54e00c879bab87b8c58b
| 26,207,890,488,205 |
32d54074cbd17d34cc880bf93c99b08d78e9ed4f
|
/src/main/java/com/gk/htc/ahp/brand/thread/SendBrandCustomer.java
|
292c030b01a3feefe4bac4bd2cab395aa3d2580f
|
[] |
no_license
|
hongyanggreat/projtest2
|
https://github.com/hongyanggreat/projtest2
|
ce090ac74025685f16b11a9d69db67cbcf50fb37
|
973ae8c75d404b51402c1df7532be4b4ee820226
|
refs/heads/master
| 2020-03-16T21:30:56.824000 | 2018-05-11T07:05:47 | 2018-05-11T07:05:47 | 133,002,334 | 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 com.gk.htc.ahp.brand.thread;
import com.gk.htc.ahp.brand.app.AppStart;
import com.gk.htc.ahp.brand.common.DateProc;
import com.gk.htc.ahp.brand.common.Tool;
import com.gk.htc.ahp.brand.entity.MsgBrandCustomer;
import com.gk.htc.ahp.brand.entity.SmsBrandQueue;
import com.gk.htc.ahp.brand.service.primarywork.MonitorWorker;
import java.util.ArrayList;
import org.apache.log4j.Logger;
/**
*
* @author TUANPLA
*/
public class SendBrandCustomer extends Thread {
final Logger logger = Logger.getLogger(SendBrandCustomer.class);
private boolean stop = false;
public SendBrandCustomer() {
this.setName("SendBrandCustomer [" + DateProc.createTimestamp() + "]");
MonitorWorker.addDemonName(this.getName());
}
@Override
public void run() {
try {
Tool.debug("|===> " + this.getName() + " is Started....");
while (AppStart.isRuning && !stop) {
MsgBrandCustomer dao = new MsgBrandCustomer();
ArrayList<MsgBrandCustomer> all = dao.getAll_MsgCustomer();
if (all != null && !all.isEmpty()) {
logger.info("SendBrandCustomer size: " + all.size());
for (MsgBrandCustomer one : all) {
try {
// Chi day lai Queue gui ko log lai Income nua? Tại Sao
// Xoa Thanh cong thi day
if (dao.del(one.getId())) {
// TODO neu label = null --> chua den doan Account thi da bi log DB roi nen khong tim thay lich su
SmsBrandQueue oneQueue = one.buildQueue();
if (oneQueue != null) {
if (oneQueue.getResult() == 1 || oneQueue.getResult() == 99) {
// Add vao Queue de xu ly gui & Đã log income ngay khi buildQueue() rồi
AppStart.sendPrimaryTask.addToqueue(oneQueue);
} else {
oneQueue.setErrorInfo("oneQueue.getResult() !=1 or 99");
logger.error(oneQueue.toStringJson());
}
} else {
// Bị lỗi và bị reject đã log income trong hàm buildQueue()
}
}
} catch (Exception e) {
logger.error("SendBrandCustomer ERROR:" + one.getLabel() + ":" + one.getUserSender() + "|Exception=" + e.getMessage());
logger.error(Tool.getLogMessage(e));
}
}
}
// 30s SendBrandCustomer 1 lan neu co
Thread.sleep(10 * 1000);
Tool.debug("|==> SendBrandCustomer Thread is Wakeup[" + DateProc.createTimestamp() + "]....");
}
} catch (Exception e) {
logger.error(Tool.getLogMessage(e));
}
MonitorWorker.removeDemonName(this.getName());
}
public void shutDown() {
stop = true;
}
}
|
UTF-8
|
Java
| 3,444 |
java
|
SendBrandCustomer.java
|
Java
|
[
{
"context": "import org.apache.log4j.Logger;\n\n/**\n *\n * @author TUANPLA\n */\npublic class SendBrandCustomer extends Thread",
"end": 603,
"score": 0.9757196307182312,
"start": 596,
"tag": "USERNAME",
"value": "TUANPLA"
}
] | 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 com.gk.htc.ahp.brand.thread;
import com.gk.htc.ahp.brand.app.AppStart;
import com.gk.htc.ahp.brand.common.DateProc;
import com.gk.htc.ahp.brand.common.Tool;
import com.gk.htc.ahp.brand.entity.MsgBrandCustomer;
import com.gk.htc.ahp.brand.entity.SmsBrandQueue;
import com.gk.htc.ahp.brand.service.primarywork.MonitorWorker;
import java.util.ArrayList;
import org.apache.log4j.Logger;
/**
*
* @author TUANPLA
*/
public class SendBrandCustomer extends Thread {
final Logger logger = Logger.getLogger(SendBrandCustomer.class);
private boolean stop = false;
public SendBrandCustomer() {
this.setName("SendBrandCustomer [" + DateProc.createTimestamp() + "]");
MonitorWorker.addDemonName(this.getName());
}
@Override
public void run() {
try {
Tool.debug("|===> " + this.getName() + " is Started....");
while (AppStart.isRuning && !stop) {
MsgBrandCustomer dao = new MsgBrandCustomer();
ArrayList<MsgBrandCustomer> all = dao.getAll_MsgCustomer();
if (all != null && !all.isEmpty()) {
logger.info("SendBrandCustomer size: " + all.size());
for (MsgBrandCustomer one : all) {
try {
// Chi day lai Queue gui ko log lai Income nua? Tại Sao
// Xoa Thanh cong thi day
if (dao.del(one.getId())) {
// TODO neu label = null --> chua den doan Account thi da bi log DB roi nen khong tim thay lich su
SmsBrandQueue oneQueue = one.buildQueue();
if (oneQueue != null) {
if (oneQueue.getResult() == 1 || oneQueue.getResult() == 99) {
// Add vao Queue de xu ly gui & Đã log income ngay khi buildQueue() rồi
AppStart.sendPrimaryTask.addToqueue(oneQueue);
} else {
oneQueue.setErrorInfo("oneQueue.getResult() !=1 or 99");
logger.error(oneQueue.toStringJson());
}
} else {
// Bị lỗi và bị reject đã log income trong hàm buildQueue()
}
}
} catch (Exception e) {
logger.error("SendBrandCustomer ERROR:" + one.getLabel() + ":" + one.getUserSender() + "|Exception=" + e.getMessage());
logger.error(Tool.getLogMessage(e));
}
}
}
// 30s SendBrandCustomer 1 lan neu co
Thread.sleep(10 * 1000);
Tool.debug("|==> SendBrandCustomer Thread is Wakeup[" + DateProc.createTimestamp() + "]....");
}
} catch (Exception e) {
logger.error(Tool.getLogMessage(e));
}
MonitorWorker.removeDemonName(this.getName());
}
public void shutDown() {
stop = true;
}
}
| 3,444 | 0.505834 | 0.501167 | 78 | 42.948719 | 32.784416 | 147 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.461538 | false | false |
12
|
08c16a59903a8febbff6dd52694b44803d72f7a7
| 23,991,687,376,879 |
dfa1bb1bd7ef84f9e225d51761c4fc2470b51112
|
/missing-element-in-sorted-array/missing-element-in-sorted-array.java
|
c21d5449091f2af817b22a2906891bab9d8331af
|
[] |
no_license
|
gowriaddepalli/Leetcode_solutions
|
https://github.com/gowriaddepalli/Leetcode_solutions
|
f31d9716a3690dcdbc0e7e4eaf9773b8bd8f7453
|
1f33cbeb52f9ec6332d05bbd3da69935ba553cf8
|
refs/heads/master
| 2023-04-05T11:34:42.736000 | 2021-04-16T07:33:02 | 2021-04-16T07:33:02 | 158,172,755 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
class Solution {
public int missingElement(int[] nums, int k) {
int n = nums.length;
int i=0;
int num = -1;
while(i+1<n){
if(nums[i+1]-nums[i]-1<k){
k -= nums[i+1]-nums[i]-1;
}else{
num = nums[i]+k;
return num;
}
i++;
}
if(i==n-1){
num = nums[i]+k;
}
return num;
}
}
|
UTF-8
|
Java
| 545 |
java
|
missing-element-in-sorted-array.java
|
Java
|
[] | null |
[] |
class Solution {
public int missingElement(int[] nums, int k) {
int n = nums.length;
int i=0;
int num = -1;
while(i+1<n){
if(nums[i+1]-nums[i]-1<k){
k -= nums[i+1]-nums[i]-1;
}else{
num = nums[i]+k;
return num;
}
i++;
}
if(i==n-1){
num = nums[i]+k;
}
return num;
}
}
| 545 | 0.339912 | 0.322368 | 21 | 20.714285 | 12.055992 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.47619 | false | false |
12
|
74e168e4db3d529f3d3f4cfccf7a4d203f3723f1
| 6,571,300,017,208 |
be73f4064999830948ed48741068959ace7333a5
|
/SSMDemo/src/org/springmvc_demo/entity/User.java
|
a45a093795837c90afeb17d1864b409028bb5071
|
[] |
no_license
|
myeanng/SSM
|
https://github.com/myeanng/SSM
|
3a1b79a1ba225e35c0b6f950c65e1ac18827994b
|
d7b29a265fa0077d08ceebd85b5b1ffae38b60bc
|
refs/heads/master
| 2020-04-01T17:33:51.762000 | 2016-05-28T02:26:02 | 2016-05-28T02:26:02 | 59,873,419 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.springmvc_demo.entity;
import java.io.Serializable;
import java.util.Date;
public class User implements Serializable{
private static final long serialVersionUID = 216615822538235296L;
private Date createDate;
private String email;
private String pwd;
private Integer userId;
private String userName;
public User() {}
public User(Integer userId, String userName, String email, String pwd) {
super();
this.userId = userId;
this.userName = userName;
this.email = email;
this.pwd = pwd;
}
public User(Integer userId, String userName, String email, String pwd,
Date createDate) {
super();
this.userId = userId;
this.userName = userName;
this.email = email;
this.pwd = pwd;
this.createDate = createDate;
}
public User(String userName, String email, String pwd) {
super();
this.userName = userName;
this.email = email;
this.pwd = pwd;
}
public User(String userName, String email, String pwd, Date createDate) {
super();
this.userName = userName;
this.email = email;
this.pwd = pwd;
this.createDate = createDate;
}
public Date getCreateDate() {
return createDate;
}
public String getEmail() {
return email;
}
public String getPwd() {
return pwd;
}
public Integer getUserId() {
return userId;
}
public String getUserName() {
return userName;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public void setEmail(String email) {
if( email != null && !"".equals(email.trim()) )
this.email = email;
}
public void setPwd(String pwd) {
if( pwd != null && !"".equals(pwd.trim()) )
this.pwd = pwd;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public void setUserName(String userName) {
this.userName = userName;
}
@Override
public String toString() {
return "User [createDate=" + createDate + ", email=" + email
+ ", pwd=" + pwd + ", userId=" + userId
+ ", userName=" + userName + "]";
}
}
|
UTF-8
|
Java
| 1,987 |
java
|
User.java
|
Java
|
[
{
"context": "ic User() {}\n\t\n\tpublic User(Integer userId, String userName, String email, String pwd) {\n\t\tsuper();\n\t\tthis.us",
"end": 391,
"score": 0.9213432669639587,
"start": 383,
"tag": "USERNAME",
"value": "userName"
},
{
"context": "super();\n\t\tthis.userId = userId;\n\t\tthis.userName = userName;\n\t\tthis.email = email;\n\t\tthis.pwd = pwd;\n\t}\n\n\tpub",
"end": 482,
"score": 0.9968137145042419,
"start": 474,
"tag": "USERNAME",
"value": "userName"
},
{
"context": "pwd = pwd;\n\t}\n\n\tpublic User(Integer userId, String userName, String email, String pwd,\n\t\t\tDate createDate) {\n",
"end": 572,
"score": 0.9798994064331055,
"start": 564,
"tag": "USERNAME",
"value": "userName"
},
{
"context": "super();\n\t\tthis.userId = userId;\n\t\tthis.userName = userName;\n\t\tthis.email = email;\n\t\tthis.pwd = pwd;\n\t\tthis.c",
"end": 683,
"score": 0.9989721775054932,
"start": 675,
"tag": "USERNAME",
"value": "userName"
},
{
"context": "ame = userName;\n\t\tthis.email = email;\n\t\tthis.pwd = pwd;\n\t\tthis.createDate = createDate;\n\t}\n\t\n\t\n\tpublic U",
"end": 723,
"score": 0.8941662907600403,
"start": 720,
"tag": "PASSWORD",
"value": "pwd"
},
{
"context": "reateDate = createDate;\n\t}\n\t\n\t\n\tpublic User(String userName, String email, String pwd) {\n\t\tsuper();\n\t\tthis.us",
"end": 792,
"score": 0.9717509746551514,
"start": 784,
"tag": "USERNAME",
"value": "userName"
},
{
"context": " email, String pwd) {\n\t\tsuper();\n\t\tthis.userName = userName;\n\t\tthis.email = email;\n\t\tthis.pwd = pwd;\n\t}\n\t\n\t\n\t",
"end": 859,
"score": 0.9981364011764526,
"start": 851,
"tag": "USERNAME",
"value": "userName"
},
{
"context": "ame = userName;\n\t\tthis.email = email;\n\t\tthis.pwd = pwd;\n\t}\n\t\n\t\n\tpublic User(String userName, String emai",
"end": 899,
"score": 0.967052161693573,
"start": 896,
"tag": "PASSWORD",
"value": "pwd"
},
{
"context": "mail;\n\t\tthis.pwd = pwd;\n\t}\n\t\n\t\n\tpublic User(String userName, String email, String pwd, Date createDate) {\n\t\ts",
"end": 936,
"score": 0.881086528301239,
"start": 928,
"tag": "USERNAME",
"value": "userName"
},
{
"context": "d, Date createDate) {\n\t\tsuper();\n\t\tthis.userName = userName;\n\t\tthis.email = email;\n\t\tthis.pwd = pwd;\n\t\tthis.c",
"end": 1020,
"score": 0.9979107975959778,
"start": 1012,
"tag": "USERNAME",
"value": "userName"
},
{
"context": "ame = userName;\n\t\tthis.email = email;\n\t\tthis.pwd = pwd;\n\t\tthis.createDate = createDate;\n\t}\n\t\n\tpublic Dat",
"end": 1060,
"score": 0.9576700925827026,
"start": 1057,
"tag": "PASSWORD",
"value": "pwd"
},
{
"context": "urn email;\n\t}\n\n\n\tpublic String getPwd() {\n\t\treturn pwd;\n\t}\n\n\tpublic Integer getUserId() {\n\t\treturn userI",
"end": 1242,
"score": 0.8172386884689331,
"start": 1239,
"tag": "PASSWORD",
"value": "pwd"
},
{
"context": "serId;\n\t}\n\n\tpublic String getUserName() {\n\t\treturn userName;\n\t}\n\n\tpublic void setCreateDate(Date createDate) ",
"end": 1347,
"score": 0.9735032916069031,
"start": 1339,
"tag": "USERNAME",
"value": "userName"
},
{
"context": " != null && !\"\".equals(pwd.trim()) )\n\t\t\tthis.pwd = pwd;\n\t}\n\n\tpublic void setUserId(Integer userId) {\n\t\tt",
"end": 1647,
"score": 0.9979268908500671,
"start": 1644,
"tag": "PASSWORD",
"value": "pwd"
},
{
"context": "erId = userId;\n\t}\n\n\tpublic void setUserName(String userName) {\n\t\tthis.userName = userName;\n\t}\n\n\t@Override\n\tpu",
"end": 1762,
"score": 0.707851767539978,
"start": 1754,
"tag": "USERNAME",
"value": "userName"
},
{
"context": "d setUserName(String userName) {\n\t\tthis.userName = userName;\n\t}\n\n\t@Override\n\tpublic String toString() {\n\t\tret",
"end": 1792,
"score": 0.9984089732170105,
"start": 1784,
"tag": "USERNAME",
"value": "userName"
},
{
"context": "+ createDate + \", email=\" + email\n\t\t\t\t+ \", pwd=\" + pwd + \", userId=\" + userId\n\t\t\t\t+ \", userName=\" + user",
"end": 1920,
"score": 0.9975918531417847,
"start": 1917,
"tag": "PASSWORD",
"value": "pwd"
},
{
"context": "+ pwd + \", userId=\" + userId\n\t\t\t\t+ \", userName=\" + userName + \"]\";\n\t}\n}\n",
"end": 1974,
"score": 0.9980356097221375,
"start": 1966,
"tag": "USERNAME",
"value": "userName"
}
] | null |
[] |
package org.springmvc_demo.entity;
import java.io.Serializable;
import java.util.Date;
public class User implements Serializable{
private static final long serialVersionUID = 216615822538235296L;
private Date createDate;
private String email;
private String pwd;
private Integer userId;
private String userName;
public User() {}
public User(Integer userId, String userName, String email, String pwd) {
super();
this.userId = userId;
this.userName = userName;
this.email = email;
this.pwd = pwd;
}
public User(Integer userId, String userName, String email, String pwd,
Date createDate) {
super();
this.userId = userId;
this.userName = userName;
this.email = email;
this.pwd = pwd;
this.createDate = createDate;
}
public User(String userName, String email, String pwd) {
super();
this.userName = userName;
this.email = email;
this.pwd = pwd;
}
public User(String userName, String email, String pwd, Date createDate) {
super();
this.userName = userName;
this.email = email;
this.pwd = pwd;
this.createDate = createDate;
}
public Date getCreateDate() {
return createDate;
}
public String getEmail() {
return email;
}
public String getPwd() {
return pwd;
}
public Integer getUserId() {
return userId;
}
public String getUserName() {
return userName;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public void setEmail(String email) {
if( email != null && !"".equals(email.trim()) )
this.email = email;
}
public void setPwd(String pwd) {
if( pwd != null && !"".equals(pwd.trim()) )
this.pwd = pwd;
}
public void setUserId(Integer userId) {
this.userId = userId;
}
public void setUserName(String userName) {
this.userName = userName;
}
@Override
public String toString() {
return "User [createDate=" + createDate + ", email=" + email
+ ", pwd=" + pwd + ", userId=" + userId
+ ", userName=" + userName + "]";
}
}
| 1,987 | 0.672874 | 0.663815 | 103 | 18.291262 | 18.314741 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.76699 | false | false |
12
|
cb72fadf830b08221db563f9847a99f1214c8e2b
| 2,525,440,830,420 |
db0051f846f16cf4e8a3a312b5d3020f68f06e79
|
/src/com/arraysNmatrix/NextPermutation.java
|
63cb6365787dcfe14516e9e06dabdeb0c3826c80
|
[] |
no_license
|
avyaysingh/Java-SDE-Sheet
|
https://github.com/avyaysingh/Java-SDE-Sheet
|
3131fd4a0362c5cb6ecde0f08289734893e30b82
|
0c000f72e8a6dd28a64cd76a8a076a81014e2592
|
refs/heads/master
| 2023-07-17T01:01:11.998000 | 2021-08-17T06:29:55 | 2021-08-17T06:29:55 | 397,129,418 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.arraysNmatrix;
public class NextPermutation {
public static void findNextpermutation(int[] number) {
int i = number.length - 2;
while (i >= 0 && number[i + 1] <= number[i]) {
i--;
}
if (i >= 0) {
int j = number.length - 1;
while (number[j] <= number[i]) {
j--;
}
swap(number, i, j);
}
reverse(number, i + 1);
}
private static void reverse(int[] nums, int start) {
int i = start, j = nums.length - 1;
while (i < j) {
swap(nums, i, j);
i++;
j--;
}
}
private static void swap(int[] nums, int i, int j) {
int temp = nums[i];
nums[i] = nums[j];
nums[j] = temp;
}
}
|
UTF-8
|
Java
| 809 |
java
|
NextPermutation.java
|
Java
|
[] | null |
[] |
package com.arraysNmatrix;
public class NextPermutation {
public static void findNextpermutation(int[] number) {
int i = number.length - 2;
while (i >= 0 && number[i + 1] <= number[i]) {
i--;
}
if (i >= 0) {
int j = number.length - 1;
while (number[j] <= number[i]) {
j--;
}
swap(number, i, j);
}
reverse(number, i + 1);
}
private static void reverse(int[] nums, int start) {
int i = start, j = nums.length - 1;
while (i < j) {
swap(nums, i, j);
i++;
j--;
}
}
private static void swap(int[] nums, int i, int j) {
int temp = nums[i];
nums[i] = nums[j];
nums[j] = temp;
}
}
| 809 | 0.428925 | 0.420272 | 34 | 22.764706 | 17.334187 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.676471 | false | false |
12
|
97688ade7c8da2b0c4f14273c581bc0dd014d0b2
| 2,559,800,577,095 |
7970d62f4cf68ad1e42b6fee3bda980de0c34b92
|
/JDBC_project2/src/com/chenlong/java/JDBC1/JDBCTools.java
|
1b059f47399d05d07bb84167836157843e4d9df7
|
[] |
no_license
|
Long-Cc/JavaCodeDemo
|
https://github.com/Long-Cc/JavaCodeDemo
|
e027c7c971efd7030f302c8a68fc4ba4e8dca755
|
57a38dc7c509abb08f88767143d2a0bb28d63def
|
refs/heads/master
| 2021-07-16T06:45:29.258000 | 2017-10-21T02:31:36 | 2017-10-21T02:31:36 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.chenlong.java.JDBC1;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.sql.DataSource;
import com.mchange.v2.c3p0.ComboPooledDataSource;
public class JDBCTools {
//处理数据库事务
public static void commit(Connection connection){
if(connection!=null){
try {
connection.commit();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
public static void rollback(Connection connection){
if(connection!=null){
try {
connection.rollback();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
public static void beginTx(Connection connection){
if(connection!=null){
try {
connection.setAutoCommit(false);
} catch (SQLException e) {
e.printStackTrace();
}
}
}
private static DataSource dataSource=null;
//数据库连接池只被初始化一次
static{
dataSource=new ComboPooledDataSource("helloc3p0");
}
public static Connection getConnection() throws Exception{
return dataSource.getConnection();
}
public static void release(Statement sta, Connection conn, ResultSet rs) {
if (rs != null) {
try {
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if (sta != null) {
try {
sta.close();
} catch (Exception e) {
e.printStackTrace();
}
}
if (conn != null) {
try {
//数据库连接池的Connection对象进行Close时
//并不是真的进行关闭,而是把该数据库连接会归还到数据库连接池中
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
public static void release(Statement sta, Connection conn) {
if (sta != null) {
try {
sta.close();
} catch (Exception e) {
e.printStackTrace();
}
}
if (conn != null) {
try {
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
// public static Connection getConnection() throws Exception {
//
// Properties proper = new Properties();
// InputStream is = JDBCTools.class.getClassLoader().getResourceAsStream(
// "JDBC.properties");
// proper.load(is);
// String user = proper.getProperty("user");
// String password = proper.getProperty("password");
// String jdbcUrl = proper.getProperty("jdbcUrl");
// String driver = proper.getProperty("driver");
//
// Class.forName(driver);
// return DriverManager.getConnection(jdbcUrl, user, password);
// }
}
|
GB18030
|
Java
| 2,465 |
java
|
JDBCTools.java
|
Java
|
[] | null |
[] |
package com.chenlong.java.JDBC1;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.sql.DataSource;
import com.mchange.v2.c3p0.ComboPooledDataSource;
public class JDBCTools {
//处理数据库事务
public static void commit(Connection connection){
if(connection!=null){
try {
connection.commit();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
public static void rollback(Connection connection){
if(connection!=null){
try {
connection.rollback();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
public static void beginTx(Connection connection){
if(connection!=null){
try {
connection.setAutoCommit(false);
} catch (SQLException e) {
e.printStackTrace();
}
}
}
private static DataSource dataSource=null;
//数据库连接池只被初始化一次
static{
dataSource=new ComboPooledDataSource("helloc3p0");
}
public static Connection getConnection() throws Exception{
return dataSource.getConnection();
}
public static void release(Statement sta, Connection conn, ResultSet rs) {
if (rs != null) {
try {
rs.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
if (sta != null) {
try {
sta.close();
} catch (Exception e) {
e.printStackTrace();
}
}
if (conn != null) {
try {
//数据库连接池的Connection对象进行Close时
//并不是真的进行关闭,而是把该数据库连接会归还到数据库连接池中
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
public static void release(Statement sta, Connection conn) {
if (sta != null) {
try {
sta.close();
} catch (Exception e) {
e.printStackTrace();
}
}
if (conn != null) {
try {
conn.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
// public static Connection getConnection() throws Exception {
//
// Properties proper = new Properties();
// InputStream is = JDBCTools.class.getClassLoader().getResourceAsStream(
// "JDBC.properties");
// proper.load(is);
// String user = proper.getProperty("user");
// String password = proper.getProperty("password");
// String jdbcUrl = proper.getProperty("jdbcUrl");
// String driver = proper.getProperty("driver");
//
// Class.forName(driver);
// return DriverManager.getConnection(jdbcUrl, user, password);
// }
}
| 2,465 | 0.658693 | 0.65613 | 111 | 20.09009 | 18.445707 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.396396 | false | false |
12
|
cd5c5bac683315b7fd5bb892701abbe25da6def4
| 3,788,161,224,744 |
065c3e84dea714b40f5f3d5bb04665609bb91b51
|
/src/main/java/com/zdh/mappers/ManagerMapper.java
|
ac5e07712929f20f1289b3aae8d75a63f985246a
|
[] |
no_license
|
Takohubuki/TwoHanded
|
https://github.com/Takohubuki/TwoHanded
|
89cfa264e036490bf4e3ad09c99230a05d031e3b
|
fc65f77a38b8decc1a70aae7028f56e166f785bd
|
refs/heads/master
| 2022-12-27T07:52:43.894000 | 2020-06-12T12:18:21 | 2020-06-12T12:18:21 | 180,088,661 | 0 | 0 | null | false | 2022-12-15T23:23:58 | 2019-04-08T06:57:25 | 2020-06-12T12:18:41 | 2022-12-15T23:23:54 | 79,540 | 0 | 0 | 10 |
JavaScript
| false | false |
package com.zdh.mappers;
import com.zdh.bean.Item;
import com.zdh.bean.Manager;
import com.zdh.bean.Member;
import com.zdh.bean.Order;
import java.util.List;
public interface ManagerMapper {
int deleteByPrimaryKey(Integer id);
int insert(Manager record);
int insertSelective(Manager record);
Manager selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(Manager record);
int updateByPrimaryKey(Manager record);
Manager selectByName(String username);
Integer countMember();
Integer countItemWtsOnCarriiage();
Integer countItemWtbOnCarriiage();
Integer orderedToday();
List<Member> selectAllMember();
void shutMember(String sid);
List<Item> selectAllSellItems();
void activeMember(String sid);
void offItem(String item_id);
List<Item> selectAllBuyItems();
List<Order> selectAllOrder();
Integer selectLoginToday();
Integer countItemWtsToday();
Integer countItemWtbToday();
Integer countOrderTotal();
Integer countInfoToHandle();
Integer countMemberToIdentify();
void delMember(String sid);
}
|
UTF-8
|
Java
| 1,125 |
java
|
ManagerMapper.java
|
Java
|
[] | null |
[] |
package com.zdh.mappers;
import com.zdh.bean.Item;
import com.zdh.bean.Manager;
import com.zdh.bean.Member;
import com.zdh.bean.Order;
import java.util.List;
public interface ManagerMapper {
int deleteByPrimaryKey(Integer id);
int insert(Manager record);
int insertSelective(Manager record);
Manager selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(Manager record);
int updateByPrimaryKey(Manager record);
Manager selectByName(String username);
Integer countMember();
Integer countItemWtsOnCarriiage();
Integer countItemWtbOnCarriiage();
Integer orderedToday();
List<Member> selectAllMember();
void shutMember(String sid);
List<Item> selectAllSellItems();
void activeMember(String sid);
void offItem(String item_id);
List<Item> selectAllBuyItems();
List<Order> selectAllOrder();
Integer selectLoginToday();
Integer countItemWtsToday();
Integer countItemWtbToday();
Integer countOrderTotal();
Integer countInfoToHandle();
Integer countMemberToIdentify();
void delMember(String sid);
}
| 1,125 | 0.722667 | 0.722667 | 60 | 17.766666 | 17.221466 | 52 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.516667 | false | false |
12
|
2d60ee8f2b17436518642bad0a6adb932c57349c
| 9,139,690,463,316 |
99cf8e2b9afbe976a6255d062715dfa4f4af38ee
|
/src/Main.java
|
c53d7b9ab50eb53a48c3e13d332541ff049d9444
|
[] |
no_license
|
hugoduar/Stock-Control
|
https://github.com/hugoduar/Stock-Control
|
a43ef8d626a29ea20fd274c67427a635400e5f79
|
c3b2f80c8ed166e3efeeae2a8b3ad99755546fa9
|
refs/heads/master
| 2021-03-12T20:01:57.312000 | 2012-11-27T07:05:47 | 2012-11-27T07:05:47 | 6,733,419 | 1 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
public class Main {
public static void main(String[] args) {
Interfaz ui = new Interfaz();
ui.setVisible(true);
/*Producto RockPop = new Producto();
RockPop.Genero="Rock Pop";
RockPop.Cantidad=1500;
RockPop.CostoUnitario=200.00;
RockPop.PrecioVenta=255.55;
String rock;
rock=RockPop.toString();
System.out.println(rock);*/
/*CargaProducto obj = new CargaProducto("datos.txt");
Producto nuevo = new Producto();
int opc;
int aux;
do{
System.out.println("1.- Tamaño.");
System.out.println("2.- Mostrar todo.");
System.out.println("3.- Eliminar.");
System.out.println("4.- Alta.");
System.out.println("5.- Busqueda por genero.");
System.out.println("6.- Guardar Cambios.");
System.out.println("7.- Salir.");
System.out.print("Teclee una opcion: ");
opc = Leer.datoInt();
switch (opc){
case 1:
System.out.println("El número de registros es: "+
obj.Tamaño());
break;
case 2:
for (int cont=0; cont!=obj.Tamaño();cont++){
System.out.print("Registro "+cont+" :"+obj.Consulta(cont));
}
break;
case 3:
System.out.print("\nTeclee el elemento a eliminar: ");
System.out.print(obj.Baja(Leer.datoInt())?"Baja Exitosa":
"No se logro dar de baja");
break;
case 4:
System.out.print("\nTeclee el genero del disco: ");
nuevo.setGenero(Leer.dato());
System.out.print("\nTeclee la cantidad de discos: ");
nuevo.setCantidad(Leer.datoInt());
System.out.print("\nTeclee el costo unitario: ");
nuevo.setCostoUnitario(Leer.datoDouble());
System.out.print("\nTeclee el precio de venta: ");
nuevo.setPrecioVenta(Leer.datoDouble());
System.out.println(obj.Alta(nuevo)?"Alta Exitosa":
"No se logro dar de alta");
break;
case 5:
System.out.print("\nTeclee el nombre a buscar: ");
aux = obj.BuscarGenero(Leer.dato());
System.out.println(aux==-1?"Elemento no Encontrado":obj.Consulta(aux));
break;
case 6:
System.out.println(obj.Guardar()?"Guardado Exitoso":"Error al Guardar");
default:
break;
}
System.out.print("\n");
}while(opc!=7);*/
}
}
|
UTF-8
|
Java
| 2,953 |
java
|
Main.java
|
Java
|
[] | null |
[] |
public class Main {
public static void main(String[] args) {
Interfaz ui = new Interfaz();
ui.setVisible(true);
/*Producto RockPop = new Producto();
RockPop.Genero="Rock Pop";
RockPop.Cantidad=1500;
RockPop.CostoUnitario=200.00;
RockPop.PrecioVenta=255.55;
String rock;
rock=RockPop.toString();
System.out.println(rock);*/
/*CargaProducto obj = new CargaProducto("datos.txt");
Producto nuevo = new Producto();
int opc;
int aux;
do{
System.out.println("1.- Tamaño.");
System.out.println("2.- Mostrar todo.");
System.out.println("3.- Eliminar.");
System.out.println("4.- Alta.");
System.out.println("5.- Busqueda por genero.");
System.out.println("6.- Guardar Cambios.");
System.out.println("7.- Salir.");
System.out.print("Teclee una opcion: ");
opc = Leer.datoInt();
switch (opc){
case 1:
System.out.println("El número de registros es: "+
obj.Tamaño());
break;
case 2:
for (int cont=0; cont!=obj.Tamaño();cont++){
System.out.print("Registro "+cont+" :"+obj.Consulta(cont));
}
break;
case 3:
System.out.print("\nTeclee el elemento a eliminar: ");
System.out.print(obj.Baja(Leer.datoInt())?"Baja Exitosa":
"No se logro dar de baja");
break;
case 4:
System.out.print("\nTeclee el genero del disco: ");
nuevo.setGenero(Leer.dato());
System.out.print("\nTeclee la cantidad de discos: ");
nuevo.setCantidad(Leer.datoInt());
System.out.print("\nTeclee el costo unitario: ");
nuevo.setCostoUnitario(Leer.datoDouble());
System.out.print("\nTeclee el precio de venta: ");
nuevo.setPrecioVenta(Leer.datoDouble());
System.out.println(obj.Alta(nuevo)?"Alta Exitosa":
"No se logro dar de alta");
break;
case 5:
System.out.print("\nTeclee el nombre a buscar: ");
aux = obj.BuscarGenero(Leer.dato());
System.out.println(aux==-1?"Elemento no Encontrado":obj.Consulta(aux));
break;
case 6:
System.out.println(obj.Guardar()?"Guardado Exitoso":"Error al Guardar");
default:
break;
}
System.out.print("\n");
}while(opc!=7);*/
}
}
| 2,953 | 0.460495 | 0.450322 | 73 | 39.397259 | 22.830368 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.684932 | false | false |
12
|
4c074c3dbab0cfd282024d5865f6f2b6d5bb69ae
| 32,719,060,919,364 |
352163a8f69f64bc87a9e14471c947e51bd6b27d
|
/bin/platform/ext/core/testsrc/de/hybris/platform/persistence/flexiblesearch/typecache/impl/DefaultFlexibleSearchTypeCacheProviderTest.java
|
71c722395e378300046559af34e7a5823e70ae1b
|
[] |
no_license
|
GTNDYanagisawa/merchandise
|
https://github.com/GTNDYanagisawa/merchandise
|
2ad5209480d5dc7d946a442479cfd60649137109
|
e9773338d63d4f053954d396835ac25ef71039d3
|
refs/heads/master
| 2021-01-22T20:45:31.217000 | 2015-05-20T06:23:45 | 2015-05-20T06:23:45 | 35,868,211 | 3 | 5 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* [y] hybris Platform
*
* Copyright (c) 2000-2013 hybris AG
* All rights reserved.
*
* This software is the confidential and proprietary information of hybris
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with hybris.
*
*
*/
package de.hybris.platform.persistence.flexiblesearch.typecache.impl;
import static org.fest.assertions.Assertions.assertThat;
import static org.junit.Assert.fail;
import static org.mockito.BDDMockito.given;
import de.hybris.bootstrap.annotations.UnitTest;
import de.hybris.platform.core.PK;
import de.hybris.platform.jalo.JaloItemNotFoundException;
import de.hybris.platform.jalo.c2l.C2LManager;
import de.hybris.platform.jalo.c2l.Language;
import de.hybris.platform.jalo.flexiblesearch.FlexibleSearch;
import de.hybris.platform.jalo.flexiblesearch.FlexibleSearchException;
import de.hybris.platform.jalo.type.TypeManager;
import de.hybris.platform.persistence.flexiblesearch.typecache.CachedTypeData;
import de.hybris.platform.persistence.property.PersistenceManager;
import de.hybris.platform.persistence.property.TypeInfoMap;
import java.util.Collections;
import java.util.Set;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import com.google.common.collect.Sets;
@RunWith(MockitoJUnitRunner.class)
@UnitTest
public class DefaultFlexibleSearchTypeCacheProviderTest
{
@Mock
private PersistenceManager persistenceManager;
@SuppressWarnings("deprecation")
@Mock
private FlexibleSearch flexibleSearch;
@Mock
private C2LManager c2lManager;
@Mock
private TypeInfoMap typeInfoMap;
@Mock
private TypeManager typeManager;
@Mock
private Language language;
private DefaultFlexibleSearchTypeCacheProvider fsCache;
private final PK mainPk = PK.createFixedUUIDPK(1, 2), searchPk = PK.createFixedUUIDPK(3, 4), langPk = PK.createFixedUUIDPK(5,
6);
@Before
public void setUp() throws Exception
{
fsCache = new DefaultFlexibleSearchTypeCacheProvider(persistenceManager, typeManager, c2lManager, flexibleSearch);
}
@Test
public void shouldContainsTypePkWhenExternalTypesContainsSearchPk()
{
// given
given(persistenceManager.getTypePK("fooBar")).willReturn(mainPk);
given(persistenceManager.getExternalTableTypes(mainPk)).willReturn(Sets.newHashSet(searchPk));
// when
final boolean containsTypePk = fsCache.getExternalTableTypes("fooBar").contains(searchPk);
// then
assertThat(containsTypePk).isTrue();
}
@Test
public void shouldNotContainsTypePkWhenExternalTypesReturnsEmptySet()
{
// given
given(persistenceManager.getPersistenceInfo("fooBar")).willReturn(typeInfoMap);
given(typeInfoMap.getTypePK()).willReturn(mainPk);
given(persistenceManager.getExternalTableTypes(mainPk)).willReturn(Collections.EMPTY_SET);
// when
final boolean containsTypePk = fsCache.getExternalTableTypes("fooBar").contains(searchPk);
// then
assertThat(containsTypePk).isFalse();
}
@Test
public void shouldNotContainsTypePkWhenExternalTypesReturnNull()
{
// given
given(persistenceManager.getPersistenceInfo("fooBar")).willReturn(typeInfoMap);
given(typeInfoMap.getTypePK()).willReturn(mainPk);
given(persistenceManager.getExternalTableTypes(mainPk)).willReturn(null);
// when
final Set<PK> externalTableTypes = fsCache.getExternalTableTypes("fooBar");
// then
assertThat(externalTableTypes).isNotNull();
assertThat(externalTableTypes).isEmpty();
}
@Test
public void shouldHaveSubtypesWhenExternalTypesReturnsNotEmptySet()
{
// given
given(persistenceManager.getTypePK("fooBar")).willReturn(mainPk);
given(persistenceManager.getExternalTableTypes(mainPk)).willReturn(Sets.newHashSet(searchPk));
// when
final boolean typeHasSubtypes = fsCache.hasExternalTables("fooBar");
// then
assertThat(typeHasSubtypes).isTrue();
}
@Test
public void shouldHaveSubtypesWhenExternalTypesReturnsEmptySet()
{
// given
given(persistenceManager.getTypePK("fooBar")).willReturn(mainPk);
given(persistenceManager.getExternalTableTypes(mainPk)).willReturn(Collections.EMPTY_SET);
// when
final boolean typeHasSubtypes = fsCache.hasExternalTables("fooBar");
// then
assertThat(typeHasSubtypes).isFalse();
}
@Test
public void shouldHaveSubtypesWhenExternalTypesReturnsNull()
{
// given
given(persistenceManager.getPersistenceInfo("fooBar")).willReturn(typeInfoMap);
given(typeInfoMap.getTypePK()).willReturn(mainPk);
given(persistenceManager.getExternalTableTypes(mainPk)).willReturn(null);
// when
final boolean typeHasSubtypes = fsCache.hasExternalTables("fooBar");
// then
assertThat(typeHasSubtypes).isFalse();
}
@Test
public void typeShouldBeAbstractRootTableWhenTypeIsAbstractUnlocalizedTableIsNotNullAndDoesntContainSubtypes()
{
// given
given(persistenceManager.getPersistenceInfo("fooBar")).willReturn(typeInfoMap);
given(typeInfoMap.getTypePK()).willReturn(mainPk);
given(Boolean.valueOf(typeInfoMap.isAbstract())).willReturn(Boolean.TRUE);
given(persistenceManager.getExternalTableTypes(mainPk)).willReturn(Collections.EMPTY_SET);
given(typeInfoMap.getTableName(false)).willReturn("barBaz");
// when
final boolean isAbstractRootTable = fsCache.isAbstractRootTable("fooBar");
// then
assertThat(isAbstractRootTable).isTrue();
}
@Test
public void typeShouldBeNotAbstractRootTableWhenTypeIsNotAbstract()
{
// given
given(persistenceManager.getPersistenceInfo("fooBar")).willReturn(typeInfoMap);
given(typeInfoMap.getTypePK()).willReturn(mainPk);
given(Boolean.valueOf(typeInfoMap.isAbstract())).willReturn(Boolean.FALSE);
// when
final boolean isAbstractRootTable = fsCache.isAbstractRootTable("fooBar");
// then
assertThat(isAbstractRootTable).isFalse();
}
@Test
public void typeShouldBeNotAbstractRootTableWhenUnlocalizedTableIsNull()
{
// given
given(persistenceManager.getPersistenceInfo("fooBar")).willReturn(typeInfoMap);
given(typeInfoMap.getTypePK()).willReturn(mainPk);
given(Boolean.valueOf(typeInfoMap.isAbstract())).willReturn(Boolean.TRUE);
given(typeInfoMap.getTableName(false)).willReturn(null);
// when
final boolean isAbstractRootTable = fsCache.isAbstractRootTable("fooBar");
// then
assertThat(isAbstractRootTable).isFalse();
}
@Test
public void typeShouldBeNotAbstractRootTableWhenContainsSubtypes()
{
// given
given(persistenceManager.getPersistenceInfo("fooBar")).willReturn(typeInfoMap);
given(persistenceManager.getTypePK("fooBar")).willReturn(mainPk);
given(typeInfoMap.getTypePK()).willReturn(mainPk);
given(Boolean.valueOf(typeInfoMap.isAbstract())).willReturn(Boolean.TRUE);
given(typeInfoMap.getTableName(false)).willReturn("fooBar");
given(persistenceManager.getExternalTableTypes(mainPk)).willReturn(Sets.newHashSet(searchPk));
// when
final boolean isAbstractRootTable = fsCache.isAbstractRootTable("fooBar");
// then
assertThat(isAbstractRootTable).isFalse();
}
@Test
public void typeShouldNotBeAbstractWhenTypeIsAbstractAndDoesContainSubtypes()
{
// given
given(persistenceManager.getPersistenceInfo("fooBar")).willReturn(typeInfoMap);
given(typeInfoMap.getTypePK()).willReturn(mainPk);
given(persistenceManager.getTypePK("fooBar")).willReturn(mainPk);
given(Boolean.valueOf(typeInfoMap.isAbstract())).willReturn(Boolean.FALSE);
given(persistenceManager.getExternalTableTypes(mainPk)).willReturn(Sets.newHashSet(searchPk));
// when
final boolean isAbstractRootTable = fsCache.isAbstractRootTable("fooBar");
// then
assertThat(isAbstractRootTable).isFalse();
}
@Test
public void shouldReturnFalseIfGivenTypeCodeIsNotAbstractRootTable()
{
// given
given(persistenceManager.getPersistenceInfo("fooBar")).willReturn(typeInfoMap);
given(typeInfoMap.getTypePK()).willReturn(mainPk);
given(Boolean.valueOf(typeInfoMap.isAbstract())).willReturn(Boolean.FALSE);
given(persistenceManager.getExternalTableTypes(mainPk)).willReturn(Sets.newHashSet(searchPk));
// when
final boolean isAbstractRootTable = fsCache.isAbstractRootTable("fooBar");
// then
assertThat(isAbstractRootTable).isFalse();
}
@Test
public void shouldReturnTypePersistenceDataObjectForGivenTypeCode()
{
// given
given(persistenceManager.getPersistenceInfo("fooBar")).willReturn(typeInfoMap);
// when
final CachedTypeData typePersistenceData = fsCache.getCachedTypeData("fooBar");
// then
assertThat(typePersistenceData).isNotNull();
}
@Test
public void shouldThrowFlexibleSearchExceptionWhenPersistenceManagerWillThrowIllegalStateException()
{
// given
given(persistenceManager.getPersistenceInfo("fooBar"))
.willThrow(new IllegalArgumentException("type code 'FooBar' invalid"));
try
{
// when
fsCache.getCachedTypeData("fooBar");
fail("should throw FlexibleSearchException");
}
catch (final FlexibleSearchException e)
{
// then
assertThat(e).hasMessage("type code 'FooBar' invalid");
}
}
@Test
public void shouldReturnLanguagePkFromProperIsoCode()
{
// given
given(c2lManager.getLanguageByIsoCode("en")).willReturn(language);
given(language.getPK()).willReturn(langPk);
// when
final PK foundLangPk = fsCache.getLanguagePkFromIsocode("en");
// then
assertThat(foundLangPk).isNotNull().isEqualTo(langPk);
}
@Test
public void shouldReturnLanguagePkByParsingSearchStringIfC2LManagerFailed()
{
// given
given(c2lManager.getLanguageByIsoCode("123456")).willThrow(new JaloItemNotFoundException("language not found", 0));
// when
final PK foundLangPk = fsCache.getLanguagePkFromIsocode("123456");
// then
assertThat(foundLangPk).isNotNull().isEqualTo(PK.parse("123456"));
}
}
|
UTF-8
|
Java
| 9,838 |
java
|
DefaultFlexibleSearchTypeCacheProviderTest.java
|
Java
|
[] | null |
[] |
/*
* [y] hybris Platform
*
* Copyright (c) 2000-2013 hybris AG
* All rights reserved.
*
* This software is the confidential and proprietary information of hybris
* ("Confidential Information"). You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms of the
* license agreement you entered into with hybris.
*
*
*/
package de.hybris.platform.persistence.flexiblesearch.typecache.impl;
import static org.fest.assertions.Assertions.assertThat;
import static org.junit.Assert.fail;
import static org.mockito.BDDMockito.given;
import de.hybris.bootstrap.annotations.UnitTest;
import de.hybris.platform.core.PK;
import de.hybris.platform.jalo.JaloItemNotFoundException;
import de.hybris.platform.jalo.c2l.C2LManager;
import de.hybris.platform.jalo.c2l.Language;
import de.hybris.platform.jalo.flexiblesearch.FlexibleSearch;
import de.hybris.platform.jalo.flexiblesearch.FlexibleSearchException;
import de.hybris.platform.jalo.type.TypeManager;
import de.hybris.platform.persistence.flexiblesearch.typecache.CachedTypeData;
import de.hybris.platform.persistence.property.PersistenceManager;
import de.hybris.platform.persistence.property.TypeInfoMap;
import java.util.Collections;
import java.util.Set;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.runners.MockitoJUnitRunner;
import com.google.common.collect.Sets;
@RunWith(MockitoJUnitRunner.class)
@UnitTest
public class DefaultFlexibleSearchTypeCacheProviderTest
{
@Mock
private PersistenceManager persistenceManager;
@SuppressWarnings("deprecation")
@Mock
private FlexibleSearch flexibleSearch;
@Mock
private C2LManager c2lManager;
@Mock
private TypeInfoMap typeInfoMap;
@Mock
private TypeManager typeManager;
@Mock
private Language language;
private DefaultFlexibleSearchTypeCacheProvider fsCache;
private final PK mainPk = PK.createFixedUUIDPK(1, 2), searchPk = PK.createFixedUUIDPK(3, 4), langPk = PK.createFixedUUIDPK(5,
6);
@Before
public void setUp() throws Exception
{
fsCache = new DefaultFlexibleSearchTypeCacheProvider(persistenceManager, typeManager, c2lManager, flexibleSearch);
}
@Test
public void shouldContainsTypePkWhenExternalTypesContainsSearchPk()
{
// given
given(persistenceManager.getTypePK("fooBar")).willReturn(mainPk);
given(persistenceManager.getExternalTableTypes(mainPk)).willReturn(Sets.newHashSet(searchPk));
// when
final boolean containsTypePk = fsCache.getExternalTableTypes("fooBar").contains(searchPk);
// then
assertThat(containsTypePk).isTrue();
}
@Test
public void shouldNotContainsTypePkWhenExternalTypesReturnsEmptySet()
{
// given
given(persistenceManager.getPersistenceInfo("fooBar")).willReturn(typeInfoMap);
given(typeInfoMap.getTypePK()).willReturn(mainPk);
given(persistenceManager.getExternalTableTypes(mainPk)).willReturn(Collections.EMPTY_SET);
// when
final boolean containsTypePk = fsCache.getExternalTableTypes("fooBar").contains(searchPk);
// then
assertThat(containsTypePk).isFalse();
}
@Test
public void shouldNotContainsTypePkWhenExternalTypesReturnNull()
{
// given
given(persistenceManager.getPersistenceInfo("fooBar")).willReturn(typeInfoMap);
given(typeInfoMap.getTypePK()).willReturn(mainPk);
given(persistenceManager.getExternalTableTypes(mainPk)).willReturn(null);
// when
final Set<PK> externalTableTypes = fsCache.getExternalTableTypes("fooBar");
// then
assertThat(externalTableTypes).isNotNull();
assertThat(externalTableTypes).isEmpty();
}
@Test
public void shouldHaveSubtypesWhenExternalTypesReturnsNotEmptySet()
{
// given
given(persistenceManager.getTypePK("fooBar")).willReturn(mainPk);
given(persistenceManager.getExternalTableTypes(mainPk)).willReturn(Sets.newHashSet(searchPk));
// when
final boolean typeHasSubtypes = fsCache.hasExternalTables("fooBar");
// then
assertThat(typeHasSubtypes).isTrue();
}
@Test
public void shouldHaveSubtypesWhenExternalTypesReturnsEmptySet()
{
// given
given(persistenceManager.getTypePK("fooBar")).willReturn(mainPk);
given(persistenceManager.getExternalTableTypes(mainPk)).willReturn(Collections.EMPTY_SET);
// when
final boolean typeHasSubtypes = fsCache.hasExternalTables("fooBar");
// then
assertThat(typeHasSubtypes).isFalse();
}
@Test
public void shouldHaveSubtypesWhenExternalTypesReturnsNull()
{
// given
given(persistenceManager.getPersistenceInfo("fooBar")).willReturn(typeInfoMap);
given(typeInfoMap.getTypePK()).willReturn(mainPk);
given(persistenceManager.getExternalTableTypes(mainPk)).willReturn(null);
// when
final boolean typeHasSubtypes = fsCache.hasExternalTables("fooBar");
// then
assertThat(typeHasSubtypes).isFalse();
}
@Test
public void typeShouldBeAbstractRootTableWhenTypeIsAbstractUnlocalizedTableIsNotNullAndDoesntContainSubtypes()
{
// given
given(persistenceManager.getPersistenceInfo("fooBar")).willReturn(typeInfoMap);
given(typeInfoMap.getTypePK()).willReturn(mainPk);
given(Boolean.valueOf(typeInfoMap.isAbstract())).willReturn(Boolean.TRUE);
given(persistenceManager.getExternalTableTypes(mainPk)).willReturn(Collections.EMPTY_SET);
given(typeInfoMap.getTableName(false)).willReturn("barBaz");
// when
final boolean isAbstractRootTable = fsCache.isAbstractRootTable("fooBar");
// then
assertThat(isAbstractRootTable).isTrue();
}
@Test
public void typeShouldBeNotAbstractRootTableWhenTypeIsNotAbstract()
{
// given
given(persistenceManager.getPersistenceInfo("fooBar")).willReturn(typeInfoMap);
given(typeInfoMap.getTypePK()).willReturn(mainPk);
given(Boolean.valueOf(typeInfoMap.isAbstract())).willReturn(Boolean.FALSE);
// when
final boolean isAbstractRootTable = fsCache.isAbstractRootTable("fooBar");
// then
assertThat(isAbstractRootTable).isFalse();
}
@Test
public void typeShouldBeNotAbstractRootTableWhenUnlocalizedTableIsNull()
{
// given
given(persistenceManager.getPersistenceInfo("fooBar")).willReturn(typeInfoMap);
given(typeInfoMap.getTypePK()).willReturn(mainPk);
given(Boolean.valueOf(typeInfoMap.isAbstract())).willReturn(Boolean.TRUE);
given(typeInfoMap.getTableName(false)).willReturn(null);
// when
final boolean isAbstractRootTable = fsCache.isAbstractRootTable("fooBar");
// then
assertThat(isAbstractRootTable).isFalse();
}
@Test
public void typeShouldBeNotAbstractRootTableWhenContainsSubtypes()
{
// given
given(persistenceManager.getPersistenceInfo("fooBar")).willReturn(typeInfoMap);
given(persistenceManager.getTypePK("fooBar")).willReturn(mainPk);
given(typeInfoMap.getTypePK()).willReturn(mainPk);
given(Boolean.valueOf(typeInfoMap.isAbstract())).willReturn(Boolean.TRUE);
given(typeInfoMap.getTableName(false)).willReturn("fooBar");
given(persistenceManager.getExternalTableTypes(mainPk)).willReturn(Sets.newHashSet(searchPk));
// when
final boolean isAbstractRootTable = fsCache.isAbstractRootTable("fooBar");
// then
assertThat(isAbstractRootTable).isFalse();
}
@Test
public void typeShouldNotBeAbstractWhenTypeIsAbstractAndDoesContainSubtypes()
{
// given
given(persistenceManager.getPersistenceInfo("fooBar")).willReturn(typeInfoMap);
given(typeInfoMap.getTypePK()).willReturn(mainPk);
given(persistenceManager.getTypePK("fooBar")).willReturn(mainPk);
given(Boolean.valueOf(typeInfoMap.isAbstract())).willReturn(Boolean.FALSE);
given(persistenceManager.getExternalTableTypes(mainPk)).willReturn(Sets.newHashSet(searchPk));
// when
final boolean isAbstractRootTable = fsCache.isAbstractRootTable("fooBar");
// then
assertThat(isAbstractRootTable).isFalse();
}
@Test
public void shouldReturnFalseIfGivenTypeCodeIsNotAbstractRootTable()
{
// given
given(persistenceManager.getPersistenceInfo("fooBar")).willReturn(typeInfoMap);
given(typeInfoMap.getTypePK()).willReturn(mainPk);
given(Boolean.valueOf(typeInfoMap.isAbstract())).willReturn(Boolean.FALSE);
given(persistenceManager.getExternalTableTypes(mainPk)).willReturn(Sets.newHashSet(searchPk));
// when
final boolean isAbstractRootTable = fsCache.isAbstractRootTable("fooBar");
// then
assertThat(isAbstractRootTable).isFalse();
}
@Test
public void shouldReturnTypePersistenceDataObjectForGivenTypeCode()
{
// given
given(persistenceManager.getPersistenceInfo("fooBar")).willReturn(typeInfoMap);
// when
final CachedTypeData typePersistenceData = fsCache.getCachedTypeData("fooBar");
// then
assertThat(typePersistenceData).isNotNull();
}
@Test
public void shouldThrowFlexibleSearchExceptionWhenPersistenceManagerWillThrowIllegalStateException()
{
// given
given(persistenceManager.getPersistenceInfo("fooBar"))
.willThrow(new IllegalArgumentException("type code 'FooBar' invalid"));
try
{
// when
fsCache.getCachedTypeData("fooBar");
fail("should throw FlexibleSearchException");
}
catch (final FlexibleSearchException e)
{
// then
assertThat(e).hasMessage("type code 'FooBar' invalid");
}
}
@Test
public void shouldReturnLanguagePkFromProperIsoCode()
{
// given
given(c2lManager.getLanguageByIsoCode("en")).willReturn(language);
given(language.getPK()).willReturn(langPk);
// when
final PK foundLangPk = fsCache.getLanguagePkFromIsocode("en");
// then
assertThat(foundLangPk).isNotNull().isEqualTo(langPk);
}
@Test
public void shouldReturnLanguagePkByParsingSearchStringIfC2LManagerFailed()
{
// given
given(c2lManager.getLanguageByIsoCode("123456")).willThrow(new JaloItemNotFoundException("language not found", 0));
// when
final PK foundLangPk = fsCache.getLanguagePkFromIsocode("123456");
// then
assertThat(foundLangPk).isNotNull().isEqualTo(PK.parse("123456"));
}
}
| 9,838 | 0.784102 | 0.779833 | 323 | 29.417957 | 32.191597 | 126 | false | false | 0 | 0 | 0 | 0 | 96 | 0.0185 | 1.513932 | false | false |
12
|
e18ea8e995ab9d6ea4eabf43130f1c68ddd9cc33
| 32,719,060,922,111 |
30ff2b27b71902f98fb8b580d24a98cd3c827385
|
/src/test/java/com/brightywe/brightylist/user/controller/UserControllerIntegrationTest.java
|
eb476990e02ca79f1298e994f189c6f45a8b55e1
|
[] |
no_license
|
jakub3704/Brighty-List-BE
|
https://github.com/jakub3704/Brighty-List-BE
|
6efe35b0ec98fca0f90433df1f3767eb481e96db
|
a8dc27c1963a71a254a76aff2f15f1200d9339fa
|
refs/heads/master
| 2023-01-20T10:58:23.944000 | 2020-11-15T15:48:40 | 2020-11-15T15:48:40 | 268,542,750 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.brightywe.brightylist.user.controller;
import static org.hamcrest.Matchers.is;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import java.util.UUID;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.ResultActions;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import com.brightywe.brightylist.security.AuthenticationDetailsContext;
import com.brightywe.brightylist.security.MockAccessTokenService;
import com.brightywe.brightylist.user.model.Role;
import com.brightywe.brightylist.user.model.domain.User;
import com.brightywe.brightylist.user.model.dto.PasswordChange;
import com.brightywe.brightylist.user.repository.UserRepository;
import com.fasterxml.jackson.databind.ObjectMapper;
@AutoConfigureMockMvc
@ActiveProfiles("test")
@WebAppConfiguration
@SpringBootTest
public class UserControllerIntegrationTest {
private User userDb;
@Value("#{new Boolean('${value.features.user_updates.disabled}')}")
private Boolean userOperationsDisabled;
@Autowired
private MockMvc mvc;
@Autowired
private UserRepository userRepository;
@Autowired
AuthenticationDetailsContext authenticationDetailsContext;
@Autowired
private PasswordEncoder passwordEncoder;
@Autowired
private ObjectMapper mapper;
@AfterEach
public void tearDown() {
if (userDb!=null) {
this.userDb = userRepository.findById(userDb.getId()).orElse(null);
userRepository.delete(userDb);
}
this.userDb=null;
}
@Test
public void getUserDetailsTest() throws Exception {
String randomUUID = UUID.randomUUID().toString();
User user = new User();
user.setName(randomUUID.substring(0, Math.min(randomUUID.length(), 20)));
user.setEmail(randomUUID.substring(0, Math.min(randomUUID.length(), 5)) + "@user.com");
String userPassword = randomUUID.substring(0, Math.min(randomUUID.length(), 5));
user.setPassword(passwordEncoder.encode(userPassword));
user.setRole(Role.ROLE_USER);
this.userDb = userRepository.save(user);
MockAccessTokenService mockAccessTokenService = new MockAccessTokenService();
String accessToken = mockAccessTokenService.obtainAccessToken(user.getName(), userPassword, mvc);
ResultActions result = mvc
.perform(MockMvcRequestBuilders.get("/users/details").header("Authorization", "Bearer " + accessToken));
result.andExpect(status().isOk());
result.andExpect(jsonPath("$.name", is(user.getName()))).andExpect(jsonPath("$.email", is(user.getEmail())));
}
@Test
public void updateUserPasswordTest() throws Exception {
String randomUUID = UUID.randomUUID().toString();
User user = new User();
user.setName(randomUUID.substring(0, Math.min(randomUUID.length(), 20)));
user.setEmail(randomUUID.substring(0, Math.min(randomUUID.length(), 5)) + "@user.com");
String userPassword = randomUUID.substring(0, Math.min(randomUUID.length(), 5));
user.setPassword(passwordEncoder.encode(userPassword));
user.setRole(Role.ROLE_USER);
this.userDb = userRepository.save(user);
PasswordChange newPassword = new PasswordChange();
newPassword.setPasswordNew("NewPassword");
newPassword.setPasswordOld(userPassword);
;
MockAccessTokenService mockAccessTokenService = new MockAccessTokenService();
String accessToken = mockAccessTokenService.obtainAccessToken(user.getName(), userPassword, mvc);
ResultActions result = mvc
.perform(MockMvcRequestBuilders.put("/users/password").header("Authorization", "Bearer " + accessToken)
.header("Content-Type", "application/json;charset=UTF-8")
.contentType(MediaType.APPLICATION_JSON).content(mapper.writeValueAsString(newPassword)));
if (userOperationsDisabled) {
result.andExpect(status().isForbidden());
} else {
result.andExpect(status().isOk());
result.andExpect(jsonPath("$.name", is(user.getName()))).andExpect(jsonPath("$.email", is(user.getEmail())));
User userDatabase = userRepository.findByName(user.getName()).orElse(null);
assertEquals(true, passwordEncoder.matches(newPassword.getPasswordNew(), userDatabase.getPassword()));
}
}
}
|
UTF-8
|
Java
| 5,257 |
java
|
UserControllerIntegrationTest.java
|
Java
|
[
{
"context": "wordChange();\n newPassword.setPasswordNew(\"NewPassword\");\n newPassword.setPasswordOld(userPasswor",
"end": 4135,
"score": 0.996492862701416,
"start": 4124,
"tag": "PASSWORD",
"value": "NewPassword"
}
] | null |
[] |
package com.brightywe.brightylist.user.controller;
import static org.hamcrest.Matchers.is;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
import java.util.UUID;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.MediaType;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.ResultActions;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import com.brightywe.brightylist.security.AuthenticationDetailsContext;
import com.brightywe.brightylist.security.MockAccessTokenService;
import com.brightywe.brightylist.user.model.Role;
import com.brightywe.brightylist.user.model.domain.User;
import com.brightywe.brightylist.user.model.dto.PasswordChange;
import com.brightywe.brightylist.user.repository.UserRepository;
import com.fasterxml.jackson.databind.ObjectMapper;
@AutoConfigureMockMvc
@ActiveProfiles("test")
@WebAppConfiguration
@SpringBootTest
public class UserControllerIntegrationTest {
private User userDb;
@Value("#{new Boolean('${value.features.user_updates.disabled}')}")
private Boolean userOperationsDisabled;
@Autowired
private MockMvc mvc;
@Autowired
private UserRepository userRepository;
@Autowired
AuthenticationDetailsContext authenticationDetailsContext;
@Autowired
private PasswordEncoder passwordEncoder;
@Autowired
private ObjectMapper mapper;
@AfterEach
public void tearDown() {
if (userDb!=null) {
this.userDb = userRepository.findById(userDb.getId()).orElse(null);
userRepository.delete(userDb);
}
this.userDb=null;
}
@Test
public void getUserDetailsTest() throws Exception {
String randomUUID = UUID.randomUUID().toString();
User user = new User();
user.setName(randomUUID.substring(0, Math.min(randomUUID.length(), 20)));
user.setEmail(randomUUID.substring(0, Math.min(randomUUID.length(), 5)) + "@user.com");
String userPassword = randomUUID.substring(0, Math.min(randomUUID.length(), 5));
user.setPassword(passwordEncoder.encode(userPassword));
user.setRole(Role.ROLE_USER);
this.userDb = userRepository.save(user);
MockAccessTokenService mockAccessTokenService = new MockAccessTokenService();
String accessToken = mockAccessTokenService.obtainAccessToken(user.getName(), userPassword, mvc);
ResultActions result = mvc
.perform(MockMvcRequestBuilders.get("/users/details").header("Authorization", "Bearer " + accessToken));
result.andExpect(status().isOk());
result.andExpect(jsonPath("$.name", is(user.getName()))).andExpect(jsonPath("$.email", is(user.getEmail())));
}
@Test
public void updateUserPasswordTest() throws Exception {
String randomUUID = UUID.randomUUID().toString();
User user = new User();
user.setName(randomUUID.substring(0, Math.min(randomUUID.length(), 20)));
user.setEmail(randomUUID.substring(0, Math.min(randomUUID.length(), 5)) + "@user.com");
String userPassword = randomUUID.substring(0, Math.min(randomUUID.length(), 5));
user.setPassword(passwordEncoder.encode(userPassword));
user.setRole(Role.ROLE_USER);
this.userDb = userRepository.save(user);
PasswordChange newPassword = new PasswordChange();
newPassword.setPasswordNew("<PASSWORD>");
newPassword.setPasswordOld(userPassword);
;
MockAccessTokenService mockAccessTokenService = new MockAccessTokenService();
String accessToken = mockAccessTokenService.obtainAccessToken(user.getName(), userPassword, mvc);
ResultActions result = mvc
.perform(MockMvcRequestBuilders.put("/users/password").header("Authorization", "Bearer " + accessToken)
.header("Content-Type", "application/json;charset=UTF-8")
.contentType(MediaType.APPLICATION_JSON).content(mapper.writeValueAsString(newPassword)));
if (userOperationsDisabled) {
result.andExpect(status().isForbidden());
} else {
result.andExpect(status().isOk());
result.andExpect(jsonPath("$.name", is(user.getName()))).andExpect(jsonPath("$.email", is(user.getEmail())));
User userDatabase = userRepository.findByName(user.getName()).orElse(null);
assertEquals(true, passwordEncoder.matches(newPassword.getPasswordNew(), userDatabase.getPassword()));
}
}
}
| 5,256 | 0.72608 | 0.723226 | 130 | 39.438461 | 34.413548 | 121 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.730769 | false | false |
12
|
d84a0f6d5a18f55f523dbe64a67599320eb79ef8
| 9,586,367,050,467 |
669b0728750890ef102bec56958096ea2d44f83f
|
/52/com.fimi.soul_source_from_JADX/p000a/C0002j.java
|
b982db5e4d84ffcda6db2cebd0211cc856bd7be0
|
[] |
no_license
|
babaloveyou/cuid
|
https://github.com/babaloveyou/cuid
|
474ace2a770e11a8e83f5fae3e1c24729f8c3c9f
|
a897c9a16465452e833f218c60ee0c866e20fb78
|
refs/heads/master
| 2023-03-16T01:57:18.941000 | 2016-11-14T15:55:36 | 2016-11-14T15:55:36 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package p000a;
import android.net.Uri;
/* renamed from: a.j */
public interface C0002j {
C0018s<C0006e> m12a(Uri uri);
}
|
UTF-8
|
Java
| 127 |
java
|
C0002j.java
|
Java
|
[] | null |
[] |
package p000a;
import android.net.Uri;
/* renamed from: a.j */
public interface C0002j {
C0018s<C0006e> m12a(Uri uri);
}
| 127 | 0.685039 | 0.551181 | 8 | 14.875 | 12.241707 | 33 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.375 | false | false |
12
|
8a1a579f0ba7c93172ccdd1daa40f93b8ab4725f
| 27,556,510,214,341 |
0d2bf6334bcd085106186840f6c59a4b34a97459
|
/sofa-boot-core/src/main/java/org/luvx/service/UserService.java
|
c19f10e0e6326900ca9f244250776e409beeb127
|
[
"MIT"
] |
permissive
|
shimaomao/luvx_trial
|
https://github.com/shimaomao/luvx_trial
|
d5f4be73937169b7b48481afbed11f5cd144440d
|
6b14bec62a2d2bfa594f97ca35645784901be3b3
|
refs/heads/master
| 2020-08-23T22:10:25.322000 | 2019-08-27T09:35:49 | 2019-08-27T09:35:49 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.luvx.service;
import javax.ws.rs.*;
@Path("/user")
@Consumes("application/json;charset=UTF-8")
@Produces("application/json;charset=UTF-8")
public interface UserService {
@GET
@Path("/getUser/{id}")
String getUser(@PathParam("id") String id);
}
|
UTF-8
|
Java
| 270 |
java
|
UserService.java
|
Java
|
[] | null |
[] |
package org.luvx.service;
import javax.ws.rs.*;
@Path("/user")
@Consumes("application/json;charset=UTF-8")
@Produces("application/json;charset=UTF-8")
public interface UserService {
@GET
@Path("/getUser/{id}")
String getUser(@PathParam("id") String id);
}
| 270 | 0.688889 | 0.681481 | 12 | 21.5 | 16.489897 | 47 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.416667 | false | false |
12
|
b2a8b69e46371d1fd2bc866c30476e4a60586929
| 1,700,807,108,829 |
9c333ade80170a878d1c6b41f127e675b5216fbb
|
/rest/src/main/java/DAO/CategoriaDAO.java
|
47164e01941cd49146721afa5af80395b2b0923f
|
[] |
no_license
|
rbaselio/aula-java-rest
|
https://github.com/rbaselio/aula-java-rest
|
5ec57b3ecd54d6b921399e2fe8918d9a31f002cb
|
e681188105ccc9286573f6202dc2624f08ac1aad
|
refs/heads/master
| 2016-08-09T11:33:46.198000 | 2016-01-16T10:59:03 | 2016-01-16T10:59:03 | 47,884,759 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package DAO;
import model.Categoria;
public class CategoriaDAO extends BaseDAO<Categoria> {
public CategoriaDAO() {
this.entityClass = Categoria.class;
}
}
|
UTF-8
|
Java
| 165 |
java
|
CategoriaDAO.java
|
Java
|
[] | null |
[] |
package DAO;
import model.Categoria;
public class CategoriaDAO extends BaseDAO<Categoria> {
public CategoriaDAO() {
this.entityClass = Categoria.class;
}
}
| 165 | 0.745455 | 0.745455 | 12 | 12.833333 | 17.232882 | 54 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false |
12
|
2747ffbcc4e36d114a07e6b7d086d057fde9f3ee
| 12,704,513,316,426 |
78dc03fc7281d9e86632203fca57de99e4fbcd54
|
/SWF-1566/src/main/java/foo/bar/CustomMvcViewFactoryCreator.java
|
3bcff3ee6ce01ec1f36ecadd89dac672e2922340
|
[] |
no_license
|
spring-projects/spring-webflow-issues
|
https://github.com/spring-projects/spring-webflow-issues
|
caf3f5b8f1d1fec3dddd77844231e94d4093069e
|
cca49f429b0e113d28ea2de06cd338017f0d94eb
|
refs/heads/main
| 2023-08-06T10:12:01.845000 | 2022-03-31T21:18:37 | 2022-03-31T21:18:37 | 2,990,596 | 3 | 13 | null | false | 2022-03-31T21:18:22 | 2011-12-15T21:10:25 | 2022-03-31T21:17:38 | 2022-03-31T21:18:21 | 396 | 10 | 22 | 44 |
Java
| false | false |
package foo.bar;
import org.springframework.binding.convert.ConversionService;
import org.springframework.binding.expression.Expression;
import org.springframework.binding.expression.ExpressionParser;
import org.springframework.binding.expression.beanwrapper.BeanWrapperExpressionParser;
import org.springframework.validation.Validator;
import org.springframework.webflow.engine.builder.BinderConfiguration;
import org.springframework.webflow.execution.ViewFactory;
import org.springframework.webflow.mvc.builder.MvcViewFactoryCreator;
import org.springframework.webflow.validation.ValidationHintResolver;
public class CustomMvcViewFactoryCreator extends MvcViewFactoryCreator {
@Override
public ViewFactory createViewFactory(Expression viewId,
ExpressionParser expressionParser,
ConversionService conversionService,
BinderConfiguration binderConfiguration, Validator validator,
ValidationHintResolver validationHintResolver) {
BeanWrapperExpressionParser bwExpressionParser = new BeanWrapperExpressionParser(conversionService);
bwExpressionParser.setAutoGrowNestedPaths(true);
bwExpressionParser.setAutoGrowCollectionLimit(1000);
return super.createViewFactory(viewId, bwExpressionParser, conversionService,
binderConfiguration, validator, validationHintResolver);
}
}
|
UTF-8
|
Java
| 1,307 |
java
|
CustomMvcViewFactoryCreator.java
|
Java
|
[] | null |
[] |
package foo.bar;
import org.springframework.binding.convert.ConversionService;
import org.springframework.binding.expression.Expression;
import org.springframework.binding.expression.ExpressionParser;
import org.springframework.binding.expression.beanwrapper.BeanWrapperExpressionParser;
import org.springframework.validation.Validator;
import org.springframework.webflow.engine.builder.BinderConfiguration;
import org.springframework.webflow.execution.ViewFactory;
import org.springframework.webflow.mvc.builder.MvcViewFactoryCreator;
import org.springframework.webflow.validation.ValidationHintResolver;
public class CustomMvcViewFactoryCreator extends MvcViewFactoryCreator {
@Override
public ViewFactory createViewFactory(Expression viewId,
ExpressionParser expressionParser,
ConversionService conversionService,
BinderConfiguration binderConfiguration, Validator validator,
ValidationHintResolver validationHintResolver) {
BeanWrapperExpressionParser bwExpressionParser = new BeanWrapperExpressionParser(conversionService);
bwExpressionParser.setAutoGrowNestedPaths(true);
bwExpressionParser.setAutoGrowCollectionLimit(1000);
return super.createViewFactory(viewId, bwExpressionParser, conversionService,
binderConfiguration, validator, validationHintResolver);
}
}
| 1,307 | 0.864575 | 0.861515 | 34 | 37.441177 | 31.889692 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.5 | false | false |
12
|
ab64eab27de380ac8230855d8e1260ba1b946a65
| 12,704,513,318,955 |
2913e74be284c5b9c49fa0ad483915afcbcbe9d7
|
/src/main/java/io/hops/metadata/yarn/entity/FiCaSchedulerNodeInfos.java
|
46d33d621e1069447aae5099d1d5d8aa00f47b7b
|
[
"Apache-2.0"
] |
permissive
|
akyekth/hops-metadata-dal
|
https://github.com/akyekth/hops-metadata-dal
|
d566be7f27b967fb1e77ef48ce0e5b15f322275e
|
cc5a6307d16203fdd8cf402cce843d6a374d633f
|
refs/heads/master
| 2021-01-11T19:09:47.388000 | 2016-11-02T15:04:43 | 2016-11-02T15:04:43 | null | 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 io.hops.metadata.yarn.entity;
import java.util.ArrayList;
import java.util.List;
public class FiCaSchedulerNodeInfos {
FiCaSchedulerNode fiCaSchedulerNode;
Resource totalResource;
Resource availableResource;
Resource usedResource;
List<LaunchedContainers> launchedContainers
= new ArrayList<LaunchedContainers>();
public FiCaSchedulerNode getFiCaSchedulerNode() {
return fiCaSchedulerNode;
}
public void setFiCaSchedulerNode(FiCaSchedulerNode fiCaSchedulerNode) {
this.fiCaSchedulerNode = fiCaSchedulerNode;
}
public Resource getTotalResource() {
return totalResource;
}
public void setTotalResource(Resource totalResource) {
this.totalResource = totalResource;
}
public Resource getAvailableResource() {
return availableResource;
}
public void setAvailableResource(Resource availableResource) {
this.availableResource = availableResource;
}
public Resource getUsedResource() {
return usedResource;
}
public void setUsedResource(Resource usedResource) {
this.usedResource = usedResource;
}
public void addLaunchedContainer(LaunchedContainers container){
launchedContainers.add(container);
}
public List<LaunchedContainers> getLaunchedContainers() {
return launchedContainers;
}
}
|
UTF-8
|
Java
| 1,494 |
java
|
FiCaSchedulerNodeInfos.java
|
Java
|
[] | 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 io.hops.metadata.yarn.entity;
import java.util.ArrayList;
import java.util.List;
public class FiCaSchedulerNodeInfos {
FiCaSchedulerNode fiCaSchedulerNode;
Resource totalResource;
Resource availableResource;
Resource usedResource;
List<LaunchedContainers> launchedContainers
= new ArrayList<LaunchedContainers>();
public FiCaSchedulerNode getFiCaSchedulerNode() {
return fiCaSchedulerNode;
}
public void setFiCaSchedulerNode(FiCaSchedulerNode fiCaSchedulerNode) {
this.fiCaSchedulerNode = fiCaSchedulerNode;
}
public Resource getTotalResource() {
return totalResource;
}
public void setTotalResource(Resource totalResource) {
this.totalResource = totalResource;
}
public Resource getAvailableResource() {
return availableResource;
}
public void setAvailableResource(Resource availableResource) {
this.availableResource = availableResource;
}
public Resource getUsedResource() {
return usedResource;
}
public void setUsedResource(Resource usedResource) {
this.usedResource = usedResource;
}
public void addLaunchedContainer(LaunchedContainers container){
launchedContainers.add(container);
}
public List<LaunchedContainers> getLaunchedContainers() {
return launchedContainers;
}
}
| 1,494 | 0.760375 | 0.760375 | 61 | 23.491804 | 22.948711 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.344262 | false | false |
12
|
f146150f2675b85007b6eade89d9e271c2d74d98
| 26,912,265,098,020 |
89f64e3aa6f4d3a51e7d9fe7af08798d2eb0ca36
|
/task1/src/main/java/config/byxml/beans/C.java
|
a3ed94102ea09fbb99d03b1ac67064087c48c27b
|
[] |
no_license
|
nikita123412/hey
|
https://github.com/nikita123412/hey
|
c9bfcd9fea8bf80f385031f1d63378f246e17e3d
|
726ae1f1b6665b4b014b9173f400964743c1ae0f
|
refs/heads/master
| 2022-12-24T09:54:51.090000 | 2019-08-23T11:11:28 | 2019-08-23T11:11:28 | 203,982,737 | 0 | 0 | null | false | 2022-12-16T00:39:59 | 2019-08-23T11:06:41 | 2019-08-23T11:11:35 | 2022-12-16T00:39:57 | 58 | 0 | 0 | 3 |
Java
| false | false |
package config.byxml.beans;
import org.springframework.beans.factory.annotation.Autowired;
public class C {
private String cName;
@Autowired
public C(String cName) {
this.cName = cName;
}
public String getCName() {
return cName;
}
public void setCName(String cName) {
this.cName = cName;
}
}
|
UTF-8
|
Java
| 353 |
java
|
C.java
|
Java
|
[] | null |
[] |
package config.byxml.beans;
import org.springframework.beans.factory.annotation.Autowired;
public class C {
private String cName;
@Autowired
public C(String cName) {
this.cName = cName;
}
public String getCName() {
return cName;
}
public void setCName(String cName) {
this.cName = cName;
}
}
| 353 | 0.631728 | 0.631728 | 20 | 16.65 | 16.377653 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.3 | false | false |
12
|
0f538875db7e9605f9cc9a2bc8723f42a0b604c0
| 25,821,343,445,021 |
8e54fa82d6286e430794e42390956be9a2e773c1
|
/src/main/java/com/shiyamtj/helpers/GenericHelper.java
|
b03d8d74f2b303d0d2855cbc4841594ef7d80920
|
[] |
no_license
|
shiyamtj/BDDFrameworkMJ
|
https://github.com/shiyamtj/BDDFrameworkMJ
|
517c03c089c170b36afbb2b366d4668986dcdc27
|
133eca53706bcca552097b01ae584f07288d3543
|
refs/heads/master
| 2020-03-20T04:28:11.546000 | 2018-06-13T08:34:07 | 2018-06-13T08:34:07 | 137,184,227 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.shiyamtj.helpers;
import org.apache.commons.io.FileUtils;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import java.io.File;
import java.io.IOException;
public class GenericHelper {
private static GenericHelper genericHelper;
private static WebDriver _driver;
private GenericHelper(WebDriver driver){
_driver = driver;
}
public static GenericHelper getInstance(WebDriver driver){
if(genericHelper == null ||(_driver.hashCode() != driver.hashCode())){
genericHelper = new GenericHelper(driver);
}
return genericHelper;
}
public void TakeScreenshot(String sdir, String sfilename){
File directory = new File(sdir);
if(!directory.exists()){
directory.mkdir();
}
File screenshot = ((TakesScreenshot)_driver).getScreenshotAs(OutputType.FILE);
try {
FileUtils.copyFile(screenshot, new File(directory.getAbsolutePath() + File.separator + sfilename));
} catch (IOException e) {
e.printStackTrace();
}
}
public byte[] TakeScreenshot(){
byte[] screenshot = ((TakesScreenshot)_driver).getScreenshotAs(OutputType.BYTES);
return screenshot;
}
}
|
UTF-8
|
Java
| 1,319 |
java
|
GenericHelper.java
|
Java
|
[] | null |
[] |
package com.shiyamtj.helpers;
import org.apache.commons.io.FileUtils;
import org.openqa.selenium.OutputType;
import org.openqa.selenium.TakesScreenshot;
import org.openqa.selenium.WebDriver;
import java.io.File;
import java.io.IOException;
public class GenericHelper {
private static GenericHelper genericHelper;
private static WebDriver _driver;
private GenericHelper(WebDriver driver){
_driver = driver;
}
public static GenericHelper getInstance(WebDriver driver){
if(genericHelper == null ||(_driver.hashCode() != driver.hashCode())){
genericHelper = new GenericHelper(driver);
}
return genericHelper;
}
public void TakeScreenshot(String sdir, String sfilename){
File directory = new File(sdir);
if(!directory.exists()){
directory.mkdir();
}
File screenshot = ((TakesScreenshot)_driver).getScreenshotAs(OutputType.FILE);
try {
FileUtils.copyFile(screenshot, new File(directory.getAbsolutePath() + File.separator + sfilename));
} catch (IOException e) {
e.printStackTrace();
}
}
public byte[] TakeScreenshot(){
byte[] screenshot = ((TakesScreenshot)_driver).getScreenshotAs(OutputType.BYTES);
return screenshot;
}
}
| 1,319 | 0.666414 | 0.666414 | 45 | 28.311111 | 26.760521 | 111 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.511111 | false | false |
12
|
002d14dcc61c19b76d64fcee2352c0dcb93878b8
| 12,558,484,411,608 |
0e82cbf541977412d232f63cc286fb09b79705fc
|
/Web-DB/src/com/niranjan/spring/web/Dao/jobsadda.java
|
31f8d62420a7d775301f51c882436a0676066687
|
[] |
no_license
|
niranjan-kmit/SpringFramework
|
https://github.com/niranjan-kmit/SpringFramework
|
a57f68c8c2ce87cc4d07172f2a91f970804324c0
|
b34a75116e381e334e0f7e8d022e9ffab55e8152
|
refs/heads/master
| 2021-01-10T05:43:27.983000 | 2015-06-04T19:15:30 | 2015-06-04T19:15:30 | 36,850,573 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.niranjan.spring.web.Dao;
public class jobsadda {
private int id;
private String company;
private String postdate;
private String lastdate;
private String place;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getCompany() {
return company;
}
public void setCompany(String company) {
this.company = company;
}
public String getPostdate() {
return postdate;
}
public void setPostdate(String postdate) {
this.postdate = postdate;
}
public String getLastdate() {
return lastdate;
}
public void setLastdate(String lastdate) {
this.lastdate = lastdate;
}
public String getPlace() {
return place;
}
public void setPlace(String place) {
this.place = place;
}
@Override
public String toString() {
return "jobsadda [id=" + id + ", company=" + company + ", postdate="
+ postdate + ", lastdate=" + lastdate + ", place=" + place
+ "]";
}
}
|
UTF-8
|
Java
| 954 |
java
|
jobsadda.java
|
Java
|
[] | null |
[] |
package com.niranjan.spring.web.Dao;
public class jobsadda {
private int id;
private String company;
private String postdate;
private String lastdate;
private String place;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getCompany() {
return company;
}
public void setCompany(String company) {
this.company = company;
}
public String getPostdate() {
return postdate;
}
public void setPostdate(String postdate) {
this.postdate = postdate;
}
public String getLastdate() {
return lastdate;
}
public void setLastdate(String lastdate) {
this.lastdate = lastdate;
}
public String getPlace() {
return place;
}
public void setPlace(String place) {
this.place = place;
}
@Override
public String toString() {
return "jobsadda [id=" + id + ", company=" + company + ", postdate="
+ postdate + ", lastdate=" + lastdate + ", place=" + place
+ "]";
}
}
| 954 | 0.667715 | 0.667715 | 50 | 18.08 | 16.236797 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.64 | false | false |
12
|
0e89b421d348a2c1323c91f0d43ea8b4b97e94b0
| 584,115,605,340 |
cc89e2c307c73ecc2580efce04edbc75221b76ea
|
/src/org/hackyourlife/gcn/dsp/RS02.java
|
a1916442bf467592e9044e36b91f24aa2fec0548
|
[] |
no_license
|
hackyourlife/brstm
|
https://github.com/hackyourlife/brstm
|
5294ad1176b1759290d2c7ef424c9cee07f5ba47
|
910ec5103f37e7c6234d28ecc50bd746f63874ab
|
refs/heads/master
| 2021-01-14T08:41:26.288000 | 2020-04-25T23:31:35 | 2020-04-25T23:31:35 | 24,235,984 | 6 | 4 | null | false | 2017-04-05T20:39:51 | 2014-09-19T15:55:58 | 2017-03-07T16:33:47 | 2017-04-04T20:15:08 | 18 | 0 | 1 | 1 |
Java
| null | null |
package org.hackyourlife.gcn.dsp;
import java.io.IOException;
import java.io.RandomAccessFile;
public class RS02 implements Stream {
long sample_count;
long nibble_count;
long sample_rate;
int format;
int loop_flag;
long loop_start_offset;
long loop_end_offset;
long channel_count;
int coef[][]; /* really 8x2 */
RandomAccessFile file;
long startoffset;
long filepos;
long filesize;
long current_sample;
long current_byte;
ADPCMDecoder decoder[];
public RS02(RandomAccessFile file) throws FileFormatException, IOException {
this.file = file;
this.filesize = file.length();
if(!readHeader()) {
throw new FileFormatException("not a RS02 file");
}
reset();
}
public final static int unsigned2signed16bit(int x) {
int sign = x & (1 << 15);
int value = x & ~(1 << 15);
return (sign != 0) ? -(~x & 0xFFFF) : value;
}
public boolean read_dsp_header(byte[] header, RandomAccessFile in) throws IOException {
channel_count = endianess.get_32bitBE(header, 0x00);
if(channel_count != 2) {
return(false);
}
sample_count = endianess.get_32bitBE(header, 0x04);
sample_rate = endianess.get_32bitBE(header, 0x08);
nibble_count = endianess.get_32bitBE(header, 0x0C);
loop_flag = endianess.get_16bitBE(header, 0x10);
format = endianess.get_16bitBE(header, 0x12);
loop_start_offset = endianess.get_32bitBE(header, 0x14) / 2 * channel_count;
loop_end_offset = endianess.get_32bitBE(header, 0x18) / 2 * channel_count;
coef = new int[(int) channel_count][16];
byte[] buf = new byte[(int) (0x20 * channel_count)];
in.read(buf);
for(int c = 0; c < channel_count; c++) {
for(int i = 0; i < 16; i++) {
coef[c][i] = unsigned2signed16bit(endianess.get_16bitBE(buf, (c * 0x20) + i * 2));
}
}
return(true);
}
@Override
public long getSampleRate() {
return(sample_rate);
}
@Override
public int getChannels() {
return((int)channel_count);
}
public long getPreferedBufferSize() {
return(getChannels() * (long) (channel_count * 14.0));
}
private boolean readHeader() throws IOException {
seek(0);
byte[] header = new byte[0x1C];
file.read(header);
if(!read_dsp_header(header, file)) {
return(false);
}
startoffset = 0x60;
decoder = new ADPCMDecoder[(int) channel_count];
for(int i = 0; i < channel_count; i++) {
decoder[i] = new ADPCMDecoder();
decoder[i].setCoef(coef[i]);
decoder[i].setHistory(0, 0);
}
filepos = startoffset;
current_sample = 0;
current_byte = 0;
return(true);
}
@Override
public void close() throws IOException {
file.close();
}
@Override
public boolean hasMoreData() {
return((loop_flag != 0) || (filepos < filesize));
}
private void seek(long pos) throws IOException {
file.seek(startoffset + pos);
filepos = startoffset + pos;
}
public void reset() throws IOException {
seek(0);
for(int i = 0; i < channel_count; i++) {
decoder[i].setHistory(0, 0);
}
}
private int[] doDecode() throws IOException {
int[] samples = new int[(int) (14 * channel_count)];
byte[] rawdata = new byte[(int) (8 * channel_count)];
filepos += file.read(rawdata);
for(int ch = 0; ch < channel_count; ch++) {
int[] buf = decoder[ch].decode_ngc_dsp_sub(0, 0,
(int) (rawdata.length / 8.0 / channel_count * 14.0), ch,
(int) channel_count, rawdata);
for(int x = 0; x < buf.length; x++) {
samples[(int) (x * channel_count + ch)] = buf[x];
}
}
current_sample += samples.length;
if((loop_flag != 0) && ((filepos - startoffset) >= loop_end_offset)) {
filepos = startoffset + (loop_start_offset / 8) * 8;
seek(filepos);
}
return(samples);
}
@Override
public byte[] decode() throws Exception {
int[] samples = doDecode();
byte[] buffer = new byte[samples.length * 2];
for(int i = 0; i < samples.length; i++)
endianess.set16bit_BE(samples[i], buffer, i * 2);
return(buffer);
}
public short[] decode16() throws Exception {
int[] samples = doDecode();
short[] buffer = new short[samples.length];
for(int i = 0; i < samples.length; i++) {
buffer[i] = (short) samples[i];
}
return(buffer);
}
@Override
public String toString() {
return("RS02[" + sample_rate + "Hz,16bit," + sample_count + " samples,loop:" +
((loop_flag != 0) ? "yes" : "no") + "," + channel_count + "ch]");
}
}
|
UTF-8
|
Java
| 4,306 |
java
|
RS02.java
|
Java
|
[] | null |
[] |
package org.hackyourlife.gcn.dsp;
import java.io.IOException;
import java.io.RandomAccessFile;
public class RS02 implements Stream {
long sample_count;
long nibble_count;
long sample_rate;
int format;
int loop_flag;
long loop_start_offset;
long loop_end_offset;
long channel_count;
int coef[][]; /* really 8x2 */
RandomAccessFile file;
long startoffset;
long filepos;
long filesize;
long current_sample;
long current_byte;
ADPCMDecoder decoder[];
public RS02(RandomAccessFile file) throws FileFormatException, IOException {
this.file = file;
this.filesize = file.length();
if(!readHeader()) {
throw new FileFormatException("not a RS02 file");
}
reset();
}
public final static int unsigned2signed16bit(int x) {
int sign = x & (1 << 15);
int value = x & ~(1 << 15);
return (sign != 0) ? -(~x & 0xFFFF) : value;
}
public boolean read_dsp_header(byte[] header, RandomAccessFile in) throws IOException {
channel_count = endianess.get_32bitBE(header, 0x00);
if(channel_count != 2) {
return(false);
}
sample_count = endianess.get_32bitBE(header, 0x04);
sample_rate = endianess.get_32bitBE(header, 0x08);
nibble_count = endianess.get_32bitBE(header, 0x0C);
loop_flag = endianess.get_16bitBE(header, 0x10);
format = endianess.get_16bitBE(header, 0x12);
loop_start_offset = endianess.get_32bitBE(header, 0x14) / 2 * channel_count;
loop_end_offset = endianess.get_32bitBE(header, 0x18) / 2 * channel_count;
coef = new int[(int) channel_count][16];
byte[] buf = new byte[(int) (0x20 * channel_count)];
in.read(buf);
for(int c = 0; c < channel_count; c++) {
for(int i = 0; i < 16; i++) {
coef[c][i] = unsigned2signed16bit(endianess.get_16bitBE(buf, (c * 0x20) + i * 2));
}
}
return(true);
}
@Override
public long getSampleRate() {
return(sample_rate);
}
@Override
public int getChannels() {
return((int)channel_count);
}
public long getPreferedBufferSize() {
return(getChannels() * (long) (channel_count * 14.0));
}
private boolean readHeader() throws IOException {
seek(0);
byte[] header = new byte[0x1C];
file.read(header);
if(!read_dsp_header(header, file)) {
return(false);
}
startoffset = 0x60;
decoder = new ADPCMDecoder[(int) channel_count];
for(int i = 0; i < channel_count; i++) {
decoder[i] = new ADPCMDecoder();
decoder[i].setCoef(coef[i]);
decoder[i].setHistory(0, 0);
}
filepos = startoffset;
current_sample = 0;
current_byte = 0;
return(true);
}
@Override
public void close() throws IOException {
file.close();
}
@Override
public boolean hasMoreData() {
return((loop_flag != 0) || (filepos < filesize));
}
private void seek(long pos) throws IOException {
file.seek(startoffset + pos);
filepos = startoffset + pos;
}
public void reset() throws IOException {
seek(0);
for(int i = 0; i < channel_count; i++) {
decoder[i].setHistory(0, 0);
}
}
private int[] doDecode() throws IOException {
int[] samples = new int[(int) (14 * channel_count)];
byte[] rawdata = new byte[(int) (8 * channel_count)];
filepos += file.read(rawdata);
for(int ch = 0; ch < channel_count; ch++) {
int[] buf = decoder[ch].decode_ngc_dsp_sub(0, 0,
(int) (rawdata.length / 8.0 / channel_count * 14.0), ch,
(int) channel_count, rawdata);
for(int x = 0; x < buf.length; x++) {
samples[(int) (x * channel_count + ch)] = buf[x];
}
}
current_sample += samples.length;
if((loop_flag != 0) && ((filepos - startoffset) >= loop_end_offset)) {
filepos = startoffset + (loop_start_offset / 8) * 8;
seek(filepos);
}
return(samples);
}
@Override
public byte[] decode() throws Exception {
int[] samples = doDecode();
byte[] buffer = new byte[samples.length * 2];
for(int i = 0; i < samples.length; i++)
endianess.set16bit_BE(samples[i], buffer, i * 2);
return(buffer);
}
public short[] decode16() throws Exception {
int[] samples = doDecode();
short[] buffer = new short[samples.length];
for(int i = 0; i < samples.length; i++) {
buffer[i] = (short) samples[i];
}
return(buffer);
}
@Override
public String toString() {
return("RS02[" + sample_rate + "Hz,16bit," + sample_count + " samples,loop:" +
((loop_flag != 0) ? "yes" : "no") + "," + channel_count + "ch]");
}
}
| 4,306 | 0.641895 | 0.612634 | 173 | 23.890173 | 21.697462 | 88 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.179191 | false | false |
12
|
761f3617747434c6ecdf33336b4ae4b7f24012a0
| 11,003,706,252,129 |
733e2fcb9c19c4d1f675c2be8764ec55efe35907
|
/src/main/java/com/jtrent238/moretrophies/MoreTrophies.java
|
a3f6a93373f7bfa5606601a77d6e14d8ae96bf50
|
[] |
no_license
|
hidalgoarlene60/More-Trophies
|
https://github.com/hidalgoarlene60/More-Trophies
|
f00c9690ca0270e4b8bd242bea369fe5fc778a00
|
4885e83bfdf9359ee0b13b4bfd35af33d214b8d8
|
refs/heads/master
| 2020-03-30T00:00:43.835000 | 2018-06-26T22:54:42 | 2018-06-26T22:54:42 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.jtrent238.moretrophies;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import org.apache.logging.log4j.Level;
import com.jim.obscore.OCClientConfig;
import com.jim.obscore.blocks.BlockInitialisation;
import com.jim.obscore.containers.AbstractLanguageDetails;
import com.jim.obscore.containers.BlockDetails;
import com.jim.obscore.lib.ObsLog;
import com.jim.obstrophiesaoa.trophy.TrophyAoA;
import com.jim.obstrophiesaoa.trophy.TrophyRegistry;
import com.jtrent238.moretrophies.common.CommonProxy;
import com.jtrent238.moretrophies.trophyloaders.AdInfernos;
import com.jtrent238.moretrophies.trophyloaders.AnimalBikes;
import com.jtrent238.moretrophies.trophyloaders.AquaCreeper;
import com.jtrent238.moretrophies.trophyloaders.AshtonsWatermelonMod;
import com.jtrent238.moretrophies.trophyloaders.BabyMobs;
import com.jtrent238.moretrophies.trophyloaders.BackportMod;
import com.jtrent238.moretrophies.trophyloaders.CandyCraft;
import com.jtrent238.moretrophies.trophyloaders.CrazyOres;
import com.jtrent238.moretrophies.trophyloaders.CryptoCraft;
import com.jtrent238.moretrophies.trophyloaders.DinoDimension;
import com.jtrent238.moretrophies.trophyloaders.DungeonMobs;
import com.jtrent238.moretrophies.trophyloaders.EpicProportionsMod;
import com.jtrent238.moretrophies.trophyloaders.EpicProportionsMod_Christmas;
import com.jtrent238.moretrophies.trophyloaders.EpicProportionsMod_Halloween;
import com.jtrent238.moretrophies.trophyloaders.ExoticPlayers;
import com.jtrent238.moretrophies.trophyloaders.ExtraGolems;
import com.jtrent238.moretrophies.trophyloaders.FNaFUniverse;
import com.jtrent238.moretrophies.trophyloaders.FandomCraft;
import com.jtrent238.moretrophies.trophyloaders.FantasyMod;
import com.jtrent238.moretrophies.trophyloaders.FatherToastSpecialMobs;
import com.jtrent238.moretrophies.trophyloaders.FossilsandArcheologyRevival;
import com.jtrent238.moretrophies.trophyloaders.FrozenArctic;
import com.jtrent238.moretrophies.trophyloaders.HardcoreEnderExpansion;
import com.jtrent238.moretrophies.trophyloaders.InventoryPets;
import com.jtrent238.moretrophies.trophyloaders.JTYouTubers;
import com.jtrent238.moretrophies.trophyloaders.JurassiCraft;
import com.jtrent238.moretrophies.trophyloaders.JustaFewFish;
import com.jtrent238.moretrophies.trophyloaders.LaserCreepers;
import com.jtrent238.moretrophies.trophyloaders.LittleBigCraft;
import com.jtrent238.moretrophies.trophyloaders.LostWorld;
import com.jtrent238.moretrophies.trophyloaders.LotsofMobs;
import com.jtrent238.moretrophies.trophyloaders.MaleficentWorld;
import com.jtrent238.moretrophies.trophyloaders.Minecraft;
import com.jtrent238.moretrophies.trophyloaders.MoZombies;
import com.jtrent238.moretrophies.trophyloaders.MoreAnimalsMod;
import com.jtrent238.moretrophies.trophyloaders.MoreShearables;
import com.jtrent238.moretrophies.trophyloaders.MrGorrila;
import com.jtrent238.moretrophies.trophyloaders.MrWhalesAminalsMod;
import com.jtrent238.moretrophies.trophyloaders.MyPetSushi;
import com.jtrent238.moretrophies.trophyloaders.OreSpiders;
import com.jtrent238.moretrophies.trophyloaders.Orespawn;
import com.jtrent238.moretrophies.trophyloaders.ParziStarWars;
import com.jtrent238.moretrophies.trophyloaders.Pixelmon;
import com.jtrent238.moretrophies.trophyloaders.Potatians;
import com.jtrent238.moretrophies.trophyloaders.ProjectFruit;
import com.jtrent238.moretrophies.trophyloaders.RandNMixMod;
import com.jtrent238.moretrophies.trophyloaders.RandomMobsMod;
import com.jtrent238.moretrophies.trophyloaders.ReptileMod;
import com.jtrent238.moretrophies.trophyloaders.SoggyEaster;
import com.jtrent238.moretrophies.trophyloaders.SpiderQueen;
import com.jtrent238.moretrophies.trophyloaders.TConstruct;
import com.jtrent238.moretrophies.trophyloaders.TattleTailCraft;
import com.jtrent238.moretrophies.trophyloaders.TheUltimateUnicornMod;
import com.jtrent238.moretrophies.trophyloaders.TheValeOfShadows;
import com.jtrent238.moretrophies.trophyloaders.VaraziusFNAF;
import com.jtrent238.moretrophies.trophyloaders.WeepingAngels;
import com.jtrent238.moretrophies.trophyloaders.WildMobsMod;
import com.jtrent238.moretrophies.trophyloaders.Yogmod;
import com.jtrent238.moretrophies.trophyloaders.ZeldaSwordSkills;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.registry.LanguageRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.command.ICommandManager;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagString;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.WeightedRandomChestContent;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.common.ChestGenHooks;
@Mod(modid=MoreTrophies.MODID, name=MoreTrophies.MODNAME, version=(MoreTrophies.MODVERSION), dependencies="required-after:obstrophiesaoa")
//@MeddleMod(id=Main.MODID, name=Main.MODNAME, version=(Main.MODVERSION), author=Main.MODAUTHOR)
public class MoreTrophies
{
@SidedProxy(clientSide="com.jtrent238.moretrophies.client.ClientProxy", serverSide="com.jtrent238.moretrophies.common.CommonProxy")
public static CommonProxy proxy;
public static final String MODID = "moretrophies";
@Instance(MODID)
public static MoreTrophies instance;
public static final String MODVERSION = "1.0.2.5";
public static final String MODNAME = "jtrent238's More Trophies Mod";
public static final String MODAUTHOR = "jtrent238";
public static final String MC = "1.7.10";
public static final String OBSTrophiesVersion = "1.6.0";
public static final String OBSCoreVersion = "1.4.1";
private List<AbstractLanguageDetails> _languageDetails = new ArrayList();
@ForgeSubscribe(priority = EventPriority.NORMAL)
public void eventHandler(RenderGameOverlayEvent event) {
}
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event)
{
ObsLog.initialise(event.getModLog(), MODNAME);
ConfigManager.Manage(event);
}
@Mod.EventHandler
public void init(FMLInitializationEvent event) throws IOException
{
proxy.init(event);
ItemLoader.loadItems();
//String name = "otaoablocktrophyPLAYER";
//BlockDetails[] bd = { new BlockDetails("TrophyPLAYER", Boolean.valueOf(false), "builder") };
//blockPlayerTrophy = new BlockTrophyPlayer(name, Material.rock);
//BlockInitialisation.initBlockMultiDetails(blockPlayerTrophy, bd, 2.0F, 0.8F, this._languageDetails);
//blockPlayerTrophy.func_149711_c(0.5F);
//Register Trophies for mods
Minecraft.registerTrophies();
//PlayerTrophies.registerTrophies();
if(ConfigManager.AUTOTROPHYLOADER == true){
if(OCClientConfig.getInstance().dumpEntityData == true){
AutoTrophyLoader.constructor("obscore_entity_ids.txt");
AutoTrophyLoader.registerTrophies();
}
if(OCClientConfig.getInstance().dumpEntityData == false){
LogHelper.log(Level.WARN, "dump_entity_data must be set to true in obscore.cfg for this to work.");
}
}
if (Loader.isModLoaded("epicproportionsmod")) {
System.out.println("EpicProportions Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded EpicProportions Mod ");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load EpicProportions Mod");
e.printStackTrace(System.err);
}
EpicProportionsMod.registerTrophies();
}
if (Loader.isModLoaded("epicproportionsmod_halloween")) {
System.out.println("EpicProportions Mod Halloween Addon Loaded");
try {
LogHelper.log(Level.INFO, "Loaded EpicProportions Mod Halloween Addon");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load EpicProportions Mod Halloween Addon");
e.printStackTrace(System.err);
}
EpicProportionsMod_Halloween.registerTrophies();
}
if (Loader.isModLoaded("epicproportionsmod_christmas")) {
System.out.println("EpicProportions Mod Christmas Addon Loaded");
try {
LogHelper.log(Level.INFO, "Loaded EpicProportions Mod Christmas Addon");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load EpicProportions Mod Christmas Addon");
e.printStackTrace(System.err);
}
EpicProportionsMod_Christmas.registerTrophies();
}
if (Loader.isModLoaded("wildmobsmod")) {
System.out.println("Wild Mobs Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Wild Mobs Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Wild Mobs Mod");
e.printStackTrace(System.err);
}
WildMobsMod.registerTrophies();
}
if (Loader.isModLoaded("lostworld")) {
System.out.println("Lost World Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Lost World Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Lost World Mod");
e.printStackTrace(System.err);
}
LostWorld.registerTrophies();
}
if (Loader.isModLoaded("mypetsushi")) {
System.out.println("My Pet Sushi Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded My Pet Sushi Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load My Pet Sushi Mod");
e.printStackTrace(System.err);
}
MyPetSushi.registerTrophies();
}
if (Loader.isModLoaded("w_angels")) {
System.out.println("Weeping Angels Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Weeping Angels Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Weeping Angels Mod");
e.printStackTrace(System.err);
}
WeepingAngels.registerTrophies();
}
if (Loader.isModLoaded("mozombies")) {
System.out.println("Mo' Zombies Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Mo' Zombies Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Mo' Zombies Mod");
e.printStackTrace(System.err);
}
MoZombies.registerTrophies();
}
if (Loader.isModLoaded("SQ")) {
System.out.println("Spider Queen Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Spider Queen Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Spider Queen Mod");
e.printStackTrace(System.err);
}
SpiderQueen.registerTrophies();
}
if (Loader.isModLoaded("orespiders")) {
System.out.println("Ore Spiders Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Ore Spiders Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Ore Spiders Mod");
e.printStackTrace(System.err);
}
OreSpiders.registerTrophies();
}
if (Loader.isModLoaded("projectfruit")) {
System.out.println("Project Fruit Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Project Fruit Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Project Fruit Mod");
e.printStackTrace(System.err);
}
ProjectFruit.registerTrophies();
}
if (Loader.isModLoaded("fandomcraft")) {
System.out.println("Fandom Craft Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Fandom Craft Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Fandom Craft Mod");
e.printStackTrace(System.err);
}
FandomCraft.registerTrophies();
}
if (Loader.isModLoaded("mrwhale1")) {
System.out.println("Mr Whale's Aminals Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Mr Whale's Aminals Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Mr Whale's Aminals Mod");
e.printStackTrace(System.err);
}
MrWhalesAminalsMod.registerTrophies();
}
if (Loader.isModLoaded("zeldaswordskills")) {
System.out.println("ZeldaSwordSkills Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded ZeldaSwordSkills Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load ZeldaSwordSkills Mod");
e.printStackTrace(System.err);
}
ZeldaSwordSkills.registerTrophies();
}
if (Loader.isModLoaded("mrgorrila")) {
System.out.println("Mr Gorrila Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Mr Gorrila Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Mr Gorrila Mod");
e.printStackTrace(System.err);
}
MrGorrila.registerTrophies();
}
if (Loader.isModLoaded("frozenarctic")) {
System.out.println("Frozen Arctic Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Frozen Arctic Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Frozen Arctic Mod");
e.printStackTrace(System.err);
}
FrozenArctic.registerTrophies();
}
if (Loader.isModLoaded("lasercreepers")) {
System.out.println("Laser Creeper Robot Dino Riders From Space Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Laser Creeper Robot Dino Riders From Space Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Laser Creeper Robot Dino Riders From Space Mod");
e.printStackTrace(System.err);
}
LaserCreepers.registerTrophies();
}
if (Loader.isModLoaded("HardcoreEnderExpansion")) {
System.out.println("Hardcore Ender Expansion Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Hardcore Ender Expansion Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Hardcore Ender Expansion Mod");
e.printStackTrace(System.err);
}
HardcoreEnderExpansion.registerTrophies();
}
if (Loader.isModLoaded("aquacreeper")) {
System.out.println("Aqua Creeper Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Aqua Creeper Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Aqua Creeper Mod");
e.printStackTrace(System.err);
}
AquaCreeper.registerTrophies();
}
/*
if (Loader.isModLoaded("jurassicraft")) {
System.out.println("JurassiCraft Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded JurassiCraft Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load JurassiCraft Mod");
e.printStackTrace(System.err);
}
JurassiCraft.registerTrophies();
}
*/
if (Loader.isModLoaded("dextersnether")) {
System.out.println("Ad Infernos Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Ad Infernos Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Ad Infernos Mod");
e.printStackTrace(System.err);
}
AdInfernos.registerTrophies();
}
/*
if (Loader.isModLoaded("potatians")) {
System.out.println("Potatians Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Potatians Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Potatians Mod");
e.printStackTrace(System.err);
}
Potatians.registerTrophies();
}
*/
if (Loader.isModLoaded("golems")) {
System.out.println("Extra Golems Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Extra Golems Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Extra Golems Mod");
e.printStackTrace(System.err);
}
ExtraGolems.registerTrophies();
}
if (Loader.isModLoaded("reptilemod")) {
System.out.println("Reptile Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Reptile Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Reptile Mod");
e.printStackTrace(System.err);
}
ReptileMod.registerTrophies();
}
if (Loader.isModLoaded("moreShearables")) {
System.out.println("More Shearables Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded More Shearables Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load More Shearables Mod");
e.printStackTrace(System.err);
}
MoreShearables.registerTrophies();
}
if (Loader.isModLoaded("babymobs")) {
System.out.println("Baby Mobs Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Baby Mobs Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Baby Mobs Mod");
e.printStackTrace(System.err);
}
BabyMobs.registerTrophies();
}
/*
if (Loader.isModLoaded("jaff")) {
System.out.println("Just a Few Fish Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Just a Few Fish Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Just a Few Fish Mod");
e.printStackTrace(System.err);
}
JustaFewFish.registerTrophies();
}
*/
if (Loader.isModLoaded("AshtonsWatermelonMod")) {
System.out.println("Ashtons Watermelon Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Ashtons Watermelon Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Ashtons Watermelon Mod");
e.printStackTrace(System.err);
}
AshtonsWatermelonMod.registerTrophies();
}
/*
if (Loader.isModLoaded("ultimate_unicorn_mod")) {
System.out.println("Wings, Horns, and Hooves, the Ultimate Unicorn Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Wings, Horns, and Hooves, the Ultimate Unicorn Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Wings, Horns, and Hooves, the Ultimate Unicorn Mod");
e.printStackTrace(System.err);
}
TheUltimateUnicornMod.registerTrophies();
}
*/
if (Loader.isModLoaded("OreSpawn")) {
System.out.println("OreSpawn Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded OreSpawn Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load OreSpawn Mod");
e.printStackTrace(System.err);
}
Orespawn.registerTrophies();
}
if (Loader.isModLoaded("ttm")) {
System.out.println("TattleTail Craft: Mama's Coming! Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded TattleTail Craft: Mama's Coming! Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load TattleTail Craft: Mama's Coming! Mod");
e.printStackTrace(System.err);
}
TattleTailCraft.registerTrophies();
}
if (Loader.isModLoaded("animalbikes")) {
System.out.println("Animal Bikes Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Animal Bikes Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Animal Bikes Mod");
e.printStackTrace(System.err);
}
AnimalBikes.registerTrophies();
}
if (Loader.isModLoaded("lom")) {
System.out.println("Lots of Mobs Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Lots of Mobs Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Lots of Mobs Mod");
e.printStackTrace(System.err);
}
LotsofMobs.registerTrophies();
}
if (Loader.isModLoaded("jtrent238youtubers")) {
System.out.println("jtrent238's YouTubers Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded jtrent238's YouTubers Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load jtrent238's YouTubers Mod");
e.printStackTrace(System.err);
}
JTYouTubers.registerTrophies();
}
if (Loader.isModLoaded("upsidedown")) {
System.out.println("The Vale of Shadows Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded The Vale of Shadows Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load The Vale of Shadows Mod");
e.printStackTrace(System.err);
}
TheValeOfShadows.registerTrophies();
}
if (Loader.isModLoaded("ExoticPlayers")) {
System.out.println("Exotic Players Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Exotic Players Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Exotic Players Mod");
e.printStackTrace(System.err);
}
ExoticPlayers.registerTrophies();
}
if (Loader.isModLoaded("candycraftmod")) {
System.out.println("CandyCraft Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded CandyCraft Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load CandyCraft Mod");
e.printStackTrace(System.err);
}
CandyCraft.registerTrophies();
}
if (Loader.isModLoaded("fnafmod")) {
System.out.println("Five Nights at Freddy's Universe Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Five Nights at Freddy's Universe Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Five Nights at Freddy's Universe Mod");
e.printStackTrace(System.err);
}
FNaFUniverse.registerTrophies();
}
if (Loader.isModLoaded("easter")) {
System.out.println("Easter Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Easter Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Easter Mod");
e.printStackTrace(System.err);
}
SoggyEaster.registerTrophies();
}
if (Loader.isModLoaded("starwarsmod")) {
System.out.println("Parzi's Star Wars Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Parzi's Star Wars Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Parzi's Star Wars Mod");
e.printStackTrace(System.err);
}
ParziStarWars.registerTrophies();
}
if (Loader.isModLoaded("fnafmod")) {
System.out.println("Fnaf Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Fnaf Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Fnaf Mod");
e.printStackTrace(System.err);
}
VaraziusFNAF.registerTrophies();
}
if (Loader.isModLoaded("MaleficentWorld")) {
System.out.println("Maleficent World Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Maleficent World Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Maleficent World Mod");
e.printStackTrace(System.err);
}
MaleficentWorld.registerTrophies();
}
if (Loader.isModLoaded("RandNMixMod")) {
System.out.println("RandNMixMod Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded RandNMixMod Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load RandNMixMod Mod");
e.printStackTrace(System.err);
}
RandNMixMod.registerTrophies();
}
if (Loader.isModLoaded("fantasymod")) {
System.out.println("FantasyMod Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded FantasyMod Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load FantasyMod Mod");
e.printStackTrace(System.err);
}
FantasyMod.registerTrophies();
}
if (Loader.isModLoaded("Yogmod")) {
System.out.println("Yogmod Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Yogmod Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Yogmod Mod");
e.printStackTrace(System.err);
}
Yogmod.registerTrophies();
}
if (Loader.isModLoaded("MobsModV6")) {
System.out.println("More Animals Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded More Animals Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load More Animals Mod");
e.printStackTrace(System.err);
}
MoreAnimalsMod.registerTrophies();
}
if (Loader.isModLoaded("CryptoCraft")) {
System.out.println("CryptoCraft Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded CryptoCraft Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load CryptoCraft Mod");
e.printStackTrace(System.err);
}
CryptoCraft.registerTrophies();
}
if (Loader.isModLoaded("LittleBigCraft")) {
System.out.println("LittleBigCraft Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded LittleBigCraft Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load LittleBigCraft Mod");
e.printStackTrace(System.err);
}
LittleBigCraft.registerTrophies();
}
if (Loader.isModLoaded("RandomMobsMod")) {
System.out.println("Random Mobs Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Random Mobs Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Random Mobs Mod");
e.printStackTrace(System.err);
}
RandomMobsMod.registerTrophies();
}
if (Loader.isModLoaded("SpecialMobs")) {
System.out.println("FatherToast Special Mobs Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded FatherToast Special Mobs Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load FatherToast Special Mobs Mod");
e.printStackTrace(System.err);
}
FatherToastSpecialMobs.registerTrophies();
}
if (Loader.isModLoaded("dungeonmobs")) {
System.out.println("Dungeon Mobs Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Dungeon Mobs Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Dungeon Mobs Mod");
e.printStackTrace(System.err);
}
DungeonMobs.registerTrophies();
}
if (Loader.isModLoaded("InventoryPets")) {
System.out.println("Inventory Pets Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Inventory Pets Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Inventory Pets Mod");
e.printStackTrace(System.err);
}
InventoryPets.registerTrophies();
}
if (Loader.isModLoaded("fossilsarcheology")) {
System.out.println("Fossils and Archeology Revival Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Fossils and Archeology Revival Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Fossils and Archeology Revival Mod");
e.printStackTrace(System.err);
}
FossilsandArcheologyRevival.registerTrophies();
}
if (Loader.isModLoaded("crazyores")) {
System.out.println("CrazyOres Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded CrazyOres Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load CrazyOres Mod");
e.printStackTrace(System.err);
}
CrazyOres.registerTrophies();
}
if (Loader.isModLoaded("pixelmon")) {
System.out.println("Pixelmon Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Pixelmon Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Pixelmon Mod");
e.printStackTrace(System.err);
}
Pixelmon.registerTrophies();
}
if (Loader.isModLoaded("backportmod")) {
System.out.println("Backport Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Backport Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Backport Mod");
e.printStackTrace(System.err);
}
BackportMod.registerTrophies();
}
if (Loader.isModLoaded("dinodim")) {
System.out.println("DinoDimension Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded DinoDimension Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load DinoDimension Mod");
e.printStackTrace(System.err);
}
DinoDimension.registerTrophies();
}
if (Loader.isModLoaded("TConstruct")) {
System.out.println("Tinkers Construct Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Tinkers Construct Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Tinkers Construct Mod");
e.printStackTrace(System.err);
}
TConstruct.registerTrophies();
}
}
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent event) {
{
}
}
@EventHandler
public void serverStart(FMLServerStartingEvent event)
{
MinecraftServer server = MinecraftServer.getServer();
// Get's the current server instance
ICommandManager command = server.getCommandManager();
//ServerCommandManager manager = (ServerCommandManager) command;
//manager.registerCommand(new CommandModInfo());
//manager.registerCommand(new CommandChangelog());
}
}
|
UTF-8
|
Java
| 31,433 |
java
|
MoreTrophies.java
|
Java
|
[] | null |
[] |
package com.jtrent238.moretrophies;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import org.apache.logging.log4j.Level;
import com.jim.obscore.OCClientConfig;
import com.jim.obscore.blocks.BlockInitialisation;
import com.jim.obscore.containers.AbstractLanguageDetails;
import com.jim.obscore.containers.BlockDetails;
import com.jim.obscore.lib.ObsLog;
import com.jim.obstrophiesaoa.trophy.TrophyAoA;
import com.jim.obstrophiesaoa.trophy.TrophyRegistry;
import com.jtrent238.moretrophies.common.CommonProxy;
import com.jtrent238.moretrophies.trophyloaders.AdInfernos;
import com.jtrent238.moretrophies.trophyloaders.AnimalBikes;
import com.jtrent238.moretrophies.trophyloaders.AquaCreeper;
import com.jtrent238.moretrophies.trophyloaders.AshtonsWatermelonMod;
import com.jtrent238.moretrophies.trophyloaders.BabyMobs;
import com.jtrent238.moretrophies.trophyloaders.BackportMod;
import com.jtrent238.moretrophies.trophyloaders.CandyCraft;
import com.jtrent238.moretrophies.trophyloaders.CrazyOres;
import com.jtrent238.moretrophies.trophyloaders.CryptoCraft;
import com.jtrent238.moretrophies.trophyloaders.DinoDimension;
import com.jtrent238.moretrophies.trophyloaders.DungeonMobs;
import com.jtrent238.moretrophies.trophyloaders.EpicProportionsMod;
import com.jtrent238.moretrophies.trophyloaders.EpicProportionsMod_Christmas;
import com.jtrent238.moretrophies.trophyloaders.EpicProportionsMod_Halloween;
import com.jtrent238.moretrophies.trophyloaders.ExoticPlayers;
import com.jtrent238.moretrophies.trophyloaders.ExtraGolems;
import com.jtrent238.moretrophies.trophyloaders.FNaFUniverse;
import com.jtrent238.moretrophies.trophyloaders.FandomCraft;
import com.jtrent238.moretrophies.trophyloaders.FantasyMod;
import com.jtrent238.moretrophies.trophyloaders.FatherToastSpecialMobs;
import com.jtrent238.moretrophies.trophyloaders.FossilsandArcheologyRevival;
import com.jtrent238.moretrophies.trophyloaders.FrozenArctic;
import com.jtrent238.moretrophies.trophyloaders.HardcoreEnderExpansion;
import com.jtrent238.moretrophies.trophyloaders.InventoryPets;
import com.jtrent238.moretrophies.trophyloaders.JTYouTubers;
import com.jtrent238.moretrophies.trophyloaders.JurassiCraft;
import com.jtrent238.moretrophies.trophyloaders.JustaFewFish;
import com.jtrent238.moretrophies.trophyloaders.LaserCreepers;
import com.jtrent238.moretrophies.trophyloaders.LittleBigCraft;
import com.jtrent238.moretrophies.trophyloaders.LostWorld;
import com.jtrent238.moretrophies.trophyloaders.LotsofMobs;
import com.jtrent238.moretrophies.trophyloaders.MaleficentWorld;
import com.jtrent238.moretrophies.trophyloaders.Minecraft;
import com.jtrent238.moretrophies.trophyloaders.MoZombies;
import com.jtrent238.moretrophies.trophyloaders.MoreAnimalsMod;
import com.jtrent238.moretrophies.trophyloaders.MoreShearables;
import com.jtrent238.moretrophies.trophyloaders.MrGorrila;
import com.jtrent238.moretrophies.trophyloaders.MrWhalesAminalsMod;
import com.jtrent238.moretrophies.trophyloaders.MyPetSushi;
import com.jtrent238.moretrophies.trophyloaders.OreSpiders;
import com.jtrent238.moretrophies.trophyloaders.Orespawn;
import com.jtrent238.moretrophies.trophyloaders.ParziStarWars;
import com.jtrent238.moretrophies.trophyloaders.Pixelmon;
import com.jtrent238.moretrophies.trophyloaders.Potatians;
import com.jtrent238.moretrophies.trophyloaders.ProjectFruit;
import com.jtrent238.moretrophies.trophyloaders.RandNMixMod;
import com.jtrent238.moretrophies.trophyloaders.RandomMobsMod;
import com.jtrent238.moretrophies.trophyloaders.ReptileMod;
import com.jtrent238.moretrophies.trophyloaders.SoggyEaster;
import com.jtrent238.moretrophies.trophyloaders.SpiderQueen;
import com.jtrent238.moretrophies.trophyloaders.TConstruct;
import com.jtrent238.moretrophies.trophyloaders.TattleTailCraft;
import com.jtrent238.moretrophies.trophyloaders.TheUltimateUnicornMod;
import com.jtrent238.moretrophies.trophyloaders.TheValeOfShadows;
import com.jtrent238.moretrophies.trophyloaders.VaraziusFNAF;
import com.jtrent238.moretrophies.trophyloaders.WeepingAngels;
import com.jtrent238.moretrophies.trophyloaders.WildMobsMod;
import com.jtrent238.moretrophies.trophyloaders.Yogmod;
import com.jtrent238.moretrophies.trophyloaders.ZeldaSwordSkills;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.event.FMLServerStartingEvent;
import cpw.mods.fml.common.eventhandler.EventPriority;
import cpw.mods.fml.common.registry.LanguageRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.command.ICommandManager;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagString;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.WeightedRandomChestContent;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.common.ChestGenHooks;
@Mod(modid=MoreTrophies.MODID, name=MoreTrophies.MODNAME, version=(MoreTrophies.MODVERSION), dependencies="required-after:obstrophiesaoa")
//@MeddleMod(id=Main.MODID, name=Main.MODNAME, version=(Main.MODVERSION), author=Main.MODAUTHOR)
public class MoreTrophies
{
@SidedProxy(clientSide="com.jtrent238.moretrophies.client.ClientProxy", serverSide="com.jtrent238.moretrophies.common.CommonProxy")
public static CommonProxy proxy;
public static final String MODID = "moretrophies";
@Instance(MODID)
public static MoreTrophies instance;
public static final String MODVERSION = "1.0.2.5";
public static final String MODNAME = "jtrent238's More Trophies Mod";
public static final String MODAUTHOR = "jtrent238";
public static final String MC = "1.7.10";
public static final String OBSTrophiesVersion = "1.6.0";
public static final String OBSCoreVersion = "1.4.1";
private List<AbstractLanguageDetails> _languageDetails = new ArrayList();
@ForgeSubscribe(priority = EventPriority.NORMAL)
public void eventHandler(RenderGameOverlayEvent event) {
}
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event)
{
ObsLog.initialise(event.getModLog(), MODNAME);
ConfigManager.Manage(event);
}
@Mod.EventHandler
public void init(FMLInitializationEvent event) throws IOException
{
proxy.init(event);
ItemLoader.loadItems();
//String name = "otaoablocktrophyPLAYER";
//BlockDetails[] bd = { new BlockDetails("TrophyPLAYER", Boolean.valueOf(false), "builder") };
//blockPlayerTrophy = new BlockTrophyPlayer(name, Material.rock);
//BlockInitialisation.initBlockMultiDetails(blockPlayerTrophy, bd, 2.0F, 0.8F, this._languageDetails);
//blockPlayerTrophy.func_149711_c(0.5F);
//Register Trophies for mods
Minecraft.registerTrophies();
//PlayerTrophies.registerTrophies();
if(ConfigManager.AUTOTROPHYLOADER == true){
if(OCClientConfig.getInstance().dumpEntityData == true){
AutoTrophyLoader.constructor("obscore_entity_ids.txt");
AutoTrophyLoader.registerTrophies();
}
if(OCClientConfig.getInstance().dumpEntityData == false){
LogHelper.log(Level.WARN, "dump_entity_data must be set to true in obscore.cfg for this to work.");
}
}
if (Loader.isModLoaded("epicproportionsmod")) {
System.out.println("EpicProportions Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded EpicProportions Mod ");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load EpicProportions Mod");
e.printStackTrace(System.err);
}
EpicProportionsMod.registerTrophies();
}
if (Loader.isModLoaded("epicproportionsmod_halloween")) {
System.out.println("EpicProportions Mod Halloween Addon Loaded");
try {
LogHelper.log(Level.INFO, "Loaded EpicProportions Mod Halloween Addon");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load EpicProportions Mod Halloween Addon");
e.printStackTrace(System.err);
}
EpicProportionsMod_Halloween.registerTrophies();
}
if (Loader.isModLoaded("epicproportionsmod_christmas")) {
System.out.println("EpicProportions Mod Christmas Addon Loaded");
try {
LogHelper.log(Level.INFO, "Loaded EpicProportions Mod Christmas Addon");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load EpicProportions Mod Christmas Addon");
e.printStackTrace(System.err);
}
EpicProportionsMod_Christmas.registerTrophies();
}
if (Loader.isModLoaded("wildmobsmod")) {
System.out.println("Wild Mobs Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Wild Mobs Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Wild Mobs Mod");
e.printStackTrace(System.err);
}
WildMobsMod.registerTrophies();
}
if (Loader.isModLoaded("lostworld")) {
System.out.println("Lost World Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Lost World Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Lost World Mod");
e.printStackTrace(System.err);
}
LostWorld.registerTrophies();
}
if (Loader.isModLoaded("mypetsushi")) {
System.out.println("My Pet Sushi Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded My Pet Sushi Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load My Pet Sushi Mod");
e.printStackTrace(System.err);
}
MyPetSushi.registerTrophies();
}
if (Loader.isModLoaded("w_angels")) {
System.out.println("Weeping Angels Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Weeping Angels Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Weeping Angels Mod");
e.printStackTrace(System.err);
}
WeepingAngels.registerTrophies();
}
if (Loader.isModLoaded("mozombies")) {
System.out.println("Mo' Zombies Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Mo' Zombies Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Mo' Zombies Mod");
e.printStackTrace(System.err);
}
MoZombies.registerTrophies();
}
if (Loader.isModLoaded("SQ")) {
System.out.println("Spider Queen Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Spider Queen Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Spider Queen Mod");
e.printStackTrace(System.err);
}
SpiderQueen.registerTrophies();
}
if (Loader.isModLoaded("orespiders")) {
System.out.println("Ore Spiders Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Ore Spiders Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Ore Spiders Mod");
e.printStackTrace(System.err);
}
OreSpiders.registerTrophies();
}
if (Loader.isModLoaded("projectfruit")) {
System.out.println("Project Fruit Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Project Fruit Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Project Fruit Mod");
e.printStackTrace(System.err);
}
ProjectFruit.registerTrophies();
}
if (Loader.isModLoaded("fandomcraft")) {
System.out.println("Fandom Craft Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Fandom Craft Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Fandom Craft Mod");
e.printStackTrace(System.err);
}
FandomCraft.registerTrophies();
}
if (Loader.isModLoaded("mrwhale1")) {
System.out.println("Mr Whale's Aminals Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Mr Whale's Aminals Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Mr Whale's Aminals Mod");
e.printStackTrace(System.err);
}
MrWhalesAminalsMod.registerTrophies();
}
if (Loader.isModLoaded("zeldaswordskills")) {
System.out.println("ZeldaSwordSkills Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded ZeldaSwordSkills Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load ZeldaSwordSkills Mod");
e.printStackTrace(System.err);
}
ZeldaSwordSkills.registerTrophies();
}
if (Loader.isModLoaded("mrgorrila")) {
System.out.println("Mr Gorrila Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Mr Gorrila Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Mr Gorrila Mod");
e.printStackTrace(System.err);
}
MrGorrila.registerTrophies();
}
if (Loader.isModLoaded("frozenarctic")) {
System.out.println("Frozen Arctic Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Frozen Arctic Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Frozen Arctic Mod");
e.printStackTrace(System.err);
}
FrozenArctic.registerTrophies();
}
if (Loader.isModLoaded("lasercreepers")) {
System.out.println("Laser Creeper Robot Dino Riders From Space Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Laser Creeper Robot Dino Riders From Space Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Laser Creeper Robot Dino Riders From Space Mod");
e.printStackTrace(System.err);
}
LaserCreepers.registerTrophies();
}
if (Loader.isModLoaded("HardcoreEnderExpansion")) {
System.out.println("Hardcore Ender Expansion Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Hardcore Ender Expansion Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Hardcore Ender Expansion Mod");
e.printStackTrace(System.err);
}
HardcoreEnderExpansion.registerTrophies();
}
if (Loader.isModLoaded("aquacreeper")) {
System.out.println("Aqua Creeper Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Aqua Creeper Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Aqua Creeper Mod");
e.printStackTrace(System.err);
}
AquaCreeper.registerTrophies();
}
/*
if (Loader.isModLoaded("jurassicraft")) {
System.out.println("JurassiCraft Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded JurassiCraft Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load JurassiCraft Mod");
e.printStackTrace(System.err);
}
JurassiCraft.registerTrophies();
}
*/
if (Loader.isModLoaded("dextersnether")) {
System.out.println("Ad Infernos Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Ad Infernos Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Ad Infernos Mod");
e.printStackTrace(System.err);
}
AdInfernos.registerTrophies();
}
/*
if (Loader.isModLoaded("potatians")) {
System.out.println("Potatians Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Potatians Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Potatians Mod");
e.printStackTrace(System.err);
}
Potatians.registerTrophies();
}
*/
if (Loader.isModLoaded("golems")) {
System.out.println("Extra Golems Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Extra Golems Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Extra Golems Mod");
e.printStackTrace(System.err);
}
ExtraGolems.registerTrophies();
}
if (Loader.isModLoaded("reptilemod")) {
System.out.println("Reptile Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Reptile Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Reptile Mod");
e.printStackTrace(System.err);
}
ReptileMod.registerTrophies();
}
if (Loader.isModLoaded("moreShearables")) {
System.out.println("More Shearables Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded More Shearables Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load More Shearables Mod");
e.printStackTrace(System.err);
}
MoreShearables.registerTrophies();
}
if (Loader.isModLoaded("babymobs")) {
System.out.println("Baby Mobs Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Baby Mobs Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Baby Mobs Mod");
e.printStackTrace(System.err);
}
BabyMobs.registerTrophies();
}
/*
if (Loader.isModLoaded("jaff")) {
System.out.println("Just a Few Fish Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Just a Few Fish Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Just a Few Fish Mod");
e.printStackTrace(System.err);
}
JustaFewFish.registerTrophies();
}
*/
if (Loader.isModLoaded("AshtonsWatermelonMod")) {
System.out.println("Ashtons Watermelon Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Ashtons Watermelon Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Ashtons Watermelon Mod");
e.printStackTrace(System.err);
}
AshtonsWatermelonMod.registerTrophies();
}
/*
if (Loader.isModLoaded("ultimate_unicorn_mod")) {
System.out.println("Wings, Horns, and Hooves, the Ultimate Unicorn Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Wings, Horns, and Hooves, the Ultimate Unicorn Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Wings, Horns, and Hooves, the Ultimate Unicorn Mod");
e.printStackTrace(System.err);
}
TheUltimateUnicornMod.registerTrophies();
}
*/
if (Loader.isModLoaded("OreSpawn")) {
System.out.println("OreSpawn Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded OreSpawn Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load OreSpawn Mod");
e.printStackTrace(System.err);
}
Orespawn.registerTrophies();
}
if (Loader.isModLoaded("ttm")) {
System.out.println("TattleTail Craft: Mama's Coming! Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded TattleTail Craft: Mama's Coming! Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load TattleTail Craft: Mama's Coming! Mod");
e.printStackTrace(System.err);
}
TattleTailCraft.registerTrophies();
}
if (Loader.isModLoaded("animalbikes")) {
System.out.println("Animal Bikes Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Animal Bikes Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Animal Bikes Mod");
e.printStackTrace(System.err);
}
AnimalBikes.registerTrophies();
}
if (Loader.isModLoaded("lom")) {
System.out.println("Lots of Mobs Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Lots of Mobs Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Lots of Mobs Mod");
e.printStackTrace(System.err);
}
LotsofMobs.registerTrophies();
}
if (Loader.isModLoaded("jtrent238youtubers")) {
System.out.println("jtrent238's YouTubers Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded jtrent238's YouTubers Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load jtrent238's YouTubers Mod");
e.printStackTrace(System.err);
}
JTYouTubers.registerTrophies();
}
if (Loader.isModLoaded("upsidedown")) {
System.out.println("The Vale of Shadows Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded The Vale of Shadows Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load The Vale of Shadows Mod");
e.printStackTrace(System.err);
}
TheValeOfShadows.registerTrophies();
}
if (Loader.isModLoaded("ExoticPlayers")) {
System.out.println("Exotic Players Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Exotic Players Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Exotic Players Mod");
e.printStackTrace(System.err);
}
ExoticPlayers.registerTrophies();
}
if (Loader.isModLoaded("candycraftmod")) {
System.out.println("CandyCraft Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded CandyCraft Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load CandyCraft Mod");
e.printStackTrace(System.err);
}
CandyCraft.registerTrophies();
}
if (Loader.isModLoaded("fnafmod")) {
System.out.println("Five Nights at Freddy's Universe Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Five Nights at Freddy's Universe Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Five Nights at Freddy's Universe Mod");
e.printStackTrace(System.err);
}
FNaFUniverse.registerTrophies();
}
if (Loader.isModLoaded("easter")) {
System.out.println("Easter Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Easter Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Easter Mod");
e.printStackTrace(System.err);
}
SoggyEaster.registerTrophies();
}
if (Loader.isModLoaded("starwarsmod")) {
System.out.println("Parzi's Star Wars Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Parzi's Star Wars Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Parzi's Star Wars Mod");
e.printStackTrace(System.err);
}
ParziStarWars.registerTrophies();
}
if (Loader.isModLoaded("fnafmod")) {
System.out.println("Fnaf Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Fnaf Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Fnaf Mod");
e.printStackTrace(System.err);
}
VaraziusFNAF.registerTrophies();
}
if (Loader.isModLoaded("MaleficentWorld")) {
System.out.println("Maleficent World Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Maleficent World Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Maleficent World Mod");
e.printStackTrace(System.err);
}
MaleficentWorld.registerTrophies();
}
if (Loader.isModLoaded("RandNMixMod")) {
System.out.println("RandNMixMod Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded RandNMixMod Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load RandNMixMod Mod");
e.printStackTrace(System.err);
}
RandNMixMod.registerTrophies();
}
if (Loader.isModLoaded("fantasymod")) {
System.out.println("FantasyMod Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded FantasyMod Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load FantasyMod Mod");
e.printStackTrace(System.err);
}
FantasyMod.registerTrophies();
}
if (Loader.isModLoaded("Yogmod")) {
System.out.println("Yogmod Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Yogmod Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Yogmod Mod");
e.printStackTrace(System.err);
}
Yogmod.registerTrophies();
}
if (Loader.isModLoaded("MobsModV6")) {
System.out.println("More Animals Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded More Animals Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load More Animals Mod");
e.printStackTrace(System.err);
}
MoreAnimalsMod.registerTrophies();
}
if (Loader.isModLoaded("CryptoCraft")) {
System.out.println("CryptoCraft Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded CryptoCraft Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load CryptoCraft Mod");
e.printStackTrace(System.err);
}
CryptoCraft.registerTrophies();
}
if (Loader.isModLoaded("LittleBigCraft")) {
System.out.println("LittleBigCraft Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded LittleBigCraft Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load LittleBigCraft Mod");
e.printStackTrace(System.err);
}
LittleBigCraft.registerTrophies();
}
if (Loader.isModLoaded("RandomMobsMod")) {
System.out.println("Random Mobs Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Random Mobs Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Random Mobs Mod");
e.printStackTrace(System.err);
}
RandomMobsMod.registerTrophies();
}
if (Loader.isModLoaded("SpecialMobs")) {
System.out.println("FatherToast Special Mobs Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded FatherToast Special Mobs Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load FatherToast Special Mobs Mod");
e.printStackTrace(System.err);
}
FatherToastSpecialMobs.registerTrophies();
}
if (Loader.isModLoaded("dungeonmobs")) {
System.out.println("Dungeon Mobs Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Dungeon Mobs Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Dungeon Mobs Mod");
e.printStackTrace(System.err);
}
DungeonMobs.registerTrophies();
}
if (Loader.isModLoaded("InventoryPets")) {
System.out.println("Inventory Pets Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Inventory Pets Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Inventory Pets Mod");
e.printStackTrace(System.err);
}
InventoryPets.registerTrophies();
}
if (Loader.isModLoaded("fossilsarcheology")) {
System.out.println("Fossils and Archeology Revival Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Fossils and Archeology Revival Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Fossils and Archeology Revival Mod");
e.printStackTrace(System.err);
}
FossilsandArcheologyRevival.registerTrophies();
}
if (Loader.isModLoaded("crazyores")) {
System.out.println("CrazyOres Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded CrazyOres Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load CrazyOres Mod");
e.printStackTrace(System.err);
}
CrazyOres.registerTrophies();
}
if (Loader.isModLoaded("pixelmon")) {
System.out.println("Pixelmon Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Pixelmon Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Pixelmon Mod");
e.printStackTrace(System.err);
}
Pixelmon.registerTrophies();
}
if (Loader.isModLoaded("backportmod")) {
System.out.println("Backport Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Backport Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Backport Mod");
e.printStackTrace(System.err);
}
BackportMod.registerTrophies();
}
if (Loader.isModLoaded("dinodim")) {
System.out.println("DinoDimension Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded DinoDimension Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load DinoDimension Mod");
e.printStackTrace(System.err);
}
DinoDimension.registerTrophies();
}
if (Loader.isModLoaded("TConstruct")) {
System.out.println("Tinkers Construct Mod Loaded");
try {
LogHelper.log(Level.INFO, "Loaded Tinkers Construct Mod");
}
catch (Exception e) {
LogHelper.log(Level.WARN, "Could not load Tinkers Construct Mod");
e.printStackTrace(System.err);
}
TConstruct.registerTrophies();
}
}
@Mod.EventHandler
public void postInit(FMLPostInitializationEvent event) {
{
}
}
@EventHandler
public void serverStart(FMLServerStartingEvent event)
{
MinecraftServer server = MinecraftServer.getServer();
// Get's the current server instance
ICommandManager command = server.getCommandManager();
//ServerCommandManager manager = (ServerCommandManager) command;
//manager.registerCommand(new CommandModInfo());
//manager.registerCommand(new CommandChangelog());
}
}
| 31,433 | 0.650876 | 0.643368 | 961 | 30.708637 | 26.25946 | 138 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.566077 | false | false |
12
|
09637e730a283dd2e50e1b3c278cbad937186c35
| 17,179,934,307 |
d9b6f98afec907faa5fc2bc0cb951930092b4d34
|
/src/main/java/cn/zjdyms/spring/io/Resource.java
|
56d385007e644a926f5acf29f259ca19f5581236
|
[] |
no_license
|
zjdym/spring-core
|
https://github.com/zjdym/spring-core
|
7ea88bb01865545b32af00c294adb319741cf6ad
|
16607a74baebbf9dc7027424409592bed25cad00
|
refs/heads/master
| 2021-08-20T06:59:45.192000 | 2017-11-28T13:03:08 | 2017-11-28T13:03:08 | 106,690,471 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package cn.zjdyms.spring.io;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URL;
/**
* 通用的文件处理,各种资源统一整合,不仅仅处理文件系统的文件,还能整合处理各类
* @author alen
*
*/
public interface Resource extends InputStreamSource{
//是否存在
/**
* 资源是否存在
* @return
*/
boolean isExit();
//是否可读
/**
* 资源是否可读
* @return
*/
boolean isReadable();
//是否打开
/**
* 资源是否已经处于打开状态
* @return
*/
boolean isOpen();
//uri
/**
* 获取资源的URI
* @return
*/
URI getURI() throws IOException;
//url
/**
* 获取资源的URL
* @return
*/
URL getURL() throws IOException;
//获取文件
/**
* 获取资源文件,如果不存在文件系统中返回null
* @return
*/
File getFile() throws IOException;
//可读资源的长度
/**
* 获取资源可读长度
* @return
*/
long getContentLength() throws IOException;
//上次修改的时间
/**
* 获取资源上一次修改的时间
* @return
*/
long getLastModfied() throws IOException;
//创建一个相关文件
/**
* 创建一个
* @param relateName
* @return
* @throws
*/
Resource createRelationResource(String relateName) throws IOException;
//获取文件名
/**
* 获取文件名,
* 如果不存在文件名的资源可以返回null
* @return 返回资源的文件名
*/
String getFileName();
//获取描述
/**
* 返回该资源的描述,可用于当资源发生异常时间的输出标识
* @return 返回资源的描述
*/
String getDescription();
}
|
UTF-8
|
Java
| 1,666 |
java
|
Resource.java
|
Java
|
[
{
"context": " 通用的文件处理,各种资源统一整合,不仅仅处理文件系统的文件,还能整合处理各类\n * @author alen\n *\n */\npublic interface Resource extends InputStr",
"end": 183,
"score": 0.9991146326065063,
"start": 179,
"tag": "USERNAME",
"value": "alen"
}
] | null |
[] |
package cn.zjdyms.spring.io;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URL;
/**
* 通用的文件处理,各种资源统一整合,不仅仅处理文件系统的文件,还能整合处理各类
* @author alen
*
*/
public interface Resource extends InputStreamSource{
//是否存在
/**
* 资源是否存在
* @return
*/
boolean isExit();
//是否可读
/**
* 资源是否可读
* @return
*/
boolean isReadable();
//是否打开
/**
* 资源是否已经处于打开状态
* @return
*/
boolean isOpen();
//uri
/**
* 获取资源的URI
* @return
*/
URI getURI() throws IOException;
//url
/**
* 获取资源的URL
* @return
*/
URL getURL() throws IOException;
//获取文件
/**
* 获取资源文件,如果不存在文件系统中返回null
* @return
*/
File getFile() throws IOException;
//可读资源的长度
/**
* 获取资源可读长度
* @return
*/
long getContentLength() throws IOException;
//上次修改的时间
/**
* 获取资源上一次修改的时间
* @return
*/
long getLastModfied() throws IOException;
//创建一个相关文件
/**
* 创建一个
* @param relateName
* @return
* @throws
*/
Resource createRelationResource(String relateName) throws IOException;
//获取文件名
/**
* 获取文件名,
* 如果不存在文件名的资源可以返回null
* @return 返回资源的文件名
*/
String getFileName();
//获取描述
/**
* 返回该资源的描述,可用于当资源发生异常时间的输出标识
* @return 返回资源的描述
*/
String getDescription();
}
| 1,666 | 0.62785 | 0.62785 | 92 | 12.347826 | 12.636588 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.076087 | false | false |
12
|
37939d3c6fb5d3055ae5fcfcd94c9d19b5e895b1
| 19,335,942,824,285 |
ad195ca16744602d9b5b66349126d8b8284bcc88
|
/src/com/company/lab10_ex02.java
|
ce11950b01abe39b20844f15b631977cdb9f32d2
|
[] |
no_license
|
quetion667/laba10_11_java
|
https://github.com/quetion667/laba10_11_java
|
f54e0958651809166a0bec14515861b143a0eea2
|
260dc71a0689f064b613da2acf8835dd2b319cc7
|
refs/heads/master
| 2022-10-05T15:24:16.790000 | 2020-06-08T04:06:16 | 2020-06-08T04:06:16 | 270,521,220 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.company;
import java.io.ByteArrayInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
public class lab10_ex02 {
public static void readAllByte(InputStream in) throws IOException {
while (true) {
int oneByte = in.read();
if (oneByte != -1) {
System.out.print((char) oneByte);
}
else
{
System.out.println("\n" + "end");
break;
}
}
}
public static void main(String[] args) throws IOException {
try {
// С потоком связан файл
InputStream inFile = new FileInputStream("C:/lab10_2.txt"); // файл предварительно заполнен
readAllByte(inFile);
System.out.print("\n\n\n");
inFile.close();
// С потоком связана страница
InputStream inUrl = (new URL("http://cat.rtf.urfu.ru/")).openStream();
readAllByte(inUrl);
System.out.print("\n\n\n");
inUrl.close();
// С потоком связан массив
ByteArrayInputStream inArray = new ByteArrayInputStream(new byte[]{7, 9, 3, 7, 4});
readAllByte(inArray);
System.out.print("\n\n\n");
inArray.close();
}
catch (IOException e)
{
System.out.println("Error: " + e);
}
}
}
//
|
UTF-8
|
Java
| 1,608 |
java
|
lab10_ex02.java
|
Java
|
[] | null |
[] |
package com.company;
import java.io.ByteArrayInputStream;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
public class lab10_ex02 {
public static void readAllByte(InputStream in) throws IOException {
while (true) {
int oneByte = in.read();
if (oneByte != -1) {
System.out.print((char) oneByte);
}
else
{
System.out.println("\n" + "end");
break;
}
}
}
public static void main(String[] args) throws IOException {
try {
// С потоком связан файл
InputStream inFile = new FileInputStream("C:/lab10_2.txt"); // файл предварительно заполнен
readAllByte(inFile);
System.out.print("\n\n\n");
inFile.close();
// С потоком связана страница
InputStream inUrl = (new URL("http://cat.rtf.urfu.ru/")).openStream();
readAllByte(inUrl);
System.out.print("\n\n\n");
inUrl.close();
// С потоком связан массив
ByteArrayInputStream inArray = new ByteArrayInputStream(new byte[]{7, 9, 3, 7, 4});
readAllByte(inArray);
System.out.print("\n\n\n");
inArray.close();
}
catch (IOException e)
{
System.out.println("Error: " + e);
}
}
}
//
| 1,608 | 0.506246 | 0.497699 | 48 | 29.479166 | 23.028957 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5625 | false | false |
12
|
023e5ec774a60b7976636c153c03e2a8e4abac6f
| 6,184,752,922,228 |
352f01386b6ccbe037abb4d9017d78ee9ec9c1f9
|
/webShop/src/main/java/hr/java/web/radanovic/webShop/repository/HibSellerRep.java
|
ee413ed5daf431f3bd279f51affb875f44aff4c9
|
[] |
no_license
|
dradanovi/webshopproject
|
https://github.com/dradanovi/webshopproject
|
ab69206fcd0e83cecafa118127e935f3a8a4fbbf
|
f52c3c493dcd8e91bb5794421b1db3f2b92f1c03
|
refs/heads/master
| 2022-10-16T22:26:47.437000 | 2020-06-11T19:14:55 | 2020-06-11T19:14:55 | 268,174,079 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package hr.java.web.radanovic.webShop.repository;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
import javax.persistence.PersistenceContext;
import javax.persistence.StoredProcedureQuery;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import javax.transaction.Transactional;
import org.springframework.stereotype.Repository;
import hr.java.web.radanovic.webShop.model.AppUser;
import hr.java.web.radanovic.webShop.model.Seller;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@Repository
@Transactional
public class HibSellerRep implements RepSeller {
@PersistenceContext
private EntityManager em;
@Override
public <S extends Seller> S save(S entity) {
log.info("persist " + entity.toString());
em.persist(entity);
return entity;
}
public <S extends Seller> S update(S entity) {
log.info("merge " + entity.toString());
em.merge(entity);
return entity;
}
@Override
public <S extends Seller> Iterable<S> saveAll(Iterable<S> entities) {
entities.forEach(e -> em.persist(e));
return entities;
}
@Override
public Optional<Seller> findById(Long id) {
return Optional.ofNullable(em.find(Seller.class, id));
}
@Override
public boolean existsById(Long id) {
if (em.find(Seller.class, id) != null) {
return true;
}
return false;
}
public boolean existsByUser(AppUser user) {
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Seller> cq = cb.createQuery(Seller.class);
Root<Seller> root = cq.from(Seller.class);
cq.where(cb.equal(root.get("user"), user));
if (em.createQuery(cq).getResultList().size() > 0)
return true;
else
return false;
}
@Override
public Iterable<Seller> findAll() {
return em.createQuery("from Seller", Seller.class).getResultList();
}
@Override
public Iterable<Seller> findAllById(Iterable<Long> ids) {
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Seller> cq = cb.createQuery(Seller.class);
Root<Seller> root = cq.from(Seller.class);
List<Predicate> predicates = new ArrayList<>();
ids.forEach(e -> predicates.add(cb.equal(root.get("id"), e)));
cq.where(cb.or(predicates.toArray(new Predicate[] {})));
return em.createQuery(cq).getResultList();
}
@Override
public long count() {
// TODO Auto-generated method stub
return 0;
}
@Override
public void deleteById(Long id) {
em.remove(findById(id));
}
@Override
public void delete(Seller entity) {
em.remove(entity);
}
@Override
public void deleteAll(Iterable<? extends Seller> entities) {
entities.forEach(e -> em.remove(e));
}
@Override
public void deleteAll() {
findAll().forEach(e -> em.remove(e));
}
@Override
public Optional<Seller> findByUser(AppUser user) {
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Seller> cq = cb.createQuery(Seller.class);
Root<Seller> root = cq.from(Seller.class);
cq.where(cb.equal(root.get("user"), user));
try {
return Optional.ofNullable(em.createQuery(cq).getSingleResult());
} catch (NoResultException e) {
log.info("NoResultException -> seller by user");
e.printStackTrace();
return Optional.empty();
}
}
public boolean recalculateRating() {
StoredProcedureQuery spQuery = em.createNamedStoredProcedureQuery("recalculateratings");
return spQuery.execute();
}
}
|
UTF-8
|
Java
| 3,654 |
java
|
HibSellerRep.java
|
Java
|
[] | null |
[] |
package hr.java.web.radanovic.webShop.repository;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
import javax.persistence.PersistenceContext;
import javax.persistence.StoredProcedureQuery;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import javax.transaction.Transactional;
import org.springframework.stereotype.Repository;
import hr.java.web.radanovic.webShop.model.AppUser;
import hr.java.web.radanovic.webShop.model.Seller;
import lombok.extern.slf4j.Slf4j;
@Slf4j
@Repository
@Transactional
public class HibSellerRep implements RepSeller {
@PersistenceContext
private EntityManager em;
@Override
public <S extends Seller> S save(S entity) {
log.info("persist " + entity.toString());
em.persist(entity);
return entity;
}
public <S extends Seller> S update(S entity) {
log.info("merge " + entity.toString());
em.merge(entity);
return entity;
}
@Override
public <S extends Seller> Iterable<S> saveAll(Iterable<S> entities) {
entities.forEach(e -> em.persist(e));
return entities;
}
@Override
public Optional<Seller> findById(Long id) {
return Optional.ofNullable(em.find(Seller.class, id));
}
@Override
public boolean existsById(Long id) {
if (em.find(Seller.class, id) != null) {
return true;
}
return false;
}
public boolean existsByUser(AppUser user) {
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Seller> cq = cb.createQuery(Seller.class);
Root<Seller> root = cq.from(Seller.class);
cq.where(cb.equal(root.get("user"), user));
if (em.createQuery(cq).getResultList().size() > 0)
return true;
else
return false;
}
@Override
public Iterable<Seller> findAll() {
return em.createQuery("from Seller", Seller.class).getResultList();
}
@Override
public Iterable<Seller> findAllById(Iterable<Long> ids) {
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Seller> cq = cb.createQuery(Seller.class);
Root<Seller> root = cq.from(Seller.class);
List<Predicate> predicates = new ArrayList<>();
ids.forEach(e -> predicates.add(cb.equal(root.get("id"), e)));
cq.where(cb.or(predicates.toArray(new Predicate[] {})));
return em.createQuery(cq).getResultList();
}
@Override
public long count() {
// TODO Auto-generated method stub
return 0;
}
@Override
public void deleteById(Long id) {
em.remove(findById(id));
}
@Override
public void delete(Seller entity) {
em.remove(entity);
}
@Override
public void deleteAll(Iterable<? extends Seller> entities) {
entities.forEach(e -> em.remove(e));
}
@Override
public void deleteAll() {
findAll().forEach(e -> em.remove(e));
}
@Override
public Optional<Seller> findByUser(AppUser user) {
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<Seller> cq = cb.createQuery(Seller.class);
Root<Seller> root = cq.from(Seller.class);
cq.where(cb.equal(root.get("user"), user));
try {
return Optional.ofNullable(em.createQuery(cq).getSingleResult());
} catch (NoResultException e) {
log.info("NoResultException -> seller by user");
e.printStackTrace();
return Optional.empty();
}
}
public boolean recalculateRating() {
StoredProcedureQuery spQuery = em.createNamedStoredProcedureQuery("recalculateratings");
return spQuery.execute();
}
}
| 3,654 | 0.705254 | 0.703886 | 138 | 24.47826 | 21.71162 | 90 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.543478 | false | false |
12
|
f7d882fe05ace4dce2856056993863ca180d9f66
| 27,668,179,330,657 |
eec70bee2aacbbf3ab8263b92b8938bda57cb8d0
|
/app/src/main/java/com/example/capstoneproject/widget/SubjectWidget.java
|
f6847fd9e2ff7c352d3f649881dedd4c3e1dfccd
|
[] |
no_license
|
Arta0613/CapstoneProject
|
https://github.com/Arta0613/CapstoneProject
|
928627fa226185deba8246d86aec61c60220f791
|
88b178b88ff8aae1b7aa05284aa6c1452d0fffb1
|
refs/heads/master
| 2022-12-27T21:54:11.723000 | 2020-06-08T01:21:42 | 2020-06-08T01:21:42 | 267,477,036 | 0 | 0 | null | false | 2020-10-02T21:27:09 | 2020-05-28T02:45:28 | 2020-06-08T01:21:55 | 2020-10-02T21:27:09 | 590 | 0 | 0 | 0 |
Java
| false | false |
package com.example.capstoneproject.widget;
import android.app.PendingIntent;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.Context;
import android.content.Intent;
import android.util.TypedValue;
import android.widget.RemoteViews;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import com.example.capstoneproject.R;
import com.example.capstoneproject.WaniReferenceApplication;
import com.example.capstoneproject.database.entities.LevelEntity;
import com.example.capstoneproject.database.entities.SubjectTypeEntity;
import com.example.capstoneproject.repository.WaniRepository;
import com.example.capstoneproject.ui.MainActivity;
import com.example.capstoneproject.utils.AppExecutors;
import com.example.capstoneproject.utils.SubjectHelper;
import java.util.List;
import java.util.Random;
import io.reactivex.disposables.CompositeDisposable;
/**
* Implementation of App Widget functionality.
*/
public class SubjectWidget extends AppWidgetProvider {
private final static CompositeDisposable disposable = new CompositeDisposable();
@Override
public void onUpdate(
@NonNull final Context context,
@NonNull final AppWidgetManager appWidgetManager,
@NonNull final int[] appWidgetIds
) {
// There may be multiple widgets active, so update all of them
for (int appWidgetId : appWidgetIds) {
updateAppWidget(context, appWidgetManager, appWidgetId);
}
}
@Override
public void onEnabled(@NonNull final Context context) {
// Enter relevant functionality for when the first widget is created
}
@Override
public void onDisabled(@NonNull final Context context) {
// Enter relevant functionality for when the last widget is disabled
}
@NonNull
private static PendingIntent getPendingIntent(@NonNull final Context context) {
// TODO: Potentially pass in Subject in bundle and deeplink to detail activity of selected subject
return PendingIntent.getActivity(context, 0, new Intent(context, MainActivity.class), 0);
}
private static void updateAppWidget(
@NonNull final Context context,
@NonNull final AppWidgetManager appWidgetManager,
final int appWidgetId
) {
final WaniRepository repository = ((WaniReferenceApplication) context.getApplicationContext()).getAppContainer().getWaniRepository();
AppExecutors.getInstance().getDiskIO().execute(() -> {
final List<LevelEntity> levelEntities = repository.loadLocalLevelsSynchronous();
if (levelEntities.size() != 0) {
final Random random = new Random();
final int randomLevel = random.nextInt(levelEntities.size());
final int randomSubjectType = random.nextInt(3);
List<SubjectTypeEntity> subjectTypeEntityList;
switch (randomSubjectType) {
case 1:
subjectTypeEntityList = levelEntities.get(randomLevel).getKanjiList();
break;
case 2:
subjectTypeEntityList = levelEntities.get(randomLevel).getVocabularyList();
break;
default:
subjectTypeEntityList = levelEntities.get(randomLevel).getRadicalList();
}
final int randomSubject = random.nextInt(subjectTypeEntityList.size());
final SubjectTypeEntity randomSubjectTypeEntity = subjectTypeEntityList.get(randomSubject);
updateRemoveViews(context, randomSubjectTypeEntity, appWidgetManager, appWidgetId);
} else {
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.subject_widget);
changeRemoteViewTextAttributes(views, context);
views.setOnClickPendingIntent(R.id.subject_widget, getPendingIntent(context));
appWidgetManager.updateAppWidget(appWidgetId, views);
}
});
}
private static void updateRemoveViews(
@NonNull final Context context,
@NonNull final SubjectTypeEntity subjectTypeEntity,
@NonNull final AppWidgetManager appWidgetManager,
final int appWidgetId
) {
CharSequence widgetSubjectMeaning = subjectTypeEntity.getMeaning();
CharSequence widgetSubjectCharacters = subjectTypeEntity.getCharacters();
// Construct the RemoteViews object
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.subject_widget);
final int color = SubjectHelper.getColor(subjectTypeEntity.getSubjectType());
views.setInt(R.id.subject_widget, "setBackgroundColor", ContextCompat.getColor(context, color));
views.setTextViewText(R.id.subject_meaning, widgetSubjectMeaning);
views.setTextViewText(R.id.subject_characters, widgetSubjectCharacters);
if (subjectTypeEntity.getCharacters().isEmpty()) {
views.setTextViewText(R.id.subject_characters, context.getString(R.string.unavailable_radical));
changeRemoteViewTextAttributes(views, context);
}
views.setOnClickPendingIntent(R.id.subject_widget, getPendingIntent(context));
// Instruct the widget manager to update the widget
appWidgetManager.updateAppWidget(appWidgetId, views);
}
private static void changeRemoteViewTextAttributes(
@NonNull final RemoteViews views, @NonNull final Context context
) {
views.setInt(R.id.subject_widget, "setBackgroundColor", ContextCompat.getColor(context, R.color.colorAccent));
views.setTextViewTextSize(R.id.subject_characters, TypedValue.COMPLEX_UNIT_SP, 24);
views.setBoolean(R.id.subject_characters, "setSingleLine", false);
}
}
|
UTF-8
|
Java
| 5,944 |
java
|
SubjectWidget.java
|
Java
|
[] | null |
[] |
package com.example.capstoneproject.widget;
import android.app.PendingIntent;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProvider;
import android.content.Context;
import android.content.Intent;
import android.util.TypedValue;
import android.widget.RemoteViews;
import androidx.annotation.NonNull;
import androidx.core.content.ContextCompat;
import com.example.capstoneproject.R;
import com.example.capstoneproject.WaniReferenceApplication;
import com.example.capstoneproject.database.entities.LevelEntity;
import com.example.capstoneproject.database.entities.SubjectTypeEntity;
import com.example.capstoneproject.repository.WaniRepository;
import com.example.capstoneproject.ui.MainActivity;
import com.example.capstoneproject.utils.AppExecutors;
import com.example.capstoneproject.utils.SubjectHelper;
import java.util.List;
import java.util.Random;
import io.reactivex.disposables.CompositeDisposable;
/**
* Implementation of App Widget functionality.
*/
public class SubjectWidget extends AppWidgetProvider {
private final static CompositeDisposable disposable = new CompositeDisposable();
@Override
public void onUpdate(
@NonNull final Context context,
@NonNull final AppWidgetManager appWidgetManager,
@NonNull final int[] appWidgetIds
) {
// There may be multiple widgets active, so update all of them
for (int appWidgetId : appWidgetIds) {
updateAppWidget(context, appWidgetManager, appWidgetId);
}
}
@Override
public void onEnabled(@NonNull final Context context) {
// Enter relevant functionality for when the first widget is created
}
@Override
public void onDisabled(@NonNull final Context context) {
// Enter relevant functionality for when the last widget is disabled
}
@NonNull
private static PendingIntent getPendingIntent(@NonNull final Context context) {
// TODO: Potentially pass in Subject in bundle and deeplink to detail activity of selected subject
return PendingIntent.getActivity(context, 0, new Intent(context, MainActivity.class), 0);
}
private static void updateAppWidget(
@NonNull final Context context,
@NonNull final AppWidgetManager appWidgetManager,
final int appWidgetId
) {
final WaniRepository repository = ((WaniReferenceApplication) context.getApplicationContext()).getAppContainer().getWaniRepository();
AppExecutors.getInstance().getDiskIO().execute(() -> {
final List<LevelEntity> levelEntities = repository.loadLocalLevelsSynchronous();
if (levelEntities.size() != 0) {
final Random random = new Random();
final int randomLevel = random.nextInt(levelEntities.size());
final int randomSubjectType = random.nextInt(3);
List<SubjectTypeEntity> subjectTypeEntityList;
switch (randomSubjectType) {
case 1:
subjectTypeEntityList = levelEntities.get(randomLevel).getKanjiList();
break;
case 2:
subjectTypeEntityList = levelEntities.get(randomLevel).getVocabularyList();
break;
default:
subjectTypeEntityList = levelEntities.get(randomLevel).getRadicalList();
}
final int randomSubject = random.nextInt(subjectTypeEntityList.size());
final SubjectTypeEntity randomSubjectTypeEntity = subjectTypeEntityList.get(randomSubject);
updateRemoveViews(context, randomSubjectTypeEntity, appWidgetManager, appWidgetId);
} else {
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.subject_widget);
changeRemoteViewTextAttributes(views, context);
views.setOnClickPendingIntent(R.id.subject_widget, getPendingIntent(context));
appWidgetManager.updateAppWidget(appWidgetId, views);
}
});
}
private static void updateRemoveViews(
@NonNull final Context context,
@NonNull final SubjectTypeEntity subjectTypeEntity,
@NonNull final AppWidgetManager appWidgetManager,
final int appWidgetId
) {
CharSequence widgetSubjectMeaning = subjectTypeEntity.getMeaning();
CharSequence widgetSubjectCharacters = subjectTypeEntity.getCharacters();
// Construct the RemoteViews object
RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.subject_widget);
final int color = SubjectHelper.getColor(subjectTypeEntity.getSubjectType());
views.setInt(R.id.subject_widget, "setBackgroundColor", ContextCompat.getColor(context, color));
views.setTextViewText(R.id.subject_meaning, widgetSubjectMeaning);
views.setTextViewText(R.id.subject_characters, widgetSubjectCharacters);
if (subjectTypeEntity.getCharacters().isEmpty()) {
views.setTextViewText(R.id.subject_characters, context.getString(R.string.unavailable_radical));
changeRemoteViewTextAttributes(views, context);
}
views.setOnClickPendingIntent(R.id.subject_widget, getPendingIntent(context));
// Instruct the widget manager to update the widget
appWidgetManager.updateAppWidget(appWidgetId, views);
}
private static void changeRemoteViewTextAttributes(
@NonNull final RemoteViews views, @NonNull final Context context
) {
views.setInt(R.id.subject_widget, "setBackgroundColor", ContextCompat.getColor(context, R.color.colorAccent));
views.setTextViewTextSize(R.id.subject_characters, TypedValue.COMPLEX_UNIT_SP, 24);
views.setBoolean(R.id.subject_characters, "setSingleLine", false);
}
}
| 5,944 | 0.698351 | 0.697005 | 138 | 42.079712 | 34.519699 | 141 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.695652 | false | false |
12
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.