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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0ef4503cd2fda1e36657eba21bb8750ce2503d10
| 32,487,132,673,239 |
73601deb01f3c3f90fbe6346c5d407653431609a
|
/First_Step/data/202/4/submittedfiles/ReactorPlanner.java
|
a3e8c3e82b777e113612c47f8853a2909256b632
|
[] |
no_license
|
Benjam73/ComplexityAnalyzer
|
https://github.com/Benjam73/ComplexityAnalyzer
|
145fbac896ac18e6239791a636fe871efc3de332
|
27a0f1d5528ee66f2913b18137425aae59d06b0f
|
refs/heads/master
| 2020-03-17T09:25:31.308000 | 2018-07-20T13:34:17 | 2018-07-20T13:34:17 | 133,474,612 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
* A class to represent the reactor planner.
*/
public class ReactorPlanner {
/**
* A table of integers to model the profit for each time period
**/
private int[] p;
/**
* Constructor by data
***/
public ReactorPlanner(int[] p) {
this.p = new int[p.length];
for (int i = 0; i < p.length; i++) {
this.p[i] = p[i];
}
}
/**
* returns the maximum profit
**/
public int maxProfit(){
//TODO
int somme=0;
int max=0;
for(int i=0;i<this.p.length;i++){
somme=this.p[i];
if(somme>max){
max=somme;
}
for(int j=i+1;j<this.p.length;j++){
somme=somme+this.p[j];
if(somme>max){
max=somme;
}
}
}
return(max);
}
}
|
UTF-8
|
Java
| 904 |
java
|
ReactorPlanner.java
|
Java
|
[] | null |
[] |
/**
* A class to represent the reactor planner.
*/
public class ReactorPlanner {
/**
* A table of integers to model the profit for each time period
**/
private int[] p;
/**
* Constructor by data
***/
public ReactorPlanner(int[] p) {
this.p = new int[p.length];
for (int i = 0; i < p.length; i++) {
this.p[i] = p[i];
}
}
/**
* returns the maximum profit
**/
public int maxProfit(){
//TODO
int somme=0;
int max=0;
for(int i=0;i<this.p.length;i++){
somme=this.p[i];
if(somme>max){
max=somme;
}
for(int j=i+1;j<this.p.length;j++){
somme=somme+this.p[j];
if(somme>max){
max=somme;
}
}
}
return(max);
}
}
| 904 | 0.419248 | 0.413717 | 44 | 19.568182 | 15.436671 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.363636 | false | false |
13
|
5bbf9b528a9d72a1bd9f81a07c748f1739fe4f7d
| 32,950,989,098,168 |
4f2d3a643c948b89239e25e0019b5b490a2b7817
|
/src/main/java/com/appointment/api/message/request/merchant/MerchantUpdateRequest.java
|
3d23101af7fe3f410861f006f0ca569bda8e4ff9
|
[] |
no_license
|
bungleon/appointment-api
|
https://github.com/bungleon/appointment-api
|
c8ad2d89f9390599b77bdc797dd955a3fe1e0b9e
|
e70172282f99215faebc965101c7dd46a04d1e91
|
refs/heads/master
| 2020-03-25T04:58:54.722000 | 2018-09-27T11:41:03 | 2018-09-27T11:41:03 | 143,423,290 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.appointment.api.message.request.merchant;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.UUID;
@Getter
@Setter
public class MerchantUpdateRequest {
@NotNull
private UUID id;
@NotEmpty
private String apiKey;
@NotEmpty
private String secretKey;
@NotEmpty
private String name;
private Integer workingRange;
private Boolean enabled = true;
}
|
UTF-8
|
Java
| 498 |
java
|
MerchantUpdateRequest.java
|
Java
|
[] | null |
[] |
package com.appointment.api.message.request.merchant;
import lombok.Getter;
import lombok.Setter;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.UUID;
@Getter
@Setter
public class MerchantUpdateRequest {
@NotNull
private UUID id;
@NotEmpty
private String apiKey;
@NotEmpty
private String secretKey;
@NotEmpty
private String name;
private Integer workingRange;
private Boolean enabled = true;
}
| 498 | 0.75502 | 0.75502 | 23 | 20.652174 | 15.006111 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.521739 | false | false |
13
|
3739c8f428866f63cc421f1395c6aeccc0545510
| 20,109,036,918,894 |
7422826c8e8949c41928dd935640a754d1ef5778
|
/src/main/java/org/example/jsonpath/psi/JsonPathElementType.java
|
926fc39cc6aff53af0d91ee71bfe2eaeddfeb198
|
[] |
no_license
|
jreznot/intellij-plugin-showcase
|
https://github.com/jreznot/intellij-plugin-showcase
|
a3cd09f19f0e097fa1b8ee6ed1e26f3c6f3ea862
|
399479214bd251f5ceb954da4131e5cdd2e59c9a
|
refs/heads/master
| 2023-03-22T15:27:41.615000 | 2021-03-11T09:40:15 | 2021-03-11T09:40:15 | 342,031,772 | 7 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.example.jsonpath.psi;
import com.intellij.psi.tree.IElementType;
import org.example.jsonpath.JsonPathLanguage;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
public final class JsonPathElementType extends IElementType {
public JsonPathElementType(@NotNull @NonNls String debugName) {
super(debugName, JsonPathLanguage.INSTANCE);
}
}
|
UTF-8
|
Java
| 399 |
java
|
JsonPathElementType.java
|
Java
|
[] | null |
[] |
package org.example.jsonpath.psi;
import com.intellij.psi.tree.IElementType;
import org.example.jsonpath.JsonPathLanguage;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
public final class JsonPathElementType extends IElementType {
public JsonPathElementType(@NotNull @NonNls String debugName) {
super(debugName, JsonPathLanguage.INSTANCE);
}
}
| 399 | 0.802005 | 0.802005 | 12 | 32.25 | 23.48448 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.583333 | false | false |
13
|
55bd0bdd831a971e08e1cd4826ceb44756c7c939
| 19,988,777,797,227 |
5c4c896a67e7e43f29cc979f4ed8693c2c4b924e
|
/src/com/metropia/exceptions/RouteNotFoundException.java
|
133ec34da0862ec038dabc805f653f8b46b98fb7
|
[] |
no_license
|
starlessnight/company
|
https://github.com/starlessnight/company
|
9b2383ebf6c3d1004d92872962a07a864a8296be
|
9cfaaa9b881fff3a0534d40300ad375c04b4b416
|
refs/heads/master
| 2021-01-10T03:42:58.952000 | 2015-12-17T05:57:30 | 2015-12-17T05:57:30 | 47,752,310 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.metropia.exceptions;
public class RouteNotFoundException extends SmarTrekException {
/**
* Auto-generated serial UID
*/
private static final long serialVersionUID = -9108407358813009055L;
public RouteNotFoundException() {
super();
}
public RouteNotFoundException(String message) {
super(message);
}
}
|
UTF-8
|
Java
| 332 |
java
|
RouteNotFoundException.java
|
Java
|
[] | null |
[] |
package com.metropia.exceptions;
public class RouteNotFoundException extends SmarTrekException {
/**
* Auto-generated serial UID
*/
private static final long serialVersionUID = -9108407358813009055L;
public RouteNotFoundException() {
super();
}
public RouteNotFoundException(String message) {
super(message);
}
}
| 332 | 0.756024 | 0.698795 | 17 | 18.529411 | 22.376768 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1 | false | false |
13
|
f3b642d4b4bc57e49c01fac455760906613a2786
| 36,816,459,662,278 |
ba79e283842106c317ed4b626c8a34bc765cf6b2
|
/app/src/main/java/com/sauyee333/visatest1/MainActivity.java
|
1b69deaf164209b2feec25baaaac3979235cfcfa
|
[] |
no_license
|
sauyee333/SSLSample
|
https://github.com/sauyee333/SSLSample
|
9fb823e080912716da103e914a05d533d9d79f7c
|
f5b72c3268b2701e5013cf407dd3a1fe60cc5bb5
|
refs/heads/master
| 2021-01-18T17:33:35.040000 | 2016-10-25T22:45:23 | 2016-10-25T22:45:23 | 71,887,722 | 0 | 1 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.sauyee333.visatest1;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.util.Base64;
import android.widget.Button;
import android.widget.TextView;
import com.sauyee333.visatest1.model.response.HelloResponse;
import com.sauyee333.visatest1.network.NetworkCallback;
import com.sauyee333.visatest1.network.RetrofitClient;
import com.sauyee333.visatest1.utils.XPayTokenGenerator;
import java.security.SignatureException;
import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;
public class MainActivity extends AppCompatActivity {
@Bind(R.id.helloToken)
Button helloToken;
@Bind(R.id.results)
TextView results;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
}
@OnClick(R.id.helloToken)
public void helloTokenClickHandler() {
clearResults();
getHelloWorld(false);
}
@OnClick(R.id.helloTwoWalSsl)
public void helloTwoWaySslClickHandler() {
clearResults();
getHelloWorldTwoWaySsl(true);
}
private void clearResults() {
setResults("");
}
private void setResults(String input) {
if (results != null) {
results.setText(input);
}
}
private void getHelloWorld(boolean twoWaySsl) {
String endPoint = "helloworld";
String token = null;
String apiKey = getResources().getString(R.string.apiKey);
String sharedSecret = getResources().getString(R.string.sharedSecret);
try {
token = XPayTokenGenerator.generateXpaytoken(endPoint, "apikey=" + apiKey, "", sharedSecret);
} catch (SignatureException se) {
se.printStackTrace();
}
if (!TextUtils.isEmpty(token)) {
RetrofitClient.getInstance(getApplicationContext(), twoWaySsl).getHelloWorldApi(new NetworkCallback<HelloResponse>() {
@Override
protected void onSuccess(HelloResponse response) {
results.setText(response.getTimestamp() + " " + response.getMessage());
}
@Override
protected void onFailure(boolean isNetworkFailure, String responseDetails, String responseStatus) {
}
}, "application/json", token, apiKey);
}
}
private void getHelloWorldTwoWaySsl(boolean twoWaySsl) {
String username = getResources().getString(R.string.userid);
String password = getResources().getString(R.string.password);
String credentials = username + ":" + password;
final String basic = "Basic " + Base64.encodeToString(credentials.getBytes(), Base64.NO_WRAP);
if (!TextUtils.isEmpty(basic)) {
RetrofitClient.getInstance(getApplicationContext(), twoWaySsl).getHelloWorldTwoWaySsl(new NetworkCallback<HelloResponse>() {
@Override
protected void onSuccess(HelloResponse response) {
results.setText(response.getMessage());
}
@Override
protected void onFailure(boolean isNetworkFailure, String responseDetails, String responseStatus) {
}
}, null, basic);
}
}
}
|
UTF-8
|
Java
| 3,416 |
java
|
MainActivity.java
|
Java
|
[
{
"context": "visatest1.network.NetworkCallback;\nimport com.sauyee333.visatest1.network.RetrofitClient;\nimport com.sa",
"end": 366,
"score": 0.7412394881248474,
"start": 363,
"tag": "USERNAME",
"value": "ee3"
}
] | null |
[] |
package com.sauyee333.visatest1;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.util.Base64;
import android.widget.Button;
import android.widget.TextView;
import com.sauyee333.visatest1.model.response.HelloResponse;
import com.sauyee333.visatest1.network.NetworkCallback;
import com.sauyee333.visatest1.network.RetrofitClient;
import com.sauyee333.visatest1.utils.XPayTokenGenerator;
import java.security.SignatureException;
import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;
public class MainActivity extends AppCompatActivity {
@Bind(R.id.helloToken)
Button helloToken;
@Bind(R.id.results)
TextView results;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ButterKnife.bind(this);
}
@OnClick(R.id.helloToken)
public void helloTokenClickHandler() {
clearResults();
getHelloWorld(false);
}
@OnClick(R.id.helloTwoWalSsl)
public void helloTwoWaySslClickHandler() {
clearResults();
getHelloWorldTwoWaySsl(true);
}
private void clearResults() {
setResults("");
}
private void setResults(String input) {
if (results != null) {
results.setText(input);
}
}
private void getHelloWorld(boolean twoWaySsl) {
String endPoint = "helloworld";
String token = null;
String apiKey = getResources().getString(R.string.apiKey);
String sharedSecret = getResources().getString(R.string.sharedSecret);
try {
token = XPayTokenGenerator.generateXpaytoken(endPoint, "apikey=" + apiKey, "", sharedSecret);
} catch (SignatureException se) {
se.printStackTrace();
}
if (!TextUtils.isEmpty(token)) {
RetrofitClient.getInstance(getApplicationContext(), twoWaySsl).getHelloWorldApi(new NetworkCallback<HelloResponse>() {
@Override
protected void onSuccess(HelloResponse response) {
results.setText(response.getTimestamp() + " " + response.getMessage());
}
@Override
protected void onFailure(boolean isNetworkFailure, String responseDetails, String responseStatus) {
}
}, "application/json", token, apiKey);
}
}
private void getHelloWorldTwoWaySsl(boolean twoWaySsl) {
String username = getResources().getString(R.string.userid);
String password = getResources().getString(R.string.password);
String credentials = username + ":" + password;
final String basic = "Basic " + Base64.encodeToString(credentials.getBytes(), Base64.NO_WRAP);
if (!TextUtils.isEmpty(basic)) {
RetrofitClient.getInstance(getApplicationContext(), twoWaySsl).getHelloWorldTwoWaySsl(new NetworkCallback<HelloResponse>() {
@Override
protected void onSuccess(HelloResponse response) {
results.setText(response.getMessage());
}
@Override
protected void onFailure(boolean isNetworkFailure, String responseDetails, String responseStatus) {
}
}, null, basic);
}
}
}
| 3,416 | 0.655738 | 0.647834 | 101 | 32.821781 | 30.161085 | 136 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.544554 | false | false |
9
|
f74c6c1f9b1500ca0944a68d567c3c20ee4e226c
| 34,368,328,306,085 |
ae305e27c510074b090d5b979b0ce8ff0c930ba4
|
/Prg9.java
|
823d56a87d6a0f092345e7f20dc8bb623d0eeff9
|
[] |
no_license
|
gaurav09kumar/Selenium
|
https://github.com/gaurav09kumar/Selenium
|
62ed4c245d34bd6f0c6bc4c24cdbb5fc021c0574
|
8abcf7e3367a3887676d0c0622e7fa57bab12a17
|
refs/heads/master
| 2020-06-18T03:22:51.429000 | 2019-07-19T05:10:59 | 2019-07-19T05:10:59 | 196,148,943 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package demo;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class Prg5 {
public static void main(String [] args) {
System.setProperty("webdriver.chrome.driver", "C:\\Users\\VSPICT\\Downloads\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("http://opensource-demo.orangehrmlive.com");
driver.findElement(By.xpath("//input[@id='txtUsername']")).sendKeys("Admin");
driver.findElement(By.xpath("//input[@id='txtUsername']/following::input[1]")).sendKeys("admin123");
driver.findElement(By.xpath("//input[@id='txtUsername']/following::input[2]")).click();
driver.findElement(By.xpath("//b[contains(text(),'Admin')]")).click();
List<WebElement> rows = driver.findElements(By.xpath("//tbody/tr"));
//size of the table
System.out.println(rows.size());
//displaying all the items in the table
for(WebElement ele: rows) {
System.out.println(ele.getText());
}
driver.close();
}
}
|
UTF-8
|
Java
| 1,129 |
java
|
Prg9.java
|
Java
|
[
{
"context": "By.xpath(\"//input[@id='txtUsername']\")).sendKeys(\"Admin\");\n\t\tdriver.findElement(By.xpath(\"//input[@id='tx",
"end": 590,
"score": 0.9776889681816101,
"start": 585,
"tag": "USERNAME",
"value": "Admin"
},
{
"context": "d='txtUsername']/following::input[1]\")).sendKeys(\"admin123\");\n\t\tdriver.findElement(By.xpath(\"//input[@id='tx",
"end": 693,
"score": 0.7820523381233215,
"start": 685,
"tag": "USERNAME",
"value": "admin123"
}
] | null |
[] |
package demo;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
public class Prg5 {
public static void main(String [] args) {
System.setProperty("webdriver.chrome.driver", "C:\\Users\\VSPICT\\Downloads\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("http://opensource-demo.orangehrmlive.com");
driver.findElement(By.xpath("//input[@id='txtUsername']")).sendKeys("Admin");
driver.findElement(By.xpath("//input[@id='txtUsername']/following::input[1]")).sendKeys("admin123");
driver.findElement(By.xpath("//input[@id='txtUsername']/following::input[2]")).click();
driver.findElement(By.xpath("//b[contains(text(),'Admin')]")).click();
List<WebElement> rows = driver.findElements(By.xpath("//tbody/tr"));
//size of the table
System.out.println(rows.size());
//displaying all the items in the table
for(WebElement ele: rows) {
System.out.println(ele.getText());
}
driver.close();
}
}
| 1,129 | 0.719221 | 0.713906 | 31 | 35.419353 | 29.161148 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.806452 | false | false |
9
|
2b405c3831cfef2f89ed3b5ecbb1ecee57d5ca6a
| 24,017,457,182,548 |
94514c165b415a2b642324c2c573ee0ff84b10ca
|
/LearnProject/src/main/java/com/learn/first/Student/Student_Controller.java
|
b59c0d66e7b2d0d8c90b3e5561dec7b08b467e20
|
[] |
no_license
|
ykid333/LearnProject
|
https://github.com/ykid333/LearnProject
|
091976372ab0ca1de5ec1083de5a2992197de6f9
|
b8583ca69d70747a092d68e8dce0cc48fd015aeb
|
refs/heads/master
| 2020-09-09T07:07:38.067000 | 2019-11-13T07:26:10 | 2019-11-13T07:26:10 | 221,383,317 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.learn.first.Student;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.servlet.ModelAndView;
import lombok.AllArgsConstructor;
@Controller
@AllArgsConstructor
public class Student_Controller {
private Student_Service stsv;
@GetMapping("Move_Student_List")
private ModelAndView Move_Student_List() {
ModelAndView mav = stsv.Get_Student_List();
return mav;
}
}
|
UTF-8
|
Java
| 502 |
java
|
Student_Controller.java
|
Java
|
[] | null |
[] |
package com.learn.first.Student;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.servlet.ModelAndView;
import lombok.AllArgsConstructor;
@Controller
@AllArgsConstructor
public class Student_Controller {
private Student_Service stsv;
@GetMapping("Move_Student_List")
private ModelAndView Move_Student_List() {
ModelAndView mav = stsv.Get_Student_List();
return mav;
}
}
| 502 | 0.756972 | 0.756972 | 22 | 20.818182 | 19.839437 | 58 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.909091 | false | false |
9
|
95f28193aad42c56eac2a9d32ad478c81049019b
| 34,376,918,264,762 |
7494612881aa0906b6145e3bcce44f9705cad08b
|
/elearningApp-service/src/main/java/entities/StatusCours.java
|
cf3874ccb6cbee521e56b0521f2151089d539ef4
|
[] |
no_license
|
elarib/eLearningApp
|
https://github.com/elarib/eLearningApp
|
ed2985d289c9a25e6e8e225fceed9b2412d76365
|
4999fc1ed8a33389b490f20f22169853f613c3f4
|
refs/heads/master
| 2021-01-17T06:50:25.775000 | 2016-02-01T14:49:41 | 2016-02-01T14:49:41 | 48,852,236 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package entities;
public enum StatusCours {
PRIVE("privé"), PUBLIQUE("publique"), WAITING("en attente de validation");
private final String name;
private StatusCours(String name) {
this.name = name;
}
@Override
public String toString() {
return name;
}
}
|
UTF-8
|
Java
| 291 |
java
|
StatusCours.java
|
Java
|
[] | null |
[] |
package entities;
public enum StatusCours {
PRIVE("privé"), PUBLIQUE("publique"), WAITING("en attente de validation");
private final String name;
private StatusCours(String name) {
this.name = name;
}
@Override
public String toString() {
return name;
}
}
| 291 | 0.655172 | 0.655172 | 17 | 14.941176 | 18.931675 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.058824 | false | false |
9
|
5abfa09d81ab3c267bb02bbec98a4ffd499b6cc0
| 5,145,370,874,938 |
b280a34244a58fddd7e76bddb13bc25c83215010
|
/scmv6/web-management/src/main/java/com/smate/web/management/service/other/FundThirdServiceImpl.java
|
42b276d6e3bab8f552f3e6a610d16f016f929833
|
[] |
no_license
|
hzr958/myProjects
|
https://github.com/hzr958/myProjects
|
910d7b7473c33ef2754d79e67ced0245e987f522
|
d2e8f61b7b99a92ffe19209fcda3c2db37315422
|
refs/heads/master
| 2022-12-24T16:43:21.527000 | 2019-08-16T01:46:18 | 2019-08-16T01:46:18 | 202,512,072 | 2 | 3 | null | false | 2022-12-16T05:31:05 | 2019-08-15T09:21:04 | 2020-10-17T16:19:58 | 2022-12-16T05:31:02 | 108,488 | 2 | 3 | 21 |
Java
| false | false |
package com.smate.web.management.service.other;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.client.RestTemplate;
import com.smate.core.base.exception.ServiceException;
import com.smate.core.base.utils.json.JacksonUtils;
import com.smate.web.management.dao.other.fund.ConstFundAgencyDao;
import com.smate.web.management.dao.other.fund.OpenThirdRegDao;
import com.smate.web.management.dao.other.fund.ThirdSourcesDao;
import com.smate.web.management.dao.other.fund.ThirdSourcesFundDao;
import com.smate.web.management.model.other.fund.ConstFundAgency;
import com.smate.web.management.model.other.fund.ConstFundCategory;
import com.smate.web.management.model.other.fund.FundThirdForm;
import com.smate.web.management.model.other.fund.ThirdSourcesFund;
@Service("fundThirdService")
@Transactional(rollbackFor = Exception.class)
public class FundThirdServiceImpl implements FundThirdService {
private static final long serialVersionUID = 7603977418174465406L;
protected final Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private ThirdSourcesFundDao thirdSourcesFundDao;
@Autowired
private OpenThirdRegDao openThirdRegDao;
@Autowired
private ConstFundAgencyDao constFundAgencyDao;
@Autowired
private ThirdSourcesDao thirdSourcesDao;
@Resource(name = "restTemplate")
private RestTemplate restTemplate;
@Value("${initOpen.restful.url}")
private String SERVER_URL;
@SuppressWarnings("unchecked")
@Override
public void findFundThirdList(FundThirdForm form) throws ServiceException {
ThirdSourcesFund thirdFund = form.getThirdSourcesFund();
List<ThirdSourcesFund> fundList = thirdSourcesFundDao.findFundThirdList(thirdFund, form.getPage());
if (fundList != null && fundList.size() > 0) {
for (ThirdSourcesFund fund : fundList) {
String fundingAgency = fund.getFundingAgency();// 资助机构
Long agencyId = thirdSourcesDao.getAgentcyIdByToken(fundingAgency);
if (agencyId != null) {
ConstFundAgency cfa = constFundAgencyDao.get(agencyId);
if (cfa != null) {
fund.setAgencyViewName(cfa.getNameZh() == null ? cfa.getNameEn() : cfa.getNameZh());
}
}
}
form.setThirdSourcesFundlist(fundList);
}
}
@SuppressWarnings("unchecked")
@Override
public void viewFundThirdDetails(FundThirdForm form) throws ServiceException {
ThirdSourcesFund thirdFund = thirdSourcesFundDao.get(form.getId());
String fundingAgency = thirdFund.getFundingAgency();// 资助机构
Long agencyId = thirdSourcesDao.getAgentcyIdByToken(fundingAgency);
if (agencyId != null) {
String accessoryUrl = thirdFund.getAccessoryUrl();
thirdFund.setAccessoryUrlView(null);
if (accessoryUrl != null && JacksonUtils.isJsonList(accessoryUrl)) {
thirdFund.setAccessoryUrlView(JacksonUtils.jsonToList(accessoryUrl));
}
ConstFundAgency cfa = constFundAgencyDao.get(agencyId);
if (cfa != null) {
thirdFund.setAgencyViewName(cfa.getNameZh() == null ? cfa.getNameEn() : cfa.getNameZh());
}
}
form.setThirdSourcesFund(thirdFund);
}
/**
* 基金机会审核
*/
@Override
public ConstFundCategory checkFundThird(Long id) throws ServiceException {
// 1.获取基金机会信息
ThirdSourcesFund fund = thirdSourcesFundDao.get(id);
ConstFundCategory fundCategory = new ConstFundCategory();
if (fund != null) {
String fundingAgency = fund.getFundingAgency();// 资助机构
Long agencyId = thirdSourcesDao.getAgentcyIdByToken(fundingAgency);
if (agencyId != null) {
ConstFundAgency cfa = constFundAgencyDao.get(agencyId);
if (cfa != null) {
fundCategory.setAgencyViewName(cfa.getNameZh() == null ? cfa.getNameEn() : cfa.getNameZh());
}
}
fundCategory.setNameZh(fund.getFundTitleCn());
fundCategory.setNameEn(fund.getFundTitleEn());
fundCategory.setAbbr(fund.getFundTitleAbbr());
fundCategory.setCode(fund.getFundNumber());
fundCategory.setDescription(fund.getFundDesc());
fundCategory.setKeywordList(fund.getFundKeywords());
fundCategory.setFileList(fund.getAccessoryUrl());
fundCategory.setStartDate(fund.getApplyDateStart());
fundCategory.setEndDate(fund.getApplyDateEnd());
fundCategory.setGuideUrl(fund.getDeclareGuideUrl());
fundCategory.setDeclareUrl(fund.getDeclareUrl());
fundCategory.setDisList(fund.getDisciplineClassificationType());
fundCategory.setFundId(id);
}
return fundCategory;
}
@Override
public void updateFundThird(Long id, Integer status) throws ServiceException {
ThirdSourcesFund fund = thirdSourcesFundDao.get(id);
if (fund != null) {
fund.setAuditStatus(status);
fund.setUpdateTime(new Date());
thirdSourcesFundDao.saveOrUpdate(fund);
}
}
@Override
public void deleteFundThird(Long id) throws ServiceException {
updateFundThird(id, 2);
}
}
|
UTF-8
|
Java
| 5,341 |
java
|
FundThirdServiceImpl.java
|
Java
|
[] | null |
[] |
package com.smate.web.management.service.other;
import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.client.RestTemplate;
import com.smate.core.base.exception.ServiceException;
import com.smate.core.base.utils.json.JacksonUtils;
import com.smate.web.management.dao.other.fund.ConstFundAgencyDao;
import com.smate.web.management.dao.other.fund.OpenThirdRegDao;
import com.smate.web.management.dao.other.fund.ThirdSourcesDao;
import com.smate.web.management.dao.other.fund.ThirdSourcesFundDao;
import com.smate.web.management.model.other.fund.ConstFundAgency;
import com.smate.web.management.model.other.fund.ConstFundCategory;
import com.smate.web.management.model.other.fund.FundThirdForm;
import com.smate.web.management.model.other.fund.ThirdSourcesFund;
@Service("fundThirdService")
@Transactional(rollbackFor = Exception.class)
public class FundThirdServiceImpl implements FundThirdService {
private static final long serialVersionUID = 7603977418174465406L;
protected final Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private ThirdSourcesFundDao thirdSourcesFundDao;
@Autowired
private OpenThirdRegDao openThirdRegDao;
@Autowired
private ConstFundAgencyDao constFundAgencyDao;
@Autowired
private ThirdSourcesDao thirdSourcesDao;
@Resource(name = "restTemplate")
private RestTemplate restTemplate;
@Value("${initOpen.restful.url}")
private String SERVER_URL;
@SuppressWarnings("unchecked")
@Override
public void findFundThirdList(FundThirdForm form) throws ServiceException {
ThirdSourcesFund thirdFund = form.getThirdSourcesFund();
List<ThirdSourcesFund> fundList = thirdSourcesFundDao.findFundThirdList(thirdFund, form.getPage());
if (fundList != null && fundList.size() > 0) {
for (ThirdSourcesFund fund : fundList) {
String fundingAgency = fund.getFundingAgency();// 资助机构
Long agencyId = thirdSourcesDao.getAgentcyIdByToken(fundingAgency);
if (agencyId != null) {
ConstFundAgency cfa = constFundAgencyDao.get(agencyId);
if (cfa != null) {
fund.setAgencyViewName(cfa.getNameZh() == null ? cfa.getNameEn() : cfa.getNameZh());
}
}
}
form.setThirdSourcesFundlist(fundList);
}
}
@SuppressWarnings("unchecked")
@Override
public void viewFundThirdDetails(FundThirdForm form) throws ServiceException {
ThirdSourcesFund thirdFund = thirdSourcesFundDao.get(form.getId());
String fundingAgency = thirdFund.getFundingAgency();// 资助机构
Long agencyId = thirdSourcesDao.getAgentcyIdByToken(fundingAgency);
if (agencyId != null) {
String accessoryUrl = thirdFund.getAccessoryUrl();
thirdFund.setAccessoryUrlView(null);
if (accessoryUrl != null && JacksonUtils.isJsonList(accessoryUrl)) {
thirdFund.setAccessoryUrlView(JacksonUtils.jsonToList(accessoryUrl));
}
ConstFundAgency cfa = constFundAgencyDao.get(agencyId);
if (cfa != null) {
thirdFund.setAgencyViewName(cfa.getNameZh() == null ? cfa.getNameEn() : cfa.getNameZh());
}
}
form.setThirdSourcesFund(thirdFund);
}
/**
* 基金机会审核
*/
@Override
public ConstFundCategory checkFundThird(Long id) throws ServiceException {
// 1.获取基金机会信息
ThirdSourcesFund fund = thirdSourcesFundDao.get(id);
ConstFundCategory fundCategory = new ConstFundCategory();
if (fund != null) {
String fundingAgency = fund.getFundingAgency();// 资助机构
Long agencyId = thirdSourcesDao.getAgentcyIdByToken(fundingAgency);
if (agencyId != null) {
ConstFundAgency cfa = constFundAgencyDao.get(agencyId);
if (cfa != null) {
fundCategory.setAgencyViewName(cfa.getNameZh() == null ? cfa.getNameEn() : cfa.getNameZh());
}
}
fundCategory.setNameZh(fund.getFundTitleCn());
fundCategory.setNameEn(fund.getFundTitleEn());
fundCategory.setAbbr(fund.getFundTitleAbbr());
fundCategory.setCode(fund.getFundNumber());
fundCategory.setDescription(fund.getFundDesc());
fundCategory.setKeywordList(fund.getFundKeywords());
fundCategory.setFileList(fund.getAccessoryUrl());
fundCategory.setStartDate(fund.getApplyDateStart());
fundCategory.setEndDate(fund.getApplyDateEnd());
fundCategory.setGuideUrl(fund.getDeclareGuideUrl());
fundCategory.setDeclareUrl(fund.getDeclareUrl());
fundCategory.setDisList(fund.getDisciplineClassificationType());
fundCategory.setFundId(id);
}
return fundCategory;
}
@Override
public void updateFundThird(Long id, Integer status) throws ServiceException {
ThirdSourcesFund fund = thirdSourcesFundDao.get(id);
if (fund != null) {
fund.setAuditStatus(status);
fund.setUpdateTime(new Date());
thirdSourcesFundDao.saveOrUpdate(fund);
}
}
@Override
public void deleteFundThird(Long id) throws ServiceException {
updateFundThird(id, 2);
}
}
| 5,341 | 0.741539 | 0.737001 | 137 | 37.605839 | 27.222349 | 103 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.532847 | false | false |
9
|
8bd061ae18b93795321edf73ef10eb2e9fd54a1a
| 23,227,183,167,150 |
5ecb0d821e9a7000a77e29d7aa4650e99055ebc1
|
/src/test/java/com/luckycat/holmes/TestConfig.java
|
06a79083f10f5f5fbdd8810503dde775c852c9dc
|
[] |
no_license
|
macoto-liu/holmes
|
https://github.com/macoto-liu/holmes
|
ebca8651ab78161ba5f7ada4dc38554dd182ea3e
|
db94c0f1e03a55ac49268b0e1eb0b90328543c39
|
refs/heads/master
| 2016-09-07T17:46:24.649000 | 2015-08-23T08:42:30 | 2015-08-23T08:42:30 | 33,816,488 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.luckycat.holmes;
import javax.sql.DataSource;
import org.apache.commons.dbcp2.BasicDataSource;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.EnvironmentAware;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.core.io.ClassPathResource;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
@Configuration
@PropertySource("classpath:/application.properties")
@MapperScan("com.luckycat.holmes.table.mapper")
@ComponentScan(basePackages = "com.luckycat.holmes.service.impl")
public class TestConfig implements EnvironmentAware{
private Environment env;
@Override
public void setEnvironment(Environment env) {
this.env = env;
}
@Bean
public DataSource dataSource() {
BasicDataSource dataSource = new BasicDataSource();
dataSource.setUsername(env.getProperty("jdbc.username"));
dataSource.setPassword(env.getProperty("jdbc.password"));
dataSource.setUrl(env.getProperty("jdbc.url"));
dataSource.setDriverClassName(env.getProperty("jdbc.driverClassName"));
dataSource.setConnectionProperties("characterEncoding=UTF-8");
dataSource.setInitialSize(1);
dataSource.setMaxTotal(10);
dataSource.setMaxIdle(10);
dataSource.setMinIdle(0);
dataSource.setMaxWaitMillis(25000);
dataSource.setValidationQuery("SELECT 1");
return dataSource;
}
@Bean
public DataSourceTransactionManager transactionManager() {
return new DataSourceTransactionManager(dataSource());
}
@Bean
public SqlSessionFactory sqlSessionFactory() throws Exception {
SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
sessionFactory.setDataSource(dataSource());
sessionFactory.setTypeAliasesPackage("com.luckycat.holmes.table");
sessionFactory.setConfigLocation(new ClassPathResource("mybatis-config.xml"));
return sessionFactory.getObject();
}
}
|
UTF-8
|
Java
| 2,208 |
java
|
TestConfig.java
|
Java
|
[] | null |
[] |
package com.luckycat.holmes;
import javax.sql.DataSource;
import org.apache.commons.dbcp2.BasicDataSource;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.EnvironmentAware;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.core.io.ClassPathResource;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
@Configuration
@PropertySource("classpath:/application.properties")
@MapperScan("com.luckycat.holmes.table.mapper")
@ComponentScan(basePackages = "com.luckycat.holmes.service.impl")
public class TestConfig implements EnvironmentAware{
private Environment env;
@Override
public void setEnvironment(Environment env) {
this.env = env;
}
@Bean
public DataSource dataSource() {
BasicDataSource dataSource = new BasicDataSource();
dataSource.setUsername(env.getProperty("jdbc.username"));
dataSource.setPassword(env.getProperty("jdbc.password"));
dataSource.setUrl(env.getProperty("jdbc.url"));
dataSource.setDriverClassName(env.getProperty("jdbc.driverClassName"));
dataSource.setConnectionProperties("characterEncoding=UTF-8");
dataSource.setInitialSize(1);
dataSource.setMaxTotal(10);
dataSource.setMaxIdle(10);
dataSource.setMinIdle(0);
dataSource.setMaxWaitMillis(25000);
dataSource.setValidationQuery("SELECT 1");
return dataSource;
}
@Bean
public DataSourceTransactionManager transactionManager() {
return new DataSourceTransactionManager(dataSource());
}
@Bean
public SqlSessionFactory sqlSessionFactory() throws Exception {
SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
sessionFactory.setDataSource(dataSource());
sessionFactory.setTypeAliasesPackage("com.luckycat.holmes.table");
sessionFactory.setConfigLocation(new ClassPathResource("mybatis-config.xml"));
return sessionFactory.getObject();
}
}
| 2,208 | 0.817482 | 0.811141 | 61 | 35.19672 | 24.580294 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.459016 | false | false |
9
|
32d0cabb0316b95431de6c7f8e684ad6a0b6a33a
| 22,874,995,852,932 |
0bc0909590d8a2e2eb8a82b780920bfd19931cf8
|
/SampleKey/app/src/main/java/org/androidtown/samplekey/MainActivity.java
|
caba0ee5ba96660405353a78429fc4506007ee8b
|
[] |
no_license
|
Minki-Choi/AndroidExercise
|
https://github.com/Minki-Choi/AndroidExercise
|
a5f6779601ad30f5906d211d1e7d996c570ce8b6
|
46e47ee8fcd1eda1ba585bb56936f7ded7512493
|
refs/heads/master
| 2021-01-17T20:29:32.714000 | 2016-06-24T12:56:00 | 2016-06-24T12:56:00 | 61,001,075 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.androidtown.samplekey;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
private final static int REQUEST_CODE=200;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void onButton1Clicked(View v) {
Intent intent=new Intent(this,AnotherActivity.class);
startActivityForResult(intent,REQUEST_CODE);
}
public void onActivityResult(int requestCode,int resultCode,Intent intent){
super.onActivityResult(requestCode,resultCode,intent);
if(requestCode==REQUEST_CODE) {
if(intent!=null) {
String result = intent.getExtras().getString("result");
Toast.makeText(this, result, Toast.LENGTH_SHORT).show();
}
}
}
}
|
UTF-8
|
Java
| 1,025 |
java
|
MainActivity.java
|
Java
|
[] | null |
[] |
package org.androidtown.samplekey;
import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Toast;
public class MainActivity extends AppCompatActivity {
private final static int REQUEST_CODE=200;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void onButton1Clicked(View v) {
Intent intent=new Intent(this,AnotherActivity.class);
startActivityForResult(intent,REQUEST_CODE);
}
public void onActivityResult(int requestCode,int resultCode,Intent intent){
super.onActivityResult(requestCode,resultCode,intent);
if(requestCode==REQUEST_CODE) {
if(intent!=null) {
String result = intent.getExtras().getString("result");
Toast.makeText(this, result, Toast.LENGTH_SHORT).show();
}
}
}
}
| 1,025 | 0.694634 | 0.689756 | 31 | 32.064518 | 24.133947 | 79 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.709677 | false | false |
9
|
084de6f964f33f730a2e0d56efa401f8900a0272
| 9,680,856,294,177 |
b4f31762a2aa827bff47dd5d75b5c5469e794858
|
/src/main/java/domain/Company.java
|
1128eb987dbc7cf7086b3acbc91a28b895b14a7f
|
[] |
no_license
|
MatinParsapour/bookticketsite
|
https://github.com/MatinParsapour/bookticketsite
|
2db32d6059be9386ebbd54906ab68c0721ef987b
|
c3e9660941d9c5cbd8a7da20402130b62fad904b
|
refs/heads/main
| 2023-08-31T12:28:51.243000 | 2021-10-12T08:55:27 | 2021-10-12T08:55:27 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package domain;
import base.entity.BaseEntity;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;
@Entity
@Table(name = Company.COMPANYTABLE)
@Setter
@Getter
@NoArgsConstructor
public class Company extends BaseEntity<Long> {
public static final String COMPANYTABLE = "company_table";
private static final String COMPANYNAME = "company_name";
private static final String CEO = "ceo";
private static final String EMPLOYEES = "employees";
private static final String TICKETS = "tickets";
@JoinColumn(name = COMPANYNAME)
private String companyName;
@OneToOne(mappedBy = "company",cascade = CascadeType.ALL)
private CEO ceo;
@OneToMany(mappedBy = "company",cascade = CascadeType.ALL)
private List<Employee> employees = new ArrayList<>();
@OneToMany(mappedBy = "company",cascade = CascadeType.ALL)
private List<Ticket> tickets = new ArrayList<>();
public Company(String companyName, domain.CEO ceo) {
this.companyName = companyName;
this.ceo = ceo;
}
}
|
UTF-8
|
Java
| 1,136 |
java
|
Company.java
|
Java
|
[] | null |
[] |
package domain;
import base.entity.BaseEntity;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;
@Entity
@Table(name = Company.COMPANYTABLE)
@Setter
@Getter
@NoArgsConstructor
public class Company extends BaseEntity<Long> {
public static final String COMPANYTABLE = "company_table";
private static final String COMPANYNAME = "company_name";
private static final String CEO = "ceo";
private static final String EMPLOYEES = "employees";
private static final String TICKETS = "tickets";
@JoinColumn(name = COMPANYNAME)
private String companyName;
@OneToOne(mappedBy = "company",cascade = CascadeType.ALL)
private CEO ceo;
@OneToMany(mappedBy = "company",cascade = CascadeType.ALL)
private List<Employee> employees = new ArrayList<>();
@OneToMany(mappedBy = "company",cascade = CascadeType.ALL)
private List<Ticket> tickets = new ArrayList<>();
public Company(String companyName, domain.CEO ceo) {
this.companyName = companyName;
this.ceo = ceo;
}
}
| 1,136 | 0.723592 | 0.723592 | 40 | 27.4 | 22.053118 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.575 | false | false |
9
|
a6c2faac9f80bac2310932a1a44ca2f1333cb0ab
| 8,177,617,778,797 |
05816b4ea192490ac116e4793b4f2175b26ce791
|
/src/main/java/com/cn/tianxia/pay/impl/CZFPayServiceImpl.java
|
6b215748f0eec588d06c4d51bc6b668f2bfcf15e
|
[] |
no_license
|
pumaxiaoyao/Spring-mvc-interface
|
https://github.com/pumaxiaoyao/Spring-mvc-interface
|
7099b489b96312936802946ee075ece12e9f1017
|
6e2ba6c7c25463a31484fc4e6f83c2e3c47112e2
|
refs/heads/master
| 2020-05-21T21:49:55.833000 | 2019-02-13T10:10:49 | 2019-02-13T10:10:49 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.cn.tianxia.pay.impl;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.cn.tianxia.common.PayEntity;
import com.cn.tianxia.common.PayUtil;
import com.cn.tianxia.pay.gst.util.StringUtils;
import com.cn.tianxia.pay.jh.util.SimpleHttpUtils;
import com.cn.tianxia.pay.kjf.util.HttpUtil;
import com.cn.tianxia.pay.kjf.util.MD5;
import com.cn.tianxia.pay.service.PayService;
import com.cn.tianxia.util.SSLClient;
import net.sf.json.JSONObject;
/**
*
* @Description:TODO
*
* @author:zouwei
*
* @time:2017年7月6日 下午7:22:39
*
*/
public class CZFPayServiceImpl implements PayService {
private String sign_type;// 加密方式 加密类型,取值:md5默认:md5
private String mch_id;// 商户id
private String remark;// 订单内容
private String notify_url; // 回调通知URL
private String url;// 请求地址
private String mch_key;// 加密key
private final static Logger logger = LoggerFactory.getLogger(CZFPayServiceImpl.class);
public CZFPayServiceImpl(Map<String, String> pmap) {
net.sf.json.JSONObject jo = new net.sf.json.JSONObject().fromObject(pmap);
if (null != pmap) {
sign_type = jo.get("sign_type").toString();
mch_id = jo.get("mch_id").toString();
remark = jo.get("remark").toString();
notify_url = jo.get("notify_url").toString();
url = jo.get("url").toString();
mch_key = jo.get("mch_key").toString();
}
}
/**
* 接口返回结果
*
* @param link
* @param linkType
* 二种形式:1.qrcode 生成二维码 2.qrcode_url 支持跳转的url
* @param msg
* @param status
* @return
*/
private JSONObject retJSON(String link, String linkType, String msg, String status) {
JSONObject json = new JSONObject();
json.put("status", status);
json.put("type", linkType);
json.put("link", link);
json.put("msg", msg);
return json;
}
/**
* post 方法
*
* @param url
* @param map
* @param charset
* @return
*/
public static String doPost(String url, Map<String, String> map, String charset) {
HttpClient httpClient = null;
HttpPost httpPost = null;
String result = null;
try {
httpClient = new SSLClient();
httpPost = new HttpPost(url);
// ����
List<NameValuePair> list = new ArrayList<NameValuePair>();
Iterator iterator = map.entrySet().iterator();
while (iterator.hasNext()) {
Entry<String, String> elem = (Entry<String, String>) iterator.next();
list.add(new BasicNameValuePair(elem.getKey(), elem.getValue()));
}
if (list.size() > 0) {
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(list, charset);
httpPost.setEntity(entity);
}
HttpResponse response = httpClient.execute(httpPost);
if (response != null) {
HttpEntity resEntity = response.getEntity();
if (resEntity != null) {
result = EntityUtils.toString(resEntity, charset);
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
return result;
}
public static String md5(String strSrc) {
String result = "";
try {
MessageDigest md5;
try {
md5 = MessageDigest.getInstance("MD5");
md5.update((strSrc).getBytes("UTF-8"));
byte b[] = md5.digest();
int i;
StringBuffer buf = new StringBuffer("");
for (int offset = 0; offset < b.length; offset++) {
i = b[offset];
if (i < 0) {
i += 256;
}
if (i < 16) {
buf.append("0");
}
buf.append(Integer.toHexString(i));
}
result = buf.toString();
return result;
} catch (NoSuchAlgorithmException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return result;
}
/*
* unicode编码转中文
*/
public static String decodeUnicode(final String dataStr) {
int start = 0;
int end = 0;
final StringBuffer buffer = new StringBuffer();
while (start > -1) {
end = dataStr.indexOf("\\u", start + 2);
String charStr = "";
if (end == -1) {
charStr = dataStr.substring(start + 2, dataStr.length());
} else {
charStr = dataStr.substring(start + 2, end);
}
char letter = (char) Integer.parseInt(charStr, 16); // 16进制parse整形字符串。
buffer.append(new Character(letter).toString());
start = end;
}
return buffer.toString();
}
public static String gbEncoding(final String gbString) {
char[] utfBytes = gbString.toCharArray();
String unicodeBytes = "";
for (int i = 0; i < utfBytes.length; i++) {
String hexB = Integer.toHexString(utfBytes[i]);
if (hexB.length() <= 2) {
hexB = "00" + hexB;
}
unicodeBytes = unicodeBytes + "\\u" + hexB;
}
return unicodeBytes;
}
private JSONObject scanPay(Map<String, String> scanMap) {
// TODO Auto-generated method stub
if(!StringUtils.isNullOrEmpty(scanMap.get("mobile")) && scanMap.get("payType").equals("union_qrcode")){
scanMap.put("mobile", null);
}
Map<String,String> hashMap = new HashMap<String,String>();
hashMap.put("amt", scanMap.get("amt"));
hashMap.put("client_ip", scanMap.get("client_ip"));
hashMap.put("created_at", scanMap.get("created_at"));
hashMap.put("mch_id", mch_id);
hashMap.put("mch_order", scanMap.get("mch_order"));
hashMap.put("notify_url", notify_url);
hashMap.put("remark", remark);
hashMap.put("sign_type", sign_type);
hashMap.put("mch_key", mch_key);
String queryStr = getSign(hashMap);
String sign = md5(queryStr);
hashMap.put("sign", sign);
hashMap.remove("mch_key");
System.out.println("请求地址"+url+scanMap.get("payType")+".api"+"请求参数:"+hashMap.toString());
String rusult = doPost(url+scanMap.get("payType")+".api", hashMap, "UTF-8");
JSONObject json = JSONObject.fromObject(rusult);
System.out.println("返回结果:"+rusult);
if("1".equals(json.get("code").toString())){
JSONObject js = JSONObject.fromObject(json.get("data"));
String link ="";
if (StringUtils.isNullOrEmpty(scanMap.get("mobile"))) {
// if(js.containsKey("redirect_pay_url") && (scanMap.get("payType").equals("ali_qrcode")||
// scanMap.get("payType").equals("qq_qrcode")) ){
// link = js.get("redirect_pay_url").toString().replace("\\\\","");
// }else{
// }
//快捷支付
if(scanMap.get("payType").equals("quick_page")){
link = js.get("pay_info").toString().replace("\\\\","");
return retJSON(link, "qrcode_url", "二维码图片生成", "success");
}
link = js.get("code_url").toString().replace("\\\\","");
return retJSON(link, "qrcode", "二维码图片生成", "success");
} else {
if(scanMap.get("payType").equals("jd_wap")){
link = js.get("pay_url").toString().replace("\\\\","");
return retJSON(link, "qrcode_url", "二维码图片生成", "success");
}
link = js.get("pay_info").toString().replace("\\\\","");
return retJSON(js.get("pay_info").toString(), "qrcode_url", "二维码图片连接", "success");
}
}else{
String msg = decodeUnicode(gbEncoding(json.get("msg").toString()));
return retJSON("", "",msg, "error");
}
}
public static String getSign(Map<String, String> map) {
Set<String> set = new TreeSet<String>();
StringBuffer sb = new StringBuffer();
for (String s : map.keySet()) {
set.add(s);
}
int i = 0;
for (String s : set) {
if (i < 1) {
sb.append(s + "=" + map.get(s));
} else {
sb.append("&" + s + "=" + map.get(s));
}
i++;
}
System.out.println(sb.toString());
return sb.toString();
}
@Override
public String callback(Map<String, String> request) {
List<String> keys = new ArrayList<String>(request.keySet());
for (int i = 0; i < keys.size(); i++) {
String name = (String) keys.get(i);
String value = (String) request.get(name);
if (StringUtils.isNullOrEmpty(value)) {
logger.info("删除:" + name);
request.remove(name);
}
}
String sign = request.get("sign");
request.remove("sign");
request.put("mch_key", mch_key);
String queryStr = getSign(request);
String newSign = md5(queryStr);
if(sign.equals(newSign)){
return "success";
}
return null;
}
private static void callback() {
Map<String, String> paramMap = new HashMap<String, String>();
String a = System.currentTimeMillis()+"";
paramMap.put("mch_id", "viwgonhmfk");
paramMap.put("service", "10");
paramMap.put("mch_order", "CZFtxk201803182048512048513345");
paramMap.put("amt", "20000");
paramMap.put("mch_amt", "20000");
paramMap.put("sign_type", "md5");
paramMap.put("amt_type", "cny");
paramMap.put("status", "2");
paramMap.put("created_at", a);
String b = System.currentTimeMillis()+"";
paramMap.put("success_at", b);
paramMap.put("mch_key", "d023d0e37451aa53ce44cd7fe570d6a9");
String signStr1 = getSign(paramMap);
String sign = md5(signStr1);
paramMap.put("sign", sign);
paramMap.remove("mch_key");
String payResult = SimpleHttpUtils.httpPost("http://localhost:81/JJF/Notify/CZFNotify.do", paramMap);// 发送请求,POST请求,文档get请求是演示参数
System.out.println(payResult);
}
@Override
public JSONObject wyPay(PayEntity payEntity) {
// TODO Auto-generated method stub
Double amount = payEntity.getAmount();
String order_no = payEntity.getOrderNo();
String refereUrl = payEntity.getRefererUrl();
String pay_code = payEntity.getPayCode();
String userName = payEntity.getUsername();
String pay_url = payEntity.getPayUrl();
Map<String, String> scanMap = new HashMap<>();
scanMap.put("mch_order", payEntity.getOrderNo());// 订单号
scanMap.put("created_at", System.currentTimeMillis() + "");
String amt = String.valueOf((int)(payEntity.getAmount() * 1000));
scanMap.put("amt", amt);// 金额 .substring(0,amt.indexOf("."))
scanMap.put("client_ip", payEntity.getIp());// "110.164.197.124"
JSONObject retJson;
scanMap.put("bank_code", payEntity.getPayCode());
String payInfo = bankPay(scanMap);
return PayUtil.returnWYPayJson("success", "link", payInfo, null, "");
}
private String bankPay(Map<String, String> scanMap) {
Map<String,String> hashMap = new TreeMap<String,String>();
hashMap.put("sign_type", sign_type);
hashMap.put("mch_id", mch_id);
hashMap.put("mch_order", scanMap.get("mch_order"));
hashMap.put("amt", scanMap.get("amt"));
hashMap.put("remark", remark);
hashMap.put("created_at", scanMap.get("created_at"));
hashMap.put("client_ip", scanMap.get("client_ip"));
hashMap.put("notify_url", notify_url);
hashMap.put("bank_code", scanMap.get("bank_code"));//scanMap.get("bank_code")
hashMap.put("bank_card_type", "1");
hashMap.put("mch_key", mch_key);
String queryStr = getSign(hashMap);
String sign = md5(queryStr);
hashMap.put("sign", sign);
hashMap.remove("mch_key");
String responseStr = HttpUtil.RequestForm(url+"union.api", hashMap);
JSONObject responseJson= JSONObject.fromObject(responseStr);
logger.info("畅支付支付请求:" + responseJson);
String res_code = responseJson.getString("code");
String pay_info = null;//网银收银台地址
if("1".equals(res_code)) {//成功
pay_info = responseJson.getJSONObject("data").getString("pay_info");
}
return pay_info;
}
@Override
public JSONObject smPay(PayEntity payEntity) {
// TODO Auto-generated method stub
Double amount = payEntity.getAmount();
String order_no = payEntity.getOrderNo();
String userName = payEntity.getUsername();
Map<String, String> scanMap = new HashMap<String, String>();
Map<String, Object> json = new HashMap<String, Object>();
scanMap.put("mch_order", payEntity.getOrderNo());// 订单号
scanMap.put("created_at", System.currentTimeMillis() + "");
// String amt = String.valueOf(payEntity.getAmount() * 1000);
DecimalFormat df = new DecimalFormat("############");
String amt = df.format(payEntity.getAmount()* 1000);
scanMap.put("amt", amt);// 金额 .substring(0,amt.indexOf("."))
scanMap.put("client_ip",payEntity.getIp());// payEntity.getIp());//"58.64.40.26"
JSONObject retJson;
scanMap.put("payType", payEntity.getPayCode());
scanMap.put("mobile", payEntity.getMobile());
retJson = scanPay(scanMap);
if (retJson.getString("status").equals("success")) {
if (retJson.getString("type").equals("qrcode")) {
if(!StringUtils.isNullOrEmpty(payEntity.getMobile()) && payEntity.getPayCode().equals("union_qrcode")){
return PayUtil.returnPayJson("success", "4", "支付接口请求成功!", userName, amount, order_no, retJson.getString("link"));
}
return PayUtil.returnPayJson("success", "2", "支付接口请求成功!", userName, amount, order_no, retJson.getString("link"));
} else if (retJson.getString("type").equals("qrcode_url")) {
return PayUtil.returnPayJson("success", "4", "支付接口请求成功!", userName, amount, order_no, retJson.getString("link"));
} else if (payEntity.getPayCode().equals("wx_h5")){
return PayUtil.returnPayJson("error", "4", "支付接口请求失败!", userName, amount, order_no, retJson.getString("msg"));
}else{
return PayUtil.returnPayJson("error", "1", "支付接口请求失败!", userName, amount, order_no, retJson.getString("msg"));
}
}
return PayUtil.returnPayJson("error", "1", "支付接口请求失败!", userName, amount, order_no, retJson.getString("msg"));
}
public static void main(String[] args) {
String s = "amt=123000&bank_code =1001&client_ip=127.0.0.1&created_at=1529564886503&mch_id=elpwifdmsc&mch_key=248254578cc92fabea3c3f7fac2aa67b&mch_order=CZFbl1201806211508031508037721¬ify_url=http://txw.tx8899.com/YHH/Notify/CZFNotify.do&remark=tianxiazhifu&sign_type=md5";
/*
Map<String,String> hashMap = new HashMap<String,String>();
hashMap.put("amt", "100000");
hashMap.put("client_ip", "110.164.197.124");
hashMap.put("created_at", System.currentTimeMillis() + "");
hashMap.put("mch_id", "tmygnxasqh");
hashMap.put("mch_order", "CZF"+System.currentTimeMillis());
hashMap.put("notify_url", "https://www.6hghg.com/HG1/PlatformPay/QFTNotify.do");
hashMap.put("remark", "xianxiazhifu");
hashMap.put("sign_type", "md5");
hashMap.put("mch_key", "284bdd34ae8e91156c3682ee0f26bad0");
// hashMap.put("user_bank_id ", "1");
// hashMap.put("bank_card_type ", "11");
// hashMap.put("bank_code ", "1026");
// hashMap.put("callback_url ", "https://www.6hghg.com");
String queryStr = getSign(hashMap);
String sign = md5(queryStr);
hashMap.put("sign", sign);
hashMap.remove("mch_key");
String rusult = doPost("https://sdk.consucredit.com/api/v1/union_qrcode.api", hashMap, "UTF-8");
System.out.println(rusult);
// String FormString = "<body onLoad=\"document.actform.submit()\">正在处理请稍候.....................<form id=\"actform\" name=\"actform\" method=\"post\" action=\""
// + "https://sdk.consucredit.com/api/v1/quick_page.api" + "\">";
// for (String key : hashMap.keySet()) {
// FormString += "<input name=\"" + key + "\" type=\"hidden\" value='" + hashMap.get(key) + "'>\r\n";
// }
// FormString += "</form></body>";
//
// String html = FormString;
// String html = HttpUtil.HtmlFrom(url, resquestMap);
// System.out.println(html);
// Map<String,String> hashMap = new HashMap<String,String>();
// hashMap.put("amt", "100000");
// hashMap.put("client_ip", "110.164.197.124");
// hashMap.put("created_at", System.currentTimeMillis() + "");
// hashMap.put("mch_id", "elpwifdmsc");
// hashMap.put("mch_order", "CZF"+System.currentTimeMillis());
// hashMap.put("notify_url", "https://www.6hghg.com/HG1/PlatformPay/QFTNotify.do");
// hashMap.put("remark", "xianxiazhifu");
// hashMap.put("sign_type", "md5");
// hashMap.put("mch_key", "248254578cc92fabea3c3f7fac2aa67b");
// String queryStr = getSign(hashMap);
// String sign = md5(queryStr);
// hashMap.put("sign", sign);
// hashMap.remove("mch_key");
// String rusult = doPost("https://sdk.consucredit.com/api/v1/ali_qrcode.api", hashMap, "UTF-8");
// JSONObject json = JSONObject.fromObject(rusult);
// System.out.println("返回结果:"+rusult);
*/}
}
|
UTF-8
|
Java
| 17,228 |
java
|
CZFPayServiceImpl.java
|
Java
|
[
{
"context": "ect;\n\n/**\n * \n * @Description:TODO\n * \n * @author:zouwei\n * \n * @time:2017年7月6日 下午7:22:39\n * \n */\npublic c",
"end": 1261,
"score": 0.9995980262756348,
"start": 1255,
"tag": "USERNAME",
"value": "zouwei"
},
{
"context": "success_at\", b); \n\t paramMap.put(\"mch_key\", \"d023d0e37451aa53ce44cd7fe570d6a9\"); \n\t String signStr1 = getSign(paramMap); \n",
"end": 9617,
"score": 0.9997601509094238,
"start": 9585,
"tag": "KEY",
"value": "d023d0e37451aa53ce44cd7fe570d6a9"
},
{
"context": "\t\tscanMap.put(\"client_ip\", payEntity.getIp());// \"110.164.197.124\"\n\t\tJSONObject retJson;\n\t\tscanMap.put(\"bank_code\",",
"end": 10687,
"score": 0.9997606873512268,
"start": 10672,
"tag": "IP_ADDRESS",
"value": "110.164.197.124"
},
{
"context": "t_ip\",payEntity.getIp());// payEntity.getIp());//\"58.64.40.26\"\n\t\tJSONObject retJson;\n\t\tscanMap.put(\"payType\", p",
"end": 12835,
"score": 0.9997214674949646,
"start": 12824,
"tag": "IP_ADDRESS",
"value": "58.64.40.26"
},
{
"context": "\tString s = \"amt=123000&bank_code =1001&client_ip=127.0.0.1&created_at=1529564886503&mch_id=elpwifdmsc&mch_ke",
"end": 14161,
"score": 0.9996908903121948,
"start": 14152,
"tag": "IP_ADDRESS",
"value": "127.0.0.1"
},
{
"context": "reated_at=1529564886503&mch_id=elpwifdmsc&mch_key=248254578cc92fabea3c3f7fac2aa67b&mch_order=CZFbl1201806211508031508037721¬ify_u",
"end": 14245,
"score": 0.999741792678833,
"start": 14213,
"tag": "KEY",
"value": "248254578cc92fabea3c3f7fac2aa67b"
},
{
"context": "put(\"amt\", \"100000\");\n\t\thashMap.put(\"client_ip\", \"110.164.197.124\");\n\t\thashMap.put(\"created_at\", System.currentTime",
"end": 14524,
"score": 0.9996823072433472,
"start": 14509,
"tag": "IP_ADDRESS",
"value": "110.164.197.124"
},
{
"context": "ut(\"sign_type\", \"md5\");\n\t\thashMap.put(\"mch_key\", \"284bdd34ae8e91156c3682ee0f26bad0\");\n//\t\thashMap.put(\"user_bank_id \", \"1\");\n//\t\thas",
"end": 14908,
"score": 0.999752402305603,
"start": 14876,
"tag": "KEY",
"value": "284bdd34ae8e91156c3682ee0f26bad0"
},
{
"context": "t(\"amt\", \"100000\");\n//\t\thashMap.put(\"client_ip\", \"110.164.197.124\");\n//\t\thashMap.put(\"created_at\", System.currentTi",
"end": 16037,
"score": 0.9997185468673706,
"start": 16022,
"tag": "IP_ADDRESS",
"value": "110.164.197.124"
},
{
"context": "(\"sign_type\", \"md5\");\n//\t\thashMap.put(\"mch_key\", \"248254578cc92fabea3c3f7fac2aa67b\");\n//\t\tString queryStr = getSign(hashMap);\n//\t\tSt",
"end": 16435,
"score": 0.9997601509094238,
"start": 16403,
"tag": "KEY",
"value": "248254578cc92fabea3c3f7fac2aa67b"
}
] | null |
[] |
package com.cn.tianxia.pay.impl;
import java.io.UnsupportedEncodingException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.cn.tianxia.common.PayEntity;
import com.cn.tianxia.common.PayUtil;
import com.cn.tianxia.pay.gst.util.StringUtils;
import com.cn.tianxia.pay.jh.util.SimpleHttpUtils;
import com.cn.tianxia.pay.kjf.util.HttpUtil;
import com.cn.tianxia.pay.kjf.util.MD5;
import com.cn.tianxia.pay.service.PayService;
import com.cn.tianxia.util.SSLClient;
import net.sf.json.JSONObject;
/**
*
* @Description:TODO
*
* @author:zouwei
*
* @time:2017年7月6日 下午7:22:39
*
*/
public class CZFPayServiceImpl implements PayService {
private String sign_type;// 加密方式 加密类型,取值:md5默认:md5
private String mch_id;// 商户id
private String remark;// 订单内容
private String notify_url; // 回调通知URL
private String url;// 请求地址
private String mch_key;// 加密key
private final static Logger logger = LoggerFactory.getLogger(CZFPayServiceImpl.class);
public CZFPayServiceImpl(Map<String, String> pmap) {
net.sf.json.JSONObject jo = new net.sf.json.JSONObject().fromObject(pmap);
if (null != pmap) {
sign_type = jo.get("sign_type").toString();
mch_id = jo.get("mch_id").toString();
remark = jo.get("remark").toString();
notify_url = jo.get("notify_url").toString();
url = jo.get("url").toString();
mch_key = jo.get("mch_key").toString();
}
}
/**
* 接口返回结果
*
* @param link
* @param linkType
* 二种形式:1.qrcode 生成二维码 2.qrcode_url 支持跳转的url
* @param msg
* @param status
* @return
*/
private JSONObject retJSON(String link, String linkType, String msg, String status) {
JSONObject json = new JSONObject();
json.put("status", status);
json.put("type", linkType);
json.put("link", link);
json.put("msg", msg);
return json;
}
/**
* post 方法
*
* @param url
* @param map
* @param charset
* @return
*/
public static String doPost(String url, Map<String, String> map, String charset) {
HttpClient httpClient = null;
HttpPost httpPost = null;
String result = null;
try {
httpClient = new SSLClient();
httpPost = new HttpPost(url);
// ����
List<NameValuePair> list = new ArrayList<NameValuePair>();
Iterator iterator = map.entrySet().iterator();
while (iterator.hasNext()) {
Entry<String, String> elem = (Entry<String, String>) iterator.next();
list.add(new BasicNameValuePair(elem.getKey(), elem.getValue()));
}
if (list.size() > 0) {
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(list, charset);
httpPost.setEntity(entity);
}
HttpResponse response = httpClient.execute(httpPost);
if (response != null) {
HttpEntity resEntity = response.getEntity();
if (resEntity != null) {
result = EntityUtils.toString(resEntity, charset);
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
return result;
}
public static String md5(String strSrc) {
String result = "";
try {
MessageDigest md5;
try {
md5 = MessageDigest.getInstance("MD5");
md5.update((strSrc).getBytes("UTF-8"));
byte b[] = md5.digest();
int i;
StringBuffer buf = new StringBuffer("");
for (int offset = 0; offset < b.length; offset++) {
i = b[offset];
if (i < 0) {
i += 256;
}
if (i < 16) {
buf.append("0");
}
buf.append(Integer.toHexString(i));
}
result = buf.toString();
return result;
} catch (NoSuchAlgorithmException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return result;
}
/*
* unicode编码转中文
*/
public static String decodeUnicode(final String dataStr) {
int start = 0;
int end = 0;
final StringBuffer buffer = new StringBuffer();
while (start > -1) {
end = dataStr.indexOf("\\u", start + 2);
String charStr = "";
if (end == -1) {
charStr = dataStr.substring(start + 2, dataStr.length());
} else {
charStr = dataStr.substring(start + 2, end);
}
char letter = (char) Integer.parseInt(charStr, 16); // 16进制parse整形字符串。
buffer.append(new Character(letter).toString());
start = end;
}
return buffer.toString();
}
public static String gbEncoding(final String gbString) {
char[] utfBytes = gbString.toCharArray();
String unicodeBytes = "";
for (int i = 0; i < utfBytes.length; i++) {
String hexB = Integer.toHexString(utfBytes[i]);
if (hexB.length() <= 2) {
hexB = "00" + hexB;
}
unicodeBytes = unicodeBytes + "\\u" + hexB;
}
return unicodeBytes;
}
private JSONObject scanPay(Map<String, String> scanMap) {
// TODO Auto-generated method stub
if(!StringUtils.isNullOrEmpty(scanMap.get("mobile")) && scanMap.get("payType").equals("union_qrcode")){
scanMap.put("mobile", null);
}
Map<String,String> hashMap = new HashMap<String,String>();
hashMap.put("amt", scanMap.get("amt"));
hashMap.put("client_ip", scanMap.get("client_ip"));
hashMap.put("created_at", scanMap.get("created_at"));
hashMap.put("mch_id", mch_id);
hashMap.put("mch_order", scanMap.get("mch_order"));
hashMap.put("notify_url", notify_url);
hashMap.put("remark", remark);
hashMap.put("sign_type", sign_type);
hashMap.put("mch_key", mch_key);
String queryStr = getSign(hashMap);
String sign = md5(queryStr);
hashMap.put("sign", sign);
hashMap.remove("mch_key");
System.out.println("请求地址"+url+scanMap.get("payType")+".api"+"请求参数:"+hashMap.toString());
String rusult = doPost(url+scanMap.get("payType")+".api", hashMap, "UTF-8");
JSONObject json = JSONObject.fromObject(rusult);
System.out.println("返回结果:"+rusult);
if("1".equals(json.get("code").toString())){
JSONObject js = JSONObject.fromObject(json.get("data"));
String link ="";
if (StringUtils.isNullOrEmpty(scanMap.get("mobile"))) {
// if(js.containsKey("redirect_pay_url") && (scanMap.get("payType").equals("ali_qrcode")||
// scanMap.get("payType").equals("qq_qrcode")) ){
// link = js.get("redirect_pay_url").toString().replace("\\\\","");
// }else{
// }
//快捷支付
if(scanMap.get("payType").equals("quick_page")){
link = js.get("pay_info").toString().replace("\\\\","");
return retJSON(link, "qrcode_url", "二维码图片生成", "success");
}
link = js.get("code_url").toString().replace("\\\\","");
return retJSON(link, "qrcode", "二维码图片生成", "success");
} else {
if(scanMap.get("payType").equals("jd_wap")){
link = js.get("pay_url").toString().replace("\\\\","");
return retJSON(link, "qrcode_url", "二维码图片生成", "success");
}
link = js.get("pay_info").toString().replace("\\\\","");
return retJSON(js.get("pay_info").toString(), "qrcode_url", "二维码图片连接", "success");
}
}else{
String msg = decodeUnicode(gbEncoding(json.get("msg").toString()));
return retJSON("", "",msg, "error");
}
}
public static String getSign(Map<String, String> map) {
Set<String> set = new TreeSet<String>();
StringBuffer sb = new StringBuffer();
for (String s : map.keySet()) {
set.add(s);
}
int i = 0;
for (String s : set) {
if (i < 1) {
sb.append(s + "=" + map.get(s));
} else {
sb.append("&" + s + "=" + map.get(s));
}
i++;
}
System.out.println(sb.toString());
return sb.toString();
}
@Override
public String callback(Map<String, String> request) {
List<String> keys = new ArrayList<String>(request.keySet());
for (int i = 0; i < keys.size(); i++) {
String name = (String) keys.get(i);
String value = (String) request.get(name);
if (StringUtils.isNullOrEmpty(value)) {
logger.info("删除:" + name);
request.remove(name);
}
}
String sign = request.get("sign");
request.remove("sign");
request.put("mch_key", mch_key);
String queryStr = getSign(request);
String newSign = md5(queryStr);
if(sign.equals(newSign)){
return "success";
}
return null;
}
private static void callback() {
Map<String, String> paramMap = new HashMap<String, String>();
String a = System.currentTimeMillis()+"";
paramMap.put("mch_id", "viwgonhmfk");
paramMap.put("service", "10");
paramMap.put("mch_order", "CZFtxk201803182048512048513345");
paramMap.put("amt", "20000");
paramMap.put("mch_amt", "20000");
paramMap.put("sign_type", "md5");
paramMap.put("amt_type", "cny");
paramMap.put("status", "2");
paramMap.put("created_at", a);
String b = System.currentTimeMillis()+"";
paramMap.put("success_at", b);
paramMap.put("mch_key", "d023d0e37451aa53ce44cd7fe570d6a9");
String signStr1 = getSign(paramMap);
String sign = md5(signStr1);
paramMap.put("sign", sign);
paramMap.remove("mch_key");
String payResult = SimpleHttpUtils.httpPost("http://localhost:81/JJF/Notify/CZFNotify.do", paramMap);// 发送请求,POST请求,文档get请求是演示参数
System.out.println(payResult);
}
@Override
public JSONObject wyPay(PayEntity payEntity) {
// TODO Auto-generated method stub
Double amount = payEntity.getAmount();
String order_no = payEntity.getOrderNo();
String refereUrl = payEntity.getRefererUrl();
String pay_code = payEntity.getPayCode();
String userName = payEntity.getUsername();
String pay_url = payEntity.getPayUrl();
Map<String, String> scanMap = new HashMap<>();
scanMap.put("mch_order", payEntity.getOrderNo());// 订单号
scanMap.put("created_at", System.currentTimeMillis() + "");
String amt = String.valueOf((int)(payEntity.getAmount() * 1000));
scanMap.put("amt", amt);// 金额 .substring(0,amt.indexOf("."))
scanMap.put("client_ip", payEntity.getIp());// "172.16.31.10"
JSONObject retJson;
scanMap.put("bank_code", payEntity.getPayCode());
String payInfo = bankPay(scanMap);
return PayUtil.returnWYPayJson("success", "link", payInfo, null, "");
}
private String bankPay(Map<String, String> scanMap) {
Map<String,String> hashMap = new TreeMap<String,String>();
hashMap.put("sign_type", sign_type);
hashMap.put("mch_id", mch_id);
hashMap.put("mch_order", scanMap.get("mch_order"));
hashMap.put("amt", scanMap.get("amt"));
hashMap.put("remark", remark);
hashMap.put("created_at", scanMap.get("created_at"));
hashMap.put("client_ip", scanMap.get("client_ip"));
hashMap.put("notify_url", notify_url);
hashMap.put("bank_code", scanMap.get("bank_code"));//scanMap.get("bank_code")
hashMap.put("bank_card_type", "1");
hashMap.put("mch_key", mch_key);
String queryStr = getSign(hashMap);
String sign = md5(queryStr);
hashMap.put("sign", sign);
hashMap.remove("mch_key");
String responseStr = HttpUtil.RequestForm(url+"union.api", hashMap);
JSONObject responseJson= JSONObject.fromObject(responseStr);
logger.info("畅支付支付请求:" + responseJson);
String res_code = responseJson.getString("code");
String pay_info = null;//网银收银台地址
if("1".equals(res_code)) {//成功
pay_info = responseJson.getJSONObject("data").getString("pay_info");
}
return pay_info;
}
@Override
public JSONObject smPay(PayEntity payEntity) {
// TODO Auto-generated method stub
Double amount = payEntity.getAmount();
String order_no = payEntity.getOrderNo();
String userName = payEntity.getUsername();
Map<String, String> scanMap = new HashMap<String, String>();
Map<String, Object> json = new HashMap<String, Object>();
scanMap.put("mch_order", payEntity.getOrderNo());// 订单号
scanMap.put("created_at", System.currentTimeMillis() + "");
// String amt = String.valueOf(payEntity.getAmount() * 1000);
DecimalFormat df = new DecimalFormat("############");
String amt = df.format(payEntity.getAmount()* 1000);
scanMap.put("amt", amt);// 金额 .substring(0,amt.indexOf("."))
scanMap.put("client_ip",payEntity.getIp());// payEntity.getIp());//"172.16.17.32"
JSONObject retJson;
scanMap.put("payType", payEntity.getPayCode());
scanMap.put("mobile", payEntity.getMobile());
retJson = scanPay(scanMap);
if (retJson.getString("status").equals("success")) {
if (retJson.getString("type").equals("qrcode")) {
if(!StringUtils.isNullOrEmpty(payEntity.getMobile()) && payEntity.getPayCode().equals("union_qrcode")){
return PayUtil.returnPayJson("success", "4", "支付接口请求成功!", userName, amount, order_no, retJson.getString("link"));
}
return PayUtil.returnPayJson("success", "2", "支付接口请求成功!", userName, amount, order_no, retJson.getString("link"));
} else if (retJson.getString("type").equals("qrcode_url")) {
return PayUtil.returnPayJson("success", "4", "支付接口请求成功!", userName, amount, order_no, retJson.getString("link"));
} else if (payEntity.getPayCode().equals("wx_h5")){
return PayUtil.returnPayJson("error", "4", "支付接口请求失败!", userName, amount, order_no, retJson.getString("msg"));
}else{
return PayUtil.returnPayJson("error", "1", "支付接口请求失败!", userName, amount, order_no, retJson.getString("msg"));
}
}
return PayUtil.returnPayJson("error", "1", "支付接口请求失败!", userName, amount, order_no, retJson.getString("msg"));
}
public static void main(String[] args) {
String s = "amt=123000&bank_code =1001&client_ip=127.0.0.1&created_at=1529564886503&mch_id=elpwifdmsc&mch_key=248254578cc92fabea3c3f7fac2aa67b&mch_order=CZFbl1201806211508031508037721¬ify_url=http://txw.tx8899.com/YHH/Notify/CZFNotify.do&remark=tianxiazhifu&sign_type=md5";
/*
Map<String,String> hashMap = new HashMap<String,String>();
hashMap.put("amt", "100000");
hashMap.put("client_ip", "172.16.31.10");
hashMap.put("created_at", System.currentTimeMillis() + "");
hashMap.put("mch_id", "tmygnxasqh");
hashMap.put("mch_order", "CZF"+System.currentTimeMillis());
hashMap.put("notify_url", "https://www.6hghg.com/HG1/PlatformPay/QFTNotify.do");
hashMap.put("remark", "xianxiazhifu");
hashMap.put("sign_type", "md5");
hashMap.put("mch_key", "284bdd34ae8e91156c3682ee0f26bad0");
// hashMap.put("user_bank_id ", "1");
// hashMap.put("bank_card_type ", "11");
// hashMap.put("bank_code ", "1026");
// hashMap.put("callback_url ", "https://www.6hghg.com");
String queryStr = getSign(hashMap);
String sign = md5(queryStr);
hashMap.put("sign", sign);
hashMap.remove("mch_key");
String rusult = doPost("https://sdk.consucredit.com/api/v1/union_qrcode.api", hashMap, "UTF-8");
System.out.println(rusult);
// String FormString = "<body onLoad=\"document.actform.submit()\">正在处理请稍候.....................<form id=\"actform\" name=\"actform\" method=\"post\" action=\""
// + "https://sdk.consucredit.com/api/v1/quick_page.api" + "\">";
// for (String key : hashMap.keySet()) {
// FormString += "<input name=\"" + key + "\" type=\"hidden\" value='" + hashMap.get(key) + "'>\r\n";
// }
// FormString += "</form></body>";
//
// String html = FormString;
// String html = HttpUtil.HtmlFrom(url, resquestMap);
// System.out.println(html);
// Map<String,String> hashMap = new HashMap<String,String>();
// hashMap.put("amt", "100000");
// hashMap.put("client_ip", "172.16.31.10");
// hashMap.put("created_at", System.currentTimeMillis() + "");
// hashMap.put("mch_id", "elpwifdmsc");
// hashMap.put("mch_order", "CZF"+System.currentTimeMillis());
// hashMap.put("notify_url", "https://www.6hghg.com/HG1/PlatformPay/QFTNotify.do");
// hashMap.put("remark", "xianxiazhifu");
// hashMap.put("sign_type", "md5");
// hashMap.put("mch_key", "248254578cc92fabea3c3f7fac2aa67b");
// String queryStr = getSign(hashMap);
// String sign = md5(queryStr);
// hashMap.put("sign", sign);
// hashMap.remove("mch_key");
// String rusult = doPost("https://sdk.consucredit.com/api/v1/ali_qrcode.api", hashMap, "UTF-8");
// JSONObject json = JSONObject.fromObject(rusult);
// System.out.println("返回结果:"+rusult);
*/}
}
| 17,220 | 0.647767 | 0.628033 | 464 | 35.148708 | 28.246786 | 278 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.799569 | false | false |
9
|
086506a7336feff02324af918cd5ffea34f4978d
| 25,331,717,121,963 |
77aaea65429193925d1d923faafd77d9eddc0e09
|
/app/src/main/java/com/dotplays/customspiner2/MySpinnerAdapter.java
|
9965ec312e8dd64c258fdd9b335d04f85e83ab91
|
[] |
no_license
|
huuhuybn/CustomSpinner2
|
https://github.com/huuhuybn/CustomSpinner2
|
8ec0d1ad25fbb3a79dd7a5b0458ed19a48f9e37b
|
4dbac9827b7e9654699bd7525b1588582596fd46
|
refs/heads/master
| 2020-06-02T13:52:13.863000 | 2019-06-10T14:03:30 | 2019-06-10T14:03:30 | 191,177,270 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.dotplays.customspiner2;
import android.content.Context;
import android.database.DataSetObserver;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.SpinnerAdapter;
import android.widget.TextView;
import java.util.List;
public class MySpinnerAdapter implements SpinnerAdapter {
private List<Student> studentList;
private Context context;
public MySpinnerAdapter(Context context,List<Student> studentList) {
this.studentList = studentList;
this.context = context;
}
@Override
public View getDropDownView(int position, View convertView, ViewGroup parent) {
convertView = LayoutInflater.from(context).inflate(R.layout.drop_row, parent, false);
TextView tvName = convertView.findViewById(R.id.tvName);
tvName.setText(studentList.get(position).name);
return convertView;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
convertView = LayoutInflater.from(context).inflate(R.layout.seleted_row, parent, false);
TextView tvName = convertView.findViewById(R.id.tvName);
tvName.setText(studentList.get(position).name);
return convertView;
}
@Override
public int getViewTypeCount() {
return 1;
}
@Override
public int getCount() {
return studentList.size();
}
@Override
public Student getItem(int position) {
return studentList.get(position);
}
@Override
public long getItemId(int position) {
return 0;
}
@Override
public boolean hasStableIds() {
return false;
}
@Override
public int getItemViewType(int position) {
return 0;
}
@Override
public boolean isEmpty() {
return false;
}
@Override
public void registerDataSetObserver(DataSetObserver observer) {
}
@Override
public void unregisterDataSetObserver(DataSetObserver observer) {
}
}
|
UTF-8
|
Java
| 2,044 |
java
|
MySpinnerAdapter.java
|
Java
|
[] | null |
[] |
package com.dotplays.customspiner2;
import android.content.Context;
import android.database.DataSetObserver;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.SpinnerAdapter;
import android.widget.TextView;
import java.util.List;
public class MySpinnerAdapter implements SpinnerAdapter {
private List<Student> studentList;
private Context context;
public MySpinnerAdapter(Context context,List<Student> studentList) {
this.studentList = studentList;
this.context = context;
}
@Override
public View getDropDownView(int position, View convertView, ViewGroup parent) {
convertView = LayoutInflater.from(context).inflate(R.layout.drop_row, parent, false);
TextView tvName = convertView.findViewById(R.id.tvName);
tvName.setText(studentList.get(position).name);
return convertView;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
convertView = LayoutInflater.from(context).inflate(R.layout.seleted_row, parent, false);
TextView tvName = convertView.findViewById(R.id.tvName);
tvName.setText(studentList.get(position).name);
return convertView;
}
@Override
public int getViewTypeCount() {
return 1;
}
@Override
public int getCount() {
return studentList.size();
}
@Override
public Student getItem(int position) {
return studentList.get(position);
}
@Override
public long getItemId(int position) {
return 0;
}
@Override
public boolean hasStableIds() {
return false;
}
@Override
public int getItemViewType(int position) {
return 0;
}
@Override
public boolean isEmpty() {
return false;
}
@Override
public void registerDataSetObserver(DataSetObserver observer) {
}
@Override
public void unregisterDataSetObserver(DataSetObserver observer) {
}
}
| 2,044 | 0.683464 | 0.681507 | 90 | 21.711111 | 23.987146 | 96 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.411111 | false | false |
9
|
f14c035c1f42c5292d1eb652dad486a1879cc66b
| 26,560,077,774,350 |
cc28ed0e8f362b8b192c448b83f82a6ef60705fd
|
/app/src/main/java/com/function/luo/day0620/MyApplication.java
|
dfd92f4b1e9451dbdf3f248008f239596f67b122
|
[] |
no_license
|
lyyRunning/greenDao
|
https://github.com/lyyRunning/greenDao
|
a2fbce9a793dff71958fa74d4781e70f5c34c89f
|
8bc9eae8ab04307a3c29941d51e3cc191c138c9c
|
refs/heads/master
| 2020-06-07T11:54:10.375000 | 2019-06-21T02:31:10 | 2019-06-21T02:31:10 | 193,016,859 | 3 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.function.luo.day0620;
import android.app.Application;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import com.function.luo.bean.DaoMaster;
import com.function.luo.bean.DaoSession;
import com.function.luo.utils.MySqliteOpenHelper;
import com.github.yuweiguocn.library.greendao.MigrationHelper;
/**
* Created by luo on 2019/6/20.
*/
public class MyApplication extends Application{
private static DaoSession daoSession;
private static Context mContext;
@Override
public void onCreate() {
super.onCreate();
mContext = this;
initGreenDao();
}
/**
* 初始化GreenDao,直接在Application中进行初始化操作
*/
private void initGreenDao() {
// 初始化//如果你想查看日志信息,请将 DEBUG 设置为 true
if (BuildConfig.DEBUG){
MigrationHelper.DEBUG = true;
}else {
MigrationHelper.DEBUG = false;
}
//数据库名字
MySqliteOpenHelper mySqliteOpenHelper = new MySqliteOpenHelper(mContext, "greenDaoTest.db",null);
SQLiteDatabase db = mySqliteOpenHelper.getWritableDatabase();
DaoMaster daoMaster = new DaoMaster(db);
daoSession = daoMaster.newSession();
}
/**
* 提供一个全局的会话
* @return
*/
public static DaoSession getDaoSession() {
return daoSession;
}
/**
* 提供一个全局的上下文
* @return
*/
public static Context getApplication(){
return mContext;
}
}
|
UTF-8
|
Java
| 1,588 |
java
|
MyApplication.java
|
Java
|
[
{
"context": "luo.utils.MySqliteOpenHelper;\nimport com.github.yuweiguocn.library.greendao.MigrationHelper;\n\n/**\n * Created",
"end": 306,
"score": 0.7725920081138611,
"start": 298,
"tag": "USERNAME",
"value": "weiguocn"
},
{
"context": "brary.greendao.MigrationHelper;\n\n/**\n * Created by luo on 2019/6/20.\n */\n\npublic class MyApplication ex",
"end": 363,
"score": 0.9995014667510986,
"start": 360,
"tag": "USERNAME",
"value": "luo"
}
] | null |
[] |
package com.function.luo.day0620;
import android.app.Application;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import com.function.luo.bean.DaoMaster;
import com.function.luo.bean.DaoSession;
import com.function.luo.utils.MySqliteOpenHelper;
import com.github.yuweiguocn.library.greendao.MigrationHelper;
/**
* Created by luo on 2019/6/20.
*/
public class MyApplication extends Application{
private static DaoSession daoSession;
private static Context mContext;
@Override
public void onCreate() {
super.onCreate();
mContext = this;
initGreenDao();
}
/**
* 初始化GreenDao,直接在Application中进行初始化操作
*/
private void initGreenDao() {
// 初始化//如果你想查看日志信息,请将 DEBUG 设置为 true
if (BuildConfig.DEBUG){
MigrationHelper.DEBUG = true;
}else {
MigrationHelper.DEBUG = false;
}
//数据库名字
MySqliteOpenHelper mySqliteOpenHelper = new MySqliteOpenHelper(mContext, "greenDaoTest.db",null);
SQLiteDatabase db = mySqliteOpenHelper.getWritableDatabase();
DaoMaster daoMaster = new DaoMaster(db);
daoSession = daoMaster.newSession();
}
/**
* 提供一个全局的会话
* @return
*/
public static DaoSession getDaoSession() {
return daoSession;
}
/**
* 提供一个全局的上下文
* @return
*/
public static Context getApplication(){
return mContext;
}
}
| 1,588 | 0.651289 | 0.643826 | 67 | 21 | 21.215315 | 105 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.358209 | false | false |
9
|
87dd978c0fff510391e50bb126065a9e7543a208
| 29,317,446,785,732 |
ca07495d3702170ffd6cbbaf544795eb6969b48b
|
/nime-dispatch/src/main/java/com/train/dispatch/analysisReport/service/IKPIAnalysisService.java
|
98bc1840c253c0d381dab8b101644f38ab775db4
|
[] |
no_license
|
sxx-github/NIMS
|
https://github.com/sxx-github/NIMS
|
ce9e4a1ae7fad01956a0b78711b75bde98dd0ae7
|
4bc11108a4dcad51810eb717bd4f3fa261394e66
|
refs/heads/master
| 2020-06-14T10:06:06.205000 | 2019-07-03T06:39:24 | 2019-07-03T06:39:24 | 194,976,360 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.train.dispatch.analysisReport.service;
import com.train.dispatch.analysisReport.model.KPIAnalysisModel;
import com.train.dispatch.analysisReport.model.KPIComplete;
import java.util.List;
import java.util.Map;
public interface IKPIAnalysisService {
/**
* 获取指定月份所有段所的13个KPI指标。
* 如果是历史月,获取当月所有数据;
* 如果是当月,获取月初至今的数据
* @param time
* @return
*/
List<KPIComplete> selectMonthList(String time);
/**
* 检修信息获取:高级修、临修、二级修
* @param deptCode
* @param periodType
* @param startDay
* @param endDay
* @param weekDays
* @return
*/
Map<String, Object> repairDatas(String deptCode, String periodType, String startDay, String endDay, String[] weekDays, String days[]);
/**
* KPI指标分析页面数据获取
* @param deptCode
* @param KPIType
* @param periodType
* @param startDay
* @param endDay
* @param weekDays
* @return
*/
KPIAnalysisModel KPIAnalysis(String deptCode, String KPIType, String periodType, String startDay, String endDay, String[] weekDays);
/**
* @param deptCode
* @param KPIType
* @param days
* @return
*/
KPIAnalysisModel KPIDataRandomDay(String deptCode, String KPIType, String[] days);
}
|
UTF-8
|
Java
| 1,410 |
java
|
IKPIAnalysisService.java
|
Java
|
[] | null |
[] |
package com.train.dispatch.analysisReport.service;
import com.train.dispatch.analysisReport.model.KPIAnalysisModel;
import com.train.dispatch.analysisReport.model.KPIComplete;
import java.util.List;
import java.util.Map;
public interface IKPIAnalysisService {
/**
* 获取指定月份所有段所的13个KPI指标。
* 如果是历史月,获取当月所有数据;
* 如果是当月,获取月初至今的数据
* @param time
* @return
*/
List<KPIComplete> selectMonthList(String time);
/**
* 检修信息获取:高级修、临修、二级修
* @param deptCode
* @param periodType
* @param startDay
* @param endDay
* @param weekDays
* @return
*/
Map<String, Object> repairDatas(String deptCode, String periodType, String startDay, String endDay, String[] weekDays, String days[]);
/**
* KPI指标分析页面数据获取
* @param deptCode
* @param KPIType
* @param periodType
* @param startDay
* @param endDay
* @param weekDays
* @return
*/
KPIAnalysisModel KPIAnalysis(String deptCode, String KPIType, String periodType, String startDay, String endDay, String[] weekDays);
/**
* @param deptCode
* @param KPIType
* @param days
* @return
*/
KPIAnalysisModel KPIDataRandomDay(String deptCode, String KPIType, String[] days);
}
| 1,410 | 0.656646 | 0.655063 | 50 | 24.280001 | 28.730499 | 138 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.44 | false | false |
9
|
0cc7bfc040314717c8a887f54edcb2718efeb6fc
| 23,648,089,956,403 |
d5aec66183cc0f7e42b0c06187f9e09dd173b157
|
/Frontend/app/src/main/java/com/example/myapplication/SecurityLogic.java
|
8b6fe7051d5181198776075b678e826c5d7b379b
|
[] |
no_license
|
aman-a1/ISUMarketPlace
|
https://github.com/aman-a1/ISUMarketPlace
|
f804ddc839af7dae375b140feadba5754038bd73
|
07a1564f9592d1074bf331218fe720c84617a66c
|
refs/heads/main
| 2023-04-22T16:50:46.758000 | 2021-05-04T04:57:30 | 2021-05-04T04:57:30 | 364,143,781 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.myapplication;
/**
* This activity is the logic part to change the password of your account.
* @author Abdula Eljaam (abeljaam)
*/
import android.text.method.PasswordTransformationMethod;
import android.util.Log;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.android.volley.VolleyError;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.UnsupportedEncodingException;
public class SecurityLogic implements IVolleyListener{
IView d;
IServerRequest r;
/**
* Constructor to create an instance of SecurityLogic.
* @param d The IView given.
* @param r The IServerRequest given
*/
public SecurityLogic(IView d, IServerRequest r){
this.d = d;
this.r = r;
r.addIVolleyListener(this);
}
/**
* Method to insert inputted paramters in a user object and send request to the server.
* @param username username of account.
* @param oldPassword current password.
* @param password new password.
* @return Nothing.
*/
public void changePassword(String username, String oldPassword,String password) {
String url = "http://coms-309-vb-05.cs.iastate.edu:8080/User/"+username+"/ChangePassword";
JSONObject user_object = new JSONObject();
try {
user_object.put("username",username);
user_object.put("oldPassword", oldPassword);
user_object.put("newPassword", password);
}catch (JSONException e){
e.printStackTrace();
}
r.sendToServer(url, user_object, "PUT");
}
/**
* Method to check the inputted paramters if the current password is correct, and if the new password passes the validation requirements.
* @param first Current password entered
* @param second New password entered
* @param password Current password of user
* @return Response message.
*/
public String checkInputChange(String first, String second, String password) {
String regex = "^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z]).{8,20}$";
if(!first.equals(password) && second.matches(regex)){
d.toastText("You have incorrectly entered your current password!");
return "You have incorrectly entered your current password!";
}
else if(!second.matches(regex) && first.equals(password)){
d.toastText("Your new password has not met all conditions: contains at least 8 characters and at most 20 characters, contains at least one digit, contains at least one upper case alphabet, and contains at least one lower case alphabet.");
return "Your new password has not met all conditions: contains at least 8 characters and at most 20 characters, contains at least one digit, contains at least one upper case alphabet, and contains at least one lower case alphabet.";
}
else if(first.equals(password) && second.matches(regex)){
d.toastText("You have successfully entered the data!");
return "You have successfully entered the data!";
}
else if(!first.equals(password) && !second.matches(regex)){
d.toastText("You have incorrectly typed your current passsword and your new one does not" +
" follow the following requirements: contains at least 8 characters and at most 20 characters, It contains at least one digit, It contains at least one upper case alphabet, It contains at least one lower case alphabet.");
return "You have incorrectly typed your current passsword and your new one does not " +
"follow the following requirements: contains at least 8 characters and at most 20 characters, It contains at least one digit, It contains at least one upper case alphabet, It contains at least one lower case alphabet.";
}
return null;
}
/**
* Method to show or hide the text entered in the new password edit text.
* @param i Integer to know if even or odd
* @param show Button to show or hide
* @param t The EditText that is used to enter new password
* @return Nothing.
*/
public void showHide(int i, Button show, EditText t){
if(i%2 == 0) {
t.setTransformationMethod(null);
show.setText("HIDE");
}
else{
t.setTransformationMethod(new PasswordTransformationMethod());
show.setText("SHOW");
}
}
/**
* Method to control if request was a success.
* @param getResponseMessage Respsonse Message
* @return Nothing.
*/
@Override
public void onSuccess(String getResponseMessage) {
d.toastText(getResponseMessage);
}
/**
* Method to control if request was an error.
* @param error The error given by server
* @return Nothing.
*/
@Override
public void onError(VolleyError error) {
String body;
String getResponseMessage;
JSONObject bodyJsonObject;
String statusCode = String.valueOf(error.networkResponse.statusCode);
if(statusCode.equals("401")){
if(error.networkResponse.data != null){
try{
body = new String(error.networkResponse.data, "UTF-8");
bodyJsonObject = new JSONObject(body);
getResponseMessage = bodyJsonObject.getString("message");
d.toastText(getResponseMessage);
} catch (UnsupportedEncodingException | JSONException e) {
e.printStackTrace();
}
}
}
else if(statusCode.equals("404")){
if(error.networkResponse.data != null){
try{
body = new String(error.networkResponse.data, "UTF-8");
bodyJsonObject = new JSONObject(body);
getResponseMessage = bodyJsonObject.getString("message");
d.toastText(getResponseMessage);
} catch (UnsupportedEncodingException | JSONException e) {
e.printStackTrace();
}
}
}
else{
Log.d("Error.Response", String.valueOf(error));
}
}
}
|
UTF-8
|
Java
| 6,317 |
java
|
SecurityLogic.java
|
Java
|
[
{
"context": " to change the password of your account.\n* @author Abdula Eljaam (abeljaam)\n*/\n\n\nimport android.text.method.Passwo",
"end": 137,
"score": 0.9998939037322998,
"start": 124,
"tag": "NAME",
"value": "Abdula Eljaam"
},
{
"context": "assword of your account.\n* @author Abdula Eljaam (abeljaam)\n*/\n\n\nimport android.text.method.PasswordTransfor",
"end": 147,
"score": 0.9995936751365662,
"start": 139,
"tag": "USERNAME",
"value": "abeljaam"
},
{
"context": "ldPassword current password.\n * @param password new password.\n * @return Nothing.\n */\n\n public void c",
"end": 1072,
"score": 0.7209372520446777,
"start": 1060,
"tag": "PASSWORD",
"value": "new password"
},
{
"context": " second New password entered\n * @param password Current password of user\n * @return Response message.\n */\n\n ",
"end": 1929,
"score": 0.965012788772583,
"start": 1913,
"tag": "PASSWORD",
"value": "Current password"
}
] | null |
[] |
package com.example.myapplication;
/**
* This activity is the logic part to change the password of your account.
* @author <NAME> (abeljaam)
*/
import android.text.method.PasswordTransformationMethod;
import android.util.Log;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;
import com.android.volley.VolleyError;
import org.json.JSONException;
import org.json.JSONObject;
import java.io.UnsupportedEncodingException;
public class SecurityLogic implements IVolleyListener{
IView d;
IServerRequest r;
/**
* Constructor to create an instance of SecurityLogic.
* @param d The IView given.
* @param r The IServerRequest given
*/
public SecurityLogic(IView d, IServerRequest r){
this.d = d;
this.r = r;
r.addIVolleyListener(this);
}
/**
* Method to insert inputted paramters in a user object and send request to the server.
* @param username username of account.
* @param oldPassword current password.
* @param password <PASSWORD>.
* @return Nothing.
*/
public void changePassword(String username, String oldPassword,String password) {
String url = "http://coms-309-vb-05.cs.iastate.edu:8080/User/"+username+"/ChangePassword";
JSONObject user_object = new JSONObject();
try {
user_object.put("username",username);
user_object.put("oldPassword", oldPassword);
user_object.put("newPassword", password);
}catch (JSONException e){
e.printStackTrace();
}
r.sendToServer(url, user_object, "PUT");
}
/**
* Method to check the inputted paramters if the current password is correct, and if the new password passes the validation requirements.
* @param first Current password entered
* @param second New password entered
* @param password <PASSWORD> of user
* @return Response message.
*/
public String checkInputChange(String first, String second, String password) {
String regex = "^(?=.*[0-9])(?=.*[a-z])(?=.*[A-Z]).{8,20}$";
if(!first.equals(password) && second.matches(regex)){
d.toastText("You have incorrectly entered your current password!");
return "You have incorrectly entered your current password!";
}
else if(!second.matches(regex) && first.equals(password)){
d.toastText("Your new password has not met all conditions: contains at least 8 characters and at most 20 characters, contains at least one digit, contains at least one upper case alphabet, and contains at least one lower case alphabet.");
return "Your new password has not met all conditions: contains at least 8 characters and at most 20 characters, contains at least one digit, contains at least one upper case alphabet, and contains at least one lower case alphabet.";
}
else if(first.equals(password) && second.matches(regex)){
d.toastText("You have successfully entered the data!");
return "You have successfully entered the data!";
}
else if(!first.equals(password) && !second.matches(regex)){
d.toastText("You have incorrectly typed your current passsword and your new one does not" +
" follow the following requirements: contains at least 8 characters and at most 20 characters, It contains at least one digit, It contains at least one upper case alphabet, It contains at least one lower case alphabet.");
return "You have incorrectly typed your current passsword and your new one does not " +
"follow the following requirements: contains at least 8 characters and at most 20 characters, It contains at least one digit, It contains at least one upper case alphabet, It contains at least one lower case alphabet.";
}
return null;
}
/**
* Method to show or hide the text entered in the new password edit text.
* @param i Integer to know if even or odd
* @param show Button to show or hide
* @param t The EditText that is used to enter new password
* @return Nothing.
*/
public void showHide(int i, Button show, EditText t){
if(i%2 == 0) {
t.setTransformationMethod(null);
show.setText("HIDE");
}
else{
t.setTransformationMethod(new PasswordTransformationMethod());
show.setText("SHOW");
}
}
/**
* Method to control if request was a success.
* @param getResponseMessage Respsonse Message
* @return Nothing.
*/
@Override
public void onSuccess(String getResponseMessage) {
d.toastText(getResponseMessage);
}
/**
* Method to control if request was an error.
* @param error The error given by server
* @return Nothing.
*/
@Override
public void onError(VolleyError error) {
String body;
String getResponseMessage;
JSONObject bodyJsonObject;
String statusCode = String.valueOf(error.networkResponse.statusCode);
if(statusCode.equals("401")){
if(error.networkResponse.data != null){
try{
body = new String(error.networkResponse.data, "UTF-8");
bodyJsonObject = new JSONObject(body);
getResponseMessage = bodyJsonObject.getString("message");
d.toastText(getResponseMessage);
} catch (UnsupportedEncodingException | JSONException e) {
e.printStackTrace();
}
}
}
else if(statusCode.equals("404")){
if(error.networkResponse.data != null){
try{
body = new String(error.networkResponse.data, "UTF-8");
bodyJsonObject = new JSONObject(body);
getResponseMessage = bodyJsonObject.getString("message");
d.toastText(getResponseMessage);
} catch (UnsupportedEncodingException | JSONException e) {
e.printStackTrace();
}
}
}
else{
Log.d("Error.Response", String.valueOf(error));
}
}
}
| 6,302 | 0.628938 | 0.623239 | 179 | 34.290504 | 42.112572 | 250 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.463687 | false | false |
9
|
c1d33d4e92c7d27e219164c7571746da35fa1141
| 5,317,169,582,583 |
780f39ff55b0ff2c22ea27860a1863df523b6cb5
|
/src/Utils/TableInfo.java
|
47a6e5b15cc3df90f7d2ce21fc72018989696f36
|
[] |
no_license
|
qiusu/softwarerepfulltextsearch
|
https://github.com/qiusu/softwarerepfulltextsearch
|
2c49aa8dfa22e9b6aa10081e0f9adf6ae98b9ebe
|
2c912f5fad9304e8d95d80c5c68bcb260b71b8db
|
refs/heads/master
| 2020-03-16T09:40:52.237000 | 2018-04-24T10:30:46 | 2018-04-24T10:30:46 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package Utils;
import java.util.List;
public class TableInfo {
private String tableName;
private List<List<TableColumns>> columnList;
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
public List<List<TableColumns>> getColumn() {
return columnList;
}
public void setColumn(List<List<TableColumns>> columnList) {
this.columnList = columnList;
}
}
|
UTF-8
|
Java
| 444 |
java
|
TableInfo.java
|
Java
|
[] | null |
[] |
package Utils;
import java.util.List;
public class TableInfo {
private String tableName;
private List<List<TableColumns>> columnList;
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
public List<List<TableColumns>> getColumn() {
return columnList;
}
public void setColumn(List<List<TableColumns>> columnList) {
this.columnList = columnList;
}
}
| 444 | 0.745495 | 0.745495 | 21 | 20.142857 | 18.048309 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.285714 | false | false |
9
|
5b5116ccad52044835edf7680310b84191eb0054
| 8,985,071,608,099 |
88a83bdf997f463bcded5bcf94a8d81738fb781c
|
/main/java/thelarsinator/lomarctic/core/LotsOMobsArctic.java
|
72fc807f0a49d544a62b0c3ea578c03b6b3cbc36
|
[] |
no_license
|
TheLarsinator/LotsOMobs-1.9
|
https://github.com/TheLarsinator/LotsOMobs-1.9
|
a535055811bc1bd5059a4bee97b56db75864af58
|
5b0c0dce97162d9b896057b6f295762a7ca4e190
|
refs/heads/master
| 2016-09-12T22:28:12.032000 | 2016-05-07T19:43:49 | 2016-05-07T19:43:49 | 58,281,765 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package thelarsinator.lomarctic.core;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import thelarsinator.lomarctic.init.LotsOMobsArcticMobs;
import thelarsinator.lomarctic.init.LotsOMobsArcticRecipes;
@Mod (modid = "lomarc", name = "LotsOMobsArctic", version = "1.9-1.0", dependencies = "required-after:lom")
public class LotsOMobsArctic
{
public static String modid = "lomarc";
@SidedProxy(clientSide = "thelarsinator.lomarctic.core.LotsOMobsArcticClient", serverSide = "thelarsinator.lomarctic.core.LotsOMobsArcticProxy")
public static LotsOMobsArcticProxy proxy;
@Mod.Instance("lomarc")
public static LotsOMobsArctic instance;
//PreInit
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event)
{
// LotsOMobsBlocks.Init();
// LotsOMobsBiomes.Init();
// LotsOMobsAchievementsBook.Init();
}
@EventHandler
public void load(FMLInitializationEvent event)
{
LotsOMobsArcticMobs.Init();
LotsOMobsArcticRecipes.RecipeBook();
proxy.registerRenderInformation();
}
}
|
UTF-8
|
Java
| 1,274 |
java
|
LotsOMobsArctic.java
|
Java
|
[] | null |
[] |
package thelarsinator.lomarctic.core;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import thelarsinator.lomarctic.init.LotsOMobsArcticMobs;
import thelarsinator.lomarctic.init.LotsOMobsArcticRecipes;
@Mod (modid = "lomarc", name = "LotsOMobsArctic", version = "1.9-1.0", dependencies = "required-after:lom")
public class LotsOMobsArctic
{
public static String modid = "lomarc";
@SidedProxy(clientSide = "thelarsinator.lomarctic.core.LotsOMobsArcticClient", serverSide = "thelarsinator.lomarctic.core.LotsOMobsArcticProxy")
public static LotsOMobsArcticProxy proxy;
@Mod.Instance("lomarc")
public static LotsOMobsArctic instance;
//PreInit
@Mod.EventHandler
public void preInit(FMLPreInitializationEvent event)
{
// LotsOMobsBlocks.Init();
// LotsOMobsBiomes.Init();
// LotsOMobsAchievementsBook.Init();
}
@EventHandler
public void load(FMLInitializationEvent event)
{
LotsOMobsArcticMobs.Init();
LotsOMobsArcticRecipes.RecipeBook();
proxy.registerRenderInformation();
}
}
| 1,274 | 0.78179 | 0.77865 | 39 | 31.692308 | 30.708015 | 145 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.358974 | false | false |
9
|
7cc75e921be2b025eb3db0f65df05b43ea2e8f20
| 15,066,745,294,262 |
878d5e8723ca525282954c5d171212785ebdc53e
|
/model/src/main/java/com/housing/javaee6demo/model/package-info.java
|
37f00a7883c09979295f63660627db044d7ccf4a
|
[] |
no_license
|
ramirescm/javaee6-demo
|
https://github.com/ramirescm/javaee6-demo
|
b3d59061975028fc0513b55a0a5bfbde691f03b2
|
cfc96e528e216d57f86a5bc8fc9b5641a1627911
|
refs/heads/master
| 2021-01-20T07:31:48.333000 | 2012-04-03T09:53:15 | 2012-04-03T09:53:15 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
@XmlAccessorType(XmlAccessType.FIELD)
package com.housing.javaee6demo.model;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
|
UTF-8
|
Java
| 176 |
java
|
package-info.java
|
Java
|
[] | null |
[] |
@XmlAccessorType(XmlAccessType.FIELD)
package com.housing.javaee6demo.model;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
| 176 | 0.852273 | 0.846591 | 5 | 34.200001 | 17.747112 | 49 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6 | false | false |
9
|
3fe3356d8cc61846e2b0b0ed56efd7b5a30f75ea
| 23,983,097,395,576 |
8fc3dba3e446a5915b4857fe88bb1647e9580479
|
/modules/nexus-core/src/test/java/com/youama/nexus/core/system/BeansApplicationContextTest.java
|
b0e57efd6a34791e7aabcbbe62188a65d0753fd5
|
[
"MIT"
] |
permissive
|
AphelionGroup/Nexus-Engine
|
https://github.com/AphelionGroup/Nexus-Engine
|
c3a0d5bd2d33a248c99385cf19b132a2ccb2333a
|
a5c4cb8d453ded1b89c084850f75570d9fe3e836
|
refs/heads/master
| 2020-03-26T15:41:50.040000 | 2015-10-10T21:00:31 | 2015-10-10T21:00:31 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.youama.nexus.core.system;
import org.junit.*;
import org.springframework.beans.factory.BeanCreationException;
/**
* @author David Belicza
* @since 0.1.0
*/
public class BeansApplicationContextTest {
private BeansApplicationContext singleService;
@Before
public void setUp() {
singleService = new BeansApplicationContext();
}
@Test(expected = BeanCreationException.class)
public void testSetApplicationContext() {
singleService.setApplicationContext();
}
@Test(expected = NullPointerException.class)
public void testGetService() {
singleService.getService(Object.class);
}
}
|
UTF-8
|
Java
| 658 |
java
|
BeansApplicationContextTest.java
|
Java
|
[
{
"context": "ans.factory.BeanCreationException;\n\n/**\n * @author David Belicza\n * @since 0.1.0\n */\npublic class BeansApplication",
"end": 152,
"score": 0.9998629689216614,
"start": 139,
"tag": "NAME",
"value": "David Belicza"
}
] | null |
[] |
package com.youama.nexus.core.system;
import org.junit.*;
import org.springframework.beans.factory.BeanCreationException;
/**
* @author <NAME>
* @since 0.1.0
*/
public class BeansApplicationContextTest {
private BeansApplicationContext singleService;
@Before
public void setUp() {
singleService = new BeansApplicationContext();
}
@Test(expected = BeanCreationException.class)
public void testSetApplicationContext() {
singleService.setApplicationContext();
}
@Test(expected = NullPointerException.class)
public void testGetService() {
singleService.getService(Object.class);
}
}
| 651 | 0.715805 | 0.711246 | 28 | 22.535715 | 21.138121 | 63 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false |
9
|
30f3bbc732ce99a6f7e1bc94cd846f2398d8fb85
| 9,036,611,248,524 |
66ef22ea58cbac8dd35243127bb8c071dd809073
|
/core-jsf-bean/src/main/java/aroliveira/core/beans/Planetarium.java
|
f89ecb34259ccfb409210c3f0d5b28e13e6079e6
|
[] |
no_license
|
aroliveira/core-jsf
|
https://github.com/aroliveira/core-jsf
|
fc4672d8ee2b07f79fc2ceede2bf756b44ce4639
|
1d1bba7a3098329248924bb3ac714c78f130c011
|
refs/heads/master
| 2020-04-25T22:37:21.156000 | 2012-01-13T01:05:32 | 2012-01-13T01:05:32 | 3,167,386 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package aroliveira.core.beans;
import java.io.Serializable;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
@Named("planetarium")
@RequestScoped
public class Planetarium implements Serializable {
private static final long serialVersionUID = 2501037828585504662L;
private String selectedPlanet;
public String getSelectedPlanet() {
return selectedPlanet;
}
public String changePlanet(String newValue){
selectedPlanet = newValue;
return selectedPlanet;
}
}
|
UTF-8
|
Java
| 503 |
java
|
Planetarium.java
|
Java
|
[] | null |
[] |
package aroliveira.core.beans;
import java.io.Serializable;
import javax.enterprise.context.RequestScoped;
import javax.inject.Named;
@Named("planetarium")
@RequestScoped
public class Planetarium implements Serializable {
private static final long serialVersionUID = 2501037828585504662L;
private String selectedPlanet;
public String getSelectedPlanet() {
return selectedPlanet;
}
public String changePlanet(String newValue){
selectedPlanet = newValue;
return selectedPlanet;
}
}
| 503 | 0.795229 | 0.757455 | 24 | 19.958334 | 19.264561 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.041667 | false | false |
9
|
1ba1a13bb7fbffcb2b5aa3778102f63b84389911
| 9,036,611,248,117 |
6c581f6164eebe845a848e8c2d9f8315f7e264fd
|
/org.abchip.mimo.biz.model/src/org/abchip/mimo/biz/model/order/shoppinglist/ShoppinglistFactory.java
|
86fa1098b0d06af6e270dfd3da16621e43510ad8
|
[] |
no_license
|
abchip/mimo-biz20
|
https://github.com/abchip/mimo-biz20
|
7a0b110fd40733a7f3049d1871ef9559bc08db5c
|
a3cffeccb98d200ff2ecd629942b4279364d3373
|
refs/heads/master
| 2023-03-22T22:54:03.865000 | 2021-03-18T20:35:52 | 2021-03-18T20:35:52 | 245,134,382 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/**
* Copyright (c) 2017, 2021 ABChip and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.abchip.mimo.biz.model.order.shoppinglist;
import org.eclipse.emf.ecore.EFactory;
/**
* <!-- begin-user-doc -->
* The <b>Factory</b> for the model.
* It provides a create method for each non-abstract class of the model.
* <!-- end-user-doc -->
* @see org.abchip.mimo.biz.model.order.shoppinglist.ShoppinglistPackage
* @generated
*/
public interface ShoppinglistFactory extends EFactory {
/**
* The singleton instance of the factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
ShoppinglistFactory eINSTANCE = org.abchip.mimo.biz.model.order.shoppinglist.impl.ShoppinglistFactoryImpl.init();
/**
* Returns a new object of class '<em>Shopping List</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Shopping List</em>'.
* @generated
*/
ShoppingList createShoppingList();
/**
* Returns a new object of class '<em>Shopping List Item</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Shopping List Item</em>'.
* @generated
*/
ShoppingListItem createShoppingListItem();
/**
* Returns a new object of class '<em>Shopping List Item Survey</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Shopping List Item Survey</em>'.
* @generated
*/
ShoppingListItemSurvey createShoppingListItemSurvey();
/**
* Returns a new object of class '<em>Shopping List Type</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Shopping List Type</em>'.
* @generated
*/
ShoppingListType createShoppingListType();
/**
* Returns a new object of class '<em>Shopping List Work Effort</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Shopping List Work Effort</em>'.
* @generated
*/
ShoppingListWorkEffort createShoppingListWorkEffort();
/**
* Returns the package supported by this factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the package supported by this factory.
* @generated
*/
ShoppinglistPackage getShoppinglistPackage();
} //ShoppinglistFactory
|
UTF-8
|
Java
| 2,504 |
java
|
ShoppinglistFactory.java
|
Java
|
[] | null |
[] |
/**
* Copyright (c) 2017, 2021 ABChip and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.abchip.mimo.biz.model.order.shoppinglist;
import org.eclipse.emf.ecore.EFactory;
/**
* <!-- begin-user-doc -->
* The <b>Factory</b> for the model.
* It provides a create method for each non-abstract class of the model.
* <!-- end-user-doc -->
* @see org.abchip.mimo.biz.model.order.shoppinglist.ShoppinglistPackage
* @generated
*/
public interface ShoppinglistFactory extends EFactory {
/**
* The singleton instance of the factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
ShoppinglistFactory eINSTANCE = org.abchip.mimo.biz.model.order.shoppinglist.impl.ShoppinglistFactoryImpl.init();
/**
* Returns a new object of class '<em>Shopping List</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Shopping List</em>'.
* @generated
*/
ShoppingList createShoppingList();
/**
* Returns a new object of class '<em>Shopping List Item</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Shopping List Item</em>'.
* @generated
*/
ShoppingListItem createShoppingListItem();
/**
* Returns a new object of class '<em>Shopping List Item Survey</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Shopping List Item Survey</em>'.
* @generated
*/
ShoppingListItemSurvey createShoppingListItemSurvey();
/**
* Returns a new object of class '<em>Shopping List Type</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Shopping List Type</em>'.
* @generated
*/
ShoppingListType createShoppingListType();
/**
* Returns a new object of class '<em>Shopping List Work Effort</em>'.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return a new object of class '<em>Shopping List Work Effort</em>'.
* @generated
*/
ShoppingListWorkEffort createShoppingListWorkEffort();
/**
* Returns the package supported by this factory.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @return the package supported by this factory.
* @generated
*/
ShoppinglistPackage getShoppinglistPackage();
} //ShoppinglistFactory
| 2,504 | 0.663339 | 0.658546 | 83 | 29.168674 | 25.730213 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.795181 | false | false |
9
|
fa0a8a7c75937f4b68847b0d309ec6a146bc8133
| 13,529,147,048,484 |
d66f3680fce7bcbe7e87977ee9e22411accd1c36
|
/Java/Systems/src/LRUCache/LRUCacheListImpl.java
|
2bb7be7a32c01d4a3022f9486bc287c0eeb41d0c
|
[] |
no_license
|
harshchiki/System-Design
|
https://github.com/harshchiki/System-Design
|
98115ddb556e3a0765e4877b06e164e245667ac8
|
4c8af194eccc5380a779d37f832080a5ecfa00d1
|
refs/heads/master
| 2021-01-25T04:38:15.610000 | 2017-06-22T10:20:37 | 2017-06-22T10:20:37 | 93,463,183 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package LRUCache;
import java.util.Objects;
/**
* Insertion from tail - MOST RECENTLY USED
* - on insert
* - on use of a page
*
* Deletion for head - LEAST RECENTLY USED
*
* @author Harsh
*
*/
public class LRUCacheListImpl implements LRUCachList {
private final int MAX_SIZE;
private LRUCacheListNode head, tail;
private int size;
public LRUCacheListImpl(final int size){
this.MAX_SIZE = size;
}
@Override
public LRUCacheListNode getHead() {
return this.head;
}
@Override
public LRUCacheListNode getTail() {
return this.tail;
}
@Override
public void insert(LRUCacheListNode lRUCacheListNode) {
if(tail == null && head == null){
// list is empty
tail = head = lRUCacheListNode;
}else{
if(size == MAX_SIZE){
// list is full
this.remove();
}
// insertion to made at the tail
// this denotes the most recently used node
LRUCacheListNode nodeAtTail = tail;
nodeAtTail.prev = lRUCacheListNode;
lRUCacheListNode.next = nodeAtTail;
tail = lRUCacheListNode;
}
// maintain size
size++;
}
@Override
public LRUCacheListNode remove() {
if(head == null){
// empty list
return null;
}else{
// making the head point to the node prev to the current head.
LRUCacheListNode nodeAtHead = head;
nodeAtHead.prev.next = null;
head = nodeAtHead.prev;
nodeAtHead.prev = nodeAtHead.next = null;
//maintain size
size--;
return nodeAtHead;
}
}
@Override
public LRUCacheListNode removeLRUCacheListNode(LRUCacheListNode nodeToBeRemoved) {
if(head == null && tail == null){
// empty list
return null;
}
// take the reference of the tail - and keep moving forward until null
LRUCacheListNode node = tail;
while(node != null){
if(node.equals(nodeToBeRemoved)){
// node to be removed is found
LRUCacheListNode prevNode = node.prev;
LRUCacheListNode nxtNode = node.next;
if(null != prevNode){
//first node found
prevNode.next = nxtNode;
}
// node could have been found in the end
if(null != nxtNode){
nxtNode.prev = prevNode;
}
if(prevNode == null && nxtNode == null){
tail = head = null;
}
if(prevNode == null && nxtNode != null){
tail = nxtNode;
}
if(prevNode != null && nxtNode == null){
head = prevNode;
}
size--;
node.next = node.prev = null;
return node;
}
node = node.next;
}
return null;
}
/*
* remove the node and insert to the list
* (non-Javadoc)
* @see LRUCache.LRUCachList#bringToHead(LRUCache.LRUCacheListNode)
*/
@Override
public void bringToHead(LRUCacheListNode nodeToBeBroughtForward) {
LRUCacheListNode removedNode = this.removeLRUCacheListNode(nodeToBeBroughtForward);
this.insert(removedNode);
}
@Override
public int size() {
return this.size;
}
@Override
public void printList() {
if(this.head == null){
return;
}
LRUCacheListNode node = tail;
while(node!=null){
System.out.print(node.page.content+ ", ");
node = node.next;
}
}
}
class LRUCacheListNode{
Page page;
LRUCacheListNode next = null, prev = null;
public LRUCacheListNode(Page page) {
this.page = page;
}
@Override
public boolean equals(Object o){
return Objects.equals(this.page, ((LRUCacheListNode) o).page);
}
@Override
public int hashCode(){
return System.identityHashCode(this.page);
}
}
|
UTF-8
|
Java
| 3,404 |
java
|
LRUCacheListImpl.java
|
Java
|
[
{
"context": "tion for head - LEAST RECENTLY USED\n * \n * @author Harsh\n *\n */\npublic class LRUCacheListImpl implements L",
"end": 200,
"score": 0.9992034435272217,
"start": 195,
"tag": "NAME",
"value": "Harsh"
}
] | null |
[] |
package LRUCache;
import java.util.Objects;
/**
* Insertion from tail - MOST RECENTLY USED
* - on insert
* - on use of a page
*
* Deletion for head - LEAST RECENTLY USED
*
* @author Harsh
*
*/
public class LRUCacheListImpl implements LRUCachList {
private final int MAX_SIZE;
private LRUCacheListNode head, tail;
private int size;
public LRUCacheListImpl(final int size){
this.MAX_SIZE = size;
}
@Override
public LRUCacheListNode getHead() {
return this.head;
}
@Override
public LRUCacheListNode getTail() {
return this.tail;
}
@Override
public void insert(LRUCacheListNode lRUCacheListNode) {
if(tail == null && head == null){
// list is empty
tail = head = lRUCacheListNode;
}else{
if(size == MAX_SIZE){
// list is full
this.remove();
}
// insertion to made at the tail
// this denotes the most recently used node
LRUCacheListNode nodeAtTail = tail;
nodeAtTail.prev = lRUCacheListNode;
lRUCacheListNode.next = nodeAtTail;
tail = lRUCacheListNode;
}
// maintain size
size++;
}
@Override
public LRUCacheListNode remove() {
if(head == null){
// empty list
return null;
}else{
// making the head point to the node prev to the current head.
LRUCacheListNode nodeAtHead = head;
nodeAtHead.prev.next = null;
head = nodeAtHead.prev;
nodeAtHead.prev = nodeAtHead.next = null;
//maintain size
size--;
return nodeAtHead;
}
}
@Override
public LRUCacheListNode removeLRUCacheListNode(LRUCacheListNode nodeToBeRemoved) {
if(head == null && tail == null){
// empty list
return null;
}
// take the reference of the tail - and keep moving forward until null
LRUCacheListNode node = tail;
while(node != null){
if(node.equals(nodeToBeRemoved)){
// node to be removed is found
LRUCacheListNode prevNode = node.prev;
LRUCacheListNode nxtNode = node.next;
if(null != prevNode){
//first node found
prevNode.next = nxtNode;
}
// node could have been found in the end
if(null != nxtNode){
nxtNode.prev = prevNode;
}
if(prevNode == null && nxtNode == null){
tail = head = null;
}
if(prevNode == null && nxtNode != null){
tail = nxtNode;
}
if(prevNode != null && nxtNode == null){
head = prevNode;
}
size--;
node.next = node.prev = null;
return node;
}
node = node.next;
}
return null;
}
/*
* remove the node and insert to the list
* (non-Javadoc)
* @see LRUCache.LRUCachList#bringToHead(LRUCache.LRUCacheListNode)
*/
@Override
public void bringToHead(LRUCacheListNode nodeToBeBroughtForward) {
LRUCacheListNode removedNode = this.removeLRUCacheListNode(nodeToBeBroughtForward);
this.insert(removedNode);
}
@Override
public int size() {
return this.size;
}
@Override
public void printList() {
if(this.head == null){
return;
}
LRUCacheListNode node = tail;
while(node!=null){
System.out.print(node.page.content+ ", ");
node = node.next;
}
}
}
class LRUCacheListNode{
Page page;
LRUCacheListNode next = null, prev = null;
public LRUCacheListNode(Page page) {
this.page = page;
}
@Override
public boolean equals(Object o){
return Objects.equals(this.page, ((LRUCacheListNode) o).page);
}
@Override
public int hashCode(){
return System.identityHashCode(this.page);
}
}
| 3,404 | 0.658931 | 0.658931 | 169 | 19.142012 | 18.420563 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.201183 | false | false |
9
|
9d0bc30b1ec012e51dcd4cde7f5e60ce59525774
| 22,823,456,275,333 |
e1b6b9c11318d5575415f42bd3c237f6ee62dcc7
|
/src/main/java/com/experis/okko/icloneapp/controllers/RestAPIController.java
|
977b2f367bff119c57348a5e70520b4f6ee5628c
|
[] |
no_license
|
okarp/ChinookAPI
|
https://github.com/okarp/ChinookAPI
|
c9b7410ec3a53ea0c150f692bb5fa1453589e76d
|
0dce954fde847e0656cfeca16b87de8b7f242886
|
refs/heads/main
| 2023-03-24T19:37:28.238000 | 2021-03-10T10:20:38 | 2021-03-10T10:20:38 | 337,166,868 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.experis.okko.icloneapp.controllers;
import com.experis.okko.icloneapp.dao.CustomerRepository;
import com.experis.okko.icloneapp.exceptions.BadRequestException;
import com.experis.okko.icloneapp.exceptions.ResourceNotFoundException;
import com.experis.okko.icloneapp.models.Customer;
import com.experis.okko.icloneapp.models.CustomerInvoiceTotalWrapper;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import static com.experis.okko.icloneapp.controllers.RestURIConstants.*;
/*
* Okko Partanen
* Experis Academy Task 4
*
* Rest API Controller class.
* Rest URI's are held in RestURIConstants class. Few custom exceptions are thrown if
* API requests are not valid. The exceptions have been implemented mostly for the sake of learning.
*
*/
@RestController
public class RestAPIController {
private CustomerRepository customerRepository = new CustomerRepository();
//get all customers from the database
@RequestMapping(value=GET_CUSTOMERS, method = RequestMethod.GET)
public ArrayList<Customer> getAllCustomers(){
return customerRepository.selectAllCustomer();
}
//get countries and customer count in each country
@RequestMapping(value=GET_COUNTRIES_BY_CUSTOMER_COUNT, method = RequestMethod.GET)
public LinkedHashMap<String, Integer> getCountriesWithUserCount(){
return customerRepository.selectCountriesByCustomerCount();
}
//get single customer by id
@RequestMapping(value =GET_CUSTOMER_BY_ID, method = RequestMethod.GET)
public Customer getCustomerByPathId(@PathVariable String id){
Customer customer = customerRepository.selectCustomerById(id);
//throw 404 if customer is null
if (customer.getFirstName() == null)
throw new ResourceNotFoundException();
else
return customer;
}
//add a customer to database
@RequestMapping(value= CREATE_CUSTOMER, method = RequestMethod.POST)
public Customer addNewCustomer(@RequestBody Customer customer){
Customer addedCustomer = customerRepository.addCustomer(customer);
//throw 402 if customer couldn't be created
if (addedCustomer == null)
throw new BadRequestException();
return addedCustomer;
}
//update a customers fields in database
@RequestMapping(value = UPDATE_CUSTOMER, method = RequestMethod.PUT)
public Boolean updateExistingCustomer(@PathVariable int id, @RequestBody Customer customer){
//if parameter doesn't match body throw 402
if (id != customer.getCustomerId())
throw new BadRequestException();
return customerRepository.updateCustomer(customer);
}
//get all customers and how much money they have spent
@RequestMapping(value=GET_CUSTOMERS_BY_INVOICE_TOTAL, method = RequestMethod.GET)
public ArrayList<CustomerInvoiceTotalWrapper> getCustomersByMoneySpent(){
return customerRepository.selectAllCustomerByInvoiceTotal();
}
//get a customers favourite genre(s)
@RequestMapping(value =GET_CUSTOMER_FAV_GENRE, method = RequestMethod.GET)
public ArrayList<String> getCustomerFavGenre(@PathVariable String id){
//throw 404 if customerid doesn't exist / can't find favourite genres for given id
//new customers don't have favourite genres, so this is not the best practice.
ArrayList<String> favourites = customerRepository.selectCustomerFavGenre(id);
if (favourites.size() == 0)
throw new ResourceNotFoundException();
else
return favourites;
}
}
|
UTF-8
|
Java
| 3,623 |
java
|
RestAPIController.java
|
Java
|
[
{
"context": "ko.icloneapp.controllers.RestURIConstants.*;\n\n/*\n* Okko Partanen\n* Experis Academy Task 4\n*\n* Rest API Controller ",
"end": 568,
"score": 0.9996480941772461,
"start": 555,
"tag": "NAME",
"value": "Okko Partanen"
}
] | null |
[] |
package com.experis.okko.icloneapp.controllers;
import com.experis.okko.icloneapp.dao.CustomerRepository;
import com.experis.okko.icloneapp.exceptions.BadRequestException;
import com.experis.okko.icloneapp.exceptions.ResourceNotFoundException;
import com.experis.okko.icloneapp.models.Customer;
import com.experis.okko.icloneapp.models.CustomerInvoiceTotalWrapper;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import static com.experis.okko.icloneapp.controllers.RestURIConstants.*;
/*
* <NAME>
* Experis Academy Task 4
*
* Rest API Controller class.
* Rest URI's are held in RestURIConstants class. Few custom exceptions are thrown if
* API requests are not valid. The exceptions have been implemented mostly for the sake of learning.
*
*/
@RestController
public class RestAPIController {
private CustomerRepository customerRepository = new CustomerRepository();
//get all customers from the database
@RequestMapping(value=GET_CUSTOMERS, method = RequestMethod.GET)
public ArrayList<Customer> getAllCustomers(){
return customerRepository.selectAllCustomer();
}
//get countries and customer count in each country
@RequestMapping(value=GET_COUNTRIES_BY_CUSTOMER_COUNT, method = RequestMethod.GET)
public LinkedHashMap<String, Integer> getCountriesWithUserCount(){
return customerRepository.selectCountriesByCustomerCount();
}
//get single customer by id
@RequestMapping(value =GET_CUSTOMER_BY_ID, method = RequestMethod.GET)
public Customer getCustomerByPathId(@PathVariable String id){
Customer customer = customerRepository.selectCustomerById(id);
//throw 404 if customer is null
if (customer.getFirstName() == null)
throw new ResourceNotFoundException();
else
return customer;
}
//add a customer to database
@RequestMapping(value= CREATE_CUSTOMER, method = RequestMethod.POST)
public Customer addNewCustomer(@RequestBody Customer customer){
Customer addedCustomer = customerRepository.addCustomer(customer);
//throw 402 if customer couldn't be created
if (addedCustomer == null)
throw new BadRequestException();
return addedCustomer;
}
//update a customers fields in database
@RequestMapping(value = UPDATE_CUSTOMER, method = RequestMethod.PUT)
public Boolean updateExistingCustomer(@PathVariable int id, @RequestBody Customer customer){
//if parameter doesn't match body throw 402
if (id != customer.getCustomerId())
throw new BadRequestException();
return customerRepository.updateCustomer(customer);
}
//get all customers and how much money they have spent
@RequestMapping(value=GET_CUSTOMERS_BY_INVOICE_TOTAL, method = RequestMethod.GET)
public ArrayList<CustomerInvoiceTotalWrapper> getCustomersByMoneySpent(){
return customerRepository.selectAllCustomerByInvoiceTotal();
}
//get a customers favourite genre(s)
@RequestMapping(value =GET_CUSTOMER_FAV_GENRE, method = RequestMethod.GET)
public ArrayList<String> getCustomerFavGenre(@PathVariable String id){
//throw 404 if customerid doesn't exist / can't find favourite genres for given id
//new customers don't have favourite genres, so this is not the best practice.
ArrayList<String> favourites = customerRepository.selectCustomerFavGenre(id);
if (favourites.size() == 0)
throw new ResourceNotFoundException();
else
return favourites;
}
}
| 3,616 | 0.738062 | 0.734198 | 88 | 40.170456 | 30.047016 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.397727 | false | false |
9
|
9fc8c9248940470d8ba62261218fc5a03ebd8fc0
| 29,360,396,504,387 |
04c756572972dd6e97b1c161cacc4672d04d0217
|
/lambico-datatest-jpa/src/test/java/org/lambico/datatest/junit/DatasetTest.java
|
39ea004c2a32aec4ecf3929582ced7619faaf39d
|
[
"Apache-2.0"
] |
permissive
|
lambico/lambico-datatest
|
https://github.com/lambico/lambico-datatest
|
de55c6da11623125efc5b659344d81098d004bce
|
05a7ba97e46ce67f69e486114ef63d6b47d0440c
|
refs/heads/master
| 2022-12-03T02:30:28.226000 | 2019-12-13T09:30:02 | 2019-12-13T09:30:02 | 168,819,906 | 0 | 0 |
Apache-2.0
| false | 2022-11-15T23:51:20 | 2019-02-02T10:22:04 | 2019-12-13T09:42:46 | 2022-11-15T23:51:17 | 1,143 | 0 | 0 | 6 |
Java
| false | false |
/**
* Copyright © 2018 The Lambico Datatest Team (lucio.benfante@gmail.com)
*
* This file is part of lambico-datatest-jpa.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.lambico.datatest.junit;
import static org.hamcrest.Matchers.*;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.*;
public class DatasetTest {
@Test
public void testDefaultValues() {
Dataset instance = Dataset.builder().build();
assertThat(instance.flushWindowSize, is(nullValue()));
assertThat(instance.useMerge, is(false));
}
@Test
public void testFlushWindowSizeSetting() {
Dataset instance = Dataset.builder()
.flushWindowSize(1)
.useMerge(true).build();
assertThat(instance.flushWindowSize, is(1));
assertThat(instance.useMerge, is(true));
}
}
|
UTF-8
|
Java
| 1,381 |
java
|
DatasetTest.java
|
Java
|
[
{
"context": "**\n * Copyright © 2018 The Lambico Datatest Team (lucio.benfante@gmail.com)\n *\n * This file is part of lambico-datatest-jpa.",
"end": 75,
"score": 0.999910831451416,
"start": 51,
"tag": "EMAIL",
"value": "lucio.benfante@gmail.com"
}
] | null |
[] |
/**
* Copyright © 2018 The Lambico Datatest Team (<EMAIL>)
*
* This file is part of lambico-datatest-jpa.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.lambico.datatest.junit;
import static org.hamcrest.Matchers.*;
import org.junit.Test;
import static org.hamcrest.MatcherAssert.*;
public class DatasetTest {
@Test
public void testDefaultValues() {
Dataset instance = Dataset.builder().build();
assertThat(instance.flushWindowSize, is(nullValue()));
assertThat(instance.useMerge, is(false));
}
@Test
public void testFlushWindowSizeSetting() {
Dataset instance = Dataset.builder()
.flushWindowSize(1)
.useMerge(true).build();
assertThat(instance.flushWindowSize, is(1));
assertThat(instance.useMerge, is(true));
}
}
| 1,364 | 0.692029 | 0.684783 | 43 | 31.11628 | 25.650793 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.44186 | false | false |
9
|
94798b0b11006aacd612937891d296ff6a6b07a6
| 17,609,365,977,538 |
9d7a18d3d972f60dd0f20fd767c22db4aaca41be
|
/g8_jetpack/src/main/java/com/jetpack/demos/room/RoomActivity.java
|
5b4a59868a4563f96a1f7ebc484f2fe7cad8e845
|
[] |
no_license
|
jhwsx/AndroidTraining
|
https://github.com/jhwsx/AndroidTraining
|
ddefbf7cb4f8cbb6bd754fbfa0660ec77d7cdd5f
|
9c6c5681cdc2c3ab54a31e06463955ff5e34c177
|
refs/heads/master
| 2021-06-01T14:30:35.190000 | 2020-12-23T13:15:46 | 2020-12-23T13:15:46 | 110,397,978 | 7 | 4 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.jetpack.demos.room;
import androidx.room.Room;
import android.content.Context;
import android.content.Intent;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import com.jetpack.demos.R;
import java.util.List;
public class RoomActivity extends AppCompatActivity implements View.OnClickListener {
private static final String TAG = RoomActivity.class.getSimpleName();
private UserDao mUserDao;
private CompanyDao mCompanyDao;
public static void start(Context context) {
Intent starter = new Intent(context, RoomActivity.class);
context.startActivity(starter);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_room);
AppDatabase db = Room.databaseBuilder(getApplicationContext(), AppDatabase.class, "roomDemo-database")
.addMigrations(AppDatabase.MIGRATION_1_2).build();
mUserDao = db.userDao();
mCompanyDao = db.companyDao();
initViews();
}
private void initViews() {
Button btnInsertOne = (Button) findViewById(R.id.button_insert_one);
Button btnInsertSome = (Button) findViewById(R.id.button_insert_some);
Button btnUpdateOne = (Button) findViewById(R.id.button_update_one);
Button btnDeleteOne = (Button) findViewById(R.id.button_delete_one);
Button btnFindOne = (Button) findViewById(R.id.button_find_one);
Button btnFindAll = (Button) findViewById(R.id.button_find_all);
Button btnDeleteAll = (Button) findViewById(R.id.button_delete_all);
Button button_get_company = (Button) findViewById(R.id.button_get_company);
Button button_insert_company = (Button) findViewById(R.id.button_insert_company);
btnInsertOne.setOnClickListener(this);
btnInsertSome.setOnClickListener(this);
btnUpdateOne.setOnClickListener(this);
btnDeleteOne.setOnClickListener(this);
btnFindOne.setOnClickListener(this);
btnFindAll.setOnClickListener(this);
btnDeleteAll.setOnClickListener(this);
button_get_company.setOnClickListener(this);
button_insert_company.setOnClickListener(this);
}
@Override
public void onClick(View v) {
int id = v.getId();
if (id == R.id.button_insert_one) {
insertOne();
} else if (id == R.id.button_insert_some) {
insertSome();
} else if (id == R.id.button_update_one) {
updateOne();
} else if (id == R.id.button_delete_one) {
deleteOne();
} else if (id == R.id.button_find_one) {
findOne();
} else if (id == R.id.button_find_all) {
findAll();
} else if (id == R.id.button_delete_all) {
deleteAll();
} else if (id == R.id.button_get_company) {
getCompany();
} else if (id == R.id.button_insert_company) {
insertCompany();
}
}
private void deleteAll() {
new Thread(new Runnable() {
@Override
public void run() {
List<User> users = mUserDao.getAll();
int i = mUserDao.deleteAll(users);
Log.d(TAG, "deleteAll : delete="+i);
}
}).start();
}
private void findAll() {
new Thread(new Runnable() {
@Override
public void run() {
List<User> users = mUserDao.getAll();
for (User user : users) {
Log.d(TAG, "findAll user = " + user);
}
}
}).start();
}
private void findOne() {
new Thread(new Runnable() {
@Override
public void run() {
User user = mUserDao.findByUid(1);
Log.d(TAG, "findOne user = " + user);
}
}).start();
}
private void deleteOne() {
new Thread(new Runnable() {
@Override
public void run() {
User user = mUserDao.findByUid(1);
int delete = mUserDao.delete(user);
Log.d(TAG, "deleteOne delete=" + delete);
}
}).start();
}
private void updateOne() {
new Thread(new Runnable() {
@Override
public void run() {
User user = new User(1);
user.setFirstName("updatedFirstName");
int update = mUserDao.update(user);
Log.d(TAG, "updateOne: update = " + update);
}
}).start();
}
private void insertSome() {
new Thread(new Runnable() {
@Override
public void run() {
List<Long> longs = mUserDao.insertAll(new User("t" + (System.currentTimeMillis() / 1000), "allen"), new User("t" + (System.currentTimeMillis() / 1000), "allen"));
if (longs != null && !longs.isEmpty()) {
for (Long aLong : longs) {
Log.d(TAG, "insert success: id = " + aLong);
}
} else {
Log.d(TAG, "insert fail");
}
}
}).start();
}
private void insertOne() {
new Thread(new Runnable() {
@Override
public void run() {
Long aLong = mUserDao.insert(new User("t" + (System.currentTimeMillis() / 1000), "allen"));
if (aLong > 0) {
Log.d(TAG, "insert success: id = " + aLong);
} else {
Log.d(TAG, "insert fail");
}
}
}).start();
}
private void insertCompany() {
new Thread(new Runnable() {
@Override
public void run() {
Company company = new Company();
company.setId(1);
company.setName("adups");
Long aLong = mCompanyDao.insert(company);
if (aLong > 0) {
Log.d(TAG, "insert success: id = " + aLong);
} else {
Log.d(TAG, "insert fail");
}
}
}).start();
}
private void getCompany() {
new Thread(new Runnable() {
@Override
public void run() {
List<Company> users = mCompanyDao.getAll();
for (Company user : users) {
Log.d(TAG, "findAll user = " + user);
}
}
}).start();
}
}
|
UTF-8
|
Java
| 6,700 |
java
|
RoomActivity.java
|
Java
|
[
{
"context": "ser(1);\n user.setFirstName(\"updatedFirstName\");\n int update = mUserDao.update(u",
"end": 4574,
"score": 0.5114555954933167,
"start": 4565,
"tag": "USERNAME",
"value": "FirstName"
},
{
"context": "ompany.setId(1);\n company.setName(\"adups\");\n Long aLong = mCompanyDao.inser",
"end": 6064,
"score": 0.9569205641746521,
"start": 6059,
"tag": "NAME",
"value": "adups"
}
] | null |
[] |
package com.jetpack.demos.room;
import androidx.room.Room;
import android.content.Context;
import android.content.Intent;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import com.jetpack.demos.R;
import java.util.List;
public class RoomActivity extends AppCompatActivity implements View.OnClickListener {
private static final String TAG = RoomActivity.class.getSimpleName();
private UserDao mUserDao;
private CompanyDao mCompanyDao;
public static void start(Context context) {
Intent starter = new Intent(context, RoomActivity.class);
context.startActivity(starter);
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_room);
AppDatabase db = Room.databaseBuilder(getApplicationContext(), AppDatabase.class, "roomDemo-database")
.addMigrations(AppDatabase.MIGRATION_1_2).build();
mUserDao = db.userDao();
mCompanyDao = db.companyDao();
initViews();
}
private void initViews() {
Button btnInsertOne = (Button) findViewById(R.id.button_insert_one);
Button btnInsertSome = (Button) findViewById(R.id.button_insert_some);
Button btnUpdateOne = (Button) findViewById(R.id.button_update_one);
Button btnDeleteOne = (Button) findViewById(R.id.button_delete_one);
Button btnFindOne = (Button) findViewById(R.id.button_find_one);
Button btnFindAll = (Button) findViewById(R.id.button_find_all);
Button btnDeleteAll = (Button) findViewById(R.id.button_delete_all);
Button button_get_company = (Button) findViewById(R.id.button_get_company);
Button button_insert_company = (Button) findViewById(R.id.button_insert_company);
btnInsertOne.setOnClickListener(this);
btnInsertSome.setOnClickListener(this);
btnUpdateOne.setOnClickListener(this);
btnDeleteOne.setOnClickListener(this);
btnFindOne.setOnClickListener(this);
btnFindAll.setOnClickListener(this);
btnDeleteAll.setOnClickListener(this);
button_get_company.setOnClickListener(this);
button_insert_company.setOnClickListener(this);
}
@Override
public void onClick(View v) {
int id = v.getId();
if (id == R.id.button_insert_one) {
insertOne();
} else if (id == R.id.button_insert_some) {
insertSome();
} else if (id == R.id.button_update_one) {
updateOne();
} else if (id == R.id.button_delete_one) {
deleteOne();
} else if (id == R.id.button_find_one) {
findOne();
} else if (id == R.id.button_find_all) {
findAll();
} else if (id == R.id.button_delete_all) {
deleteAll();
} else if (id == R.id.button_get_company) {
getCompany();
} else if (id == R.id.button_insert_company) {
insertCompany();
}
}
private void deleteAll() {
new Thread(new Runnable() {
@Override
public void run() {
List<User> users = mUserDao.getAll();
int i = mUserDao.deleteAll(users);
Log.d(TAG, "deleteAll : delete="+i);
}
}).start();
}
private void findAll() {
new Thread(new Runnable() {
@Override
public void run() {
List<User> users = mUserDao.getAll();
for (User user : users) {
Log.d(TAG, "findAll user = " + user);
}
}
}).start();
}
private void findOne() {
new Thread(new Runnable() {
@Override
public void run() {
User user = mUserDao.findByUid(1);
Log.d(TAG, "findOne user = " + user);
}
}).start();
}
private void deleteOne() {
new Thread(new Runnable() {
@Override
public void run() {
User user = mUserDao.findByUid(1);
int delete = mUserDao.delete(user);
Log.d(TAG, "deleteOne delete=" + delete);
}
}).start();
}
private void updateOne() {
new Thread(new Runnable() {
@Override
public void run() {
User user = new User(1);
user.setFirstName("updatedFirstName");
int update = mUserDao.update(user);
Log.d(TAG, "updateOne: update = " + update);
}
}).start();
}
private void insertSome() {
new Thread(new Runnable() {
@Override
public void run() {
List<Long> longs = mUserDao.insertAll(new User("t" + (System.currentTimeMillis() / 1000), "allen"), new User("t" + (System.currentTimeMillis() / 1000), "allen"));
if (longs != null && !longs.isEmpty()) {
for (Long aLong : longs) {
Log.d(TAG, "insert success: id = " + aLong);
}
} else {
Log.d(TAG, "insert fail");
}
}
}).start();
}
private void insertOne() {
new Thread(new Runnable() {
@Override
public void run() {
Long aLong = mUserDao.insert(new User("t" + (System.currentTimeMillis() / 1000), "allen"));
if (aLong > 0) {
Log.d(TAG, "insert success: id = " + aLong);
} else {
Log.d(TAG, "insert fail");
}
}
}).start();
}
private void insertCompany() {
new Thread(new Runnable() {
@Override
public void run() {
Company company = new Company();
company.setId(1);
company.setName("adups");
Long aLong = mCompanyDao.insert(company);
if (aLong > 0) {
Log.d(TAG, "insert success: id = " + aLong);
} else {
Log.d(TAG, "insert fail");
}
}
}).start();
}
private void getCompany() {
new Thread(new Runnable() {
@Override
public void run() {
List<Company> users = mCompanyDao.getAll();
for (Company user : users) {
Log.d(TAG, "findAll user = " + user);
}
}
}).start();
}
}
| 6,700 | 0.528955 | 0.52597 | 200 | 32.5 | 24.516117 | 178 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.53 | false | false |
9
|
262317f6e7df830f19e615e4a3dc9d3041190686
| 33,663,953,728,370 |
e75fad186936926425ea9e5251a6a3022f9e67c7
|
/BootMVCSportsCar/src/main/java/com/skilldistillery/bootmvc/controllers/CarController.java
|
1747c175cce700409cdfc8c709367b700012dfd1
|
[] |
no_license
|
jdfruchterman/JPACRUDProject
|
https://github.com/jdfruchterman/JPACRUDProject
|
b7d9f4ab8687b4a30a6f8a01826bb828bf2e229a
|
9f85d74af777adf920d5e0cfd7a54cd9b60e9e2f
|
refs/heads/master
| 2020-04-12T12:38:48.975000 | 2019-01-07T22:37:49 | 2019-01-07T22:37:49 | 162,498,065 | 0 | 0 | null | false | 2019-01-07T22:37:50 | 2018-12-19T22:35:05 | 2019-01-04T23:34:51 | 2019-01-07T22:37:49 | 17,864 | 0 | 0 | 0 |
Java
| false | null |
package com.skilldistillery.bootmvc.controllers;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import com.skilldistillery.bootmvc.data.CarDAO;
import com.skilldistillery.jpasportscar.entities.Car;
import com.skilldistillery.jpasportscar.entities.Engine;
@Controller
public class CarController {
@Autowired
private CarDAO dao;
@RequestMapping(path="getCar.do", method=RequestMethod.GET)
public ModelAndView getCar(@RequestParam("id") int id) {
Car car = dao.find(id);
ModelAndView mv = new ModelAndView();
mv.addObject(car);
mv.setViewName("WEB-INF/car/showCar.jsp");
return mv;
}
@RequestMapping(path="getCarByKeyword.do", method=RequestMethod.GET)
public ModelAndView getCarsByKeyword(@RequestParam("keyword") String key) {
List<Car> cars = dao.getCarsByKeyword(key);
ModelAndView mv = new ModelAndView();
mv.addObject("car", cars);
mv.setViewName("WEB-INF/car/listCarsByKeyword.jsp");
return mv;
}
@RequestMapping(path="listCars.do", method=RequestMethod.GET)
public ModelAndView listCars() {
List<Car> cars = dao.listAllCars();
ModelAndView mv = new ModelAndView();
mv.addObject("car", cars);
mv.setViewName("WEB-INF/car/listCars.jsp");
return mv;
}
@RequestMapping(path="listEngines.do", method=RequestMethod.GET)
public ModelAndView listEngines() {
List<Engine> engines = dao.listAllEngines();
ModelAndView mv = new ModelAndView();
mv.addObject("engine", engines);
mv.setViewName("WEB-INF/car/listEngines.jsp");
return mv;
}
@RequestMapping(path="editCar.do", method=RequestMethod.GET)
public ModelAndView editCar(@RequestParam("id") int id) {
Car car = dao.find(id);
ModelAndView mv = new ModelAndView();
mv.addObject(car);
mv.setViewName("WEB-INF/car/editCar.jsp");
return mv;
}
@RequestMapping(path="deleteCar.do", method=RequestMethod.GET)
public String deleteCar(@RequestParam("id") int id) {
boolean destroyed = dao.destroy(id);
// ModelAndView mv = new ModelAndView();
return "WEB-INF/car/carDeleted.jsp";
}
@RequestMapping(path="editCar.do", method=RequestMethod.POST)
public ModelAndView edit(@RequestParam("id")int id, @RequestParam("model")String model, @RequestParam("make")String make, @RequestParam("year")int year, @RequestParam("trim")String trim, @RequestParam("doors")int doors,@RequestParam("engineLayout") String engineLayout, @RequestParam("weight")int weight, @RequestParam("horsepower")int horsepower, @RequestParam("torque")int torque, @RequestParam("0to60")String zerotosixty ) {
ModelAndView mv = new ModelAndView();
Car editedCar = new Car();
// newCar.setId(0); going to reuse id but don't need it as this is tempobject
editedCar.setModel(model);
editedCar.setMake(make);
editedCar.setYear(year);
editedCar.setTrim(trim);
editedCar.setDoors(doors);
editedCar.setEngineLayout(engineLayout);
editedCar.setWeight(weight);
editedCar.setHorsepower(horsepower);
editedCar.setTorque(torque);
double zeroToSixty = Double.parseDouble(zerotosixty);
editedCar.setZerotosixty(zeroToSixty);
editedCar = dao.update(id, editedCar);
if(editedCar != null) {
mv.addObject("car", editedCar);
mv.setViewName("WEB-INF/car/editedCar.jsp");
}
else {
mv.addObject("error", "Could not edit car, try again");
}
return mv;
}
@RequestMapping(path="createEngine.do", method=RequestMethod.POST)
public ModelAndView createEngine(@RequestParam("name")String name, @RequestParam("displacement")String displacement, @RequestParam("cylinders")int cylinders, @RequestParam("configuration")String configuration) {
ModelAndView mv = new ModelAndView();
Engine newEngine = new Engine();
newEngine.setId(0);
newEngine.setName(name);
newEngine.setCylinders(cylinders);
newEngine.setDisplacement(displacement);
newEngine.setConfiguration(configuration);
// newEngine.setCars(null);
newEngine = dao.createEngine(newEngine);
if(newEngine != null) {
mv.addObject("engine", newEngine);
mv.setViewName("WEB-INF/car/newEngine.jsp");
}
else {
mv.addObject("error", "Could not create engine, try again");
}
return mv;
}
@RequestMapping(path="createCar.do", method=RequestMethod.POST)
public ModelAndView create(@RequestParam("model")String model, @RequestParam("make")String make, @RequestParam("year")int year, @RequestParam("trim")String trim, @RequestParam("doors")int doors,@RequestParam("engineLayout") String engineLayout, @RequestParam("weight")int weight, @RequestParam("horsepower")int horsepower, @RequestParam("torque")int torque, @RequestParam("0to60")String zerotosixty ) {
ModelAndView mv = new ModelAndView();
Car newCar = new Car();
newCar.setId(0);
newCar.setModel(model);
newCar.setMake(make);
newCar.setYear(year);
newCar.setTrim(trim);
newCar.setDoors(doors);
newCar.setEngineLayout(engineLayout);
newCar.setWeight(weight);
newCar.setHorsepower(horsepower);
newCar.setTorque(torque);
double zeroToSixty = Double.parseDouble(zerotosixty);
newCar.setZerotosixty(zeroToSixty);
// add engine later:
newCar.setEngine(null);
newCar = dao.create(newCar);
if(newCar != null) {
mv.addObject("car", newCar);
mv.setViewName("WEB-INF/car/newCar.jsp");
}
else {
mv.addObject("error", "Could not create car, try again");
}
return mv;
}
@RequestMapping(path="createCar.do", method=RequestMethod.GET)
public String addCar() {
return "WEB-INF/car/addCar.jsp";
}
@RequestMapping(path="createEngine.do", method=RequestMethod.GET)
public String addEngine() {
return "WEB-INF/car/addEngine.jsp";
}
@RequestMapping(path= {"home.do", "/"})
public String index() {
return "WEB-INF/index.jsp";
// return "index"; // if using a ViewResolver.
}
}
|
UTF-8
|
Java
| 6,034 |
java
|
CarController.java
|
Java
|
[] | null |
[] |
package com.skilldistillery.bootmvc.controllers;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import com.skilldistillery.bootmvc.data.CarDAO;
import com.skilldistillery.jpasportscar.entities.Car;
import com.skilldistillery.jpasportscar.entities.Engine;
@Controller
public class CarController {
@Autowired
private CarDAO dao;
@RequestMapping(path="getCar.do", method=RequestMethod.GET)
public ModelAndView getCar(@RequestParam("id") int id) {
Car car = dao.find(id);
ModelAndView mv = new ModelAndView();
mv.addObject(car);
mv.setViewName("WEB-INF/car/showCar.jsp");
return mv;
}
@RequestMapping(path="getCarByKeyword.do", method=RequestMethod.GET)
public ModelAndView getCarsByKeyword(@RequestParam("keyword") String key) {
List<Car> cars = dao.getCarsByKeyword(key);
ModelAndView mv = new ModelAndView();
mv.addObject("car", cars);
mv.setViewName("WEB-INF/car/listCarsByKeyword.jsp");
return mv;
}
@RequestMapping(path="listCars.do", method=RequestMethod.GET)
public ModelAndView listCars() {
List<Car> cars = dao.listAllCars();
ModelAndView mv = new ModelAndView();
mv.addObject("car", cars);
mv.setViewName("WEB-INF/car/listCars.jsp");
return mv;
}
@RequestMapping(path="listEngines.do", method=RequestMethod.GET)
public ModelAndView listEngines() {
List<Engine> engines = dao.listAllEngines();
ModelAndView mv = new ModelAndView();
mv.addObject("engine", engines);
mv.setViewName("WEB-INF/car/listEngines.jsp");
return mv;
}
@RequestMapping(path="editCar.do", method=RequestMethod.GET)
public ModelAndView editCar(@RequestParam("id") int id) {
Car car = dao.find(id);
ModelAndView mv = new ModelAndView();
mv.addObject(car);
mv.setViewName("WEB-INF/car/editCar.jsp");
return mv;
}
@RequestMapping(path="deleteCar.do", method=RequestMethod.GET)
public String deleteCar(@RequestParam("id") int id) {
boolean destroyed = dao.destroy(id);
// ModelAndView mv = new ModelAndView();
return "WEB-INF/car/carDeleted.jsp";
}
@RequestMapping(path="editCar.do", method=RequestMethod.POST)
public ModelAndView edit(@RequestParam("id")int id, @RequestParam("model")String model, @RequestParam("make")String make, @RequestParam("year")int year, @RequestParam("trim")String trim, @RequestParam("doors")int doors,@RequestParam("engineLayout") String engineLayout, @RequestParam("weight")int weight, @RequestParam("horsepower")int horsepower, @RequestParam("torque")int torque, @RequestParam("0to60")String zerotosixty ) {
ModelAndView mv = new ModelAndView();
Car editedCar = new Car();
// newCar.setId(0); going to reuse id but don't need it as this is tempobject
editedCar.setModel(model);
editedCar.setMake(make);
editedCar.setYear(year);
editedCar.setTrim(trim);
editedCar.setDoors(doors);
editedCar.setEngineLayout(engineLayout);
editedCar.setWeight(weight);
editedCar.setHorsepower(horsepower);
editedCar.setTorque(torque);
double zeroToSixty = Double.parseDouble(zerotosixty);
editedCar.setZerotosixty(zeroToSixty);
editedCar = dao.update(id, editedCar);
if(editedCar != null) {
mv.addObject("car", editedCar);
mv.setViewName("WEB-INF/car/editedCar.jsp");
}
else {
mv.addObject("error", "Could not edit car, try again");
}
return mv;
}
@RequestMapping(path="createEngine.do", method=RequestMethod.POST)
public ModelAndView createEngine(@RequestParam("name")String name, @RequestParam("displacement")String displacement, @RequestParam("cylinders")int cylinders, @RequestParam("configuration")String configuration) {
ModelAndView mv = new ModelAndView();
Engine newEngine = new Engine();
newEngine.setId(0);
newEngine.setName(name);
newEngine.setCylinders(cylinders);
newEngine.setDisplacement(displacement);
newEngine.setConfiguration(configuration);
// newEngine.setCars(null);
newEngine = dao.createEngine(newEngine);
if(newEngine != null) {
mv.addObject("engine", newEngine);
mv.setViewName("WEB-INF/car/newEngine.jsp");
}
else {
mv.addObject("error", "Could not create engine, try again");
}
return mv;
}
@RequestMapping(path="createCar.do", method=RequestMethod.POST)
public ModelAndView create(@RequestParam("model")String model, @RequestParam("make")String make, @RequestParam("year")int year, @RequestParam("trim")String trim, @RequestParam("doors")int doors,@RequestParam("engineLayout") String engineLayout, @RequestParam("weight")int weight, @RequestParam("horsepower")int horsepower, @RequestParam("torque")int torque, @RequestParam("0to60")String zerotosixty ) {
ModelAndView mv = new ModelAndView();
Car newCar = new Car();
newCar.setId(0);
newCar.setModel(model);
newCar.setMake(make);
newCar.setYear(year);
newCar.setTrim(trim);
newCar.setDoors(doors);
newCar.setEngineLayout(engineLayout);
newCar.setWeight(weight);
newCar.setHorsepower(horsepower);
newCar.setTorque(torque);
double zeroToSixty = Double.parseDouble(zerotosixty);
newCar.setZerotosixty(zeroToSixty);
// add engine later:
newCar.setEngine(null);
newCar = dao.create(newCar);
if(newCar != null) {
mv.addObject("car", newCar);
mv.setViewName("WEB-INF/car/newCar.jsp");
}
else {
mv.addObject("error", "Could not create car, try again");
}
return mv;
}
@RequestMapping(path="createCar.do", method=RequestMethod.GET)
public String addCar() {
return "WEB-INF/car/addCar.jsp";
}
@RequestMapping(path="createEngine.do", method=RequestMethod.GET)
public String addEngine() {
return "WEB-INF/car/addEngine.jsp";
}
@RequestMapping(path= {"home.do", "/"})
public String index() {
return "WEB-INF/index.jsp";
// return "index"; // if using a ViewResolver.
}
}
| 6,034 | 0.740471 | 0.738979 | 170 | 34.494118 | 48.552486 | 428 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.370588 | false | false |
9
|
200bcadd203f156b2ac08a492f6eb9e157311e01
| 32,719,060,923,262 |
4b161eb9049b392cf75f931b875395df1bae969c
|
/java-sample-app-gradle-jar/src/main/java/com/mskj/buildpack/sample/java/maven/jar/demoapp/controller/HelloWorldController.java
|
85e1833c871669541f14664f321b691b6bfb8383
|
[] |
no_license
|
minsheng-fintech-corp-ltd/example-project
|
https://github.com/minsheng-fintech-corp-ltd/example-project
|
a633425b92694caf157611e7b254299511b93f8f
|
6f1aad9ff2a5ee3435c69e938afab40ac53da90b
|
refs/heads/master
| 2020-07-05T02:56:59.370000 | 2020-01-07T08:24:45 | 2020-01-07T08:24:45 | 202,501,025 | 0 | 2 | null | false | 2020-01-07T08:24:47 | 2019-08-15T08:10:31 | 2019-12-24T15:48:57 | 2020-01-07T08:24:46 | 108 | 0 | 1 | 0 |
Java
| false | false |
package com.mskj.buildpack.sample.java.maven.jar.demoapp.controller;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloWorldController {
@GetMapping("/")
public String helloWorld() {
return "hello world!";
}
}
|
UTF-8
|
Java
| 461 |
java
|
HelloWorldController.java
|
Java
|
[] | null |
[] |
package com.mskj.buildpack.sample.java.maven.jar.demoapp.controller;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloWorldController {
@GetMapping("/")
public String helloWorld() {
return "hello world!";
}
}
| 461 | 0.789588 | 0.789588 | 17 | 26.117647 | 25.621412 | 68 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.352941 | false | false |
9
|
3ccf8c2af4583d6b3d1811b931d214330c58fe91
| 24,352,464,569,858 |
9fadbce6465f8b62f44e2127d992172ca5e64dd4
|
/core/src/com/drk393w/em3/PhysicalAttributes.java
|
b0087b2ccaf395acb917149144305e45b360700d
|
[] |
no_license
|
DRK393Y/G
|
https://github.com/DRK393Y/G
|
09ec662a9bb9bddaece2a3243f05b93929599561
|
85d566353112fce1a31319c86fadc1fa1835e5e3
|
refs/heads/master
| 2016-09-16T12:24:19.650000 | 2016-08-16T04:44:02 | 2016-08-16T04:44:02 | 64,418,101 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.drk393w.em3;
public class PhysicalAttributes {
public float velocityX, velocityY;
public float accelerationX, accelerationY;
public float dX, dY;
public void apply(float tInterval)
{
velocityX = velocityX + accelerationX;
velocityY = velocityY + accelerationY;
velocityX*=tInterval;
velocityY*=tInterval;
}
}
|
UTF-8
|
Java
| 402 |
java
|
PhysicalAttributes.java
|
Java
|
[] | null |
[] |
package com.drk393w.em3;
public class PhysicalAttributes {
public float velocityX, velocityY;
public float accelerationX, accelerationY;
public float dX, dY;
public void apply(float tInterval)
{
velocityX = velocityX + accelerationX;
velocityY = velocityY + accelerationY;
velocityX*=tInterval;
velocityY*=tInterval;
}
}
| 402 | 0.639304 | 0.629353 | 21 | 18.142857 | 19.037022 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.52381 | false | false |
9
|
b3bbf2f1d1625a2b39f67d88db7be6cc893b09dd
| 22,067,542,036,448 |
bf32292ba04f30a55ce44941ba25db206c8c04d4
|
/hc-uc/hc-uc-web/src/main/java/com/hc/scm/uc/web/controller/ItgProjectController.java
|
9586f802121848be3e512e955fcb4609db8c3920
|
[] |
no_license
|
lijinxi/hc-main-new
|
https://github.com/lijinxi/hc-main-new
|
707a20d19200e7b8ffc636a4395b2dfd76b90f73
|
9cd06028b6ffbcd95a266d8f8d4e86e39a33f94b
|
refs/heads/master
| 2021-01-10T08:43:05.562000 | 2015-12-17T07:33:03 | 2015-12-17T07:33:03 | 47,641,394 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.hc.scm.uc.web.controller;
import com.hc.scm.common.base.service.BaseCrudService;
import com.hc.scm.common.base.web.BaseCrudController;
import com.hc.scm.uc.dao.entity.ItgProject;
import com.hc.scm.uc.service.ItgProjectService;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* Description: 请写出类的用途
* All rights Reserved, Designed Byhcopyright: Copyright(C) 2014-2015
* Company: Wonhigh.
* @author: user
* @date: 2015-03-11 10:27:50
* @version 1.0.0
*/
@Controller
@RequestMapping("/itg_project")
public class ItgProjectController extends BaseCrudController<ItgProject> {
@Resource
private ItgProjectService itgProjectService;
@Override
public BaseCrudService init() {
return itgProjectService;
}
}
|
UTF-8
|
Java
| 903 |
java
|
ItgProjectController.java
|
Java
|
[
{
"context": "14-2015\r\n * Company: Wonhigh.\r\n * @author: user\r\n * @date: 2015-03-11 10:27:50\r\n * @version 1.0.",
"end": 547,
"score": 0.9952539801597595,
"start": 543,
"tag": "USERNAME",
"value": "user"
}
] | null |
[] |
package com.hc.scm.uc.web.controller;
import com.hc.scm.common.base.service.BaseCrudService;
import com.hc.scm.common.base.web.BaseCrudController;
import com.hc.scm.uc.dao.entity.ItgProject;
import com.hc.scm.uc.service.ItgProjectService;
import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* Description: 请写出类的用途
* All rights Reserved, Designed Byhcopyright: Copyright(C) 2014-2015
* Company: Wonhigh.
* @author: user
* @date: 2015-03-11 10:27:50
* @version 1.0.0
*/
@Controller
@RequestMapping("/itg_project")
public class ItgProjectController extends BaseCrudController<ItgProject> {
@Resource
private ItgProjectService itgProjectService;
@Override
public BaseCrudService init() {
return itgProjectService;
}
}
| 903 | 0.735658 | 0.707537 | 29 | 28.724138 | 21.85516 | 74 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.37931 | false | false |
9
|
3a0940a83a4e8f6ad0f6a80abffe1a34ce000c5c
| 26,061,861,619,427 |
a60f932793a81fe4d4572eae66064cbecc4b1bc6
|
/Taller de Programacion/ServidorCentral/src/DataTypes/DataUsuario.java
|
855564569647405c59e41d8e93e8ace648af590a
|
[] |
no_license
|
faller222/fing
|
https://github.com/faller222/fing
|
0f8f40c601dcf7154bb9dae8e8daf119aaf4ea59
|
93df5a96d3d9988c0c9620c34638ded00dacfa6b
|
refs/heads/master
| 2021-01-25T07:44:24.082000 | 2019-02-03T01:17:29 | 2019-02-03T01:17:29 | 93,658,761 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package DataTypes;
import Extras.UtilImage;
import java.awt.image.BufferedImage;
import java.util.Date;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlSeeAlso;
@XmlAccessorType
@XmlSeeAlso({DataCliente.class, DataProveedor.class})
public abstract class DataUsuario {
public DataUsuario() {
}
private boolean Online;
private String mail;
private String nickname;
private String pass;
private String nombre;
private String apellido;
private Date fechaNac;
private byte[] bimagen;
public DataUsuario(String NickName,
String pass,
String Mail,
String Nombre,
String Apellido,
Date FechaNac) {
this.nickname = NickName;
this.pass = pass;
this.mail = Mail;
this.nombre = Nombre;
this.apellido = Apellido;
this.fechaNac = FechaNac;
this.bimagen = null;
}
public DataUsuario(String NickName,
String pass,
String Mail,
String Nombre,
String Apellido,
Date FechaNac,
byte[] imagen) {
this.nickname = NickName;
this.pass = pass;
this.mail = Mail;
this.nombre = Nombre;
this.apellido = Apellido;
this.fechaNac = FechaNac;
this.bimagen = imagen;
}
public String getMail() {
return mail;
}
public void setMail(String email) {
this.mail = email;
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public String getNombre() {
return nombre;
}
public String getPass() {
return pass;
}
public void setPass(String pass) {
this.pass = pass;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public String getApellido() {
return apellido;
}
public void setApellido(String apellido) {
this.apellido = apellido;
}
public Date getFechaNac() {
return fechaNac;
}
public void setFechaNac(Date fechaN) {
this.fechaNac = fechaN;
}
public void setImagen(String image) throws Exception {
if (image != null && !image.equals("")) {
this.bimagen = UtilImage.toByteArray(image);
}
}
public byte[] getBimagen() {
return bimagen;
}
public void setBimagen(byte[] bimagen) throws Exception {
this.bimagen = bimagen;
}
public boolean isOnline() {
return Online;
}
public void setOnline(boolean Online) {
this.Online = Online;
}
}
|
UTF-8
|
Java
| 2,730 |
java
|
DataUsuario.java
|
Java
|
[
{
"context": " this.nickname = NickName;\n this.pass = pass;\n this.mail = Mail;\n this.nombre = ",
"end": 794,
"score": 0.9982523322105408,
"start": 790,
"tag": "PASSWORD",
"value": "pass"
},
{
"context": " this.nickname = NickName;\n this.pass = pass;\n this.mail = Mail;\n this.nombre = ",
"end": 1216,
"score": 0.9984159469604492,
"start": 1212,
"tag": "PASSWORD",
"value": "pass"
}
] | null |
[] |
package DataTypes;
import Extras.UtilImage;
import java.awt.image.BufferedImage;
import java.util.Date;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlSeeAlso;
@XmlAccessorType
@XmlSeeAlso({DataCliente.class, DataProveedor.class})
public abstract class DataUsuario {
public DataUsuario() {
}
private boolean Online;
private String mail;
private String nickname;
private String pass;
private String nombre;
private String apellido;
private Date fechaNac;
private byte[] bimagen;
public DataUsuario(String NickName,
String pass,
String Mail,
String Nombre,
String Apellido,
Date FechaNac) {
this.nickname = NickName;
this.pass = <PASSWORD>;
this.mail = Mail;
this.nombre = Nombre;
this.apellido = Apellido;
this.fechaNac = FechaNac;
this.bimagen = null;
}
public DataUsuario(String NickName,
String pass,
String Mail,
String Nombre,
String Apellido,
Date FechaNac,
byte[] imagen) {
this.nickname = NickName;
this.pass = <PASSWORD>;
this.mail = Mail;
this.nombre = Nombre;
this.apellido = Apellido;
this.fechaNac = FechaNac;
this.bimagen = imagen;
}
public String getMail() {
return mail;
}
public void setMail(String email) {
this.mail = email;
}
public String getNickname() {
return nickname;
}
public void setNickname(String nickname) {
this.nickname = nickname;
}
public String getNombre() {
return nombre;
}
public String getPass() {
return pass;
}
public void setPass(String pass) {
this.pass = pass;
}
public void setNombre(String nombre) {
this.nombre = nombre;
}
public String getApellido() {
return apellido;
}
public void setApellido(String apellido) {
this.apellido = apellido;
}
public Date getFechaNac() {
return fechaNac;
}
public void setFechaNac(Date fechaN) {
this.fechaNac = fechaN;
}
public void setImagen(String image) throws Exception {
if (image != null && !image.equals("")) {
this.bimagen = UtilImage.toByteArray(image);
}
}
public byte[] getBimagen() {
return bimagen;
}
public void setBimagen(byte[] bimagen) throws Exception {
this.bimagen = bimagen;
}
public boolean isOnline() {
return Online;
}
public void setOnline(boolean Online) {
this.Online = Online;
}
}
| 2,742 | 0.590476 | 0.590476 | 124 | 21.016129 | 15.633908 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.459677 | false | false |
9
|
24a7853ac88f217e6e0748d93abd0a1ba29aded1
| 9,526,237,474,824 |
e1e02b3d82dc6c23694fab32951a05e877ac3f98
|
/src/main/java/me/matthewe/dungeonrealms/drenhanced/dungeonrealmsenhanced/utilities/item/ItemRarity.java
|
d2a39c6cb06a9fb11c9feb16434822fb42ba2783
|
[] |
no_license
|
dungeonrealmsenhanced/DungeonRealmsEnhancedMod
|
https://github.com/dungeonrealmsenhanced/DungeonRealmsEnhancedMod
|
d67cab5218aa1823eb2f3b1a73a42da3c202c2b2
|
027896963c6c5e9a6a218a29d1896d76cf195f85
|
refs/heads/master
| 2023-07-22T20:35:36.178000 | 2023-07-14T17:13:35 | 2023-07-14T17:13:35 | 175,246,035 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package me.matthewe.dungeonrealms.drenhanced.dungeonrealmsenhanced.utilities.item;
import me.matthewe.dungeonrealms.drenhanced.dungeonrealmsenhanced.utilities.color.RGBAColor;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TextFormatting;
/**
* Created by Matthew E on 5/28/2018 at 11:57 AM for the project DungeonRealmsEnhanced
*/
public enum ItemRarity {
COMMON("Common", 0xAAAAAA, TextFormatting.GRAY, new RGBAColor(1, 1, 1)),
UNCOMMON("Uncommon", 0x5FF55, TextFormatting.GREEN, new RGBAColor(0, 1, 0)),
RARE("Rare", 0x55FFFF, TextFormatting.AQUA, new RGBAColor(0, 1, 1)),
EPIC("Epic", 0xAA00AA, TextFormatting.DARK_PURPLE, new RGBAColor(0.3f, 0, 0.3f)),
LEGENDARY("Legendary", 0xFFFF55, TextFormatting.YELLOW, new RGBAColor(1, 1, 0)),
MYTHIC("Mythic", 0xFFAA00, TextFormatting.GOLD, new RGBAColor(1, 0.6666667f, 0.0f));
private String name;
private int color;
private TextFormatting textFormatting;
private RGBAColor rgbaColor;
ItemRarity(String name, int color, TextFormatting textFormatting, RGBAColor rgbaColor) {
this.name = name;
this.color = color;
this.textFormatting = textFormatting;
this.rgbaColor = rgbaColor;
}
public static ItemRarity getByItemStack(ItemStack itemStack) {
return ItemUtils.getRarity(itemStack);
}
public RGBAColor getRgbaColor() {
return rgbaColor;
}
public String getName() {
return name;
}
public TextFormatting getTextFormatting() {
return textFormatting;
}
public int getColor() {
return color;
}
public static ItemRarity getByName(String name) {
if (name == null) {
return null;
}
for (ItemRarity itemRarity : values()) {
if (itemRarity.toString().equalsIgnoreCase(name)) {
return itemRarity;
}
}
return null;
}
public boolean isBetter(ItemRarity best) {
if (best == null) {
return true;
}
return this.ordinal() > best.ordinal();
}
}
|
UTF-8
|
Java
| 2,112 |
java
|
ItemRarity.java
|
Java
|
[
{
"context": "craft.util.text.TextFormatting;\n\n/**\n * Created by Matthew E on 5/28/2018 at 11:57 AM for the project DungeonR",
"end": 289,
"score": 0.9994637966156006,
"start": 280,
"tag": "NAME",
"value": "Matthew E"
}
] | null |
[] |
package me.matthewe.dungeonrealms.drenhanced.dungeonrealmsenhanced.utilities.item;
import me.matthewe.dungeonrealms.drenhanced.dungeonrealmsenhanced.utilities.color.RGBAColor;
import net.minecraft.item.ItemStack;
import net.minecraft.util.text.TextFormatting;
/**
* Created by <NAME> on 5/28/2018 at 11:57 AM for the project DungeonRealmsEnhanced
*/
public enum ItemRarity {
COMMON("Common", 0xAAAAAA, TextFormatting.GRAY, new RGBAColor(1, 1, 1)),
UNCOMMON("Uncommon", 0x5FF55, TextFormatting.GREEN, new RGBAColor(0, 1, 0)),
RARE("Rare", 0x55FFFF, TextFormatting.AQUA, new RGBAColor(0, 1, 1)),
EPIC("Epic", 0xAA00AA, TextFormatting.DARK_PURPLE, new RGBAColor(0.3f, 0, 0.3f)),
LEGENDARY("Legendary", 0xFFFF55, TextFormatting.YELLOW, new RGBAColor(1, 1, 0)),
MYTHIC("Mythic", 0xFFAA00, TextFormatting.GOLD, new RGBAColor(1, 0.6666667f, 0.0f));
private String name;
private int color;
private TextFormatting textFormatting;
private RGBAColor rgbaColor;
ItemRarity(String name, int color, TextFormatting textFormatting, RGBAColor rgbaColor) {
this.name = name;
this.color = color;
this.textFormatting = textFormatting;
this.rgbaColor = rgbaColor;
}
public static ItemRarity getByItemStack(ItemStack itemStack) {
return ItemUtils.getRarity(itemStack);
}
public RGBAColor getRgbaColor() {
return rgbaColor;
}
public String getName() {
return name;
}
public TextFormatting getTextFormatting() {
return textFormatting;
}
public int getColor() {
return color;
}
public static ItemRarity getByName(String name) {
if (name == null) {
return null;
}
for (ItemRarity itemRarity : values()) {
if (itemRarity.toString().equalsIgnoreCase(name)) {
return itemRarity;
}
}
return null;
}
public boolean isBetter(ItemRarity best) {
if (best == null) {
return true;
}
return this.ordinal() > best.ordinal();
}
}
| 2,109 | 0.65625 | 0.629735 | 69 | 29.608696 | 28.12303 | 92 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.884058 | false | false |
9
|
908c9e4e6a1f5eee41c808f4ddab14b7ad3a13a2
| 16,295,105,964,223 |
b486b291abba4d995a7fcce1c270595964f1e160
|
/src/main/java/cn/zcyoung/home/controller/AdminController.java
|
cc004ed0012f47bd85a55462f22e11e057f9644b
|
[] |
no_license
|
zengchunzc/zcyoung_ssm
|
https://github.com/zengchunzc/zcyoung_ssm
|
0eb2cd3e7ad9dfe6f141c43b84f3eb6c5000296c
|
485c1b04c8443af2770face304f0febdb9a6d150
|
refs/heads/master
| 2020-05-23T08:11:17.938000 | 2017-07-01T11:08:59 | 2017-07-01T11:08:59 | 70,298,820 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package cn.zcyoung.home.controller;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import cn.zcyoung.home.pojo.Friendurl;
import cn.zcyoung.home.pojo.Log;
import cn.zcyoung.home.pojo.Message;
import cn.zcyoung.home.pojo.User;
import cn.zcyoung.home.service.FriendUrlService;
import cn.zcyoung.home.service.LogService;
import cn.zcyoung.home.service.MessageService;
import cn.zcyoung.home.service.PageService;
import cn.zcyoung.home.service.UserService;
import cn.zcyoung.home.utils.MD5Utils;
import cn.zcyoung.home.utils.MailUtils;
import cn.zcyoung.home.utils.PjaxUtils;
import cn.zcyoung.home.web.auth.AuthPassport;
@Controller
@RequestMapping("/admin")
public class AdminController {
@Resource
private UserService userService;
@Resource
private FriendUrlService friendUrlService;
@Resource
private PageService pageService;
@Resource
private LogService logService;
@Resource
private MessageService messageService;
@AuthPassport(isadmin = true)
@RequestMapping("/user")
public String user(HttpServletRequest request){
String key = request.getParameter("key");
if(key == null || key.equals(""))
request.setAttribute("Page", pageService.GetUserPage(1, 10));
else {
request.setAttribute("Page", pageService.GetUserPage(1, 10, key));
request.setAttribute("key", key);
}
return PjaxUtils.get(request, "admin_user");
}
@AuthPassport(isadmin = true)
@RequestMapping("/user/{page}")
public String user(HttpServletRequest request, @PathVariable Integer page){
request.setAttribute("Page", pageService.GetUserPage(page, 10));
return PjaxUtils.get(request, "admin_user");
}
@AuthPassport(isadmin = true)
@RequestMapping("/user/{page}/{key}")
public String user(HttpServletRequest request, @PathVariable String key, @PathVariable Integer page){
try {
key = new String(key.getBytes("iso-8859-1"), "utf-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
request.setAttribute("Key", key);
request.setAttribute("Page", pageService.GetUserPage(page, 10, key));
return PjaxUtils.get(request, "admin_user");
}
@AuthPassport(isadmin = true)
@RequestMapping("/friendurl")
public String friendurl(HttpServletRequest request){
request.setAttribute("Page", pageService.GetFriendUrlPage(FriendUrlService.By_TIME, 1, 10, true));
return PjaxUtils.get(request, "admin_friendurl");
}
@AuthPassport(isadmin = true)
@RequestMapping("/friendurl/{page}")
public String friendurl(HttpServletRequest request, @PathVariable Integer page){
request.setAttribute("Page", pageService.GetFriendUrlPage(FriendUrlService.By_TIME, page, 10, true));
return PjaxUtils.get(request, "admin_friendurl");
}
@AuthPassport(isadmin = true)
@RequestMapping(value="/checkfriendurl/{id}")
public String cfriendurl(HttpServletRequest request, @PathVariable Integer id){
User user = (User) request.getSession().getAttribute("User");
Friendurl fu = friendUrlService.GetFriendUrlById(id);
if(fu != null && fu.getCheckState() != 1){
if(friendUrlService.CheckFreind(user, id)){
Log log = new Log();
log.setData(user.getUsername() + "通过了" + fu.getUserId() + "的[" + fu.getName() + "]友链.");
log.setTime(new Date());
log.setType("admin");
log.setUserId(user.getId());
logService.AddLog(log);
Message message = new Message();
message.setTime(new Date());
message.setFromId(1);
message.setToId(fu.getUserId());
message.setState(0);
message.setUrl("/view/friendurl");
message.setData("亲的[" + fu.getName() + "]已通过审核,谢谢您的使用.");
messageService.AddMessage(message);
request.setAttribute("msg", "审核通过。");
request.setAttribute("Page", pageService.GetFriendUrlPage(FriendUrlService.By_TIME, 1, 10, true));
return PjaxUtils.get(request, "admin_friendurl");
}
}
request.setAttribute("msg", "审核失败。");
request.setAttribute("Page", pageService.GetFriendUrlPage(FriendUrlService.By_TIME, 1, 10, true));
return PjaxUtils.get(request, "admin_friendurl");
}
@AuthPassport(isadmin = true)
@RequestMapping(value="/deletefriendurl/{id}")
public String dfriendurl(HttpServletRequest request, @PathVariable Integer id){
User user = (User) request.getSession().getAttribute("User");
Friendurl fu = friendUrlService.GetFriendUrlById(id);
if(fu != null && friendUrlService.DeleteFirendUrl(id)){
Log log = new Log();
log.setData(user.getUsername() + "删除了" + fu.getUserId() + "的[" + fu.getName() + "]友链.");
log.setTime(new Date());
log.setType("admin");
log.setUserId(user.getId());
logService.AddLog(log);
request.setAttribute("msg", "删除成功。");
}
else request.setAttribute("msg", "删除失败。");
request.setAttribute("Page", pageService.GetFriendUrlPage(FriendUrlService.By_TIME, 1, 10, true));
return PjaxUtils.get(request, "admin_friendurl");
}
@AuthPassport(isadmin = true)
@RequestMapping("/repassword/{id}")
public String repassword(HttpServletRequest request, @PathVariable Integer id){
User user = (User) request.getSession().getAttribute("User");
User client = userService.GetUserById(id);
if(client == null) request.setAttribute("msg", "重置密码失败.");
else if(client.getRole().equals("admin") && user.getId() != 1) request.setAttribute("msg", "重置密码失败.");
else {
String pw = (int)(Math.random() * 100000000) + "";
client.setPassword(MD5Utils.md5(pw));
Log log = new Log();
log.setData(user.getUsername() + "为" + client.getUsername() + "重置了密码.");
log.setTime(new Date());
log.setType("admin");
log.setUserId(user.getId());
logService.AddLog(log);
log = new Log();
log.setType("mail");
log.setTime(new Date());
log.setUserId(user.getId());
log.setData("重置为了" + pw);
logService.AddLog(log);
client.setPassword(MD5Utils.md5(pw));
userService.UpdateUser(client);
Message message = new Message();
message.setData("管理员为您重置了登录密码,请妥善保管.");
message.setTime(new Date());
message.setFromId(1);
message.setToId(client.getId());
message.setState(0);
messageService.AddMessage(message);
new MailUtils().SendResetPw(client, pw);
request.setAttribute("msg", "重置成功,为【"+ pw +"】");
}
request.setAttribute("Page", pageService.GetUserPage(1, 10));
return PjaxUtils.get(request, "admin_user");
}
}
|
UTF-8
|
Java
| 6,696 |
java
|
AdminController.java
|
Java
|
[
{
"context": "random() * 100000000) + \"\";\n\t\t\tclient.setPassword(MD5Utils.md5(pw));\n\t\t\tLog log = new Log();\n\t\t\tlog.setData(user",
"end": 5589,
"score": 0.8895718455314636,
"start": 5577,
"tag": "PASSWORD",
"value": "MD5Utils.md5"
},
{
"context": "logService.AddLog(log);\n\t\t\t\n\t\t\tclient.setPassword(MD5Utils.md5(pw));\n\t\t\tuserService.UpdateUser(client);\n\t\t\t\n\t\t\tM",
"end": 6010,
"score": 0.9039084315299988,
"start": 5998,
"tag": "PASSWORD",
"value": "MD5Utils.md5"
}
] | null |
[] |
package cn.zcyoung.home.controller;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import cn.zcyoung.home.pojo.Friendurl;
import cn.zcyoung.home.pojo.Log;
import cn.zcyoung.home.pojo.Message;
import cn.zcyoung.home.pojo.User;
import cn.zcyoung.home.service.FriendUrlService;
import cn.zcyoung.home.service.LogService;
import cn.zcyoung.home.service.MessageService;
import cn.zcyoung.home.service.PageService;
import cn.zcyoung.home.service.UserService;
import cn.zcyoung.home.utils.MD5Utils;
import cn.zcyoung.home.utils.MailUtils;
import cn.zcyoung.home.utils.PjaxUtils;
import cn.zcyoung.home.web.auth.AuthPassport;
@Controller
@RequestMapping("/admin")
public class AdminController {
@Resource
private UserService userService;
@Resource
private FriendUrlService friendUrlService;
@Resource
private PageService pageService;
@Resource
private LogService logService;
@Resource
private MessageService messageService;
@AuthPassport(isadmin = true)
@RequestMapping("/user")
public String user(HttpServletRequest request){
String key = request.getParameter("key");
if(key == null || key.equals(""))
request.setAttribute("Page", pageService.GetUserPage(1, 10));
else {
request.setAttribute("Page", pageService.GetUserPage(1, 10, key));
request.setAttribute("key", key);
}
return PjaxUtils.get(request, "admin_user");
}
@AuthPassport(isadmin = true)
@RequestMapping("/user/{page}")
public String user(HttpServletRequest request, @PathVariable Integer page){
request.setAttribute("Page", pageService.GetUserPage(page, 10));
return PjaxUtils.get(request, "admin_user");
}
@AuthPassport(isadmin = true)
@RequestMapping("/user/{page}/{key}")
public String user(HttpServletRequest request, @PathVariable String key, @PathVariable Integer page){
try {
key = new String(key.getBytes("iso-8859-1"), "utf-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
request.setAttribute("Key", key);
request.setAttribute("Page", pageService.GetUserPage(page, 10, key));
return PjaxUtils.get(request, "admin_user");
}
@AuthPassport(isadmin = true)
@RequestMapping("/friendurl")
public String friendurl(HttpServletRequest request){
request.setAttribute("Page", pageService.GetFriendUrlPage(FriendUrlService.By_TIME, 1, 10, true));
return PjaxUtils.get(request, "admin_friendurl");
}
@AuthPassport(isadmin = true)
@RequestMapping("/friendurl/{page}")
public String friendurl(HttpServletRequest request, @PathVariable Integer page){
request.setAttribute("Page", pageService.GetFriendUrlPage(FriendUrlService.By_TIME, page, 10, true));
return PjaxUtils.get(request, "admin_friendurl");
}
@AuthPassport(isadmin = true)
@RequestMapping(value="/checkfriendurl/{id}")
public String cfriendurl(HttpServletRequest request, @PathVariable Integer id){
User user = (User) request.getSession().getAttribute("User");
Friendurl fu = friendUrlService.GetFriendUrlById(id);
if(fu != null && fu.getCheckState() != 1){
if(friendUrlService.CheckFreind(user, id)){
Log log = new Log();
log.setData(user.getUsername() + "通过了" + fu.getUserId() + "的[" + fu.getName() + "]友链.");
log.setTime(new Date());
log.setType("admin");
log.setUserId(user.getId());
logService.AddLog(log);
Message message = new Message();
message.setTime(new Date());
message.setFromId(1);
message.setToId(fu.getUserId());
message.setState(0);
message.setUrl("/view/friendurl");
message.setData("亲的[" + fu.getName() + "]已通过审核,谢谢您的使用.");
messageService.AddMessage(message);
request.setAttribute("msg", "审核通过。");
request.setAttribute("Page", pageService.GetFriendUrlPage(FriendUrlService.By_TIME, 1, 10, true));
return PjaxUtils.get(request, "admin_friendurl");
}
}
request.setAttribute("msg", "审核失败。");
request.setAttribute("Page", pageService.GetFriendUrlPage(FriendUrlService.By_TIME, 1, 10, true));
return PjaxUtils.get(request, "admin_friendurl");
}
@AuthPassport(isadmin = true)
@RequestMapping(value="/deletefriendurl/{id}")
public String dfriendurl(HttpServletRequest request, @PathVariable Integer id){
User user = (User) request.getSession().getAttribute("User");
Friendurl fu = friendUrlService.GetFriendUrlById(id);
if(fu != null && friendUrlService.DeleteFirendUrl(id)){
Log log = new Log();
log.setData(user.getUsername() + "删除了" + fu.getUserId() + "的[" + fu.getName() + "]友链.");
log.setTime(new Date());
log.setType("admin");
log.setUserId(user.getId());
logService.AddLog(log);
request.setAttribute("msg", "删除成功。");
}
else request.setAttribute("msg", "删除失败。");
request.setAttribute("Page", pageService.GetFriendUrlPage(FriendUrlService.By_TIME, 1, 10, true));
return PjaxUtils.get(request, "admin_friendurl");
}
@AuthPassport(isadmin = true)
@RequestMapping("/repassword/{id}")
public String repassword(HttpServletRequest request, @PathVariable Integer id){
User user = (User) request.getSession().getAttribute("User");
User client = userService.GetUserById(id);
if(client == null) request.setAttribute("msg", "重置密码失败.");
else if(client.getRole().equals("admin") && user.getId() != 1) request.setAttribute("msg", "重置密码失败.");
else {
String pw = (int)(Math.random() * 100000000) + "";
client.setPassword(<PASSWORD>(pw));
Log log = new Log();
log.setData(user.getUsername() + "为" + client.getUsername() + "重置了密码.");
log.setTime(new Date());
log.setType("admin");
log.setUserId(user.getId());
logService.AddLog(log);
log = new Log();
log.setType("mail");
log.setTime(new Date());
log.setUserId(user.getId());
log.setData("重置为了" + pw);
logService.AddLog(log);
client.setPassword(<PASSWORD>(pw));
userService.UpdateUser(client);
Message message = new Message();
message.setData("管理员为您重置了登录密码,请妥善保管.");
message.setTime(new Date());
message.setFromId(1);
message.setToId(client.getId());
message.setState(0);
messageService.AddMessage(message);
new MailUtils().SendResetPw(client, pw);
request.setAttribute("msg", "重置成功,为【"+ pw +"】");
}
request.setAttribute("Page", pageService.GetUserPage(1, 10));
return PjaxUtils.get(request, "admin_user");
}
}
| 6,692 | 0.721216 | 0.71308 | 178 | 35.595505 | 24.758709 | 104 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.780899 | false | false |
9
|
32b3b3851fb0b6b86533fb98c9a97804f71b159b
| 16,415,365,040,478 |
afa23aeeecb836c2a0edab381ffe3b1edc3f7630
|
/workspace/JavaLearning/src/Chegg/ReadFile.java
|
156c544218d2199aa97c8499e69e1b965d67c5d6
|
[] |
no_license
|
fathamd/JavaLearing
|
https://github.com/fathamd/JavaLearing
|
0a4c9faee42180c203fe55d05fd34df50b5a3fcb
|
aad820608fa3cc7beb2d0a961b5c1eb5e47e95c0
|
refs/heads/master
| 2020-09-23T13:12:33.510000 | 2019-12-03T02:04:51 | 2019-12-03T02:04:51 | 225,508,788 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package Chegg;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;
public class ReadFile {
public static void main(String[] args) throws FileNotFoundException {
ArrayList<Long> array = new ArrayList<Long>();
Scanner input = new Scanner(new File("numbers.txt"));
int counter = 0;
while(input.hasNextLine() && counter < 50)
{
array.add(input.nextLong());
counter++;
}
Long[] intArr = new Long[array.size()];
array.toArray(intArr);
ArrayList<String> array2 = new ArrayList<String>();
Scanner input2 = new Scanner(new File("names.txt"));
int counter2 = 0;
while(input2.hasNextLine() && counter2 < 50)
{
array2.add(input2.nextLine());
counter2++;
}
String[] strArr = new String[array2.size()];
array2.toArray(strArr);
LinkedHashMap<Long, String> productMap = new LinkedHashMap<Long, String>();
for (int i=0;i<array.size();i++) {
productMap.put(Long.valueOf(intArr[i]),String.valueOf(strArr[i]));
}
System.out.println("Before sorting");
for (Map.Entry<Long,String> entry : productMap.entrySet())
System.out.println("Phone number = " + entry.getKey() +
", Name = " + entry.getValue());
System.out.println("After sorting phone numbers");
TreeMap<Long, String> treeMap = new TreeMap<Long, String>(productMap);
for (Map.Entry<Long,String> entry1 : treeMap.entrySet())
System.out.println("Phone number = " + entry1.getKey() +
", Name = " + entry1.getValue());
}
}
|
UTF-8
|
Java
| 1,881 |
java
|
ReadFile.java
|
Java
|
[] | null |
[] |
package Chegg;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Scanner;
import java.util.TreeMap;
public class ReadFile {
public static void main(String[] args) throws FileNotFoundException {
ArrayList<Long> array = new ArrayList<Long>();
Scanner input = new Scanner(new File("numbers.txt"));
int counter = 0;
while(input.hasNextLine() && counter < 50)
{
array.add(input.nextLong());
counter++;
}
Long[] intArr = new Long[array.size()];
array.toArray(intArr);
ArrayList<String> array2 = new ArrayList<String>();
Scanner input2 = new Scanner(new File("names.txt"));
int counter2 = 0;
while(input2.hasNextLine() && counter2 < 50)
{
array2.add(input2.nextLine());
counter2++;
}
String[] strArr = new String[array2.size()];
array2.toArray(strArr);
LinkedHashMap<Long, String> productMap = new LinkedHashMap<Long, String>();
for (int i=0;i<array.size();i++) {
productMap.put(Long.valueOf(intArr[i]),String.valueOf(strArr[i]));
}
System.out.println("Before sorting");
for (Map.Entry<Long,String> entry : productMap.entrySet())
System.out.println("Phone number = " + entry.getKey() +
", Name = " + entry.getValue());
System.out.println("After sorting phone numbers");
TreeMap<Long, String> treeMap = new TreeMap<Long, String>(productMap);
for (Map.Entry<Long,String> entry1 : treeMap.entrySet())
System.out.println("Phone number = " + entry1.getKey() +
", Name = " + entry1.getValue());
}
}
| 1,881 | 0.576289 | 0.565657 | 59 | 29.881355 | 24.970549 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.677966 | false | false |
9
|
7639791e1d391c9ab733c41e32459b485740185d
| 19,997,367,788,232 |
2a904d37b79d2c19b40c10ecd09362bd0be4bd2b
|
/src/service/Encryption.java
|
08031f69631780e8957991518739630fedb89a19
|
[] |
no_license
|
scriptboys/swing
|
https://github.com/scriptboys/swing
|
57422ecc08584e07935f6677d1e29313a57fd3ca
|
9891a9780df6d91f6be15c8127cad5b280f268af
|
refs/heads/master
| 2020-03-21T22:36:54.263000 | 2018-07-09T05:09:15 | 2018-07-09T05:09:15 | 139,136,958 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package service;
import java.util.HashMap;
import java.util.Map;
public class Encryption {
public Map<String, Object> getEncryptionByte(byte[] encrypted){
Map<String, Object> confidential=new HashMap<>();
int key=(int) (Math.random()*999+1);
byte[] dest=new byte[encrypted.length+1];
for(int i=0;i<dest.length-1;i++){
dest[i]=(byte) (encrypted[i]+key);
}
//把byte最后一位留给Key,以便解密
dest[dest.length-1]=(byte) key;
confidential.put("key", key);
confidential.put("dest", dest);
return confidential;
}
public byte[] getDecryptionByte(byte[] arr){
byte[] dest=new byte[arr.length-1];
int key=arr[arr.length-1];
for(int i=0;i<dest.length;i++){
dest[i]=(byte) (arr[i]-key);
}
return dest;
}
}
|
GB18030
|
Java
| 778 |
java
|
Encryption.java
|
Java
|
[] | null |
[] |
package service;
import java.util.HashMap;
import java.util.Map;
public class Encryption {
public Map<String, Object> getEncryptionByte(byte[] encrypted){
Map<String, Object> confidential=new HashMap<>();
int key=(int) (Math.random()*999+1);
byte[] dest=new byte[encrypted.length+1];
for(int i=0;i<dest.length-1;i++){
dest[i]=(byte) (encrypted[i]+key);
}
//把byte最后一位留给Key,以便解密
dest[dest.length-1]=(byte) key;
confidential.put("key", key);
confidential.put("dest", dest);
return confidential;
}
public byte[] getDecryptionByte(byte[] arr){
byte[] dest=new byte[arr.length-1];
int key=arr[arr.length-1];
for(int i=0;i<dest.length;i++){
dest[i]=(byte) (arr[i]-key);
}
return dest;
}
}
| 778 | 0.640212 | 0.625661 | 29 | 24.068966 | 16.956194 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.275862 | false | false |
9
|
1a5713f421cda2f2ae24c064c2bf72bba8942e0a
| 4,879,082,849,090 |
38a2e8068dcc639a631cc750939d86a3ec44672d
|
/src/main/java/com/framework/utils/ModelUtils.java
|
318a84524b176aae1e511dadc8244e954d72e877
|
[] |
no_license
|
germanotero/Cyrius
|
https://github.com/germanotero/Cyrius
|
a6c61055f3557e3652887dd5331fc28a5f74d531
|
c348c1a6f64065c5b28075e68a9dab781b25fa4c
|
refs/heads/master
| 2023-04-29T01:21:43.227000 | 2021-09-21T13:29:19 | 2021-09-21T13:29:19 | 3,120,377 | 1 | 0 | null | false | 2023-04-14T19:04:00 | 2012-01-06T19:29:50 | 2021-09-21T13:29:27 | 2023-04-14T19:03:56 | 7,471 | 2 | 0 | 6 |
Java
| false | false |
/* */ package com.framework.utils;
/* */
/* */ import com.framework.entities.FormModelUtils;
/* */ import com.framework.models.FormModel;
/* */
/* */ public class ModelUtils
/* */ {
/* */ public static FormModel getNestedProperty(FormModel parent, String propertyName)
/* */ {
/* 13 */ return parent.getProperty(propertyName);
/* */ }
/* */
/* */ public static FormModel getNestedProperty(Object parent, String propertyName) {
/* 17 */ return FormModelUtils.wrap(parent).getProperty(propertyName);
/* */ }
/* */
/* */ public static void setNestedProperty(FormModel parent, String hierarchiMethod, Object argument)
/* */ {
/* 22 */ parent.setProperty(hierarchiMethod, argument);
/* */ }
/* */
/* */ public static void setNestedProperty(Object parent, String hierarchiMethod, Object argument)
/* */ {
/* 27 */ FormModelUtils.wrap(parent).setProperty(hierarchiMethod, argument);
/* */ }
/* */ }
/* Location: E:\cyrius.ultimo\cyrius\cyrius.jar
* Qualified Name: com.framework.utils.ModelUtils
* JD-Core Version: 0.6.0
*/
|
UTF-8
|
Java
| 1,176 |
java
|
ModelUtils.java
|
Java
|
[] | null |
[] |
/* */ package com.framework.utils;
/* */
/* */ import com.framework.entities.FormModelUtils;
/* */ import com.framework.models.FormModel;
/* */
/* */ public class ModelUtils
/* */ {
/* */ public static FormModel getNestedProperty(FormModel parent, String propertyName)
/* */ {
/* 13 */ return parent.getProperty(propertyName);
/* */ }
/* */
/* */ public static FormModel getNestedProperty(Object parent, String propertyName) {
/* 17 */ return FormModelUtils.wrap(parent).getProperty(propertyName);
/* */ }
/* */
/* */ public static void setNestedProperty(FormModel parent, String hierarchiMethod, Object argument)
/* */ {
/* 22 */ parent.setProperty(hierarchiMethod, argument);
/* */ }
/* */
/* */ public static void setNestedProperty(Object parent, String hierarchiMethod, Object argument)
/* */ {
/* 27 */ FormModelUtils.wrap(parent).setProperty(hierarchiMethod, argument);
/* */ }
/* */ }
/* Location: E:\cyrius.ultimo\cyrius\cyrius.jar
* Qualified Name: com.framework.utils.ModelUtils
* JD-Core Version: 0.6.0
*/
| 1,176 | 0.60034 | 0.590986 | 31 | 36 | 32.22802 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.483871 | false | false |
9
|
5304b5fe12bb462909dee838e05dea6a4bab78d7
| 25,391,846,703,033 |
b1df851fee813939d02510383d08dd6ca98504e6
|
/src/api/java/mekanism/api/recipes/cache/CombinerCachedRecipe.java
|
2b0e77cd5983d5b0c51a4574bbfc6f6e536e65a4
|
[
"MIT"
] |
permissive
|
MorningSage/Mekanism-Fabric
|
https://github.com/MorningSage/Mekanism-Fabric
|
0d78b35ca54de30297f31f4b96aacb3e17431d29
|
ef1bf9e3d08ead12a9e58372e5985cacc720372a
|
refs/heads/master
| 2022-12-23T18:16:27.042000 | 2020-10-04T01:59:01 | 2020-10-04T01:59:01 | 291,511,422 | 5 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package mekanism.api.recipes.cache;
import mekanism.api.annotations.FieldsAreNonnullByDefault;
import mekanism.api.annotations.NonNull;
import mekanism.api.recipes.CombinerRecipe;
import mekanism.api.recipes.inputs.IInputHandler;
import mekanism.api.recipes.outputs.IOutputHandler;
import net.minecraft.item.ItemStack;
import javax.annotation.ParametersAreNonnullByDefault;
@FieldsAreNonnullByDefault
@ParametersAreNonnullByDefault
public class CombinerCachedRecipe extends CachedRecipe<CombinerRecipe> {
private final IOutputHandler<@NonNull ItemStack> outputHandler;
private final IInputHandler<@NonNull ItemStack> inputHandler;
private final IInputHandler<@NonNull ItemStack> extraInputHandler;
public CombinerCachedRecipe(CombinerRecipe recipe, IInputHandler<@NonNull ItemStack> inputHandler, IInputHandler<@NonNull ItemStack> extraInputHandler,
IOutputHandler<@NonNull ItemStack> outputHandler) {
super(recipe);
this.inputHandler = inputHandler;
this.extraInputHandler = extraInputHandler;
this.outputHandler = outputHandler;
}
@Override
protected int getOperationsThisTick(int currentMax) {
currentMax = super.getOperationsThisTick(currentMax);
if (currentMax <= 0) {
//If our parent checks show we can't operate then return so
return currentMax;
}
ItemStack recipeMain = inputHandler.getRecipeInput(recipe.getMainInput());
//Test to make sure we can even perform a single operation. This is akin to !recipe.test(inputItem)
if (recipeMain.isEmpty()) {
return -1;
}
ItemStack recipeExtra = extraInputHandler.getRecipeInput(recipe.getExtraInput());
//Test to make sure we can even perform a single operation. This is akin to !recipe.test(inputItem)
if (recipeExtra.isEmpty()) {
return -1;
}
//Calculate the current max based on the main input
currentMax = inputHandler.operationsCanSupport(recipe.getMainInput(), currentMax);
//Calculate the current max based on the extra input
currentMax = extraInputHandler.operationsCanSupport(recipe.getExtraInput(), currentMax);
if (currentMax <= 0) {
//If our input can't handle it return that we should be resetting
return -1;
}
//Calculate the max based on the space in the output
return outputHandler.operationsRoomFor(recipe.getOutput(recipeMain, recipeExtra), currentMax);
}
@Override
public boolean isInputValid() {
return recipe.test(inputHandler.getInput(), extraInputHandler.getInput());
}
@Override
protected void finishProcessing(int operations) {
ItemStack recipeMain = inputHandler.getRecipeInput(recipe.getMainInput());
if (recipeMain.isEmpty()) {
//Something went wrong, this if should never really be true if we got to finishProcessing
return;
}
ItemStack recipeExtra = extraInputHandler.getRecipeInput(recipe.getExtraInput());
if (recipeExtra.isEmpty()) {
//Something went wrong, this if should never really be true if we got to finishProcessing
return;
}
inputHandler.use(recipeMain, operations);
extraInputHandler.use(recipeExtra, operations);
outputHandler.handleOutput(recipe.getOutput(recipeMain, recipeExtra), operations);
}
}
|
UTF-8
|
Java
| 3,451 |
java
|
CombinerCachedRecipe.java
|
Java
|
[] | null |
[] |
package mekanism.api.recipes.cache;
import mekanism.api.annotations.FieldsAreNonnullByDefault;
import mekanism.api.annotations.NonNull;
import mekanism.api.recipes.CombinerRecipe;
import mekanism.api.recipes.inputs.IInputHandler;
import mekanism.api.recipes.outputs.IOutputHandler;
import net.minecraft.item.ItemStack;
import javax.annotation.ParametersAreNonnullByDefault;
@FieldsAreNonnullByDefault
@ParametersAreNonnullByDefault
public class CombinerCachedRecipe extends CachedRecipe<CombinerRecipe> {
private final IOutputHandler<@NonNull ItemStack> outputHandler;
private final IInputHandler<@NonNull ItemStack> inputHandler;
private final IInputHandler<@NonNull ItemStack> extraInputHandler;
public CombinerCachedRecipe(CombinerRecipe recipe, IInputHandler<@NonNull ItemStack> inputHandler, IInputHandler<@NonNull ItemStack> extraInputHandler,
IOutputHandler<@NonNull ItemStack> outputHandler) {
super(recipe);
this.inputHandler = inputHandler;
this.extraInputHandler = extraInputHandler;
this.outputHandler = outputHandler;
}
@Override
protected int getOperationsThisTick(int currentMax) {
currentMax = super.getOperationsThisTick(currentMax);
if (currentMax <= 0) {
//If our parent checks show we can't operate then return so
return currentMax;
}
ItemStack recipeMain = inputHandler.getRecipeInput(recipe.getMainInput());
//Test to make sure we can even perform a single operation. This is akin to !recipe.test(inputItem)
if (recipeMain.isEmpty()) {
return -1;
}
ItemStack recipeExtra = extraInputHandler.getRecipeInput(recipe.getExtraInput());
//Test to make sure we can even perform a single operation. This is akin to !recipe.test(inputItem)
if (recipeExtra.isEmpty()) {
return -1;
}
//Calculate the current max based on the main input
currentMax = inputHandler.operationsCanSupport(recipe.getMainInput(), currentMax);
//Calculate the current max based on the extra input
currentMax = extraInputHandler.operationsCanSupport(recipe.getExtraInput(), currentMax);
if (currentMax <= 0) {
//If our input can't handle it return that we should be resetting
return -1;
}
//Calculate the max based on the space in the output
return outputHandler.operationsRoomFor(recipe.getOutput(recipeMain, recipeExtra), currentMax);
}
@Override
public boolean isInputValid() {
return recipe.test(inputHandler.getInput(), extraInputHandler.getInput());
}
@Override
protected void finishProcessing(int operations) {
ItemStack recipeMain = inputHandler.getRecipeInput(recipe.getMainInput());
if (recipeMain.isEmpty()) {
//Something went wrong, this if should never really be true if we got to finishProcessing
return;
}
ItemStack recipeExtra = extraInputHandler.getRecipeInput(recipe.getExtraInput());
if (recipeExtra.isEmpty()) {
//Something went wrong, this if should never really be true if we got to finishProcessing
return;
}
inputHandler.use(recipeMain, operations);
extraInputHandler.use(recipeExtra, operations);
outputHandler.handleOutput(recipe.getOutput(recipeMain, recipeExtra), operations);
}
}
| 3,451 | 0.709649 | 0.708201 | 78 | 43.256409 | 34.018257 | 155 | true | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.602564 | false | false |
9
|
70bc313c37fc608a9dce802c3217bb27b2508823
| 23,553,600,661,599 |
c3445da9eff3501684f1e22dd8709d01ff414a15
|
/LIS/sinosoft-parents/lis-business/src/main/java/com/sinosoft/lis/claimgrp/LLStandPayInfoBL.java
|
c4afb89b104ade07826c54a2d8a918200f257620
|
[] |
no_license
|
zhanght86/HSBC20171018
|
https://github.com/zhanght86/HSBC20171018
|
954403d25d24854dd426fa9224dfb578567ac212
|
c1095c58c0bdfa9d79668db9be4a250dd3f418c5
|
refs/heads/master
| 2021-05-07T03:30:31.905000 | 2017-11-08T08:54:46 | 2017-11-08T08:54:46 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
/*
* <p>ClassName: LLStandPayInfoBL </p>
* <p>Description: LLStandPayInfoBL类文件 </p>
* <p>Copyright: Copyright (c) 2002</p>
* <p>Company: testcompany </p>
* @Database:
* @Author:pd
* @CreateDate:2005-11-1
*/
package com.sinosoft.lis.claimgrp;
import org.apache.log4j.Logger;
import com.sinosoft.lis.vschema.*;
import com.sinosoft.utility.*;
import com.sinosoft.lis.pubfun.*;
import com.sinosoft.service.BusinessService;
public class LLStandPayInfoBL implements BusinessService{
private static Logger logger = Logger.getLogger(LLStandPayInfoBL.class);
/** 错误处理类,每个需要错误处理的类中都放置该类 */
public CErrors mErrors = new CErrors();
private VData mResult = new VData();
/** 往后面传输数据的容器 */
private VData mInputData = new VData();
private MMap map = new MMap();
/** 全局数据 */
private GlobalInput mGlobalInput = new GlobalInput();
/** 数据操作字符串 */
private String mOperate;
/** 业务处理相关变量 */
private LLStandPayInfoSet mLLStandPayInfoSet = new LLStandPayInfoSet();
public LLStandPayInfoBL() {
}
public static void main(String[] args) {
}
/**
* 传输数据的公共方法
* @param: cInputData 输入的数据
* cOperate 数据操作
* @return:
*/
public boolean submitData(VData cInputData, String cOperate) {
//将操作数据拷贝到本类中
this.mOperate = cOperate;
//得到外部传入的数据,将数据备份到本类中
logger.debug("begin getinputdata");
if (!getInputData(cInputData)) {
// @@错误处理
CError tError = new CError();
tError.moduleName = "LLStandPayInfoBL";
tError.functionName = "submitData";
tError.errorMessage = "数据处理失败LLStandPayInfoBL-->getInputData!";
this.mErrors.addOneError(tError);
return false;
}
logger.debug(
"----------LLStandPayInfoBL after getInputData----------");
//进行业务处理
if (!dealData()) {
// @@错误处理
CError tError = new CError();
tError.moduleName = "LLStandPayInfoBL";
tError.functionName = "submitData";
tError.errorMessage = "数据处理失败LLStandPayInfoBL-->dealData!";
this.mErrors.addOneError(tError);
return false;
}
logger.debug(
"----------LLStandPayInfoBL after dealData----------");
//准备往后台的数据
if (!prepareOutputData()) {
// @@错误处理
CError tError = new CError();
tError.moduleName = "LLStandPayInfoBL";
tError.functionName = "submitData";
tError.errorMessage = "数据处理失败LLStandPayInfoBL-->submitquery!";
this.mErrors.addOneError(tError);
return false;
}
logger.debug(
"----------LLStandPayInfoBL after prepareOutputData----------");
PubSubmit tPubSubmit = new PubSubmit();
if (!tPubSubmit.submitData(mInputData, cOperate)) {
// @@错误处理
this.mErrors.copyAllErrors(tPubSubmit.mErrors);
CError tError = new CError();
tError.moduleName = "LLClaimRegisterDealBL";
tError.functionName = "submitData";
tError.errorMessage = "数据提交失败!";
this.mErrors.addOneError(tError);
return false;
}
mInputData = null;
return true;
}
/**
* 根据前面的输入数据,进行BL逻辑处理
* 如果在处理过程中出错,则返回false,否则返回true
*/
private boolean dealData() {
if (this.mOperate.equals("INSERT||MAIN")) {
if (mLLStandPayInfoSet != null && mLLStandPayInfoSet.size() > 0) {
String SQL = "";
for (int i = 1; i <= mLLStandPayInfoSet.size(); i++) {
mLLStandPayInfoSet.get(i).setMakeDate(PubFun.getCurrentDate());
mLLStandPayInfoSet.get(i).setMakeTime(PubFun.getCurrentTime());
mLLStandPayInfoSet.get(i).setModifyDate(PubFun.getCurrentDate());
mLLStandPayInfoSet.get(i).setModifyTime(PubFun.getCurrentTime());
mLLStandPayInfoSet.get(i).setOperator(mGlobalInput.Operator);
mLLStandPayInfoSet.get(i).setManageCom(mGlobalInput.ManageCom);
//mLLStandPayInfoSet.get(i).setCurrency("01");//add liupeng by 20100908
//先删除原先的记录在从新写入
SQL = "delete from LLStandPayInfo where CaseNo = '" +
mLLStandPayInfoSet.get(i).getCaseNo()+ "'";
}
map.put(SQL, "DELETE");
map.put(mLLStandPayInfoSet, "INSERT");
}
}
if (this.mOperate.equals("UPDATE||MAIN")) {
if (mLLStandPayInfoSet != null && mLLStandPayInfoSet.size() > 0) {
for (int i = 1; i <= mLLStandPayInfoSet.size(); i++) {
mLLStandPayInfoSet.get(i).setMakeDate(PubFun.getCurrentDate());
mLLStandPayInfoSet.get(i).setMakeTime(PubFun.getCurrentTime());
mLLStandPayInfoSet.get(i).setModifyDate(PubFun.getCurrentDate());
mLLStandPayInfoSet.get(i).setModifyTime(PubFun.getCurrentTime());
mLLStandPayInfoSet.get(i).setOperator(mGlobalInput.Operator);
mLLStandPayInfoSet.get(i).setManageCom(mGlobalInput.ManageCom);
}
map.put(mLLStandPayInfoSet, "UPDATE");
}
}
return true;
}
/**
* 从输入数据中得到所有对象
*输出:如果没有得到足够的业务数据对象,则返回false,否则返回true
*/
private boolean getInputData(VData cInputData) {
this.mLLStandPayInfoSet.set((LLStandPayInfoSet) cInputData.getObjectByObjectName(
"LLStandPayInfoSet", 0));
for(int i=1;i<=mLLStandPayInfoSet.size();i++){
if(mLLStandPayInfoSet.get(i).getCaseNo() == null ||"".equals(mLLStandPayInfoSet.get(i).getCaseNo())){
CError.buildErr(this, "赔案号缺失,无法进行保存操作!");
return false;
}
}
this.mGlobalInput.setSchema((GlobalInput) cInputData.
getObjectByObjectName("GlobalInput", 0));
return true;
}
/**
* 准备往后层输出所需要的数据
* 输出:如果准备数据时发生错误则返回false,否则返回true
*/
private boolean prepareOutputData() {
try {
this.mInputData.clear();
this.mInputData.add(map);
mResult.clear();
mResult.add(this.mLLStandPayInfoSet);
} catch (Exception ex) {
// @@错误处理
CError tError = new CError();
tError.moduleName = "LLBnfBL";
tError.functionName = "prepareData";
tError.errorMessage = "在准备往后层处理所需要的数据时出错。";
this.mErrors.addOneError(tError);
return false;
}
return true;
}
public VData getResult() {
return this.mResult;
}
public CErrors getErrors() {
// TODO Auto-generated method stub
return mErrors;
}
}
|
UTF-8
|
Java
| 7,529 |
java
|
LLStandPayInfoBL.java
|
Java
|
[
{
"context": "ompany: testcompany </p>\n * @Database:\n * @Author:pd\n * @CreateDate:2005-11-1\n */\npackage com.sinosoft",
"end": 185,
"score": 0.9981549978256226,
"start": 183,
"tag": "USERNAME",
"value": "pd"
}
] | null |
[] |
/*
* <p>ClassName: LLStandPayInfoBL </p>
* <p>Description: LLStandPayInfoBL类文件 </p>
* <p>Copyright: Copyright (c) 2002</p>
* <p>Company: testcompany </p>
* @Database:
* @Author:pd
* @CreateDate:2005-11-1
*/
package com.sinosoft.lis.claimgrp;
import org.apache.log4j.Logger;
import com.sinosoft.lis.vschema.*;
import com.sinosoft.utility.*;
import com.sinosoft.lis.pubfun.*;
import com.sinosoft.service.BusinessService;
public class LLStandPayInfoBL implements BusinessService{
private static Logger logger = Logger.getLogger(LLStandPayInfoBL.class);
/** 错误处理类,每个需要错误处理的类中都放置该类 */
public CErrors mErrors = new CErrors();
private VData mResult = new VData();
/** 往后面传输数据的容器 */
private VData mInputData = new VData();
private MMap map = new MMap();
/** 全局数据 */
private GlobalInput mGlobalInput = new GlobalInput();
/** 数据操作字符串 */
private String mOperate;
/** 业务处理相关变量 */
private LLStandPayInfoSet mLLStandPayInfoSet = new LLStandPayInfoSet();
public LLStandPayInfoBL() {
}
public static void main(String[] args) {
}
/**
* 传输数据的公共方法
* @param: cInputData 输入的数据
* cOperate 数据操作
* @return:
*/
public boolean submitData(VData cInputData, String cOperate) {
//将操作数据拷贝到本类中
this.mOperate = cOperate;
//得到外部传入的数据,将数据备份到本类中
logger.debug("begin getinputdata");
if (!getInputData(cInputData)) {
// @@错误处理
CError tError = new CError();
tError.moduleName = "LLStandPayInfoBL";
tError.functionName = "submitData";
tError.errorMessage = "数据处理失败LLStandPayInfoBL-->getInputData!";
this.mErrors.addOneError(tError);
return false;
}
logger.debug(
"----------LLStandPayInfoBL after getInputData----------");
//进行业务处理
if (!dealData()) {
// @@错误处理
CError tError = new CError();
tError.moduleName = "LLStandPayInfoBL";
tError.functionName = "submitData";
tError.errorMessage = "数据处理失败LLStandPayInfoBL-->dealData!";
this.mErrors.addOneError(tError);
return false;
}
logger.debug(
"----------LLStandPayInfoBL after dealData----------");
//准备往后台的数据
if (!prepareOutputData()) {
// @@错误处理
CError tError = new CError();
tError.moduleName = "LLStandPayInfoBL";
tError.functionName = "submitData";
tError.errorMessage = "数据处理失败LLStandPayInfoBL-->submitquery!";
this.mErrors.addOneError(tError);
return false;
}
logger.debug(
"----------LLStandPayInfoBL after prepareOutputData----------");
PubSubmit tPubSubmit = new PubSubmit();
if (!tPubSubmit.submitData(mInputData, cOperate)) {
// @@错误处理
this.mErrors.copyAllErrors(tPubSubmit.mErrors);
CError tError = new CError();
tError.moduleName = "LLClaimRegisterDealBL";
tError.functionName = "submitData";
tError.errorMessage = "数据提交失败!";
this.mErrors.addOneError(tError);
return false;
}
mInputData = null;
return true;
}
/**
* 根据前面的输入数据,进行BL逻辑处理
* 如果在处理过程中出错,则返回false,否则返回true
*/
private boolean dealData() {
if (this.mOperate.equals("INSERT||MAIN")) {
if (mLLStandPayInfoSet != null && mLLStandPayInfoSet.size() > 0) {
String SQL = "";
for (int i = 1; i <= mLLStandPayInfoSet.size(); i++) {
mLLStandPayInfoSet.get(i).setMakeDate(PubFun.getCurrentDate());
mLLStandPayInfoSet.get(i).setMakeTime(PubFun.getCurrentTime());
mLLStandPayInfoSet.get(i).setModifyDate(PubFun.getCurrentDate());
mLLStandPayInfoSet.get(i).setModifyTime(PubFun.getCurrentTime());
mLLStandPayInfoSet.get(i).setOperator(mGlobalInput.Operator);
mLLStandPayInfoSet.get(i).setManageCom(mGlobalInput.ManageCom);
//mLLStandPayInfoSet.get(i).setCurrency("01");//add liupeng by 20100908
//先删除原先的记录在从新写入
SQL = "delete from LLStandPayInfo where CaseNo = '" +
mLLStandPayInfoSet.get(i).getCaseNo()+ "'";
}
map.put(SQL, "DELETE");
map.put(mLLStandPayInfoSet, "INSERT");
}
}
if (this.mOperate.equals("UPDATE||MAIN")) {
if (mLLStandPayInfoSet != null && mLLStandPayInfoSet.size() > 0) {
for (int i = 1; i <= mLLStandPayInfoSet.size(); i++) {
mLLStandPayInfoSet.get(i).setMakeDate(PubFun.getCurrentDate());
mLLStandPayInfoSet.get(i).setMakeTime(PubFun.getCurrentTime());
mLLStandPayInfoSet.get(i).setModifyDate(PubFun.getCurrentDate());
mLLStandPayInfoSet.get(i).setModifyTime(PubFun.getCurrentTime());
mLLStandPayInfoSet.get(i).setOperator(mGlobalInput.Operator);
mLLStandPayInfoSet.get(i).setManageCom(mGlobalInput.ManageCom);
}
map.put(mLLStandPayInfoSet, "UPDATE");
}
}
return true;
}
/**
* 从输入数据中得到所有对象
*输出:如果没有得到足够的业务数据对象,则返回false,否则返回true
*/
private boolean getInputData(VData cInputData) {
this.mLLStandPayInfoSet.set((LLStandPayInfoSet) cInputData.getObjectByObjectName(
"LLStandPayInfoSet", 0));
for(int i=1;i<=mLLStandPayInfoSet.size();i++){
if(mLLStandPayInfoSet.get(i).getCaseNo() == null ||"".equals(mLLStandPayInfoSet.get(i).getCaseNo())){
CError.buildErr(this, "赔案号缺失,无法进行保存操作!");
return false;
}
}
this.mGlobalInput.setSchema((GlobalInput) cInputData.
getObjectByObjectName("GlobalInput", 0));
return true;
}
/**
* 准备往后层输出所需要的数据
* 输出:如果准备数据时发生错误则返回false,否则返回true
*/
private boolean prepareOutputData() {
try {
this.mInputData.clear();
this.mInputData.add(map);
mResult.clear();
mResult.add(this.mLLStandPayInfoSet);
} catch (Exception ex) {
// @@错误处理
CError tError = new CError();
tError.moduleName = "LLBnfBL";
tError.functionName = "prepareData";
tError.errorMessage = "在准备往后层处理所需要的数据时出错。";
this.mErrors.addOneError(tError);
return false;
}
return true;
}
public VData getResult() {
return this.mResult;
}
public CErrors getErrors() {
// TODO Auto-generated method stub
return mErrors;
}
}
| 7,529 | 0.573229 | 0.569028 | 190 | 35.331577 | 25.208824 | 110 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.631579 | false | false |
9
|
988d085aa79381e00eaf7b0d62b8cf82e5615b98
| 14,972,256,055,867 |
0abbdfc69ef3fbf19291cca357eb4a55d08dfcdf
|
/ProgramCreekPractice/src/LongestSubstringLength.java
|
36ea706f12d9c02c382329c647e4c686f4d0ab2a
|
[] |
no_license
|
ojamvk/ProgramCreek-Practice
|
https://github.com/ojamvk/ProgramCreek-Practice
|
72d898c1265708a52a11459a275600c1c059d00d
|
d63c8cfda0703ca7e139f4381481391b46c941d1
|
refs/heads/master
| 2020-05-21T13:33:15.410000 | 2016-11-05T03:14:03 | 2016-11-05T03:14:03 | 64,574,861 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
import java.util.Hashtable;
public class LongestSubstringLength {
public static void main(String[] args) {
String inputString = "abcabcbbabcdefdfdf";
System.out.println(lengthOfLongestSubString(inputString));
}
private static int lengthOfLongestSubString(String inputString) {
char[] input = inputString.toCharArray();
int maxLength = 1;
Hashtable<Character, Integer> charsVisited = new Hashtable<Character, Integer>();
for(int i=0; i< input.length; i++) {
if(!charsVisited.containsKey(input[i])) {
charsVisited.put(input[i], i);
}
else {
i = charsVisited.get(input[i]);
maxLength = Math.max(maxLength, charsVisited.size());
charsVisited = new Hashtable<Character, Integer>();
}
}
return maxLength;
}
}
|
UTF-8
|
Java
| 774 |
java
|
LongestSubstringLength.java
|
Java
|
[] | null |
[] |
import java.util.Hashtable;
public class LongestSubstringLength {
public static void main(String[] args) {
String inputString = "abcabcbbabcdefdfdf";
System.out.println(lengthOfLongestSubString(inputString));
}
private static int lengthOfLongestSubString(String inputString) {
char[] input = inputString.toCharArray();
int maxLength = 1;
Hashtable<Character, Integer> charsVisited = new Hashtable<Character, Integer>();
for(int i=0; i< input.length; i++) {
if(!charsVisited.containsKey(input[i])) {
charsVisited.put(input[i], i);
}
else {
i = charsVisited.get(input[i]);
maxLength = Math.max(maxLength, charsVisited.size());
charsVisited = new Hashtable<Character, Integer>();
}
}
return maxLength;
}
}
| 774 | 0.689922 | 0.687339 | 31 | 23.967741 | 23.811741 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.774194 | false | false |
9
|
c5bc267d662f86c9de01fe0bed2b3b405c5f5b2c
| 15,350,213,179,964 |
4dc7c96fad98cef4e0b8791933e8200cc823d01c
|
/src/com/engine/Core/RenderingEngine.java
|
28f84778e21610e315d6e7b320dbb41f8d0bce06
|
[] |
no_license
|
alex-ta/RenderingEngine
|
https://github.com/alex-ta/RenderingEngine
|
764bbac91fbd3e279299e0a7b23613eaf842125f
|
e6352056369915a9c93747555fb23bbe1a6bc8d2
|
refs/heads/master
| 2020-04-05T23:16:23.168000 | 2015-06-06T19:51:25 | 2015-06-06T19:51:25 | 36,099,163 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.engine.Core;
import static org.lwjgl.opengl.GL11.*;
import java.util.LinkedList;
import com.engine.Components.Camera;
import com.engine.Components.Light;
import com.engine.Components.NormalLight;
import com.engine.Desing.Material;
import com.engine.Math.Vector3D;
import com.engine.Shaders.ForwardNormalLight;
import com.engine.Shaders.Shader;
public class RenderingEngine {
private Camera camera;
private Light activeLight;
private Light normlight;
// permanent Structures
private LinkedList<Light> lights;
public RenderingEngine(){
// clearcolor setzten (schwarz)
glClearColor(0.0f,0.0f,0.0f,0.0f);
// -> welches das frontface is
glFrontFace(GL_CW);
// sachen die wegzeigen nicht zeichnen
glCullFace(GL_BACK);
glEnable(GL_CULL_FACE);
glEnable(GL_DEPTH_TEST);
//glEnable(GL_DEPTH_CLAMP);
glEnable(GL_TEXTURE_2D);
System.out.println(getOGLVersion());
lights = new LinkedList<Light>();
normlight = NormalLight.getInstance(this);
}
public void render(Game game){
clearLights();
game.addToREngine(this);
game.render(normlight.getShader());
glEnable(GL_BLEND);
glBlendFunc(GL_ONE,GL_ONE);
glDepthMask(false);
glDepthFunc(GL_EQUAL);
for(Light l: lights){
this.activeLight = l;
game.render(l.getShader());
}
glDepthFunc(GL_LESS);
glDepthMask(true);
glDisable(GL_BLEND);
}
private static String getOGLVersion(){
return glGetString(GL_VERSION);
}
private static void setTextures(boolean value){
if(value)
glEnable(GL_TEXTURE_2D);
else
glDisable(GL_TEXTURE_2D);
}
private static void setClearColor(Vector3D color){
glClearColor(color.x,color.y,color.z,1.0f);
}
private static void unbindTextures(){
glBindTexture(GL_TEXTURE_2D,0);
}
public Camera getMainCamera() {
return camera;
}
public void setMainCamera(Camera camera) {
this.camera = camera;
}
public Light getLight() {
return activeLight;
}
public void addLight(Light light) {
this.lights.add(light);
}
public void addCamera(Camera camera) {
this.camera = camera;
}
private void clearLights(){
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
lights.clear();
}
public Light getNormalLight() {
return normlight;
}
}
|
UTF-8
|
Java
| 2,277 |
java
|
RenderingEngine.java
|
Java
|
[] | null |
[] |
package com.engine.Core;
import static org.lwjgl.opengl.GL11.*;
import java.util.LinkedList;
import com.engine.Components.Camera;
import com.engine.Components.Light;
import com.engine.Components.NormalLight;
import com.engine.Desing.Material;
import com.engine.Math.Vector3D;
import com.engine.Shaders.ForwardNormalLight;
import com.engine.Shaders.Shader;
public class RenderingEngine {
private Camera camera;
private Light activeLight;
private Light normlight;
// permanent Structures
private LinkedList<Light> lights;
public RenderingEngine(){
// clearcolor setzten (schwarz)
glClearColor(0.0f,0.0f,0.0f,0.0f);
// -> welches das frontface is
glFrontFace(GL_CW);
// sachen die wegzeigen nicht zeichnen
glCullFace(GL_BACK);
glEnable(GL_CULL_FACE);
glEnable(GL_DEPTH_TEST);
//glEnable(GL_DEPTH_CLAMP);
glEnable(GL_TEXTURE_2D);
System.out.println(getOGLVersion());
lights = new LinkedList<Light>();
normlight = NormalLight.getInstance(this);
}
public void render(Game game){
clearLights();
game.addToREngine(this);
game.render(normlight.getShader());
glEnable(GL_BLEND);
glBlendFunc(GL_ONE,GL_ONE);
glDepthMask(false);
glDepthFunc(GL_EQUAL);
for(Light l: lights){
this.activeLight = l;
game.render(l.getShader());
}
glDepthFunc(GL_LESS);
glDepthMask(true);
glDisable(GL_BLEND);
}
private static String getOGLVersion(){
return glGetString(GL_VERSION);
}
private static void setTextures(boolean value){
if(value)
glEnable(GL_TEXTURE_2D);
else
glDisable(GL_TEXTURE_2D);
}
private static void setClearColor(Vector3D color){
glClearColor(color.x,color.y,color.z,1.0f);
}
private static void unbindTextures(){
glBindTexture(GL_TEXTURE_2D,0);
}
public Camera getMainCamera() {
return camera;
}
public void setMainCamera(Camera camera) {
this.camera = camera;
}
public Light getLight() {
return activeLight;
}
public void addLight(Light light) {
this.lights.add(light);
}
public void addCamera(Camera camera) {
this.camera = camera;
}
private void clearLights(){
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
lights.clear();
}
public Light getNormalLight() {
return normlight;
}
}
| 2,277 | 0.706192 | 0.697848 | 114 | 18.973684 | 15.752728 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.008772 | false | false |
9
|
05fc44b606266602a5a1318fd8af64b41d305688
| 24,678,882,129,341 |
ae831be360123d053cca75cdc667f213470dc3ef
|
/src/com/jconnolly/chapter5/Exercise5_16.java
|
30be7260153e1ccf6f14455f40145ec36cbb3e43
|
[] |
no_license
|
Schonge/Introduction-To-Java-Programming
|
https://github.com/Schonge/Introduction-To-Java-Programming
|
07e224643ebec5c68176dd920ed4af5033e9371f
|
62848eafe69e60af730326d4d3d4bb1db4928f11
|
refs/heads/master
| 2021-06-25T12:37:57.654000 | 2020-10-21T02:21:54 | 2020-10-21T02:21:54 | 134,127,493 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.jconnolly.chapter5;
import java.util.Scanner;
/**
* Number of days in a month.
* @author jconnolly
*
*/
public class Exercise5_16 {
public static void main(String[] args) {
@SuppressWarnings("resource")
Scanner input = new Scanner(System.in);
int month = 0;
while(month < 1 || month > 12) {
System.out.print("Enter a month (January = 1): ");
month = input.nextInt();
}
switch(month) {
case 1:
System.out.println("January has " + daysInMonth(month) + " days.");
break;
case 2:
System.out.println("February has " + daysInMonth(month) + " days.");
break;
case 3:
System.out.println("March has " + daysInMonth(month) + " days.");
break;
case 4:
System.out.println("April has " + daysInMonth(month) + " days.");
break;
case 5:
System.out.println("May has " + daysInMonth(month) + " days.");
break;
case 6:
System.out.println("June has " + daysInMonth(month) + " days.");
break;
case 7:
System.out.println("July has " + daysInMonth(month) + " days.");
break;
case 8:
System.out.println("August has " + daysInMonth(month) + " days.");
break;
case 9:
System.out.println("September has " + daysInMonth(month) + " days.");
break;
case 10:
System.out.println("October has " + daysInMonth(month) + " days.");
break;
case 11:
System.out.println("November has " + daysInMonth(month) + " days.");
break;
case 12:
System.out.println("December has " + daysInMonth(month) + " days.");
break;
}
}
public static int daysInMonth(int month) {
int days = 0;
if(month == 4 || month == 6 || month == 9 || month == 11) {
days = 30;
} else if(month == 2) { // Ignoring leap years as per exercise instructions
days = 28;
} else {
days = 31;
}
return days;
}
}
|
UTF-8
|
Java
| 1,850 |
java
|
Exercise5_16.java
|
Java
|
[
{
"context": "ner;\n\n/**\n * Number of days in a month.\n * @author jconnolly\n *\n */\n\npublic class Exercise5_16 {\n\n\tpublic stat",
"end": 114,
"score": 0.9982640147209167,
"start": 105,
"tag": "USERNAME",
"value": "jconnolly"
}
] | null |
[] |
package com.jconnolly.chapter5;
import java.util.Scanner;
/**
* Number of days in a month.
* @author jconnolly
*
*/
public class Exercise5_16 {
public static void main(String[] args) {
@SuppressWarnings("resource")
Scanner input = new Scanner(System.in);
int month = 0;
while(month < 1 || month > 12) {
System.out.print("Enter a month (January = 1): ");
month = input.nextInt();
}
switch(month) {
case 1:
System.out.println("January has " + daysInMonth(month) + " days.");
break;
case 2:
System.out.println("February has " + daysInMonth(month) + " days.");
break;
case 3:
System.out.println("March has " + daysInMonth(month) + " days.");
break;
case 4:
System.out.println("April has " + daysInMonth(month) + " days.");
break;
case 5:
System.out.println("May has " + daysInMonth(month) + " days.");
break;
case 6:
System.out.println("June has " + daysInMonth(month) + " days.");
break;
case 7:
System.out.println("July has " + daysInMonth(month) + " days.");
break;
case 8:
System.out.println("August has " + daysInMonth(month) + " days.");
break;
case 9:
System.out.println("September has " + daysInMonth(month) + " days.");
break;
case 10:
System.out.println("October has " + daysInMonth(month) + " days.");
break;
case 11:
System.out.println("November has " + daysInMonth(month) + " days.");
break;
case 12:
System.out.println("December has " + daysInMonth(month) + " days.");
break;
}
}
public static int daysInMonth(int month) {
int days = 0;
if(month == 4 || month == 6 || month == 9 || month == 11) {
days = 30;
} else if(month == 2) { // Ignoring leap years as per exercise instructions
days = 28;
} else {
days = 31;
}
return days;
}
}
| 1,850 | 0.592973 | 0.572973 | 79 | 22.417721 | 24.549412 | 77 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.949367 | false | false |
9
|
ced3fec47fa52823135352d7281446ee223ad1db
| 24,137,716,242,893 |
a7a995daea30dd036671feb817a69f8a7bdc915a
|
/src/main/java/com/platzi/platziprofesores/service/SocialMediaServiceImpl.java
|
1da3fc73da4e65035b809d642bb79ff08e450968
|
[] |
no_license
|
daespuor/platziprofesores-api
|
https://github.com/daespuor/platziprofesores-api
|
a5bc5a4e1f8a9957f05e221388fce6c6078a5c9b
|
c8734fe150fb147792f607d71ff33d7d566c9eb7
|
refs/heads/master
| 2020-04-19T01:48:46.978000 | 2019-01-27T19:01:40 | 2019-01-27T19:01:40 | 167,882,953 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.platzi.platziprofesores.service;
import java.util.List;
import javax.transaction.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.platzi.platziprofesores.dao.SocialMediaDAO;
import com.platzi.platziprofesores.model.SocialMedia;
import com.platzi.platziprofesores.model.TeacherSocialMedia;
@Service("socialMediaService")
@Transactional
public class SocialMediaServiceImpl implements SocialMediaService{
@Autowired
private SocialMediaDAO _socialMediaDAO;
@Override
public void create(SocialMedia socialMedia) {
// TODO Auto-generated method stub
_socialMediaDAO.create(socialMedia);
}
@Override
public List<SocialMedia> findAll() {
// TODO Auto-generated method stub
return _socialMediaDAO.findAll();
}
@Override
public void update(SocialMedia socialMedia) {
// TODO Auto-generated method stub
_socialMediaDAO.update(socialMedia);
}
@Override
public void delete(Long idSocialMedia) {
// TODO Auto-generated method stub
_socialMediaDAO.delete(idSocialMedia);
}
@Override
public SocialMedia findByName(String name) {
// TODO Auto-generated method stub
return _socialMediaDAO.findByName(name);
}
@Override
public SocialMedia findById(Long idSocialMedia) {
// TODO Auto-generated method stub
return _socialMediaDAO.findById(idSocialMedia);
}
@Override
public TeacherSocialMedia findTeacherSocialMediaByIdAndName(Long idSocialMedia, String nickname) {
// TODO Auto-generated method stub
return _socialMediaDAO.findTeacherSocialMediaByIdAndName(idSocialMedia, nickname);
}
}
|
UTF-8
|
Java
| 1,631 |
java
|
SocialMediaServiceImpl.java
|
Java
|
[] | null |
[] |
package com.platzi.platziprofesores.service;
import java.util.List;
import javax.transaction.Transactional;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.platzi.platziprofesores.dao.SocialMediaDAO;
import com.platzi.platziprofesores.model.SocialMedia;
import com.platzi.platziprofesores.model.TeacherSocialMedia;
@Service("socialMediaService")
@Transactional
public class SocialMediaServiceImpl implements SocialMediaService{
@Autowired
private SocialMediaDAO _socialMediaDAO;
@Override
public void create(SocialMedia socialMedia) {
// TODO Auto-generated method stub
_socialMediaDAO.create(socialMedia);
}
@Override
public List<SocialMedia> findAll() {
// TODO Auto-generated method stub
return _socialMediaDAO.findAll();
}
@Override
public void update(SocialMedia socialMedia) {
// TODO Auto-generated method stub
_socialMediaDAO.update(socialMedia);
}
@Override
public void delete(Long idSocialMedia) {
// TODO Auto-generated method stub
_socialMediaDAO.delete(idSocialMedia);
}
@Override
public SocialMedia findByName(String name) {
// TODO Auto-generated method stub
return _socialMediaDAO.findByName(name);
}
@Override
public SocialMedia findById(Long idSocialMedia) {
// TODO Auto-generated method stub
return _socialMediaDAO.findById(idSocialMedia);
}
@Override
public TeacherSocialMedia findTeacherSocialMediaByIdAndName(Long idSocialMedia, String nickname) {
// TODO Auto-generated method stub
return _socialMediaDAO.findTeacherSocialMediaByIdAndName(idSocialMedia, nickname);
}
}
| 1,631 | 0.797057 | 0.797057 | 62 | 25.306452 | 23.772163 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.129032 | false | false |
9
|
d42aa7319cf3a733fc092fdf8d79238144254d56
| 19,920,058,364,408 |
ba99ac3e32a720fb6db63ca08022c390c1a71bc9
|
/src/java/servlet/artigos/ArtigosListar.java
|
739161018ece393d6730823a0a26e5513d3c441a
|
[] |
no_license
|
jeancx/JavaCMS_REST_Angular
|
https://github.com/jeancx/JavaCMS_REST_Angular
|
0516f66a8d9d6bbb24f9c9aa5ee35e6cdb92bbeb
|
fc8f2b3a2a65b460f6db716e8136510425d6de8a
|
refs/heads/master
| 2020-06-02T22:22:25.820000 | 2015-07-08T20:22:20 | 2015-07-08T20:22:20 | 38,777,664 | 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 servlet.artigos;
import dao.ArtigoJpaController;
import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import models.Artigo;
/**
*
* @author Jean
*/
@WebServlet(name = "Artigos", urlPatterns = {"/admin/artigos"})
public class ArtigosListar extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
ArtigoJpaController dao = new ArtigoJpaController();
List<Artigo> artigos = dao.findArtigoEntities();
req.setAttribute("artigos", artigos);
req.getRequestDispatcher("/backend/pages/artigos/listar.jsp").forward(req, resp);
}
}
|
UTF-8
|
Java
| 1,082 |
java
|
ArtigosListar.java
|
Java
|
[
{
"context": "Response;\nimport models.Artigo;\n\n/**\n *\n * @author Jean\n */\n@WebServlet(name = \"Artigos\", urlPatterns = {",
"end": 554,
"score": 0.9496471881866455,
"start": 550,
"tag": "NAME",
"value": "Jean"
}
] | 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 servlet.artigos;
import dao.ArtigoJpaController;
import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import models.Artigo;
/**
*
* @author Jean
*/
@WebServlet(name = "Artigos", urlPatterns = {"/admin/artigos"})
public class ArtigosListar extends HttpServlet {
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
ArtigoJpaController dao = new ArtigoJpaController();
List<Artigo> artigos = dao.findArtigoEntities();
req.setAttribute("artigos", artigos);
req.getRequestDispatcher("/backend/pages/artigos/listar.jsp").forward(req, resp);
}
}
| 1,082 | 0.744917 | 0.744917 | 35 | 29.914286 | 28.317961 | 113 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.628571 | false | false |
9
|
11d5fd227fed213dacc9cf284d7f1f84b51e085b
| 31,679,678,832,609 |
6be39fc2c882d0b9269f1530e0650fd3717df493
|
/weixin反编译/sources/c/t/m/g/s.java
|
46d79a6811cab67bd48fd2918cb67777325e1fc4
|
[] |
no_license
|
sir-deng/res
|
https://github.com/sir-deng/res
|
f1819af90b366e8326bf23d1b2f1074dfe33848f
|
3cf9b044e1f4744350e5e89648d27247c9dc9877
|
refs/heads/master
| 2022-06-11T21:54:36.725000 | 2020-05-07T06:03:23 | 2020-05-07T06:03:23 | 155,177,067 | 5 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package c.t.m.g;
public interface s {
r a(String str);
}
|
UTF-8
|
Java
| 62 |
java
|
s.java
|
Java
|
[] | null |
[] |
package c.t.m.g;
public interface s {
r a(String str);
}
| 62 | 0.612903 | 0.612903 | 5 | 11.4 | 9.024411 | 20 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false |
9
|
36854a1e1e92049944159cc628b13a05ad572876
| 22,986,665,035,551 |
40c27ac7f94d256cc3e99fa951526b78b50796d7
|
/src/tetris/TetrisGraphic.java
|
91f41ba53a2da0c35afebdbaa157fe3a2a48215c
|
[] |
no_license
|
littlepig2013/tetris
|
https://github.com/littlepig2013/tetris
|
cdaa2eeb6939aa896dd13f9591fe900ea4d90836
|
61ea18871b2bfe80ab2b668bb7d527aba5c72eeb
|
refs/heads/master
| 2019-08-27T12:46:27.383000 | 2016-04-14T06:45:05 | 2016-04-14T06:45:05 | 56,213,779 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package tetris;
import java.io.File;
import java.io.FileNotFoundException;
import java.net.URL;
import java.applet.Applet;
import java.applet.AudioClip;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class TetrisGraphic extends JPanel{
int width, height;
int widthGrids, heightGrids;
int gridWidth,gridHeight;
int score, level;
int [][] grid;
int [][] nextgrid;
String audioPath;
JFrame mainFrame;
JFrame tetrisFrame;
JLabel scoreText, levelText;
GameJPanel gameJPanel, nextPic;
Logic logic;
AudioClip music;
public TetrisGraphic(int width, int height, int widthGrids, int heightGrids, JFrame mainFrame, String audioPath){
this.mainFrame = mainFrame;
this.width = width;
this.height = height;
this.widthGrids = widthGrids;
this.heightGrids = heightGrids;
this.audioPath = audioPath;
grid = new int[heightGrids][widthGrids];
for(int i = 0; i < widthGrids; i++){
for(int j = 0; j < heightGrids; j++){
grid[j][i] = 0;
}
}
nextgrid = new int[4][4];
for(int i = 0; i < 4; i++){
for(int j = 0; j < 4; j++){
nextgrid[i][j] = 0;
}
}
this.gridWidth = (width - 200)/widthGrids;
this.gridHeight = (height - 40)/heightGrids;
score = 0;
level = 5;
}
public void init(){
initFrame();
gameJPanel = new GameJPanel(0, 0, gridWidth, gridHeight,
widthGrids, heightGrids, grid);
JPanel infoJPanel = new JPanel();
gameJPanel.setLayout(null);
gameJPanel.setBounds(0, 0, (width - 190), (height - 30));
infoJPanel.setLayout(new BoxLayout(infoJPanel, BoxLayout.Y_AXIS));
infoJPanel.setBounds(width-200, 0, 200, (height-40));
initInfo(infoJPanel);
this.add(gameJPanel);
this.add(infoJPanel);
initAudio();
tetrisFrame.setVisible(true);
}
public void initAudio(){
URL musicURL = null;
File musicFile;
try{
musicFile = new File(audioPath);
musicURL = musicFile.toURI().toURL();
music = Applet.newAudioClip(musicURL);
music.loop();
}catch(Exception e){
e.printStackTrace();
}
}
public void initFrame(){
//set frame
tetrisFrame = new JFrame();
tetrisFrame.setTitle("Tetris");
tetrisFrame.setSize(width, height);
tetrisFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setOpaque(false);
this.setLayout(null);
tetrisFrame.setContentPane(this);
}
public void initInfo(JPanel infoJPanel){
JPanel nextJPanel = new JPanel(new BorderLayout());
initNext(nextJPanel);
infoJPanel.add(nextJPanel);
JPanel scoreJPanel = new JPanel(new BorderLayout());
initScore(scoreJPanel);
infoJPanel.add(scoreJPanel);
JPanel buttonJPanel = new JPanel();
buttonJPanel.setLayout(new BoxLayout(buttonJPanel, BoxLayout.Y_AXIS));
initButton(buttonJPanel);
infoJPanel.add(buttonJPanel);
}
public void initNext(JPanel nextJPanel){
JPanel textJPanel = new JPanel(new FlowLayout());
JLabel text= new JLabel("下一个方块");
textJPanel.add(text);
nextPic = new GameJPanel(30, 0, gridWidth, gridHeight,
4, 4, nextgrid);
nextJPanel.add("North", textJPanel);
nextJPanel.add("Center", nextPic);
}
public void initScore(JPanel scoreJPanel){
JPanel textJPanel = new JPanel(new FlowLayout());
JLabel scoreWord = new JLabel("得分:");
scoreText = new JLabel(String.valueOf(score));
textJPanel.add(scoreWord);
textJPanel.add(scoreText);
scoreJPanel.add("Center", textJPanel);
}
public void initButton(JPanel buttonJPanel){
JLabel gameText = new JLabel("游戏 :");
JButton goOnButton = new JButton("继续");
goOnButton.setFocusable(false);
goOnButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
logic.setPauseFlag(false);
}
});
JButton pauseButton = new JButton("暂停");
pauseButton.setFocusable(false);
pauseButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
logic.setPauseFlag(true);
}
});
JLabel musicText = new JLabel("音乐 :");
JButton startMusicButton = new JButton("开始");
startMusicButton.setFocusable(false);
startMusicButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
music.loop();
}
});
JButton stopMusicButton = new JButton("停止");
stopMusicButton.setFocusable(false);
stopMusicButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
music.stop();
}
});
JButton increaseButton = new JButton("+");
increaseButton.setFocusable(false);
increaseButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
logic.setInterval(-100);
if(level >= 10){
return;
}
level += 1;
levelText.setText(level + "");
}
});
JButton decreaseButton = new JButton("-");
decreaseButton.setFocusable(false);
decreaseButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
logic.setInterval(100);
if(level <= 0){
return;
}
level -= 1;
levelText.setText(level + "");
}
});
JLabel levelDecri = new JLabel("level : ");
levelText = new JLabel("5");
JButton giveUpButton = new JButton("认输");
giveUpButton.setFocusable(false);
giveUpButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
logic.setPauseFlag(true);
logic.lose();
}
});
JButton exitButton = new JButton("退出");
exitButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
music.stop();
tetrisFrame.dispose();
mainFrame.setVisible(true);
}
});
JPanel pausePanel = new JPanel(new FlowLayout());
pausePanel.add(gameText);
pausePanel.add(goOnButton);
pausePanel.add(pauseButton);
JPanel musicPanel = new JPanel(new FlowLayout());
musicPanel.add(musicText);
musicPanel.add(startMusicButton);
musicPanel.add(stopMusicButton);
JPanel ratePanel = new JPanel(new FlowLayout());
ratePanel.add(increaseButton);
ratePanel.add(decreaseButton);
JPanel levelJPanel = new JPanel(new FlowLayout());
levelJPanel.add(levelDecri);
levelJPanel.add(levelText);
JPanel exitPanel = new JPanel(new FlowLayout());
exitPanel.add(giveUpButton);
exitPanel.add(exitButton);
buttonJPanel.add(levelJPanel);
buttonJPanel.add(ratePanel);
buttonJPanel.add(pausePanel);
buttonJPanel.add(musicPanel);
buttonJPanel.add(exitPanel);
}
public void setLogic(Logic logic){
this.logic = logic;
this.tetrisFrame.addKeyListener(new myListner(logic));
this.tetrisFrame.requestFocus();
}
public void updateScore(String score){
scoreText.setText(score);
repaint();
}
}
class GameJPanel extends JPanel{
int startX, startY;
int widthGrids, heightGrids;
int gridWidth, gridHeight;
int width, height;
int [][]grid;
Color[] colorSelect;
public GameJPanel(int startX, int startY, int gridWidth, int gridHeight,
int widthGrids, int heightGrids, int[][] grid) {
super();
this.startX = startX;
this.startY = startY;
this.widthGrids = widthGrids;
this.heightGrids = heightGrids;
this.gridWidth = gridWidth;
this.gridHeight = gridHeight;
this.grid = grid;
this.width = widthGrids*gridWidth;
this.height = heightGrids*gridHeight;
setColorSelect();
}
private void setColorSelect(){
colorSelect = new Color[7];
colorSelect[0] = Color.white;
colorSelect[1] = Color.blue;
colorSelect[2] = Color.red;
colorSelect[3] = Color.green;
colorSelect[4] = Color.yellow;
colorSelect[5] = Color.gray;
colorSelect[6] = Color.orange;
}
@Override
public void paint(Graphics g) {
super.paint(g);
for(int i = 0;i < widthGrids; i++){
for(int j = 0; j < heightGrids; j++){
g.setColor(colorSelect[grid[j][i]]);
g.fillRect(startX + i*gridWidth, startY + j*gridHeight, gridWidth, gridHeight);
}
}
for(int i = 0; i <= widthGrids; i++){
g.setColor(Color.black);
g.drawLine(startX + i*gridWidth, startY, startX + i*gridWidth, startY + height);
}
for(int i = 0; i <= heightGrids; i++){
g.setColor(Color.black);
g.drawLine(startX, startY + i*gridHeight, startX + width, startY + i*gridHeight);
}
}
}
class myListner implements KeyListener{
Logic logic;
public myListner(Logic logic) {
this.logic = logic;
}
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyReleased(KeyEvent e) {
}
@Override
public void keyPressed(KeyEvent e) {
if(e.getKeyCode() == KeyEvent.VK_DOWN){
logic.down();
}
else if(e.getKeyCode() == KeyEvent.VK_LEFT){
logic.left();
}
else if(e.getKeyCode() == KeyEvent.VK_RIGHT){
logic.right();
}
else if(e.getKeyCode() == KeyEvent.VK_SPACE){
logic.changeGraphic();
}
}
}
|
GB18030
|
Java
| 9,128 |
java
|
TetrisGraphic.java
|
Java
|
[] | null |
[] |
package tetris;
import java.io.File;
import java.io.FileNotFoundException;
import java.net.URL;
import java.applet.Applet;
import java.applet.AudioClip;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
public class TetrisGraphic extends JPanel{
int width, height;
int widthGrids, heightGrids;
int gridWidth,gridHeight;
int score, level;
int [][] grid;
int [][] nextgrid;
String audioPath;
JFrame mainFrame;
JFrame tetrisFrame;
JLabel scoreText, levelText;
GameJPanel gameJPanel, nextPic;
Logic logic;
AudioClip music;
public TetrisGraphic(int width, int height, int widthGrids, int heightGrids, JFrame mainFrame, String audioPath){
this.mainFrame = mainFrame;
this.width = width;
this.height = height;
this.widthGrids = widthGrids;
this.heightGrids = heightGrids;
this.audioPath = audioPath;
grid = new int[heightGrids][widthGrids];
for(int i = 0; i < widthGrids; i++){
for(int j = 0; j < heightGrids; j++){
grid[j][i] = 0;
}
}
nextgrid = new int[4][4];
for(int i = 0; i < 4; i++){
for(int j = 0; j < 4; j++){
nextgrid[i][j] = 0;
}
}
this.gridWidth = (width - 200)/widthGrids;
this.gridHeight = (height - 40)/heightGrids;
score = 0;
level = 5;
}
public void init(){
initFrame();
gameJPanel = new GameJPanel(0, 0, gridWidth, gridHeight,
widthGrids, heightGrids, grid);
JPanel infoJPanel = new JPanel();
gameJPanel.setLayout(null);
gameJPanel.setBounds(0, 0, (width - 190), (height - 30));
infoJPanel.setLayout(new BoxLayout(infoJPanel, BoxLayout.Y_AXIS));
infoJPanel.setBounds(width-200, 0, 200, (height-40));
initInfo(infoJPanel);
this.add(gameJPanel);
this.add(infoJPanel);
initAudio();
tetrisFrame.setVisible(true);
}
public void initAudio(){
URL musicURL = null;
File musicFile;
try{
musicFile = new File(audioPath);
musicURL = musicFile.toURI().toURL();
music = Applet.newAudioClip(musicURL);
music.loop();
}catch(Exception e){
e.printStackTrace();
}
}
public void initFrame(){
//set frame
tetrisFrame = new JFrame();
tetrisFrame.setTitle("Tetris");
tetrisFrame.setSize(width, height);
tetrisFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setOpaque(false);
this.setLayout(null);
tetrisFrame.setContentPane(this);
}
public void initInfo(JPanel infoJPanel){
JPanel nextJPanel = new JPanel(new BorderLayout());
initNext(nextJPanel);
infoJPanel.add(nextJPanel);
JPanel scoreJPanel = new JPanel(new BorderLayout());
initScore(scoreJPanel);
infoJPanel.add(scoreJPanel);
JPanel buttonJPanel = new JPanel();
buttonJPanel.setLayout(new BoxLayout(buttonJPanel, BoxLayout.Y_AXIS));
initButton(buttonJPanel);
infoJPanel.add(buttonJPanel);
}
public void initNext(JPanel nextJPanel){
JPanel textJPanel = new JPanel(new FlowLayout());
JLabel text= new JLabel("下一个方块");
textJPanel.add(text);
nextPic = new GameJPanel(30, 0, gridWidth, gridHeight,
4, 4, nextgrid);
nextJPanel.add("North", textJPanel);
nextJPanel.add("Center", nextPic);
}
public void initScore(JPanel scoreJPanel){
JPanel textJPanel = new JPanel(new FlowLayout());
JLabel scoreWord = new JLabel("得分:");
scoreText = new JLabel(String.valueOf(score));
textJPanel.add(scoreWord);
textJPanel.add(scoreText);
scoreJPanel.add("Center", textJPanel);
}
public void initButton(JPanel buttonJPanel){
JLabel gameText = new JLabel("游戏 :");
JButton goOnButton = new JButton("继续");
goOnButton.setFocusable(false);
goOnButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
logic.setPauseFlag(false);
}
});
JButton pauseButton = new JButton("暂停");
pauseButton.setFocusable(false);
pauseButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
logic.setPauseFlag(true);
}
});
JLabel musicText = new JLabel("音乐 :");
JButton startMusicButton = new JButton("开始");
startMusicButton.setFocusable(false);
startMusicButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
music.loop();
}
});
JButton stopMusicButton = new JButton("停止");
stopMusicButton.setFocusable(false);
stopMusicButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
music.stop();
}
});
JButton increaseButton = new JButton("+");
increaseButton.setFocusable(false);
increaseButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
logic.setInterval(-100);
if(level >= 10){
return;
}
level += 1;
levelText.setText(level + "");
}
});
JButton decreaseButton = new JButton("-");
decreaseButton.setFocusable(false);
decreaseButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
logic.setInterval(100);
if(level <= 0){
return;
}
level -= 1;
levelText.setText(level + "");
}
});
JLabel levelDecri = new JLabel("level : ");
levelText = new JLabel("5");
JButton giveUpButton = new JButton("认输");
giveUpButton.setFocusable(false);
giveUpButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
logic.setPauseFlag(true);
logic.lose();
}
});
JButton exitButton = new JButton("退出");
exitButton.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
music.stop();
tetrisFrame.dispose();
mainFrame.setVisible(true);
}
});
JPanel pausePanel = new JPanel(new FlowLayout());
pausePanel.add(gameText);
pausePanel.add(goOnButton);
pausePanel.add(pauseButton);
JPanel musicPanel = new JPanel(new FlowLayout());
musicPanel.add(musicText);
musicPanel.add(startMusicButton);
musicPanel.add(stopMusicButton);
JPanel ratePanel = new JPanel(new FlowLayout());
ratePanel.add(increaseButton);
ratePanel.add(decreaseButton);
JPanel levelJPanel = new JPanel(new FlowLayout());
levelJPanel.add(levelDecri);
levelJPanel.add(levelText);
JPanel exitPanel = new JPanel(new FlowLayout());
exitPanel.add(giveUpButton);
exitPanel.add(exitButton);
buttonJPanel.add(levelJPanel);
buttonJPanel.add(ratePanel);
buttonJPanel.add(pausePanel);
buttonJPanel.add(musicPanel);
buttonJPanel.add(exitPanel);
}
public void setLogic(Logic logic){
this.logic = logic;
this.tetrisFrame.addKeyListener(new myListner(logic));
this.tetrisFrame.requestFocus();
}
public void updateScore(String score){
scoreText.setText(score);
repaint();
}
}
class GameJPanel extends JPanel{
int startX, startY;
int widthGrids, heightGrids;
int gridWidth, gridHeight;
int width, height;
int [][]grid;
Color[] colorSelect;
public GameJPanel(int startX, int startY, int gridWidth, int gridHeight,
int widthGrids, int heightGrids, int[][] grid) {
super();
this.startX = startX;
this.startY = startY;
this.widthGrids = widthGrids;
this.heightGrids = heightGrids;
this.gridWidth = gridWidth;
this.gridHeight = gridHeight;
this.grid = grid;
this.width = widthGrids*gridWidth;
this.height = heightGrids*gridHeight;
setColorSelect();
}
private void setColorSelect(){
colorSelect = new Color[7];
colorSelect[0] = Color.white;
colorSelect[1] = Color.blue;
colorSelect[2] = Color.red;
colorSelect[3] = Color.green;
colorSelect[4] = Color.yellow;
colorSelect[5] = Color.gray;
colorSelect[6] = Color.orange;
}
@Override
public void paint(Graphics g) {
super.paint(g);
for(int i = 0;i < widthGrids; i++){
for(int j = 0; j < heightGrids; j++){
g.setColor(colorSelect[grid[j][i]]);
g.fillRect(startX + i*gridWidth, startY + j*gridHeight, gridWidth, gridHeight);
}
}
for(int i = 0; i <= widthGrids; i++){
g.setColor(Color.black);
g.drawLine(startX + i*gridWidth, startY, startX + i*gridWidth, startY + height);
}
for(int i = 0; i <= heightGrids; i++){
g.setColor(Color.black);
g.drawLine(startX, startY + i*gridHeight, startX + width, startY + i*gridHeight);
}
}
}
class myListner implements KeyListener{
Logic logic;
public myListner(Logic logic) {
this.logic = logic;
}
@Override
public void keyTyped(KeyEvent e) {
}
@Override
public void keyReleased(KeyEvent e) {
}
@Override
public void keyPressed(KeyEvent e) {
if(e.getKeyCode() == KeyEvent.VK_DOWN){
logic.down();
}
else if(e.getKeyCode() == KeyEvent.VK_LEFT){
logic.left();
}
else if(e.getKeyCode() == KeyEvent.VK_RIGHT){
logic.right();
}
else if(e.getKeyCode() == KeyEvent.VK_SPACE){
logic.changeGraphic();
}
}
}
| 9,128 | 0.700507 | 0.69346 | 336 | 26.032738 | 17.979042 | 114 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.761905 | false | false |
9
|
dbaebaa0cceccc6413a08a6385db2ea3cf1f43ea
| 7,988,639,235,023 |
a14c2195a2649f6861fef7662ce3163fb5db2c2d
|
/apps/apps-book/Java8TheCompleteReference/intro/src/org/gamegogo/TheCollectionsFramework/HashMapDemo.java
|
6bf288b638c56b7d80f10f46889fe085ffee2651
|
[
"Apache-2.0"
] |
permissive
|
reyou/Ggg.Java
|
https://github.com/reyou/Ggg.Java
|
80ce25571c656861ffe1e23c5a2c5763c704a85c
|
952f86b8ad24e6c43e3c9246c08b557051f6f51a
|
refs/heads/master
| 2022-02-08T11:48:03.777000 | 2022-01-27T16:51:48 | 2022-01-27T16:51:48 | 134,283,720 | 0 | 0 |
Apache-2.0
| false | 2021-01-14T20:07:49 | 2018-05-21T14:55:05 | 2019-07-23T19:54:58 | 2021-01-14T20:07:48 | 10,848 | 0 | 0 | 1 |
Java
| false | false |
package org.gamegogo.TheCollectionsFramework;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
class HashMapDemo {
public static void main(String args[]) {
// Create a hash map.
/*Hash table based implementation of the Map interface.
This implementation provides all of the optional map operations, and permits null
values and the null key. (The HashMap class is roughly equivalent to Hashtable,
except that it is unsynchronized and permits nulls.)
This class makes no guarantees as to the order of the map; in particular,
it does not guarantee that the order will remain constant over time.*/
HashMap<String, Double> hm = new HashMap<>();
// Put elements to the map
/*Associates the specified value with the specified key in this map.
If the map previously contained a mapping for the key, the old value
is replaced.*/
hm.put("John Doe", new Double(3434.34));
hm.put("Tom Smith", new Double(123.22));
hm.put("Jane Baker", new Double(1378.00));
hm.put("Tod Hall", new Double(99.22));
hm.put("Ralph Smith", new Double(-19.08));
// Get a set of the entries.
/*A collection that contains no duplicate elements. More formally, sets
contain no pair of elements e1 and e2 such that e1.equals(e2), and at
most one null element. As implied by its name, this interface models the
mathematical set abstraction.*/
/*entrySet(): Returns a Set view of the mappings contained in this map.*/
Set<Map.Entry<String, Double>> set = hm.entrySet();
// Display the set.
for (Map.Entry<String, Double> me : set) {
System.out.print(me.getKey() + ": ");
System.out.println(me.getValue());
}
System.out.println();
// Deposit 1000 into John Doe's account.
double balance = hm.get("John Doe");
hm.put("John Doe", balance + 1000);
System.out.println("John Doe's new balance: " + hm.get("John Doe"));
}
}
|
UTF-8
|
Java
| 1,935 |
java
|
HashMapDemo.java
|
Java
|
[
{
"context": "key, the old value\nis replaced.*/\n hm.put(\"John Doe\", new Double(3434.34));\n hm.put(\"Tom Smith",
"end": 879,
"score": 0.9998544454574585,
"start": 871,
"tag": "NAME",
"value": "John Doe"
},
{
"context": "\"John Doe\", new Double(3434.34));\n hm.put(\"Tom Smith\", new Double(123.22));\n hm.put(\"Jane Baker",
"end": 929,
"score": 0.9998592734336853,
"start": 920,
"tag": "NAME",
"value": "Tom Smith"
},
{
"context": "\"Tom Smith\", new Double(123.22));\n hm.put(\"Jane Baker\", new Double(1378.00));\n hm.put(\"Tod Hall\"",
"end": 979,
"score": 0.9998818635940552,
"start": 969,
"tag": "NAME",
"value": "Jane Baker"
},
{
"context": "ane Baker\", new Double(1378.00));\n hm.put(\"Tod Hall\", new Double(99.22));\n hm.put(\"Ralph Smith",
"end": 1028,
"score": 0.9997408986091614,
"start": 1020,
"tag": "NAME",
"value": "Tod Hall"
},
{
"context": "t(\"Tod Hall\", new Double(99.22));\n hm.put(\"Ralph Smith\", new Double(-19.08));\n// Get a set of the entrie",
"end": 1078,
"score": 0.9998680949211121,
"start": 1067,
"tag": "NAME",
"value": "Ralph Smith"
},
{
"context": " System.out.println();\n// Deposit 1000 into John Doe's account.\n double balance = hm.get(\"John ",
"end": 1749,
"score": 0.9946052432060242,
"start": 1741,
"tag": "NAME",
"value": "John Doe"
},
{
"context": "n Doe's account.\n double balance = hm.get(\"John Doe\");\n hm.put(\"John Doe\", balance + 1000);\n ",
"end": 1802,
"score": 0.9968911409378052,
"start": 1794,
"tag": "NAME",
"value": "John Doe"
},
{
"context": "ble balance = hm.get(\"John Doe\");\n hm.put(\"John Doe\", balance + 1000);\n System.out.println(\"Jo",
"end": 1830,
"score": 0.9990912675857544,
"start": 1822,
"tag": "NAME",
"value": "John Doe"
},
{
"context": "oe\", balance + 1000);\n System.out.println(\"John Doe's new balance: \" + hm.get(\"John Doe\"));\n }\n}\n",
"end": 1886,
"score": 0.9942072033882141,
"start": 1878,
"tag": "NAME",
"value": "John Doe"
},
{
"context": ".out.println(\"John Doe's new balance: \" + hm.get(\"John Doe\"));\n }\n}\n",
"end": 1918,
"score": 0.9964597821235657,
"start": 1914,
"tag": "NAME",
"value": "John"
}
] | null |
[] |
package org.gamegogo.TheCollectionsFramework;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
class HashMapDemo {
public static void main(String args[]) {
// Create a hash map.
/*Hash table based implementation of the Map interface.
This implementation provides all of the optional map operations, and permits null
values and the null key. (The HashMap class is roughly equivalent to Hashtable,
except that it is unsynchronized and permits nulls.)
This class makes no guarantees as to the order of the map; in particular,
it does not guarantee that the order will remain constant over time.*/
HashMap<String, Double> hm = new HashMap<>();
// Put elements to the map
/*Associates the specified value with the specified key in this map.
If the map previously contained a mapping for the key, the old value
is replaced.*/
hm.put("<NAME>", new Double(3434.34));
hm.put("<NAME>", new Double(123.22));
hm.put("<NAME>", new Double(1378.00));
hm.put("<NAME>", new Double(99.22));
hm.put("<NAME>", new Double(-19.08));
// Get a set of the entries.
/*A collection that contains no duplicate elements. More formally, sets
contain no pair of elements e1 and e2 such that e1.equals(e2), and at
most one null element. As implied by its name, this interface models the
mathematical set abstraction.*/
/*entrySet(): Returns a Set view of the mappings contained in this map.*/
Set<Map.Entry<String, Double>> set = hm.entrySet();
// Display the set.
for (Map.Entry<String, Double> me : set) {
System.out.print(me.getKey() + ": ");
System.out.println(me.getValue());
}
System.out.println();
// Deposit 1000 into <NAME>'s account.
double balance = hm.get("<NAME>");
hm.put("<NAME>", balance + 1000);
System.out.println("<NAME>'s new balance: " + hm.get("John Doe"));
}
}
| 1,911 | 0.687339 | 0.668217 | 44 | 42.977272 | 23.081367 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.772727 | false | false |
9
|
46c24585101d0542f1210c7bcd0aead03b93e6b1
| 33,157,147,559,005 |
f4c8637d7efd25cd3862ae9a800b8c25c24a3d77
|
/student-management-system/src/main/java/com/infy/studmgmtsys/model/StudentEntity.java
|
72e90099e721aefd0cd029b9a37962969f3d9a44
|
[] |
no_license
|
cr7blackpearl/apache-camel-api-gateway-without-jwt
|
https://github.com/cr7blackpearl/apache-camel-api-gateway-without-jwt
|
d64e5f91584be1909d03f474f932e403ac404a66
|
cd08341a944dbfaa67285b4081bcd20888b1227a
|
refs/heads/master
| 2021-04-10T18:35:54.538000 | 2020-03-21T11:22:58 | 2020-03-21T11:22:58 | 248,954,550 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.infy.studmgmtsys.model;
import java.util.List;
public class StudentEntity {
List<Student> studetnList;
public StudentEntity() {
}
public List<Student> getStudetnList() {
return studetnList;
}
public void setStudetnList(List<Student> studetnList) {
this.studetnList = studetnList;
}
}
|
UTF-8
|
Java
| 313 |
java
|
StudentEntity.java
|
Java
|
[] | null |
[] |
package com.infy.studmgmtsys.model;
import java.util.List;
public class StudentEntity {
List<Student> studetnList;
public StudentEntity() {
}
public List<Student> getStudetnList() {
return studetnList;
}
public void setStudetnList(List<Student> studetnList) {
this.studetnList = studetnList;
}
}
| 313 | 0.744409 | 0.744409 | 19 | 15.473684 | 17.132206 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.842105 | false | false |
9
|
2e343afa6adb9b0772b96fe5525dd34d88d881c2
| 16,037,407,925,840 |
847679f17fb0843c99242e2b243299c248fa1b6c
|
/ioc-module/src/main/java/com/curtisnewbie/module/ioc/convert/Converter.java
|
d5575977f148c82cc1b754e6bd2460be11d4fcb6
|
[
"Apache-2.0"
] |
permissive
|
CurtisNewbie/ioc-module
|
https://github.com/CurtisNewbie/ioc-module
|
521f6b066f159faa848e406a59a2086ac0824642
|
2275ca387acf965bcf65fa13e4da921093fcf62a
|
refs/heads/main
| 2023-09-04T01:22:09.732000 | 2021-10-10T06:25:51 | 2021-10-10T06:25:51 | 380,705,865 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.curtisnewbie.module.ioc.convert;
/**
* A converter that converts {@code T} type to {@code V} type
*
* @author yongjie.zhuang
*/
@FunctionalInterface
public interface Converter<T, V> {
/**
* Convert value
* @param t
*/
V convert(T t);
}
|
UTF-8
|
Java
| 277 |
java
|
Converter.java
|
Java
|
[
{
"context": "rts {@code T} type to {@code V} type\n *\n * @author yongjie.zhuang\n */\n@FunctionalInterface\npublic interface Convert",
"end": 140,
"score": 0.9986057281494141,
"start": 126,
"tag": "NAME",
"value": "yongjie.zhuang"
}
] | null |
[] |
package com.curtisnewbie.module.ioc.convert;
/**
* A converter that converts {@code T} type to {@code V} type
*
* @author yongjie.zhuang
*/
@FunctionalInterface
public interface Converter<T, V> {
/**
* Convert value
* @param t
*/
V convert(T t);
}
| 277 | 0.620939 | 0.620939 | 16 | 16.3125 | 17.116217 | 61 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.1875 | false | false |
9
|
f2363adf8a3dbd6148e43f787ad3898d6e883242
| 23,648,089,979,695 |
3b150be1b781b17495e43c73daab94a940ba1fef
|
/MainClient/src/main/java/com/fdl/activity/main/HomeFragment.java
|
1070261cc2df9d674d663cad4d0343c4fea124ff
|
[] |
no_license
|
DreamFly01/SuanNiHen
|
https://github.com/DreamFly01/SuanNiHen
|
e43346a86eb156e36b3eb643e176e735811c4024
|
c10832fb402a011a93923d074d5755b64ccf1d93
|
refs/heads/master
| 2022-01-06T21:52:02.597000 | 2019-08-02T03:06:49 | 2019-08-02T03:06:49 | 195,406,683 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.fdl.activity.main;
import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.fdl.BaseFragment;
import com.fdl.activity.account.AccountMoneyActivity;
import com.fdl.activity.account.AddressActivity;
import com.fdl.activity.account.BrowsHistoryListActivity;
import com.fdl.activity.account.ProductCollectListActivity;
import com.fdl.activity.account.ServerCallActivity;
import com.fdl.activity.account.ShopFollowListActivity;
import com.fdl.activity.coupons.MyCouponsActivity;
import com.fdl.activity.goTravel.TravelActivity;
import com.fdl.activity.merchantEntry.LogingActivity;
import com.fdl.activity.order.MyOrderActivity;
import com.fdl.activity.order.MyRefundOrderActivity;
import com.fdl.activity.set.SetActivity;
import com.fdl.activity.wool.WoolActivity;
import com.fdl.adapter.MainProductAdapter;
import com.fdl.adapter.MenuAdapter;
import com.fdl.bean.BaseResultBean;
import com.fdl.bean.MenuBean;
import com.fdl.bean.MessageEvent;
import com.fdl.requestApi.NetSubscriber;
import com.fdl.requestApi.RequestClient;
import com.fdl.utils.DialogUtils;
import com.fdl.utils.ImageUtils;
import com.fdl.utils.IsBang;
import com.fdl.utils.JumpUtils;
import com.fdl.wedgit.DividerItemDecoration;
import com.gyf.barlibrary.ImmersionBar;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
import com.sg.cj.snh.PartyApp;
import com.sg.cj.snh.R;
import com.sg.cj.snh.uitls.ImmersionOwner;
import com.sg.cj.snh.uitls.ImmersionProxy;
import com.wang.avi.AVLoadingIndicatorView;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
/**
* <p>desc:<p>
* <p>author:DreamFly<p>
* <p>creatTime:2019/2/14<p>
* <p>changeTime:2019/2/14<p>
* <p>version:1<p>
*/
public class HomeFragment extends BaseFragment {
@BindView(R.id.recyclerView)
RecyclerView recyclerView;
@BindView(R.id.refreshLayout)
SmartRefreshLayout refreshLayout;
@BindView(R.id.av_avi)
AVLoadingIndicatorView avAvi;
@BindView(R.id.avi1)
RelativeLayout avi1;
@BindView(R.id.tv_tip)
TextView tvTip;
@BindView(R.id.ll_noData)
LinearLayout llNoData;
@BindView(R.id.avi)
RelativeLayout avi;
Unbinder unbinder;
@BindView(R.id.tv_name)
TextView tvName;
@BindView(R.id.iv_set)
ImageView ivSet;
@BindView(R.id.ll_top1)
LinearLayout llTop1;
private LinearLayout llTop;
private MainProductAdapter adapter;
private LayoutInflater inflater = null;
private LinearLayout heard;
private RecyclerView menuRecycleview;
private int scrollY = 0;
private MenuBean menuBean;
private List<MenuBean> menuBeanList = new ArrayList<>();
private List<String> menuStrList = new ArrayList<>();
private List<Integer> imgList = new ArrayList<>();
private MenuAdapter menuAdapter;
private LinearLayout ll_order, ll01, ll02, ll03, ll11, ll12, ll13, ll14, ll15;
private TextView tv01, tv02, tv03, tvN1, tvN2, tvN3, tvN4, tvN5, tvName1, tvGrade;
private ImageView imgHeard, set;
private Bundle bundle;
private DialogUtils dialogUtils;
@Override
public int initContentView() {
return R.layout.fragment_home_layout;
}
@Override
public void setUpViews(View view) {
EventBus.getDefault().register(this);//注册EventBus
dialogUtils = new DialogUtils(getContext());
refreshLayout.setEnableLoadMore(false);
inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
heard = (LinearLayout) inflater.inflate(R.layout.heard_home_layout, null);
tvName1 = (TextView) heard.findViewById(R.id.tv_name);
tvGrade = heard.findViewById(R.id.tv_grade);
imgHeard = (ImageView) heard.findViewById(R.id.iv_heard_img);
llTop = heard.findViewById(R.id.ll_top);
tv01 = heard.findViewById(R.id.tv_01);
tv02 = heard.findViewById(R.id.tv_02);
tv03 = heard.findViewById(R.id.tv_03);
tvN1 = heard.findViewById(R.id.tv_num1);
tvN2 = heard.findViewById(R.id.tv_num2);
tvN3 = heard.findViewById(R.id.tv_num3);
tvN4 = heard.findViewById(R.id.tv_num4);
tvN5 = heard.findViewById(R.id.tv_num5);
ll_order = heard.findViewById(R.id.ll_order);
ll01 = heard.findViewById(R.id.ll_01);
ll02 = heard.findViewById(R.id.ll_02);
ll03 = heard.findViewById(R.id.ll_03);
ll11 = heard.findViewById(R.id.ll_11);
ll12 = heard.findViewById(R.id.ll_12);
ll13 = heard.findViewById(R.id.ll_13);
ll14 = heard.findViewById(R.id.ll_14);
ll15 = heard.findViewById(R.id.ll_15);
set = heard.findViewById(R.id.iv_set);
ImmersionBar.with(getActivity()).titleBar(llTop).init();
ImmersionBar.with(getActivity()).titleBar(llTop1).init();
IsBang.setImmerHeard(getContext(), llTop);
IsBang.setImmerHeard(getContext(), llTop1);
menuRecycleview = heard.findViewById(R.id.recyclerView_menu);
setMenu();
adapter = new MainProductAdapter(R.layout.item_main_layout, null);
adapter.addHeaderView(heard);
recyclerView.setLayoutManager(new GridLayoutManager(getContext(), 2));
recyclerView.setAdapter(adapter);
recyclerView.setOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
scrollY += dy;
if (scrollY > llTop.getHeight()) {
llTop1.setVisibility(View.VISIBLE);
} else {
llTop1.setVisibility(View.GONE);
}
}
});
getData();
}
@Override
public void setUpLisener() {
ll01.setOnClickListener(this::onUserClick);
ll02.setOnClickListener(this::onUserClick);
ll03.setOnClickListener(this::onUserClick);
ll11.setOnClickListener(this::onUserClick);
ll12.setOnClickListener(this::onUserClick);
ll13.setOnClickListener(this::onUserClick);
ll14.setOnClickListener(this::onUserClick);
ll15.setOnClickListener(this::onUserClick);
ll_order.setOnClickListener(this::onUserClick);
set.setOnClickListener(this::onUserClick);
refreshLayout.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
getData();
}
});
}
@Override
public void onUserClick(View v) {
super.onUserClick(v);
switch (v.getId()) {
case R.id.ll_01:
JumpUtils.simpJump(getActivity(), ProductCollectListActivity.class, false);
break;
case R.id.ll_02:
JumpUtils.simpJump(getActivity(), ShopFollowListActivity.class, false);
break;
case R.id.ll_03:
JumpUtils.simpJump(getActivity(), BrowsHistoryListActivity.class, false);
break;
case R.id.ll_11:
bundle = new Bundle();
bundle.putInt("tabType", 1);
JumpUtils.dataJump(getActivity(), MyOrderActivity.class, bundle, false);
break;
case R.id.ll_12:
bundle = new Bundle();
bundle.putInt("tabType", 2);
JumpUtils.dataJump(getActivity(), MyOrderActivity.class, bundle, false);
break;
case R.id.ll_13:
bundle = new Bundle();
bundle.putInt("tabType", 3);
JumpUtils.dataJump(getActivity(), MyOrderActivity.class, bundle, false);
break;
case R.id.ll_14:
bundle = new Bundle();
bundle.putInt("tabType", 4);
JumpUtils.dataJump(getActivity(), MyOrderActivity.class, bundle, false);
break;
case R.id.ll_15:
JumpUtils.simpJump(getActivity(), MyRefundOrderActivity.class, false);
break;
case R.id.ll_order:
bundle = new Bundle();
bundle.putInt("tabType", 0);
JumpUtils.dataJump(getActivity(), MyOrderActivity.class, bundle, false);
break;
case R.id.iv_set:
JumpUtils.simpJump(getActivity(), SetActivity.class, false);
break;
}
}
private void getData() {
addSubscription(RequestClient.GetPersonInfo(getContext(), new NetSubscriber<BaseResultBean>(getContext()) {
@Override
public void onResultNext(BaseResultBean model) {
avi.setVisibility(View.GONE);
refreshLayout.finishRefresh();
fillView(model);
}
}));
}
private void setMenu() {
menuStrList.clear();
imgList.clear();
menuBeanList.clear();
menuStrList.add("薅羊毛");
menuStrList.add("收货地址");
menuStrList.add("我的卡包");
menuStrList.add("优惠券");
menuStrList.add("带你去旅行");
menuStrList.add("客服中心");
menuStrList.add("商家管理");
imgList.add(R.drawable.img_hym);
imgList.add(R.drawable.img_shdz);
imgList.add(R.drawable.img_wdkb);
imgList.add(R.drawable.img_yhq);
imgList.add(R.drawable.img_dnqlx);
imgList.add(R.drawable.img_kfzx);
imgList.add(R.drawable.img_sjdl);
for (int i = 0; i < menuStrList.size(); i++) {
menuBean = new MenuBean();
menuBean.name = menuStrList.get(i);
menuBean.imgRes = imgList.get(i);
menuBeanList.add(menuBean);
}
menuAdapter = new MenuAdapter(R.layout.item_menu_home_layout, menuBeanList);
menuRecycleview.setLayoutManager(new GridLayoutManager(getContext(), 4));
menuRecycleview.setAdapter(menuAdapter);
menuAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
switch (position) {
case 0:
JumpUtils.simpJump(getActivity(), WoolActivity.class, false);
break;
case 1:
JumpUtils.simpJump(getActivity(), AddressActivity.class, false);
break;
case 2:
JumpUtils.simpJump(getActivity(), AccountMoneyActivity.class, false);
break;
case 3:
JumpUtils.simpJump(getActivity(), MyCouponsActivity.class, false);
break;
case 4:
bundle = new Bundle();
bundle.putInt("type", 2);
JumpUtils.dataJump(getActivity(), TravelActivity.class, bundle, false);
break;
case 5:
JumpUtils.simpJump(getActivity(), ServerCallActivity.class, false);
break;
case 6:
Intent intent = new Intent(Intent.ACTION_MAIN);
/**知道要跳转应用的包命与目标Activity*/
try {
ComponentName componentName = new ComponentName("com.snh.snhseller", "com.snh.snhseller.WelcomActivity");
intent.setComponent(componentName);
intent.putExtra("", "");//这里Intent传值
startActivity(intent);
} catch (Exception e) {
dialogUtils.twoBtnDialog("未检测到商家管理APP,是否前往下载?", new DialogUtils.ChoseClickLisener() {
@Override
public void onConfirmClick(View v) {
goToMarket(getContext(), "com.snh.snhseller");
dialogUtils.dismissDialog();
}
@Override
public void onCancelClick(View v) {
dialogUtils.dismissDialog();
}
}, true);
}
break;
}
}
});
}
private void fillView(BaseResultBean bean) {
StringBuffer sbf = new StringBuffer(PartyApp.getAppComponent().getDataManager().getWxHeadImg());
ImageUtils.loadUrlCircleImage(getContext(), sbf.replace(0, 1, "h").toString(), imgHeard);
tvName.setText(PartyApp.getAppComponent().getDataManager().getWxNickName());
tvName1.setText(PartyApp.getAppComponent().getDataManager().getWxNickName());
tvGrade.setText("等级:v" + PartyApp.getAppComponent().getDataManager().getGradeId());
tv01.setText("商品收藏(" + bean.caregoods + ")");
tv02.setText("店铺关注(" + bean.careshop + ")");
if (bean.topay > 0) {
tvN1.setVisibility(View.VISIBLE);
tvN1.setText(bean.topay + "");
} else {
tvN1.setVisibility(View.GONE);
}
if (bean.tosendproduct > 0) {
tvN2.setVisibility(View.VISIBLE);
tvN2.setText(bean.tosendproduct + "");
} else {
tvN2.setVisibility(View.GONE);
}
if (bean.toreceiveproduct > 0) {
tvN3.setVisibility(View.VISIBLE);
tvN3.setText(bean.toreceiveproduct + "");
} else {
tvN3.setVisibility(View.GONE);
}
if (bean.toreview > 0) {
tvN4.setVisibility(View.VISIBLE);
tvN4.setText(bean.toreview + "");
} else {
tvN4.setVisibility(View.GONE);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// TODO: inflate a fragment view
View rootView = super.onCreateView(inflater, container, savedInstanceState);
unbinder = ButterKnife.bind(this, rootView);
return rootView;
}
@Override
public void onDestroyView() {
super.onDestroyView();
unbinder.unbind();
if (EventBus.getDefault().isRegistered(this)) {
EventBus.getDefault().unregister(this);
}
}
@Override
public void onResume() {
super.onResume();
if (!this.isHidden()) {
avi.setVisibility(View.VISIBLE);
getData();
} else {
StringBuffer sbf = new StringBuffer(PartyApp.getAppComponent().getDataManager().getWxHeadImg());
ImageUtils.loadUrlCircleImage(getContext(), sbf.replace(0, 1, "h").toString(), imgHeard);
tvName.setText(PartyApp.getAppComponent().getDataManager().getWxNickName());
tvName1.setText(PartyApp.getAppComponent().getDataManager().getWxNickName());
}
}
public static void goToMarket(Context context, String packageName) {
Uri uri = Uri.parse("market://details?id=" + packageName);
Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri);
try {
context.startActivity(goToMarket);
} catch (ActivityNotFoundException e) {
e.printStackTrace();
}
}
//注意这里sticky=true
@Subscribe(threadMode = ThreadMode.MAIN)
public void onMessageEvent(MessageEvent event) {
// UI updates must run on MainThread
if (event.getMessage().equals("collect") || event.getMessage().equals("storeFollow")) {
getData();
}
}
}
|
UTF-8
|
Java
| 16,929 |
java
|
HomeFragment.java
|
Java
|
[
{
"context": "rknife.Unbinder;\n\n/**\n * <p>desc:<p>\n * <p>author:DreamFly<p>\n * <p>creatTime:2019/2/14<p>\n * <p>changeTime:",
"end": 2627,
"score": 0.9996563792228699,
"start": 2619,
"tag": "USERNAME",
"value": "DreamFly"
}
] | null |
[] |
package com.fdl.activity.main;
import android.content.ActivityNotFoundException;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
import android.graphics.Color;
import android.net.Uri;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.fdl.BaseFragment;
import com.fdl.activity.account.AccountMoneyActivity;
import com.fdl.activity.account.AddressActivity;
import com.fdl.activity.account.BrowsHistoryListActivity;
import com.fdl.activity.account.ProductCollectListActivity;
import com.fdl.activity.account.ServerCallActivity;
import com.fdl.activity.account.ShopFollowListActivity;
import com.fdl.activity.coupons.MyCouponsActivity;
import com.fdl.activity.goTravel.TravelActivity;
import com.fdl.activity.merchantEntry.LogingActivity;
import com.fdl.activity.order.MyOrderActivity;
import com.fdl.activity.order.MyRefundOrderActivity;
import com.fdl.activity.set.SetActivity;
import com.fdl.activity.wool.WoolActivity;
import com.fdl.adapter.MainProductAdapter;
import com.fdl.adapter.MenuAdapter;
import com.fdl.bean.BaseResultBean;
import com.fdl.bean.MenuBean;
import com.fdl.bean.MessageEvent;
import com.fdl.requestApi.NetSubscriber;
import com.fdl.requestApi.RequestClient;
import com.fdl.utils.DialogUtils;
import com.fdl.utils.ImageUtils;
import com.fdl.utils.IsBang;
import com.fdl.utils.JumpUtils;
import com.fdl.wedgit.DividerItemDecoration;
import com.gyf.barlibrary.ImmersionBar;
import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.api.RefreshLayout;
import com.scwang.smartrefresh.layout.listener.OnRefreshListener;
import com.sg.cj.snh.PartyApp;
import com.sg.cj.snh.R;
import com.sg.cj.snh.uitls.ImmersionOwner;
import com.sg.cj.snh.uitls.ImmersionProxy;
import com.wang.avi.AVLoadingIndicatorView;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import java.util.ArrayList;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;
/**
* <p>desc:<p>
* <p>author:DreamFly<p>
* <p>creatTime:2019/2/14<p>
* <p>changeTime:2019/2/14<p>
* <p>version:1<p>
*/
public class HomeFragment extends BaseFragment {
@BindView(R.id.recyclerView)
RecyclerView recyclerView;
@BindView(R.id.refreshLayout)
SmartRefreshLayout refreshLayout;
@BindView(R.id.av_avi)
AVLoadingIndicatorView avAvi;
@BindView(R.id.avi1)
RelativeLayout avi1;
@BindView(R.id.tv_tip)
TextView tvTip;
@BindView(R.id.ll_noData)
LinearLayout llNoData;
@BindView(R.id.avi)
RelativeLayout avi;
Unbinder unbinder;
@BindView(R.id.tv_name)
TextView tvName;
@BindView(R.id.iv_set)
ImageView ivSet;
@BindView(R.id.ll_top1)
LinearLayout llTop1;
private LinearLayout llTop;
private MainProductAdapter adapter;
private LayoutInflater inflater = null;
private LinearLayout heard;
private RecyclerView menuRecycleview;
private int scrollY = 0;
private MenuBean menuBean;
private List<MenuBean> menuBeanList = new ArrayList<>();
private List<String> menuStrList = new ArrayList<>();
private List<Integer> imgList = new ArrayList<>();
private MenuAdapter menuAdapter;
private LinearLayout ll_order, ll01, ll02, ll03, ll11, ll12, ll13, ll14, ll15;
private TextView tv01, tv02, tv03, tvN1, tvN2, tvN3, tvN4, tvN5, tvName1, tvGrade;
private ImageView imgHeard, set;
private Bundle bundle;
private DialogUtils dialogUtils;
@Override
public int initContentView() {
return R.layout.fragment_home_layout;
}
@Override
public void setUpViews(View view) {
EventBus.getDefault().register(this);//注册EventBus
dialogUtils = new DialogUtils(getContext());
refreshLayout.setEnableLoadMore(false);
inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
heard = (LinearLayout) inflater.inflate(R.layout.heard_home_layout, null);
tvName1 = (TextView) heard.findViewById(R.id.tv_name);
tvGrade = heard.findViewById(R.id.tv_grade);
imgHeard = (ImageView) heard.findViewById(R.id.iv_heard_img);
llTop = heard.findViewById(R.id.ll_top);
tv01 = heard.findViewById(R.id.tv_01);
tv02 = heard.findViewById(R.id.tv_02);
tv03 = heard.findViewById(R.id.tv_03);
tvN1 = heard.findViewById(R.id.tv_num1);
tvN2 = heard.findViewById(R.id.tv_num2);
tvN3 = heard.findViewById(R.id.tv_num3);
tvN4 = heard.findViewById(R.id.tv_num4);
tvN5 = heard.findViewById(R.id.tv_num5);
ll_order = heard.findViewById(R.id.ll_order);
ll01 = heard.findViewById(R.id.ll_01);
ll02 = heard.findViewById(R.id.ll_02);
ll03 = heard.findViewById(R.id.ll_03);
ll11 = heard.findViewById(R.id.ll_11);
ll12 = heard.findViewById(R.id.ll_12);
ll13 = heard.findViewById(R.id.ll_13);
ll14 = heard.findViewById(R.id.ll_14);
ll15 = heard.findViewById(R.id.ll_15);
set = heard.findViewById(R.id.iv_set);
ImmersionBar.with(getActivity()).titleBar(llTop).init();
ImmersionBar.with(getActivity()).titleBar(llTop1).init();
IsBang.setImmerHeard(getContext(), llTop);
IsBang.setImmerHeard(getContext(), llTop1);
menuRecycleview = heard.findViewById(R.id.recyclerView_menu);
setMenu();
adapter = new MainProductAdapter(R.layout.item_main_layout, null);
adapter.addHeaderView(heard);
recyclerView.setLayoutManager(new GridLayoutManager(getContext(), 2));
recyclerView.setAdapter(adapter);
recyclerView.setOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
scrollY += dy;
if (scrollY > llTop.getHeight()) {
llTop1.setVisibility(View.VISIBLE);
} else {
llTop1.setVisibility(View.GONE);
}
}
});
getData();
}
@Override
public void setUpLisener() {
ll01.setOnClickListener(this::onUserClick);
ll02.setOnClickListener(this::onUserClick);
ll03.setOnClickListener(this::onUserClick);
ll11.setOnClickListener(this::onUserClick);
ll12.setOnClickListener(this::onUserClick);
ll13.setOnClickListener(this::onUserClick);
ll14.setOnClickListener(this::onUserClick);
ll15.setOnClickListener(this::onUserClick);
ll_order.setOnClickListener(this::onUserClick);
set.setOnClickListener(this::onUserClick);
refreshLayout.setOnRefreshListener(new OnRefreshListener() {
@Override
public void onRefresh(@NonNull RefreshLayout refreshLayout) {
getData();
}
});
}
@Override
public void onUserClick(View v) {
super.onUserClick(v);
switch (v.getId()) {
case R.id.ll_01:
JumpUtils.simpJump(getActivity(), ProductCollectListActivity.class, false);
break;
case R.id.ll_02:
JumpUtils.simpJump(getActivity(), ShopFollowListActivity.class, false);
break;
case R.id.ll_03:
JumpUtils.simpJump(getActivity(), BrowsHistoryListActivity.class, false);
break;
case R.id.ll_11:
bundle = new Bundle();
bundle.putInt("tabType", 1);
JumpUtils.dataJump(getActivity(), MyOrderActivity.class, bundle, false);
break;
case R.id.ll_12:
bundle = new Bundle();
bundle.putInt("tabType", 2);
JumpUtils.dataJump(getActivity(), MyOrderActivity.class, bundle, false);
break;
case R.id.ll_13:
bundle = new Bundle();
bundle.putInt("tabType", 3);
JumpUtils.dataJump(getActivity(), MyOrderActivity.class, bundle, false);
break;
case R.id.ll_14:
bundle = new Bundle();
bundle.putInt("tabType", 4);
JumpUtils.dataJump(getActivity(), MyOrderActivity.class, bundle, false);
break;
case R.id.ll_15:
JumpUtils.simpJump(getActivity(), MyRefundOrderActivity.class, false);
break;
case R.id.ll_order:
bundle = new Bundle();
bundle.putInt("tabType", 0);
JumpUtils.dataJump(getActivity(), MyOrderActivity.class, bundle, false);
break;
case R.id.iv_set:
JumpUtils.simpJump(getActivity(), SetActivity.class, false);
break;
}
}
private void getData() {
addSubscription(RequestClient.GetPersonInfo(getContext(), new NetSubscriber<BaseResultBean>(getContext()) {
@Override
public void onResultNext(BaseResultBean model) {
avi.setVisibility(View.GONE);
refreshLayout.finishRefresh();
fillView(model);
}
}));
}
private void setMenu() {
menuStrList.clear();
imgList.clear();
menuBeanList.clear();
menuStrList.add("薅羊毛");
menuStrList.add("收货地址");
menuStrList.add("我的卡包");
menuStrList.add("优惠券");
menuStrList.add("带你去旅行");
menuStrList.add("客服中心");
menuStrList.add("商家管理");
imgList.add(R.drawable.img_hym);
imgList.add(R.drawable.img_shdz);
imgList.add(R.drawable.img_wdkb);
imgList.add(R.drawable.img_yhq);
imgList.add(R.drawable.img_dnqlx);
imgList.add(R.drawable.img_kfzx);
imgList.add(R.drawable.img_sjdl);
for (int i = 0; i < menuStrList.size(); i++) {
menuBean = new MenuBean();
menuBean.name = menuStrList.get(i);
menuBean.imgRes = imgList.get(i);
menuBeanList.add(menuBean);
}
menuAdapter = new MenuAdapter(R.layout.item_menu_home_layout, menuBeanList);
menuRecycleview.setLayoutManager(new GridLayoutManager(getContext(), 4));
menuRecycleview.setAdapter(menuAdapter);
menuAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
switch (position) {
case 0:
JumpUtils.simpJump(getActivity(), WoolActivity.class, false);
break;
case 1:
JumpUtils.simpJump(getActivity(), AddressActivity.class, false);
break;
case 2:
JumpUtils.simpJump(getActivity(), AccountMoneyActivity.class, false);
break;
case 3:
JumpUtils.simpJump(getActivity(), MyCouponsActivity.class, false);
break;
case 4:
bundle = new Bundle();
bundle.putInt("type", 2);
JumpUtils.dataJump(getActivity(), TravelActivity.class, bundle, false);
break;
case 5:
JumpUtils.simpJump(getActivity(), ServerCallActivity.class, false);
break;
case 6:
Intent intent = new Intent(Intent.ACTION_MAIN);
/**知道要跳转应用的包命与目标Activity*/
try {
ComponentName componentName = new ComponentName("com.snh.snhseller", "com.snh.snhseller.WelcomActivity");
intent.setComponent(componentName);
intent.putExtra("", "");//这里Intent传值
startActivity(intent);
} catch (Exception e) {
dialogUtils.twoBtnDialog("未检测到商家管理APP,是否前往下载?", new DialogUtils.ChoseClickLisener() {
@Override
public void onConfirmClick(View v) {
goToMarket(getContext(), "com.snh.snhseller");
dialogUtils.dismissDialog();
}
@Override
public void onCancelClick(View v) {
dialogUtils.dismissDialog();
}
}, true);
}
break;
}
}
});
}
private void fillView(BaseResultBean bean) {
StringBuffer sbf = new StringBuffer(PartyApp.getAppComponent().getDataManager().getWxHeadImg());
ImageUtils.loadUrlCircleImage(getContext(), sbf.replace(0, 1, "h").toString(), imgHeard);
tvName.setText(PartyApp.getAppComponent().getDataManager().getWxNickName());
tvName1.setText(PartyApp.getAppComponent().getDataManager().getWxNickName());
tvGrade.setText("等级:v" + PartyApp.getAppComponent().getDataManager().getGradeId());
tv01.setText("商品收藏(" + bean.caregoods + ")");
tv02.setText("店铺关注(" + bean.careshop + ")");
if (bean.topay > 0) {
tvN1.setVisibility(View.VISIBLE);
tvN1.setText(bean.topay + "");
} else {
tvN1.setVisibility(View.GONE);
}
if (bean.tosendproduct > 0) {
tvN2.setVisibility(View.VISIBLE);
tvN2.setText(bean.tosendproduct + "");
} else {
tvN2.setVisibility(View.GONE);
}
if (bean.toreceiveproduct > 0) {
tvN3.setVisibility(View.VISIBLE);
tvN3.setText(bean.toreceiveproduct + "");
} else {
tvN3.setVisibility(View.GONE);
}
if (bean.toreview > 0) {
tvN4.setVisibility(View.VISIBLE);
tvN4.setText(bean.toreview + "");
} else {
tvN4.setVisibility(View.GONE);
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
// TODO: inflate a fragment view
View rootView = super.onCreateView(inflater, container, savedInstanceState);
unbinder = ButterKnife.bind(this, rootView);
return rootView;
}
@Override
public void onDestroyView() {
super.onDestroyView();
unbinder.unbind();
if (EventBus.getDefault().isRegistered(this)) {
EventBus.getDefault().unregister(this);
}
}
@Override
public void onResume() {
super.onResume();
if (!this.isHidden()) {
avi.setVisibility(View.VISIBLE);
getData();
} else {
StringBuffer sbf = new StringBuffer(PartyApp.getAppComponent().getDataManager().getWxHeadImg());
ImageUtils.loadUrlCircleImage(getContext(), sbf.replace(0, 1, "h").toString(), imgHeard);
tvName.setText(PartyApp.getAppComponent().getDataManager().getWxNickName());
tvName1.setText(PartyApp.getAppComponent().getDataManager().getWxNickName());
}
}
public static void goToMarket(Context context, String packageName) {
Uri uri = Uri.parse("market://details?id=" + packageName);
Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri);
try {
context.startActivity(goToMarket);
} catch (ActivityNotFoundException e) {
e.printStackTrace();
}
}
//注意这里sticky=true
@Subscribe(threadMode = ThreadMode.MAIN)
public void onMessageEvent(MessageEvent event) {
// UI updates must run on MainThread
if (event.getMessage().equals("collect") || event.getMessage().equals("storeFollow")) {
getData();
}
}
}
| 16,929 | 0.612692 | 0.601777 | 428 | 38.175232 | 24.533682 | 133 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.86215 | false | false |
9
|
e97346ed367a3c65b75bcc5d3bd2a38cac4a259e
| 9,964,324,178,474 |
215d6ea1c25a798f363cc0511b5f3146b5c85ac7
|
/example-client-spring-boot-starter/src/main/java/ru/fadeciness/user/info/service/client/autoconfigure/ExampleClientAutoConfiguration.java
|
0be0fbd3b1eb0f3dfea47ac1d63816082e7a2939
|
[] |
no_license
|
fadeciness/example-client-with-starter
|
https://github.com/fadeciness/example-client-with-starter
|
8c9316279e484132672fbd96b693be5940ba43cf
|
93d2d0f14b58001651af7c291a5ae8cdc9ce597e
|
refs/heads/master
| 2023-06-03T17:11:16.295000 | 2021-06-21T06:42:14 | 2021-06-21T06:42:14 | 378,829,925 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package ru.fadeciness.user.info.service.client.autoconfigure;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
@Configuration
//@ConditionalOnClass(RestTemplate.class)
@EnableConfigurationProperties(ExampleClientProperties.class)
public class ExampleClientAutoConfiguration {
@Autowired
private ExampleClientProperties properties;
@Bean
// @ConditionalOnBean
public RestTemplate exampleRestTemplate() {
return new RestTemplateBuilder()
.rootUri(properties.getHost())
.build();
}
}
|
UTF-8
|
Java
| 874 |
java
|
ExampleClientAutoConfiguration.java
|
Java
|
[] | null |
[] |
package ru.fadeciness.user.info.service.client.autoconfigure;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.client.RestTemplateBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
@Configuration
//@ConditionalOnClass(RestTemplate.class)
@EnableConfigurationProperties(ExampleClientProperties.class)
public class ExampleClientAutoConfiguration {
@Autowired
private ExampleClientProperties properties;
@Bean
// @ConditionalOnBean
public RestTemplate exampleRestTemplate() {
return new RestTemplateBuilder()
.rootUri(properties.getHost())
.build();
}
}
| 874 | 0.791762 | 0.791762 | 26 | 32.615383 | 25.19169 | 81 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.346154 | false | false |
9
|
1d24fcbb0127aece6d2230c49e472cfda9d2a633
| 9,964,324,174,713 |
19831859aaf954e57ed3a624baf12299ff4778e1
|
/kumoh-code-2017/Java/#1 기본/#1 과제/#6 java 과제/실습9/원자로감시.java
|
c5af579a2d4034867b5571374940bbcc68b63611
|
[] |
no_license
|
LeeSuHa98/kumoh-code
|
https://github.com/LeeSuHa98/kumoh-code
|
f81d4bb73e4fa6ec9449ac6f7ca9f944b4f11c6a
|
ac596e0d36e71846ad4cc2d9e65bae67467da8da
|
refs/heads/master
| 2021-01-07T09:49:48.926000 | 2018-11-26T10:24:58 | 2018-11-26T10:24:58 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
public class 원자로감시
{
static int 현재로온도 = 10000;
public static void main(String[] args)
{
try
{
반응로감시();
return;
}
catch(TemperatureException e)
{
System.out.println();
System.out.println(e.getMessage() + ": " + e.getTemperature());
}
finally
{
System.out.println("원자로 셧다운");
} // main();
}
static int 변이()
{
int amount;
amount = (int)(Math.random() * 1000);
return amount;
} // 변이()
static int 제어()
{
int temp = 0;
switch((int)(Math.random() * 3))
{
case 0:
temp = -500;
break;
case 1:
temp = 0;
break;
case 2:
temp = 500;
break;
}
return temp;
} // 제어()
static void 반응로감시() throws TemperatureException
{
TemperatureException e;
while(true)
{
if(현재로온도 > 15000)
{
TemperatureException e1 = new TemperatureException(); // 제어 불가
e1.setTemperature(현재로온도);
throw e1;
}
else if(현재로온도 > 12000)
{
현재로온도 += 제어();
System.out.println("경고: " + 현재로온도);
}
else
{
System.out.println("정상: " + 현재로온도);
현재로온도 += 변이();
}
}
} // 반응로감시()
} // 원자로감시
|
UHC
|
Java
| 1,269 |
java
|
원자로감시.java
|
Java
|
[] | null |
[] |
public class 원자로감시
{
static int 현재로온도 = 10000;
public static void main(String[] args)
{
try
{
반응로감시();
return;
}
catch(TemperatureException e)
{
System.out.println();
System.out.println(e.getMessage() + ": " + e.getTemperature());
}
finally
{
System.out.println("원자로 셧다운");
} // main();
}
static int 변이()
{
int amount;
amount = (int)(Math.random() * 1000);
return amount;
} // 변이()
static int 제어()
{
int temp = 0;
switch((int)(Math.random() * 3))
{
case 0:
temp = -500;
break;
case 1:
temp = 0;
break;
case 2:
temp = 500;
break;
}
return temp;
} // 제어()
static void 반응로감시() throws TemperatureException
{
TemperatureException e;
while(true)
{
if(현재로온도 > 15000)
{
TemperatureException e1 = new TemperatureException(); // 제어 불가
e1.setTemperature(현재로온도);
throw e1;
}
else if(현재로온도 > 12000)
{
현재로온도 += 제어();
System.out.println("경고: " + 현재로온도);
}
else
{
System.out.println("정상: " + 현재로온도);
현재로온도 += 변이();
}
}
} // 반응로감시()
} // 원자로감시
| 1,269 | 0.554738 | 0.523459 | 72 | 14.097222 | 14.291761 | 66 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.513889 | false | false |
9
|
7a7b6fc180ca361aa2243a56e77c4b301e739bd5
| 29,308,856,887,305 |
9e1d9b8f5121244df46ffe5479ee0c8775990092
|
/src/main/java/net/gpedro/faculdade/filinha/shared/atendimento/views/EditarAtendimento.java
|
a333a358b37c67219933fb15ee6281319b352a0c
|
[] |
no_license
|
gpedro/filinha
|
https://github.com/gpedro/filinha
|
3b1c3d9961bb7a2cc98d7af00d060af7398ce309
|
bec3b94ece9584a9250e65fea9c7320025d90451
|
refs/heads/master
| 2020-05-20T06:05:25.885000 | 2015-07-11T14:30:43 | 2015-07-11T14:30:43 | 31,869,397 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package net.gpedro.faculdade.filinha.shared.atendimento.views;
import java.util.Arrays;
import lombok.Getter;
import net.gpedro.faculdade.filinha.core.components.misc.Alert;
import net.gpedro.faculdade.filinha.shared.atendimento.constants.CLASSIFICACAO;
import net.gpedro.faculdade.filinha.shared.atendimento.model.Atendimento;
import net.gpedro.faculdade.filinha.shared.rh.model.Aluno;
import com.vaadin.data.fieldgroup.BeanFieldGroup;
import com.vaadin.data.util.BeanItemContainer;
import com.vaadin.ui.ComboBox;
import com.vaadin.ui.TextArea;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;
@SuppressWarnings("serial")
public class EditarAtendimento extends VerticalLayout {
@Getter
private BeanFieldGroup<Atendimento> bean;
private TextArea descricao;
private ComboBox status;
public boolean isValid() {
return status.isValid() && descricao.isValid();
}
public EditarAtendimento(Atendimento entity) {
if (entity == null) {
Alert.showError("Atenção",
"Não foi possível editar este atendimento", 5000);
return;
}
bean = new BeanFieldGroup<Atendimento>(Atendimento.class);
bean.setItemDataSource(entity);
// ---------
TextField senha = bean.buildAndBind("Senha", "senha", TextField.class);
senha.setEnabled(false);
senha.setSizeFull();
// ---------
Aluno a = entity.getSolicitante();
TextField alunoCpf, alunoNome;
alunoCpf = new TextField("CPF");
alunoCpf.setEnabled(false);
alunoCpf.setValue(a.getCpf());
alunoCpf.setSizeFull();
alunoNome = new TextField("Nome");
alunoNome.setEnabled(false);
alunoNome.setValue(a.getNome());
alunoNome.setSizeFull();
// ---------
descricao = bean.buildAndBind("Observação", "observacoes", TextArea.class);
descricao.setNullRepresentation("");
descricao.setSizeFull();
// ---------
BeanItemContainer<CLASSIFICACAO> bc = new BeanItemContainer<CLASSIFICACAO>(
CLASSIFICACAO.class);
bc.addAll(Arrays.asList(CLASSIFICACAO.values()));
status = bean.buildAndBind("Classificação", "classificacao", ComboBox.class);
status.setRequired(true);
status.setContainerDataSource(bc);
status.setSizeFull();
status.setItemCaptionPropertyId("description");
// ---------
addComponents(senha, alunoCpf, alunoNome, descricao, status);
}
}
|
UTF-8
|
Java
| 2,655 |
java
|
EditarAtendimento.java
|
Java
|
[] | null |
[] |
package net.gpedro.faculdade.filinha.shared.atendimento.views;
import java.util.Arrays;
import lombok.Getter;
import net.gpedro.faculdade.filinha.core.components.misc.Alert;
import net.gpedro.faculdade.filinha.shared.atendimento.constants.CLASSIFICACAO;
import net.gpedro.faculdade.filinha.shared.atendimento.model.Atendimento;
import net.gpedro.faculdade.filinha.shared.rh.model.Aluno;
import com.vaadin.data.fieldgroup.BeanFieldGroup;
import com.vaadin.data.util.BeanItemContainer;
import com.vaadin.ui.ComboBox;
import com.vaadin.ui.TextArea;
import com.vaadin.ui.TextField;
import com.vaadin.ui.VerticalLayout;
@SuppressWarnings("serial")
public class EditarAtendimento extends VerticalLayout {
@Getter
private BeanFieldGroup<Atendimento> bean;
private TextArea descricao;
private ComboBox status;
public boolean isValid() {
return status.isValid() && descricao.isValid();
}
public EditarAtendimento(Atendimento entity) {
if (entity == null) {
Alert.showError("Atenção",
"Não foi possível editar este atendimento", 5000);
return;
}
bean = new BeanFieldGroup<Atendimento>(Atendimento.class);
bean.setItemDataSource(entity);
// ---------
TextField senha = bean.buildAndBind("Senha", "senha", TextField.class);
senha.setEnabled(false);
senha.setSizeFull();
// ---------
Aluno a = entity.getSolicitante();
TextField alunoCpf, alunoNome;
alunoCpf = new TextField("CPF");
alunoCpf.setEnabled(false);
alunoCpf.setValue(a.getCpf());
alunoCpf.setSizeFull();
alunoNome = new TextField("Nome");
alunoNome.setEnabled(false);
alunoNome.setValue(a.getNome());
alunoNome.setSizeFull();
// ---------
descricao = bean.buildAndBind("Observação", "observacoes", TextArea.class);
descricao.setNullRepresentation("");
descricao.setSizeFull();
// ---------
BeanItemContainer<CLASSIFICACAO> bc = new BeanItemContainer<CLASSIFICACAO>(
CLASSIFICACAO.class);
bc.addAll(Arrays.asList(CLASSIFICACAO.values()));
status = bean.buildAndBind("Classificação", "classificacao", ComboBox.class);
status.setRequired(true);
status.setContainerDataSource(bc);
status.setSizeFull();
status.setItemCaptionPropertyId("description");
// ---------
addComponents(senha, alunoCpf, alunoNome, descricao, status);
}
}
| 2,655 | 0.642236 | 0.640725 | 83 | 30.891565 | 23.412495 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.698795 | false | false |
9
|
c7d43cf9561fc2b1da198e27f38ef882c67b199d
| 8,177,617,741,764 |
007f50af8771e45b5532666a83bd928b846cde8d
|
/app/src/main/java/com/example/foodordering/Menu.java
|
da44eb95c732f5d8da1ad26ef91e7cce12f9b510
|
[] |
no_license
|
rakaryuto23karyuto/Rest_Tauran_1
|
https://github.com/rakaryuto23karyuto/Rest_Tauran_1
|
17c56783a8babc4cf9fadce058d7321ea9152df0
|
1ae8cf7d3b2a325bf289f3683bc73b7b55d8c6c4
|
refs/heads/master
| 2020-07-30T20:13:19.872000 | 2019-09-23T12:05:59 | 2019-09-23T12:05:59 | 210,345,168 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.foodordering;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.Toast;
public class Menu extends AppCompatActivity {
ImageButton foodsImageButton,baveragesImageButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_menu);
foodsImageButton = (ImageButton) findViewById(R.id.foodsImageButton);
baveragesImageButton = (ImageButton) findViewById(R.id.baveragesImageButton);
foodsImageButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intentLoadNewActivity = new Intent (Menu.this,NewActivity.class);
startActivity(intentLoadNewActivity);
}
});
}
public void baverages(View view) {
Intent intentLoadNewActivity = new Intent(Menu.this,NewActivity.class);
startActivity(intentLoadNewActivity);}
}
|
UTF-8
|
Java
| 1,164 |
java
|
Menu.java
|
Java
|
[] | null |
[] |
package com.example.foodordering;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ImageButton;
import android.widget.Toast;
public class Menu extends AppCompatActivity {
ImageButton foodsImageButton,baveragesImageButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_menu);
foodsImageButton = (ImageButton) findViewById(R.id.foodsImageButton);
baveragesImageButton = (ImageButton) findViewById(R.id.baveragesImageButton);
foodsImageButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intentLoadNewActivity = new Intent (Menu.this,NewActivity.class);
startActivity(intentLoadNewActivity);
}
});
}
public void baverages(View view) {
Intent intentLoadNewActivity = new Intent(Menu.this,NewActivity.class);
startActivity(intentLoadNewActivity);}
}
| 1,164 | 0.730241 | 0.730241 | 36 | 31.361111 | 26.136557 | 85 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.583333 | false | false |
9
|
451fd017de788211b1111383df3a497c8da45244
| 29,961,691,892,590 |
0638f8414ecaa3d3c5bbbcdc993ccc20e1711db2
|
/src/main/java/org/uysm/zip/AddFolder.java
|
47df2dbfbe0d5e1424abeb13c3bc3d3b7db8dd4c
|
[] |
no_license
|
adnanrimedzo/uysm-updx
|
https://github.com/adnanrimedzo/uysm-updx
|
fca2d67cfd0222df5c180f224db2a51b3e7c0118
|
83c2067a6b07c8ed7a36af72da404bbeba7989d3
|
refs/heads/master
| 2022-07-10T16:17:38.569000 | 2019-07-17T21:12:30 | 2019-07-17T21:12:30 | 110,469,192 | 1 | 0 | null | false | 2022-06-30T14:44:37 | 2017-11-12T21:05:33 | 2019-07-17T21:12:39 | 2022-06-30T14:44:33 | 936 | 2 | 0 | 3 |
Java
| false | false |
package org.uysm.zip;
import net.lingala.zip4j.core.ZipFile;
import net.lingala.zip4j.exception.ZipException;
import net.lingala.zip4j.model.ZipParameters;
import net.lingala.zip4j.progress.ProgressMonitor;
import net.lingala.zip4j.util.Zip4jConstants;
/**
* Demonstrated adding a folder to zip file
*
* @author Srikanth Reddy Lingala
*/
public class AddFolder {
private ProgressMonitor progressMonitor = null;
public AddFolder(String folderDir, String UDPXDir, String ecriptionKey) {
try {
// Initiate ZipFile object with the path/name of the zip file.
ZipFile zipFile = new ZipFile(UDPXDir);
zipFile.setRunInThread(true);
// Initiate Zip Parameters which define various properties such
// as compression method, etc.
ZipParameters parameters = new ZipParameters();
// set compression method to store compression
parameters.setCompressionMethod(Zip4jConstants.COMP_DEFLATE);
// Set the compression level
parameters.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_NORMAL);
parameters.setEncryptFiles(true);
parameters.setEncryptionMethod(Zip4jConstants.ENC_METHOD_AES);
parameters.setAesKeyStrength(Zip4jConstants.AES_STRENGTH_256);
parameters.setPassword(ecriptionKey);
// Add folder to the zip file
zipFile.addFolder(folderDir, parameters);
// Get progress monitor from ZipFile
progressMonitor = zipFile.getProgressMonitor();
} catch (ZipException e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
String folderDir = "/Users/adnanrimedzo/IdeaProjects/udpx/src/test/java/resources/input";
String UDPXDir = "/Users/adnanrimedzo/IdeaProjects/udpx/src/test/java/resources/output/test.udpx";
String ecriptionKey = "1q2w3e4r1q2w3e4r";
new AddFolder(folderDir, UDPXDir, ecriptionKey);
}
public ProgressMonitor getProgressMonitor() {
return progressMonitor;
}
}
|
UTF-8
|
Java
| 2,118 |
java
|
AddFolder.java
|
Java
|
[
{
"context": "nstrated adding a folder to zip file\n *\n * @author Srikanth Reddy Lingala\n */\npublic class AddFolder {\n\n private Progres",
"end": 339,
"score": 0.9998800754547119,
"start": 317,
"tag": "NAME",
"value": "Srikanth Reddy Lingala"
},
{
"context": "output/test.udpx\";\n String ecriptionKey = \"1q2w3e4r1q2w3e4r\";\n new AddFolder(folderDir, UDPXDir, ecrip",
"end": 1961,
"score": 0.999498724937439,
"start": 1945,
"tag": "KEY",
"value": "1q2w3e4r1q2w3e4r"
}
] | null |
[] |
package org.uysm.zip;
import net.lingala.zip4j.core.ZipFile;
import net.lingala.zip4j.exception.ZipException;
import net.lingala.zip4j.model.ZipParameters;
import net.lingala.zip4j.progress.ProgressMonitor;
import net.lingala.zip4j.util.Zip4jConstants;
/**
* Demonstrated adding a folder to zip file
*
* @author <NAME>
*/
public class AddFolder {
private ProgressMonitor progressMonitor = null;
public AddFolder(String folderDir, String UDPXDir, String ecriptionKey) {
try {
// Initiate ZipFile object with the path/name of the zip file.
ZipFile zipFile = new ZipFile(UDPXDir);
zipFile.setRunInThread(true);
// Initiate Zip Parameters which define various properties such
// as compression method, etc.
ZipParameters parameters = new ZipParameters();
// set compression method to store compression
parameters.setCompressionMethod(Zip4jConstants.COMP_DEFLATE);
// Set the compression level
parameters.setCompressionLevel(Zip4jConstants.DEFLATE_LEVEL_NORMAL);
parameters.setEncryptFiles(true);
parameters.setEncryptionMethod(Zip4jConstants.ENC_METHOD_AES);
parameters.setAesKeyStrength(Zip4jConstants.AES_STRENGTH_256);
parameters.setPassword(ecriptionKey);
// Add folder to the zip file
zipFile.addFolder(folderDir, parameters);
// Get progress monitor from ZipFile
progressMonitor = zipFile.getProgressMonitor();
} catch (ZipException e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
String folderDir = "/Users/adnanrimedzo/IdeaProjects/udpx/src/test/java/resources/input";
String UDPXDir = "/Users/adnanrimedzo/IdeaProjects/udpx/src/test/java/resources/output/test.udpx";
String ecriptionKey = "1q2w3e4r1q2w3e4r";
new AddFolder(folderDir, UDPXDir, ecriptionKey);
}
public ProgressMonitor getProgressMonitor() {
return progressMonitor;
}
}
| 2,102 | 0.679887 | 0.669972 | 64 | 32.109375 | 28.988207 | 106 | false | false | 0 | 0 | 0 | 0 | 73 | 0.0661 | 0.46875 | false | false |
9
|
a542792842206f4ab5e17cd3d4568ca45e550519
| 14,207,751,861,051 |
08bf8ed62209073215583d8d4f56cf3f01d7cb32
|
/src/logicAndUtility/Palindrome.java
|
4071af4572262f1302119b07680fc5d7e79f4966
|
[] |
no_license
|
theCember/Project-Euler-04-largest-palindrome-product
|
https://github.com/theCember/Project-Euler-04-largest-palindrome-product
|
d4ed67df0dd2308ac125e019654a3531e9f776bc
|
3f0bb77b25c6b55e8cf1c663b1c7ae31088e2bcb
|
refs/heads/master
| 2020-04-14T13:55:49.003000 | 2019-01-02T19:46:46 | 2019-01-02T19:46:46 | 163,882,855 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package logicAndUtility;
public class Palindrome {
public Palindrome() {
this.numberForPalindrome = 0;
this.convertedNumber = "";
}
public Palindrome(int nmb, String plnd) {
this.numberForPalindrome = nmb;
this.convertedNumber = plnd;
this.palindromeID = numberForPalindrome;
numberForPalindrome++;
}
public static boolean compareTwoPalindromes(Palindrome plnd1, Palindrome plnd2) {
if(plnd1.getNumberForPalindrome()>=plnd2.getNumberForPalindrome()) {
return true;
}
return false;
}
@Override
public String toString() {
return "Palindrome [numberForPalindrome=" + numberForPalindrome + ", convertedNumber=" + convertedNumber
+ ", palindromeID=" + palindromeID + "]";
}
public int numberForPalindrome;
public String convertedNumber;
public int palindromeID = 0;
public int getPalindromeID() {
return palindromeID;
}
public void setPalindromeID(int palindromeID) {
this.palindromeID = palindromeID;
}
public static int counter = 0;
public int getNumberForPalindrome() {
return numberForPalindrome;
}
public void setNumberForPalindrome(int numberForPalindrome) {
this.numberForPalindrome = numberForPalindrome;
}
public String getConvertedNumber() {
return convertedNumber;
}
public void setConvertedNumber(String convertedNumber) {
this.convertedNumber = convertedNumber;
}
}
|
UTF-8
|
Java
| 1,354 |
java
|
Palindrome.java
|
Java
|
[] | null |
[] |
package logicAndUtility;
public class Palindrome {
public Palindrome() {
this.numberForPalindrome = 0;
this.convertedNumber = "";
}
public Palindrome(int nmb, String plnd) {
this.numberForPalindrome = nmb;
this.convertedNumber = plnd;
this.palindromeID = numberForPalindrome;
numberForPalindrome++;
}
public static boolean compareTwoPalindromes(Palindrome plnd1, Palindrome plnd2) {
if(plnd1.getNumberForPalindrome()>=plnd2.getNumberForPalindrome()) {
return true;
}
return false;
}
@Override
public String toString() {
return "Palindrome [numberForPalindrome=" + numberForPalindrome + ", convertedNumber=" + convertedNumber
+ ", palindromeID=" + palindromeID + "]";
}
public int numberForPalindrome;
public String convertedNumber;
public int palindromeID = 0;
public int getPalindromeID() {
return palindromeID;
}
public void setPalindromeID(int palindromeID) {
this.palindromeID = palindromeID;
}
public static int counter = 0;
public int getNumberForPalindrome() {
return numberForPalindrome;
}
public void setNumberForPalindrome(int numberForPalindrome) {
this.numberForPalindrome = numberForPalindrome;
}
public String getConvertedNumber() {
return convertedNumber;
}
public void setConvertedNumber(String convertedNumber) {
this.convertedNumber = convertedNumber;
}
}
| 1,354 | 0.750369 | 0.745199 | 58 | 22.344828 | 23.117804 | 106 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.586207 | false | false |
9
|
64e4890d75f72e96af8fc081c979483f6fb1f26f
| 22,789,096,531,268 |
c204afad81b2d7c3587d35e81c11623038b50856
|
/src/com/xiaoyu/shbookstore/ui/MainActivity.java
|
ca9ddd8a4860206b9c83189b88a7a0bfb2d79afd
|
[] |
no_license
|
monkey1992/SHBookStore
|
https://github.com/monkey1992/SHBookStore
|
59189ad09879d671328b7aa73bbe3ae7c11f2280
|
4c1fa4c3de571d1dafe2e5edddef90fe25348389
|
refs/heads/master
| 2021-05-04T08:42:52.337000 | 2016-10-09T16:35:53 | 2016-10-09T16:35:53 | 70,415,715 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.xiaoyu.shbookstore.ui;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.os.Bundle;
import android.view.Window;
import android.widget.RelativeLayout;
import com.xiaoyu.shbookstore.R;
import com.xiaoyu.shbookstore.config.ConstantValue;
import com.xiaoyu.shbookstore.config.GlobalParams;
import com.xiaoyu.shbookstore.manager.UiManager;
import com.xiaoyu.shbookstore.util.HttpClientUtil;
public class MainActivity extends Activity {
private RelativeLayout middleContainer;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main);
initView();
}
private void initView() {
middleContainer = (RelativeLayout) findViewById(R.id.ii_middle_container);
UiManager uiManager = UiManager.getUiManager();
uiManager.initMiddleContainer(middleContainer, this);
uiManager.changeView(HomeView.class);
}
@Override
public void onBackPressed() {
boolean result = UiManager.getUiManager().changeOperations();
if (!result) {
exitSystem1();
}
}
/**
* 退出系统
*/
private void exitSystem1() {
AlertDialog.Builder builder = new Builder(this);
builder.setIcon(R.drawable.ic_exit)
.setTitle(R.string.app_name)
.setMessage("是否退出应用?").setPositiveButton("确定", new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
new Thread(new Runnable(){
@Override
public void run() {
GlobalParams.isLogin = false;
HttpClientUtil client = new HttpClientUtil();
client.sendPost(ConstantValue.COMMON_URI.concat(ConstantValue.LOGOUT), null);
android.os.Process.killProcess(android.os.Process.myPid());
}
}).start();
}
})
.setNegativeButton("取消", null) .show();
}
/**
* �������η��ؼ��˳�
*/
/**private void exitSystem() {
long[] clickTimes = new long[2];
System.arraycopy(clickTimes, 1, clickTimes, 0, clickTimes.length-1);
clickTimes[clickTimes.length-1] = SystemClock.uptimeMillis();
if((SystemClock.uptimeMillis()-500) <= clickTimes[0]) {
new Thread(new Runnable(){
@Override
public void run() {
GlobalParams.isLogin = false;
HttpClientUtil client = new HttpClientUtil();
client.sendPost(ConstantValue.COMMON_URI.concat(ConstantValue.LOGOUT), null);
android.os.Process.killProcess(android.os.Process.myPid());
}
}).start();
}
}*/
}
|
UTF-8
|
Java
| 2,647 |
java
|
MainActivity.java
|
Java
|
[] | null |
[] |
package com.xiaoyu.shbookstore.ui;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.AlertDialog.Builder;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.os.Bundle;
import android.view.Window;
import android.widget.RelativeLayout;
import com.xiaoyu.shbookstore.R;
import com.xiaoyu.shbookstore.config.ConstantValue;
import com.xiaoyu.shbookstore.config.GlobalParams;
import com.xiaoyu.shbookstore.manager.UiManager;
import com.xiaoyu.shbookstore.util.HttpClientUtil;
public class MainActivity extends Activity {
private RelativeLayout middleContainer;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.main);
initView();
}
private void initView() {
middleContainer = (RelativeLayout) findViewById(R.id.ii_middle_container);
UiManager uiManager = UiManager.getUiManager();
uiManager.initMiddleContainer(middleContainer, this);
uiManager.changeView(HomeView.class);
}
@Override
public void onBackPressed() {
boolean result = UiManager.getUiManager().changeOperations();
if (!result) {
exitSystem1();
}
}
/**
* 退出系统
*/
private void exitSystem1() {
AlertDialog.Builder builder = new Builder(this);
builder.setIcon(R.drawable.ic_exit)
.setTitle(R.string.app_name)
.setMessage("是否退出应用?").setPositiveButton("确定", new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
new Thread(new Runnable(){
@Override
public void run() {
GlobalParams.isLogin = false;
HttpClientUtil client = new HttpClientUtil();
client.sendPost(ConstantValue.COMMON_URI.concat(ConstantValue.LOGOUT), null);
android.os.Process.killProcess(android.os.Process.myPid());
}
}).start();
}
})
.setNegativeButton("取消", null) .show();
}
/**
* �������η��ؼ��˳�
*/
/**private void exitSystem() {
long[] clickTimes = new long[2];
System.arraycopy(clickTimes, 1, clickTimes, 0, clickTimes.length-1);
clickTimes[clickTimes.length-1] = SystemClock.uptimeMillis();
if((SystemClock.uptimeMillis()-500) <= clickTimes[0]) {
new Thread(new Runnable(){
@Override
public void run() {
GlobalParams.isLogin = false;
HttpClientUtil client = new HttpClientUtil();
client.sendPost(ConstantValue.COMMON_URI.concat(ConstantValue.LOGOUT), null);
android.os.Process.killProcess(android.os.Process.myPid());
}
}).start();
}
}*/
}
| 2,647 | 0.727799 | 0.723552 | 87 | 28.770115 | 22.720036 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.505747 | false | false |
9
|
aee31d95cf4e7efd97663cf86a8dab08652c0370
| 22,789,096,532,558 |
4b0bf4787e89bcae7e4759bde6d7f3ab2c81f849
|
/aliyun-java-sdk-swas/src/main/java/com/aliyuncs/swas/model/v20170810/DescribeInstanceIpRelationsResponse.java
|
dd954db6352dc2b2c7245ebd4591d4ffee3f384a
|
[
"Apache-2.0"
] |
permissive
|
aliyun/aliyun-openapi-java-sdk
|
https://github.com/aliyun/aliyun-openapi-java-sdk
|
a263fa08e261f12d45586d1b3ad8a6609bba0e91
|
e19239808ad2298d32dda77db29a6d809e4f7add
|
refs/heads/master
| 2023-09-03T12:28:09.765000 | 2023-09-01T09:03:00 | 2023-09-01T09:03:00 | 39,555,898 | 1,542 | 1,317 |
NOASSERTION
| false | 2023-09-14T07:27:05 | 2015-07-23T08:41:13 | 2023-08-31T07:30:44 | 2023-09-14T07:27:03 | 72,323 | 1,375 | 1,144 | 12 |
Java
| false | false |
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.aliyuncs.swas.model.v20170810;
import java.util.List;
import com.aliyuncs.AcsResponse;
import com.aliyuncs.swas.transform.v20170810.DescribeInstanceIpRelationsResponseUnmarshaller;
import com.aliyuncs.transform.UnmarshallerContext;
/**
* @author auto create
* @version
*/
public class DescribeInstanceIpRelationsResponse extends AcsResponse {
private String code;
private String requestId;
private Boolean success;
private Long count;
private List<Instances> data;
public String getCode() {
return this.code;
}
public void setCode(String code) {
this.code = code;
}
public String getRequestId() {
return this.requestId;
}
public void setRequestId(String requestId) {
this.requestId = requestId;
}
public Boolean getSuccess() {
return this.success;
}
public void setSuccess(Boolean success) {
this.success = success;
}
public Long getCount() {
return this.count;
}
public void setCount(Long count) {
this.count = count;
}
public List<Instances> getData() {
return this.data;
}
public void setData(List<Instances> data) {
this.data = data;
}
public static class Instances {
private String instanceName;
private String instanceId;
private Long userId;
private String ip;
private String instanceType;
private Long createTime;
public String getInstanceName() {
return this.instanceName;
}
public void setInstanceName(String instanceName) {
this.instanceName = instanceName;
}
public String getInstanceId() {
return this.instanceId;
}
public void setInstanceId(String instanceId) {
this.instanceId = instanceId;
}
public Long getUserId() {
return this.userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getIp() {
return this.ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public String getInstanceType() {
return this.instanceType;
}
public void setInstanceType(String instanceType) {
this.instanceType = instanceType;
}
public Long getCreateTime() {
return this.createTime;
}
public void setCreateTime(Long createTime) {
this.createTime = createTime;
}
}
@Override
public DescribeInstanceIpRelationsResponse getInstance(UnmarshallerContext context) {
return DescribeInstanceIpRelationsResponseUnmarshaller.unmarshall(this, context);
}
@Override
public boolean checkShowJsonItemName() {
return false;
}
}
|
UTF-8
|
Java
| 3,130 |
java
|
DescribeInstanceIpRelationsResponse.java
|
Java
|
[] | null |
[] |
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.aliyuncs.swas.model.v20170810;
import java.util.List;
import com.aliyuncs.AcsResponse;
import com.aliyuncs.swas.transform.v20170810.DescribeInstanceIpRelationsResponseUnmarshaller;
import com.aliyuncs.transform.UnmarshallerContext;
/**
* @author auto create
* @version
*/
public class DescribeInstanceIpRelationsResponse extends AcsResponse {
private String code;
private String requestId;
private Boolean success;
private Long count;
private List<Instances> data;
public String getCode() {
return this.code;
}
public void setCode(String code) {
this.code = code;
}
public String getRequestId() {
return this.requestId;
}
public void setRequestId(String requestId) {
this.requestId = requestId;
}
public Boolean getSuccess() {
return this.success;
}
public void setSuccess(Boolean success) {
this.success = success;
}
public Long getCount() {
return this.count;
}
public void setCount(Long count) {
this.count = count;
}
public List<Instances> getData() {
return this.data;
}
public void setData(List<Instances> data) {
this.data = data;
}
public static class Instances {
private String instanceName;
private String instanceId;
private Long userId;
private String ip;
private String instanceType;
private Long createTime;
public String getInstanceName() {
return this.instanceName;
}
public void setInstanceName(String instanceName) {
this.instanceName = instanceName;
}
public String getInstanceId() {
return this.instanceId;
}
public void setInstanceId(String instanceId) {
this.instanceId = instanceId;
}
public Long getUserId() {
return this.userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getIp() {
return this.ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public String getInstanceType() {
return this.instanceType;
}
public void setInstanceType(String instanceType) {
this.instanceType = instanceType;
}
public Long getCreateTime() {
return this.createTime;
}
public void setCreateTime(Long createTime) {
this.createTime = createTime;
}
}
@Override
public DescribeInstanceIpRelationsResponse getInstance(UnmarshallerContext context) {
return DescribeInstanceIpRelationsResponseUnmarshaller.unmarshall(this, context);
}
@Override
public boolean checkShowJsonItemName() {
return false;
}
}
| 3,130 | 0.702556 | 0.696166 | 150 | 19.033333 | 21.432816 | 93 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.333333 | false | false |
9
|
7efecbc90517e802d80cc0c757e9744ab70f70c9
| 10,522,669,940,245 |
1cc037b19a154941fd1fdc7d9d1c02702794b975
|
/core-customize/custom/spar/sparfacades/src/com/spar/hcl/core/sitemap/dao/impl/SparSiteMapListDAOImpl.java
|
8d1068262970638f5993c6b199d94590c4fa303a
|
[] |
no_license
|
demo-solution/solution
|
https://github.com/demo-solution/solution
|
b557dea73d613ec8bb722e2d9a63a338f0b9cf8d
|
e342fd77084703d43122a17d7184803ea72ae5c2
|
refs/heads/master
| 2022-07-16T05:41:35.541000 | 2020-05-19T14:51:59 | 2020-05-19T14:51:59 | 259,383,771 | 0 | 0 | null | false | 2020-05-19T14:54:38 | 2020-04-27T16:07:54 | 2020-05-19T14:54:19 | 2020-05-19T14:54:37 | 101,858 | 0 | 0 | 1 |
Java
| false | false |
/**
*
*/
package com.spar.hcl.core.sitemap.dao.impl;
import de.hybris.platform.servicelayer.internal.dao.DefaultGenericDao;
import de.hybris.platform.servicelayer.search.FlexibleSearchQuery;
import de.hybris.platform.servicelayer.search.SearchResult;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.spar.hcl.core.enums.SparSitemapPageType;
import com.spar.hcl.core.sitemap.dao.SparSiteMapListDAO;
import com.spar.hcl.deliveryslot.model.SparSiteMapModel;
/**
* @author jitendriya.m
*
*/
public class SparSiteMapListDAOImpl extends DefaultGenericDao<SparSiteMapModel> implements SparSiteMapListDAO
{
private static final String REF_QUERY_PARAM_PAGETYPE = "pageType";
private static final String ALL_SITE_MAP_LIST = "select {sm.pk} from {SparSiteMap as sm join SparSitemapPageType as smpe on {sm.pageType}={smpe.pk} } where {smpe.code}=?pageType and {sm.visible}=TRUE";
public SparSiteMapListDAOImpl()
{
super(SparSitemapPageType._TYPECODE);
}
/*
* (non-Javadoc)
*
* @see
* com.spar.hcl.core.sitemap.dao.SparSiteMapListDAO#getAllListOnAreaType(com.spar.hcl.core.enums.SparSitemapPageType)
*/
@Override
public List<SparSiteMapModel> getAllSiteMapByPageType(final String pageType)
{
List<SparSiteMapModel> list = null;
try
{
final FlexibleSearchQuery flexibleSearchQuery = new FlexibleSearchQuery(ALL_SITE_MAP_LIST);
final Map<String, Object> params = new HashMap<String, Object>();
flexibleSearchQuery.addQueryParameter(REF_QUERY_PARAM_PAGETYPE, pageType);// it works
flexibleSearchQuery.addQueryParameters(params);
final SearchResult<SparSiteMapModel> searchResult = getFlexibleSearchService().search(flexibleSearchQuery);
list = searchResult.getResult();
}
catch (final Exception e)
{
//LOG.debug("No warehouse found. Error while retrieving the warehouse " + e.getMessage());
}
return list;
}
}
|
UTF-8
|
Java
| 1,906 |
java
|
SparSiteMapListDAOImpl.java
|
Java
|
[
{
"context": "iveryslot.model.SparSiteMapModel;\n\n\n/**\n * @author jitendriya.m\n *\n */\npublic class SparSiteMapListDAOImpl extend",
"end": 522,
"score": 0.9924032092094421,
"start": 510,
"tag": "USERNAME",
"value": "jitendriya.m"
}
] | null |
[] |
/**
*
*/
package com.spar.hcl.core.sitemap.dao.impl;
import de.hybris.platform.servicelayer.internal.dao.DefaultGenericDao;
import de.hybris.platform.servicelayer.search.FlexibleSearchQuery;
import de.hybris.platform.servicelayer.search.SearchResult;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.spar.hcl.core.enums.SparSitemapPageType;
import com.spar.hcl.core.sitemap.dao.SparSiteMapListDAO;
import com.spar.hcl.deliveryslot.model.SparSiteMapModel;
/**
* @author jitendriya.m
*
*/
public class SparSiteMapListDAOImpl extends DefaultGenericDao<SparSiteMapModel> implements SparSiteMapListDAO
{
private static final String REF_QUERY_PARAM_PAGETYPE = "pageType";
private static final String ALL_SITE_MAP_LIST = "select {sm.pk} from {SparSiteMap as sm join SparSitemapPageType as smpe on {sm.pageType}={smpe.pk} } where {smpe.code}=?pageType and {sm.visible}=TRUE";
public SparSiteMapListDAOImpl()
{
super(SparSitemapPageType._TYPECODE);
}
/*
* (non-Javadoc)
*
* @see
* com.spar.hcl.core.sitemap.dao.SparSiteMapListDAO#getAllListOnAreaType(com.spar.hcl.core.enums.SparSitemapPageType)
*/
@Override
public List<SparSiteMapModel> getAllSiteMapByPageType(final String pageType)
{
List<SparSiteMapModel> list = null;
try
{
final FlexibleSearchQuery flexibleSearchQuery = new FlexibleSearchQuery(ALL_SITE_MAP_LIST);
final Map<String, Object> params = new HashMap<String, Object>();
flexibleSearchQuery.addQueryParameter(REF_QUERY_PARAM_PAGETYPE, pageType);// it works
flexibleSearchQuery.addQueryParameters(params);
final SearchResult<SparSiteMapModel> searchResult = getFlexibleSearchService().search(flexibleSearchQuery);
list = searchResult.getResult();
}
catch (final Exception e)
{
//LOG.debug("No warehouse found. Error while retrieving the warehouse " + e.getMessage());
}
return list;
}
}
| 1,906 | 0.768625 | 0.768625 | 66 | 27.878788 | 39.388321 | 202 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.19697 | false | false |
9
|
8170cb2f4d0e88f3c57bbb5ec8fc28b0e480d5b2
| 10,634,339,074,635 |
c8cdff97fb4b6ce366bb6ab9adaff866b761a791
|
/src/Array2Practise/Zoo.java
|
2bed0ab68f0a91fe09c0d7bc1886e8c2643e08a6
|
[] |
no_license
|
SDET222/java-programmingC
|
https://github.com/SDET222/java-programmingC
|
6a50c147f526f60382c8febfe68c1a1c7f2921b2
|
f6098a8a3ff2412135120efde901ab3ac558c362
|
refs/heads/master
| 2023-06-22T00:48:25.451000 | 2021-07-26T23:51:53 | 2021-07-26T23:51:53 | 366,196,266 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package Array2Practise;
import java.util.*;
public class Zoo {
public static void main(String[] args) {
String[] arr1 = {"Tiger", "Lion", "Monkey", "Turtle", "Corcodile"};
String [] arr2 = {"Eagle", "Ducks", "Peacock","Chicken"};
String [][] zoo = {arr1,arr2};
System.out.println(Arrays.deepToString(zoo));
System.out.println("==========================================");
String a = "Chicken from zoo";
System.out.println(a.substring(0,a.indexOf(" ")));
}
}
|
UTF-8
|
Java
| 536 |
java
|
Zoo.java
|
Java
|
[] | null |
[] |
package Array2Practise;
import java.util.*;
public class Zoo {
public static void main(String[] args) {
String[] arr1 = {"Tiger", "Lion", "Monkey", "Turtle", "Corcodile"};
String [] arr2 = {"Eagle", "Ducks", "Peacock","Chicken"};
String [][] zoo = {arr1,arr2};
System.out.println(Arrays.deepToString(zoo));
System.out.println("==========================================");
String a = "Chicken from zoo";
System.out.println(a.substring(0,a.indexOf(" ")));
}
}
| 536 | 0.520522 | 0.509328 | 26 | 19.615385 | 25.878529 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.692308 | false | false |
9
|
ca8c12e1cc58115926a9204f9c0b7b69b13dc015
| 29,248,727,298,630 |
8a6766a23c06233fc5c6550a869af550a2e9519e
|
/app/src/main/java/com/dream/fishbonelsy/tooldatamanager/adapter/AbsRecyclerViewAdapter.java
|
aa0b72b6f164e9c5ed13f3a20512199404203bc9
|
[] |
no_license
|
Fishbonelsy/ToolDataManager
|
https://github.com/Fishbonelsy/ToolDataManager
|
21e57d41b3302aeab9d313ec6799310fbda4a9d0
|
f7988babc59444620baaaed7606e3c66f4cea72a
|
refs/heads/master
| 2016-09-19T18:07:56.219000 | 2016-09-19T15:19:53 | 2016-09-19T15:19:53 | 66,567,923 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.dream.fishbonelsy.tooldatamanager.adapter;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import com.dream.fishbonelsy.tooldatamanager.datamanager.AbsDataManager;
/**
* Created by fishboneLsy on 2016/7/8.
*/
public abstract class AbsRecyclerViewAdapter extends RecyclerView.Adapter {
Context mContext;
AbsDataManager mDataManager;
public void registerDataManager(AbsDataManager dataManager){
mDataManager = dataManager;
}
public void unregisterDataManager(AbsDataManager dataManager){
mDataManager = null;
}
}
|
UTF-8
|
Java
| 603 |
java
|
AbsRecyclerViewAdapter.java
|
Java
|
[
{
"context": "ger.datamanager.AbsDataManager;\n\n/**\n * Created by fishboneLsy on 2016/7/8.\n */\npublic abstract class AbsRecycle",
"end": 239,
"score": 0.9997109174728394,
"start": 228,
"tag": "USERNAME",
"value": "fishboneLsy"
}
] | null |
[] |
package com.dream.fishbonelsy.tooldatamanager.adapter;
import android.content.Context;
import android.support.v7.widget.RecyclerView;
import com.dream.fishbonelsy.tooldatamanager.datamanager.AbsDataManager;
/**
* Created by fishboneLsy on 2016/7/8.
*/
public abstract class AbsRecyclerViewAdapter extends RecyclerView.Adapter {
Context mContext;
AbsDataManager mDataManager;
public void registerDataManager(AbsDataManager dataManager){
mDataManager = dataManager;
}
public void unregisterDataManager(AbsDataManager dataManager){
mDataManager = null;
}
}
| 603 | 0.771144 | 0.759536 | 24 | 24.125 | 26.038933 | 75 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.333333 | false | false |
9
|
467e73603f5f84a8f477d8516ae16bed6c5c7285
| 29,248,727,296,228 |
2380fd836c37a8347ed8f1835fc2c5811c61c20b
|
/src/main/java/net/floodlightcontroller/egp/controller/ServerThread.java
|
0d32c7629c5412517f1dc62e94ba84253b12e06e
|
[
"Apache-2.0"
] |
permissive
|
zhangkeyao/bgp-floodlight
|
https://github.com/zhangkeyao/bgp-floodlight
|
1b05ceb14baaf75e5c4259fc936f2ea7f1a86099
|
255c4af39a46e7ceb288f20a6cd6f5552796290e
|
refs/heads/master
| 2020-09-27T09:02:24.916000 | 2016-09-09T11:41:28 | 2016-09-09T11:41:28 | 67,788,667 | 1 | 2 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package net.floodlightcontroller.egp.controller;
import java.lang.Runnable;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ServerThread implements Runnable{
private static Logger logger = LoggerFactory.getLogger("egp.controller.ServerThread");
int localPort;
List<RemoteController> listController;
ServerSocket serverSocket;
ServerThread(int localPort, List<RemoteController> listController) {
this.localPort = localPort;
this.listController = listController;
}
public void run() {
logger.info("Server thread running...");
try {
serverSocket = new ServerSocket(localPort);
Socket socket = null;
while (true) {
try {
socket = serverSocket.accept();
logger.info("Accept from " + socket.getInetAddress().getHostAddress());
new Thread(new OpenThread(socket, listController)).start();
} catch (Exception e) {
logger.error(e.toString());
}
}
} catch (Exception e){
logger.error(e.toString());
return ;
}
}
}
|
UTF-8
|
Java
| 1,293 |
java
|
ServerThread.java
|
Java
|
[] | null |
[] |
package net.floodlightcontroller.egp.controller;
import java.lang.Runnable;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ServerThread implements Runnable{
private static Logger logger = LoggerFactory.getLogger("egp.controller.ServerThread");
int localPort;
List<RemoteController> listController;
ServerSocket serverSocket;
ServerThread(int localPort, List<RemoteController> listController) {
this.localPort = localPort;
this.listController = listController;
}
public void run() {
logger.info("Server thread running...");
try {
serverSocket = new ServerSocket(localPort);
Socket socket = null;
while (true) {
try {
socket = serverSocket.accept();
logger.info("Accept from " + socket.getInetAddress().getHostAddress());
new Thread(new OpenThread(socket, listController)).start();
} catch (Exception e) {
logger.error(e.toString());
}
}
} catch (Exception e){
logger.error(e.toString());
return ;
}
}
}
| 1,293 | 0.602475 | 0.600928 | 46 | 27.108696 | 24.120377 | 91 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.521739 | false | false |
9
|
60db230095c1b48adf352dc155aaa68835859e41
| 24,266,565,251,565 |
eb612e4e13f8df44e8dd45716e0fe0977ef4354b
|
/src/com/ibaguo/mqa/intefaces/QuestionToAnswer.java
|
ad6b90dd34c66314406c6bc622f1f826c719ff86
|
[
"Apache-2.0"
] |
permissive
|
Growingluffy/mqa
|
https://github.com/Growingluffy/mqa
|
295d3b2502363cc7b20961c34f5544783a6acb71
|
26c4254175ff0a626296f70fbdb57966e7924459
|
refs/heads/master
| 2020-05-04T17:52:04.734000 | 2016-01-22T08:57:44 | 2016-01-22T08:57:44 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.ibaguo.mqa.intefaces;
import java.util.List;
import com.ibaguo.mqa.json.AskResult;
public interface QuestionToAnswer {
public List<AskResult> makeQa(String q,int size);
}
|
UTF-8
|
Java
| 187 |
java
|
QuestionToAnswer.java
|
Java
|
[] | null |
[] |
package com.ibaguo.mqa.intefaces;
import java.util.List;
import com.ibaguo.mqa.json.AskResult;
public interface QuestionToAnswer {
public List<AskResult> makeQa(String q,int size);
}
| 187 | 0.786096 | 0.786096 | 9 | 19.777779 | 18.701027 | 50 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.666667 | false | false |
9
|
de52021549308980ca3af9f4ddeb0f60ecc1515d
| 16,432,544,906,490 |
14440c57975680a3bcca02635a4f2dc8e6a10f6b
|
/src/JUnitTest/rules/TestFireRule.java
|
9aed8e2e4b5f21f77eb155f1b53bf6c7e49be3d7
|
[] |
no_license
|
Sebastien05/SecurityPartner
|
https://github.com/Sebastien05/SecurityPartner
|
27c9cf34f41c81f893eed0a2a3c3b5da2dfbc95f
|
58240ec222a8c003dbff3327332794c69e71d48d
|
refs/heads/master
| 2022-09-06T21:22:19.293000 | 2020-06-01T15:57:06 | 2020-06-01T15:57:06 | 263,576,597 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package JUnitTest.rules;
import org.junit.Test;
import Events.Smoke;
import Rules.FireRule;
import components.correlators.managingelement.EventBase;
import interfaces.event.AbstractAtomicEvent;
public class TestFireRule {
@Test
public void test() {
EventBase b = new EventBase();
FireRule fr = new FireRule();
Smoke smoke = new Smoke("401");
smoke.putproperty(AbstractAtomicEvent.TYPE_PROPERTY, "smoke");
smoke.displayProperties();
b.getEventBase().add(smoke);
assert b.numberOfEvents() == 1;
try {
fr.executeOn(b);
} catch (Exception e) {
e.printStackTrace();
}
assert b.numberOfEvents() == 0;
}
}
|
UTF-8
|
Java
| 647 |
java
|
TestFireRule.java
|
Java
|
[] | null |
[] |
package JUnitTest.rules;
import org.junit.Test;
import Events.Smoke;
import Rules.FireRule;
import components.correlators.managingelement.EventBase;
import interfaces.event.AbstractAtomicEvent;
public class TestFireRule {
@Test
public void test() {
EventBase b = new EventBase();
FireRule fr = new FireRule();
Smoke smoke = new Smoke("401");
smoke.putproperty(AbstractAtomicEvent.TYPE_PROPERTY, "smoke");
smoke.displayProperties();
b.getEventBase().add(smoke);
assert b.numberOfEvents() == 1;
try {
fr.executeOn(b);
} catch (Exception e) {
e.printStackTrace();
}
assert b.numberOfEvents() == 0;
}
}
| 647 | 0.704791 | 0.697063 | 34 | 18.058823 | 16.942709 | 64 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.647059 | false | false |
9
|
96eefc7a32bb8a07fdc3f9c6149841acfd777a4f
| 2,791,728,787,497 |
a8ced7641ac7ce887e5154a12a33644d7848d9f4
|
/TP3-IntroduccionAJava/src/unq/Counter.java
|
b96f776d726d292bee1e8d4561b46b66bcadd41f
|
[] |
no_license
|
RoxanaCamara/PracticasPatronesObjetos0.2
|
https://github.com/RoxanaCamara/PracticasPatronesObjetos0.2
|
10ea26e8cfc264bfa7dc3b88ff0989d9a49188ee
|
ef152e9fd087576dccbd07a8bf9ae5626ef6cffb
|
refs/heads/master
| 2020-12-21T22:26:26.438000 | 2020-01-27T20:14:23 | 2020-01-27T20:14:23 | 236,582,635 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package unq;
import java.util.ArrayList;
public class Counter {
private ArrayList<Integer> listaNros = new ArrayList<Integer>();
public void addNumber(Integer numero) {
listaNros.add(numero);
}
public int getPares() {
ArrayList<Integer> numerosPares = new ArrayList<Integer>();
for( Integer nro : listaNros){
if( nro % 2 == 0) {
numerosPares.add(nro);
}
}
return numerosPares.size();
}
public int getImpares() {
ArrayList<Integer> numerosImpares = new ArrayList<Integer>();
for( Integer nro : listaNros){
if( nro % 2 != 0) {
numerosImpares.add(nro);
}
}
return numerosImpares.size();
}
public int getMultiplosDe( Integer numero) {
ArrayList<Integer> numerosMultiplos = new ArrayList<Integer>();
for( Integer nro : listaNros){
if( nro % numero == 0) {
numerosMultiplos.add(nro);
}
}
return numerosMultiplos.size();
}
public int getSumaDeTodosLosNumeros() {
Integer numeroTotal = 0;
for( Integer nro : listaNros){
numeroTotal += nro;
}
return numeroTotal;
}
public int getRestaDeTodosLosNumeros() {
Integer numeroTotal = 0;
for( Integer nro : listaNros){
numeroTotal -= nro ;
}
return numeroTotal;
}
public int getMultiplicacionDeTodosLosNumeros() {
Integer numeroTotal = 1;
for( Integer nro : listaNros){
numeroTotal *= nro ;
}
return numeroTotal;
}
}
|
UTF-8
|
Java
| 1,373 |
java
|
Counter.java
|
Java
|
[] | null |
[] |
package unq;
import java.util.ArrayList;
public class Counter {
private ArrayList<Integer> listaNros = new ArrayList<Integer>();
public void addNumber(Integer numero) {
listaNros.add(numero);
}
public int getPares() {
ArrayList<Integer> numerosPares = new ArrayList<Integer>();
for( Integer nro : listaNros){
if( nro % 2 == 0) {
numerosPares.add(nro);
}
}
return numerosPares.size();
}
public int getImpares() {
ArrayList<Integer> numerosImpares = new ArrayList<Integer>();
for( Integer nro : listaNros){
if( nro % 2 != 0) {
numerosImpares.add(nro);
}
}
return numerosImpares.size();
}
public int getMultiplosDe( Integer numero) {
ArrayList<Integer> numerosMultiplos = new ArrayList<Integer>();
for( Integer nro : listaNros){
if( nro % numero == 0) {
numerosMultiplos.add(nro);
}
}
return numerosMultiplos.size();
}
public int getSumaDeTodosLosNumeros() {
Integer numeroTotal = 0;
for( Integer nro : listaNros){
numeroTotal += nro;
}
return numeroTotal;
}
public int getRestaDeTodosLosNumeros() {
Integer numeroTotal = 0;
for( Integer nro : listaNros){
numeroTotal -= nro ;
}
return numeroTotal;
}
public int getMultiplicacionDeTodosLosNumeros() {
Integer numeroTotal = 1;
for( Integer nro : listaNros){
numeroTotal *= nro ;
}
return numeroTotal;
}
}
| 1,373 | 0.670794 | 0.664967 | 66 | 19.80303 | 17.939478 | 65 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.969697 | false | false |
9
|
c75d32f42ffd7b6ed560ae56ea221d629ed83360
| 6,786,048,354,745 |
d967a04d400b3e7ec5db559aee120b3a01e4b6cc
|
/src/main/java/ru/geekportal/portal/entity/test/Test.java
|
4f547d0c6de10589f320eee5e9d499d94b071ff6
|
[] |
no_license
|
GantZo/study-portal
|
https://github.com/GantZo/study-portal
|
aedd160a64cb73c1303232aadf07fbb9664c199d
|
60ccb65afde9c0bfa4e94af735da2de8851b93d3
|
refs/heads/master
| 2018-07-04T17:52:37.061000 | 2018-06-06T21:16:55 | 2018-06-06T21:16:55 | 109,139,744 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package ru.geekportal.portal.entity.test;
import javax.persistence.*;
import java.util.List;
@Entity
@Table(name = "tests")
public class Test {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
private String title;
private String description;
@ManyToMany(cascade = CascadeType.ALL)
@JoinTable(name = "tests_groups_join",
joinColumns = @JoinColumn(name = "test_id"),
inverseJoinColumns = @JoinColumn(name = "test_group_id"))
private List<TestGroup> testGroups;
private long timeToPass;
private short pointsToPass;
public Test() {}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public List<TestGroup> getTestGroups() {
return testGroups;
}
public void setTestGroups(List<TestGroup> testGroups) {
this.testGroups = testGroups;
}
public long getTimeToPass() {
return timeToPass;
}
public void setTimeToPass(long timeToPass) {
this.timeToPass = timeToPass;
}
public short getPointsToPass() {
return pointsToPass;
}
public void setPointsToPass(short pointsToPass) {
this.pointsToPass = pointsToPass;
}
}
|
UTF-8
|
Java
| 1,575 |
java
|
Test.java
|
Java
|
[] | null |
[] |
package ru.geekportal.portal.entity.test;
import javax.persistence.*;
import java.util.List;
@Entity
@Table(name = "tests")
public class Test {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
private String title;
private String description;
@ManyToMany(cascade = CascadeType.ALL)
@JoinTable(name = "tests_groups_join",
joinColumns = @JoinColumn(name = "test_id"),
inverseJoinColumns = @JoinColumn(name = "test_group_id"))
private List<TestGroup> testGroups;
private long timeToPass;
private short pointsToPass;
public Test() {}
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public List<TestGroup> getTestGroups() {
return testGroups;
}
public void setTestGroups(List<TestGroup> testGroups) {
this.testGroups = testGroups;
}
public long getTimeToPass() {
return timeToPass;
}
public void setTimeToPass(long timeToPass) {
this.timeToPass = timeToPass;
}
public short getPointsToPass() {
return pointsToPass;
}
public void setPointsToPass(short pointsToPass) {
this.pointsToPass = pointsToPass;
}
}
| 1,575 | 0.633016 | 0.633016 | 75 | 20 | 18.634735 | 69 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.306667 | false | false |
9
|
39bbf3a9ff1ede6c1c7de332f15e9a4950132f5c
| 11,201,274,742,317 |
15244cf1672a5578cbbf7f785e9bead1b031ab15
|
/app/src/free/java/com/example/f3838284/kwanda/ToastListener.java
|
274911d3b389e8fa13eca6f775c8359b513676b3
|
[] |
no_license
|
13natty/Kwanda
|
https://github.com/13natty/Kwanda
|
7dbd21e59ba916588dee9033a3fd999a6c5764a7
|
4f06709a09adcf9ef2ff1450d9ccac08f6ba20db
|
refs/heads/master
| 2020-04-06T04:40:50.635000 | 2016-11-03T07:41:42 | 2016-11-03T07:41:42 | 68,713,817 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.f3838284.kwanda;
import android.content.Context;
import android.net.Network;
import android.widget.Toast;
import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.AdRequest;
/**
* Created by F3838284 on 10/19/2016.
*/
public class ToastListener extends AdListener {
Context context;
String mFailedReason;
public ToastListener(Context context){
this.context = context;
}
@Override
public void onAdClosed() {
super.onAdClosed();
Toast.makeText(context, "Ad closed", Toast.LENGTH_LONG).show();
}
@Override
public void onAdFailedToLoad(int i) {
super.onAdFailedToLoad(i);
switch (i){
case AdRequest.ERROR_CODE_INTERNAL_ERROR:
mFailedReason = "Internal Error";
break;
case AdRequest.ERROR_CODE_INVALID_REQUEST:
mFailedReason = "Invalid Request";
break;
case AdRequest.ERROR_CODE_NETWORK_ERROR:
mFailedReason = "Network Error";
break;
case AdRequest.ERROR_CODE_NO_FILL:
mFailedReason = "No Fill";
break;
}
Toast.makeText(context, "Ad Failed To Load, "+mFailedReason, Toast.LENGTH_LONG).show();
}
@Override
public void onAdLeftApplication() {
super.onAdLeftApplication();
Toast.makeText(context, "Ad Left Application", Toast.LENGTH_LONG).show();
}
@Override
public void onAdLoaded() {
super.onAdLoaded();
Toast.makeText(context, "Ad Loaded", Toast.LENGTH_LONG).show();
}
@Override
public void onAdOpened() {
super.onAdOpened();
Toast.makeText(context, "Ad Opened", Toast.LENGTH_LONG).show();
}
public String getFailedReason(){
return mFailedReason==null?"":mFailedReason;
}
}
|
UTF-8
|
Java
| 1,897 |
java
|
ToastListener.java
|
Java
|
[
{
"context": "package com.example.f3838284.kwanda;\n\nimport android.content.Context;\nimport a",
"end": 28,
"score": 0.9884268641471863,
"start": 20,
"tag": "USERNAME",
"value": "f3838284"
},
{
"context": "ogle.android.gms.ads.AdRequest;\n\n/**\n * Created by F3838284 on 10/19/2016.\n */\n\npublic class ToastListener ex",
"end": 246,
"score": 0.9994441270828247,
"start": 238,
"tag": "USERNAME",
"value": "F3838284"
}
] | null |
[] |
package com.example.f3838284.kwanda;
import android.content.Context;
import android.net.Network;
import android.widget.Toast;
import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.AdRequest;
/**
* Created by F3838284 on 10/19/2016.
*/
public class ToastListener extends AdListener {
Context context;
String mFailedReason;
public ToastListener(Context context){
this.context = context;
}
@Override
public void onAdClosed() {
super.onAdClosed();
Toast.makeText(context, "Ad closed", Toast.LENGTH_LONG).show();
}
@Override
public void onAdFailedToLoad(int i) {
super.onAdFailedToLoad(i);
switch (i){
case AdRequest.ERROR_CODE_INTERNAL_ERROR:
mFailedReason = "Internal Error";
break;
case AdRequest.ERROR_CODE_INVALID_REQUEST:
mFailedReason = "Invalid Request";
break;
case AdRequest.ERROR_CODE_NETWORK_ERROR:
mFailedReason = "Network Error";
break;
case AdRequest.ERROR_CODE_NO_FILL:
mFailedReason = "No Fill";
break;
}
Toast.makeText(context, "Ad Failed To Load, "+mFailedReason, Toast.LENGTH_LONG).show();
}
@Override
public void onAdLeftApplication() {
super.onAdLeftApplication();
Toast.makeText(context, "Ad Left Application", Toast.LENGTH_LONG).show();
}
@Override
public void onAdLoaded() {
super.onAdLoaded();
Toast.makeText(context, "Ad Loaded", Toast.LENGTH_LONG).show();
}
@Override
public void onAdOpened() {
super.onAdOpened();
Toast.makeText(context, "Ad Opened", Toast.LENGTH_LONG).show();
}
public String getFailedReason(){
return mFailedReason==null?"":mFailedReason;
}
}
| 1,897 | 0.614128 | 0.60253 | 69 | 26.492754 | 22.461319 | 95 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.565217 | false | false |
9
|
e28da8bf07c95613ebb9a2aca62bacb5937aa4eb
| 19,653,770,401,312 |
7ee3475af07ddc708efc1a5ea7987752ca1e57cc
|
/android/src/main/kotlin/com/sctuopuyi/packageinfos/updateApk/Updater.java
|
f8ef28b179ab8e4ed478e19a5f8d9a5d91593e90
|
[] |
no_license
|
haibinpark/packageinfo
|
https://github.com/haibinpark/packageinfo
|
be798234405557b8ded54f1fe408a96afe1e8173
|
e18c96fdf9fa709d880ad90bbe2b464bb4eca337
|
refs/heads/master
| 2022-12-13T18:53:16.003000 | 2020-09-14T01:57:23 | 2020-09-14T01:57:23 | 294,649,125 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.sctuopuyi.packageinfos.updateApk;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.ref.WeakReference;
import java.util.List;
import java.util.Locale;
import androidx.appcompat.app.AlertDialog;
import androidx.core.content.FileProvider;
import com.sctuopuyi.packageinfos.R;
import okhttp3.Response;
import okhttp3.ResponseBody;
import rx.android.schedulers.AndroidSchedulers;
import rx.exceptions.Exceptions;
import rx.functions.Action1;
import rx.functions.Func1;
import rx.schedulers.Schedulers;
/**
* Created by fengmlo on 2018/3/1.
*/
public class Updater {
private static WeakReference<AlertDialog> updateDialog;
private static WeakReference<AlertDialog> downloadDialog;
public static void check(final Context context, final String url, final CheckUpdateRequest request,final String packageName) {
if (downloadDialog != null && downloadDialog.get() != null) return;
Net.init(context, url,packageName);
Net.getInstance().checkUpdate(request.toQueryMap())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Action1<BaseHttpResponse<CheckUpdateResponse>>() {
@Override
public void call(BaseHttpResponse<CheckUpdateResponse> checkUpdateResponseBaseHttpResponse) {
if (checkUpdateResponseBaseHttpResponse.getCode() == 0) {
CheckUpdateResponse result = checkUpdateResponseBaseHttpResponse.getResult();
if (result == null) {
// Toast.makeText(context, "已经是最新版本了", Toast.LENGTH_SHORT).show();
} else if (result.getVersionCode() > request.getVersionCode()) {
showUpdateDialog(context, result);
}
}
}
}, new Action1<Throwable>() {
@Override
public void call(Throwable throwable) {
throwable.printStackTrace();
Toast.makeText(context, "检查更新失败", Toast.LENGTH_SHORT).show();
}
});
}
public static void check(final Context context, final String url, final CheckUpdateRequest request, final CheckUpdateListener listener,final String packageTag) {
if (listener == null) return;
Net.init(context, url,packageTag);
Net.getInstance().checkUpdate(request.toQueryMap())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Action1<BaseHttpResponse<CheckUpdateResponse>>() {
@Override
public void call(BaseHttpResponse<CheckUpdateResponse> checkUpdateResponseBaseHttpResponse) {
if (checkUpdateResponseBaseHttpResponse.getCode() == 0) {
CheckUpdateResponse result = checkUpdateResponseBaseHttpResponse.getResult();
if (result == null) {
// Toast.makeText(context, "已经是最新版本了", Toast.LENGTH_SHORT).show();
listener.onCheckUpdate(false, null);
} else if (result.getVersionCode() > request.getVersionCode()) {
// showUpdateDialog(context, result);
listener.onCheckUpdate(true, result);
}
}
}
}, new Action1<Throwable>() {
@Override
public void call(Throwable throwable) {
throwable.printStackTrace();
Toast.makeText(context, "检查更新失败", Toast.LENGTH_SHORT).show();
}
});
}
public static void showUpdateDialog(final Context context, final CheckUpdateResponse checkUpdateResponse) {
AlertDialog oldDialog;
if (updateDialog != null
&& (oldDialog = updateDialog.get()) != null
&& oldDialog.isShowing()) {
oldDialog.dismiss();
}
String message = "版本名称:" + checkUpdateResponse.getVersion() + "\n" +
"文件大小:" + String.format(Locale.getDefault(), "%.2fMB", checkUpdateResponse.getFileSizeBytes() / (1024.0f * 1024.0f)) + "\n" +
"更新日期:" + checkUpdateResponse.getCurrentVersionReleaseDate() + "\n" +
"更新日志:" + "\n" +
checkUpdateResponse.getReleaseNotes();
final boolean isForce = "1".equals(checkUpdateResponse.getUpdateStrategy());
AlertDialog.Builder builder = new AlertDialog.Builder(context)
.setTitle("有新的版本")
.setMessage(message)
.setPositiveButton("更新", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
showDownloadDialog(context, checkUpdateResponse.getUpdateUrl(), isForce);
}
});
if (isForce) {
builder.setCancelable(false);
} else {
builder.setCancelable(true)
.setNegativeButton("暂不更新", null);
}
final AlertDialog alertDialog = builder.show();
if ("1".equals(checkUpdateResponse.getUpdateMode())) {
alertDialog.getButton(DialogInterface.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Uri uri = Uri.parse(checkUpdateResponse.getUpdateUrl());
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
if (isIntentAvailable(context, intent)) {
context.startActivity(intent);
} else {
Toast.makeText(context, "没有可用的浏览器", Toast.LENGTH_SHORT).show();
}
if (!isForce) alertDialog.dismiss();
}
});
}
Updater.updateDialog = new WeakReference<>(alertDialog);
}
public static void showDownloadDialog(final Context context, String url, final boolean isForce) {
View view = LayoutInflater.from(context).inflate(R.layout.dialog_porgress, new LinearLayout(context), false);
final ProgressBar progressBar = view.findViewById(R.id.pb_progress);
final TextView tvProgress = view.findViewById(R.id.tv_progress);
final AlertDialog dialog = new AlertDialog.Builder(context)
.setTitle("正在更新...")
.setView(view)
.setCancelable(false)
.show();
downloadDialog = new WeakReference<>(dialog);
final Handler handler = new Handler(Looper.getMainLooper());
ProgressListener progressListener = new ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, final boolean done) {
// Logger.d("bytesRead: " + bytesRead + "contentLength: " + contentLength + "done: " + done);
final float progress = bytesRead * 100.0f / contentLength;
handler.post(new Runnable() {
@Override
public void run() {
progressBar.setProgress((int) progress);
tvProgress.setText(String.format(Locale.getDefault(), "%.2f%%", progress));
if (done) {
dialog.dismiss();
}
}
});
}
};
updateApp(context, url, isForce, progressListener);
}
public static void updateApp(final Context context, String url, final boolean isForce, ProgressListener progressListener) {
FileDownloader.download(url, progressListener)
.map(new Func1<Response, File>() {
@Override
public File call(Response response) {
try {
return saveFile(response, context);
} catch (IOException e) {
throw Exceptions.propagate(e);
}
}
})
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Action1<File>() {
@Override
public void call(File file) {
if (file != null) {
install(context, file, isForce);
} else {
downloadFail(context, isForce);
}
}
}, new Action1<Throwable>() {
@Override
public void call(Throwable throwable) {
throwable.printStackTrace();
downloadFail(context, isForce);
}
});
}
private static void downloadFail(Context context, final boolean isForce) {
AlertDialog dialog;
if (downloadDialog != null && (dialog = downloadDialog.get()) != null) {
dialog.dismiss();
}
Toast.makeText(context, isForce ? "下载文件出错,即将退出" : "下载文件出错", Toast.LENGTH_SHORT).show();
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
@Override
public void run() {
if (isForce) {
System.exit(0);
}
}
}, 2000);
}
private static File saveFile(Response response, Context context) throws IOException {
ResponseBody responseBody = response.body();
ensureExternalCacheDir(context);
File appFile = new File(context.getExternalCacheDir(), context.getPackageName() + ".apk");
InputStream inputStream = null;
OutputStream outputStream = null;
try {
byte[] cache = new byte[4096];
inputStream = responseBody.byteStream();
outputStream = new FileOutputStream(appFile);
int read;
while ((read = inputStream.read(cache)) > 0) {
outputStream.write(cache, 0, read);
}
outputStream.flush();
return appFile;
} catch (IOException e) {
e.printStackTrace();
throw e;
} finally {
try {
if (inputStream != null) {
inputStream.close();
}
} catch (Exception ignored) {
}
try {
if (outputStream != null) {
outputStream.close();
}
} catch (Exception ignored) {
}
}
}
public static void install(Context context, File file, boolean force) {
Intent intent = new Intent(Intent.ACTION_VIEW);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
} else {
Uri uri = FileProvider.getUriForFile(context, context.getPackageName() + ".downloadedfileprovider", file);
intent.setDataAndType(uri, "application/vnd.android.package-archive");
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
}
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
// if (force) {
// System.exit(0);
// }
}
private static void ensureExternalCacheDir(Context context) {
File file = context.getExternalCacheDir();
if (file == null) {
file = new File(context.getExternalFilesDir("").getParentFile(), "cache");
}
if (file != null) {
file.mkdirs();
}
}
private static boolean isIntentAvailable(Context context, Intent intent) {
final PackageManager packageManager = context.getPackageManager();
List<ResolveInfo> list = packageManager.queryIntentActivities(intent,
PackageManager.GET_RESOLVED_FILTER);
return list.size() > 0;
}
}
|
UTF-8
|
Java
| 13,171 |
java
|
Updater.java
|
Java
|
[
{
"context": "mport rx.schedulers.Schedulers;\n\n/**\n * Created by fengmlo on 2018/3/1.\n */\n\npublic class Updater {\n\n pri",
"end": 1127,
"score": 0.9997138977050781,
"start": 1120,
"tag": "USERNAME",
"value": "fengmlo"
}
] | null |
[] |
package com.sctuopuyi.packageinfos.updateApk;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.net.Uri;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.TextView;
import android.widget.Toast;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.ref.WeakReference;
import java.util.List;
import java.util.Locale;
import androidx.appcompat.app.AlertDialog;
import androidx.core.content.FileProvider;
import com.sctuopuyi.packageinfos.R;
import okhttp3.Response;
import okhttp3.ResponseBody;
import rx.android.schedulers.AndroidSchedulers;
import rx.exceptions.Exceptions;
import rx.functions.Action1;
import rx.functions.Func1;
import rx.schedulers.Schedulers;
/**
* Created by fengmlo on 2018/3/1.
*/
public class Updater {
private static WeakReference<AlertDialog> updateDialog;
private static WeakReference<AlertDialog> downloadDialog;
public static void check(final Context context, final String url, final CheckUpdateRequest request,final String packageName) {
if (downloadDialog != null && downloadDialog.get() != null) return;
Net.init(context, url,packageName);
Net.getInstance().checkUpdate(request.toQueryMap())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Action1<BaseHttpResponse<CheckUpdateResponse>>() {
@Override
public void call(BaseHttpResponse<CheckUpdateResponse> checkUpdateResponseBaseHttpResponse) {
if (checkUpdateResponseBaseHttpResponse.getCode() == 0) {
CheckUpdateResponse result = checkUpdateResponseBaseHttpResponse.getResult();
if (result == null) {
// Toast.makeText(context, "已经是最新版本了", Toast.LENGTH_SHORT).show();
} else if (result.getVersionCode() > request.getVersionCode()) {
showUpdateDialog(context, result);
}
}
}
}, new Action1<Throwable>() {
@Override
public void call(Throwable throwable) {
throwable.printStackTrace();
Toast.makeText(context, "检查更新失败", Toast.LENGTH_SHORT).show();
}
});
}
public static void check(final Context context, final String url, final CheckUpdateRequest request, final CheckUpdateListener listener,final String packageTag) {
if (listener == null) return;
Net.init(context, url,packageTag);
Net.getInstance().checkUpdate(request.toQueryMap())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Action1<BaseHttpResponse<CheckUpdateResponse>>() {
@Override
public void call(BaseHttpResponse<CheckUpdateResponse> checkUpdateResponseBaseHttpResponse) {
if (checkUpdateResponseBaseHttpResponse.getCode() == 0) {
CheckUpdateResponse result = checkUpdateResponseBaseHttpResponse.getResult();
if (result == null) {
// Toast.makeText(context, "已经是最新版本了", Toast.LENGTH_SHORT).show();
listener.onCheckUpdate(false, null);
} else if (result.getVersionCode() > request.getVersionCode()) {
// showUpdateDialog(context, result);
listener.onCheckUpdate(true, result);
}
}
}
}, new Action1<Throwable>() {
@Override
public void call(Throwable throwable) {
throwable.printStackTrace();
Toast.makeText(context, "检查更新失败", Toast.LENGTH_SHORT).show();
}
});
}
public static void showUpdateDialog(final Context context, final CheckUpdateResponse checkUpdateResponse) {
AlertDialog oldDialog;
if (updateDialog != null
&& (oldDialog = updateDialog.get()) != null
&& oldDialog.isShowing()) {
oldDialog.dismiss();
}
String message = "版本名称:" + checkUpdateResponse.getVersion() + "\n" +
"文件大小:" + String.format(Locale.getDefault(), "%.2fMB", checkUpdateResponse.getFileSizeBytes() / (1024.0f * 1024.0f)) + "\n" +
"更新日期:" + checkUpdateResponse.getCurrentVersionReleaseDate() + "\n" +
"更新日志:" + "\n" +
checkUpdateResponse.getReleaseNotes();
final boolean isForce = "1".equals(checkUpdateResponse.getUpdateStrategy());
AlertDialog.Builder builder = new AlertDialog.Builder(context)
.setTitle("有新的版本")
.setMessage(message)
.setPositiveButton("更新", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
showDownloadDialog(context, checkUpdateResponse.getUpdateUrl(), isForce);
}
});
if (isForce) {
builder.setCancelable(false);
} else {
builder.setCancelable(true)
.setNegativeButton("暂不更新", null);
}
final AlertDialog alertDialog = builder.show();
if ("1".equals(checkUpdateResponse.getUpdateMode())) {
alertDialog.getButton(DialogInterface.BUTTON_POSITIVE).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Uri uri = Uri.parse(checkUpdateResponse.getUpdateUrl());
Intent intent = new Intent(Intent.ACTION_VIEW, uri);
if (isIntentAvailable(context, intent)) {
context.startActivity(intent);
} else {
Toast.makeText(context, "没有可用的浏览器", Toast.LENGTH_SHORT).show();
}
if (!isForce) alertDialog.dismiss();
}
});
}
Updater.updateDialog = new WeakReference<>(alertDialog);
}
public static void showDownloadDialog(final Context context, String url, final boolean isForce) {
View view = LayoutInflater.from(context).inflate(R.layout.dialog_porgress, new LinearLayout(context), false);
final ProgressBar progressBar = view.findViewById(R.id.pb_progress);
final TextView tvProgress = view.findViewById(R.id.tv_progress);
final AlertDialog dialog = new AlertDialog.Builder(context)
.setTitle("正在更新...")
.setView(view)
.setCancelable(false)
.show();
downloadDialog = new WeakReference<>(dialog);
final Handler handler = new Handler(Looper.getMainLooper());
ProgressListener progressListener = new ProgressListener() {
@Override
public void update(long bytesRead, long contentLength, final boolean done) {
// Logger.d("bytesRead: " + bytesRead + "contentLength: " + contentLength + "done: " + done);
final float progress = bytesRead * 100.0f / contentLength;
handler.post(new Runnable() {
@Override
public void run() {
progressBar.setProgress((int) progress);
tvProgress.setText(String.format(Locale.getDefault(), "%.2f%%", progress));
if (done) {
dialog.dismiss();
}
}
});
}
};
updateApp(context, url, isForce, progressListener);
}
public static void updateApp(final Context context, String url, final boolean isForce, ProgressListener progressListener) {
FileDownloader.download(url, progressListener)
.map(new Func1<Response, File>() {
@Override
public File call(Response response) {
try {
return saveFile(response, context);
} catch (IOException e) {
throw Exceptions.propagate(e);
}
}
})
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(new Action1<File>() {
@Override
public void call(File file) {
if (file != null) {
install(context, file, isForce);
} else {
downloadFail(context, isForce);
}
}
}, new Action1<Throwable>() {
@Override
public void call(Throwable throwable) {
throwable.printStackTrace();
downloadFail(context, isForce);
}
});
}
private static void downloadFail(Context context, final boolean isForce) {
AlertDialog dialog;
if (downloadDialog != null && (dialog = downloadDialog.get()) != null) {
dialog.dismiss();
}
Toast.makeText(context, isForce ? "下载文件出错,即将退出" : "下载文件出错", Toast.LENGTH_SHORT).show();
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
@Override
public void run() {
if (isForce) {
System.exit(0);
}
}
}, 2000);
}
private static File saveFile(Response response, Context context) throws IOException {
ResponseBody responseBody = response.body();
ensureExternalCacheDir(context);
File appFile = new File(context.getExternalCacheDir(), context.getPackageName() + ".apk");
InputStream inputStream = null;
OutputStream outputStream = null;
try {
byte[] cache = new byte[4096];
inputStream = responseBody.byteStream();
outputStream = new FileOutputStream(appFile);
int read;
while ((read = inputStream.read(cache)) > 0) {
outputStream.write(cache, 0, read);
}
outputStream.flush();
return appFile;
} catch (IOException e) {
e.printStackTrace();
throw e;
} finally {
try {
if (inputStream != null) {
inputStream.close();
}
} catch (Exception ignored) {
}
try {
if (outputStream != null) {
outputStream.close();
}
} catch (Exception ignored) {
}
}
}
public static void install(Context context, File file, boolean force) {
Intent intent = new Intent(Intent.ACTION_VIEW);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
} else {
Uri uri = FileProvider.getUriForFile(context, context.getPackageName() + ".downloadedfileprovider", file);
intent.setDataAndType(uri, "application/vnd.android.package-archive");
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
}
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
// if (force) {
// System.exit(0);
// }
}
private static void ensureExternalCacheDir(Context context) {
File file = context.getExternalCacheDir();
if (file == null) {
file = new File(context.getExternalFilesDir("").getParentFile(), "cache");
}
if (file != null) {
file.mkdirs();
}
}
private static boolean isIntentAvailable(Context context, Intent intent) {
final PackageManager packageManager = context.getPackageManager();
List<ResolveInfo> list = packageManager.queryIntentActivities(intent,
PackageManager.GET_RESOLVED_FILTER);
return list.size() > 0;
}
}
| 13,171 | 0.557522 | 0.553675 | 306 | 41.467319 | 30.278025 | 165 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.660131 | false | false |
9
|
9f39cc94c96496421d873521e307152729aabeeb
| 19,774,029,435,202 |
2c4e17124126a41a3ef6611927f0c5ea98afe87d
|
/app/src/main/java/com/yoloo/android/data/feedtypes/BountyButtonFeedItem.java
|
37442d597a312b531a0a285cf67f22388b42a5d7
|
[] |
no_license
|
DuyguKeskek/Yoloo
|
https://github.com/DuyguKeskek/Yoloo
|
abde2e1ffdb9d13b163340a9ad01368915edad1d
|
5d6d82640cbb0178302b38c3b83cf2097fe7c74a
|
refs/heads/master
| 2021-01-20T05:25:34.786000 | 2017-04-29T10:32:16 | 2017-04-29T10:32:16 | 89,778,623 | 1 | 3 | null | true | 2017-04-29T10:31:07 | 2017-04-29T10:31:07 | 2017-04-29T10:31:05 | 2017-04-25T15:34:32 | 80,883 | 0 | 0 | 0 | null | null | null |
package com.yoloo.android.data.feedtypes;
public class BountyButtonFeedItem implements FeedItem {
public BountyButtonFeedItem() {
// empty constructor
}
}
|
UTF-8
|
Java
| 165 |
java
|
BountyButtonFeedItem.java
|
Java
|
[] | null |
[] |
package com.yoloo.android.data.feedtypes;
public class BountyButtonFeedItem implements FeedItem {
public BountyButtonFeedItem() {
// empty constructor
}
}
| 165 | 0.763636 | 0.763636 | 8 | 19.625 | 20.309711 | 55 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.125 | false | false |
9
|
9dc0d228e810465aaf7ec12c0f11fd0254bc3bde
| 29,222,957,519,851 |
fa5c0a09eb3a31d892ec6416459af1b70b009ba4
|
/src/main/java/shoppingMall/ui/cusframe/ProductInfoUI.java
|
80b87703dc71ffb79c0abd29fd2163121537d2f9
|
[] |
no_license
|
taehoon95/shoppingMall
|
https://github.com/taehoon95/shoppingMall
|
ec0d42e7fea8e03f38fbb5bfdf77ff498f8c4bb2
|
410afc8f31878486dfc53c9c93edf880f7170abf
|
refs/heads/master
| 2023-04-10T20:27:38.624000 | 2021-04-28T05:06:36 | 2021-04-28T05:06:36 | 347,588,752 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package shoppingMall.ui.cusframe;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import shoppingMall.dto.Product;
import shoppingMall.exception.InvaildCheckException;
import shoppingMall.exception.sqlException;
import shoppingMall.service.productService;
import shoppingMall.ui.cuspanel.productInfoTablePanel;
import shoppingMall.ui.cuspanel.productInfoPanel;
@SuppressWarnings("serial")
public class ProductInfoUI extends JFrame implements ActionListener {
private JPanel contentPane;
private productInfoPanel pInfo;
private JButton btnCancelProd;
private productInfoTablePanel table;
private JButton btnUpdateProd;
private productService pService;
public ProductInfoUI() {
pService = new productService();
initialize();
}
private void initialize() {
setTitle("제품상세정보");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setBounds(100, 100, 575, 346);
contentPane = new JPanel();
contentPane.setBackground(Color.WHITE);
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(new BorderLayout(0, 0));
pInfo = new productInfoPanel();
contentPane.add(pInfo);
pInfo.setLayout(new GridLayout(0, 2, 0, 0));
JPanel panel = new JPanel();
panel.setBackground(Color.WHITE);
contentPane.add(panel, BorderLayout.SOUTH);
btnUpdateProd = new JButton("수정");
btnUpdateProd.addActionListener(this);
btnUpdateProd.setBackground(Color.GREEN);
panel.add(btnUpdateProd);
btnCancelProd = new JButton("취소");
btnCancelProd.addActionListener(this);
btnCancelProd.setBackground(Color.GREEN);
panel.add(btnCancelProd);
}
public void setDetailItem(Product prod) {
pInfo.setItem(prod);
}
public void prohibitionBtn() {
// pInfo.prohibitionBtn();
}
public void actionPerformed(ActionEvent e) {
if (e.getSource() == btnCancelProd) {
actionPerformedBtnDelProd(e);
}
try {
if (e.getSource() == btnUpdateProd) {
actionPerformedBtnUpdateProd(e);
}
}catch (InvaildCheckException e1) {
JOptionPane.showMessageDialog(null, "공란존재","오류",JOptionPane.ERROR_MESSAGE);
}catch(sqlException e1) {
JOptionPane.showMessageDialog(null, "제품코드 중복", "오류", JOptionPane.ERROR_MESSAGE);
}
}
protected void actionPerformedBtnDelProd(ActionEvent e) {
pInfo.tfClear();
}
protected void actionPerformedBtnUpdateProd(ActionEvent e) {
if(btnUpdateProd.getText().equals("수정")) {
Product modiProd = pInfo.getProd();
pService.modiProduct(modiProd);
table.loadData();
dispose();
}else {
Product prod = pInfo.getProd();
pService.addProduct(prod);
table.loadData();
dispose();
}
}
public JButton getBtnUpdateProd() {
return btnUpdateProd;
}
public void setBtnUpdateProd(JButton btnUpdateProd) {
this.btnUpdateProd = btnUpdateProd;
}
public productInfoPanel getpInfo() {
return pInfo;
}
public void setTable(productInfoTablePanel table) {
this.table = table;
}
}
|
UTF-8
|
Java
| 3,362 |
java
|
ProductInfoUI.java
|
Java
|
[] | null |
[] |
package shoppingMall.ui.cusframe;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import shoppingMall.dto.Product;
import shoppingMall.exception.InvaildCheckException;
import shoppingMall.exception.sqlException;
import shoppingMall.service.productService;
import shoppingMall.ui.cuspanel.productInfoTablePanel;
import shoppingMall.ui.cuspanel.productInfoPanel;
@SuppressWarnings("serial")
public class ProductInfoUI extends JFrame implements ActionListener {
private JPanel contentPane;
private productInfoPanel pInfo;
private JButton btnCancelProd;
private productInfoTablePanel table;
private JButton btnUpdateProd;
private productService pService;
public ProductInfoUI() {
pService = new productService();
initialize();
}
private void initialize() {
setTitle("제품상세정보");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setBounds(100, 100, 575, 346);
contentPane = new JPanel();
contentPane.setBackground(Color.WHITE);
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(new BorderLayout(0, 0));
pInfo = new productInfoPanel();
contentPane.add(pInfo);
pInfo.setLayout(new GridLayout(0, 2, 0, 0));
JPanel panel = new JPanel();
panel.setBackground(Color.WHITE);
contentPane.add(panel, BorderLayout.SOUTH);
btnUpdateProd = new JButton("수정");
btnUpdateProd.addActionListener(this);
btnUpdateProd.setBackground(Color.GREEN);
panel.add(btnUpdateProd);
btnCancelProd = new JButton("취소");
btnCancelProd.addActionListener(this);
btnCancelProd.setBackground(Color.GREEN);
panel.add(btnCancelProd);
}
public void setDetailItem(Product prod) {
pInfo.setItem(prod);
}
public void prohibitionBtn() {
// pInfo.prohibitionBtn();
}
public void actionPerformed(ActionEvent e) {
if (e.getSource() == btnCancelProd) {
actionPerformedBtnDelProd(e);
}
try {
if (e.getSource() == btnUpdateProd) {
actionPerformedBtnUpdateProd(e);
}
}catch (InvaildCheckException e1) {
JOptionPane.showMessageDialog(null, "공란존재","오류",JOptionPane.ERROR_MESSAGE);
}catch(sqlException e1) {
JOptionPane.showMessageDialog(null, "제품코드 중복", "오류", JOptionPane.ERROR_MESSAGE);
}
}
protected void actionPerformedBtnDelProd(ActionEvent e) {
pInfo.tfClear();
}
protected void actionPerformedBtnUpdateProd(ActionEvent e) {
if(btnUpdateProd.getText().equals("수정")) {
Product modiProd = pInfo.getProd();
pService.modiProduct(modiProd);
table.loadData();
dispose();
}else {
Product prod = pInfo.getProd();
pService.addProduct(prod);
table.loadData();
dispose();
}
}
public JButton getBtnUpdateProd() {
return btnUpdateProd;
}
public void setBtnUpdateProd(JButton btnUpdateProd) {
this.btnUpdateProd = btnUpdateProd;
}
public productInfoPanel getpInfo() {
return pInfo;
}
public void setTable(productInfoTablePanel table) {
this.table = table;
}
}
| 3,362 | 0.724773 | 0.717523 | 120 | 25.583334 | 18.952829 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.091667 | false | false |
9
|
c62f0a88a07158fc13592e4de81e6619409788da
| 27,530,740,384,385 |
9594b529c9115d95e68619ee065729833a25d71d
|
/java-tarde/app/src/main/java/com/cv5/sopresa/MainActivity.java
|
04006e1e8c4aa58808ef1ae1545d2fb422d3ecb2
|
[] |
no_license
|
CV5/felizmama
|
https://github.com/CV5/felizmama
|
d6ee31556236f8c5f831e425a1ed53d1e8703d56
|
ec6617932430a38efb3c0c22711e435f5c522d27
|
refs/heads/master
| 2020-05-26T01:35:53.629000 | 2019-05-29T20:04:22 | 2019-05-29T20:04:22 | 188,062,446 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.cv5.sopresa;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
EditText nombreDeMama;
TextView mensajeAMama;
ImageView foto;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
nombreDeMama = findViewById(R.id.nombre);
mensajeAMama = findViewById(R.id.mensaje);
foto = findViewById(R.id.foto);
}
public void abrir(View view) {
mensajeAMama.setText("Hola mami");
}
}
|
UTF-8
|
Java
| 767 |
java
|
MainActivity.java
|
Java
|
[] | null |
[] |
package com.cv5.sopresa;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
public class MainActivity extends AppCompatActivity {
EditText nombreDeMama;
TextView mensajeAMama;
ImageView foto;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
nombreDeMama = findViewById(R.id.nombre);
mensajeAMama = findViewById(R.id.mensaje);
foto = findViewById(R.id.foto);
}
public void abrir(View view) {
mensajeAMama.setText("Hola mami");
}
}
| 767 | 0.707953 | 0.705346 | 35 | 20.914286 | 19.808182 | 56 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.457143 | false | false |
9
|
52a6afb01f7f62c1cf8efcfafec749d7dfc287b4
| 16,716,012,765,899 |
bfb2a274d716bc3ea295193a9994c841e0bb4d08
|
/src/main/java/com/ferme/controllers/SaleController.java
|
e99fff2c055d57c67465b6c2dd18847053a37b71
|
[
"MIT"
] |
permissive
|
victorjaramilloduoc/ferme_backend
|
https://github.com/victorjaramilloduoc/ferme_backend
|
6e9512fc2169785de73f0053d16fa3154fb23d17
|
9ead375e97d49e80b494ef8ba83673627cbad476
|
refs/heads/master
| 2023-04-30T12:58:04.013000 | 2020-06-08T14:36:16 | 2020-06-08T14:36:16 | 270,703,996 | 0 | 0 |
NOASSERTION
| false | 2023-04-14T17:59:11 | 2020-06-08T14:40:51 | 2020-06-08T14:41:54 | 2023-04-14T17:59:11 | 126 | 0 | 0 | 1 |
Java
| false | false |
package com.ferme.controllers;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.ferme.services.SaleService;
import com.portafolio.util.entities.SaleEntity;
import com.portafolio.util.rest.client.ResponseUtil;
@RestController
@CrossOrigin(origins = "http://localhost:4200")
@RequestMapping(value="/api/v1/sales")
public class SaleController {
@Autowired
private SaleService service;
@RequestMapping(method = RequestMethod.GET)
public ResponseEntity<Object> getSales() {
Object response = service.getSales();
if(response != null) {
return ResponseUtil.reponseUtil(response, HttpStatus.OK);
}else {
return ResponseUtil.reponseUtil(response, HttpStatus.NO_CONTENT);
}
}
@SuppressWarnings("unchecked")
@RequestMapping(method = RequestMethod.POST)
public ResponseEntity<Object> recordedSale(@RequestBody SaleEntity sale) {
Object saleResponse = service.recordSale(sale, "product_sale_saved");
if( !((Map<String, Object>)saleResponse).get("status").equals("error") ) {
return ResponseUtil.reponseUtil(saleResponse, HttpStatus.OK);
}else {
return ResponseUtil.reponseUtil(saleResponse, HttpStatus.BAD_REQUEST);
}
}
}
|
UTF-8
|
Java
| 1,606 |
java
|
SaleController.java
|
Java
|
[] | null |
[] |
package com.ferme.controllers;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.ferme.services.SaleService;
import com.portafolio.util.entities.SaleEntity;
import com.portafolio.util.rest.client.ResponseUtil;
@RestController
@CrossOrigin(origins = "http://localhost:4200")
@RequestMapping(value="/api/v1/sales")
public class SaleController {
@Autowired
private SaleService service;
@RequestMapping(method = RequestMethod.GET)
public ResponseEntity<Object> getSales() {
Object response = service.getSales();
if(response != null) {
return ResponseUtil.reponseUtil(response, HttpStatus.OK);
}else {
return ResponseUtil.reponseUtil(response, HttpStatus.NO_CONTENT);
}
}
@SuppressWarnings("unchecked")
@RequestMapping(method = RequestMethod.POST)
public ResponseEntity<Object> recordedSale(@RequestBody SaleEntity sale) {
Object saleResponse = service.recordSale(sale, "product_sale_saved");
if( !((Map<String, Object>)saleResponse).get("status").equals("error") ) {
return ResponseUtil.reponseUtil(saleResponse, HttpStatus.OK);
}else {
return ResponseUtil.reponseUtil(saleResponse, HttpStatus.BAD_REQUEST);
}
}
}
| 1,606 | 0.791407 | 0.788294 | 47 | 33.170212 | 25.721354 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.446808 | false | false |
9
|
0b3c530afb9faa9226f7a21d0ac149642e214979
| 27,925,877,386,883 |
5c693f0cf05336ff0c7003b27650d72b3b6b4bf0
|
/lesson8/src/main/java/com/example/lesson8/fragments/fragment2/Fragment2.java
|
0fdc54280b802e7ad8b7d354c8fac4efc224f9c5
|
[] |
no_license
|
fr0zen87/SberLessons
|
https://github.com/fr0zen87/SberLessons
|
1422a1acefed50f19b18621ff6c9b0599615e230
|
15f35d2eb8c23662f704eaf4f95d44e5a7ef9aa1
|
refs/heads/master
| 2020-03-21T08:01:28.160000 | 2018-08-27T20:09:24 | 2018-08-27T20:09:24 | 138,314,498 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.lesson8.fragments.fragment2;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.example.lesson8.R;
import java.util.Random;
import java.util.concurrent.TimeUnit;
public class Fragment2 extends Fragment {
private TextView textView;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment2, container, false);
textView = view.findViewById(R.id.fr2_textView);
return view;
}
@Override
public void onResume() {
super.onResume();
new MyTask().execute();
}
private class MyTask extends AsyncTask<Void, Integer, Integer> {
@Override
protected Integer doInBackground(Void... voids) {
Random random = new Random();
for (int i = 0; i < 10; i++) {
publishProgress(random.nextInt(100));
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
return random.nextInt(100);
}
@Override
protected void onPostExecute(Integer integer) {
super.onPostExecute(integer);
textView.setText(String.valueOf(integer));
}
@Override
protected void onProgressUpdate(Integer... values) {
super.onProgressUpdate(values);
textView.setText(String.valueOf(values[0]));
}
}
}
|
UTF-8
|
Java
| 1,869 |
java
|
Fragment2.java
|
Java
|
[] | null |
[] |
package com.example.lesson8.fragments.fragment2;
import android.os.AsyncTask;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.example.lesson8.R;
import java.util.Random;
import java.util.concurrent.TimeUnit;
public class Fragment2 extends Fragment {
private TextView textView;
@Nullable
@Override
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment2, container, false);
textView = view.findViewById(R.id.fr2_textView);
return view;
}
@Override
public void onResume() {
super.onResume();
new MyTask().execute();
}
private class MyTask extends AsyncTask<Void, Integer, Integer> {
@Override
protected Integer doInBackground(Void... voids) {
Random random = new Random();
for (int i = 0; i < 10; i++) {
publishProgress(random.nextInt(100));
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
return random.nextInt(100);
}
@Override
protected void onPostExecute(Integer integer) {
super.onPostExecute(integer);
textView.setText(String.valueOf(integer));
}
@Override
protected void onProgressUpdate(Integer... values) {
super.onProgressUpdate(values);
textView.setText(String.valueOf(values[0]));
}
}
}
| 1,869 | 0.634564 | 0.624933 | 66 | 27.318182 | 24.085806 | 132 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.545455 | false | false |
9
|
cc6cc40b883e2dd0773aebe3ecd7fa4410fbe8b8
| 36,043,365,549,132 |
3691f21225bf33954813d6c5dedf9d2f4184746d
|
/src/com/LSPrinciple/EmailSender.java
|
7bde334d6d269523eeaab52418312b3c5c88114e
|
[] |
no_license
|
myCigar/DesignMode
|
https://github.com/myCigar/DesignMode
|
59d5ae5e884aece83b960a03d5ea244cddb26068
|
aa9011b74b59e988b55a0faa8a2b32b1986306cb
|
refs/heads/main
| 2023-03-24T01:40:46.680000 | 2021-03-17T05:29:03 | 2021-03-17T05:29:03 | 345,302,051 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.LSPrinciple;
public class EmailSender {
public void send(Customer customer) {
System.out.println("Hello, " + customer.getName() + " & " + customer.getEmail());
}
}
|
UTF-8
|
Java
| 193 |
java
|
EmailSender.java
|
Java
|
[] | null |
[] |
package com.LSPrinciple;
public class EmailSender {
public void send(Customer customer) {
System.out.println("Hello, " + customer.getName() + " & " + customer.getEmail());
}
}
| 193 | 0.647668 | 0.647668 | 7 | 26.571428 | 29.124643 | 89 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false |
9
|
6b5703bdbebfc5a2e42c0720b9ae103647f003ff
| 30,683,246,416,278 |
beb093032f3e1148b033f3aa8746cc30e6e17425
|
/Assignment3/src/exceptions/InvalidScholarHTMLException.java
|
ffd382360533b3319380f35bfb55329dddf5fd11
|
[] |
no_license
|
jmflee/csc207-assignments
|
https://github.com/jmflee/csc207-assignments
|
a5186c5deff6d1c0dbe006e1556f64e3d5a18c04
|
6a78a2a7d638001afbcae5eab7756ebad1f7e589
|
refs/heads/master
| 2020-06-04T20:22:18.726000 | 2019-06-16T10:45:05 | 2019-06-16T10:45:05 | 192,178,397 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
// **********************************************************
// Assignment3: 1001175346
// UTORID user_name: leejos14
//
// Author: Joseph Lee
//
//
// Honor Code: I pledge that this program represents my own
// program code and that I have coded on my own. I received
// help from no one in designing and debugging my program.
// *********************************************************
package exceptions;
/**
* Class Name: InvalidScholarHTMLException is an error when the url is
* not a Google Scholar file
*/
public class InvalidScholarHTMLException extends Exception {
/** The error. */
private String error = "";
/**
* ICreates an error output
*
* @param input error content
*/
public InvalidScholarHTMLException (String input) {
this.error = "Error: " + input + ": Invalid scholar file\n";
}
/**
* Gets the error.
*
* @return this.error is the error message
*/
public String getError() {
return this.error;
}
}
|
UTF-8
|
Java
| 980 |
java
|
InvalidScholarHTMLException.java
|
Java
|
[
{
"context": "**\n// Assignment3: 1001175346\n// UTORID user_name: leejos14\n//\n// Author: Joseph Lee\n//\n//\n// Honor Code: I p",
"end": 118,
"score": 0.9996873140335083,
"start": 110,
"tag": "USERNAME",
"value": "leejos14"
},
{
"context": "175346\n// UTORID user_name: leejos14\n//\n// Author: Joseph Lee\n//\n//\n// Honor Code: I pledge that this program r",
"end": 143,
"score": 0.9998466968536377,
"start": 133,
"tag": "NAME",
"value": "Joseph Lee"
}
] | null |
[] |
// **********************************************************
// Assignment3: 1001175346
// UTORID user_name: leejos14
//
// Author: <NAME>
//
//
// Honor Code: I pledge that this program represents my own
// program code and that I have coded on my own. I received
// help from no one in designing and debugging my program.
// *********************************************************
package exceptions;
/**
* Class Name: InvalidScholarHTMLException is an error when the url is
* not a Google Scholar file
*/
public class InvalidScholarHTMLException extends Exception {
/** The error. */
private String error = "";
/**
* ICreates an error output
*
* @param input error content
*/
public InvalidScholarHTMLException (String input) {
this.error = "Error: " + input + ": Invalid scholar file\n";
}
/**
* Gets the error.
*
* @return this.error is the error message
*/
public String getError() {
return this.error;
}
}
| 976 | 0.583673 | 0.570408 | 41 | 22.902439 | 22.912138 | 70 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.097561 | false | false |
9
|
ede30d10d0f774957c934a1d3731b51963114b60
| 23,768,349,049,609 |
19e855579987ecb4c57762635efe08c0bdb009fd
|
/SolrTest1/src/main/java/cn/solr/config/SolrConfiguration.java
|
b7398dc64f205df3fe624ffe9478ad7d04fb8644
|
[] |
no_license
|
m18513030294/springcloud
|
https://github.com/m18513030294/springcloud
|
ae36fbc22554610d12ae2f765e11457338a63672
|
3339639a2c44a1f581abcea2eaccde63b020b6fb
|
refs/heads/master
| 2020-03-28T22:34:10.094000 | 2018-09-18T07:36:16 | 2018-09-18T07:36:16 | 149,242,408 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package cn.solr.config;
import org.apache.solr.client.solrj.impl.HttpSolrClient;
import org.apache.solr.client.solrj.impl.LBHttpSolrClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.data.solr.repository.config.EnableSolrRepositories;
import org.apache.solr.client.solrj.SolrClient;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.net.MalformedURLException;
@Configuration
@EnableSolrRepositories(multicoreSupport = true)
@PropertySource(value = "classpath:/application.properties")
public class SolrConfiguration {
private static final String SOLR_HOST = "solr.host";
}
|
UTF-8
|
Java
| 831 |
java
|
SolrConfiguration.java
|
Java
|
[] | null |
[] |
package cn.solr.config;
import org.apache.solr.client.solrj.impl.HttpSolrClient;
import org.apache.solr.client.solrj.impl.LBHttpSolrClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.data.solr.repository.config.EnableSolrRepositories;
import org.apache.solr.client.solrj.SolrClient;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.net.MalformedURLException;
@Configuration
@EnableSolrRepositories(multicoreSupport = true)
@PropertySource(value = "classpath:/application.properties")
public class SolrConfiguration {
private static final String SOLR_HOST = "solr.host";
}
| 831 | 0.838749 | 0.838749 | 23 | 35.130436 | 24.57695 | 78 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.565217 | false | false |
9
|
834cb83c12d9b9192a4396cd5088a49bcb372e75
| 3,246,995,339,750 |
909303ed0628e031218b5188e67b0cd56152d80c
|
/util/mtwilson-util-crypto/src/main/java/com/intel/dcsg/cpg/x509/repository/MutableDigestRepository.java
|
59420e763db56be23112d8147770a663a65cb270
|
[
"BSD-3-Clause"
] |
permissive
|
intel-secl/common-java
|
https://github.com/intel-secl/common-java
|
5df257f6168d173182f59141e0f478d741fdbd55
|
79628eba5cca696b06636f78561dd29ef57e2bbb
|
refs/heads/master
| 2022-09-26T23:52:28.127000 | 2020-09-10T06:44:10 | 2020-09-10T06:44:10 | 179,010,272 | 2 | 0 |
NOASSERTION
| false | 2022-09-08T22:51:00 | 2019-04-02T06:08:40 | 2022-03-05T03:31:34 | 2022-09-08T22:51:00 | 2,083 | 2 | 0 | 6 |
Java
| false | false |
/*
* Copyright (C) 2019 Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause
*/
package com.intel.dcsg.cpg.x509.repository;
import com.intel.dcsg.cpg.crypto.digest.Digest;
/**
*
* @author jbuhacoff
*/
public interface MutableDigestRepository extends DigestRepository {
void addDigest(Digest digest);
}
|
UTF-8
|
Java
| 319 |
java
|
MutableDigestRepository.java
|
Java
|
[
{
"context": ".dcsg.cpg.crypto.digest.Digest;\n\n/**\n *\n * @author jbuhacoff\n */\npublic interface MutableDigestRepository exte",
"end": 209,
"score": 0.9777436256408691,
"start": 200,
"tag": "USERNAME",
"value": "jbuhacoff"
}
] | null |
[] |
/*
* Copyright (C) 2019 Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause
*/
package com.intel.dcsg.cpg.x509.repository;
import com.intel.dcsg.cpg.crypto.digest.Digest;
/**
*
* @author jbuhacoff
*/
public interface MutableDigestRepository extends DigestRepository {
void addDigest(Digest digest);
}
| 319 | 0.742947 | 0.717868 | 15 | 20.266666 | 21.754591 | 67 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.2 | false | false |
9
|
6e70e7a3c6b21669ad23a952159c3efb47456cc6
| 26,946,624,826,262 |
7c41ba5b7e8b7368c0eef793ae8f7e8fddde6926
|
/src/com/vds/local/main/VdsBlockChain.java
|
a80c5abaad6b4946d6a9837f60b8c928e9deb44d
|
[] |
no_license
|
vdsalexandre/vdsblockchain
|
https://github.com/vdsalexandre/vdsblockchain
|
3566056319d12701b7c9cbed1fbafb951e2a4169
|
999ef0ec07f3ff3a3281e48a62a853990b05ed6a
|
refs/heads/master
| 2020-03-23T03:15:49.597000 | 2018-07-15T11:03:42 | 2018-07-15T11:03:42 | 141,020,348 | 2 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.vds.local.main;
import java.security.Security;
import java.util.HashMap;
import com.vds.local.blockchain.Block;
import com.vds.local.blockchain.BlockChain;
import com.vds.local.wallet.Transaction;
import com.vds.local.wallet.TransactionOutput;
import com.vds.local.wallet.Wallet;
public class VdsBlockChain {
public static HashMap<String, TransactionOutput> UTXOs = new HashMap<>();
public static Wallet walletA;
public static Wallet walletB;
public static float minimumTransaction = 0.1f;
public static Transaction genesisTransaction; // transaction de départ pour alimenter le walletA
public static Block genesis; // block de départ
public static void main(String[] args) {
Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
walletA = new Wallet();
walletB = new Wallet();
Wallet coinbase = new Wallet();
// create genesis transaction which sends 100 vdscoins to walletA
genesisTransaction = new Transaction(coinbase.getPublicKey(), walletA.getPublicKey(), 100f, null);
genesisTransaction.generateSignature(coinbase.getPrivateKey());
genesisTransaction.transactionId = "0";
genesisTransaction.outputs.add(new TransactionOutput(genesisTransaction.recipient, genesisTransaction.value, genesisTransaction.transactionId));
UTXOs.put(genesisTransaction.outputs.get(0).id, genesisTransaction.outputs.get(0));
System.out.println("Creating and Mining Genesis block ...");
genesis = new Block("0");
genesis.addTransaction(genesisTransaction);
BlockChain.addToChain(genesis);
// testing
Block b1 = new Block(genesis.getHash());
System.out.println("\nWalletA's balance is: " + walletA.getBalance());
System.out.println("\nWalletA is attempting to send funds (40) to walletB ...");
b1.addTransaction(walletA.sendFunds(walletB.getPublicKey(), 40f));
BlockChain.addToChain(b1);
System.out.println("\nWalletA's balance is: " + walletA.getBalance());
System.out.println("\nWalletB's balance is: " + walletB.getBalance());
Block b2 = new Block(b1.getHash());
System.out.println("\nWalletA Attempting to send more funds (1000) than it has...");
b2.addTransaction(walletA.sendFunds(walletB.getPublicKey(), 1000f));
BlockChain.addToChain(b2);
System.out.println("\nWalletA's balance is: " + walletA.getBalance());
System.out.println("WalletB's balance is: " + walletB.getBalance());
Block b3 = new Block(b2.getHash());
System.out.println("\nWalletB is Attempting to send funds (20) to WalletA...");
b3.addTransaction(walletB.sendFunds( walletA.getPublicKey(), 20));
System.out.println("\nWalletA's balance is: " + walletA.getBalance());
System.out.println("WalletB's balance is: " + walletB.getBalance());
System.out.println("Chain valid: " + BlockChain.isValidChain());
}
}
|
ISO-8859-2
|
Java
| 2,808 |
java
|
VdsBlockChain.java
|
Java
|
[] | null |
[] |
package com.vds.local.main;
import java.security.Security;
import java.util.HashMap;
import com.vds.local.blockchain.Block;
import com.vds.local.blockchain.BlockChain;
import com.vds.local.wallet.Transaction;
import com.vds.local.wallet.TransactionOutput;
import com.vds.local.wallet.Wallet;
public class VdsBlockChain {
public static HashMap<String, TransactionOutput> UTXOs = new HashMap<>();
public static Wallet walletA;
public static Wallet walletB;
public static float minimumTransaction = 0.1f;
public static Transaction genesisTransaction; // transaction de départ pour alimenter le walletA
public static Block genesis; // block de départ
public static void main(String[] args) {
Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
walletA = new Wallet();
walletB = new Wallet();
Wallet coinbase = new Wallet();
// create genesis transaction which sends 100 vdscoins to walletA
genesisTransaction = new Transaction(coinbase.getPublicKey(), walletA.getPublicKey(), 100f, null);
genesisTransaction.generateSignature(coinbase.getPrivateKey());
genesisTransaction.transactionId = "0";
genesisTransaction.outputs.add(new TransactionOutput(genesisTransaction.recipient, genesisTransaction.value, genesisTransaction.transactionId));
UTXOs.put(genesisTransaction.outputs.get(0).id, genesisTransaction.outputs.get(0));
System.out.println("Creating and Mining Genesis block ...");
genesis = new Block("0");
genesis.addTransaction(genesisTransaction);
BlockChain.addToChain(genesis);
// testing
Block b1 = new Block(genesis.getHash());
System.out.println("\nWalletA's balance is: " + walletA.getBalance());
System.out.println("\nWalletA is attempting to send funds (40) to walletB ...");
b1.addTransaction(walletA.sendFunds(walletB.getPublicKey(), 40f));
BlockChain.addToChain(b1);
System.out.println("\nWalletA's balance is: " + walletA.getBalance());
System.out.println("\nWalletB's balance is: " + walletB.getBalance());
Block b2 = new Block(b1.getHash());
System.out.println("\nWalletA Attempting to send more funds (1000) than it has...");
b2.addTransaction(walletA.sendFunds(walletB.getPublicKey(), 1000f));
BlockChain.addToChain(b2);
System.out.println("\nWalletA's balance is: " + walletA.getBalance());
System.out.println("WalletB's balance is: " + walletB.getBalance());
Block b3 = new Block(b2.getHash());
System.out.println("\nWalletB is Attempting to send funds (20) to WalletA...");
b3.addTransaction(walletB.sendFunds( walletA.getPublicKey(), 20));
System.out.println("\nWalletA's balance is: " + walletA.getBalance());
System.out.println("WalletB's balance is: " + walletB.getBalance());
System.out.println("Chain valid: " + BlockChain.isValidChain());
}
}
| 2,808 | 0.74804 | 0.734497 | 65 | 42.169231 | 31.710503 | 146 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.323077 | false | false |
9
|
b89d0e2c7ae5fef7b3fc6fdcaabd4b153b9ba86e
| 18,992,345,399,461 |
7404315f76e26fb43c75fc9335d5102fbc331fb9
|
/src/com/luv2code/springdemo/dao/Rzad_fotelDaoImpl.java
|
b14369de6eb118e35db7841d62f73069a75ebb4a
|
[] |
no_license
|
MaciejMatyaszek/ProjektKinoOracle
|
https://github.com/MaciejMatyaszek/ProjektKinoOracle
|
6f745a04c881b2fe35e8f49ecac2274cadbd1a58
|
36bd19a53ac81c017e8aab09eb81cafce5b394ea
|
refs/heads/master
| 2020-05-29T23:16:30.529000 | 2019-05-30T14:38:02 | 2019-05-30T14:38:02 | 189,430,249 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.luv2code.springdemo.dao;
import com.luv2code.springdemo.entities.Rezerwacje;
import com.luv2code.springdemo.entities.Rzad_fotel;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.query.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public class Rzad_fotelDaoImpl implements Rzad_fotelDao {
@Autowired
private SessionFactory sessionFactory;
@Override
public List<Rzad_fotel> getRzad_fotel() {
//Pobranie sessji
Session currentSession = sessionFactory.getCurrentSession();
//Zapytanie
Query<Rzad_fotel> theQuery =
currentSession.createQuery("from Rzad_fotel ", Rzad_fotel.class);
//wywolanie zapytania i lista
List<Rzad_fotel> rzad_fotele = theQuery.getResultList();
//zwrocenie listy
return rzad_fotele;
}
@Override
public void saveRzad_fotel(Rzad_fotel theRzad_fotel) {
Session currentSession = sessionFactory.getCurrentSession();
currentSession.saveOrUpdate(theRzad_fotel);
}
@Override
public void updateRzad_fotel(Rzad_fotel theRzad_fotel) {
Session currentSession = sessionFactory.getCurrentSession();
currentSession.update(theRzad_fotel);
}
@Override
public Rzad_fotel getRzad_fotelById(int theId) {
Session currentSession = sessionFactory.getCurrentSession();
Rzad_fotel theRzad_fotel = currentSession.get(Rzad_fotel.class, theId);
return theRzad_fotel;
}
@Override
public void deleteRzad_fotel(int theId) {
Session currentSession = sessionFactory.getCurrentSession();
Query theQuery =
currentSession.createQuery("delete from Rzad_fotel where id_rzad_fotel=:id_rzad_fotel");
theQuery.setParameter("id_rzad_fotel", theId);
theQuery.executeUpdate();
}
}
|
UTF-8
|
Java
| 1,987 |
java
|
Rzad_fotelDaoImpl.java
|
Java
|
[] | null |
[] |
package com.luv2code.springdemo.dao;
import com.luv2code.springdemo.entities.Rezerwacje;
import com.luv2code.springdemo.entities.Rzad_fotel;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.query.Query;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public class Rzad_fotelDaoImpl implements Rzad_fotelDao {
@Autowired
private SessionFactory sessionFactory;
@Override
public List<Rzad_fotel> getRzad_fotel() {
//Pobranie sessji
Session currentSession = sessionFactory.getCurrentSession();
//Zapytanie
Query<Rzad_fotel> theQuery =
currentSession.createQuery("from Rzad_fotel ", Rzad_fotel.class);
//wywolanie zapytania i lista
List<Rzad_fotel> rzad_fotele = theQuery.getResultList();
//zwrocenie listy
return rzad_fotele;
}
@Override
public void saveRzad_fotel(Rzad_fotel theRzad_fotel) {
Session currentSession = sessionFactory.getCurrentSession();
currentSession.saveOrUpdate(theRzad_fotel);
}
@Override
public void updateRzad_fotel(Rzad_fotel theRzad_fotel) {
Session currentSession = sessionFactory.getCurrentSession();
currentSession.update(theRzad_fotel);
}
@Override
public Rzad_fotel getRzad_fotelById(int theId) {
Session currentSession = sessionFactory.getCurrentSession();
Rzad_fotel theRzad_fotel = currentSession.get(Rzad_fotel.class, theId);
return theRzad_fotel;
}
@Override
public void deleteRzad_fotel(int theId) {
Session currentSession = sessionFactory.getCurrentSession();
Query theQuery =
currentSession.createQuery("delete from Rzad_fotel where id_rzad_fotel=:id_rzad_fotel");
theQuery.setParameter("id_rzad_fotel", theId);
theQuery.executeUpdate();
}
}
| 1,987 | 0.704076 | 0.702567 | 70 | 27.385714 | 26.688839 | 104 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.4 | false | false |
9
|
67ec4e3564ed5d5eaf9bbd25f3debb31fb7a4b11
| 28,750,511,149,514 |
2d2ec3f64e0150d03785b4bcb8437137dfe7e4c6
|
/src/main/java/modao/find/BinaryFind.java
|
8f4b094ed694947d26b82902dc7fe0a3c1c62e94
|
[] |
no_license
|
hangshisitu/modao
|
https://github.com/hangshisitu/modao
|
1e62edef9ecb68f897e8bc5b02555d68e71a0ec8
|
285abfccb0c1436c9671a6091e8b59268cbc0aff
|
refs/heads/main
| 2023-03-06T20:03:32.352000 | 2021-02-23T08:36:37 | 2021-02-23T08:36:37 | 323,586,411 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package modao.find;
public class BinaryFind {
public int findRecursion(int[] array,int target)
{
return binaryFind(array,0,array.length-1,target);
}
public int binaryFind(int[] array, int left, int right, int target)
{
if(left==right)
{
if(array[left]==target)
{
return left;
}
return -1;
}
int res = -1;
int mid = left + ((right-left)>>>1);
while(left<right)
{
if(array[mid]==target)
{
return mid;
}else if (array[mid]>target)
{
res = binaryFind(array,left,mid,target);
}else
{
res = binaryFind(array,mid+1,right,target);
}
}
return res;
}
//二分查找,非递归实现
public int find(int[] array, int target) {
int left=0;
int right = array.length-1;
while(left<=right)
{
int mid = left + ((right-left)>>>1);
if(array[mid]==target)
{
return mid;
}else if(array[mid]>target)
{
right= mid-1;
}else
{
left = mid+1;
}
}
return -1;
}
//查找第一个等于目标值的元素
public int findFirstEQ(int[] array, int target)
{
int left=0;
int right = array.length-1;
while(left<=right)
{
int mid = left + ((right-left)>>>1);
if(array[mid]>target)
{
right = mid-1;
}else if(array[mid]<target)
{
left = mid+1;
}else {
if(mid==0 || array[mid-1]!=target)
{
return mid;
}else
{
right = mid-1;
}
}
}
return -1;
}
//查找最后一个等于目标值的元素
public int findLastEQ(int[] array, int target)
{
int left=0;
int right = array.length-1;
while(left<=right)
{
int mid = left + ((right-left)>>>1);
if(array[mid]==target)
{
if(mid==array.length-1 || array[mid+1]!=target)
{
return mid;
}else
{
left = mid+1;
}
}else if(array[mid]>target)
{
right= mid-1;
}else
{
left = mid+1;
}
}
return -1;
}
//查找第一个大于等于目标值的元素
public int findLastGE(int[] array, int target)
{
int left=0;
int right = array.length-1;
while(left<=right)
{
int mid = left + ((right-left)>>>1);
if(array[mid]>=target)
{
if( mid==0 || array[mid-1]<target)
{
return mid;
}else
{
right = mid-1;
}
}else
{
left = mid+1;
}
}
return -1;
}
//查找第一个大于目标值的元素
public int findLastGT(int[] array, int target)
{
int left=0;
int right = array.length-1;
while(left<=right)
{
int mid = left + ((right-left)>>>1);
if(array[mid]>target)
{
if(mid==0 || array[mid-1]<=target)
{
return mid;
}else
{
right= mid-1;
}
}else
{
left = mid+1;
}
}
return -1;
}
//查找最后一个小于等于目标值的元素
public int findLastLE(int[] array, int target)
{
int left=0;
int right = array.length-1;
while(left<=right)
{
int mid = left + ((right-left)>>>1);
if(array[mid]>target)
{
right= mid-1;
}else
{
if(mid==array.length-1 || array[mid+1]>target)
{
return mid;
}else
{
left = mid+1;
}
}
}
return -1;
}
public int findReverseEQ(int[] array, int target)
{
int left=0;
int right=array.length-1;
int split=-1;
for(int i=0;i<array.length-1;++i)
{
if(array[i]>array[i+1])
{
split = i+1;
break;
}
}
if(split!=-1)
{
if(array[0]>target)
{
left=split;
}
if(array[array.length-1]<target)
{
right=split-1;
}
}
//二分查找
while(left<=right)
{
int mid = left + ((right-left)>>>1);
if(array[mid]==target)
{
return mid;
}else if(array[mid]>target)
{
right= mid-1;
}else
{
left = mid+1;
}
}
return -1;
}
}
|
UTF-8
|
Java
| 5,468 |
java
|
BinaryFind.java
|
Java
|
[] | null |
[] |
package modao.find;
public class BinaryFind {
public int findRecursion(int[] array,int target)
{
return binaryFind(array,0,array.length-1,target);
}
public int binaryFind(int[] array, int left, int right, int target)
{
if(left==right)
{
if(array[left]==target)
{
return left;
}
return -1;
}
int res = -1;
int mid = left + ((right-left)>>>1);
while(left<right)
{
if(array[mid]==target)
{
return mid;
}else if (array[mid]>target)
{
res = binaryFind(array,left,mid,target);
}else
{
res = binaryFind(array,mid+1,right,target);
}
}
return res;
}
//二分查找,非递归实现
public int find(int[] array, int target) {
int left=0;
int right = array.length-1;
while(left<=right)
{
int mid = left + ((right-left)>>>1);
if(array[mid]==target)
{
return mid;
}else if(array[mid]>target)
{
right= mid-1;
}else
{
left = mid+1;
}
}
return -1;
}
//查找第一个等于目标值的元素
public int findFirstEQ(int[] array, int target)
{
int left=0;
int right = array.length-1;
while(left<=right)
{
int mid = left + ((right-left)>>>1);
if(array[mid]>target)
{
right = mid-1;
}else if(array[mid]<target)
{
left = mid+1;
}else {
if(mid==0 || array[mid-1]!=target)
{
return mid;
}else
{
right = mid-1;
}
}
}
return -1;
}
//查找最后一个等于目标值的元素
public int findLastEQ(int[] array, int target)
{
int left=0;
int right = array.length-1;
while(left<=right)
{
int mid = left + ((right-left)>>>1);
if(array[mid]==target)
{
if(mid==array.length-1 || array[mid+1]!=target)
{
return mid;
}else
{
left = mid+1;
}
}else if(array[mid]>target)
{
right= mid-1;
}else
{
left = mid+1;
}
}
return -1;
}
//查找第一个大于等于目标值的元素
public int findLastGE(int[] array, int target)
{
int left=0;
int right = array.length-1;
while(left<=right)
{
int mid = left + ((right-left)>>>1);
if(array[mid]>=target)
{
if( mid==0 || array[mid-1]<target)
{
return mid;
}else
{
right = mid-1;
}
}else
{
left = mid+1;
}
}
return -1;
}
//查找第一个大于目标值的元素
public int findLastGT(int[] array, int target)
{
int left=0;
int right = array.length-1;
while(left<=right)
{
int mid = left + ((right-left)>>>1);
if(array[mid]>target)
{
if(mid==0 || array[mid-1]<=target)
{
return mid;
}else
{
right= mid-1;
}
}else
{
left = mid+1;
}
}
return -1;
}
//查找最后一个小于等于目标值的元素
public int findLastLE(int[] array, int target)
{
int left=0;
int right = array.length-1;
while(left<=right)
{
int mid = left + ((right-left)>>>1);
if(array[mid]>target)
{
right= mid-1;
}else
{
if(mid==array.length-1 || array[mid+1]>target)
{
return mid;
}else
{
left = mid+1;
}
}
}
return -1;
}
public int findReverseEQ(int[] array, int target)
{
int left=0;
int right=array.length-1;
int split=-1;
for(int i=0;i<array.length-1;++i)
{
if(array[i]>array[i+1])
{
split = i+1;
break;
}
}
if(split!=-1)
{
if(array[0]>target)
{
left=split;
}
if(array[array.length-1]<target)
{
right=split-1;
}
}
//二分查找
while(left<=right)
{
int mid = left + ((right-left)>>>1);
if(array[mid]==target)
{
return mid;
}else if(array[mid]>target)
{
right= mid-1;
}else
{
left = mid+1;
}
}
return -1;
}
}
| 5,468 | 0.355417 | 0.342393 | 234 | 21.641026 | 14.605328 | 71 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.418803 | false | false |
9
|
6ac028942e0ff999a935055b6a7c97f40355c713
| 33,621,004,003,466 |
25fd5b10422d907df9539d83cc8414fa374d4bc2
|
/iatp-service/src/main/java/cn/powertime/iatp/facade/web/IndexFacade.java
|
db8fc05462f2d7be5e36955bbf9c9138deb3090a
|
[] |
no_license
|
zhouhe0312/develep
|
https://github.com/zhouhe0312/develep
|
c54e6581d1307b47b4b0909803579db558b45b24
|
14df38e2ee17745dd45f4c17f6755fe0155988f8
|
refs/heads/master
| 2022-07-13T07:28:49.917000 | 2019-09-18T08:44:44 | 2019-09-18T08:44:44 | 208,704,951 | 1 | 1 | null | false | 2022-06-29T18:06:28 | 2019-09-16T03:48:50 | 2019-09-18T08:47:07 | 2022-06-29T18:06:23 | 122,223 | 0 | 1 | 9 |
Python
| false | false |
package cn.powertime.iatp.facade.web;
import cn.powertime.iatp.entity.BaseKnowledgeInfo;
import cn.powertime.iatp.vo.resp.web.IndexCourseList;
import java.util.List;
public interface IndexFacade {
List<BaseKnowledgeInfo> knowledgeList();
List<IndexCourseList> courseList(Integer type);
}
|
UTF-8
|
Java
| 300 |
java
|
IndexFacade.java
|
Java
|
[] | null |
[] |
package cn.powertime.iatp.facade.web;
import cn.powertime.iatp.entity.BaseKnowledgeInfo;
import cn.powertime.iatp.vo.resp.web.IndexCourseList;
import java.util.List;
public interface IndexFacade {
List<BaseKnowledgeInfo> knowledgeList();
List<IndexCourseList> courseList(Integer type);
}
| 300 | 0.793333 | 0.793333 | 12 | 24 | 21.771542 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.5 | false | false |
9
|
b3f3bebe7088969a18969a4eca3f0ccbd25bd09a
| 4,939,212,405,603 |
402ef29483c7e50cc570978bbfdc51a594ceca09
|
/src/test/java/cl/lmedinar/test/CalculaPreciosEspecialTest.java
|
9f1894841ea107ecced9da8435ea18c85ead2199
|
[] |
no_license
|
lukas-577/ensayo
|
https://github.com/lukas-577/ensayo
|
626ae41b76e27337b55986b94d6d69859c54c578
|
5657a618ad2ecf65a188598625b02c40b0f871dd
|
refs/heads/master
| 2022-12-06T19:07:54.203000 | 2020-08-20T16:32:57 | 2020-08-20T16:32:57 | 288,221,103 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package cl.lmedinar.test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.Arrays;
import java.util.List;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import cl.lmedinar.recargo.CalculaPrecioEspecial;
import cl.lmedinar.recargo.ConRecargo;
public class CalculaPreciosEspecialTest {
private final static List<Double> precios = Arrays.asList(25000.0,25000.0);
@Test
@DisplayName("prueba el calculo del total simple")
void pruebaTotal() {
ConRecargo recargo = new CalculaPrecioEspecial();
assertEquals(50000.0,recargo.obtenerTotal(precios));
}
@Test
@DisplayName("prueba el calculo del total simple")
void pruebaRecargo() {
ConRecargo recargo = new CalculaPrecioEspecial();
List<Double> precios2 = Arrays.asList(25000.0,25000.0);
assertEquals(precios2,recargo.aplicarRecargo(precios));
}
}
|
UTF-8
|
Java
| 888 |
java
|
CalculaPreciosEspecialTest.java
|
Java
|
[] | null |
[] |
package cl.lmedinar.test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.Arrays;
import java.util.List;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import cl.lmedinar.recargo.CalculaPrecioEspecial;
import cl.lmedinar.recargo.ConRecargo;
public class CalculaPreciosEspecialTest {
private final static List<Double> precios = Arrays.asList(25000.0,25000.0);
@Test
@DisplayName("prueba el calculo del total simple")
void pruebaTotal() {
ConRecargo recargo = new CalculaPrecioEspecial();
assertEquals(50000.0,recargo.obtenerTotal(precios));
}
@Test
@DisplayName("prueba el calculo del total simple")
void pruebaRecargo() {
ConRecargo recargo = new CalculaPrecioEspecial();
List<Double> precios2 = Arrays.asList(25000.0,25000.0);
assertEquals(precios2,recargo.aplicarRecargo(precios));
}
}
| 888 | 0.769144 | 0.733108 | 37 | 23 | 23.670029 | 76 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.216216 | false | false |
9
|
063993faa2e310548ac2da8fb8b48ba54e1dc8fc
| 23,957,327,611,114 |
909adb40444ede8cc4bda993e694da64431e45ff
|
/app/src/main/java/com/example/roomdataone/activities/ac/CreateUserActivity.java
|
5ba2f698619e685cc666d859a78a7edf2d37b897
|
[] |
no_license
|
CodingAtMidnight/RoomDataOne
|
https://github.com/CodingAtMidnight/RoomDataOne
|
801a98d7ad7716a762b71120460ccd46bf7222ab
|
49d4591dc739966946c35ec7284f54a0f309125c
|
refs/heads/master
| 2023-06-15T00:09:08.765000 | 2021-07-07T06:59:25 | 2021-07-07T06:59:25 | 383,704,118 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.example.roomdataone.activities.ac;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import com.example.roomdataone.R;
public class CreateUserActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_create_user);
ImageView goBack = findViewById(R.id.goBack);
goBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
}
}
|
UTF-8
|
Java
| 698 |
java
|
CreateUserActivity.java
|
Java
|
[] | null |
[] |
package com.example.roomdataone.activities.ac;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import com.example.roomdataone.R;
public class CreateUserActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_create_user);
ImageView goBack = findViewById(R.id.goBack);
goBack.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onBackPressed();
}
});
}
}
| 698 | 0.690544 | 0.690544 | 26 | 25.884615 | 21.509081 | 62 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.423077 | false | false |
9
|
61a03e8fd27d1d455b07820f5b7938bbb82455a0
| 1,460,288,897,772 |
c1b6d4beffb4d992c635477b13f905bf7bd40fb5
|
/app/src/main/java/com/xxl/kfapp/model/response/KSNRVo.java
|
913577639f1f2c36ae96cac0b4c650e239847b05
|
[] |
no_license
|
cly2kf/kfapp
|
https://github.com/cly2kf/kfapp
|
f565fb8b289787a2c9903964af066247ab3f7f24
|
ad4cbe4c84b21f6d745e2152d1fd9898920562d0
|
refs/heads/master
| 2020-12-02T17:39:01.456000 | 2017-07-06T07:17:15 | 2017-07-06T07:17:15 | 96,405,849 | 1 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.xxl.kfapp.model.response;
import java.io.Serializable;
/**
* 作者:XNN
* 日期:2017/6/13
* 作用:考试题目的内容
*/
public class KSNRVo implements Serializable {
private String info;
private boolean xz = false;
public boolean isXz() {
return xz;
}
public void setXz(boolean xz) {
this.xz = xz;
}
public String getInfo() {
return info;
}
public void setInfo(String info) {
this.info = info;
}
}
|
UTF-8
|
Java
| 506 |
java
|
KSNRVo.java
|
Java
|
[
{
"context": "esponse;\n\nimport java.io.Serializable;\n\n/**\n * 作者:XNN\n * 日期:2017/6/13\n * 作用:考试题目的内容\n */\n\npublic class K",
"end": 82,
"score": 0.9996954798698425,
"start": 79,
"tag": "USERNAME",
"value": "XNN"
}
] | null |
[] |
package com.xxl.kfapp.model.response;
import java.io.Serializable;
/**
* 作者:XNN
* 日期:2017/6/13
* 作用:考试题目的内容
*/
public class KSNRVo implements Serializable {
private String info;
private boolean xz = false;
public boolean isXz() {
return xz;
}
public void setXz(boolean xz) {
this.xz = xz;
}
public String getInfo() {
return info;
}
public void setInfo(String info) {
this.info = info;
}
}
| 506 | 0.590717 | 0.575949 | 32 | 13.8125 | 13.956265 | 45 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | false | false |
9
|
0981bfdf9316f748aa45d4c97c87778efc151f5e
| 33,191,507,277,954 |
7b775f959ff0f110eb41a60a216a8077674a5461
|
/src/test/java/org/openspaces/cache/model/Book.java
|
48bd35228e8b8ec13a9ac6394c3ffd2ec4960654
|
[] |
no_license
|
jottinger/openspaces-cache
|
https://github.com/jottinger/openspaces-cache
|
5c0e1569694914c574f801af191121275c848058
|
4cebf054b466bdb5cea4e414d6e15ed9f222a330
|
refs/heads/master
| 2021-01-01T19:16:23.053000 | 2011-08-15T14:20:30 | 2011-08-15T14:20:30 | 2,209,054 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package org.openspaces.cache.model;
public class Book {
String bookId;
String title;
public Book(String bookId) {
this.bookId = bookId;
this.title = "Title " + bookId;
}
public String getBookId() {
return bookId;
}
public void setBookId(String bookId) {
this.bookId = bookId;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Book)) return false;
Book book = (Book) o;
if (bookId != null ? !bookId.equals(book.bookId) : book.bookId != null) return false;
if (title != null ? !title.equals(book.title) : book.title != null) return false;
return true;
}
@Override
public int hashCode() {
int result = bookId != null ? bookId.hashCode() : 0;
result = 31 * result + (title != null ? title.hashCode() : 0);
return result;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
sb.append("Book");
sb.append("{bookId='").append(bookId).append('\'');
sb.append(", title='").append(title).append('\'');
sb.append('}');
return sb.toString();
}
}
|
UTF-8
|
Java
| 1,432 |
java
|
Book.java
|
Java
|
[] | null |
[] |
package org.openspaces.cache.model;
public class Book {
String bookId;
String title;
public Book(String bookId) {
this.bookId = bookId;
this.title = "Title " + bookId;
}
public String getBookId() {
return bookId;
}
public void setBookId(String bookId) {
this.bookId = bookId;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof Book)) return false;
Book book = (Book) o;
if (bookId != null ? !bookId.equals(book.bookId) : book.bookId != null) return false;
if (title != null ? !title.equals(book.title) : book.title != null) return false;
return true;
}
@Override
public int hashCode() {
int result = bookId != null ? bookId.hashCode() : 0;
result = 31 * result + (title != null ? title.hashCode() : 0);
return result;
}
@Override
public String toString() {
final StringBuilder sb = new StringBuilder();
sb.append("Book");
sb.append("{bookId='").append(bookId).append('\'');
sb.append(", title='").append(title).append('\'');
sb.append('}');
return sb.toString();
}
}
| 1,432 | 0.534916 | 0.532123 | 57 | 23.122807 | 22.346607 | 93 | true | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.438596 | false | false |
9
|
4883ce3b69d638ad45171d84e7565adb98dac697
| 7,937,099,589,768 |
2dd25ff091a63f53d70cb07ce11dbc10345c0dbc
|
/ilbars-091-string-reverseusingstringbuilder/src/com/doganilbars/main/ReverseUsingStringBuilder.java
|
d23ed1d970a14c0f07c7e7a52b1b30e1e8bd0132
|
[] |
no_license
|
hacidoganilbars/basic-java
|
https://github.com/hacidoganilbars/basic-java
|
0b1d71f67fd34408e0cf545d7152ef2854c618df
|
7eddcadab50d212d75c0019bee72e444b6445bda
|
refs/heads/master
| 2020-03-16T05:19:55.418000 | 2018-05-08T23:14:58 | 2018-05-08T23:14:58 | 132,530,386 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.doganilbars.main;
import java.util.Scanner;
public class ReverseUsingStringBuilder {
public static void main(String[] args) {
String str;
Scanner scan = new Scanner(System.in);
System.out.print("Enter a string: ");
str = scan.nextLine();
StringBuilder sb = new StringBuilder();
sb.append(str);
sb.reverse();
str = new String(sb);
System.out.println("After converting, " + str);
scan.close();
}
}
|
UTF-8
|
Java
| 454 |
java
|
ReverseUsingStringBuilder.java
|
Java
|
[] | null |
[] |
package com.doganilbars.main;
import java.util.Scanner;
public class ReverseUsingStringBuilder {
public static void main(String[] args) {
String str;
Scanner scan = new Scanner(System.in);
System.out.print("Enter a string: ");
str = scan.nextLine();
StringBuilder sb = new StringBuilder();
sb.append(str);
sb.reverse();
str = new String(sb);
System.out.println("After converting, " + str);
scan.close();
}
}
| 454 | 0.65859 | 0.65859 | 20 | 20.700001 | 16.428938 | 49 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.75 | false | false |
9
|
f6b3e7388f12d5166c0419a94143477feccaee99
| 13,348,758,403,917 |
292c261058ce18376febb2e369965b54174adb2d
|
/Teste/src/br/com/caelum/testes/TesteContatoDao.java
|
e2303eeb9f9bfa53388cfe3cc3692c16dbf0d768
|
[] |
no_license
|
juakacc/sucataGeral
|
https://github.com/juakacc/sucataGeral
|
4cba821ff331852671af77c13ce5c8029db501e1
|
4d55ce69bba1937b3769752ee6ce10498eb575ac
|
refs/heads/master
| 2021-01-10T09:29:41.599000 | 2015-12-28T00:45:06 | 2015-12-28T00:45:06 | 48,608,047 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package br.com.caelum.testes;
import java.util.Calendar;
import java.util.List;
import dao.Contato;
import dao.ContatoDao;
public class TesteContatoDao {
public static void main(String[] args) {
Contato c = new Contato();
c.setNome("Joaquim");
c.setEmail("juakacc@gmail.com");
c.setEndereco("Rua Divone");
c.setData(Calendar.getInstance());
c.setId(2);
ContatoDao banco = new ContatoDao();
// banco.adicionaContato(c);
Contato c2 = new Contato();
c2.setId(2);
c2.setNome("Julia");
c2.setEmail("julheba@gmail.com");
c2.setEndereco("Rua de cima");
c2.setData(Calendar.getInstance());
banco.alterar(c2);
System.out.println(c.getId());
banco.remove(c);
List<Contato> contatos = banco.getContatos();
for (Contato contato : contatos) {
System.out.println(contato.toString() + "\n");
}
System.out.println(banco.getContatoPorId(2));
}
}
|
UTF-8
|
Java
| 896 |
java
|
TesteContatoDao.java
|
Java
|
[
{
"context": "args) {\n\t\tContato c = new Contato();\n\t\tc.setNome(\"Joaquim\");\n\t\tc.setEmail(\"juakacc@gmail.com\");\n\t\tc.setEnde",
"end": 250,
"score": 0.9998263716697693,
"start": 243,
"tag": "NAME",
"value": "Joaquim"
},
{
"context": " Contato();\n\t\tc.setNome(\"Joaquim\");\n\t\tc.setEmail(\"juakacc@gmail.com\");\n\t\tc.setEndereco(\"Rua Divone\");\n\t\tc.setData(Cal",
"end": 285,
"score": 0.9999322295188904,
"start": 268,
"tag": "EMAIL",
"value": "juakacc@gmail.com"
},
{
"context": " c2 = new Contato();\n\t\tc2.setId(2);\n\t\tc2.setNome(\"Julia\");\n\t\tc2.setEmail(\"julheba@gmail.com\");\n\t\tc2.setEn",
"end": 513,
"score": 0.9998745918273926,
"start": 508,
"tag": "NAME",
"value": "Julia"
},
{
"context": "2.setId(2);\n\t\tc2.setNome(\"Julia\");\n\t\tc2.setEmail(\"julheba@gmail.com\");\n\t\tc2.setEndereco(\"Rua de cima\");\n\t\tc2.setData(",
"end": 549,
"score": 0.9999326467514038,
"start": 532,
"tag": "EMAIL",
"value": "julheba@gmail.com"
}
] | null |
[] |
package br.com.caelum.testes;
import java.util.Calendar;
import java.util.List;
import dao.Contato;
import dao.ContatoDao;
public class TesteContatoDao {
public static void main(String[] args) {
Contato c = new Contato();
c.setNome("Joaquim");
c.setEmail("<EMAIL>");
c.setEndereco("Rua Divone");
c.setData(Calendar.getInstance());
c.setId(2);
ContatoDao banco = new ContatoDao();
// banco.adicionaContato(c);
Contato c2 = new Contato();
c2.setId(2);
c2.setNome("Julia");
c2.setEmail("<EMAIL>");
c2.setEndereco("Rua de cima");
c2.setData(Calendar.getInstance());
banco.alterar(c2);
System.out.println(c.getId());
banco.remove(c);
List<Contato> contatos = banco.getContatos();
for (Contato contato : contatos) {
System.out.println(contato.toString() + "\n");
}
System.out.println(banco.getContatoPorId(2));
}
}
| 876 | 0.679688 | 0.668527 | 41 | 20.853659 | 15.423392 | 49 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.02439 | false | false |
9
|
d3bc09067064eb4b119b463ef2911bd0121db21d
| 14,585,708,966,761 |
2ec905b5b130bed2aa6f1f37591317d80b7ce70d
|
/atlas/src/main/java/us/ihmc/atlas/behaviors/AtlasLookAndStepParameters.java
|
930cf33ed0995c9bd599d6e812a0cfdfb27a2642
|
[
"Apache-2.0"
] |
permissive
|
ihmcrobotics/ihmc-open-robotics-software
|
https://github.com/ihmcrobotics/ihmc-open-robotics-software
|
dbb1f9d7a4eaf01c08068b7233d1b01d25c5d037
|
42a4e385af75e8e13291d6156a5c7bebebbecbfd
|
refs/heads/develop
| 2023-09-01T18:18:14.623000 | 2023-09-01T14:16:26 | 2023-09-01T14:16:26 | 50,613,360 | 227 | 91 | null | false | 2023-01-25T21:39:35 | 2016-01-28T21:00:16 | 2023-01-23T10:08:40 | 2023-01-25T21:39:32 | 980,849 | 195 | 77 | 30 |
Java
| false | false |
package us.ihmc.atlas.behaviors;
import us.ihmc.behaviors.lookAndStep.LookAndStepBehaviorParameters;
import us.ihmc.log.LogTools;
/**
* The JSON file for this property set is located here:
* atlas/src/main/resources/us/ihmc/atlas/behaviors/LookAndStepParametersForAtlas.json
*/
public class AtlasLookAndStepParameters extends LookAndStepBehaviorParameters
{
public AtlasLookAndStepParameters()
{
super(AtlasLookAndStepParameters.class, "ForAtlas");
}
public static void main(String[] args)
{
AtlasLookAndStepParameters parameters = new AtlasLookAndStepParameters();
LogTools.info(parameters.getTitle());
}
}
|
UTF-8
|
Java
| 650 |
java
|
AtlasLookAndStepParameters.java
|
Java
|
[] | null |
[] |
package us.ihmc.atlas.behaviors;
import us.ihmc.behaviors.lookAndStep.LookAndStepBehaviorParameters;
import us.ihmc.log.LogTools;
/**
* The JSON file for this property set is located here:
* atlas/src/main/resources/us/ihmc/atlas/behaviors/LookAndStepParametersForAtlas.json
*/
public class AtlasLookAndStepParameters extends LookAndStepBehaviorParameters
{
public AtlasLookAndStepParameters()
{
super(AtlasLookAndStepParameters.class, "ForAtlas");
}
public static void main(String[] args)
{
AtlasLookAndStepParameters parameters = new AtlasLookAndStepParameters();
LogTools.info(parameters.getTitle());
}
}
| 650 | 0.770769 | 0.770769 | 22 | 28.545454 | 29.682758 | 86 | false | false | 0 | 0 | 0 | 0 | 78 | 0.12 | 0.318182 | false | false |
9
|
ef40d9f9facb39806ee25c1ef662348a6bd8863d
| 14,585,708,967,243 |
ca1f825ba7c09558ece0eb13db53546539cba7ee
|
/app/src/main/java/com/example/fcmpushnotification/ApiCalls.java
|
10275ae54b80755cb236af395e6d0b97ff3a94fe
|
[
"MIT"
] |
permissive
|
Meenendu/Android-firebase-push-notification
|
https://github.com/Meenendu/Android-firebase-push-notification
|
44a73464e3cb29e5a891199d6f4f81c17962d5b1
|
a84d6dfcbd8b3eca2921d621eaa81d182d0ea93d
|
refs/heads/master
| 2023-02-04T00:52:42.928000 | 2021-01-28T08:42:33 | 2021-01-28T08:42:33 | 204,452,792 | 0 | 1 |
MIT
| false | 2023-01-09T11:53:17 | 2019-08-26T10:31:52 | 2021-01-28T08:42:36 | 2023-01-09T11:53:15 | 280 | 0 | 1 | 5 |
Java
| false | false |
package com.example.fcmpushnotification;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.POST;
import retrofit2.http.Path;
public interface ApiCalls {
@POST("/send/{token}")
Call<Void> sendMessage(@Body MessageData message, @Path("token") String token);
}
|
UTF-8
|
Java
| 291 |
java
|
ApiCalls.java
|
Java
|
[] | null |
[] |
package com.example.fcmpushnotification;
import retrofit2.Call;
import retrofit2.http.Body;
import retrofit2.http.POST;
import retrofit2.http.Path;
public interface ApiCalls {
@POST("/send/{token}")
Call<Void> sendMessage(@Body MessageData message, @Path("token") String token);
}
| 291 | 0.75945 | 0.745704 | 11 | 25.454546 | 22.235777 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.636364 | false | false |
9
|
94ed102e53b7797f9d944707b9af19a860a6ff16
| 2,456,721,361,628 |
c71c2a60c06e4f2a064d89a69fd204b1e9aea429
|
/unix-common/src/main/java/com/stratio/mojo/unix/io/IoEffect.java
|
85d6c682e2948e6001906a381a79030bba2fc011
|
[
"MIT"
] |
permissive
|
jpgilaberte-stratio/unix-maven-plugin
|
https://github.com/jpgilaberte-stratio/unix-maven-plugin
|
58c91d91902dbc2834bf93e5125ccda187fa15f4
|
2067659131c129f0262fdd8531de13599f128535
|
refs/heads/master
| 2021-01-16T23:09:09.052000 | 2016-03-08T16:40:29 | 2016-03-08T16:40:29 | null | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.stratio.mojo.unix.io;
public interface IoEffect
{
void run()
throws Exception;
}
|
UTF-8
|
Java
| 107 |
java
|
IoEffect.java
|
Java
|
[] | null |
[] |
package com.stratio.mojo.unix.io;
public interface IoEffect
{
void run()
throws Exception;
}
| 107 | 0.672897 | 0.672897 | 7 | 14.142858 | 12.743946 | 33 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.285714 | false | false |
9
|
480bf42c38a291666947719835dc3a1fd4af50b0
| 32,427,003,115,749 |
17f5cd9facebddb84c606c5cada7c6ea6bceb9ef
|
/CompleteJava/src/multiThreading/PriorityThread.java
|
2363779a4cf554af83201f42090fb3db8e05e677
|
[] |
no_license
|
cmani97/Java-Practice-Code
|
https://github.com/cmani97/Java-Practice-Code
|
d000fb4b7f4d1af5cb3ff6b43c4f75f3d24bf315
|
9f37c2c615c79acb3c6409cd989779c73f426cd0
|
refs/heads/master
| 2023-07-12T08:45:27.411000 | 2021-08-19T05:37:51 | 2021-08-19T05:48:06 | 286,197,564 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package multiThreading;
class MultiThread2 extends Thread {
public void run() {
System.out.println("Thread id : "+ Thread.currentThread().getId());
System.out.println("Thread priority : "+Thread.currentThread().getPriority());
}
}
public class PriorityThread {
public static void main(String args[]) {
MultiThread2 mt1 = new MultiThread2();
MultiThread2 mt2 = new MultiThread2();
mt1.setPriority(1);
mt2.setPriority(Thread.MAX_PRIORITY);
mt1.start();
mt2.start();
}
}
|
UTF-8
|
Java
| 493 |
java
|
PriorityThread.java
|
Java
|
[] | null |
[] |
package multiThreading;
class MultiThread2 extends Thread {
public void run() {
System.out.println("Thread id : "+ Thread.currentThread().getId());
System.out.println("Thread priority : "+Thread.currentThread().getPriority());
}
}
public class PriorityThread {
public static void main(String args[]) {
MultiThread2 mt1 = new MultiThread2();
MultiThread2 mt2 = new MultiThread2();
mt1.setPriority(1);
mt2.setPriority(Thread.MAX_PRIORITY);
mt1.start();
mt2.start();
}
}
| 493 | 0.707911 | 0.68357 | 21 | 22.476191 | 22.670769 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.428571 | false | false |
9
|
3fe156fa3eea10963b71392b35d15f72e8be8541
| 29,128,468,231,410 |
dbbabcc61cfd5cd086fc5e0eb9fb3fdc2d5cf8c5
|
/src/com/rohitkaundal/mypeid/MyPeidWebAPI.java
|
2ecb583e4092ca14224cea6d8f5dacf51fde3ed9
|
[] |
no_license
|
rohit-kaundal/mypeid-app
|
https://github.com/rohit-kaundal/mypeid-app
|
b8a34230243e891b859bcf358760087714dfb659
|
16052ce93d50d0c03804297420311786561c813a
|
refs/heads/master
| 2021-01-10T04:23:38.835000 | 2016-01-26T12:59:49 | 2016-01-26T12:59:49 | 50,428,172 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package com.rohitkaundal.mypeid;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.security.SecureRandom;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.List;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import javax.security.cert.CertificateException;
import org.apache.*;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.*;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONException;
import org.json.JSONObject;
public class MyPeidWebAPI {
/**
* Class Vairables URL
*/
InputStream is = null;
JSONObject jobj = null;
String json = "";
public final String register_request_otp_url = "https://www.mypeid.com/mypeservices/public/mypeuser/";
public final String register_newuser_url = "https://www.mypeid.com/mypeservices/public/mypeuser";
public final String forgotpassword_getotp_url = "https://www.mypeid.com/mypeservices/public/forgotpassword/";
public final String forgotpassword_updatepassword_url = "https://www.mypeid.com/mypeservices/public/forgotpassword";
public final String authenticate_url = "https://www.mypeid.com/mypeservices/public/authenticate";
public final String addressbook_viewcontacts_url = "https://www.mypeid.com/mypeservices/public/addressbook/919492389969?token=XXX";
public final String addressbook_editcontatcs_url = "https://www.mypeid.com/mypeservices/public/addressbook/2/edit?name=ram&email=ram&firstname=ram&surname=ram&token=xxxx";
public final String addressbook_addcontatcs_url = "https://www.mypeid.com/mypeservices/public/addressbook/";
public String register_request_id = "";
public String forgotpassword_request_id = "";
public String _token = "";
public String OTP_Registeration = "";
public String OTP_forgotpassword = "";
/**
*
*/
public MyPeidWebAPI() {
SSLUtilities.trustAllHostnames();
SSLUtilities.trustAllHttpsCertificates();
}
// this method returns json object.
public JSONObject makePostHttpRequest(String url, List<NameValuePair> params) {
// http client helps to send and receive data
// our request method is post
try {
DefaultHttpClient httpclient = buildhttpClient();
// get the response
HttpPost httpost = new HttpPost(url);
httpost.setEntity(new UrlEncodedFormEntity(params));
HttpResponse httpresponse = httpclient.execute(httpost);
HttpEntity httpentity = httpresponse.getEntity();
is = httpentity.getContent();
// get the content and store it into inputstream object.
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
System.out.println(e.getLocalizedMessage());
} catch (IOException e) {
// TODO Auto-generated catch block
System.out.println(e.getLocalizedMessage());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
// convert byte-stream to character-stream.
BufferedReader reader = new BufferedReader(new InputStreamReader(
is, "iso-8859-1"), 8);
StringBuilder sb = new StringBuilder();
String line = null;
try {
while ((line = reader.readLine()) != null) {
sb.append(line + "\n");
}
// close the input stream
is.close();
json = sb.toString();
try {
jobj = new JSONObject(json);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
return jobj;
// return null;
}
/**
*
* @param url
* @return
*/
private DefaultHttpClient buildhttpClient() throws Exception {
final X509Certificate[] _AcceptedIssuers = new X509Certificate[] {};
/*
* try { SSLContext ctx = SSLContext.getInstance("TLS");
* X509TrustManager tm = new X509TrustManager() {
*
* @Override public X509Certificate[] getAcceptedIssuers() { return
* _AcceptedIssuers; }
*
* @Override public void checkServerTrusted(X509Certificate[] chain,
* String authType) { }
*
* @Override public void checkClientTrusted(X509Certificate[] chain,
* String authType) { } }; ctx.init(null, new TrustManager[] { tm }, new
* SecureRandom()); // SSLSocketFactory ssf = new SSLSocketFactory(ctx,
* // SSLSocketFactory.this.); //ClientConnectionManager ccm =
* httpClient.getConnectionManager(); //SchemeRegistry sr =
* ccm.getSchemeRegistry(); //sr.register(new Scheme("https", 443,
* ssf)); return new DefaultHttpClient(); } catch (Exception e) { throw
* e; }
*/
return new DefaultHttpClient();
}
// this method returns json object.
public JSONObject makeGetHttpRequest(String url) {
// http client helps to send and receive data
DefaultHttpClient httpclient = new DefaultHttpClient();
// our request method is post
try {
// get the response
HttpGet httpost = new HttpGet(url);
HttpResponse httpresponse = httpclient.execute(httpost);
// System.out.println(httpresponse.getStatusLine().toString());
HttpEntity httpentity = httpresponse.getEntity();
is = httpentity.getContent();
// get the content and store it into inputstream object.
// convert byte-stream to character-stream.
BufferedReader reader = new BufferedReader(new InputStreamReader(
is, "UTF-8"), 8);
StringBuilder sb = new StringBuilder();
String line = null;
try {
while ((line = reader.readLine()) != null) {
sb.append(line + "\n");
}
// close the input stream
is.close();
json = sb.toString();
try {
jobj = new JSONObject(json);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
System.out.println(e.getLocalizedMessage());
} catch (IOException e) {
// TODO Auto-generated catch block
System.out.println(e.getLocalizedMessage());
}
return jobj;
// return null;
}
/**
*
* @param strMobileNumber
* Mobile number to get otp on
* @return returns unique request id on success and null on failure
*/
public String getOTP(String strMobileNumber) {
String url = this.register_request_otp_url + strMobileNumber;
try {
JSONObject jobj = makeGetHttpRequest(url);
this.setRegister_request_id(jobj.getString("request_id"));
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
return getRegister_request_id();
}
/**
*
* @param strMobileNumber
* @param strOTP
* @param strPassword
* @param strVerifyPassword
* @param strRequestID
* @return
*/
public boolean RegisterUser(String strMobileNumber, String strOTP,
String strPassword, String strVerifyPassword, String strRequestID) {
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("mobile", strMobileNumber));
params.add(new BasicNameValuePair("otp", strOTP));
params.add(new BasicNameValuePair("password", strPassword));
params.add(new BasicNameValuePair("verifypassword", strVerifyPassword));
params.add(new BasicNameValuePair("request_id", strRequestID));
JSONObject jobj = makePostHttpRequest(this.register_newuser_url, params);
if (null != jobj) {
System.out.println(jobj.toString());
return true;
} else
return false;
}
/**
* Returns request id for forgot password for mobile number
*
* @param strMobileNumber
* mobile number whose password to reset
* @return
*/
public String getOTPForgotPassword(String strMobileNumber) {
String url = this.forgotpassword_getotp_url + strMobileNumber;
try {
JSONObject jobj = makeGetHttpRequest(url);
this.forgotpassword_request_id = jobj.getString("request_id");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
return getForgotpassword_request_id();
}
public Boolean boolVerifyPassword(String strMobileNumber, String strOtp,
String strPassword, String strvPassword, String strRequestId) {
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("mobile", strMobileNumber));
params.add(new BasicNameValuePair("otp", strOtp));
params.add(new BasicNameValuePair("password", strPassword));
params.add(new BasicNameValuePair("verifypassword", strvPassword));
params.add(new BasicNameValuePair("request_id", strRequestId));
try
{
JSONObject jobj = makePostHttpRequest(this.forgotpassword_updatepassword_url, params);
if (null != jobj) {
return true;
} else
return false;
}catch(Exception e)
{
return false;
}
}
/**
*
* @param strMobileNumber
* @return
*/
public String forgotPassword(String strMobileNumber) {
return null;
}
public InputStream getIs() {
return is;
}
public void setIs(InputStream is) {
this.is = is;
}
public JSONObject getJobj() {
return jobj;
}
public void setJobj(JSONObject jobj) {
this.jobj = jobj;
}
public String getJson() {
return json;
}
public void setJson(String json) {
this.json = json;
}
public String getRegister_request_id() {
return register_request_id;
}
public void setRegister_request_id(String register_request_id) {
this.register_request_id = register_request_id;
}
public String get_token() {
return _token;
}
public void set_token(String _token) {
this._token = _token;
}
/**
* This function returns a valid token on successful authentication else
* return null on invalid user name and password
*
* @param strUsername
* @param strPassword
* @return
*/
public String authenticateUser(String strUsername, String strPassword) {
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("username", strUsername));
params.add(new BasicNameValuePair("password", strPassword));
try
{
JSONObject jobj = makePostHttpRequest(this.authenticate_url, params);
if (null != jobj) {
String strToken = jobj.getString("token");
return strToken;
} else
return null;
}catch(Exception e)
{
e.printStackTrace();
}
return null;
}
public String getForgotpassword_request_id() {
return forgotpassword_request_id;
}
public void setForgotpassword_request_id(String forgotpassword_request_id) {
this.forgotpassword_request_id = forgotpassword_request_id;
}
public String getOTP_Registeration() {
return OTP_Registeration;
}
public void setOTP_Registeration(String oTP_Registeration) {
OTP_Registeration = oTP_Registeration;
}
public String getOTP_forgotpassword() {
return OTP_forgotpassword;
}
public void setOTP_forgotpassword(String oTP_forgotpassword) {
OTP_forgotpassword = oTP_forgotpassword;
}
}
|
UTF-8
|
Java
| 11,654 |
java
|
MyPeidWebAPI.java
|
Java
|
[
{
"context": ");\n\t\tparams.add(new BasicNameValuePair(\"password\", strPassword));\n\t\tparams.add(new BasicNameValuePair(\"verifypas",
"end": 7895,
"score": 0.7072780728340149,
"start": 7884,
"tag": "PASSWORD",
"value": "strPassword"
},
{
"context": ");\n\t\tparams.add(new BasicNameValuePair(\"password\", strPassword));\n\t\tparams.add(new BasicNameValuePair(\"v",
"end": 9173,
"score": 0.7449472546577454,
"start": 9170,
"tag": "PASSWORD",
"value": "str"
},
{
"context": ");\n\t\tparams.add(new BasicNameValuePair(\"password\", strPassword));\n\t\t\n\t\t\n\t\ttry\n\t\t{\n\t\t\tJSONObject jobj = makePostH",
"end": 10771,
"score": 0.6603407859802246,
"start": 10760,
"tag": "PASSWORD",
"value": "strPassword"
}
] | null |
[] |
package com.rohitkaundal.mypeid;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException;
import java.security.SecureRandom;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.List;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import javax.security.cert.CertificateException;
import org.apache.*;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.*;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.conn.scheme.Scheme;
import org.apache.http.conn.scheme.SchemeRegistry;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.message.BasicNameValuePair;
import org.json.JSONException;
import org.json.JSONObject;
public class MyPeidWebAPI {
/**
* Class Vairables URL
*/
InputStream is = null;
JSONObject jobj = null;
String json = "";
public final String register_request_otp_url = "https://www.mypeid.com/mypeservices/public/mypeuser/";
public final String register_newuser_url = "https://www.mypeid.com/mypeservices/public/mypeuser";
public final String forgotpassword_getotp_url = "https://www.mypeid.com/mypeservices/public/forgotpassword/";
public final String forgotpassword_updatepassword_url = "https://www.mypeid.com/mypeservices/public/forgotpassword";
public final String authenticate_url = "https://www.mypeid.com/mypeservices/public/authenticate";
public final String addressbook_viewcontacts_url = "https://www.mypeid.com/mypeservices/public/addressbook/919492389969?token=XXX";
public final String addressbook_editcontatcs_url = "https://www.mypeid.com/mypeservices/public/addressbook/2/edit?name=ram&email=ram&firstname=ram&surname=ram&token=xxxx";
public final String addressbook_addcontatcs_url = "https://www.mypeid.com/mypeservices/public/addressbook/";
public String register_request_id = "";
public String forgotpassword_request_id = "";
public String _token = "";
public String OTP_Registeration = "";
public String OTP_forgotpassword = "";
/**
*
*/
public MyPeidWebAPI() {
SSLUtilities.trustAllHostnames();
SSLUtilities.trustAllHttpsCertificates();
}
// this method returns json object.
public JSONObject makePostHttpRequest(String url, List<NameValuePair> params) {
// http client helps to send and receive data
// our request method is post
try {
DefaultHttpClient httpclient = buildhttpClient();
// get the response
HttpPost httpost = new HttpPost(url);
httpost.setEntity(new UrlEncodedFormEntity(params));
HttpResponse httpresponse = httpclient.execute(httpost);
HttpEntity httpentity = httpresponse.getEntity();
is = httpentity.getContent();
// get the content and store it into inputstream object.
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
System.out.println(e.getLocalizedMessage());
} catch (IOException e) {
// TODO Auto-generated catch block
System.out.println(e.getLocalizedMessage());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
// convert byte-stream to character-stream.
BufferedReader reader = new BufferedReader(new InputStreamReader(
is, "iso-8859-1"), 8);
StringBuilder sb = new StringBuilder();
String line = null;
try {
while ((line = reader.readLine()) != null) {
sb.append(line + "\n");
}
// close the input stream
is.close();
json = sb.toString();
try {
jobj = new JSONObject(json);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
return jobj;
// return null;
}
/**
*
* @param url
* @return
*/
private DefaultHttpClient buildhttpClient() throws Exception {
final X509Certificate[] _AcceptedIssuers = new X509Certificate[] {};
/*
* try { SSLContext ctx = SSLContext.getInstance("TLS");
* X509TrustManager tm = new X509TrustManager() {
*
* @Override public X509Certificate[] getAcceptedIssuers() { return
* _AcceptedIssuers; }
*
* @Override public void checkServerTrusted(X509Certificate[] chain,
* String authType) { }
*
* @Override public void checkClientTrusted(X509Certificate[] chain,
* String authType) { } }; ctx.init(null, new TrustManager[] { tm }, new
* SecureRandom()); // SSLSocketFactory ssf = new SSLSocketFactory(ctx,
* // SSLSocketFactory.this.); //ClientConnectionManager ccm =
* httpClient.getConnectionManager(); //SchemeRegistry sr =
* ccm.getSchemeRegistry(); //sr.register(new Scheme("https", 443,
* ssf)); return new DefaultHttpClient(); } catch (Exception e) { throw
* e; }
*/
return new DefaultHttpClient();
}
// this method returns json object.
public JSONObject makeGetHttpRequest(String url) {
// http client helps to send and receive data
DefaultHttpClient httpclient = new DefaultHttpClient();
// our request method is post
try {
// get the response
HttpGet httpost = new HttpGet(url);
HttpResponse httpresponse = httpclient.execute(httpost);
// System.out.println(httpresponse.getStatusLine().toString());
HttpEntity httpentity = httpresponse.getEntity();
is = httpentity.getContent();
// get the content and store it into inputstream object.
// convert byte-stream to character-stream.
BufferedReader reader = new BufferedReader(new InputStreamReader(
is, "UTF-8"), 8);
StringBuilder sb = new StringBuilder();
String line = null;
try {
while ((line = reader.readLine()) != null) {
sb.append(line + "\n");
}
// close the input stream
is.close();
json = sb.toString();
try {
jobj = new JSONObject(json);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (ClientProtocolException e) {
// TODO Auto-generated catch block
System.out.println(e.getLocalizedMessage());
} catch (IOException e) {
// TODO Auto-generated catch block
System.out.println(e.getLocalizedMessage());
}
return jobj;
// return null;
}
/**
*
* @param strMobileNumber
* Mobile number to get otp on
* @return returns unique request id on success and null on failure
*/
public String getOTP(String strMobileNumber) {
String url = this.register_request_otp_url + strMobileNumber;
try {
JSONObject jobj = makeGetHttpRequest(url);
this.setRegister_request_id(jobj.getString("request_id"));
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
return getRegister_request_id();
}
/**
*
* @param strMobileNumber
* @param strOTP
* @param strPassword
* @param strVerifyPassword
* @param strRequestID
* @return
*/
public boolean RegisterUser(String strMobileNumber, String strOTP,
String strPassword, String strVerifyPassword, String strRequestID) {
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("mobile", strMobileNumber));
params.add(new BasicNameValuePair("otp", strOTP));
params.add(new BasicNameValuePair("password", <PASSWORD>));
params.add(new BasicNameValuePair("verifypassword", strVerifyPassword));
params.add(new BasicNameValuePair("request_id", strRequestID));
JSONObject jobj = makePostHttpRequest(this.register_newuser_url, params);
if (null != jobj) {
System.out.println(jobj.toString());
return true;
} else
return false;
}
/**
* Returns request id for forgot password for mobile number
*
* @param strMobileNumber
* mobile number whose password to reset
* @return
*/
public String getOTPForgotPassword(String strMobileNumber) {
String url = this.forgotpassword_getotp_url + strMobileNumber;
try {
JSONObject jobj = makeGetHttpRequest(url);
this.forgotpassword_request_id = jobj.getString("request_id");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
return getForgotpassword_request_id();
}
public Boolean boolVerifyPassword(String strMobileNumber, String strOtp,
String strPassword, String strvPassword, String strRequestId) {
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("mobile", strMobileNumber));
params.add(new BasicNameValuePair("otp", strOtp));
params.add(new BasicNameValuePair("password", strPassword));
params.add(new BasicNameValuePair("verifypassword", strvPassword));
params.add(new BasicNameValuePair("request_id", strRequestId));
try
{
JSONObject jobj = makePostHttpRequest(this.forgotpassword_updatepassword_url, params);
if (null != jobj) {
return true;
} else
return false;
}catch(Exception e)
{
return false;
}
}
/**
*
* @param strMobileNumber
* @return
*/
public String forgotPassword(String strMobileNumber) {
return null;
}
public InputStream getIs() {
return is;
}
public void setIs(InputStream is) {
this.is = is;
}
public JSONObject getJobj() {
return jobj;
}
public void setJobj(JSONObject jobj) {
this.jobj = jobj;
}
public String getJson() {
return json;
}
public void setJson(String json) {
this.json = json;
}
public String getRegister_request_id() {
return register_request_id;
}
public void setRegister_request_id(String register_request_id) {
this.register_request_id = register_request_id;
}
public String get_token() {
return _token;
}
public void set_token(String _token) {
this._token = _token;
}
/**
* This function returns a valid token on successful authentication else
* return null on invalid user name and password
*
* @param strUsername
* @param strPassword
* @return
*/
public String authenticateUser(String strUsername, String strPassword) {
List<NameValuePair> params = new ArrayList<NameValuePair>();
params.add(new BasicNameValuePair("username", strUsername));
params.add(new BasicNameValuePair("password", <PASSWORD>));
try
{
JSONObject jobj = makePostHttpRequest(this.authenticate_url, params);
if (null != jobj) {
String strToken = jobj.getString("token");
return strToken;
} else
return null;
}catch(Exception e)
{
e.printStackTrace();
}
return null;
}
public String getForgotpassword_request_id() {
return forgotpassword_request_id;
}
public void setForgotpassword_request_id(String forgotpassword_request_id) {
this.forgotpassword_request_id = forgotpassword_request_id;
}
public String getOTP_Registeration() {
return OTP_Registeration;
}
public void setOTP_Registeration(String oTP_Registeration) {
OTP_Registeration = oTP_Registeration;
}
public String getOTP_forgotpassword() {
return OTP_forgotpassword;
}
public void setOTP_forgotpassword(String oTP_forgotpassword) {
OTP_forgotpassword = oTP_forgotpassword;
}
}
| 11,652 | 0.71469 | 0.710314 | 422 | 26.616114 | 26.087067 | 172 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 2.052133 | false | false |
9
|
d2e59c8205d41c4ec24098944e0e724772d938eb
| 300,647,739,625 |
d65c644c467ded4ce46934beb6fe6360ebfa520b
|
/kimble/src/kimble/license/License.java
|
473fa321d2da9c062de300d08a637837184318a0
|
[] |
no_license
|
lybeck/kimble
|
https://github.com/lybeck/kimble
|
5cbed63649157d237c7a31450dbb7529d180aa4b
|
da884f64641b7541706dca594af0feeca45df0f5
|
refs/heads/master
| 2021-01-12T19:18:23.737000 | 2014-07-04T06:35:16 | 2014-07-04T06:35:16 | 19,488,341 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package kimble.license;
import java.util.Scanner;
/**
*
* @author Christoffer
*/
public enum License {
LWJGL_LICENSE("lwjgl_license.txt"),
TWL_LICENSE("twl_license.txt"),
XPP3_LICENSE("xpp3_license.txt"),
GSON_LICENSE("gson_license.txt");
// Enum instance code below. To add a new license just extend the list above this comment.
// Save the license file in the res/licenses/ directory
//
// Example:
// LICENSE_1("filename_1"), LICENSE_2("filename_2"); etc
//
// You access the license text with "License.LICENSE_1.getText();".
//
public static final String LICENSE_DIR = "/res/licenses/";
private final String filename;
License(String filename) {
this.filename = filename;
}
public StringBuilder getText() {
StringBuilder s = new StringBuilder();
Scanner scanner = new Scanner(License.class.getResourceAsStream(LICENSE_DIR + filename));
String line;
while (scanner.hasNextLine()) {
line = scanner.nextLine();
s.append(line).append("\n");
}
scanner.close();
return s;
}
}
|
UTF-8
|
Java
| 1,142 |
java
|
License.java
|
Java
|
[
{
"context": "nse;\n\nimport java.util.Scanner;\n\n/**\n *\n * @author Christoffer\n */\npublic enum License {\n\n LWJGL_LICENSE(\"lwj",
"end": 81,
"score": 0.9996927976608276,
"start": 70,
"tag": "NAME",
"value": "Christoffer"
}
] | null |
[] |
package kimble.license;
import java.util.Scanner;
/**
*
* @author Christoffer
*/
public enum License {
LWJGL_LICENSE("lwjgl_license.txt"),
TWL_LICENSE("twl_license.txt"),
XPP3_LICENSE("xpp3_license.txt"),
GSON_LICENSE("gson_license.txt");
// Enum instance code below. To add a new license just extend the list above this comment.
// Save the license file in the res/licenses/ directory
//
// Example:
// LICENSE_1("filename_1"), LICENSE_2("filename_2"); etc
//
// You access the license text with "License.LICENSE_1.getText();".
//
public static final String LICENSE_DIR = "/res/licenses/";
private final String filename;
License(String filename) {
this.filename = filename;
}
public StringBuilder getText() {
StringBuilder s = new StringBuilder();
Scanner scanner = new Scanner(License.class.getResourceAsStream(LICENSE_DIR + filename));
String line;
while (scanner.hasNextLine()) {
line = scanner.nextLine();
s.append(line).append("\n");
}
scanner.close();
return s;
}
}
| 1,142 | 0.621716 | 0.615587 | 42 | 26.190475 | 24.803263 | 97 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.452381 | false | false |
9
|
f0dcb55ed79583834cc8c4e9b900ed92141b32ff
| 300,647,740,167 |
7987b453e295b2d228a8c783ed572382cf71d043
|
/briana-server/src/main/java/by/ttre16/briana/controller/OrganizationOwnerController.java
|
c06ba1be8e68acf2930dfa1357a53026c023afef
|
[
"LicenseRef-scancode-free-unknown",
"MIT"
] |
permissive
|
21tretiak0101/briana-crm
|
https://github.com/21tretiak0101/briana-crm
|
7c111706a7588ccc2c53deb6d3765a2d3e4869fb
|
280f1d9fe4bc1e78475ad4ba0fe6a82e1ecc61fe
|
refs/heads/dev
| 2023-03-02T23:47:44.986000 | 2021-02-08T20:37:49 | 2021-02-08T20:37:49 | 293,803,671 | 11 | 5 |
MIT
| false | 2021-02-08T20:37:50 | 2020-09-08T12:28:49 | 2020-12-25T13:25:13 | 2021-02-08T20:37:49 | 335 | 2 | 0 | 0 |
Java
| false | false |
package by.ttre16.briana.controller;
import by.ttre16.briana.service.OrganizationOwnerService;
import by.ttre16.briana.transport.EmployeeTo;
import by.ttre16.briana.transport.OrganizationOwner;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
import java.net.URI;
import static by.ttre16.briana.controller.ApiMapping.OWNER_REST_URL;
@RestController
@RequestMapping(OWNER_REST_URL)
@RequiredArgsConstructor
public class OrganizationOwnerController {
private final OrganizationOwnerService organizationOwnerService;
@PostMapping(
consumes = MediaType.APPLICATION_JSON_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE
)
@ResponseStatus(HttpStatus.CREATED)
public ResponseEntity<EmployeeTo> create(
@RequestBody OrganizationOwner organizationOwner) {
EmployeeTo created = organizationOwnerService.create(organizationOwner);
URI resourceUri = ServletUriComponentsBuilder.fromCurrentContextPath()
.path("/api/{id}")
.buildAndExpand(created.getId()).toUri();
return ResponseEntity
.created(resourceUri)
.body(created);
}
}
|
UTF-8
|
Java
| 1,422 |
java
|
OrganizationOwnerController.java
|
Java
|
[] | null |
[] |
package by.ttre16.briana.controller;
import by.ttre16.briana.service.OrganizationOwnerService;
import by.ttre16.briana.transport.EmployeeTo;
import by.ttre16.briana.transport.OrganizationOwner;
import lombok.RequiredArgsConstructor;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;
import java.net.URI;
import static by.ttre16.briana.controller.ApiMapping.OWNER_REST_URL;
@RestController
@RequestMapping(OWNER_REST_URL)
@RequiredArgsConstructor
public class OrganizationOwnerController {
private final OrganizationOwnerService organizationOwnerService;
@PostMapping(
consumes = MediaType.APPLICATION_JSON_VALUE,
produces = MediaType.APPLICATION_JSON_VALUE
)
@ResponseStatus(HttpStatus.CREATED)
public ResponseEntity<EmployeeTo> create(
@RequestBody OrganizationOwner organizationOwner) {
EmployeeTo created = organizationOwnerService.create(organizationOwner);
URI resourceUri = ServletUriComponentsBuilder.fromCurrentContextPath()
.path("/api/{id}")
.buildAndExpand(created.getId()).toUri();
return ResponseEntity
.created(resourceUri)
.body(created);
}
}
| 1,422 | 0.756681 | 0.749648 | 38 | 36.421051 | 23.736084 | 80 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.447368 | false | false |
9
|
52a07286d0fd7308832bbc73244b2a78d8d69b51
| 19,636,590,538,407 |
617b9430b27675084678941e7348ccdaa217e8f2
|
/src/main/java/SeleniumSessions/VerifyAllLinksOnSetUpPage.java
|
b0aed9ae3a3cb6c37262f18dfe89c358b4b15303
|
[] |
no_license
|
hsharan/Sharan6701SeleniumWork
|
https://github.com/hsharan/Sharan6701SeleniumWork
|
0283bb8c433dea2a0981666e552a07d8c9c817ea
|
da08748c6f44dbaa83af7ecd91032b2772ea017e
|
refs/heads/master
| 2023-06-05T12:54:38.506000 | 2021-06-24T16:02:27 | 2021-06-24T16:02:27 | 379,979,495 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package SeleniumSessions;
import java.sql.Timestamp;
import java.time.Duration;
import java.time.Instant;
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.apache.commons.lang3.time.StopWatch;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import io.github.bonigarcia.wdm.WebDriverManager;
public class VerifyAllLinksOnSetUpPage {
static WebDriver driver;
public static void main(String[] args) throws InterruptedException {
WebDriverManager.chromedriver().setup();
driver = new ChromeDriver();
driver.get("http://sharantest6701/dist/#/login");
// driver.get("https://quickship-p21test.azurewebsites.net/dist/#/login");
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(2000, TimeUnit.SECONDS);
Thread.sleep(1000);
Date date = new Date();
Timestamp ts=new Timestamp(date.getTime());
//System.out.println(ts);
By regCode = By.xpath("//label[text()='Registration Code']/..//input");
By un = By.xpath("//label[text()='User Name']/..//input");
By pwd = By.xpath("//label[text()='Password']/..//input");
By loginBtn = By.xpath("//button[@type='submit']//div");
By home = By.xpath("//li[@id='Home']");
By setup = By.xpath("//h4[text()='Setup']");
By appSet = By.xpath("//h4[text()='App Settings']");
By bolClass = By.xpath("//h4[text()='BOL Classes']");
By cXMLfiles = By.xpath("//h4[text()='Carrier Xml Files']");
By conType = By.xpath("//h4[text()='Container Types']");
By contry = By.xpath("//h4[text()='Countries']");
By ccRate = By.xpath("//h4[text()='Currency Conversion Rate']");
By custMsg = By.xpath("//h4[text()='Custom Messages']");
By customers = By.xpath("//h4[text()='Customers']");
By dataPackagerImport = By.xpath("//h4[text()='Data Packager Import']");
By dpMaintenance = By.xpath("//h4[text()='Data Packager Maintenance']");
By dgis = By.xpath("//h4[text()='DGIS Regulation']");
By docMgr = By.xpath("//h4[text()='Document Manager']");
By DwnLoad = By.xpath("//h4[text()='Downloads']");
By epicorDM = By.xpath("//h4[text()='Epicor Data Mapping']");
By emailTemplate = By.xpath("//h4[text()='Email Templates']");
By exportLicense = By.xpath("//h4[text()='Export License']");
By facilities = By.xpath("//h4[text()='Facilities']");
By genCarrier = By.xpath("//h4[text()='Generic Carriers']");
By hazGrp = By.xpath("//h4[text()='Hazmat Group']");
By prods = By.xpath("//h4[text()='Products']");
By proxySettings = By.xpath("//h4[text()='Proxy Settings']");
By qMgr = By.xpath("//h4[text()='Query Manager']");
By shipCode = By.xpath("//h4[text()='Ship Codes']");
By shipChargeSchema = By.xpath("//h4[text()='Shipping Charge Schemes']");
By triffCode = By.xpath("//h4[text()='Tariff Codes']");
By Usr = By.xpath("//h4[text()='Users']");
//System.out.println("Test Starts : "+ ts);
StopWatch stopwatch = new StopWatch();
stopwatch.start();
//long timeElapsedStart = date.getTime();
//System.out.println("Execution time in milliseconds:" +date.getTime());
// System.out.println(duration);
doSendKeys(regCode, "SharanDemo");
doSendKeys(un, "admin");
doSendKeys(pwd, "password123");
doClick(loginBtn);
// =========================== Quickship Home screen
System.out.println(driver.getTitle());
Thread.sleep(100);
By h1_header_hm = By.xpath("//h1[text()='Quick Ship']");
String hm1 = "Quick Ship";
System.out.print(driver.findElement(h1_header_hm).getText());
String stra = driver.findElement(h1_header_hm).getText();
if (hm1.equals(stra)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
Thread.sleep(5000);
// *************** Setup screen
doClick(setup);
By h2_header_se = By.xpath("//h1[text()='Setup']");
String se1 = "Setup";
System.out.print(driver.findElement(h2_header_se).getText());
String str7 = driver.findElement(h2_header_se).getText();
if (se1.equals(str7)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" : Heading mis-matches : FAIL");
}
// *************** Setup screen >> Application Setting Page
doClick(appSet);
By h2_header_appsets = By.xpath("//h1[text()='Application Settings']");
String cc1 = "Application Settings";
System.out.print(driver.findElement(h2_header_appsets).getText());
String str2 = driver.findElement(h2_header_appsets).getText();
if (cc1.equals(str2)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >> BOL Class Page
doClick(bolClass);
By h1_header_bc = By.xpath("//h1[text()='BOL Class']");
String bc1 = "BOL Class";
System.out.print(driver.findElement(h1_header_bc).getText());
String bc = driver.findElement(h1_header_bc).getText();
if (bc1.equals(bc)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >> Carrier Xml Files Page
doClick(cXMLfiles);
By h1_header_cxf = By.xpath("//h1[text()='Carrier Xml Files']");
String cxf1 = "Carrier Xml Files";
System.out.print(driver.findElement(h1_header_cxf).getText());
String cxf = driver.findElement(h1_header_cxf).getText();
if (cxf1.equals(cxf)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >> Container Types Page
doClick(conType);
Thread.sleep(5000);
By h1_header_ct = By.xpath("//h5[text()='Container Types']");
String ct1 = "Container Types";
System.out.print(driver.findElement(h1_header_ct).getText());
String ct = driver.findElement(h1_header_ct).getText();
if (ct1.equals(ct)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>Currency Conversion Rate Page
doClick(ccRate);
By h1_header_ccr = By.xpath("//h1[text()='Currency Conversion Rate']");
String ccr1 = "Currency Conversion Rate";
System.out.print(driver.findElement(h1_header_ccr).getText());
String ccr = driver.findElement(h1_header_ccr).getText();
if (ccr1.equals(ccr)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>Countries Page
doClick(contry);
Thread.sleep(1000);
By h1_header_ctn = By.xpath("//h5[text()='Countries']");
String ctn1 = "Countries";
System.out.print(driver.findElement(h1_header_ctn).getText());
String ctn = driver.findElement(h1_header_ctn).getText();
if (ctn1.equals(ctn)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>Custom Messages Page
doClick(custMsg);
By h1_header_cMsg = By.xpath("//h1[text()='Custom Messages']");
String msg1 = "Custom Messages";
System.out.print(driver.findElement(h1_header_cMsg).getText());
String msg = driver.findElement(h1_header_cMsg).getText();
if (msg1.equals(msg)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>Customers Page
doClick(customers);
By h1_header_cust = By.xpath("//h5[text()='Customers']");
String cust1 = "Customers";
System.out.print(driver.findElement(h1_header_cust).getText());
String cust = driver.findElement(h1_header_cust).getText();
if (cust1.equals(cust)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>Data Packager Import Page
doClick(dataPackagerImport);
Thread.sleep(5000);
By h1_header_dp = By.xpath("//h1[text()='Data Package Import']");
String dp1 = "Data Package Import";
System.out.print(driver.findElement(h1_header_dp).getText());
String dp = driver.findElement(h1_header_dp).getText();
if (dp1.equals(dp)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>Data Packager Maintenance Page
doClick(dpMaintenance);
Thread.sleep(5000);
By h1_header_dpmTest = By.xpath("//h1[text()='Datapackager Maintenance']");
String dpmTest1 = "Datapackager Maintenance";
System.out.print(driver.findElement(h1_header_dpmTest).getText());
String dpmTest = driver.findElement(h1_header_dpmTest).getText();
if (dpmTest1.equals(dpmTest)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>DGIS Regulation Page
doClick(dgis);
Thread.sleep(5000);
By h1_header_dgisTest = By.xpath("//h1[text()='DGIS Regulation Manager']");
String dgisTest1 = "DGIS Regulation Manager";
System.out.print(driver.findElement(h1_header_dgisTest).getText());
String dgisTest = driver.findElement(h1_header_dgisTest).getText();
if (dgisTest1.equals(dgisTest)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>Document Manager Page
doClick(docMgr);
Thread.sleep(5000);
By h1_header_docMgr = By.xpath("//h1[text()='Document Manager']");
String docMgrr1 = "Document Manager";
System.out.print(driver.findElement(h1_header_docMgr).getText());
String docMgrr = driver.findElement(h1_header_docMgr).getText();
if (docMgrr1.equals(docMgrr)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>Downloads Page
doClick(DwnLoad);
Thread.sleep(5000);
By h1_header_dlTest = By.xpath("//h1[text()='Downloads']");
String dl1 = "Downloads";
System.out.print(driver.findElement(h1_header_dlTest).getText());
String dlTest = driver.findElement(h1_header_dlTest).getText();
if (dl1.equals(dlTest)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>Epicor Data Mapping Page
doClick(epicorDM);
Thread.sleep(5000);
By h1_header_eDMTest = By.xpath("//h1[text()='Epicor Data Mapping']");
String eDM1 = "Epicor Data Mapping";
System.out.print(driver.findElement(h1_header_eDMTest).getText());
String eDMTest = driver.findElement(h1_header_eDMTest).getText();
if (eDM1.equals(eDMTest)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>Email Template Page
doClick(emailTemplate);
Thread.sleep(5000);
By h1_header_emailTemp = By.xpath("//div[contains(text(),' Email Template ')]");
String emailTemp1 = " Email Template ";
System.out.print(driver.findElement(h1_header_emailTemp).getText());
String emailTemp = driver.findElement(h1_header_emailTemp).getText();
if (emailTemp1.equals(emailTemp)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>Export License Page
doClick(exportLicense);
Thread.sleep(5000);
By h1_header_exportLic = By.xpath("//h1[text()='Export License']");
String exportLic1 = "Export License";
System.out.print(driver.findElement(h1_header_exportLic).getText());
String exportLic = driver.findElement(h1_header_exportLic).getText();
if (exportLic1.equals(exportLic)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>Facilities Page
doClick(facilities);
Thread.sleep(5000);
By h1_header_facilityTest = By.xpath("//h1[text()='Facilities']");
String facilityTest1 = "Facilities";
System.out.print(driver.findElement(h1_header_facilityTest).getText());
String facilityTest = driver.findElement(h1_header_facilityTest).getText();
if (facilityTest1.equals(facilityTest)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>Generic Carriers Page
doClick(genCarrier);
Thread.sleep(5000);
By h1_header_genCarrierTest = By.xpath("//h2[text()='Generic Carriers']");
String genCarrier1 = "Generic Carriers";
System.out.print(driver.findElement(h1_header_genCarrierTest).getText());
String genCarrierTest = driver.findElement(h1_header_genCarrierTest).getText();
if (genCarrier1.equals(genCarrierTest)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>Hazmat Group Page
doClick(hazGrp);
Thread.sleep(5000);
By h1_header_hZGrpTest = By.xpath("//h1[text()='Hazmat Group']");
String hZGrp1 = "Hazmat Group";
System.out.print(driver.findElement(h1_header_hZGrpTest).getText());
String hZGrpTest = driver.findElement(h1_header_hZGrpTest).getText();
if (hZGrp1.equals(hZGrpTest)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>Products Page
doClick(prods);
Thread.sleep(5000);
By h1_header_prodsTest = By.xpath("//h1[text()='Products']");
String prods1 = "Products";
System.out.print(driver.findElement(h1_header_prodsTest).getText());
String prodsTest = driver.findElement(h1_header_prodsTest).getText();
if (prods1.equals(prodsTest)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>Proxy Settings Page
doClick(proxySettings);
Thread.sleep(5000);
By h1_header_prxySetTest = By.xpath("//h1[text()='Proxy Settings']");
String prxySet1 = "Proxy Settings";
System.out.print(driver.findElement(h1_header_prxySetTest).getText());
String prxySetTest = driver.findElement(h1_header_prxySetTest).getText();
if (prxySet1.equals(prxySetTest)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>Query Manager Page
doClick(qMgr);
Thread.sleep(5000);
By h1_header_queryMgrTest = By.xpath("//h2[text()='Query Manager']");
String queryMgr1 = "Query Manager";
System.out.print(driver.findElement(h1_header_queryMgrTest).getText());
String queryMgrTest = driver.findElement(h1_header_queryMgrTest).getText();
if (queryMgr1.equals(queryMgrTest)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>Ship Codes Page
doClick(shipCode);
Thread.sleep(10000);
By h1_header_shipViaCodeTest = By.xpath("//h2[text()='Ship Codes']");
String shipViaCode1 = "Ship Codes";
System.out.print(driver.findElement(h1_header_shipViaCodeTest).getText());
String shipViaCodeTest = driver.findElement(h1_header_shipViaCodeTest).getText();
if (shipViaCode1.equals(shipViaCodeTest)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>Shipping Charge Scheme Page
doClick(shipChargeSchema);
Thread.sleep(5000);
By h1_header_SCSTest = By.xpath("//h2[text()='Shipping Charge Schemes']");
String SCS1 = "Shipping Charge Schemes";
System.out.print(driver.findElement(h1_header_SCSTest).getText());
String SCSTest = driver.findElement(h1_header_SCSTest).getText();
if (SCS1.equals(SCSTest)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>Tariff Codes Page
doClick(triffCode);
Thread.sleep(5000);
By h1_header_codeTariff = By.xpath("//h1[text()='Tariff Codes']");
String codeTariff1 = "Tariff Codes";
System.out.print(driver.findElement(h1_header_codeTariff).getText());
String codeTariff = driver.findElement(h1_header_codeTariff).getText();
if (codeTariff1.equals(codeTariff)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>Users Page
doClick(Usr);
Thread.sleep(5000);
By h2_header_codeTariff = By.xpath("//h2[text()='User Management']");
String usrTest1 = "User Management";
System.out.print(driver.findElement(h2_header_codeTariff).getText());
String usrTest = driver.findElement(h2_header_codeTariff).getText();
if (usrTest1.equals(usrTest)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
System.out.println("SetUp Page Links Working Fine====>> QA PASS");
stopwatch.stop(); // Optional
long timeElapsed = stopwatch.getTime();
System.out.println("Execution time in Seconds: " + timeElapsed/1000);
//methodToTime();
//Instant finish = Instant.now();
//long timeElapsed = Duration.between(start, finish).toMillis();
// Date endDate = new Date();
// Timestamp eD=new Timestamp(date.getTime());
// System.out.println(eD);
driver.quit();
}
public static WebElement getElement(By locator) {
return driver.findElement(locator);
}
public static void doSendKeys(By locator, String value) {
getElement(locator).sendKeys(value);
}
public static void doClick(By locator) {
getElement(locator).click();
}
public static void tdoClick(By locator) {
getElement(locator).click();
}
private static void methodToTime() {
try {
TimeUnit.SECONDS.sleep(3);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
public void selectDropDownValueWithoutSelectClass(By locator, String value) {
List<WebElement> industry_options_list = driver.findElements(locator);
for (WebElement ele : industry_options_list) {
String text = ele.getText();
if (text.equals(value)) {
ele.click();
break;
}
}
}
}
|
UTF-8
|
Java
| 21,022 |
java
|
VerifyAllLinksOnSetUpPage.java
|
Java
|
[
{
"context": "a.selenium.chrome.ChromeDriver;\n\nimport io.github.bonigarcia.wdm.WebDriverManager;\n\npublic class VerifyAllLink",
"end": 426,
"score": 0.9511309862136841,
"start": 416,
"tag": "USERNAME",
"value": "bonigarcia"
},
{
"context": "tem.out.println(duration);\n\t\tdoSendKeys(regCode, \"SharanDemo\");\n\t\tdoSendKeys(un, \"admin\");\n\t\tdoSendKey",
"end": 3269,
"score": 0.883012592792511,
"start": 3267,
"tag": "KEY",
"value": "Sh"
},
{
"context": "m.out.println(duration);\n\t\tdoSendKeys(regCode, \"SharanDemo\");\n\t\tdoSendKeys(un, \"admin\");\n\t\tdoSendKeys(pwd, \"",
"end": 3277,
"score": 0.38980546593666077,
"start": 3269,
"tag": "USERNAME",
"value": "aranDemo"
},
{
"context": "endKeys(regCode, \"SharanDemo\");\n\t\tdoSendKeys(un, \"admin\");\n\t\tdoSendKeys(pwd, \"password123\");\n\t\tdoClick(lo",
"end": 3304,
"score": 0.9688031077384949,
"start": 3299,
"tag": "USERNAME",
"value": "admin"
},
{
"context": "\");\n\t\tdoSendKeys(un, \"admin\");\n\t\tdoSendKeys(pwd, \"password123\");\n\t\tdoClick(loginBtn);\n\n\t\t// ===================",
"end": 3338,
"score": 0.9991744756698608,
"start": 3327,
"tag": "PASSWORD",
"value": "password123"
}
] | null |
[] |
package SeleniumSessions;
import java.sql.Timestamp;
import java.time.Duration;
import java.time.Instant;
import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
import org.apache.commons.lang3.time.StopWatch;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import io.github.bonigarcia.wdm.WebDriverManager;
public class VerifyAllLinksOnSetUpPage {
static WebDriver driver;
public static void main(String[] args) throws InterruptedException {
WebDriverManager.chromedriver().setup();
driver = new ChromeDriver();
driver.get("http://sharantest6701/dist/#/login");
// driver.get("https://quickship-p21test.azurewebsites.net/dist/#/login");
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(2000, TimeUnit.SECONDS);
Thread.sleep(1000);
Date date = new Date();
Timestamp ts=new Timestamp(date.getTime());
//System.out.println(ts);
By regCode = By.xpath("//label[text()='Registration Code']/..//input");
By un = By.xpath("//label[text()='User Name']/..//input");
By pwd = By.xpath("//label[text()='Password']/..//input");
By loginBtn = By.xpath("//button[@type='submit']//div");
By home = By.xpath("//li[@id='Home']");
By setup = By.xpath("//h4[text()='Setup']");
By appSet = By.xpath("//h4[text()='App Settings']");
By bolClass = By.xpath("//h4[text()='BOL Classes']");
By cXMLfiles = By.xpath("//h4[text()='Carrier Xml Files']");
By conType = By.xpath("//h4[text()='Container Types']");
By contry = By.xpath("//h4[text()='Countries']");
By ccRate = By.xpath("//h4[text()='Currency Conversion Rate']");
By custMsg = By.xpath("//h4[text()='Custom Messages']");
By customers = By.xpath("//h4[text()='Customers']");
By dataPackagerImport = By.xpath("//h4[text()='Data Packager Import']");
By dpMaintenance = By.xpath("//h4[text()='Data Packager Maintenance']");
By dgis = By.xpath("//h4[text()='DGIS Regulation']");
By docMgr = By.xpath("//h4[text()='Document Manager']");
By DwnLoad = By.xpath("//h4[text()='Downloads']");
By epicorDM = By.xpath("//h4[text()='Epicor Data Mapping']");
By emailTemplate = By.xpath("//h4[text()='Email Templates']");
By exportLicense = By.xpath("//h4[text()='Export License']");
By facilities = By.xpath("//h4[text()='Facilities']");
By genCarrier = By.xpath("//h4[text()='Generic Carriers']");
By hazGrp = By.xpath("//h4[text()='Hazmat Group']");
By prods = By.xpath("//h4[text()='Products']");
By proxySettings = By.xpath("//h4[text()='Proxy Settings']");
By qMgr = By.xpath("//h4[text()='Query Manager']");
By shipCode = By.xpath("//h4[text()='Ship Codes']");
By shipChargeSchema = By.xpath("//h4[text()='Shipping Charge Schemes']");
By triffCode = By.xpath("//h4[text()='Tariff Codes']");
By Usr = By.xpath("//h4[text()='Users']");
//System.out.println("Test Starts : "+ ts);
StopWatch stopwatch = new StopWatch();
stopwatch.start();
//long timeElapsedStart = date.getTime();
//System.out.println("Execution time in milliseconds:" +date.getTime());
// System.out.println(duration);
doSendKeys(regCode, "SharanDemo");
doSendKeys(un, "admin");
doSendKeys(pwd, "<PASSWORD>");
doClick(loginBtn);
// =========================== Quickship Home screen
System.out.println(driver.getTitle());
Thread.sleep(100);
By h1_header_hm = By.xpath("//h1[text()='Quick Ship']");
String hm1 = "Quick Ship";
System.out.print(driver.findElement(h1_header_hm).getText());
String stra = driver.findElement(h1_header_hm).getText();
if (hm1.equals(stra)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
Thread.sleep(5000);
// *************** Setup screen
doClick(setup);
By h2_header_se = By.xpath("//h1[text()='Setup']");
String se1 = "Setup";
System.out.print(driver.findElement(h2_header_se).getText());
String str7 = driver.findElement(h2_header_se).getText();
if (se1.equals(str7)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" : Heading mis-matches : FAIL");
}
// *************** Setup screen >> Application Setting Page
doClick(appSet);
By h2_header_appsets = By.xpath("//h1[text()='Application Settings']");
String cc1 = "Application Settings";
System.out.print(driver.findElement(h2_header_appsets).getText());
String str2 = driver.findElement(h2_header_appsets).getText();
if (cc1.equals(str2)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >> BOL Class Page
doClick(bolClass);
By h1_header_bc = By.xpath("//h1[text()='BOL Class']");
String bc1 = "BOL Class";
System.out.print(driver.findElement(h1_header_bc).getText());
String bc = driver.findElement(h1_header_bc).getText();
if (bc1.equals(bc)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >> Carrier Xml Files Page
doClick(cXMLfiles);
By h1_header_cxf = By.xpath("//h1[text()='Carrier Xml Files']");
String cxf1 = "Carrier Xml Files";
System.out.print(driver.findElement(h1_header_cxf).getText());
String cxf = driver.findElement(h1_header_cxf).getText();
if (cxf1.equals(cxf)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >> Container Types Page
doClick(conType);
Thread.sleep(5000);
By h1_header_ct = By.xpath("//h5[text()='Container Types']");
String ct1 = "Container Types";
System.out.print(driver.findElement(h1_header_ct).getText());
String ct = driver.findElement(h1_header_ct).getText();
if (ct1.equals(ct)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>Currency Conversion Rate Page
doClick(ccRate);
By h1_header_ccr = By.xpath("//h1[text()='Currency Conversion Rate']");
String ccr1 = "Currency Conversion Rate";
System.out.print(driver.findElement(h1_header_ccr).getText());
String ccr = driver.findElement(h1_header_ccr).getText();
if (ccr1.equals(ccr)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>Countries Page
doClick(contry);
Thread.sleep(1000);
By h1_header_ctn = By.xpath("//h5[text()='Countries']");
String ctn1 = "Countries";
System.out.print(driver.findElement(h1_header_ctn).getText());
String ctn = driver.findElement(h1_header_ctn).getText();
if (ctn1.equals(ctn)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>Custom Messages Page
doClick(custMsg);
By h1_header_cMsg = By.xpath("//h1[text()='Custom Messages']");
String msg1 = "Custom Messages";
System.out.print(driver.findElement(h1_header_cMsg).getText());
String msg = driver.findElement(h1_header_cMsg).getText();
if (msg1.equals(msg)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>Customers Page
doClick(customers);
By h1_header_cust = By.xpath("//h5[text()='Customers']");
String cust1 = "Customers";
System.out.print(driver.findElement(h1_header_cust).getText());
String cust = driver.findElement(h1_header_cust).getText();
if (cust1.equals(cust)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>Data Packager Import Page
doClick(dataPackagerImport);
Thread.sleep(5000);
By h1_header_dp = By.xpath("//h1[text()='Data Package Import']");
String dp1 = "Data Package Import";
System.out.print(driver.findElement(h1_header_dp).getText());
String dp = driver.findElement(h1_header_dp).getText();
if (dp1.equals(dp)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>Data Packager Maintenance Page
doClick(dpMaintenance);
Thread.sleep(5000);
By h1_header_dpmTest = By.xpath("//h1[text()='Datapackager Maintenance']");
String dpmTest1 = "Datapackager Maintenance";
System.out.print(driver.findElement(h1_header_dpmTest).getText());
String dpmTest = driver.findElement(h1_header_dpmTest).getText();
if (dpmTest1.equals(dpmTest)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>DGIS Regulation Page
doClick(dgis);
Thread.sleep(5000);
By h1_header_dgisTest = By.xpath("//h1[text()='DGIS Regulation Manager']");
String dgisTest1 = "DGIS Regulation Manager";
System.out.print(driver.findElement(h1_header_dgisTest).getText());
String dgisTest = driver.findElement(h1_header_dgisTest).getText();
if (dgisTest1.equals(dgisTest)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>Document Manager Page
doClick(docMgr);
Thread.sleep(5000);
By h1_header_docMgr = By.xpath("//h1[text()='Document Manager']");
String docMgrr1 = "Document Manager";
System.out.print(driver.findElement(h1_header_docMgr).getText());
String docMgrr = driver.findElement(h1_header_docMgr).getText();
if (docMgrr1.equals(docMgrr)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>Downloads Page
doClick(DwnLoad);
Thread.sleep(5000);
By h1_header_dlTest = By.xpath("//h1[text()='Downloads']");
String dl1 = "Downloads";
System.out.print(driver.findElement(h1_header_dlTest).getText());
String dlTest = driver.findElement(h1_header_dlTest).getText();
if (dl1.equals(dlTest)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>Epicor Data Mapping Page
doClick(epicorDM);
Thread.sleep(5000);
By h1_header_eDMTest = By.xpath("//h1[text()='Epicor Data Mapping']");
String eDM1 = "Epicor Data Mapping";
System.out.print(driver.findElement(h1_header_eDMTest).getText());
String eDMTest = driver.findElement(h1_header_eDMTest).getText();
if (eDM1.equals(eDMTest)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>Email Template Page
doClick(emailTemplate);
Thread.sleep(5000);
By h1_header_emailTemp = By.xpath("//div[contains(text(),' Email Template ')]");
String emailTemp1 = " Email Template ";
System.out.print(driver.findElement(h1_header_emailTemp).getText());
String emailTemp = driver.findElement(h1_header_emailTemp).getText();
if (emailTemp1.equals(emailTemp)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>Export License Page
doClick(exportLicense);
Thread.sleep(5000);
By h1_header_exportLic = By.xpath("//h1[text()='Export License']");
String exportLic1 = "Export License";
System.out.print(driver.findElement(h1_header_exportLic).getText());
String exportLic = driver.findElement(h1_header_exportLic).getText();
if (exportLic1.equals(exportLic)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>Facilities Page
doClick(facilities);
Thread.sleep(5000);
By h1_header_facilityTest = By.xpath("//h1[text()='Facilities']");
String facilityTest1 = "Facilities";
System.out.print(driver.findElement(h1_header_facilityTest).getText());
String facilityTest = driver.findElement(h1_header_facilityTest).getText();
if (facilityTest1.equals(facilityTest)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>Generic Carriers Page
doClick(genCarrier);
Thread.sleep(5000);
By h1_header_genCarrierTest = By.xpath("//h2[text()='Generic Carriers']");
String genCarrier1 = "Generic Carriers";
System.out.print(driver.findElement(h1_header_genCarrierTest).getText());
String genCarrierTest = driver.findElement(h1_header_genCarrierTest).getText();
if (genCarrier1.equals(genCarrierTest)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>Hazmat Group Page
doClick(hazGrp);
Thread.sleep(5000);
By h1_header_hZGrpTest = By.xpath("//h1[text()='Hazmat Group']");
String hZGrp1 = "Hazmat Group";
System.out.print(driver.findElement(h1_header_hZGrpTest).getText());
String hZGrpTest = driver.findElement(h1_header_hZGrpTest).getText();
if (hZGrp1.equals(hZGrpTest)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>Products Page
doClick(prods);
Thread.sleep(5000);
By h1_header_prodsTest = By.xpath("//h1[text()='Products']");
String prods1 = "Products";
System.out.print(driver.findElement(h1_header_prodsTest).getText());
String prodsTest = driver.findElement(h1_header_prodsTest).getText();
if (prods1.equals(prodsTest)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>Proxy Settings Page
doClick(proxySettings);
Thread.sleep(5000);
By h1_header_prxySetTest = By.xpath("//h1[text()='Proxy Settings']");
String prxySet1 = "Proxy Settings";
System.out.print(driver.findElement(h1_header_prxySetTest).getText());
String prxySetTest = driver.findElement(h1_header_prxySetTest).getText();
if (prxySet1.equals(prxySetTest)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>Query Manager Page
doClick(qMgr);
Thread.sleep(5000);
By h1_header_queryMgrTest = By.xpath("//h2[text()='Query Manager']");
String queryMgr1 = "Query Manager";
System.out.print(driver.findElement(h1_header_queryMgrTest).getText());
String queryMgrTest = driver.findElement(h1_header_queryMgrTest).getText();
if (queryMgr1.equals(queryMgrTest)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>Ship Codes Page
doClick(shipCode);
Thread.sleep(10000);
By h1_header_shipViaCodeTest = By.xpath("//h2[text()='Ship Codes']");
String shipViaCode1 = "Ship Codes";
System.out.print(driver.findElement(h1_header_shipViaCodeTest).getText());
String shipViaCodeTest = driver.findElement(h1_header_shipViaCodeTest).getText();
if (shipViaCode1.equals(shipViaCodeTest)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>Shipping Charge Scheme Page
doClick(shipChargeSchema);
Thread.sleep(5000);
By h1_header_SCSTest = By.xpath("//h2[text()='Shipping Charge Schemes']");
String SCS1 = "Shipping Charge Schemes";
System.out.print(driver.findElement(h1_header_SCSTest).getText());
String SCSTest = driver.findElement(h1_header_SCSTest).getText();
if (SCS1.equals(SCSTest)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>Tariff Codes Page
doClick(triffCode);
Thread.sleep(5000);
By h1_header_codeTariff = By.xpath("//h1[text()='Tariff Codes']");
String codeTariff1 = "Tariff Codes";
System.out.print(driver.findElement(h1_header_codeTariff).getText());
String codeTariff = driver.findElement(h1_header_codeTariff).getText();
if (codeTariff1.equals(codeTariff)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
// *************** Setup screen >>Users Page
doClick(Usr);
Thread.sleep(5000);
By h2_header_codeTariff = By.xpath("//h2[text()='User Management']");
String usrTest1 = "User Management";
System.out.print(driver.findElement(h2_header_codeTariff).getText());
String usrTest = driver.findElement(h2_header_codeTariff).getText();
if (usrTest1.equals(usrTest)) {
System.out.print(": Heading matches : PASS " + " >> " + "URL is : " + driver.getCurrentUrl() + "\n");
} else {
System.out.println(" Heading mis-matches : FAIL");
}
doClick(home);
doClick(setup);
System.out.println("SetUp Page Links Working Fine====>> QA PASS");
stopwatch.stop(); // Optional
long timeElapsed = stopwatch.getTime();
System.out.println("Execution time in Seconds: " + timeElapsed/1000);
//methodToTime();
//Instant finish = Instant.now();
//long timeElapsed = Duration.between(start, finish).toMillis();
// Date endDate = new Date();
// Timestamp eD=new Timestamp(date.getTime());
// System.out.println(eD);
driver.quit();
}
public static WebElement getElement(By locator) {
return driver.findElement(locator);
}
public static void doSendKeys(By locator, String value) {
getElement(locator).sendKeys(value);
}
public static void doClick(By locator) {
getElement(locator).click();
}
public static void tdoClick(By locator) {
getElement(locator).click();
}
private static void methodToTime() {
try {
TimeUnit.SECONDS.sleep(3);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
public void selectDropDownValueWithoutSelectClass(By locator, String value) {
List<WebElement> industry_options_list = driver.findElements(locator);
for (WebElement ele : industry_options_list) {
String text = ele.getText();
if (text.equals(value)) {
ele.click();
break;
}
}
}
}
| 21,021 | 0.639521 | 0.624822 | 689 | 29.512337 | 29.331451 | 104 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 1.988389 | false | false |
9
|
667997ad8d4ab9f886a76ac7734512032aeec377
| 21,955,872,834,906 |
69ec9c8cd54492d686b241b5fdec16a90cd60e6c
|
/AiyaEffectSDK/libyuv/src/main/java/com/aiyaapp/aiya/AYYuvUtil.java
|
565d0c176768b4150fe96619786d14a6cf46a656
|
[] |
no_license
|
aiyaapp/AiyaEffectsAndroid
|
https://github.com/aiyaapp/AiyaEffectsAndroid
|
f856bb5fdfc0ebce30bfadea7c473b6a3587733a
|
d21a621004278e1f8c0c77e640318f32579660af
|
refs/heads/master
| 2022-12-01T06:08:14.840000 | 2022-11-30T10:27:45 | 2022-11-30T10:27:45 | 84,385,164 | 1,149 | 318 | null | false | 2019-10-10T07:06:11 | 2017-03-09T01:46:41 | 2019-10-08T08:13:12 | 2019-10-10T07:06:11 | 405,628 | 791 | 245 | 11 |
C++
| false | false |
package com.aiyaapp.aiya;
import java.nio.ByteBuffer;
public class AYYuvUtil {
static {
System.loadLibrary("libyuv");
}
// bgra 转 yuv
public static native void RGBA_To_I420(ByteBuffer bgra, ByteBuffer yuv, int width, int height);
// yuv 转 bgra
public static native void I420_To_RGBA(ByteBuffer yuv, ByteBuffer bgra, int width, int height);
}
|
UTF-8
|
Java
| 383 |
java
|
AYYuvUtil.java
|
Java
|
[] | null |
[] |
package com.aiyaapp.aiya;
import java.nio.ByteBuffer;
public class AYYuvUtil {
static {
System.loadLibrary("libyuv");
}
// bgra 转 yuv
public static native void RGBA_To_I420(ByteBuffer bgra, ByteBuffer yuv, int width, int height);
// yuv 转 bgra
public static native void I420_To_RGBA(ByteBuffer yuv, ByteBuffer bgra, int width, int height);
}
| 383 | 0.688654 | 0.672823 | 16 | 22.6875 | 31.037716 | 99 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.6875 | false | false |
9
|
3a5c8407abb38a76dceb4ab1a09bcb9a30ef4e76
| 11,141,145,188,179 |
544a182915e8d4a460734d552764f93b506aea7b
|
/src/test/java/org/hy/common/license/junit/SignHelper.java
|
c1d29b0036783cfa83ea69c4bbd703bdfed9803d
|
[
"Apache-2.0",
"LicenseRef-scancode-proprietary-license"
] |
permissive
|
HY-ZhengWei/hy.common.license
|
https://github.com/HY-ZhengWei/hy.common.license
|
f093864842c60055ce6529d05c4f1beaa98cc38f
|
f3974b32a70b30ed4e77961a01b3818d2b16a1f4
|
refs/heads/master
| 2023-06-10T05:56:02.873000 | 2023-06-06T01:26:35 | 2023-06-06T01:26:35 | 98,083,153 | 0 | 0 |
Apache-2.0
| false | 2020-10-13T01:25:11 | 2017-07-23T07:57:36 | 2020-09-16T07:17:18 | 2020-10-13T01:25:09 | 509 | 0 | 0 | 1 |
Java
| false | false |
package org.hy.common.license.junit;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.Base64;
import java.util.Map;
import java.util.TreeMap;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
/**
* 请求开放平台套件授权相关接口的加签类
*/
public class SignHelper {
/**
* 按参数名排序后依次拼接参数名称与数值,之后对该字符串使用 HmacSHA256 加签,加签结果进行 base 64 返回
* @param params 请求参数 map
* @param suiteSecret 套件密钥,用作 mac key
* @return 签名
* @throws NoSuchAlgorithmException
* @throws UnsupportedEncodingException
* @throws InvalidKeyException
*/
public static String sign(Map<String, String> params, String suiteSecret) throws NoSuchAlgorithmException, UnsupportedEncodingException, InvalidKeyException {
// use tree map to sort params by name
Map<String, String> treeMap;
if (params instanceof TreeMap) {
treeMap = params;
} else {
treeMap = new TreeMap<>(params);
}
StringBuilder stringBuilder = new StringBuilder();
for (Map.Entry<String, String> entry : treeMap.entrySet()) {
stringBuilder.append(entry.getKey()).append(entry.getValue());
}
System.out.println(stringBuilder.toString());
Mac mac = Mac.getInstance("HmacSHA256");
mac.init(new SecretKeySpec(suiteSecret.getBytes(StandardCharsets.UTF_8), "HmacSHA256"));
byte[] signData = mac.doFinal(stringBuilder.toString().getBytes(StandardCharsets.UTF_8));
String base64String = Base64.getEncoder().encodeToString(signData);
return URLEncoder.encode(base64String, "UTF-8");
}
}
|
UTF-8
|
Java
| 1,929 |
java
|
SignHelper.java
|
Java
|
[] | null |
[] |
package org.hy.common.license.junit;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.Base64;
import java.util.Map;
import java.util.TreeMap;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
/**
* 请求开放平台套件授权相关接口的加签类
*/
public class SignHelper {
/**
* 按参数名排序后依次拼接参数名称与数值,之后对该字符串使用 HmacSHA256 加签,加签结果进行 base 64 返回
* @param params 请求参数 map
* @param suiteSecret 套件密钥,用作 mac key
* @return 签名
* @throws NoSuchAlgorithmException
* @throws UnsupportedEncodingException
* @throws InvalidKeyException
*/
public static String sign(Map<String, String> params, String suiteSecret) throws NoSuchAlgorithmException, UnsupportedEncodingException, InvalidKeyException {
// use tree map to sort params by name
Map<String, String> treeMap;
if (params instanceof TreeMap) {
treeMap = params;
} else {
treeMap = new TreeMap<>(params);
}
StringBuilder stringBuilder = new StringBuilder();
for (Map.Entry<String, String> entry : treeMap.entrySet()) {
stringBuilder.append(entry.getKey()).append(entry.getValue());
}
System.out.println(stringBuilder.toString());
Mac mac = Mac.getInstance("HmacSHA256");
mac.init(new SecretKeySpec(suiteSecret.getBytes(StandardCharsets.UTF_8), "HmacSHA256"));
byte[] signData = mac.doFinal(stringBuilder.toString().getBytes(StandardCharsets.UTF_8));
String base64String = Base64.getEncoder().encodeToString(signData);
return URLEncoder.encode(base64String, "UTF-8");
}
}
| 1,929 | 0.69592 | 0.683622 | 55 | 31.527273 | 30.754662 | 162 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.545455 | false | false |
9
|
4baaa4152b644b9e2a7959f93332af90b2ff03df
| 1,864,015,846,617 |
4ab81c224734abd68611c30921449ac35f27b83c
|
/app/src/prod/java/br/com/githubrepos/data/service/impl/RepositoryServiceApiImpl.java
|
630d90f05652cc0c3c7819539de1137d303097e1
|
[] |
no_license
|
bedrickprokop/desafio-android
|
https://github.com/bedrickprokop/desafio-android
|
6fd53e15049cd5e06df845368dcd9e7c381d7a69
|
36be1f81bd1e735620cfd463dc72e28c478d4421
|
refs/heads/master
| 2020-06-30T07:08:41.147000 | 2019-08-07T03:50:57 | 2019-08-07T03:50:57 | 200,762,614 | 0 | 0 | null | true | 2019-08-06T02:35:28 | 2019-08-06T02:35:27 | 2019-06-13T14:19:17 | 2019-08-05T16:27:01 | 12 | 0 | 0 | 0 | null | false | false |
package br.com.githubrepos.data.service.impl;
import com.crashlytics.android.Crashlytics;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import br.com.githubrepos.data.HttpEndpointGenerator;
import br.com.githubrepos.data.endpoint.RepositoryEndpoint;
import br.com.githubrepos.data.entity.Repository;
import br.com.githubrepos.data.entity.RepositoryStatus;
import br.com.githubrepos.data.service.RepositoryServiceApi;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class RepositoryServiceApiImpl implements RepositoryServiceApi {
@Override
public void search(int page, String language, String sort,
final RepositoryServiceCallback<RepositoryStatus> callback) {
Map<String, String> options = new HashMap<>();
options.put("page", String.valueOf(page));
options.put("q", language);
options.put("sort", sort);
Call<RepositoryStatus> call = new HttpEndpointGenerator<RepositoryEndpoint>()
.gen(RepositoryEndpoint.class).search(options);
call.enqueue(new Callback<RepositoryStatus>() {
@Override
public void onResponse(Call<RepositoryStatus> call, Response<RepositoryStatus> response) {
RepositoryStatus body = response.body();
if (null == body) {
body = new RepositoryStatus(0, false, new ArrayList<Repository>());
}
callback.onLoaded(body);
}
@Override
public void onFailure(Call<RepositoryStatus> call, Throwable t) {
Crashlytics.logException(t);
try {
Response<RepositoryStatus> execute = call.execute();
String errorMessage = execute.message();
callback.onError(errorMessage);
} catch (IOException e) {
e.printStackTrace();
}
}
});
}
}
|
UTF-8
|
Java
| 2,046 |
java
|
RepositoryServiceApiImpl.java
|
Java
|
[] | null |
[] |
package br.com.githubrepos.data.service.impl;
import com.crashlytics.android.Crashlytics;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import br.com.githubrepos.data.HttpEndpointGenerator;
import br.com.githubrepos.data.endpoint.RepositoryEndpoint;
import br.com.githubrepos.data.entity.Repository;
import br.com.githubrepos.data.entity.RepositoryStatus;
import br.com.githubrepos.data.service.RepositoryServiceApi;
import retrofit2.Call;
import retrofit2.Callback;
import retrofit2.Response;
public class RepositoryServiceApiImpl implements RepositoryServiceApi {
@Override
public void search(int page, String language, String sort,
final RepositoryServiceCallback<RepositoryStatus> callback) {
Map<String, String> options = new HashMap<>();
options.put("page", String.valueOf(page));
options.put("q", language);
options.put("sort", sort);
Call<RepositoryStatus> call = new HttpEndpointGenerator<RepositoryEndpoint>()
.gen(RepositoryEndpoint.class).search(options);
call.enqueue(new Callback<RepositoryStatus>() {
@Override
public void onResponse(Call<RepositoryStatus> call, Response<RepositoryStatus> response) {
RepositoryStatus body = response.body();
if (null == body) {
body = new RepositoryStatus(0, false, new ArrayList<Repository>());
}
callback.onLoaded(body);
}
@Override
public void onFailure(Call<RepositoryStatus> call, Throwable t) {
Crashlytics.logException(t);
try {
Response<RepositoryStatus> execute = call.execute();
String errorMessage = execute.message();
callback.onError(errorMessage);
} catch (IOException e) {
e.printStackTrace();
}
}
});
}
}
| 2,046 | 0.636852 | 0.634897 | 57 | 34.894737 | 26.859404 | 102 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.684211 | false | false |
9
|
deb4fb8ed1d09d6f4aef63d678de4e50ed24bcb8
| 4,887,672,815,170 |
f83670babb5d044f7c71d47a521bbb44700114b2
|
/creational/abstractFactory/MainFactoryProvider.java
|
e1940238fae43a6892b943b15a0c69ad0fdadaa3
|
[] |
no_license
|
yangnn/design-pattern
|
https://github.com/yangnn/design-pattern
|
44437f6c2d063c1c7adc59ad615eb4ea7459bef7
|
a70176834c16641fe82e23ddb73e427333290bf0
|
refs/heads/master
| 2021-01-10T01:22:43.604000 | 2015-10-22T09:10:12 | 2015-10-22T09:10:12 | 44,715,880 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package abstractFactory;
import builder.MailSender;
import builder.Sender;
public class MainFactoryProvider implements Provider{
@Override
public Sender produce() {
// TODO Auto-generated method stub
return new MailSender();
}
}
|
UTF-8
|
Java
| 240 |
java
|
MainFactoryProvider.java
|
Java
|
[] | null |
[] |
package abstractFactory;
import builder.MailSender;
import builder.Sender;
public class MainFactoryProvider implements Provider{
@Override
public Sender produce() {
// TODO Auto-generated method stub
return new MailSender();
}
}
| 240 | 0.770833 | 0.770833 | 14 | 16.142857 | 16.146017 | 53 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.785714 | false | false |
9
|
ae2c1bb754d150b126f9183578942a242d512418
| 10,977,936,445,402 |
4b4150bff2db04d84c67ea97e32f37a61f163679
|
/src/Interface00P2/Phone.java
|
4c047e5cfa3f50a54d3d73bcca701ba72cfefaf1
|
[] |
no_license
|
m3rv3s/zerotohero
|
https://github.com/m3rv3s/zerotohero
|
3c03d6b2a07f79c27173d5977518c42e89db078d
|
391035ca7762c57ff9b5e89b2ce94d97eb19693e
|
refs/heads/master
| 2020-11-24T15:42:35.479000 | 2019-12-15T17:25:22 | 2019-12-15T17:25:22 | 228,222,218 | 0 | 0 | null | null | null | null | null | null | null | null | null | null | null | null | null |
package Interface00P2;
public abstract class Phone extends Object implements flashCard ,FaceRecognition {
public Phone(){
System.out.println("I am Phone Constructor");
}
String name;
String model;
int size;
public abstract void call();
public abstract void text();
public abstract void takePicture();
}
|
UTF-8
|
Java
| 353 |
java
|
Phone.java
|
Java
|
[] | null |
[] |
package Interface00P2;
public abstract class Phone extends Object implements flashCard ,FaceRecognition {
public Phone(){
System.out.println("I am Phone Constructor");
}
String name;
String model;
int size;
public abstract void call();
public abstract void text();
public abstract void takePicture();
}
| 353 | 0.674221 | 0.665722 | 21 | 15.809524 | 21.384504 | 83 | false | false | 0 | 0 | 0 | 0 | 0 | 0 | 0.428571 | false | false |
9
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.